/* Layout: content pages sit under a sticky nav on a warm paper ground; the puzzle table is a full-bleed felt canvas with floating cardstock panels. */
:root {
  --table: #24414f;
  --bg: #f3f1ec; --surface: #fbfaf7; --panel: rgba(250, 248, 243, .95); --panel-solid: #faf8f3;
  --ink: #1b2130; --muted: #5b6475; --line: rgba(27, 33, 48, .13); --hover: rgba(27, 33, 48, .07);
  --accent: #2f55d4; --accent-ink: #ffffff; --accent-soft: rgba(47, 85, 212, .12);
  --ok: #1f9a57; --warn: #c07a00; --bad: #c93c3c; --gold: #c58a00; --xp: #e0a400;
  --scrim: rgba(12, 18, 26, .5);
  --shadow: 0 10px 30px rgba(8, 18, 28, .18), 0 1px 3px rgba(8, 18, 28, .14);
  --shadow-sm: 0 1px 2px rgba(8, 18, 28, .08), 0 4px 14px rgba(8, 18, 28, .06);
  --font-display: 'Bricolage Grotesque', 'Figtree', ui-sans-serif, system-ui, sans-serif;
  --font-ui: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-panel: 14px; --r-ctl: 9px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181e; --surface: #1d2129; --panel: rgba(29, 32, 40, .94); --panel-solid: #1d2028;
    --ink: #eef0f5; --muted: #a3abbb; --line: rgba(255, 255, 255, .11); --hover: rgba(255, 255, 255, .08);
    --accent: #8ea5ff; --accent-ink: #0c1333; --accent-soft: rgba(142, 165, 255, .16);
    --ok: #4cd08a; --warn: #f0b34a; --bad: #ff7a7a; --gold: #f2c14e; --xp: #ffc83d; --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .35); --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
body.on-table { overflow: hidden; background: var(--table); }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex: none; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.015em; text-wrap: balance; margin: 0; }
h1 { font-size: 30px; font-weight: 780; }
h2 { font-size: 21px; font-weight: 750; }
h3 { font-size: 16px; font-weight: 720; }
.muted { color: var(--muted); }
.center { display: flex; justify-content: center; padding: 18px 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; min-width: 36px; padding: 0 13px; border: 0; border-radius: var(--r-ctl); background: transparent; font-weight: 650; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--hover); }
.btn.icon { padding: 0; width: 36px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { border: 1px solid var(--line); background: var(--surface); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); }
.btn[aria-pressed="true"] { background: var(--hover); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; background:
  radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: min(440px, 100%); text-align: center; }
.logo-lg { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.logo-lg svg { width: 36px; height: 36px; }
.login h1 { font-size: 38px; }
.lede { color: var(--muted); margin: 10px auto 26px; max-width: 34ch; }
.login-btns { display: flex; flex-direction: column; gap: 10px; }
.oauth { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); }
.oauth:hover { background: var(--hover); }
.oauth svg { width: 20px; height: 20px; }
.dev-form { margin-top: 18px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.dev-form label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.dev-form .row input { flex: 1; min-width: 0; }
.dev-form small { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); margin-top: 18px; }
input[type=text], input[type=search] { height: 40px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px 20px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 780; font-size: 18px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav-brand svg { width: 26px; height: 26px; color: var(--accent); }
.nav-links { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; }
.nav-links a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 650; text-decoration: none; white-space: nowrap; }
.nav-links a:hover { background: var(--hover); color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--hover); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 3px 3px 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.me-chip .lvl { font-family: var(--font-display); font-weight: 800; font-size: 13px; }
.me-chip .lvl::before { content: 'Lv '; font-weight: 650; color: var(--muted); font-family: var(--font-ui); }
.me-xp { width: 54px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.me-xp i { display: block; height: 100%; width: 0; background: var(--xp); border-radius: 99px; transition: width .5s ease; }
.me-chip img, .me-init { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.me-init { display: grid; place-items: center; font-weight: 750; color: #fff; font-size: 13px; }

/* ---------- pages ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; display: flex; flex-direction: column; gap: 28px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page > .sec-head { margin-bottom: -10px; }
.grid { display: grid; gap: 14px; }
.grid.tables { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid.imgs { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.ach { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.panel-card h3 { margin-bottom: 10px; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--r-panel); }

.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.daily-card, .start-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.daily-card { display: grid; grid-template-rows: auto 1fr; }
.daily-card .thumb { position: relative; aspect-ratio: 16 / 7; background: var(--table); overflow: hidden; }
.daily-card.big .thumb { aspect-ratio: 16 / 8; }
.daily-card .thumb img, .daily-card .thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.daily-card .tag { position: absolute; left: 14px; top: 14px; padding: 4px 10px; border-radius: 99px; background: rgba(10, 14, 22, .7); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.daily-card .info { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.daily-card .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.daily-card .meta b { color: var(--ink); }
.week { display: flex; gap: 6px; }
.week span { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); }
.week span.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.week span.today { box-shadow: 0 0 0 2px var(--accent); }
.start-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.start-card p { margin: 0; color: var(--muted); }
.start-btns { display: grid; gap: 10px; }
.big-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); text-align: left; }
.big-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.big-btn b { font-family: var(--font-display); font-size: 17px; }
.big-btn span { color: var(--muted); font-size: 13.5px; }
.race-list { display: flex; flex-direction: column; gap: 6px; }
.race-list h4 { margin: 4px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.race-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }

.tcard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease; min-width: 0; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tcard .thumb { aspect-ratio: 3 / 2; background: var(--table); overflow: hidden; position: relative; }
.tcard .thumb img, .tcard .thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard .live { position: absolute; right: 10px; top: 10px; padding: 3px 9px; border-radius: 99px; background: var(--ok); color: #fff; font-size: 11.5px; font-weight: 750; }
.tcard .done-badge { position: absolute; right: 10px; top: 10px; padding: 3px 9px; border-radius: 99px; background: rgba(10, 14, 22, .7); color: #fff; font-size: 11.5px; font-weight: 750; }
.tcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.tcard .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard .s { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.avs { display: flex; }
.av { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -6px; background: var(--c, #888); color: #fff; font-size: 10.5px; font-weight: 750; display: grid; place-items: center; overflow: hidden; flex: none; }
.av:first-child { margin-left: 0; }
.av img { width: 100%; height: 100%; object-fit: cover; }

/* library */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 650; color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); max-width: 620px; }
.search svg { color: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; height: 44px; min-width: 0; padding: 0; }
.search input:focus { outline: none; }
.search .btn { height: 34px; }
.lib-note { margin: -14px 0 -8px; font-size: 13.5px; }
.icard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }
.icard .thumb { aspect-ratio: 4 / 3; background: var(--hover); position: relative; overflow: hidden; }
.icard .thumb img, .icard .thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.icard .fav { position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(10, 14, 22, .55); color: #fff; display: grid; place-items: center; }
.icard .fav[aria-pressed="true"] { color: #ffd23f; }
.icard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.icard .t { font-weight: 700; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icard .a { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icard .lic { font-size: 11.5px; color: var(--muted); }
.icard .acts { display: flex; gap: 6px; margin-top: 6px; }
.icard .acts .btn { height: 32px; font-size: 13px; flex: 1; }
.drop-card { display: grid; place-items: center; text-align: center; gap: 6px; padding: 24px; border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); background: transparent; min-height: 200px; }
.drop-card:hover, .drop-card.over { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.drop-card svg { width: 30px; height: 30px; }

/* daily & boards */
.daily-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: r; }
.board-list li { display: grid; grid-template-columns: 26px 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; counter-increment: r; font-variant-numeric: tabular-nums; }
.board-list li::before { content: counter(r); font-weight: 750; color: var(--muted); text-align: right; }
.board-list li:nth-child(1)::before { color: var(--gold); }
.board-list li.me { background: var(--accent-soft); }
.board-list li a { color: var(--ink); text-decoration: none; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-list li .v { font-weight: 700; }
.board-list li .v small { color: var(--muted); font-weight: 500; }
.board-list .av { width: 28px; height: 28px; margin: 0; }

/* profile */
.prof-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.prof-av { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-sm); border: 3px solid var(--surface); display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-size: 36px; font-weight: 800; }
.prof-id { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 240px; }
.prof-id .title { color: var(--muted); font-weight: 650; }
.xpbar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; max-width: 460px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--xp), color-mix(in srgb, var(--xp) 70%, #ff7a3d)); border-radius: 99px; }
.xp-txt { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lvl-badge { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--font-display); }
.lvl-badge b { font-size: 26px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.achv { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.achv .medal { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--muted); }
.achv.earned .medal { background: linear-gradient(135deg, #ffd86b, #e59a00); color: #5a3a00; box-shadow: 0 2px 6px rgba(229, 154, 0, .35); }
.achv .medal svg { width: 20px; height: 20px; }
.achv b { display: block; font-size: 14px; }
.achv span { font-size: 12.5px; color: var(--muted); }
.achv:not(.earned) b { color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.recent { display: flex; flex-direction: column; gap: 8px; }
.recent a { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); }
.recent .rt { width: 64px; aspect-ratio: 3 / 2; border-radius: 6px; object-fit: cover; background: var(--table); }
.recent .s { font-size: 12.5px; color: var(--muted); }

/* ---------- table view ---------- */
.table-view { position: fixed; inset: 0; background: var(--table); }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#board.grabbing { cursor: grabbing; }
#board.over-piece { cursor: pointer; }
.hud { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
.hud-group { display: flex; align-items: center; gap: 4px; padding: 5px; min-width: 0; }
.hud .btn { height: 34px; min-width: 34px; font-size: 13.5px; }
.hud .btn.icon { width: 34px; }
.sep { width: 1px; align-self: stretch; margin: 4px; background: var(--line); }
.pz { display: flex; flex-direction: column; line-height: 1.15; padding: 0 6px; min-width: 0; }
.pz-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 24ch; }
.pz-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.prog { display: flex; align-items: center; gap: 7px; padding: 0 8px 0 4px; font-variant-numeric: tabular-nums; }
.prog svg { width: 26px; height: 26px; transform: rotate(-90deg); }
.prog .track { stroke: var(--line); }
.prog .fill { stroke: var(--accent); transition: stroke-dashoffset .4s ease; }
.prog b { font-size: 15px; font-weight: 700; min-width: 3.2ch; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 0 8px; font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status[data-s="live"] i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.status[data-s="warn"] i { background: var(--warn); }
.players { display: flex; align-items: center; padding: 0 4px 0 2px; }
.player { position: relative; display: flex; align-items: center; gap: 4px; margin-left: -6px; padding: 0; border: 0; background: none; }
.player:first-child { margin-left: 0; }
.player .pa { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel-solid); background: var(--c, #888); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; overflow: hidden; box-shadow: 0 0 0 2px var(--c, #888); }
.player .pa img { width: 100%; height: 100%; object-fit: cover; }
.player .pc { position: absolute; bottom: -6px; right: -6px; min-width: 18px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--c); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums; border: 1.5px solid var(--panel-solid); }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 240px; padding: 6px; z-index: 20; display: flex; flex-direction: column; gap: 2px; }
.menu .mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 13.5px; }
.menu .mi:hover { background: var(--hover); }
.menu .mi small { display: block; color: var(--muted); font-size: 12px; }
.menu .mi svg { color: var(--muted); }
.menu h4 { margin: 6px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 4px 10px 8px; }
.sw { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 2px solid transparent; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); padding: 0; }
.sw[aria-pressed="true"] { border-color: var(--accent); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.toggle:hover { background: var(--hover); }
.toggle input { width: 34px; height: 20px; appearance: none; -webkit-appearance: none; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(14px); }
.dock { position: absolute; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 2px; padding: 5px; z-index: 5; }
.dock .zl { min-width: 5ch; text-align: center; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted); }
.lid { position: absolute; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: 280px; max-width: calc(100% - 24px); z-index: 6; padding: 0 0 8px; overflow: hidden; }
.lid-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 12px; cursor: move; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); user-select: none; touch-action: none; }
.lid canvas { display: block; width: calc(100% - 16px); margin: 0 8px; border-radius: 6px; height: auto; }
.lid-credit { margin: 6px 10px 0; font-size: 11px; color: var(--muted); line-height: 1.35; }
.combo { position: absolute; left: 50%; top: 78px; transform: translateX(-50%); z-index: 7; padding: 6px 16px; border-radius: 99px; background: linear-gradient(135deg, #ffcf3f, #ff8a3d); color: #2b1600; font-family: var(--font-display); font-weight: 800; font-size: 18px; box-shadow: 0 6px 20px rgba(255, 138, 61, .45); pointer-events: none; animation: pop .35s ease; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.race-hud { position: absolute; top: 74px; left: 12px; z-index: 5; padding: 10px 12px; width: 250px; display: flex; flex-direction: column; gap: 8px; }
.race-hud h4 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; justify-content: space-between; }
.rp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; font-size: 13px; }
.rp .n { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp .v { font-variant-numeric: tabular-nums; font-weight: 700; }
.rp .bar { grid-column: 1 / -1; height: 7px; }
.rp .bar i { background: var(--c); transition: width .3s ease; }
.overlay { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: var(--scrim); }
.lobby { width: min(560px, 100%); background: var(--panel-solid); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.lobby .thumb { aspect-ratio: 16 / 7; background: var(--table); }
.lobby .thumb img, .lobby .thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.lobby .in { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.lobby .plist { display: flex; flex-wrap: wrap; gap: 8px; }
.lobby .pchip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--hover); font-weight: 650; font-size: 14px; }
.lobby .pchip .av { width: 28px; height: 28px; margin: 0; border: 0; }
.lobby .copy { display: flex; gap: 8px; }
.lobby .copy input { flex: 1; min-width: 0; font-size: 13px; }
.countdown { position: absolute; inset: 0; z-index: 31; display: grid; place-items: center; pointer-events: none; font-family: var(--font-display); font-size: min(30vw, 220px); font-weight: 800; color: #fff; text-shadow: 0 10px 40px rgba(0, 0, 0, .5); }

/* ---------- overlays, dialogs, toasts ---------- */
.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; pointer-events: none; }
.loading .panel { display: flex; align-items: center; gap: 14px; padding: 16px 22px; font-weight: 600; pointer-events: auto; }
.spin { width: 26px; height: 26px; color: var(--accent); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(460px, calc(100% - 32px)); }
.toast { padding: 10px 16px; font-size: 14px; font-weight: 600; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); pointer-events: auto; animation: drop .25s ease; text-align: center; }
.toast.bad { box-shadow: var(--shadow), inset 3px 0 0 var(--bad); }
.toast.ach { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; text-align: left; padding: 10px 16px 10px 10px; }
.toast.ach .medal { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #ffd86b, #e59a00); color: #5a3a00; }
.toast.ach small { display: block; color: var(--muted); font-weight: 500; }
.toast.lvl { font-family: var(--font-display); font-size: 18px; font-weight: 800; background: linear-gradient(135deg, #ffcf3f, #ff8a3d); color: #2b1600; border: 0; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dlg { width: min(940px, 100%); max-height: calc(100% - 8px); display: flex; flex-direction: column; background: var(--panel-solid); overflow: hidden; }
.dlg.sm { width: min(560px, 100%); }
.dlg header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 10px 22px; }
.dlg h2 { font-size: 22px; }
.dlg .body { padding: 6px 22px 22px; overflow: auto; min-height: 0; }
.np { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
.preview { position: relative; border-radius: 10px; overflow: hidden; background: var(--hover); }
.preview canvas { display: block; width: 100%; height: auto; }
.credit { margin: 8px 0; font-size: 12.5px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--hover); gap: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 650; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow-sm); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 32px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: transparent; font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.note b { color: var(--ink); font-variant-numeric: tabular-nums; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.actions .btn { height: 40px; padding: 0 18px; }
.done-card { text-align: center; padding: 26px 24px 24px; }
.done-card .big { font-family: var(--font-display); font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.done-card p { color: var(--muted); margin: 4px 0 16px; font-variant-numeric: tabular-nums; }
.done-card .tbl { text-align: left; }
.done-card .actions { justify-content: center; }
.mvp { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: linear-gradient(135deg, #ffd86b, #e59a00); color: #5a3a00; font-size: 11px; font-weight: 800; }
.help { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 14px; margin: 0; }
.help dt { font-weight: 650; white-space: nowrap; }
.help dd { margin: 0; color: var(--muted); }
kbd { font-family: inherit; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--hover); }

@media (max-width: 900px) {
  .hero, .daily-wrap { grid-template-columns: minmax(0, 1fr); }
  .lbl { display: none; }
  .hud .btn:has(.lbl), .nav .btn:has(.lbl) { padding: 0; width: 36px; }
}
@media (max-width: 720px) {
  .nav { gap: 10px; padding-inline: 12px; flex-wrap: wrap; }
  .nav-brand span { display: none; }
  .nav-links { order: 3; flex-basis: 100%; }
  .me-xp { display: none; }
  .page { padding: 18px 16px 48px; }
  .np { grid-template-columns: minmax(0, 1fr); }
  .race-hud { top: auto; bottom: 64px; width: auto; right: 12px; }
  .pz-name { max-width: 14ch; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } .tcard, .toast, .combo { transition: none; animation: none; } }

/* ---------- couples: invite landing, Us page, home pair card ---------- */
.lang-btn { font-size: 13px; padding-inline: 10px; }
.av.ghost { background: var(--hover); color: var(--muted); border: 2px dashed var(--line); display: inline-grid; place-items: center; font-weight: 700; }
.duo { display: inline-flex; align-items: center; }
.duo .av { width: 34px; height: 34px; margin: 0; border: 2px solid var(--surface); }
.duo .av + .av { margin-left: -10px; }
.duo.big .av { width: 64px; height: 64px; font-size: 26px; border-width: 3px; }
.duo.big .av + .av { margin-left: -16px; }
.pair-card { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.pair-card:hover { outline: 2px solid var(--accent); }
.pair-card b { display: block; font-size: 15px; }
.pair-card small { color: var(--muted); font-size: 13px; }
.join-card { display: flex; flex-direction: column; gap: 14px; align-items: stretch; text-align: center; }
.join-card .duo { align-self: center; }
.join-card .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.join-card .or::before, .join-card .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.guest-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.guest-form label { font-weight: 650; font-size: 14px; }
.guest-form .seg { display: flex; gap: 6px; }
.guest-form .seg button { flex: 1; padding: 8px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.guest-form .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { padding: 12px 18px; font-size: 16px; justify-content: center; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: 14px; }
.us-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.us-head h1 { margin: 0; font-family: var(--font-display); }
.us-head p { margin: 4px 0 0; }
.us-head .on { color: var(--ok); }
.us-acts { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.us-invite { max-width: 560px; margin: 4vh auto; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.us-invite h1 { margin: 0; font-family: var(--font-display); }
.us-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.us-album .alb { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; cursor: pointer; background: var(--hover); }
.us-album .alb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.us-album .alb .av { position: absolute; right: 5px; bottom: 5px; width: 22px; height: 22px; font-size: 11px; margin: 0; border: 2px solid #fff; }
.us-album .alb:hover { outline: 3px solid var(--accent); }
@media (max-width: 640px) { .us-acts { margin-left: 0; width: 100%; } .us-acts .btn { flex: 1; } }

/* ---------- embedded in the date room (?embed=1) ---------- */
.embed #hudBack, .embed #btnInvite, .embed #dnHome, .embed #dnNew, .embed .pz-sub { display: none !important; }
.embed .hud { top: 8px; }
.table-view { -webkit-user-select: none; user-select: none; }
.us-album > p { grid-column: 1 / -1; margin: 0; }
.toast.date-on { display: flex; align-items: center; gap: 12px; } .toast.date-on .btn { padding: 6px 12px; }

/* ---------- photo library (Pexels): justified rows, newest pages append without reflowing ---------- */
#libGrid.photos { display: flex; flex-wrap: wrap; gap: 12px 10px; }
#libGrid.photos::after { content: ''; flex-grow: 1000000; }
#libGrid.photos > .empty { flex-basis: 100%; }
.pcard { flex: calc(var(--ar) * 100) 1 calc(var(--ar) * 190px); min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 5px; }
.pcard .pimg { position: relative; display: block; width: 100%; aspect-ratio: var(--ar); padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--bg); cursor: pointer; }
.pcard .pimg img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.pcard .pimg:hover img { transform: scale(1.035); }
.pcard .pimg:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pcard .go { position: absolute; left: 8px; bottom: 8px; padding: 5px 11px; border-radius: 99px; background: rgba(10, 14, 22, .72); color: #fff; font-weight: 700; font-size: 13px; opacity: 0; transition: opacity .15s; }
.pcard .pimg:hover .go, .pcard .pimg:focus-visible .go { opacity: 1; }
@media (hover: none) { .pcard .go { opacity: 1; } }
.pby { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.pby a { color: inherit; text-overflow: ellipsis; overflow: hidden; }
.pby .pex { text-decoration: none; flex: none; }
.lib-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.lib-note a { color: var(--accent); font-weight: 650; }
@media (max-width: 560px) { .pcard { flex-basis: calc(var(--ar) * 130px); } }
.pby .who { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) {
  .lib-cats, #libTabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .lib-cats::-webkit-scrollbar, #libTabs::-webkit-scrollbar { display: none; }
  .lib-cats .chip, #libTabs button { flex: none; }
}
