/* beancountr design tokens (CLAUDE.md → Design). Light by default; .dark for the shot timer. */
@font-face { font-family: 'DM Sans'; src: url(/fonts/dm-sans.woff2) format('woff2'); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(/fonts/fraunces.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #F4EEE5; --ink: #24170F; --act: #A5571F; --muted: #6F6052; --good: #6F8A5B;
  --card: #FFFFFF; --soft: #FBF8F3; --line: #E3D8C9; --chip: #EAE0D3; --on-act: #FFF8F0; --err: #9B2C1C;
  --r: 14px; --tap: 48px;
  --sans: 'DM Sans', system-ui, sans-serif; --serif: 'Fraunces', Georgia, serif;
}
.dark { --bg: #17110D; --ink: #F1E7DA; --act: #D9864A; --muted: #B8A690; --good: #8FAF78; --card: #221912; --soft: #221912; --line: #2E231C; --chip: #2E231C; --on-act: #17110D; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
main { max-width: 480px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom)); min-height: 100vh; display: flex; flex-direction: column; }
h1 { font: 500 34px/1.1 var(--serif); letter-spacing: -0.02em; margin: 22px 0 6px; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 24px 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--act); }
.mut { color: var(--muted); font-size: 14px; }
.num { font-family: var(--serif); font-variant-numeric: tabular-nums; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 30px; height: 30px; }
.word { font-size: 22px; font-weight: 600; letter-spacing: -0.045em; }
.word span { color: var(--act); }
.top { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 12px; min-height: var(--tap); padding: 10px 14px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--act); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 400; color: var(--ink); }
.check input { width: 22px; min-height: 22px; margin-top: 1px; accent-color: var(--act); }

.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; border-radius: 28px; border: 0; font: 600 16px var(--sans); cursor: pointer; text-decoration: none; margin-top: 18px; }
.btn.go { background: var(--act); color: var(--on-act); }
.btn.line { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.quiet { background: transparent; color: var(--muted); min-height: var(--tap); margin-top: 6px; }
.btn:disabled { opacity: 0.6; }
.link { background: none; border: 0; padding: 0 4px; min-height: var(--tap); font: 600 14px var(--sans); color: var(--act); cursor: pointer; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip { display: inline-block; text-decoration: none; color: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--chip); }
.chip.good { background: #E3EBDC; color: #3F5531; }
.err { color: var(--err); font-size: 14px; margin-top: 12px; }
.grow { flex: 1; }

/* ---------- layout pieces ---------- */
body.dark { background: var(--bg); }
main.withnav { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.top { gap: 8px; }
.toptitle { flex: 1; font-size: 15px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topright { display: flex; align-items: center; justify-content: flex-end; min-width: 44px; gap: 6px; }
.iconbtn { width: 44px; height: 44px; margin-left: -10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: none; border: 0; cursor: pointer; }
.lead { font-size: 15px; color: var(--muted); margin: 0 0 18px; }
.kicker { font-size: 12px; color: var(--muted); }
.h-serif { font: 500 21px/1.2 var(--serif); letter-spacing: -0.01em; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; height: calc(76px + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom); background: var(--soft); border-top: 1px solid var(--line); z-index: 5; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: var(--tap); justify-content: center; text-decoration: none; font-size: 11px; color: var(--muted); }
.tabbar a.on { color: var(--act); font-weight: 600; }
.tabbar .tabshot { justify-self: center; width: 56px; height: 56px; border-radius: 28px; background: var(--ink); color: var(--bg); margin-top: -18px; }

.search { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.search input { border: 0; background: transparent; padding: 0; min-height: 46px; }
.search input:focus { outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fchip { min-height: 36px; padding: 0 14px; border-radius: 18px; font: 600 13px var(--sans); cursor: pointer; background: transparent; color: var(--ink); border: 1px solid #CFC3B3; }
.fchip[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.pick { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-align: left; font: inherit; color: var(--ink); cursor: pointer; text-decoration: none; }
.pick.on { border: 1.5px solid var(--act); }
.pick .ini { width: 44px; height: 44px; border-radius: 10px; background: #EFE6DA; display: flex; align-items: center; justify-content: center; font: 600 18px var(--serif); flex-shrink: 0; }
.pick .sw { width: 44px; height: 56px; border-radius: 10px; background: #3B2618; flex-shrink: 0; }
.pick .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pick .t1 { font-size: 16px; font-weight: 600; }
.pick .t2 { font-size: 13px; color: var(--muted); }
.pick .val { font: 600 20px var(--serif); }

.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 14px; background: var(--chip); }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 600 14px var(--sans); cursor: pointer; line-height: 1.2; }
.seg button[aria-pressed=true], .seg button[aria-selected=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(36,23,15,.12); }
.dark .seg button[aria-pressed=true] { background: var(--ink); color: var(--bg); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.tile.hero { background: #24170F; color: #F4EEE5; border-color: #24170F; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile.hero .k { color: #CDBBA6; }
.tile .v { font: 500 26px/1.15 var(--serif); }
.tile .v small { font-size: 15px; color: var(--muted); }
.tile .n { font-size: 12px; color: var(--muted); }
.tile.hero .n { color: #E7A673; }

.scale { display: grid; grid-template-columns: 90px 1fr; align-items: center; column-gap: 10px; margin: 6px 0 14px; }
.slabel { font-size: 13px; font-weight: 600; grid-row: 1 / span 2; }
.strack { position: relative; height: 18px; }
.strack::before { content: ''; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: #D8CCBC; }
.strack .smid { position: absolute; left: 50%; top: 3px; width: 2px; height: 12px; background: #B5A795; }
.strack b { position: absolute; top: 1px; width: 16px; height: 16px; border-radius: 8px; background: var(--act); }
.sl, .sr { font-size: 11px; color: var(--muted); grid-column: 2; grid-row: 2; }
.sr { justify-self: end; }
.snote { grid-column: 2; font-size: 12px; color: var(--ink); margin-top: 2px; }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--chip); font-size: 13px; line-height: 1.45; margin-top: 12px; }
.next { margin-top: 14px; padding: 16px; border-radius: 18px; background: #24170F; color: #F4EEE5; display: flex; flex-direction: column; gap: 8px; }
.next .k { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #E7A673; }
.next .v { font: 500 22px/1.25 var(--serif); }
.next .r { font-size: 13px; line-height: 1.45; color: #CDBBA6; }

.stars { display: flex; gap: 2px; }
.stars button { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; color: var(--act); display: flex; align-items: center; justify-content: center; padding: 0; }
.stars button.on svg { fill: var(--act); }

table.log { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.log th { text-align: left; font-weight: 500; color: var(--muted); padding: 6px 4px 6px 0; }
table.log td { border-top: 1px solid var(--line); padding: 10px 4px 10px 0; }
table.log tr.rec td { font-weight: 600; }
.btnrow { display: flex; gap: 10px; }
.btnrow .btn { flex: 1; font-size: 15px; }
.empty { text-align: center; padding: 28px 10px; color: var(--muted); }

/* shot timer */
.ring { position: relative; width: 268px; height: 268px; margin: 22px auto 0; }
.ring svg { position: absolute; inset: 0; }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring .t { font: 500 84px/1 var(--serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring .t small { font-size: 40px; color: var(--muted); }
.zone { margin-top: 8px; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.06); color: #E7A673; }
.zone.ok { color: var(--good); }
.startbtn { display: block; margin: 22px auto 0; width: 140px; min-height: 56px; border-radius: 28px; border: 0; cursor: pointer; font: 700 17px var(--sans); background: var(--act); color: var(--on-act); }
.startbtn.run { background: var(--ink); color: var(--bg); }
.meas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.meas > div { padding: 8px 12px; border-radius: 14px; background: var(--card); display: flex; flex-direction: column; }
.meas > div.focus { border: 1.5px solid var(--act); }
.meas > div:focus-within { box-shadow: 0 0 0 2px var(--act); }
.meas input:focus { outline: none; }
.meas label { margin: 0; font-size: 12px; font-weight: 400; }
.meas input { border: 0; background: transparent; padding: 0; min-height: 36px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meas .ro { font-size: 22px; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.dark .btn.line { color: var(--ink); border-color: var(--ink); }
.light-btn { background: var(--ink); color: var(--bg); }

/* coach */
.pick.todo { align-items: flex-start; }
.pick.todo .box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #CFC3B3; flex-shrink: 0; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.pick.todo.on .box { background: var(--good); border-color: var(--good); }
.pick.todo.on .t1 { color: var(--muted); }
.pick.todo .t2 b { color: var(--ink); }
.taste { display: flex; flex-direction: column; gap: 6px; }
.taste button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.taste button.on { border: 1.5px solid var(--act); box-shadow: 0 0 0 2px rgba(165,87,31,.12); }
.taste .txt { display: flex; flex-direction: column; }
.taste .t1 { font-weight: 600; font-size: 15px; }
.taste .t2 { font-size: 12px; color: var(--muted); }
.dot { width: 14px; height: 14px; border-radius: 7px; flex-shrink: 0; }
.dot.t0 { background: #D9B23A; } .dot.t1 { background: #E2CC7E; } .dot.t2 { background: var(--good); } .dot.t3 { background: #9B6A48; } .dot.t4 { background: #5A3820; }
.next .expect { color: #8FAF78; }
ol.steps { margin: 0 0 6px; padding-left: 20px; font-size: 15px; line-height: 1.6; }
.hero-card { display: block; margin-bottom: 14px; padding: 18px; border-radius: 20px; background: #24170F; color: #F4EEE5; text-decoration: none; }
.hero-card .k { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #E7A673; }
.hero-card .b { font: 500 26px/1.15 var(--serif); margin: 6px 0 4px; }
.hero-card .l { font-size: 14px; color: #CDBBA6; line-height: 1.45; }
.hero-card .go { display: inline-flex; align-items: center; margin-top: 14px; min-height: 48px; padding: 0 22px; border-radius: 24px; background: #D9864A; color: #17110D; font-weight: 700; }
