/* App-specific styling on top of Beer CSS (Material Design 3). Tokens come from theme-tokens.css. */

:root {
  --font: "Inter", "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", sans-serif;
}

/* wider content area and a slightly larger type scale than Beer's 14px default */
:root { --size: 17px; }
body { font-size: .95rem; line-height: 1.65rem; }
.small-text { font-size: .82rem; }
main.responsive { max-width: 1400px; padding-bottom: 6rem; }
main > article:last-child, main > div:last-child { margin-bottom: 1.5rem; }
table.data td, table.data th { font-size: .92rem; }
table.data th { font-size: .8rem; }

/* checklist rows (checkbox + wrapping text) */
.check-row { display: grid; grid-template-columns: auto 1fr; gap: .25rem .5rem; align-items: start; padding: .4rem 0; border-bottom: 1px solid var(--outline-variant); }
.check-row:last-of-type { border-bottom: 0; }
.check-row .checkbox { margin: 0; }
.check-row .text { line-height: 1.5; }

/* page header */
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.page-title h3, .page-title h4 { margin: 0; }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--on-surface-variant); }

/* numbers */
.num { font-variant-numeric: tabular-nums; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.kpi article { margin: 0; }
.kpi .value { font-size: 2rem; line-height: 1.1; font-weight: 500; letter-spacing: -.02em; }
.kpi .label { color: var(--on-surface-variant); font-size: .8rem; }

/* verdict chips (hook leak) */
.verdict { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 500; white-space: nowrap; }
.verdict.healthy { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.verdict.leaking { background: var(--secondary-container); color: var(--on-secondary-container); }
.verdict.severe  { background: var(--error-container); color: var(--on-error-container); }

/* cliffs */
.cliff { display: grid; grid-template-columns: 4.5rem 4.5rem 1fr; gap: .25rem 1rem; padding: .7rem .25rem; border-bottom: 1px solid var(--outline-variant); align-items: baseline; }
.cliff:last-child { border-bottom: 0; }
.cliff .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.cliff .lost { color: var(--error); font-variant-numeric: tabular-nums; font-weight: 500; }
.cliff .said { color: var(--on-surface-variant); line-height: 1.5; }
.cliff .said:empty::before { content: "(字幕なし)"; opacity: .6; }

/* retention curve */
.curve { width: 100%; height: 180px; display: block; border-radius: 1rem; background: var(--surface-container-low); }
.curve .grid-line { stroke: var(--outline-variant); }
.curve .line { stroke: var(--primary); fill: none; stroke-width: 2.5; }
.curve .fill { fill: var(--primary); opacity: .12; }
.curve .cliff-mark { stroke: var(--error); stroke-dasharray: 3 3; }
.curve .hook-zone { fill: var(--secondary); opacity: .08; }

/* script */
pre.script { white-space: pre-wrap; font: inherit; line-height: 1.75; margin: 0; }
pre.script-beat { white-space: pre-wrap; font: inherit; margin: 0; }
.hook-card.chosen { outline: 2px solid var(--primary); }
.scores { display: flex; gap: .4rem .9rem; flex-wrap: wrap; color: var(--on-surface-variant); font-size: .8rem; }
.scores b { color: var(--on-surface); font-weight: 500; }

/* tables */
table.data th { color: var(--on-surface-variant); font-weight: 500; font-size: .8rem; }
table.data td, table.data th { vertical-align: middle; }
img.thumb { width: 88px; height: 50px; object-fit: cover; border-radius: .6rem; display: block; }

/* misc */
.muted { color: var(--on-surface-variant); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; letter-spacing: -.01em; }
.brand i { color: var(--primary); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.left a.active { color: var(--primary); }
@media (max-width: 600px) { .cliff { grid-template-columns: 3.5rem 3.5rem 1fr; } .kpi .value { font-size: 1.6rem; } }

/* rendered script */
.script-body { line-height: 1.8; }
.beat-title { display: flex; align-items: baseline; gap: .6rem; font-weight: 600; font-size: 1.05rem; margin: 1.25rem 0 .4rem; color: var(--primary); }
.beat-title:first-child { margin-top: 0; }
.beat-ts { font-variant-numeric: tabular-nums; font-size: .8rem; font-weight: 500; padding: .05rem .5rem; border-radius: 999px; background: var(--primary-container); color: var(--on-primary-container); }
.beat-line { margin: .2rem 0; }
.beat-line strong { color: var(--on-surface); font-weight: 600; }
.beat-sep { border: 0; border-top: 1px solid var(--outline-variant); margin: .75rem 0; }
.onscreen { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: .5rem; background: var(--surface-container-high); color: var(--on-surface-variant); font-size: .85rem; }
.todo { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: .5rem; background: var(--error-container); color: var(--on-error-container); font-size: .85rem; }
.sref { font-size: .72rem; vertical-align: super; color: var(--primary); text-decoration: none; margin-left: .1rem; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }

/* spacing helper: Beer's *margin* helpers zero the parent's padding, so use this instead */
.mt { margin-top: .9rem; }

/* approval gate */
.gate { border-left: 4px solid var(--primary); }
.gate-title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; color: var(--primary); }
.gate .row { flex-wrap: wrap; align-items: center; }
.gate .row .field { flex: 1 1 240px; }
.title-edit .field input { font-size: 1.35rem; font-weight: 600; }
.title-edit .field { margin-bottom: .25rem; }
.gate { margin-top: 1.5rem; }
