/* yochien-menseki tool styles (loaded after base.css). No inline styles (CSP). */

.h1-sub { display: block; font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-top: var(--space-1); }
#tool-form > fieldset, #tool-form > details, #tool-form > .field { margin-bottom: var(--space-3); }
.verified { font-size: 0.875rem; color: var(--text-muted); margin: 0 0 var(--space-2); }
.verified .badge { border-color: var(--ok); color: var(--ok); }
.quick-result { font-weight: 700; color: var(--accent); margin: 0; min-height: 1.5em; }
.save-line { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.btn-link { font: inherit; background: none; border: 0; padding: 0.5rem 0; min-height: 2.75rem; color: var(--accent); text-decoration: underline; cursor: pointer; }
.choice { display: flex; align-items: center; gap: var(--space-2); font-weight: 400 !important; min-height: 2.75rem; }
.choice input { width: 1.2rem; height: 1.2rem; flex: none; }
details.options summary { cursor: pointer; font-weight: 600; min-height: 2.75rem; display: flex; align-items: center; }
.print-grid, .area-grid, .limit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0 var(--space-2); margin-bottom: var(--space-2); }
.limit-grid { margin-top: var(--space-2); }
.limit-grid .hint { grid-column: 1 / -1; margin: 0; }
.limit-grid input, .kid-grid input { max-width: 7rem; text-align: right; }
.kid-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 var(--space-2); }
.kid-grid .field { margin-bottom: var(--space-2); display: flex; flex-direction: column; justify-content: flex-start; }
.kid-grid .field label { flex: 1 0 auto; display: flex; align-items: flex-end; }
.example-label { display: inline-block; font-size: 0.875rem; font-weight: 600; background: var(--mark-bg); color: var(--mark-text); padding: 0 var(--space-2); border-radius: 4px; margin-bottom: var(--space-2); }
.top-summary { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.top-summary .quick-result { flex: 1 1 14rem; }
.top-summary .quick-result::before { content: "いまの結果: "; }
.top-summary #prefill-status { flex: 1 1 100%; margin: 0; }

/* ---------- Results ---------- */
.verdict-ok { color: var(--ok); }
.verdict-ng { color: var(--danger); }
.verdict-calc, .verdict-empty { color: var(--accent); }
.result-plain { margin-bottom: var(--space-2); }
.reason-list { border-left: 4px solid var(--danger); background: var(--accent-soft); padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 1.2em); border-radius: 4px; }
.result-block { margin: var(--space-3) 0; }
.result-block h3 { margin-bottom: var(--space-1); }
.settings { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-2); font-size: 0.875rem; margin: var(--space-3) 0; }
.settings dt { font-weight: 600; color: var(--text-muted); }
.settings dd { margin: 0; }
.result-table caption { text-align: left; font-weight: 700; padding: var(--space-2) 0; }
.result-table th.num, .result-table td.num { text-align: right; white-space: nowrap; }
.result-table .strong, .strong { font-weight: 700; }
.result-table td.calc { font-family: var(--font-mono); font-size: 0.85rem; }
.result-table tfoot th, .result-table tfoot td { font-weight: 700; }
.class-table { min-width: 22rem; }
.terms-table { min-width: 30rem; }
.judge-table tr.is-ng th, .judge-table tr.is-ng td { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.cell-sub { display: block; font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.short { color: var(--danger); }
.plus { color: var(--danger); font-weight: 700; }
.status { font-weight: 700; white-space: nowrap; }
.status-ok { color: var(--ok); }
.status-ng { color: var(--danger); }
.status-na { color: var(--text-muted); }
.cap-list { padding-left: 1.2em; }
.crosslink { margin: var(--space-3) 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.result-notes { margin-top: var(--space-3); }
.result-notes ul { padding-left: 1.2em; }
.note-info, .note-warn {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  padding: var(--space-2) var(--space-3); border-radius: 4px; font-size: 0.9rem;
}
.note-warn { border-left-color: var(--danger); }

.rule-table { min-width: 34rem; margin-bottom: var(--space-3); }
.hayami { min-width: 24rem; }
.sources li { margin-bottom: var(--space-1); }

/* Keep the first column visible while a wide table scrolls sideways (same idea as hoiku-menseki). */
.result-table tbody th, .result-table tfoot th, .result-table thead th:first-child {
  position: sticky; left: 0; background: var(--surface); z-index: 1;
}
.narrow-only { display: none; }
.result-toc ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); list-style: none; padding: 0; margin: 0 0 var(--space-2); font-size: 0.875rem; }
.result-toc a { display: inline-block; min-height: 2.75rem; padding: 0.6rem 0; }
.alt-note { margin-top: var(--space-2); }
.alt-note p { margin-bottom: var(--space-1); }
.compare-table, .judge-table { min-width: 20rem; }

@media (max-width: 40rem) {
  /* Formula column -> small text under the item name, so the breakdown fits a phone width. */
  .result-table .wide-only { display: none; }
  .result-table .narrow-only { display: block; font-family: var(--font-mono); }
  .terms-table { min-width: 0; }
  .class-table { min-width: 20rem; }
}

@media print {
  .no-print { display: none !important; }
  thead { display: table-header-group; }
  .results { break-inside: auto; }
  .print-header { margin-bottom: 6pt; }
  .print-title { font-size: 14pt; font-weight: 700; margin: 0 0 4pt; }
  .print-meta { display: grid; grid-template-columns: repeat(3, max-content 1fr); gap: 2pt 6pt; margin: 0; font-size: 10pt; }
  .print-meta dt { font-weight: 700; }
  .print-meta dd { margin: 0; border-bottom: 1px solid #000; min-width: 6em; }
  .print-meta dd.sign { min-height: 2.2em; }
  .table-scroll { overflow: visible; }
  .result-table tbody th, .result-table tfoot th, .result-table thead th:first-child { position: static; }
  .result-table .wide-only { display: table-cell; }
  .result-table .narrow-only { display: none; }
  .class-table, .terms-table, .compare-table, .judge-table { min-width: 0; font-size: 9pt; }
  .result-table th, .result-table td { padding: 1px 4px; }
  .judge-table tr.is-ng th, .judge-table tr.is-ng td { background: #eee; }
  .result-table td.calc { font-size: 8pt; }
  .result-table tr { break-inside: avoid; }
}
