/* One layout, two palettes. Light: each round's field colour behind the duel, ink words.
   Dark: true black, you in blue on the left, them in salmon on the right. */
:root {
  --g: #ffffff; --s: #f1f2f3; --s2: #e4e5e7;
  --ink: #111214; --mu: #6c7077; --on: #ffffff; --inbg: #ffffff; --inb: #111214;
  --you: var(--ink); --oth: var(--ink);
  --pri: #a3b898; --on-pri: #111214; --sel: #d6e0cf; --on-sel: #111214;
  --ok: #2f8f57; --warn: #c08a1a; --bad: #c8452f;
  --trk: rgba(17, 18, 20, .14); --n: #a0a4aa;
  --duo-ink: #111214; --duo-mu: rgba(17, 18, 20, .66);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --spring: cubic-bezier(.2, .9, .25, 1); --out: cubic-bezier(.4, 0, .2, 1);
  color-scheme: light;
}
/* Round colours; the second of each pair is the right-hand column. */
.f1 { --fa: #bccdb3; --fb: #aebfa5; } .f2 { --fa: #cbd0a2; --fb: #bcc294; } .f3 { --fa: #e4c7a2; --fb: #d7b891; }
.f4 { --fa: #dbb8ae; --fb: #cda99f; } .f5 { --fa: #a9cbe8; --fb: #98bcdc; }
:root[data-theme="dark"] {
  --g: #000000; --s: #161616; --s2: #272727;
  --ink: #f3f3f3; --mu: #8f8f8f; --on: #000000; --inbg: #0c0c0c; --inb: #5a5a5a;
  --you: #93b6db; --oth: #e6a593;
  --pri: #93b6db; --on-pri: #000000; --sel: #22303e; --on-sel: #93b6db;
  --ok: #6fcf8f; --warn: #e0b048; --bad: #ef7a64;
  --trk: #333333; --n: #5f5f5f;
  --duo-ink: #f3f3f3; --duo-mu: #8f8f8f;
  color-scheme: dark;
}
:root[data-theme="dark"] :is(.f1, .f2, .f3, .f4, .f5) { --fa: #000000; --fb: #161616; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--g); }
body { margin: 0; background: var(--g); color: var(--ink); font: 16px/1.5 var(--font); transition: background-color .25s, color .25s; }
button, input { font: inherit; color: inherit; }
.app { max-width: 520px; margin: 0 auto; padding: 0 18px calc(32px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
h1, h2 { margin: 0; }
.muted { color: var(--mu); }
.small { font-size: 14px; }
.center { text-align: center; }
.pad { padding: 48px 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mu); display: inline-block; flex: none; }
.dot.good { background: var(--ok); } .dot.ok { background: var(--warn); } .dot.bad { background: var(--bad); }

/* controls */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border: 0; border-radius: 26px; background: var(--pri); color: var(--on-pri); font-size: 16px; font-weight: 600; cursor: pointer; padding: 0 18px; text-decoration: none; transition: transform .14s var(--spring), opacity .14s, background-color .2s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: var(--s); color: var(--ink); }
.btn.narrow { max-width: 260px; margin: 0 auto; }
.stack > * + * { margin-top: 10px; }
.link { display: block; width: fit-content; text-decoration: none; margin: 14px auto 0; background: none; border: 0; color: var(--mu); padding: 8px 0; cursor: pointer; font-size: 15px; }
.input { width: 100%; height: 48px; border: 0; border-radius: 12px; background: var(--s); padding: 0 14px; font-size: 17px; outline: none; }
.input:focus-visible { box-shadow: inset 0 0 0 1.5px var(--ink); }
.field { margin: 0 0 16px; }
.label { display: block; font-size: 14px; color: var(--mu); margin: 0 0 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 0 auto; min-width: 56px; height: 40px; border: 0; border-radius: 20px; background: var(--s); cursor: pointer; padding: 0 12px; font-size: 15px; transition: background-color .15s, color .15s, transform .14s var(--spring); }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--on-sel); font-weight: 600; }
.seg button:active { transform: scale(.95); }
.custom-in { margin-top: 8px; }
.toggle { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--s2); position: relative; cursor: pointer; margin: 0; flex: none; transition: background-color .2s; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .24s var(--spring); }
.toggle:checked { background: var(--pri); }
.toggle:checked::after { transform: translateX(18px); background: var(--on); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) {
  .btn:hover { opacity: .88; }
  .seg button:not([aria-pressed="true"]):hover, .chip-f:not([aria-pressed="true"]):hover { background: var(--s2); }
}

/* lobby */
.top { position: sticky; top: 0; z-index: 5; background: var(--g); margin: 0 -18px; padding: 20px 18px 12px; transition: background-color .25s; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-right: auto; white-space: nowrap; }
.brand h1 .a { color: var(--you); } .brand h1 .b { color: var(--oth); }
.wm { width: 110px; height: 30px; font-size: 0; background: var(--ink); -webkit-mask: url(/wordmark.svg) center / contain no-repeat; mask: url(/wordmark.svg) center / contain no-repeat; transition: background-color .25s; }
.net-mini { font-size: 13px; color: var(--mu); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.theme-t { width: 40px; height: 40px; margin-right: -10px; border: 0; background: none; color: var(--ink); display: flex; align-items: center; justify-content: center; border-radius: 20px; cursor: pointer; transition: transform .25s var(--spring); }
.theme-t:active { transform: scale(.88) rotate(-25deg); }
.theme-t svg { width: 20px; height: 20px; }
.tagline { margin: 6px 0 18px; font-size: 15px; color: var(--mu); }
.nethint { margin: -8px 0 12px; font-size: 14px; color: var(--bad); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px; -webkit-user-select: none; user-select: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-f { flex: none; height: 36px; padding: 0 15px; border: 0; border-radius: 18px; background: var(--s); font-size: 15px; cursor: pointer; white-space: nowrap; -webkit-touch-callout: none; transition: background-color .15s, color .15s, transform .14s var(--spring); }
.chip-f[aria-pressed="true"] { background: var(--sel); color: var(--on-sel); font-weight: 600; }
.chip-f:active { transform: scale(.95); }
.chip-f .c { opacity: .55; margin-left: 5px; font-variant-numeric: tabular-nums; }
.chip-f.add { background: none; color: var(--mu); padding: 0 8px; }
.actions { display: flex; gap: 10px; padding: 14px 0 0; }
.actions .btn { min-height: 50px; }
.actions .match { flex: 1.6; } .actions .ghost { flex: 1; }
.count { padding: 28px 0 2px; font-size: 14px; color: var(--mu); min-height: 21px; }
.ptr { height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; font-size: 14px; color: var(--mu); transition: height .2s; }
.ptr span { padding-bottom: 8px; }
ul.list { list-style: none; margin: 0; padding: 0; }
.r { display: flex; align-items: center; gap: 16px; padding: 18px 0; min-height: 80px; max-height: 140px; overflow: hidden; transition: opacity .3s, max-height .35s var(--out), padding .35s var(--out); }
.r + .r { box-shadow: 0 -1px 0 var(--s); }
.r:active .info { opacity: .6; }
.r .info { flex: 1; min-width: 0; }
.r .t { font-size: 17px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r .m { font-size: 13px; color: var(--mu); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r .m .set { display: inline-block; min-width: 9em; margin-right: 6px; }
.r .m b { color: var(--ink); font-weight: 500; }
.r .join { width: auto; min-height: 38px; padding: 0 18px; font-size: 15px; flex: none; }
.r.new { animation: row-in .5s var(--spring) both; }
@keyframes row-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
.r.full { opacity: .4; }
.r.gone { opacity: 0; max-height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; }
.r.skel .t, .r.skel .m { background: var(--s); border-radius: 6px; height: 16px; width: 60%; animation: shimmer 1.2s ease-in-out infinite; }
.r.skel .m { height: 12px; width: 40%; margin-top: 8px; }
@keyframes shimmer { 50% { opacity: .5; } }
.newpill { position: fixed; left: 50%; top: 150px; transform: translateX(-50%); z-index: 6; height: 36px; padding: 0 16px; border: 0; border-radius: 18px; background: var(--pri); color: var(--on-pri); font-size: 14px; font-weight: 600; cursor: pointer; animation: pill-in .3s var(--spring) both; }
@keyframes pill-in { from { opacity: 0; transform: translate(-50%, -10px); } }
.end { text-align: center; color: var(--mu); font-size: 14px; padding: 20px 0 40px; }
.end p { margin: 0 0 12px; }

/* sheets */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; animation: bg-in .2s ease both; }
@keyframes bg-in { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; background: var(--g); border-radius: 22px 22px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); z-index: 31; max-height: 90vh; overflow-y: auto; animation: up .34s var(--spring); transition: transform .3s var(--spring); }
:root[data-theme="dark"] .sheet { background: #111; }
:root[data-theme="dark"] .sheet .input, :root[data-theme="dark"] .sheet .seg button:not([aria-pressed="true"]) { background: #1f1f1f; }
@keyframes up { from { transform: translateY(100%); } }
#sheetRoot.closing .sheet { transform: translateY(100%); transition: transform .2s var(--out); }
#sheetRoot.closing .sheet-bg { opacity: 0; transition: opacity .2s; }
.grab { width: 36px; height: 5px; border-radius: 3px; background: var(--s2); margin: 0 auto 14px; }
.sheet h2 { font-size: 22px; letter-spacing: -.01em; margin-bottom: 14px; }
.sheet-sub { margin: -8px 0 14px; }
.sheet > .btn { margin-top: 6px; }
.sheet .stack { margin-top: 16px; }
.matching { text-align: center; padding: 30px 0 20px; }
.matching .big { font-size: 20px; font-weight: 650; margin: 0 0 6px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--s2); border-top-color: var(--ink); margin: 0 auto 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tag-on { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--sel); color: var(--on-sel); border-radius: 17px; height: 34px; padding: 0 10px 0 13px; font-size: 15px; cursor: pointer; }
.tag-on span { opacity: .6; font-size: 17px; line-height: 1; }
.sug { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; border: 0; border-radius: 10px; background: none; padding: 0 12px; font-size: 16px; text-align: left; cursor: pointer; transition: background-color .12s; }
.sug .sl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug:active { background: var(--s2); }
@media (hover: hover) { .sug:hover { background: var(--s2); } }
.tag-on:active { transform: scale(.95); }

/* page motion */
.room.enter > * { animation: rise .4s var(--spring) both; }
.room.enter > *:nth-child(2) { animation-delay: .03s; }
.room.enter > *:nth-child(3) { animation-delay: .06s; }
.room.enter > *:nth-child(4) { animation-delay: .09s; }
.room.enter > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
::view-transition-old(root) { animation: vt-out .16s var(--out) both; }
::view-transition-new(root) { animation: vt-in .3s var(--spring) both; }
@keyframes vt-out { to { opacity: 0; transform: scale(.985); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

.net { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: var(--warn); color: #1b1400; font-size: 14px; text-align: center; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; }
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--on); padding: 11px 18px; border-radius: 22px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s var(--spring); max-width: calc(100% - 36px); text-align: center; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Reduced motion: keep fades and colour changes, drop travel, flips, loops and the merge. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .room.enter > * { animation-delay: 0s !important; }
  .boom { display: none; }
  .dots i { opacity: .7; }
}
.sug .n { flex: none; color: var(--mu); font-size: 13px; font-variant-numeric: tabular-nums; }
.sheet.tall { min-height: 80vh; display: flex; flex-direction: column; }
.sheet.tall .pick { flex: 1; margin-bottom: 14px; }
.pick-label { font-size: 14px; color: var(--mu); margin: 0 0 6px; }
.picked { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.search { position: relative; z-index: 2; }
.search-i { position: absolute; left: 15px; top: 14px; width: 20px; height: 20px; color: var(--mu); pointer-events: none; }
.tag-input { width: 100%; height: 48px; border: 0; border-radius: 24px; background: var(--s); padding: 0 16px 0 44px; font-size: 16px; outline: none; transition: box-shadow .15s; }
.tag-input:focus { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tag-input:disabled { opacity: .6; }
/* The suggestion card floats over the form, like a menu. */
.pop { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 10; background: var(--g); border-radius: 16px; padding: 6px; max-height: min(296px, 44vh); overflow-y: auto; box-shadow: 0 14px 36px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.06); transform-origin: top center; animation: pop-in .2s var(--spring); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.pop-h { margin: 6px 12px 4px; font-size: 12px; color: var(--mu); }
:root[data-theme="dark"] .pop { background: #1c1c1c; box-shadow: 0 14px 36px rgba(0,0,0,.6), 0 0 0 1px #2c2c2c; }
:root[data-theme="dark"] .sheet .tag-input { background: #1f1f1f; }
:root[data-theme="dark"] .sug:active, :root[data-theme="dark"] .sug:hover { background: #2a2a2a; }


/* ---------- room: see DESIGN.md (core component: the duel field, you left, them right) ---------- */
.room { position: relative; padding-bottom: 8px; }
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 52px; font-size: 15px; }
.back { color: var(--mu); text-decoration: none; padding: 8px 0; justify-self: start; }
.bar .mid { font-weight: 600; white-space: nowrap; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
.bar .mid span { color: var(--mu); font-weight: 400; margin-left: 6px; }
.bar .mid.none { color: var(--mu); font-weight: 400; }
.net-r { justify-self: end; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mu); font-variant-numeric: tabular-nums; white-space: nowrap; }
.net-r.bad { color: var(--bad); }

.duo { display: grid; grid-template-columns: 1fr 1fr; position: relative; margin: 0 -18px; min-height: 128px; color: var(--duo-ink); }
.duo.flow { background: linear-gradient(90deg, var(--pa) 50%, var(--pb) 50%); }
.col { padding: 18px 18px 22px; min-width: 0; background: var(--fa); display: flex; flex-direction: column; justify-content: flex-end; }
.col.o { background: var(--fb); text-align: right; align-items: flex-end; }
.col.empty { background: var(--s); }
:root[data-theme="dark"] .col.empty { background: var(--g); box-shadow: inset 0 0 0 1px var(--s2); }
.col .l { font-size: 13px; color: var(--duo-mu); margin: 0; }
.col b { display: block; font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; overflow-wrap: anywhere; }
.col b.st { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.col.empty b.st { color: var(--mu); font-weight: 500; }
.col.y b { color: var(--you); } .col.o b { color: var(--oth); }
.col b.none { color: var(--mu); font-weight: 500; font-size: 21px; }
.duo.flow .col.y { animation: seam-l .6s var(--spring) both; }
.duo.flow .col.o { animation: seam-r .6s var(--spring) both; }
@keyframes seam-l { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
@keyframes seam-r { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
.duo.rv b:not(.st) { animation: flip .55s var(--spring) both; }
.duo.rv .col.o b { animation-delay: .08s; }
@keyframes flip { from { transform: translateY(14px) scale(.96); opacity: 0; } }

.clock { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: var(--g); color: var(--ink); font-size: 21px; font-weight: 800; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; z-index: 2; }
.clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.clock circle { fill: none; stroke-width: 3; }
.clock .track { stroke: var(--s2); }
.clock .arc { stroke: currentColor; stroke-linecap: round; stroke-dasharray: 157.08; }
.clock.low { color: var(--bad); }
.clock span { position: relative; }

.same-pill { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 50%); z-index: 3; height: 40px; padding: 0 18px; border-radius: 20px; border: 0; background: var(--g); color: var(--ink); font-size: 15px; font-weight: 600; box-shadow: 0 0 0 1.5px var(--ink); white-space: nowrap; cursor: pointer; transition: transform .14s var(--spring); }
.same-pill:active { transform: translate(-50%, 50%) scale(.95); }
.same-pill.sent { box-shadow: 0 0 0 1.5px var(--s2); color: var(--mu); font-weight: 500; }
.ask { display: flex; align-items: center; gap: 10px; margin: 14px 0; padding: 8px 8px 8px 16px; border-radius: 26px; background: var(--fb); color: var(--duo-ink); }
:root[data-theme="dark"] .ask { background: var(--s); }
.ask p { margin: 0 auto 0 0; font-size: 15px; font-weight: 600; }
:root[data-theme="dark"] .ask p { color: var(--oth); }
.ask .no { border: 0; background: none; color: var(--duo-mu); font-size: 14px; padding: 8px 6px; cursor: pointer; }
.ask .yes { border: 0; height: 36px; padding: 0 16px; border-radius: 18px; background: var(--pri); color: var(--on-pri); font-size: 14px; font-weight: 600; cursor: pointer; }
.gap { height: 34px; }

.form { margin: 0; }
.composer { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 6px 0 16px; border-radius: 28px; background: var(--s); position: relative; transition: background-color .15s, box-shadow .15s; }
.composer:focus-within { background: var(--g); box-shadow: inset 0 0 0 2px var(--ink); }
.word-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; padding: 0 0 0 44px; font-size: 20px; font-weight: 650; text-align: center; caret-color: var(--ink); }
.word-ph { position: absolute; left: 0; right: 50px; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 22px; filter: grayscale(1); opacity: .35; padding-left: 44px; }
.word-input:not(:placeholder-shown) ~ .word-ph { display: none; }
.send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--pri); color: var(--on-pri); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .14s var(--spring), background-color .15s; }
.send:active { transform: scale(.92); }
.send[disabled] { background: var(--s2); color: var(--n); cursor: default; transform: none; }
.send svg { width: 20px; height: 20px; }
.done-w { height: 56px; border-radius: 28px; background: var(--s); display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--mu); font-size: 16px; }
.done-w b { color: var(--you); font-size: 20px; }

.history { margin: 30px -18px 0; font-size: 15px; color: var(--mu); }
.pair { display: grid; grid-template-columns: 1fr 44px 1fr; align-items: center; min-height: 40px; padding: 0 18px; }
.pair > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.pair > span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; display: flex; justify-content: flex-end; }
.pair .n { text-align: center; font-size: 12px; color: var(--n); font-variant-numeric: tabular-nums; }
.pair.now { color: var(--ink); }
.pair .none { color: var(--n); }
.dots { display: inline-flex; gap: 4px; align-items: center; height: 20px; color: var(--n); }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .4; animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .4; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.check { color: var(--ok); display: inline-flex; animation: pop .34s var(--spring) both; }
.check svg { width: 20px; height: 20px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.note { text-align: center; font-size: 14px; color: var(--mu); margin: 12px 0 0; }

/* waiting and ready */
.big-h { font-size: 26px; line-height: 1.25; letter-spacing: -.02em; margin: 14px 0 8px; }
.sub { color: var(--mu); margin: 0 0 26px; }
.rule { font-size: 17px; line-height: 1.7; margin: 0 0 26px; }
.meta { display: flex; justify-content: space-between; font-size: 14px; color: var(--mu); padding: 14px 0 0; }
.dock { padding-top: 40px; }
.intro { font-size: 17px; margin: 0 0 22px; }

/* done */
.result-img { width: 100%; display: block; border-radius: 18px; background: var(--s); -webkit-touch-callout: default; user-select: none; margin-top: 4px; }
:root:not([data-theme="dark"]) .result-img { box-shadow: 0 0 0 1px var(--s2); }
.invite { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; padding: 8px 8px 8px 18px; min-height: 56px; border-radius: 28px; background: var(--fb); color: var(--duo-ink); }
:root[data-theme="dark"] .invite { background: var(--s); }
.invite p { margin: 0 auto 0 0; font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
:root[data-theme="dark"] .invite p { color: var(--oth); }
.invite .no { border: 0; background: none; color: var(--duo-mu); font-size: 14px; padding: 8px 6px; cursor: pointer; }
.invite .yes { border: 0; height: 40px; padding: 0 18px; border-radius: 20px; background: var(--pri); color: var(--on-pri); font-size: 15px; font-weight: 600; cursor: pointer; }
.imgset { margin-top: 18px; }
.imgset summary { display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; list-style: none; }
.imgset summary::-webkit-details-marker { display: none; }
.imgset summary span { color: var(--mu); font-weight: 400; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; font-size: 15px; }
.opt .seg { flex: none; flex-wrap: nowrap; }
.opt .seg button { height: 34px; min-width: 62px; font-size: 14px; }
.end-acts { margin-top: 14px; }
.save-tip { text-align: center; font-size: 14px; color: var(--mu); margin: 6px 0 14px; }

/* matched: the two halves close on the seam and become the black band of the result card */
.stage { position: relative; margin: 0 -18px; height: 128px; overflow: visible; z-index: 3; }
.stage .ha, .stage .hb { position: absolute; top: 0; bottom: 0; width: 50%; }
.stage .ha { left: 0; background: var(--fa); } .stage .hb { right: 0; background: var(--fb); }
.stage .hit { position: absolute; inset: 0; background: var(--ink); }
.stage .ws { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 22px; color: var(--g); font-size: 46px; font-weight: 800; letter-spacing: -.03em; }
.stage .ws.two { font-size: 38px; }
.stage.go .ha { animation: half-l .55s var(--spring) both; }
.stage.go .hb { animation: half-r .55s var(--spring) both; }
.stage.go .hit { animation: hit .5s var(--spring) .3s both; }
.stage.go .ws span:first-child { animation: in-l .6s var(--spring) .15s both; }
.stage.go .ws span:last-child { animation: in-r .6s var(--spring) .15s both; }
.stage.go .ws.one span { animation: rise-in .5s var(--spring) .35s both; }
@keyframes half-l { to { transform: translateX(50%); opacity: 0; } }
@keyframes half-r { to { transform: translateX(-50%); opacity: 0; } }
@keyframes hit { from { transform: scaleX(0); } }
@keyframes in-l { from { transform: translateX(-90px); opacity: 0; } }
@keyframes in-r { from { transform: translateX(90px); opacity: 0; } }
@keyframes rise-in { from { transform: scale(.8); opacity: 0; } }
.boom { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.boom i { position: absolute; left: 0; top: 0; opacity: 0; animation: boom 1.3s cubic-bezier(.15,.7,.3,1) both; }
@keyframes boom { 0% { opacity: 0; transform: translate(-50%, -50%); } 8% { opacity: 1; } 35% { opacity: 1; transform: translate(var(--x), var(--y)) rotate(calc(var(--r) * .4)); } 100% { opacity: 0; transform: translate(calc(var(--x) * 1.25), var(--f)) rotate(var(--r)); } }
.room.enter > .stage.go ~ * { animation: rise .45s var(--spring) .7s both; }
/* After the burst the band folds away: the result card below already carries it. */
.room.enter > .stage.go { animation: fold .45s var(--out) 2s both; }
@keyframes fold { to { height: 0; opacity: 0; margin-bottom: -14px; } }

/* lobby rows: half a duel. The host waits on the right; the empty left is your seat. */
ul.list .room-row { display: grid; grid-template-columns: 96px 1fr; min-height: 88px; margin: 0 -18px 4px; overflow: hidden; max-height: 160px; transition: opacity .3s, max-height .35s var(--out), margin .35s var(--out); }
.room-row .join { border: 0; background: var(--s); color: var(--ink); font-size: 16px; font-weight: 600; cursor: pointer; }
.room-row .join:active { background: var(--s2); }
.room-row .join[disabled] { color: var(--mu); cursor: default; }
:root[data-theme="dark"] .room-row .join { background: var(--g); box-shadow: inset 0 0 0 1px var(--s2); }
.room-row .host { background: var(--fb); padding: 14px 18px; text-align: right; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
:root[data-theme="dark"] .room-row .host { background: var(--s); }
.room-row .t { font-size: 17px; font-weight: 650; line-height: 1.35; color: var(--duo-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme="dark"] .room-row .t { color: var(--oth); }
.room-row .m { font-size: 13px; margin-top: 4px; color: var(--duo-mu); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-row.new { animation: row-in .5s var(--spring) both; }
.room-row.full { opacity: .4; }
.room-row.gone { opacity: 0; max-height: 0; min-height: 0; margin-bottom: 0; }
.room-row.skel .host { background: var(--s); } .room-row.skel .t, .room-row.skel .m { background: var(--s2); border-radius: 6px; height: 14px; width: 60%; margin-left: auto; animation: shimmer 1.2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .duo.flow .col, .stage .ha, .stage .hb, .stage .hit, .stage .ws span { animation: none !important; }
  .stage .ha, .stage .hb { display: none; }
  .room.enter > .stage.go { animation: fold .2s linear 1.2s both !important; }
}

/* wide screens: the column reads as the game, the rest of the window steps back */
@media (min-width: 640px) {
  :root { --side: #eceef0; }
  :root[data-theme="dark"] { --side: #111111; }
  html, body { background: var(--side); }
  .app { background: var(--g); min-height: 100vh; transition: background-color .25s; }
}
