/* Wingspan Companion — styles */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,700;1,9..144,400&family=Source+Sans+3:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  color-scheme: light;
  --bg: #edf0e8;
  --surface: #fbfbf7;
  --surface-2: #f3f5ee;
  --ink: #1b261f;
  --ink-2: #4f5e55;
  --ink-3: #7b8980;
  --line: #d6dccf;
  --line-2: #e6eadf;
  --accent: #2f6e93;
  --accent-ink: #ffffff;
  --forest: #3f7d4e;
  --grassland: #c9962b;
  --wetland: #3b7fa8;
  --brown: #8b5e34;
  --pink: #c9578a;
  --teal: #2a8c8c;
  --yellow: #c9a017;
  --white-pw: #e9e6dc;
  --danger: #b4443a;
  --focus: #2f6e93;
  --shadow: 0 1px 2px rgba(27,38,31,.08), 0 8px 24px rgba(27,38,31,.08);
  --radius: 14px;
  --radius-s: 8px;
  /* chart series (validated default palette, light) */
  --s1:#2a78d6; --s2:#eb6834; --s3:#1baf7a; --s4:#eda100; --s5:#e87ba4; --s6:#008300; --s7:#6250d6; --s8:#e34948;
  --grid: #e3e7dc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121817; --surface: #1b2322; --surface-2: #212b2a;
    --ink: #eaeee6; --ink-2: #aeb9b0; --ink-3: #7f8b84;
    --line: #2d3837; --line-2: #263130;
    --accent: #6fb0d6; --accent-ink: #0f1a20;
    --forest: #5fa06f; --grassland: #d8a93f; --wetland: #5f9fc6;
    --brown: #b07a48; --pink: #e07aa8; --teal: #46a9a9; --yellow: #dcb33a; --white-pw: #d9d6cb;
    --danger: #e07068; --focus: #6fb0d6;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --s1:#3987e5; --s2:#d95926; --s3:#199e70; --s4:#c98500; --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767;
    --grid: #263130;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121817; --surface: #1b2322; --surface-2: #212b2a;
  --ink: #eaeee6; --ink-2: #aeb9b0; --ink-3: #7f8b84;
  --line: #2d3837; --line-2: #263130;
  --accent: #6fb0d6; --accent-ink: #0f1a20;
  --forest: #5fa06f; --grassland: #d8a93f; --wetland: #5f9fc6;
  --brown: #b07a48; --pink: #e07aa8; --teal: #46a9a9; --yellow: #dcb33a; --white-pw: #d9d6cb;
  --danger: #e07068; --focus: #6fb0d6;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --s1:#3987e5; --s2:#d95926; --s3:#199e70; --s4:#c98500; --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767;
  --grid: #263130;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  font-size: 17px; line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  background-image:
    radial-gradient(900px 600px at -10% -10%, color-mix(in srgb, var(--forest) 16%, transparent), transparent 70%),
    radial-gradient(700px 500px at 110% 20%, color-mix(in srgb, var(--grassland) 14%, transparent), transparent 70%),
    radial-gradient(900px 700px at 50% 120%, color-mix(in srgb, var(--wetland) 16%, transparent), transparent 70%);
  background-attachment: fixed;
}
/* feather texture, theme-aware via mask */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--ink); opacity: .045;
  -webkit-mask-image: url(img/bg/feathers.svg); mask-image: url(img/bg/feathers.svg);
  -webkit-mask-size: 220px 260px; mask-size: 220px 260px;
}
:root[data-theme="dark"] body::before { opacity: .07; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { opacity: .07; } }
h1,h2,h3,h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75em; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img { display: inline-block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ── Header ── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.top::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: min(60vw, 520px); pointer-events: none;
  background: var(--ink); opacity: .10;
  -webkit-mask: url(img/bg/flock.svg) right center / auto 150% no-repeat; mask: url(img/bg/flock.svg) right center / auto 150% no-repeat;
  -webkit-mask-composite: source-in; 
}
.top { background-image: linear-gradient(90deg, color-mix(in srgb, var(--forest) 18%, transparent), color-mix(in srgb, var(--grassland) 12%, transparent) 50%, color-mix(in srgb, var(--wetland) 18%, transparent)); }
.top-in { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand .crumb { display: block; font-size: .72rem; color: var(--ink-2); font-weight: 600; letter-spacing: .01em; line-height: 1; margin-bottom: 3px; }
.brand .crumb:hover { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand h1 { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.brand .habs { display: flex; gap: 3px; }
.brand .habs i { width: 8px; height: 22px; border-radius: 3px; display: block; }
.brand .habs i:nth-child(1){ background: var(--forest); height: 16px; margin-top: 6px; }
.brand .habs i:nth-child(2){ background: var(--grassland); }
.brand .habs i:nth-child(3){ background: var(--wetland); height: 18px; margin-top: 2px; }
.top nav { display: none; margin-left: auto; gap: 4px; }
.top nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.top nav a.on { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.icon-btn { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.top nav + .icon-btn { margin-left: 8px; }

/* ── Bottom tabs (mobile) ── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px 6px; text-decoration: none; color: var(--ink-3); font-size: .75rem; font-weight: 600; }
.tabs a svg { width: 24px; height: 24px; padding: 2px 14px; border-radius: 999px; box-sizing: content-box; transition: background .2s; }
.tabs a.on { color: var(--accent); }
.tabs a.on svg { background: color-mix(in srgb, var(--accent) 16%, transparent); }
@media (min-width: 820px) {
  .tabs { display: none; }
  .top nav { display: flex; }
  body { padding-bottom: 40px; }
}

/* ── Layout ── */
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.on { display: block; }
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 4%, transparent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--ink-2); }
.small { font-size: .9rem; }
.tiny { font-size: .8rem; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }

/* ── Controls ── */
.search {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 48px;
}
.search svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.search input { flex: 1; border: 0; background: transparent; padding: 0 10px; height: 100%; font-size: 1.05rem; min-width: 0; }
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search .clear { border: 0; background: var(--surface-2); border-radius: 50%; width: 28px; height: 28px; display: none; place-items: center; }
.search.has .clear { display: grid; }
.sticky { position: sticky; top: 61px; z-index: 10; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 4px 0 8px; margin: -4px 0 8px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: .9rem; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip img { width: 18px; height: 18px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.on img { filter: none; }
.chip.hab-forest.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.chip.hab-grassland.on { background: var(--grassland); border-color: var(--grassland); color: #1b261f; }
.chip.hab-wetland.on { background: var(--wetland); border-color: var(--wetland); color: #fff; }
.chip.pw-brown.on { background: var(--brown); border-color: var(--brown); color:#fff; }
.chip.pw-pink.on { background: var(--pink); border-color: var(--pink); color:#fff; }
.chip.pw-teal.on { background: var(--teal); border-color: var(--teal); color:#fff; }
.chip.pw-yellow.on { background: var(--yellow); border-color: var(--yellow); color:#1b261f; }
.chip.pw-white.on { background: var(--white-pw); border-color: var(--ink-3); color:#1b261f; }
.filter-label { font-size: .8rem; color: var(--ink-3); font-weight: 600; flex: none; padding-right: 2px; }

.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 10px 18px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); padding: 10px 12px; min-height: 44px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: var(--bg); }

/* ── Inline icons ── */
img.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin: 0 .05em; }
.pw { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .8rem; font-weight: 700; letter-spacing: .02em; color: #fff; }
.pw.brown { background: var(--brown); } .pw.pink { background: var(--pink); } .pw.teal { background: var(--teal); } .pw.yellow { background: var(--yellow); color: #1b261f; } .pw.white { background: var(--white-pw); color: #1b261f; } .pw.none { background: var(--line); color: var(--ink-2); }

/* ── Rules ── */
.rules-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.rules-nav::-webkit-scrollbar { display: none; }
.rule-ch { font-family: 'Fraunces', serif; font-size: .95rem; color: var(--ink-3); margin: 22px 0 8px; display: flex; align-items: center; gap: 10px; }
.rule-ch::after { content: ""; flex: 1; height: 1px; background: var(--line); }
details.rule { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); margin-bottom: 8px; }
details.rule > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.05rem; }
details.rule > summary::-webkit-details-marker { display: none; }
details.rule > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin-left: auto; transition: transform .2s; flex: none; }
details.rule[open] > summary::after { transform: rotate(-135deg); }
details.rule .body { padding: 0 16px 16px; max-width: 70ch; }
details.rule .body ul, details.rule .body ol { padding-left: 1.3em; margin: 0 0 .75em; }
details.rule .body li { margin-bottom: .3em; }
details.rule .body li ul { margin-top: .3em; }
details.rule .body .note { background: var(--surface-2); border-left: 3px solid var(--grassland); padding: 8px 12px; border-radius: 0 var(--radius-s) var(--radius-s) 0; }
details.rule .body table.mini { border-collapse: collapse; margin: 0 0 .75em; font-size: .95rem; }
details.rule .body table.mini th, details.rule .body table.mini td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
details.rule .body table.mini th { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
details.rule .body ul.cols { columns: 2; list-style: none; padding: 0; }
details.rule .body ul.iconlist { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
details.rule .body ul.iconlist img.ic { width: 1.5em; height: 1.5em; vertical-align: -0.35em; }
mark { background: color-mix(in srgb, var(--grassland) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.rule-src { font-size: .8rem; color: var(--ink-3); }
.ruling .body i { color: var(--ink-2); }
.bonus-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.bonus-card .cond { color: var(--ink-2); grid-column: 1 / -1; }
.bonus-card .vp { font-weight: 600; }

/* ── Birds ── */
.bird-list { display: grid; gap: 8px; }
@media (min-width: 640px) { .bird-list { grid-template-columns: 1fr 1fr; } }
.bird {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px 10px 10px; text-align: left; width: 100%;
  border-left: 5px solid var(--line);
}
.bird.hab-forest { border-left-color: var(--forest); }
.bird.hab-grassland { border-left-color: var(--grassland); }
.bird.hab-wetland { border-left-color: var(--wetland); }
.bird.hab-multi { border-image: linear-gradient(var(--forest) 0 33%, var(--grassland) 33% 66%, var(--wetland) 66%) 1; border-left-width: 5px; border-radius: var(--radius); }
.bird .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; object-position: 50% 28%; background: var(--surface-2); }
.bird .nm { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.bird .sci { font-style: italic; color: var(--ink-3); font-size: .85rem; }
.bird .meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.bird .meta img { width: 18px; height: 18px; }
.bird .meta .sep { width: 1px; height: 14px; background: var(--line); }
.bird .vp { font-family: 'Fraunces', serif; font-size: 1.5rem; font-weight: 700; text-align: center; line-height: 1; }
.bird .vp small { display: block; font-family: 'Source Sans 3', sans-serif; font-size: .7rem; color: var(--ink-3); font-weight: 600; }
.bird .pwdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pwdot.brown{background:var(--brown)} .pwdot.pink{background:var(--pink)} .pwdot.teal{background:var(--teal)} .pwdot.yellow{background:var(--yellow)} .pwdot.white{background:var(--white-pw); box-shadow: inset 0 0 0 1px var(--ink-3)} .pwdot.none{background:var(--line)}
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-2); font-size: .9rem; padding: 2px 4px 8px; }
.results-bar select { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 10px; font-size: .9rem; }
.more { display: block; margin: 16px auto; }
.more[hidden] { display: none; }
:root[data-theme="dark"] .bird .thumb { filter: invert(1); opacity: .8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bird .thumb { filter: invert(1); opacity: .8; } }
.empty { text-align: center; color: var(--ink-2); padding: 40px 16px; position: relative; }
.empty::before { content: ""; display: block; width: 180px; height: 48px; margin: 0 auto 10px; background: var(--ink-3); opacity: .5; -webkit-mask: url(img/bg/flock.svg) center / contain no-repeat; mask: url(img/bg/flock.svg) center / contain no-repeat; }
.empty b { display: block; font-family: 'Fraunces', serif; font-size: 1.2rem; color: var(--ink); margin-bottom: 4px; }

/* ── Sheet (bird detail) ── */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,15,12,.5); z-index: 40; display: none; }
.sheet-bg.on { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  transform: translateY(100%); transition: transform .25s ease, visibility .25s; padding-bottom: env(safe-area-inset-bottom); visibility: hidden;
}
.sheet.on { transform: none; visibility: visible; }
@media (min-width: 820px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%) scale(.98); width: min(900px, 92vw); border-radius: 20px; max-height: 88vh; opacity: 0; pointer-events: none; }
  .sheet.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
}
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 0; }
.sheet::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--forest), var(--grassland), var(--wetland)); border-radius: 20px 20px 0 0; }
.sheet .close { position: sticky; top: 10px; float: right; margin: -4px 12px 0 0; z-index: 2; }
.detail { display: grid; gap: 16px; padding: 16px; }
@media (min-width: 640px) { .detail { grid-template-columns: 260px 1fr; padding: 24px; } }
.detail .artwrap { position: relative; border-radius: 16px; overflow: hidden; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--hab, var(--line)) 28%, var(--surface-2)), var(--surface-2) 75%); aspect-ratio: 4/3; }
@media (min-width: 640px) { .detail .artwrap { aspect-ratio: 1/1; } }
.detail .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; mix-blend-mode: multiply; opacity: .9; }
:root[data-theme="dark"] .detail .art { mix-blend-mode: screen; filter: invert(1); opacity: .55; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .detail .art { mix-blend-mode: screen; filter: invert(1); opacity: .55; } }
.detail .art.photo { mix-blend-mode: normal !important; filter: none !important; opacity: 1 !important; object-position: 50% 35%; }
.bird .thumb.photo { filter: none !important; opacity: 1 !important; object-position: 50% 35%; }
.detail .artcap a { color: inherit; }
.detail .artwrap:has(.photo) .artcap { background: rgba(0,0,0,.45); color: #fff; padding: 2px 8px; border-radius: 999px; left: 8px; }
.detail .artcap { position: absolute; left: 10px; bottom: 8px; font-size: .7rem; color: var(--ink-3); }
.detail h2 { font-size: 1.6rem; }
.detail .sci { font-style: italic; color: var(--ink-2); }
.detail .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.detail .fact { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.detail .fact small { display: block; font-size: .75rem; color: var(--ink-3); font-weight: 600; }
.detail .fact span { font-family: 'Fraunces', serif; font-size: 1.2rem; font-weight: 600; }
.detail .fact img { width: 22px; height: 22px; vertical-align: middle; }
.detail .cost img { width: 26px; height: 26px; vertical-align: middle; }
.detail .power { border-left: 4px solid var(--line); padding: 8px 12px; border-radius: 0 10px 10px 0; background: var(--surface-2); margin: 10px 0; }
.detail .power.brown { border-color: var(--brown); } .detail .power.pink { border-color: var(--pink); } .detail .power.teal { border-color: var(--teal); } .detail .power.yellow { border-color: var(--yellow); } .detail .power.white { border-color: var(--ink-3); }
.detail .flavor { font-style: italic; color: var(--ink-2); }
.detail .note { font-size: .95rem; color: var(--ink-2); background: var(--surface-2); padding: 8px 12px; border-radius: 10px; }
.detail .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail .tag { font-size: .8rem; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 10px; }
.detail .habrow { display: flex; gap: 6px; align-items: center; }
.detail .habrow img { width: 28px; height: 28px; }

/* ── Scores ── */
.game { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.game-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.game-head h3 { font-size: 1.1rem; }
.game-head .date { color: var(--ink-3); font-size: .9rem; margin-left: auto; }
.sheet-table { width: 100%; border-collapse: collapse; margin-top: 10px; table-layout: fixed; }
.sheet-table th, .sheet-table td { padding: 6px 4px; border-bottom: 1px solid var(--line-2); text-align: center; }
.sheet-table th:first-child, .sheet-table td:first-child { text-align: left; width: 34%; font-weight: 600; color: var(--ink-2); font-size: .9rem; }
.sheet-table thead th { font-family: 'Fraunces', serif; font-weight: 600; font-size: .95rem; color: var(--ink); vertical-align: bottom; }
.sheet-table thead th .pc { display: block; width: 100%; height: 4px; border-radius: 2px; margin-top: 4px; }
.sheet-table input { width: 100%; max-width: 72px; text-align: center; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 2px; font-size: 1.05rem; min-height: 40px; -moz-appearance: textfield; }
.sheet-table input::-webkit-outer-spin-button, .sheet-table input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sheet-table tr.total td { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 700; border-bottom: 0; padding-top: 10px; }
.sheet-table tr.total td:first-child { font-family: 'Source Sans 3', sans-serif; font-size: .9rem; }
.sheet-table tr.sub td { font-size: .85rem; color: var(--ink-3); border-bottom: 0; padding: 0 4px 4px; }
.sheet-table tr.sub input { min-height: 32px; padding: 4px 2px; font-size: .9rem; max-width: 56px; }
.sheet-table .lead td { color: var(--ink); }
.crown { color: var(--grassland); font-size: .9em; }
.done-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.done-p { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; border-top: 4px solid var(--line); }
.done-p .nm { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.done-p .sc { font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.done-p .brk { font-size: .75rem; color: var(--ink-3); }
.players-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; min-height: 44px; }
.pchip i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.pchip.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.add-player { display: flex; gap: 8px; }
.add-player input { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 10px 16px; min-height: 44px; min-width: 0; }
.history-item summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.history-item summary::-webkit-details-marker { display: none; }
.history-item .winner { font-weight: 600; }
.history-item .scores { color: var(--ink-2); font-size: .9rem; margin-left: auto; text-align: right; }

/* ── Stats ── */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.tile::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--forest), var(--grassland), var(--wetland)); opacity: .7; }
.tile .v { font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 700; line-height: 1.05; }
.tile .l { color: var(--ink-2); font-size: .9rem; }
.tile .s { color: var(--ink-3); font-size: .8rem; margin-top: 2px; }
.charts { display: grid; gap: 12px; }
@media (min-width: 820px) { .charts { grid-template-columns: 1fr 1fr; } .charts .wide { grid-column: 1 / -1; } }
.chart { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px 10px; }
.chart h3 { font-size: 1rem; margin-bottom: 2px; }
.chart .sub { color: var(--ink-3); font-size: .85rem; margin-bottom: 8px; }
.chart .cv { position: relative; height: 240px; }
.chart.tall .cv { height: 300px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--ink-2); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
table.lb { width: 100%; border-collapse: collapse; }
table.lb th, table.lb td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-2); }
table.lb th { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
table.lb td.num, table.lb th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.lb .pc { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; opacity: 0; transition: all .25s; z-index: 50; pointer-events: none; }
.toast.on { opacity: 1; transform: translateX(-50%); }
@media (min-width: 820px) { .toast { bottom: 30px; } }
footer { text-align: center; color: var(--ink-3); font-size: .8rem; padding: 24px 16px 8px; max-width: 60ch; margin: 0 auto; }
