/* Between Us. Mobile first. Native UI chrome (shadcn-style), playing cards in bold category colours. */
:root {
  --bg: #fbf7f8; --card: #ffffff; --fg: #1c1418; --muted: #74666c; --border: #eadfe2;
  --subtle: #f5eef0; --hover: #f0e6e9; --ring: #c9b5bc;
  --accent: #e11d48; --accent-soft: #ffe4ea; --primary: #1c1418; --primary-fg: #ffffff;
  --me: #e11d48; --them: #0284c7; --ok: #16a34a; --ok-soft: #dcfce7; --err: #dc2626;
  --back: #2a1a22; --back-2: #e11d48;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 12px;
  --shadow: 0 1px 2px rgb(40 10 20 / .06);
  --lift: 0 18px 40px -18px rgb(60 10 30 / .45), 0 4px 10px -4px rgb(60 10 30 / .2);
  --pop: 0 12px 32px -12px rgb(40 10 20 / .35), 0 2px 6px rgb(40 10 20 / .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0b0d; --card: #18141a; --fg: #f6eff2; --muted: #a8999f; --border: #2c2428;
    --subtle: #1f1a1d; --hover: #282125; --ring: #5a4a50;
    --accent: #fb7185; --accent-soft: #3a1520; --primary: #f6eff2; --primary-fg: #18141a;
    --me: #fb7185; --them: #38bdf8; --ok: #4ade80; --ok-soft: #12301d; --err: #f87171;
    --back: #2a1a22;
    --shadow: 0 1px 2px rgb(0 0 0 / .5);
    --lift: 0 18px 40px -18px rgb(0 0 0 / .9), 0 4px 10px -4px rgb(0 0 0 / .6);
    --pop: 0 12px 32px -12px rgb(0 0 0 / .85), 0 0 0 1px rgb(255 255 255 / .05);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
code { font-family: var(--mono); font-size: 12px; background: var(--subtle); padding: 1px 6px; border-radius: 6px; }
.hint { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.hint svg { margin-top: 2px; }
.err { color: var(--err); font-size: 13px; min-height: 1.2em; }
.pad-s { padding: 8px 2px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, transform .08s, opacity .12s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.soft { background: var(--subtle); border-color: transparent; }
.btn.soft:hover { background: var(--hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--fg); }
.btn.ghost.on { color: var(--accent); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.icon { width: 42px; padding: 0; }
.btn.small { min-height: 32px; font-size: 13px; padding: 0 10px; }
.btn.start { align-self: flex-start; padding-left: 8px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.busy svg { animation: spin 1s linear infinite; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 25%, transparent); } }
input, textarea, .select-native {
  width: 100%; font: inherit; font-size: 16px; color: var(--fg); background: var(--card);
  border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: none; line-height: 1.45; }
input:focus-visible, textarea:focus-visible, .select-native:focus-visible { outline: 2px solid var(--ring); outline-offset: 0; }
label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 5px; }

/* ---------- people ---------- */
.av { --s: 24px; width: var(--s); height: var(--s); border-radius: 99px; display: inline-grid; place-items: center; flex: none;
  font-size: calc(var(--s) * .46); font-weight: 700; color: #fff; background: var(--them); box-shadow: 0 0 0 2px var(--card); }
.av.me { background: var(--me); }

/* ---------- sign in ---------- */
.signin-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.signin { width: min(380px, 100%); display: flex; flex-direction: column; gap: 8px; }
.signin h1 { font-size: 30px; font-weight: 800; margin-top: 8px; }
.signin > p { margin-bottom: 10px; }
.signin .btn { margin-top: 14px; min-height: 48px; }
.signin-cards { position: relative; height: 130px; margin-bottom: 6px; }
.sc { position: absolute; left: 50%; top: 6px; width: 84px; height: 116px; border-radius: 14px; box-shadow: var(--lift); display: grid; place-items: center; }
.sc1 { background: #fbbf24; transform: translateX(-110%) rotate(-14deg); }
.sc2 { background: #38bdf8; transform: translateX(10%) rotate(12deg); }
.sc3 { background: var(--back); transform: translateX(-50%) rotate(-2deg); }

/* ---------- shell ---------- */
#app { height: 100dvh; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); background: var(--bg); }
.brand { display: flex; gap: 8px; align-items: center; font-weight: 800; letter-spacing: -.02em; text-decoration: none; font-size: 17px; }
.offline { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); background: var(--subtle); padding: 3px 8px; border-radius: 99px; }
.view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--fg); }
.tabbar a[aria-current="page"] [data-icon] { color: var(--accent); }
.nbadge, .badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 6px; line-height: 18px; font-variant-numeric: tabular-nums; }
.nbadge { position: absolute; top: 0; left: calc(50% + 6px); box-shadow: 0 0 0 2px var(--card); }
body[data-route="c"] .tabbar { display: none; }

.menu-wrap { position: relative; }
.avatar-btn { width: 34px; height: 34px; border-radius: 99px; border: 0; background: var(--me); color: #fff; font-weight: 700; cursor: pointer; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--pop); padding: 6px; z-index: 50; }
.menu-head { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu button { width: 100%; display: flex; gap: 10px; align-items: center; background: none; border: 0; padding: 10px; border-radius: 9px; cursor: pointer; text-align: left; font-size: 14.5px; }
.menu button:hover { background: var(--hover); }
.menu-foot { font-size: 11.5px; color: var(--muted); padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; }

.page { max-width: 600px; margin: 0 auto; padding: 8px 16px 32px; display: flex; flex-direction: column; gap: 14px; }
.page-title { font-size: 28px; font-weight: 800; }
.page-sub { margin-top: -8px; }
.sec-title { font-size: 15px; font-weight: 700; margin-top: 10px; }

/* ---------- deck ---------- */
.deck-view { overflow-x: clip; height: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; padding: 4px 16px 10px; gap: 10px; }
.deck-bar { display: flex; align-items: center; gap: 8px; }
.cat-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px 0 6px; border-radius: 99px; border: 1px solid var(--border); background: var(--card); font-weight: 700; font-size: 14px; cursor: pointer; max-width: 60%; }
.cat-pill > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-ico { width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; background: var(--subtle); flex: none; }
.deck-left { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table { flex: 1; min-height: 0; position: relative; container-type: size; display: grid; place-items: center; }
.pile .back, .pcard.deck {
  position: absolute; left: 50%; top: 50%;
  width: min(100cqw, 380px, 68cqh); height: min(100cqh, calc(min(100cqw, 380px, 68cqh) * 1.45));
  translate: -50% -50%; border-radius: 24px;
}
.back { background: var(--back); box-shadow: var(--lift); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #f7d6df; font-weight: 800; letter-spacing: -.01em;
  background-image: radial-gradient(circle at 20% 20%, rgb(255 255 255 / .06) 0 18%, transparent 19%), radial-gradient(circle at 80% 75%, rgb(255 255 255 / .05) 0 22%, transparent 23%); }
.back.b2 { transform: rotate(-5deg) translateY(10px); opacity: .9; }
.back.b1 { transform: rotate(3.5deg) translateY(5px); }

/* playing card */
.pcard { --bg: #8b5cf6; --fg: #fff; background: var(--bg); color: var(--fg); border-radius: 22px; padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--lift); position: relative; user-select: none; -webkit-user-select: none; overflow: hidden; }
.pcard.deck { touch-action: none; cursor: grab; will-change: transform; container-type: size; }
.pcard.deck .pc-pair .pc-opt { min-height: 92px; font-size: 17px; border-radius: 18px; }
.pcard.deck.dragging { cursor: grabbing; }
.pcard.enter { animation: deal .42s cubic-bezier(.2,.8,.2,1.15); }
@keyframes deal { from { transform: translateY(18px) rotateY(80deg) scale(.94); opacity: .3; } to { transform: none; opacity: 1; } }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; opacity: .92; }
.pc-cat, .pc-kind, .pc-src { display: inline-flex; gap: 6px; align-items: center; }
.pc-src { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; background: color-mix(in srgb, var(--fg) 14%, transparent); padding: 2px 8px; border-radius: 99px; }
.pc-q { font-size: clamp(22px, 8cqw, 30px); line-height: 1.18; font-weight: 800; letter-spacing: -.025em; text-wrap: balance; }
.pcard.thread .pc-q { font-size: clamp(21px, 5.6vw, 26px); }
.pcard.deck .pc-q { flex: none; }
.pcard.deck > .pc-pair, .pcard.deck > .pc-list, .pcard.deck > .pc-compass, .pcard.deck > .pad { margin-top: auto; }
.pc-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; font-weight: 600; opacity: .8; margin-top: auto; }
.pcard.deck:not(.k-open) .pc-foot { margin-top: 0; }
.pc-brand { display: inline-flex; gap: 5px; align-items: center; }
.ribbon { align-self: flex-start; display: inline-flex; gap: 5px; align-items: center; background: #fff; color: #1c1418; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; box-shadow: var(--shadow); margin-bottom: -4px; }
.stamp { position: absolute; top: 40%; left: 50%; translate: -50% -50%; rotate: -10deg; padding: 6px 16px; border: 4px solid currentColor; border-radius: 12px; font-size: 26px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em;
  opacity: 0; pointer-events: none; background: color-mix(in srgb, var(--bg) 70%, transparent); max-width: 85%; text-align: center; line-height: 1.1; }
.stamp[data-dir="right"] { rotate: -12deg; }
.stamp[data-dir="left"] { rotate: 12deg; }

.pc-opt { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 14px; text-align: left; font-weight: 700; font-size: 15px;
  background: color-mix(in srgb, var(--fg) 13%, transparent); color: var(--fg); border: 2px solid transparent; cursor: pointer; }
div.pc-opt { cursor: default; }
button.pc-opt:hover { background: color-mix(in srgb, var(--fg) 20%, transparent); }
.pc-opt.picked { border-color: var(--fg); background: color-mix(in srgb, var(--fg) 24%, transparent); }
.pc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pc-pair .pc-opt { justify-content: center; text-align: center; flex-wrap: wrap; }
.pc-pair .pc-opt:first-child { justify-content: flex-start; text-align: left; }
.pc-pair .pc-opt:last-child { justify-content: flex-end; text-align: right; }
.pcard.thread .pc-pair .pc-opt { justify-content: center; text-align: center; }
.pc-list { display: flex; flex-direction: column; gap: 7px; }
.pc-letter { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; background: color-mix(in srgb, var(--fg) 18%, transparent); flex: none; }
.marks { display: inline-flex; gap: 2px; margin-left: auto; }
.marks:empty { display: none; }
.pc-compass { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: ". up ." "left hub right" ". down ."; gap: 7px; align-items: center; }
.pc-dir { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 6px 8px; border-radius: 14px; font-weight: 700; font-size: 14px; text-align: center;
  background: color-mix(in srgb, var(--fg) 13%, transparent); color: var(--fg); border: 2px solid transparent; cursor: pointer; line-height: 1.2; }
div.pc-dir { cursor: default; }
.pc-dir.picked { border-color: var(--fg); }
.pc-dir .marks { margin: 2px 0 0; }
.d-up { grid-area: up; } .d-down { grid-area: down; } .d-left { grid-area: left; } .d-right { grid-area: right; }
.pc-hub { grid-area: hub; width: 44px; height: 44px; border-radius: 99px; display: grid; place-items: center; background: color-mix(in srgb, var(--fg) 20%, transparent); }

/* grid & wheel pads */
.pad { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto 1fr auto; gap: 4px 6px; align-items: center; justify-items: center; min-height: 0; }
.pcard.deck .pad { flex: 1; }
.pad .ax { font-size: 11.5px; font-weight: 700; opacity: .9; max-width: 72px; text-align: center; line-height: 1.15; }
.ax.top { grid-area: 1 / 2; } .ax.bottom { grid-area: 3 / 2; } .ax.left { grid-area: 2 / 1; } .ax.right { grid-area: 2 / 3; }
.pad-area { grid-area: 2 / 2; position: relative; aspect-ratio: 1; width: 100%; max-width: 300px; max-height: 100%; touch-action: none; cursor: crosshair; }
.pcard.deck .grid-pad .pad-area { width: min(60cqw, 42cqh); }
.pcard.deck .polar-pad .pad-area { width: min(92cqw, 56cqh); }
.pcard.deck .pad { align-content: center; }
.pad .ax { max-width: 66px; }
.polar-pad { grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; }
.polar-pad .pad-area { grid-area: 1 / 1; aspect-ratio: 320 / 260; max-width: 360px; }
.pad-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pad-bg { fill: color-mix(in srgb, var(--fg) 12%, transparent); }
.pad-grid { stroke: color-mix(in srgb, var(--fg) 22%, transparent); stroke-width: 1; fill: none; }
.pad-axis { stroke: color-mix(in srgb, var(--fg) 45%, transparent); stroke-width: 1.5; }
.pad-axis-dot { fill: var(--fg); opacity: .6; }
.pad-label { fill: var(--fg); font: 700 12px var(--font); }
.pad-dots { position: absolute; inset: 0; pointer-events: none; }
.pad-dot { position: absolute; translate: -50% -50%; transition: left .08s, top .08s; filter: drop-shadow(0 2px 4px rgb(0 0 0 / .25)); }
.pad-dot.ghost { opacity: .55; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { scale: 1.15; } }
.pad-legend { display: flex; justify-content: space-between; width: 100%; font-size: 11.5px; font-weight: 600; opacity: .85; gap: 8px; }
.pad-readout { font-size: 13px; font-weight: 700; min-height: 1.2em; }

/* round buttons under the card */
.deck-actions { display: flex; justify-content: center; align-items: flex-start; gap: 14px; padding-bottom: 2px; }
.round { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; padding: 0; color: var(--fg); }
.round > svg { box-sizing: content-box; padding: 13px; border-radius: 99px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .1s; }
.round.big > svg { padding: 17px; }
.round:active > svg { transform: scale(.9); }
.round.primary > svg { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.round.yes > svg { background: #16a34a; color: #fff; border-color: #16a34a; }
.round.no > svg { background: #f43f5e; color: #fff; border-color: #f43f5e; }
.round.on > svg { color: var(--accent); }
.round:disabled { opacity: .4; cursor: default; }
.round-label { font-size: 11.5px; font-weight: 600; color: var(--muted); max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* category picker */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 16px; border: 2px solid transparent; background: var(--bg); color: var(--fg); text-align: left; cursor: pointer; min-height: 104px; }
.cat-tile.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--card) inset; }
.ct-top { display: flex; justify-content: space-between; align-items: center; }
.ct-n { font-size: 12px; font-weight: 700; opacity: .8; font-variant-numeric: tabular-nums; }
.cat-tile strong { font-size: 15.5px; margin-top: auto; }
.ct-d { font-size: 12px; opacity: .85; line-height: 1.3; }

/* ---------- sheets ---------- */
dialog.sheet { margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--card); color: var(--fg); box-shadow: var(--pop);
  display: flex; flex-direction: column; animation: up .26s cubic-bezier(.2,.9,.3,1); }
dialog.sheet:not([open]) { display: none; }
dialog.sheet.closing { animation: down .18s ease-in forwards; }
dialog.sheet::backdrop { background: rgb(20 5 12 / .45); }
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
@keyframes down { to { transform: translateY(40%); opacity: 0; } }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 22px; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--border); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 4px 20px; }
.sheet-head h2 { font-size: 19px; font-weight: 800; }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.qr { background: #fff; padding: 14px; border-radius: 14px; border: 1px solid var(--border); width: min(280px, 100%); margin: 8px auto; }
.qr svg { display: block; width: 100%; height: auto; }

/* reveal */
.reveal { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.reveal-faces { display: flex; justify-content: center; align-items: center; gap: 14px; }
.reveal-mid { width: 54px; height: 54px; border-radius: 99px; display: grid; place-items: center; background: var(--subtle); }
.reveal-q { text-align: center; font-weight: 700; font-size: 17px; text-wrap: balance; }
.reveal-picks { display: flex; flex-direction: column; gap: 8px; background: var(--subtle); border-radius: 14px; padding: 12px; }
.pickline { display: flex; gap: 8px; align-items: center; }

/* ---------- reactions ---------- */
.reacts { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.react { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.react.on { border-color: var(--accent); background: var(--accent-soft); }
.react.add { color: var(--muted); padding: 0 8px; }
.reacts.compact .react { height: 26px; padding: 0 7px; }
.tray { position: fixed; z-index: 100; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--pop); max-width: min(330px, calc(100vw - 16px)); animation: trayIn .16s ease-out; }
@keyframes trayIn { from { transform: scale(.85) translateY(6px); opacity: 0; } }
.tray button { border: 0; background: none; padding: 5px; border-radius: 99px; cursor: pointer; display: inline-flex; transition: transform .1s; }
.tray button:hover, .tray button:focus-visible { background: var(--hover); transform: scale(1.18); }
.burst { position: fixed; z-index: 200; pointer-events: none; translate: -50% -50%; animation: burst 1s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes burst { 0% { transform: scale(.3); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(1.1); opacity: 0; } }

/* ---------- thread ---------- */
.thread-view { height: 100%; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.subbar { display: flex; align-items: center; gap: 4px; padding: 2px 8px; }
.subbar-title { display: inline-flex; gap: 6px; align-items: center; font-weight: 800; font-size: 14px; }
.t-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.t-card .pcard { box-shadow: var(--lift); }
.t-card-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 10px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 14px; background: var(--subtle); font-size: 14px; }
.banner.match { background: var(--ok-soft); }
.t-chain { display: flex; flex-direction: column; gap: 8px; }
.follow { display: flex; flex-direction: column; gap: 6px; }
.chips { display: flex; flex-direction: column; gap: 6px; }
.chips.wrap { flex-direction: row; flex-wrap: wrap; }
.chip-btn { display: inline-flex; gap: 8px; align-items: center; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1px dashed var(--border); background: transparent; cursor: pointer; font-size: 14px; }
.chip-btn:hover { background: var(--hover); }
.chips.wrap .chip-btn { border-style: solid; background: var(--card); border-radius: 99px; }
.link-row { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: 12px; background: var(--subtle); text-decoration: none; font-size: 14px; }
.t-h { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.answers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.empty-li { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--border); border-radius: 16px; font-size: 14px; }
.a-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.answer.mine .a-card { border-color: color-mix(in srgb, var(--me) 35%, var(--border)); }
.answer:nth-child(odd) .a-card { rotate: -.4deg; }
.answer:nth-child(even) .a-card { rotate: .4deg; }
.m-head { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.m-body { display: flex; flex-direction: column; gap: 4px; }
.m-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; }
.m-text.locked { color: var(--muted); font-style: italic; }
.m-pick { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 14px; background: var(--subtle); padding: 4px 10px; border-radius: 99px; align-self: flex-start; }
.hidden-pick { filter: none; color: var(--muted); font-weight: 600; }
.m-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.mini { display: inline-flex; gap: 4px; align-items: center; height: 28px; padding: 0 8px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.mini:hover { background: var(--hover); color: var(--fg); }
.mini.on { color: var(--accent); }
.replies { list-style: none; margin: 6px 0 0 18px; padding: 0 0 0 12px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.replies:empty { display: none; }
.reply { display: flex; flex-direction: column; gap: 4px; }
.reply .m-text { font-size: 15px; }
.composer { border-top: 1px solid var(--border); background: var(--bg); padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 6px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea, .composer-row input { border-radius: 22px; padding: 10px 16px; }
.composer-row .btn.icon { border-radius: 99px; width: 44px; min-height: 44px; flex: none; }
.replying { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 0 6px; }

/* ---------- lists ---------- */
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rowlink { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); text-decoration: none; min-width: 0; flex: 1; }
.rowlink:hover { background: var(--hover); }
.row-wrap { display: flex; gap: 4px; align-items: center; }
.tile { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--muted); flex: none; }
.dot { width: 10px; height: 10px; border-radius: 99px; background: var(--accent); display: inline-block; }
.saved-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.quote { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); text-decoration: none; }
.q-src { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.q-text { font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.q-by { font-size: 12.5px; color: var(--muted); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 30px 16px; border: 1px dashed var(--border); border-radius: 18px; }
.empty p { color: var(--muted); max-width: 34ch; }
.empty-ico { width: 54px; height: 54px; border-radius: 99px; display: grid; place-items: center; background: var(--subtle); color: var(--accent); }

/* ---------- create ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 12.5px; font-weight: 700; }
.seg-btn.on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.opt-row { display: flex; gap: 6px; align-items: center; }
.opt-row .pc-letter { background: var(--subtle); }
.compass-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; grid-template-areas: "up up" "left right" "down down"; }
.compass-form label span { display: inline-flex; gap: 4px; align-items: center; }
.cf-up { grid-area: up; } .cf-down { grid-area: down; } .cf-left { grid-area: left; } .cf-right { grid-area: right; }
.preview .pcard { box-shadow: var(--shadow); }
.sticky-actions { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom, 0px)); background: var(--card); padding: 10px 0; margin-bottom: -10px; }

/* ---------- play ---------- */
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-tile { --bg: #4338ca; --fg: #fff; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 20px; border: 0; background: var(--bg); color: var(--fg); text-align: left; cursor: pointer; box-shadow: var(--lift); min-height: 170px; transition: transform .1s; }
.game-tile:active { transform: scale(.97) rotate(-1deg); }
.game-tile:nth-child(odd) { rotate: -1deg; } .game-tile:nth-child(even) { rotate: 1deg; }
.game-tile strong { font-size: 17px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.game-tile > span:last-child { font-size: 12.5px; opacity: .9; line-height: 1.35; }
.gt-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--fg) 18%, transparent); margin-bottom: 4px; }

.meter { display: flex; gap: 10px; align-items: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.meter-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--subtle); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.finale { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 24px 12px; }
.finale h2 { font-size: 26px; font-weight: 800; }
.finale .row { width: 100%; }
.mq-quote { margin: 0; padding: 18px; border-radius: 20px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--lift); display: flex; flex-direction: column; gap: 10px; rotate: -.6deg; }
.mq-quote p { font-size: 19px; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.mq-quote footer { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.mq-opt { text-align: left; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--card); cursor: pointer; font-weight: 600; font-size: 14.5px; }
.mq-opt:hover:not(:disabled) { background: var(--hover); }
.mq-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.mq-opt.wrong { border-color: var(--err); }
.mq-opt:disabled { cursor: default; }

/* quiz board */
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); font-weight: 600; }
.score strong { margin-left: auto; font-size: 20px; font-variant-numeric: tabular-nums; }
.board { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 6px; }
.b-cat { color: #fff; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 8px 6px; border-radius: 10px; min-height: 52px; display: grid; place-items: center; text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.b-cell { --tone: #4338ca; position: relative; min-height: 58px; border-radius: 10px; border: 0; background: color-mix(in srgb, var(--tone) 85%, #000); color: #fde68a; font-size: 20px; font-weight: 900; cursor: pointer; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.b-cell:disabled { cursor: default; }
.b-cell.done { background: var(--subtle); color: var(--muted); }
.b-cell.open { outline: 3px solid var(--fg); }
.b-cell.empty { background: transparent; }
.b-about { position: absolute; right: 4px; bottom: 4px; }
.b-about .av { box-shadow: 0 0 0 1.5px #fff; }
.clue { --tone: #4338ca; background: var(--tone); color: #fff; border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--lift); }
.clue-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.clue-top strong { font-size: 18px; color: #fde68a; }
.clue-text { font-size: 20px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.clue-for { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; opacity: .95; }
.clue .muted { color: rgb(255 255 255 / .82); }
.clue .btn { background: rgb(255 255 255 / .16); border-color: transparent; color: #fff; }
.clue .btn.primary { background: #fff; color: #1c1418; }
.clue .btn.ghost { align-self: center; }
.clue input { background: #fff; color: #1c1418; border-color: transparent; }
.clue-answers { background: rgb(0 0 0 / .18); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }

/* drawing */
.draw-page { gap: 10px; }
.secret { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; background: var(--subtle); padding: 6px 12px; border-radius: 99px; font-size: 14px; }
.canvas-box { width: 100%; max-width: 520px; margin: 0 auto; aspect-ratio: 1; border-radius: 20px; overflow: hidden; background: #fff; box-shadow: var(--lift); border: 1px solid var(--border); }
.draw-canvas { display: block; touch-action: none; cursor: crosshair; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.swatch { width: 30px; height: 30px; border-radius: 99px; border: 2px solid var(--border); cursor: pointer; display: grid; place-items: center; color: #1c1418; }
.swatch.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--fg); }
.sizes { display: flex; gap: 6px; }
.size { width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--border); background: var(--card); display: grid; place-items: center; cursor: pointer; }
.size span { background: var(--fg); border-radius: 99px; display: block; }
.size.on { border-color: var(--fg); background: var(--subtle); }
.chosen { display: flex; gap: 6px; align-items: center; font-size: 15px; min-height: 1.4em; }
.who-drew { font-size: 14px; }
.guesses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.guess { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); }
.guess .tag { font-size: 12px; font-weight: 700; color: var(--muted); }
.guess.yes { border-color: var(--ok); background: var(--ok-soft); }
.guess.close .tag { color: #d97706; }
.draw-status { display: flex; flex-direction: column; gap: 10px; }

/* toasts */
.toasts { position: fixed; left: 50%; translate: -50% 0; top: calc(58px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 300; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--primary); color: var(--primary-fg); border-radius: 14px; padding: 11px 14px; font-size: 14px; box-shadow: var(--pop); animation: toastIn .2s ease-out; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .3s; }
.toast.err { background: var(--err); color: #fff; }
.toast button { background: color-mix(in srgb, var(--primary-fg) 18%, transparent); border: 0; color: inherit; font-weight: 700; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } }

@media (min-width: 720px) {
  .tabbar { max-width: 560px; margin: 0 auto 12px; border: 1px solid var(--border); border-radius: 20px; width: calc(100% - 32px); box-shadow: var(--pop); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- mailbox & letters ---------- */
.mailbox-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 99px; color: var(--fg); text-decoration: none; }
.mailbox-btn:hover, .mailbox-btn[aria-current="page"] { background: var(--subtle); }
.mailbox-btn .nbadge { top: -2px; left: auto; right: -4px; }
.seg.two-seg { grid-template-columns: 1fr 1fr; }
.seg.two-seg .seg-btn { flex-direction: row; justify-content: center; font-size: 14px; padding: 10px; }
.chip-btn.on, .chips.wrap .chip-btn.on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.env-list { display: flex; flex-direction: column; gap: 14px; }
.envelope { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; width: 100%; min-height: 128px;
  padding: 62px 18px 16px; border-radius: 16px; border: 1px solid #ecd9c6; background: #fbf3ea; color: #3b2a22; cursor: pointer; box-shadow: var(--lift); }
.envelope:nth-child(odd) { rotate: -.6deg; } .envelope:nth-child(even) { rotate: .5deg; }
.env-flap { position: absolute; inset: 0 0 auto 0; height: 70px; background: #f3e4d4; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .4s ease; }
.env-seal { position: absolute; left: 50%; top: 46px; translate: -50% 0; width: 42px; height: 42px; border-radius: 99px; background: #b91c3c; display: grid; place-items: center; box-shadow: 0 2px 0 #7f1d2d, 0 4px 10px rgb(0 0 0 / .2); }
.env-seal img { filter: brightness(0) invert(1); opacity: .9; }
.env-label { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin-top: 30px; }
.env-meta { font-size: 12.5px; color: #7a6253; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.env-state { display: inline-flex; gap: 4px; align-items: center; }
.env-state.new { background: #b91c3c; color: #fff; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.envelope.opened { background: #f6f1ec; opacity: .92; }
.envelope.opened .env-flap { transform: scaleY(-1) translateY(-100%); opacity: .5; }
.envelope.opened .env-seal { display: none; }
.envelope.locked .env-seal { background: #6b5b52; box-shadow: 0 2px 0 #4a3e38; }
.envelope.opening .env-flap { transform: scaleY(-1); }
.envelope.opening .env-seal { animation: crack .4s forwards; }
@keyframes crack { to { transform: scale(1.4); opacity: 0; } }
.shake { animation: shake .4s; }
@keyframes shake { 25% { translate: -6px 0; } 50% { translate: 6px 0; } 75% { translate: -3px 0; } }
.paper { background: #fffaf3; color: #2b211c; border-radius: 14px; padding: 22px 20px; box-shadow: inset 0 0 0 1px #efe2d2;
  background-image: repeating-linear-gradient(transparent 0 31px, #efe4d6 31px 32px); line-height: 32px; }
.paper-cover { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9a7b66; line-height: 1.4; margin-bottom: 8px; }
.paper-text { font-size: 17px; white-space: pre-wrap; overflow-wrap: anywhere; }
.paper-sign { margin-top: 12px; font-weight: 700; display: flex; flex-direction: column; line-height: 1.5; }
.paper-sign span { font-weight: 500; font-size: 13px; color: #9a7b66; }
.paper .inline-link { color: #b91c3c; }
.paper .lp { background: #fff; color: #2b211c; border-color: #efe2d2; line-height: 1.4; }
.paper .lp-site, .paper .lp-desc { color: #7a6253; }
.letter-form textarea { min-height: 220px; font-size: 16.5px; line-height: 1.6; }

/* ---------- journal ---------- */
.today { display: flex; flex-direction: column; gap: 10px; }
.daily-link { position: relative; display: block; text-decoration: none; }
.daily-tag { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; font-weight: 700; background: var(--card); color: var(--fg); border: 1px solid var(--border); padding: 3px 10px; border-radius: 99px; position: absolute; top: -10px; right: 12px; z-index: 1; box-shadow: var(--shadow); }
.daily-tag.inline { position: static; margin-left: 6px; text-transform: none; letter-spacing: 0; }
.pcard.pc-compact { padding: 16px; box-shadow: var(--shadow); }
.pcard.pc-compact .pc-q { font-size: 20px; }
.day-lines, .day-answers { display: flex; flex-direction: column; gap: 8px; }
.line { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; overflow-wrap: anywhere; }
.line .av { margin-top: 1px; }
.line.note { color: var(--muted); font-style: italic; }
.revisit { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.revisit .label { display: inline-flex; gap: 2px; align-items: center; }
.rv-q { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.revisit blockquote { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--subtle); }
.revisit blockquote footer { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.days { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.day { display: flex; flex-direction: column; gap: 8px; padding-left: 14px; border-left: 2px solid var(--border); }
.day-date { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.day-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }

/* ---------- links ---------- */
.inline-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.lp { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; text-decoration: none; background: var(--card); max-width: 420px; margin-top: 4px; }
.lp-img { width: 100%; aspect-ratio: 1.91; object-fit: cover; display: block; background: var(--subtle); }
.lp-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; }
.lp > .lp-site { padding: 10px 12px; }
.lp-site { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); }
.lp strong { font-size: 14px; line-height: 1.3; }
.lp-desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- feud ---------- */
.game-tile.wide { grid-column: 1 / -1; min-height: 140px; }
.feud { background: #312e81; color: #fff; border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--lift); }
.feud-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; opacity: .9; }
.feud-strikes { display: flex; gap: 4px; }
.strike { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgb(255 255 255 / .12); color: rgb(255 255 255 / .35); }
.strike.on { background: #ef4444; color: #fff; animation: pop .3s; }
@keyframes pop { 50% { transform: scale(1.3); } }
.feud-q { font-size: 21px; font-weight: 800; line-height: 1.25; letter-spacing: -.015em; text-wrap: balance; }
.feud-for { display: flex; gap: 8px; align-items: center; font-size: 13px; opacity: .9; }
.feud-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 6px; }
.tile-f { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 50px; padding: 8px 12px; border-radius: 12px; background: #4338ca; border: 2px solid #6366f1; }
.tile-f.hidden { justify-content: center; }
.tf-n { width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; background: #1e1b4b; color: #fde68a; font-weight: 900; }
.tile-f.won { background: #fde68a; color: #1e1b4b; border-color: #fbbf24; animation: flipIn .35s; }
.tile-f.shown { background: rgb(255 255 255 / .1); border-color: transparent; color: rgb(255 255 255 / .75); }
@keyframes flipIn { from { transform: rotateX(90deg); } }
.tf-text { display: flex; flex-direction: column; font-weight: 800; font-size: 16px; text-transform: uppercase; letter-spacing: .01em; min-width: 0; }
.tf-src { display: inline-flex; gap: 4px; align-items: center; font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: inherit; opacity: .75; }
.tf-pts { font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.feud-earned { font-size: 13px; opacity: .85; text-align: right; font-variant-numeric: tabular-nums; }
.misses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.misses li { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); color: var(--muted); }

/* ---------- letter fonts ----------
   Supermarker (licensed) for Latin; Kavivanar (OFL) takes over for Tamil glyphs. */
@font-face { font-family: "Supermarker"; src: url("fonts/supermarker.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Supermarker"; src: url("fonts/supermarker-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Supermarker"; src: url("fonts/supermarker-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Kavivanar"; src: url("fonts/kavivanar-tamil.woff2") format("woff2"); font-display: swap;
  unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC; }
:root { --letter: "Supermarker", "Kavivanar", "Bradley Hand", "Segoe Print", var(--font); }
.paper-text, .paper-sign, .env-label, .letter-form textarea { font-family: var(--letter); }
.paper-text { font-size: 19px; }
.env-label { font-size: 20px; font-weight: 700; }
.paper-sign { font-weight: 700; font-size: 19px; }
.paper-sign span { font-family: var(--font); }
.letter-form textarea { font-size: 18px; }

/* ---------- commitments ---------- */
.seg.three-seg { grid-template-columns: repeat(3, 1fr); }
.seg.three-seg .seg-btn { flex-direction: row; justify-content: center; font-size: 14px; padding: 10px 4px; }
.commit { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.commit.ask { border-style: dashed; }
.commit.inactive { opacity: .75; }
.commit h3 { font-size: 18px; font-weight: 800; letter-spacing: -.015em; }
.commit-head { display: flex; gap: 10px; align-items: flex-start; }
.commit-head .muted { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.commit-why { font-size: 14px; color: var(--muted); }
.flame { display: inline-flex; gap: 4px; align-items: center; padding: 6px 10px; border-radius: 99px; background: var(--subtle); color: var(--muted); font-variant-numeric: tabular-nums; }
.flame.on { background: #ffedd5; color: #c2410c; }
@media (prefers-color-scheme: dark) { .flame.on { background: #3b1d0a; color: #fb923c; } }
.flame strong { font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats div { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: var(--subtle); }
.stats strong { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { font-size: 11.5px; color: var(--muted); }
.cal-wrap { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.cal-months { display: grid; grid-template-columns: repeat(var(--weeks), 1fr); margin-left: 18px; font-size: 10.5px; color: var(--muted); }
.cal-months span { white-space: nowrap; overflow: visible; }
.cal-body { display: flex; gap: 4px; }
.cal-labels { display: grid; grid-template-rows: repeat(7, 1fr); width: 14px; font-size: 10px; color: var(--muted); align-items: center; }
.cal { flex: 1; display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-template-columns: repeat(var(--weeks), 1fr); gap: 3px; min-width: 0; }
.cal-day { aspect-ratio: 1; border-radius: 3px; border: 0; padding: 0; background: var(--subtle); cursor: pointer; min-width: 0; }
.cal-day.off { background: transparent; box-shadow: inset 0 0 0 1px var(--border); cursor: default; }
.cal-day.future { background: transparent; cursor: default; }
.cal-day.done { background: #22c55e; }
.cal-day.excused { background: #fbbf24; }
.cal-day.missed { background: #fecaca; }
@media (prefers-color-scheme: dark) { .cal-day.done { background: #16a34a; } .cal-day.missed { background: #4c1d1d; } .cal-day.excused { background: #b45309; } }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--fg); }
.cal-legend { display: flex; gap: 12px; justify-content: flex-end; font-size: 11px; color: var(--muted); }
.cal-legend span { display: inline-flex; gap: 4px; align-items: center; }
.cal-legend i { width: 10px; height: 10px; display: inline-block; cursor: default; }
.today-log { display: flex; flex-direction: column; gap: 6px; }
.grow-kids > * { flex: 1; }
.log-chip { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.log-chip.done { background: #dcfce7; color: #166534; }
.log-chip.excused { background: #fef3c7; color: #92400e; }
@media (prefers-color-scheme: dark) { .log-chip.done { background: #12301d; color: #4ade80; } .log-chip.excused { background: #3a2a0a; color: #fbbf24; } }
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.log-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.log-note { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.excuse { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--subtle); white-space: pre-wrap; }
.end-btn { align-self: flex-start; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { min-height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); font-weight: 700; font-size: 13px; cursor: pointer; }
.wd.on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.ended summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 8px 0; }
.ended[open] { display: flex; flex-direction: column; gap: 12px; }
.today-commits { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); }
.today-commits .label { display: inline-flex; gap: 2px; align-items: center; }
.tc-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tc-row > span { min-width: 140px; }

/* ---------- Supermarker extras ---------- */
.paper-text, .lt-tools, .preview-paper { font-feature-settings: "calt" 1, "liga" 1; }
.lt-bold { font-weight: 700; }
.lt-italic { font-style: italic; }
.lt-alt { font-family: var(--letter); font-feature-settings: "ss01" 1, "salt" 1; }
.lt-art { font-family: var(--letter); font-feature-settings: "ss02" 1, "ss05" 1, "ss06" 1; }
.lt-orn { font-family: var(--letter); display: block; text-align: center; font-size: 1.6em; line-height: 1.2; }
.lt-ss03 { font-feature-settings: "ss03" 1; }
.lt-ss04 { font-feature-settings: "ss04" 1; }
.lt-sym { font-family: "Supermarker", var(--font); font-variant-emoji: text; }
.lt-tools { display: flex; flex-direction: column; gap: 8px; }
.lt-bar { display: flex; gap: 4px; flex-wrap: wrap; }
.lt-btn { min-width: 42px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--fg); cursor: pointer; font-family: var(--letter); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.lt-btn:hover { background: var(--hover); }
.lt-btn .lt-orn { display: inline; font-size: 18px; }
.lt-btn.wide { font-family: var(--font); font-size: 13px; font-weight: 600; width: 100%; }
.lt-panel { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--subtle); }
.lt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.lt-grid.words { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.lt-btn.orn { height: 52px; }
.lt-btn.orn .lt-orn { font-size: 26px; }
.lt-btn.sym { font-size: 22px; }
.mini-seg .seg-btn { padding: 7px; font-size: 13px; }
.preview-paper { min-height: 220px; }
/* hand-drawn strike: a slightly wobbly marker line over the words */
.lt-strike { text-decoration: none; position: relative; white-space: pre-wrap; }
.lt-strike::after { content: ""; position: absolute; left: -2px; right: -2px; top: 42%; height: .3em; pointer-events: none;
  background: currentColor; opacity: .85; border-radius: 40% 60% 50% 45% / 60% 40% 55% 45%; transform: rotate(-1.2deg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M0 3.5 Q12 1.5 25 3 T50 2.5 T75 2 T100 3 L100 7.5 Q88 9 75 7 T50 7.5 T25 7 T0 8 Z' fill='black'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M0 3.5 Q12 1.5 25 3 T50 2.5 T75 2 T100 3 L100 7.5 Q88 9 75 7 T50 7.5 T25 7 T0 8 Z' fill='black'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }

/* ---------- papers: every line box is --lh tall and the ruling sits just under the baseline (--ry, measured) ---------- */
.paper { --lh: 32px; --ry: 24px; --ink: #2b211c; --rule: #e7d9c6; --paper-bg: #fffaf3; --muted-ink: color-mix(in srgb, var(--ink) 60%, transparent);
  position: relative; overflow: hidden; color: var(--ink); background-color: var(--paper-bg); background-image: none;
  line-height: var(--lh); padding: 16px 20px; border-radius: 14px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
.paper > * { line-height: var(--lh); margin: 0; position: relative; }
.paper-cover { color: var(--muted-ink); margin: 0 !important; }
.paper-text { color: var(--ink); }
.paper-sign { margin-top: var(--lh) !important; color: var(--ink); }
.paper-sign span { color: var(--muted-ink); line-height: var(--lh); }
.paper .lt-orn { line-height: var(--lh); font-size: 1.45em; }
.paper .inline-link { color: color-mix(in srgb, var(--ink) 70%, #b91c3c); }
.p-ruled, .p-airmail, .p-kraft, .p-custom-ruled, .p-night {
  background-image: linear-gradient(to bottom, transparent calc(var(--ry) - 1px), var(--rule) calc(var(--ry) - 1px), var(--rule) var(--ry), transparent var(--ry));
  background-size: 100% var(--lh); }
.p-grid { background-image: linear-gradient(to bottom, transparent calc(var(--ry) - 1px), var(--rule) calc(var(--ry) - 1px), var(--rule) var(--ry), transparent var(--ry)),
  linear-gradient(to right, transparent calc(var(--lh) - 1px), color-mix(in srgb, var(--rule) 70%, transparent) calc(var(--lh) - 1px));
  background-size: 100% var(--lh), var(--lh) 100%; --rule: #dfe7ef; --paper-bg: #fcfdff; }
.p-dotted { background-image: radial-gradient(circle, #c9bba8 1.1px, transparent 1.6px); background-size: 16px var(--lh); background-position: 0 calc(var(--ry) - var(--lh) / 2); }
.p-plain { --paper-bg: #ffffff; }
.p-airmail { --paper-bg: #fbfbf7; --rule: #e3e6ee; border: 6px solid transparent; border-image: repeating-linear-gradient(45deg, #c8102e 0 12px, #fbfbf7 12px 20px, #1d3d8f 20px 32px, #fbfbf7 32px 40px) 6; border-radius: 4px; }
.p-kraft { --paper-bg: #e7cfa8; --rule: rgba(90, 60, 30, .18); --ink: #3a2414; }
.p-blush { --paper-bg: #fde4e6; }
.p-peach { --paper-bg: #ffe5d0; }
.p-butter { --paper-bg: #fff4c7; }
.p-mint { --paper-bg: #dcf5e8; }
.p-sky { --paper-bg: #dff0fd; }
.p-lavender { --paper-bg: #ebe4fb; }
.p-night { --paper-bg: #1f2340; --rule: rgba(255, 255, 255, .12); }
.p-custom { background-image: linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, .5)), var(--custom, none); background-size: cover; background-position: center; }
.p-custom.p-custom-ruled { --rule: rgba(60, 40, 30, .22);
  background-image: linear-gradient(to bottom, transparent calc(var(--ry) - 1px), var(--rule) calc(var(--ry) - 1px), var(--rule) var(--ry), transparent var(--ry)),
    linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, .5)), var(--custom, none);
  background-size: 100% var(--lh), cover, cover; }
.write-paper textarea, textarea.paper-text { display: block; width: 100%; min-height: calc(var(--lh) * 9); padding: 0; margin: 0; border: 0; outline: 0; resize: none; overflow: hidden;
  background: transparent; color: var(--ink); font-family: var(--letter); font-size: 19px; line-height: var(--lh); border-radius: 0; }
.write-paper textarea::placeholder { color: var(--muted-ink); }
.write-paper:focus-within { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 25%, transparent); }
.preview-paper { min-height: calc(var(--lh) * 9 + 32px); }

/* paper & ink picker */
.paper-picker { display: flex; flex-direction: column; gap: 8px; }
.sp-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.sp-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.swatch-paper { width: 54px; height: 68px; padding: 6px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; font-family: var(--letter); font-size: 18px; border: 0; }
.swatch-paper.on { outline: 3px solid var(--primary); outline-offset: 2px; }
.swatch-paper.add { background: var(--subtle); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.sp-name { font-size: 11px; color: var(--muted); }
.sp-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 99px; border: 0; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; cursor: pointer; }
.ink-row { display: flex; gap: 10px; }
.ink-dot { width: 30px; height: 30px; border-radius: 99px; border: 2px solid var(--border); cursor: pointer; }
.ink-dot.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--fg); }

/* stickers */
.st-layer { position: absolute !important; inset: 0; pointer-events: none; z-index: 2; }
.st-on { position: absolute; display: block; line-height: 0; }
.st-on img { width: 100%; height: auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .22)); user-select: none; -webkit-user-select: none; }
.st-layer.edit .st-on { pointer-events: auto; cursor: grab; }
.st-on.sel { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 8px; }
.st-bar { display: flex; justify-content: center; gap: 6px; }
.st-bar button { min-width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); font-size: 20px; font-weight: 700; cursor: pointer; display: inline-grid; place-items: center; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.st-grid.big { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.st-btn { aspect-ratio: 1; border-radius: 12px; border: 0; background: var(--subtle); display: grid; place-items: center; cursor: pointer; padding: 6px; width: 100%; }
.st-btn img { width: 100%; height: 100%; object-fit: contain; }
.st-btn:hover { background: var(--hover); }
.st-btn.add { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.st-cell { position: relative; }
.st-wait { width: 60%; height: 60%; border-radius: 99px; background: var(--hover); animation: pulse 1.4s infinite; }
.st-stage { display: grid; place-items: center; padding: 16px; border-radius: 16px; background: repeating-conic-gradient(var(--subtle) 0 25%, var(--card) 0 50%) 0 0 / 20px 20px; }
.st-canvas { width: min(280px, 100%); aspect-ratio: 1; cursor: grab; }
.seg.four-seg { grid-template-columns: repeat(4, 1fr); }
.seg.four-seg .seg-btn { flex-direction: row; justify-content: center; font-size: 13px; padding: 9px 4px; }

/* pull to refresh & presence */
.ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 56px); z-index: 70; width: 40px; height: 40px; border-radius: 99px; background: var(--card);
  border: 1px solid var(--border); box-shadow: var(--pop); display: grid; place-items: center; color: var(--muted); transform: translate(-50%, -120px); transition: transform .2s, opacity .2s; pointer-events: none; }
.ptr.ready { color: var(--accent); }
.ptr.spin svg { animation: spin .8s linear infinite; }
.here { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--subtle); padding: 3px 9px 3px 7px; border-radius: 99px; }
.here::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }
@media (max-width: 400px) { .here { font-size: 0; gap: 0; padding: 6px; } }
body { overscroll-behavior-y: contain; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--primary); flex: none; }
label.row { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }

/* ---------- today ---------- */
.today-head { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }
.today-with { display: flex; align-items: center; gap: 0; margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.today-with > :nth-child(2) { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg); border-radius: 50%; }
.today-with > span:last-child { margin-left: 8px; }
.wait-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; background: var(--card); overflow: hidden; }
.wait-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; min-height: 58px; }
.wait-item + .wait-item { border-top: 1px solid var(--border); }
.wait-item:hover { background: var(--hover); }
.wi-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--subtle); flex: none; }
.wait-item.letter .wi-ico { background: var(--accent-soft); }
.wi-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wi-main strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wi-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 12.5px; font-weight: 600; text-align: center; }
.quick-btn:hover { background: var(--hover); }
.quick-btn svg { color: var(--accent); }
@media (max-width: 360px) { .quick { grid-template-columns: 1fr 1fr; } }

/* ---------- splash ---------- */
.splash { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--bg); transition: opacity .45s ease, visibility .45s; }
.splash.gone { opacity: 0; visibility: hidden; }
.splash-in { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.splash-mark { position: relative; width: 112px; height: 112px; }
.splash-mark .sp-card { position: absolute; inset: 10px 22px; border-radius: 14px; box-shadow: var(--lift); }
.splash-mark .sp1 { background: var(--them); transform: rotate(-14deg) translateX(-14px); animation: sp-l 1.1s cubic-bezier(.2,.9,.3,1.2) both; }
.splash-mark .sp2 { background: var(--me); transform: rotate(12deg) translateX(14px); animation: sp-r 1.1s cubic-bezier(.2,.9,.3,1.2) both; }
.splash-mark img { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; filter: drop-shadow(0 4px 8px rgb(0 0 0 / .25)); animation: sp-pop .7s .45s cubic-bezier(.2,1.4,.4,1) both, sp-beat 1.6s 1.2s ease-in-out infinite; }
.splash h1 { font-size: 24px; font-weight: 800; animation: sp-up .6s .55s ease both; }
.splash p { animation: sp-up .6s .7s ease both; font-size: 13.5px; }
@keyframes sp-l { from { transform: rotate(0) translateX(0); opacity: 0; } }
@keyframes sp-r { from { transform: rotate(0) translateX(0); opacity: 0; } }
@keyframes sp-pop { from { transform: scale(.2); opacity: 0; } }
@keyframes sp-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.07); } }
@keyframes sp-up { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .splash *, .splash { animation: none !important; transition: none !important; } }

/* ---------- switch ---------- */
.menu .switch { margin-left: auto; width: 34px; height: 20px; border-radius: 999px; background: var(--border); position: relative; flex: none; transition: background .2s; }
.menu .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); transition: transform .2s; }
.menu [aria-checked="true"] .switch { background: var(--ok); }
.menu [aria-checked="true"] .switch::after { transform: translateX(14px); }
