.lead {
  color: var(--text-sub);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* ===== レイアウト ===== */
.main-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

@media (max-width: 540px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .diagram-card {
    max-width: 210px;
    margin: 0 auto;
  }
}

/* ===== みはじ図 ===== */
.diagram-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.mihaji-svg {
  width: 100%;
  max-width: 180px;
}

.seg {
  fill: var(--bg);
  transition: fill 0.2s;
}

.seg.calc-target {
  fill: #dbeafe;
}

[data-theme="dark"] .seg {
  fill: #1e293b;
}
[data-theme="dark"] .seg.calc-target {
  fill: #172554;
}

.circle-outline {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
}

.divider {
  stroke: var(--border);
  stroke-width: 2;
}

.seg-label {
  font-size: 13px;
  font-weight: 700;
  fill: var(--text);
  transition: fill 0.2s;
}

.seg-label.calc-target { fill: #1d4ed8; }

.seg-formula {
  font-size: 12px;
  fill: var(--text-sub);
  transition: fill 0.2s;
}

.seg-formula.calc-target { fill: #2563eb; }

.diagram-note {
  font-size: 0.72rem;
  color: var(--text-sub);
  text-align: center;
  line-height: 1.6;
}

/* ===== 入力エリア ===== */
.inputs-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-card {
  padding: 0.8rem 1rem;
  transition: border-color 0.2s;
}

.input-card.calc-target {
  border-color: #93c5fd;
}

[data-theme="dark"] .input-card.calc-target {
  border-color: #1d4ed8;
}

.input-label-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.field-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.field-badge {
  font-size: 0.72rem;
  color: #2563eb;
  font-weight: 600;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.input-row input {
  flex: 1;
  min-width: 0;
}

/* ===== 単位ボタングループ ===== */
.unit-group {
  display: flex;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.unit-btn {
  padding: 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  line-height: 1;
}

.unit-btn:first-child {
  border-left: none;
}

.unit-btn.active {
  background: var(--text);
  color: var(--surface);
}

.unit-btn:hover:not(.active) {
  background: var(--border);
  color: var(--text);
}

/* ===== プリセット ===== */
.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.presets-label {
  font-size: 0.72rem;
  color: var(--text-sub);
}

.preset-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.preset-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* ===== インラインエラー ===== */
.error-msg {
  font-size: 0.85rem;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 0.55rem 0.8rem;
}

[data-theme="dark"] .error-msg {
  background: #2d1414;
  border-color: #7f1d1d;
  color: #f87171;
}

/* ===== 結果 ===== */
.result-card {
  margin-top: 0;
}

.result-formula {
  font-size: 0.88rem;
  color: var(--text-sub);
  line-height: 1.9;
  white-space: pre-line;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
}

.result-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.result-conversions {
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.8;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.result-conversions strong {
  color: var(--text);
  font-weight: 600;
}

.result-hms {
  font-size: 0.88rem;
  color: var(--text-sub);
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}
