.roman-tool,
.roman-tool * {
  box-sizing: border-box;
}
.roman-layout {
  align-items: stretch;
  row-gap: 16px;
}
.roman-input-panel,
.roman-result-panel {
  height: 100%;
  min-width: 0;
  overflow: hidden;
}
.roman-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.roman-panel-header i {
  margin-right: 6px;
}
.roman-status {
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
}
.roman-input-body,
.roman-result-body {
  background: #fff;
}
.roman-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.roman-mode-toggle label {
  margin: 0;
}
.roman-mode-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.roman-mode-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}
.roman-mode-toggle input:checked + span {
  border-color: rgba(37, 99, 235, .35);
  background: var(--primary-soft);
  color: var(--primary);
}
.roman-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}
.roman-field > span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.roman-textarea {
  min-height: 190px;
  resize: vertical;
  font-family: var(--mono);
  line-height: 1.55;
}
.roman-input-meta {
  min-height: 20px;
  margin-top: 8px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.45;
}
.roman-quick-row,
.roman-action-row {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.roman-quick-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.roman-action-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}
.roman-quick-row .btn,
.roman-action-row .btn {
  min-width: 0;
  justify-content: center;
  white-space: nowrap;
}
.roman-quick-row .btn i,
.roman-action-row .btn i {
  margin-right: 6px;
}
.roman-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 38, 38, .25);
  border-radius: var(--radius);
  background: rgba(220, 38, 38, .08);
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.45;
}
.roman-result-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(37, 99, 235, .22);
  border-radius: var(--radius);
  background: var(--primary-soft);
}
.roman-result-card > span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.roman-result-value {
  display: block;
  min-height: 42px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.roman-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.roman-detail-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.roman-detail-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-3);
  font-size: 12px;
}
.roman-detail-item strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roman-steps-panel,
.roman-reference {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.roman-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 700;
}
.roman-section-title i {
  color: var(--primary);
}
.roman-steps-empty {
  color: var(--text-3);
  font-size: 13px;
}
.roman-step-list {
  display: grid;
  gap: 8px;
}
.roman-step {
  display: grid;
  grid-template-columns: minmax(70px, auto) 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 13px;
}
.roman-step strong {
  color: var(--primary);
}
.roman-step span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.roman-reference-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.roman-reference-grid span {
  padding: 8px 6px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: center;
}
:root[data-theme="dark"] .roman-input-body,
:root[data-theme="dark"] .roman-result-body {
  background: #161b22;
}
:root[data-theme="dark"] .roman-message {
  color: #fca5a5;
  background: rgba(248, 113, 113, .1);
  border-color: rgba(248, 113, 113, .24);
}
@media (max-width: 991px) {
  .roman-detail-grid {
    grid-template-columns: 1fr;
  }
  .roman-reference-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .roman-mode-toggle,
  .roman-quick-row,
  .roman-action-row {
    grid-template-columns: 1fr;
  }
  .roman-result-value {
    font-size: 23px;
  }
  .roman-reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .roman-step {
    grid-template-columns: 1fr;
  }
}
