/* Tic-Tac-Toe: Etheria's night palette (decision 0243 designs). X is Pip yellow bars, O a blue ring:
   they differ in lightness as well as hue. Everything is drawn from shapes in CSS. */
/* the site's own fonts (site/fonts, served at /fonts/), as the realm kit's bar uses */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/inter.woff2) format('woff2'); }
@font-face { font-family: 'Inter Tight'; font-style: normal; font-weight: 600 800; font-display: swap; src: url(/fonts/inter-tight.woff2) format('woff2'); }
:root {
  --page: #0E0F14; --card: #16181F; --raise: #1F222B; --key: #23262F; --line: #2A2D38; --line-2: #33363F;
  --ink: #F3EEE6; --ink-2: #B4AEA3; --ink-3: #8A857C;
  --x: #FFCF33; --x-base: #B98C00; --x-win: #4A3F14; --o: #6FB7FF; --o-win: #1C3550;
  --mint: #7FE3C4; --coral: #FF9C7A; --bad: #FF8A7A;
  --display: 'Inter Tight', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.45 var(--body); -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--x); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#app { min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top, 0) max(16px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0) max(16px, env(safe-area-inset-left, 0px)); }
#top { display: flex; align-items: center; gap: 10px; min-height: 58px; }
#realmSlot { flex: 1; min-width: 0; }
.tools { display: flex; gap: 8px; }
.ic { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#snd .no { display: none; } #snd[aria-pressed="false"] .on { display: none; } #snd[aria-pressed="false"] .no { display: block; }
#view { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 20px; }

/* words */
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
.kick { font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; color: var(--ink-3); }
.tag { display: inline-flex; align-items: center; color: var(--mint); border: 1px solid var(--mint); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* buttons */
.btn { min-height: 50px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--key); color: var(--ink); font-weight: 600; font-size: 15px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.go { border: 0; background: var(--x); color: var(--page); box-shadow: 0 5px 0 var(--x-base); font-family: var(--display); font-weight: 800; font-size: 19px; min-height: 58px; flex-direction: column; gap: 0; }
.btn.go small { font: 500 13px/1.2 var(--body); }
.btn.go:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--x-base); }
.btn.ghost { background: transparent; border: 0; color: var(--x); min-height: 44px; }
.btn.quiet { background: var(--card); border-color: var(--line); }
.row { display: flex; gap: 8px; }
.row > .btn { flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { border-color: var(--x); background: var(--raise); }

/* marks */
.x, .o { position: relative; display: block; width: 62%; aspect-ratio: 1; }
.x::before, .x::after { content: ""; position: absolute; left: 50%; top: -8%; width: 20%; height: 116%; margin-left: -10%; border-radius: 99px; background: var(--x); transform: rotate(45deg); }
.x::after { transform: rotate(-45deg); }
.o { width: 54%; border-radius: 50%; background: radial-gradient(closest-side, transparent 56%, var(--oc, var(--o)) 59% 96%, transparent 100%); }
.pop { animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* home */
.hero { align-self: center; width: 180px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; }
.hero span.c { aspect-ratio: 1; background: var(--card); border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.hero .strike { position: absolute; left: -9%; top: calc(50% - 4px); width: 118%; height: 8px; border-radius: 4px; background: var(--x); transform: rotate(45deg); box-shadow: 0 0 18px rgba(255,207,51,.55); }
.modes { display: flex; flex-direction: column; gap: 8px; }
.mode { text-align: left; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); min-height: 64px; }
.mode[aria-pressed="true"] { border: 2px solid var(--x); background: var(--raise); padding: 11px 13px; }
.mode b { font-size: 16px; display: block; }
.mode span.d { font-size: 13px; color: var(--ink-2); }
.mode .pic { width: 40px; height: 40px; flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.mode .pic i { border-radius: 3px; background: var(--line-2); }
.mode .pic i.y { background: var(--x); } .mode .pic i.b { background: var(--o); }
.mode .pic.u i { background: none; border: 1.5px solid var(--line-2); } .mode .pic.u i.y { background: rgba(255,207,51,.18); border-color: var(--x); }
.mode .pic.f { display: flex; align-items: center; justify-content: center; gap: 2px; background: var(--raise); border-radius: 6px; }
.mode .pic.f i { width: 6px; height: 6px; border-radius: 50%; background: var(--x); }
.foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.levels { display: flex; gap: 6px; }
.levels .chip { flex: 1; padding: 0 6px; }
.record { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.record b { color: var(--ink); }

/* players */
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pl { padding: 10px 12px; border-radius: 16px; background: var(--raise); border: 2px solid var(--line); display: flex; align-items: center; gap: 10px; min-width: 0; }
.pl.on.px { border-color: var(--x); } .pl.on.po { border-color: var(--o); }
.av { width: 38px; height: 38px; flex: none; border-radius: 12px; color: var(--page); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.pl .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl .who b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .who span { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .sc { font-family: var(--display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.px .sc { color: var(--x); } .po .sc { color: var(--o); }
.status { text-align: center; font-family: var(--display); font-weight: 800; font-size: 22px; min-height: 30px; }
.status.tx { color: var(--x); } .status.to { color: var(--o); } .status.td { color: var(--ink-2); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bar .ttl { font-size: 13px; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; text-align: center; flex: 1; }

#view > .side, #view > .mid, #view > .aside { display: flex; flex-direction: column; gap: 12px; }
#view > .mid { align-items: stretch; }

/* boards */
.board { align-self: center; width: min(100%, 60vh, 440px); display: grid; touch-action: manipulation; }
.board button { border: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: var(--raise); }
.board button:disabled { cursor: default; }
.b3 { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.b3 button { aspect-ratio: 1; border-radius: 22px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.b3 button:not(:disabled):hover { background: var(--key); }
.b3 .x::before, .b3 .x::after { width: 18%; margin-left: -9%; }
.won-x { background: var(--x-win) !important; } .won-o { background: var(--o-win) !important; }
.bu { grid-template-columns: repeat(3, 1fr); gap: 7px; }
.sb { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 5px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); }
.sb.live { border-color: var(--x); background: #2A2614; box-shadow: 0 0 22px rgba(255,207,51,.3); }
.sb.dim button { opacity: .55; }
.sb button { aspect-ratio: 1; border-radius: 6px; background: var(--key); }
.sb .big { position: absolute; inset: 0; border-radius: 12px; background: rgba(14,15,20,.72); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.sb .big .x, .sb .big .o { width: 56%; } .sb .big .o { width: 50%; }
.sb .big.draw { background: rgba(14,15,20,.55); }
.bu .sb.wline { box-shadow: 0 0 0 3px var(--x); }
.b5 { grid-template-columns: repeat(15, 1fr); gap: 2px; padding: 6px; border-radius: 18px; background: var(--card); width: min(100%, 64vh, 560px); }
.b5 button { aspect-ratio: 1; border-radius: 4px; background: var(--key); }
.b5 button.mid { background: var(--line); }
.b5 button.last { box-shadow: inset 0 0 0 2px var(--ink-3); }
.b5 button.aim { box-shadow: inset 0 0 0 2px var(--x); }
.b5 .x { width: 74%; }
.b5 .o { width: 70%; background: radial-gradient(closest-side, transparent 44%, var(--o) 48% 96%, transparent 100%); }
.zoomed { overflow: auto; }
.tip { border-radius: 16px; padding: 12px 14px; background: var(--raise); display: flex; flex-direction: column; gap: 2px; }
.tip b { font-family: var(--display); font-size: 16px; }
.tip.hot { background: #2A2614; border: 1px solid var(--x); } .tip.hot b { color: var(--x); }
.tip span { font-size: 13px; color: var(--ink-2); }

/* the friend's link */
.vs { display: flex; align-items: center; justify-content: center; gap: 18px; padding-top: 6px; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.seat .box { width: 76px; height: 76px; border-radius: 24px; background: var(--raise); border: 2px solid var(--x); display: flex; align-items: center; justify-content: center; }
.seat .box.wait { background: none; border: 2px dashed var(--o); box-shadow: 0 0 0 8px rgba(111,183,255,.08); animation: breathe 1.8s ease-in-out infinite; }
.seat .box .x { width: 46%; } .seat .box .o { width: 36%; }
.seat .box.wait .o { opacity: .45; }
@keyframes breathe { 50% { box-shadow: 0 0 0 14px rgba(111,183,255,.04); } }
.invite { background: var(--raise); border: 1px solid var(--x); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.invite input { height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--page); color: var(--ink); font: 16px var(--body); padding: 0 14px; width: 100%; }
.invite .btn.go { min-height: 50px; font-size: 17px; }
.bubble { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--raise); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 16px; font-weight: 600; box-shadow: 0 14px 30px rgba(0,0,0,.45); z-index: 30; display: flex; gap: 10px; align-items: center; animation: pop .2s ease-out; }
.bubble .av { width: 26px; height: 26px; border-radius: 8px; font-size: 13px; }

/* result */
.result { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 30px; }
.result .badge { width: 104px; height: 104px; border-radius: 32px; display: flex; align-items: center; justify-content: center; }
.result .badge.bx { background: var(--x); box-shadow: 0 8px 0 var(--x-base), 0 0 60px rgba(255,207,51,.35); }
.result .badge.bx .x::before, .result .badge.bx .x::after { background: var(--page); }
.result .badge.bo { background: var(--o); box-shadow: 0 8px 0 #3E7FC0; }
.result .badge.bo .o { --oc: var(--page); }
.result .badge.bd { background: var(--raise); border: 2px solid var(--line-2); }
.result h1 { font-size: 40px; font-weight: 800; margin-top: 16px; line-height: 1; }
.tally { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.tally .n { font-family: var(--display); font-weight: 800; font-size: 44px; font-variant-numeric: tabular-nums; }
.tally .n .a { color: var(--x); } .tally .n .b { color: var(--o); } .tally .n .s { color: var(--ink-3); }
.tally .p { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; width: 11px; height: 11px; border-radius: 3px; animation: fall 1.6s ease-out both; }
@keyframes fall { from { transform: translateY(-30px) rotate(0); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(40px) rotate(160deg); opacity: .9; } }
.rules { display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); }
.rules b { color: var(--ink); }

/* a computer or a wide tablet: the board in the middle, the players beside it */
@media (min-width: 960px) and (min-height: 640px) {
  #view.wide { max-width: 1320px; display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; grid-template-rows: auto 1fr; gap: 20px 32px; align-items: start; }
  #view.wide > .bar { grid-column: 1 / -1; }
  #view.wide > .side { grid-column: 1; display: flex; flex-direction: column; gap: 12px; }
  #view.wide > .mid { grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; }
  #view.wide > .aside { grid-column: 3; display: flex; flex-direction: column; gap: 12px; }
  #view.wide .players { grid-template-columns: 1fr; }
  #view.wide .board.b3 { width: min(100%, 66vh, 520px); }
  #view.wide .board.bu { width: min(100%, 70vh, 640px); }
  #view.wide .board.b5 { width: min(100%, 72vh, 720px); }
}
@media (prefers-reduced-motion: reduce) { .pop, .bubble, .confetti i, .seat .box.wait { animation: none; } }

/* the shelf and share pictures (tools/art.mjs) */
body.art #top { display: none; }
body.art #app { padding: 0; }
body.art #view { max-width: none; margin: 0; padding: 0; height: 100vh; overflow: hidden; background: radial-gradient(70% 90% at 80% 50%, rgba(255,207,51,.10), transparent 60%), var(--page); }
.art-wrap { height: 100%; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; padding: 0 6vw; gap: 4vw; }
.art-words { display: flex; flex-direction: column; gap: 1.4vw; align-items: flex-start; }
.art-words .tag { font-size: 1.6vw; padding: .2vw 1vw; }
.art-words h1 { white-space: nowrap; font-size: 7vw; font-weight: 800; line-height: .95; letter-spacing: -.03em; }
.art-words p { margin: 0; font-size: 2.4vw; color: var(--ink-2); font-weight: 600; }
.art-words .art-ways { color: var(--x); font-size: 1.9vw; }
.art-boards { position: relative; height: 80vh; }
.art-b3 { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 62vh !important; gap: 1.4vh; }
.art-b3 button { border-radius: 3vh; }
.art-b3 .strike { position: absolute; left: -9%; top: calc(50% - .8vh); width: 118%; height: 1.6vh; border-radius: 1vh; background: var(--x); transform: rotate(45deg); box-shadow: 0 0 3vh rgba(255,207,51,.55); }
.art-bu { display: none !important; }
.art-bu .sb { padding: .4vh; gap: .3vh; border-radius: 1.4vh; } .art-bu .sb button { border-radius: .5vh; }
.says { display: flex; flex-direction: column; gap: 8px; }
