/* TideArcade — warm paper, ink outlines, a board-game-box palette. */
:root {
  --paper: #f5efe3; --paper-2: #ece3d2; --card: #fffaf0; --sunk: #e6dccb;
  --ink: #1d1a16; --ink-2: #4a443b; --muted: #776d5f; --faint: #a3978a;
  --line: #ddd2bf; --line-2: #c8b99f;
  --red: #c4472d; --red-2: #a93a23; --green: #2f5d46; --mustard: #e3a72f; --blue: #2f5f9e; --teal: #3e7f99;
  --good: #2f7a4f; --bad: #b3371f;
  --serif: 'Young Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Karla', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r: 12px; --r-lg: 18px;
  --shadow: 0 1px 0 rgba(29, 26, 22, .04), 0 10px 24px -18px rgba(60, 40, 10, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --wrap: 1160px; --gutter: clamp(16px, 4vw, 32px);
  --tabbar: 0px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; padding-bottom: var(--tabbar); overflow-x: hidden; }
main { flex: 1; outline: none; }
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--red); text-decoration-color: var(--red); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--ink); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.005em; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.wrap { width: min(var(--wrap), 100%); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { justify-content: center; text-align: center; }
.mt { margin-top: 1.6rem; }
.row-gap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: grid; gap: 16px; }
.eyebrow, .kicker { display: block; font: 700 .78rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--red); margin: 0 0 12px; }
.label { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.display { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1.04; letter-spacing: -.02em; margin-bottom: 22px; }
.display-sm { font-size: clamp(2rem, 4.4vw, 3rem); letter-spacing: -.015em; }
.display-sm em { font-style: normal; color: var(--muted); }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-2); max-width: 58ch; }
html.guest .only-user, html.signed-in .only-guest { display: none !important; }

/* ---------- buttons ---------- */
.btn { --bg: var(--card); --fg: var(--ink); --bd: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 2px solid var(--bd); background: var(--bg); color: var(--fg); font-weight: 700; font-size: .96rem; line-height: 1.1; text-decoration: none; white-space: nowrap; box-shadow: 0 3px 0 var(--bd); transition: transform .12s var(--ease), box-shadow .12s var(--ease), background-color .15s; -webkit-tap-highlight-color: transparent; position: relative; }
.btn:hover { color: var(--fg); transform: translateY(-1px); box-shadow: 0 4px 0 var(--bd); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--bd); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 0 3px 0 var(--bd); }
.btn-primary { --bg: var(--red); --fg: #fffaf0; }
.btn-primary:hover { --bg: var(--red-2); }
.btn-outline { --bg: transparent; }
.btn-outline:hover { --bg: var(--card); }
.btn-ghost { --bg: transparent; --bd: transparent; box-shadow: none; }
.btn-ghost:hover { --bg: var(--paper-2); box-shadow: none; }
.btn-ghost:active { box-shadow: none; }
.btn-danger { --bg: #f6ddd5; --fg: var(--bad); --bd: var(--bad); }
.btn-sm { min-height: 36px; padding: 6px 13px; font-size: .9rem; border-radius: 9px; }
.btn-xs { min-height: 30px; padding: 3px 10px; font-size: .82rem; border-radius: 8px; border-width: 1.5px; box-shadow: 0 2px 0 var(--bd); }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn.loading { color: transparent; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2.5px solid rgba(255,250,240,.4); border-top-color: #fffaf0; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--line-2); background: var(--card); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--mustard); }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--red); text-decoration: none; margin-top: 10px; }
.link-arrow::after { content: '→'; transition: transform .2s var(--ease); }
.link-arrow:hover::after { transform: translateX(4px); }
.link-btn { background: none; border: 0; padding: 0; color: var(--red); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--paper-2); color: var(--ink-2); border: 1.5px solid var(--line-2); }
.badge-ranked { background: #f6e6bd; border-color: #c9962b; color: #6d4a07; }
.tag { display: inline-block; vertical-align: middle; font: 700 .68rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; background: var(--mustard); color: var(--ink); padding: 5px 7px; border-radius: 5px; border: 1.5px solid var(--ink); margin-left: 6px; }
.notice { padding: 12px 14px; border-radius: 10px; background: #e3ece4; border: 1.5px solid #b7cdbd; color: #24452f; margin: 0 0 14px; }
.notice-link { display: block; text-decoration: none; font-weight: 700; }
html[lang="en"] [data-lang-note] { display: none; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite; }
.app-loading { min-height: 360px; display: grid; place-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- avatars ---------- */
.avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center; background: var(--sunk); border: 2px solid var(--ink); }
.avatar svg { width: 100%; height: 100%; }
.avatar-sm { width: 26px; height: 26px; border-width: 1.5px; }
.avatar-lg { width: 64px; height: 64px; border-width: 2.5px; }
.avatar-xl { width: 92px; height: 92px; border-width: 3px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.avatar-opt { padding: 3px; border: 0; background: none; border-radius: 50%; transition: transform .15s var(--ease); }
.avatar-opt .avatar { width: 100%; height: auto; aspect-ratio: 1; }
.avatar-opt:hover { transform: translateY(-2px) rotate(-4deg); }
.avatar-opt[aria-checked="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--red); }
.avatar-field { border: 0; padding: 0; margin: 0; }
.avatar-edit { position: relative; border: 0; background: none; padding: 0; border-radius: 50%; }
.avatar-edit-label { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); white-space: nowrap; font-size: .72rem; font-weight: 700; background: var(--ink); color: var(--paper); padding: 2px 8px; border-radius: 999px; }
.avatar-panel { margin-bottom: 26px; padding: 18px; border-radius: var(--r); background: var(--paper); border: 1.5px solid var(--line); }
.avatar-panel .avatar-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(245, 239, 227, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1.5px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 22px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.logo-mark { width: 34px; height: 34px; transition: transform .5s var(--ease); }
.brand:hover .logo-mark { transform: rotate(-12deg); }
.brand-name { font: 1.28rem/1 var(--serif); }
.brand-name em { font-style: normal; color: var(--red); }
.main-nav { display: flex; gap: 2px; }
.main-nav a { padding: 8px 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .98rem; border-bottom: 2px solid transparent; }
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--red); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 8px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: .92rem; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary:hover, .dropdown[open] summary { background: var(--paper-2); }
.lang-code { text-transform: uppercase; letter-spacing: .06em; }
.caret { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); display: grid; animation: drop-in .16s var(--ease); z-index: 50; }
.dropdown-menu a, .dropdown-menu button { text-align: left; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); background: none; border: 0; font-size: .95rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--paper-2); color: var(--ink); }
.dropdown-menu a[aria-current] { color: var(--red); }
@keyframes drop-in { from { opacity: 0; transform: translateY(-4px); } }
.user-name { display: grid; line-height: 1.15; text-align: left; }
.user-name small { font-size: .68rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.user-name b { font-size: .92rem; }
.guest-card { width: 270px; padding: 12px; gap: 2px; }
.guest-card p { margin: 0 4px 8px; }
.guest-card-title { display: flex; align-items: center; gap: 10px; font-size: 1rem; margin: 2px 4px 8px !important; }
.guest-card a:nth-last-child(2) { color: var(--red); }
.dot-badge { width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid var(--paper); }
.count-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tabbar: calc(62px + env(safe-area-inset-bottom)); }
  body { font-size: 16px; }
  .main-nav, .hide-sm { display: none !important; }
  .header-row { height: 60px; gap: 10px; }
  .brand-name { font-size: 1.1rem; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: var(--tabbar); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 2px solid var(--ink); }
  .tabbar a { position: relative; display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 700; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current] { color: var(--red); }
  .tabbar .dot-badge { position: absolute; top: 9px; left: calc(50% + 8px); }
  .toasts { bottom: calc(var(--tabbar) + 10px) !important; }
}

/* ---------- motion (kept small) ---------- */
.reveal-ready .reveal { opacity: 0; transform: translateY(12px); }
.reveal { transition: opacity .5s var(--ease) var(--d, 0ms), transform .5s var(--ease) var(--d, 0ms); }
.reveal-ready .reveal.shown { opacity: 1; transform: none; }
.fade-in { animation: fade-in .3s var(--ease); }
.pop-in { animation: pop-in .3s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---------- home ---------- */
.hero { padding: clamp(36px, 6vw, 72px) 0 clamp(28px, 4vw, 48px); border-bottom: 1.5px solid var(--line); background: radial-gradient(circle at 1px 1px, rgba(29,26,22,.07) 1px, transparent 1.4px) 0 0 / 22px 22px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 5vw, 60px); align-items: center; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }
.identity { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; color: var(--ink-2); font-size: .98rem; }
.identity a { font-weight: 700; color: var(--red); }
.hero-scene { margin: 0; }
.hero-scene svg { width: 100%; height: auto; overflow: visible; }
.sc-tile { animation: bob 5s ease-in-out infinite; transform-box: fill-box; }
.sc-die { animation: bob 6s ease-in-out infinite 1s; transform-box: fill-box; }
.disc-a { animation: bob 4.5s ease-in-out infinite .5s; } .disc-c { animation: bob 5.5s ease-in-out infinite 1.5s; }

.section { padding-block: clamp(40px, 6vw, 72px); }
.section-head { margin-bottom: 28px; max-width: 680px; }
.section-head p { color: var(--ink-2); }
.section-head.row { display: flex; align-items: baseline; justify-content: space-between; max-width: none; gap: 16px; }
.section-head h2 { margin: 0 0 6px; }

.game-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.game-tile { grid-column: span 2; display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-lg); overflow: hidden; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.game-tile:nth-child(-n+2) { grid-column: span 3; }
.game-tile:hover { transform: translate(-2px, -2px); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 11px 31px -12px rgba(35, 32, 58, .3); }
.game-tile-art { display: grid; place-items: center; aspect-ratio: 16 / 9; border-bottom: 2px solid var(--ink); background: var(--tile-bg, var(--paper-2)); }
.game-tile-art .art { width: 72%; transition: transform .4s var(--ease); }
.game-tile:hover .game-tile-art .art { transform: rotate(-2deg) scale(1.04); }
.t-wr { --tile-bg: #f3dca0; } .t-chess { --tile-bg: #e9d8bd; } .t-bs { --tile-bg: #cfe1e7; } .t-c4 { --tile-bg: #d6deef; } .t-ttt { --tile-bg: #f2d6ca; }
.game-tile-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.game-tile-body h3 { font-size: 1.5rem; margin-bottom: 6px; }
.game-tile-body h3 a { text-decoration: none; }
.game-tile-body p { color: var(--ink-2); margin-bottom: 10px; }
.game-tile-meta { font-size: .85rem; color: var(--muted) !important; font-weight: 600; }
.game-tile-links { margin: auto 0 0 !important; display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 10px; border-top: 1.5px dashed var(--line-2); }
.game-tile-links a { font-weight: 700; text-decoration: none; color: var(--red); }
.game-tile-links a:hover { text-decoration: underline; }
.art-drop { animation: c4-drop 3.4s var(--ease) infinite; }
@keyframes c4-drop { 0% { transform: translateY(-50px); opacity: 0; } 25% { transform: none; opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } }
.art-x, .art-o { stroke-dasharray: 60; animation: draw-mark 5s infinite; } .art-o { animation-delay: .5s; } .x2 { animation-delay: 1s; } .o2 { animation-delay: 1.5s; }
@keyframes draw-mark { 0% { stroke-dashoffset: 60; } 15%, 92% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.art-timer { transform-origin: 30px 98px; animation: timer 4s linear infinite; }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(.02); } }
.art-hit { transform-origin: 122px 45px; animation: bob 2.4s ease-in-out infinite; }

.points { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; border-block: 1.5px solid var(--line); padding-block: 34px; }
.points svg { width: 40px; height: 40px; fill: none; stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 12px; }
.points h3 { font-size: 1.15rem; margin-bottom: 6px; }
.points p { color: var(--ink-2); font-size: .95rem; margin: 0; }

.top-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.board-card { padding: 20px; border-radius: var(--r-lg); background: var(--card); border: 1.5px solid var(--line-2); min-height: 250px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.board-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1.5px solid var(--line); }
.board-card-head h3 { margin: 0; } .board-card-head a { text-decoration: none; }
.mini-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.mini-list li { display: grid; grid-template-columns: 22px 26px 1fr auto; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px dotted var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { text-decoration: none; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list b { font-variant-numeric: tabular-nums; }
.pos { font: 1rem var(--serif); color: var(--muted); text-align: center; }
.top1 .pos { color: #b0820f; } .top2 .pos { color: #7c8a92; } .top3 .pos { color: #a6643a; }
.empty-board { flex: 1; display: grid; place-items: center; text-align: center; }
.board-card .link-arrow { margin-top: auto; padding-top: 12px; }
.skeleton, .skeleton-lines { position: relative; overflow: hidden; }
.skeleton::after, .skeleton-lines::after, .skeleton-row td::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.4s infinite; }
.skeleton-lines { min-height: 170px; border-radius: 8px; background: repeating-linear-gradient(transparent 0 30px, var(--paper-2) 30px 36px); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.guest-note { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding: 26px 28px; border-radius: var(--r-lg); background: var(--card); border: 2px dashed var(--line-2); }
.guest-note h2 { font-size: 1.5rem; margin-bottom: 4px; }
.guest-note p { margin: 0; color: var(--ink-2); }

.faq-list { display: grid; max-width: 860px; border-top: 1.5px solid var(--line); }
.faq-list details { border-bottom: 1.5px solid var(--line); }
.faq-list summary { cursor: pointer; list-style: none; padding: 18px 44px 18px 0; font: 1.12rem var(--serif); position: relative; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font: 700 1.5rem var(--sans); color: var(--red); transition: transform .2s var(--ease); }
.faq-list details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-list details p { padding: 0 0 18px; color: var(--ink-2); margin: 0; max-width: 70ch; }

/* ---------- ads ---------- */
.ad-slot { margin: 26px auto; text-align: center; }
.ad-slot.ad-live, .ad-slot.ad-dev { min-height: 120px; }
.ad-slot.ad-empty { display: none; }
.ad-label { display: block; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.ad-placeholder { display: grid; place-items: center; min-height: 100px; border: 1.5px dashed var(--line-2); border-radius: 10px; color: var(--faint); font-size: .8rem; background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(29,26,22,.025) 10px 20px); }
.ad-wide.ad-live, .ad-wide.ad-dev { min-height: 100px; margin: 4px 0 20px; }
.ad-side { margin: 0 0 18px; }
.ad-side.ad-live, .ad-side.ad-dev { min-height: 600px; }
.ad-side .ad-placeholder { min-height: 580px; }
.ad-result.ad-live, .ad-result.ad-dev { min-height: 280px; width: min(360px, 100%); margin: 24px auto 0; }
.ad-result .ad-placeholder { min-height: 260px; background-color: var(--card); }
.ad-row td { padding: 0 !important; background: none !important; }

/* ---------- page heads, crumbs, panels ---------- */
.page-head { padding-block: clamp(30px, 5vw, 56px) 20px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .88rem; color: var(--muted); margin: 18px 0 12px; }
.crumbs a { color: var(--ink-2); text-decoration: none; } .crumbs a:hover { color: var(--red); }
.panel { padding: clamp(18px, 3vw, 28px); border-radius: var(--r-lg); background: var(--card); border: 1.5px solid var(--line-2); box-shadow: var(--shadow); }
.panel h2 { font-size: 1.45rem; }
.side-card { padding: 18px; border-radius: var(--r-lg); background: var(--card); border: 1.5px solid var(--line-2); margin-bottom: 18px; }
.side-card h2 { font-size: 1.2rem; margin-bottom: 12px; }
.side-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-stats div { padding: 10px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.side-stats small { display: block; color: var(--muted); font-size: .76rem; font-weight: 600; }
.side-stats b { font: 1.4rem var(--serif); font-variant-numeric: tabular-nums; }

/* ---------- game page ---------- */
.game-page { padding-bottom: 40px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.game-stage { min-width: 0; }
.game-title { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.game-title h1 { font-size: clamp(2rem, 4vw, 2.7rem); margin: 0; }
.game-title p { margin: 2px 0 0; color: var(--ink-2); }
.game-title-art { width: 88px; flex-shrink: 0; padding: 8px; border-radius: 14px; background: var(--tile-bg, var(--paper-2)); border: 2px solid var(--ink); }
.game-word-rush { --tile-bg: #f3dca0; } .game-chess { --tile-bg: #e9d8bd; } .game-battleship { --tile-bg: #cfe1e7; } .game-connect-four { --tile-bg: #d6deef; } .game-tic-tac-toe { --tile-bg: #f2d6ca; }
.game-app { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-lg); padding: clamp(14px, 2.5vw, 26px); min-height: 420px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }
.game-side { position: sticky; top: 88px; }

/* setup */
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.setup-head h2 { margin: 0; font-size: 1.6rem; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.mode-card { display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line-2); }
.mode-card.mode-primary { background: #fbf0d9; border-color: #d9b56a; }
.mode-card h3 { margin: 8px 0 2px; font-size: 1.25rem; }
.mode-card p { color: var(--ink-2); font-size: .94rem; margin: 0 0 10px; }
.mode-card .btn { margin-top: auto; }
.mode-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--ink); color: var(--red); }
.mode-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mode-options { display: grid; gap: 12px; margin-bottom: 14px; }
.setup-foot { margin: 16px 0 0; color: var(--ink-2); }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--paper-2); border: 1.5px solid var(--line-2); gap: 2px; width: 100%; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 700; font-size: .9rem; min-height: 36px; }
.segmented button.active { background: var(--ink); color: var(--paper); }
.segmented button:not(.active):hover { color: var(--ink); background: rgba(255,255,255,.5); }
select, input:not([type=checkbox]):not([type=radio]) { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 10px; border: 2px solid var(--line-2); background: var(--card); color: var(--ink); font-size: 1rem; transition: border-color .15s, box-shadow .15s; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(47,95,158,.18); }
.field { display: grid; gap: 2px; }
.hint { color: var(--muted); font-size: .84rem; margin-top: 4px; }

/* match */
.match { display: grid; gap: 14px; }
.match-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.pl { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--paper); min-width: 0; transition: border-color .2s, background-color .2s; }
.pl:last-child { flex-direction: row-reverse; text-align: right; }
.pl.active { border-color: var(--ink); background: #fbf0d9; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.pl-text { min-width: 0; display: grid; } .pl-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .98rem; } .pl-text small { color: var(--muted); font-size: .8rem; }
.piece-swatch { width: 14px; height: 14px; border-radius: 50%; margin-left: auto; flex-shrink: 0; border: 2px solid var(--ink); }
.pl:last-child .piece-swatch { margin-left: 0; margin-right: auto; }
.game-tic-tac-toe .swatch-0, .game-connect-four .swatch-0 { background: var(--red); } .game-tic-tac-toe .swatch-1 { background: var(--green); } .game-connect-four .swatch-1 { background: var(--mustard); }
.game-chess .swatch-0 { background: #fbf6ea; } .game-chess .swatch-1 { background: #2a2420; }
.game-battleship .piece-swatch { display: none; }
.vs { display: grid; justify-items: center; gap: 2px; color: var(--muted); font: italic 1rem var(--serif); }
.timer { font: 700 1rem var(--sans); font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 6px; background: var(--paper-2); font-style: normal; color: var(--ink); }
.timer.low { color: #fff; background: var(--bad); }
.match-status { text-align: center; min-height: 1.6em; font: 1.12rem var(--serif); }
.match-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.board-host { position: relative; }
.board-frame { margin-inline: auto; }

/* tic-tac-toe: pencil on paper */
.ttt-board { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); width: min(420px, 100%); aspect-ratio: 1; margin-inline: auto; background: var(--card); }
.ttt-cell { position: relative; border: 0; background: transparent; display: grid; place-items: center; padding: 0; transition: background-color .15s; }
.ttt-cell:nth-child(-n+6) { border-bottom: 3px solid var(--ink); }
.ttt-cell:not(:nth-child(3n)) { border-right: 3px solid var(--ink); }
.ttt-board.my-turn .ttt-cell:not(:disabled):hover { background: var(--paper-2); }
.ttt-cell:disabled { cursor: default; }
.ttt-cell.last { background: rgba(227,167,47,.14); }
.ttt-cell.win { background: rgba(227,167,47,.3); }
.mark { width: 66%; height: 66%; fill: none; stroke-width: 10; stroke-linecap: round; }
.mark-x { stroke: var(--red); } .mark-o { stroke: var(--green); }
.mark .stroke { stroke-dasharray: 180; stroke-dashoffset: 180; animation: stroke .32s var(--ease) forwards; }
.mark .s2 { animation-delay: .1s; }
.mark.instant .stroke { animation: none; stroke-dashoffset: 0; }
@keyframes stroke { to { stroke-dashoffset: 0; } }
.ttt-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ttt-line line { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 160; stroke-dashoffset: 160; opacity: 0; }
.ttt-line.show line { opacity: 1; animation: stroke .45s var(--ease) .25s forwards; }

/* connect four */
.c4-board { width: min(560px, 100%); margin-inline: auto; }
.c4-head { position: relative; height: 0; padding-top: calc(100% / 7 * .8); }
.c4-ghost { position: absolute; bottom: 4px; left: calc((100% - 20px) / 7 * var(--col, 3) + 10px); width: calc((100% - 20px) / 7); aspect-ratio: 1; opacity: 0; transition: left .12s var(--ease), opacity .15s; }
.c4-ghost::before { content: ''; display: block; width: 78%; height: 78%; margin: 11%; border-radius: 50%; background: var(--red); border: 2.5px solid var(--ink); opacity: .6; }
.c4-ghost.p1::before { background: var(--mustard); }
.c4-ghost.show { opacity: 1; }
.c4-grid { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); padding: 10px; aspect-ratio: 7 / 6; border-radius: 14px; background: var(--blue); border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }
.c4-slot { position: relative; margin: 9%; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--ink); pointer-events: none; }
.c4-col { grid-row: 1 / -1; position: relative; z-index: 2; border: 0; background: transparent; border-radius: 10px; padding: 0; }
.c4-board.my-turn .c4-col:not(:disabled):hover { background: rgba(255,255,255,.1); }
.c4-col:disabled { cursor: default; }
.disc { position: absolute; inset: -2.5px; border-radius: 50%; background: var(--red); border: 2.5px solid var(--ink); box-shadow: inset 0 0 0 5px rgba(255,255,255,.18); }
.disc.p1 { background: var(--mustard); }
.disc.drop { animation: drop calc(.16s + var(--rows) * .05s) cubic-bezier(.45, 0, .9, .5) both; }
@keyframes drop { from { transform: translateY(calc(var(--rows) * -118% - 60%)); } to { transform: none; } }
.c4-slot.win .disc { box-shadow: inset 0 0 0 5px rgba(255,255,255,.18), 0 0 0 4px var(--card); }
.c4-slot.last:not(.win) .disc::after { content: ''; position: absolute; inset: 38%; border-radius: 50%; background: rgba(255,255,255,.6); }

/* chess */
.chess-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 16px; align-items: start; }
.chess-frame { width: min(600px, 100%); }
.board-rel { position: relative; }
.chess-board { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 6px; overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); user-select: none; -webkit-user-select: none; touch-action: none; }
.sq { position: relative; border: 0; padding: 0; display: grid; place-items: center; aspect-ratio: 1; cursor: default; -webkit-tap-highlight-color: transparent; }
.sq.light { background: #f0dfbf; } .sq.dark { background: #b98a5e; }
.sq[data-file]:not([data-file=""])::after, .sq[data-rank]:not([data-rank=""])::before { position: absolute; font: 700 clamp(8px, 1.4vw, 11px)/1 var(--sans); color: rgba(29, 26, 22, .55); pointer-events: none; }
.sq[data-file]:not([data-file=""])::after { content: attr(data-file); right: 4px; bottom: 3px; }
.sq[data-rank]:not([data-rank=""])::before { content: attr(data-rank); left: 4px; top: 3px; }
.chess-board.my-turn .sq { cursor: pointer; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(227, 167, 47, .38); }
.sq.selected { box-shadow: inset 0 0 0 100px rgba(47, 93, 70, .4); }
.sq.check { box-shadow: inset 0 0 0 100px rgba(196, 71, 45, .55); }
.sq.target::after { content: '' !important; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(29, 26, 22, .3); right: auto !important; bottom: auto !important; }
.sq.target.capture::after { width: 86%; height: 86%; background: transparent; border: 4px solid rgba(29, 26, 22, .3); }
.piece { font-family: 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'DejaVu Sans', 'Apple Symbols', serif; font-size: min(10.4vw, 62px); line-height: 1; pointer-events: none; position: relative; z-index: 1; }
.piece-w { color: #fffaf0; -webkit-text-stroke: 1.3px var(--ink); }
.piece-b { color: #2a2420; -webkit-text-stroke: .6px var(--ink); }
.piece.dragging { z-index: 10; filter: drop-shadow(0 8px 6px rgba(0,0,0,.25)); }
.captured { display: flex; align-items: center; gap: 6px; min-height: 28px; margin: 6px 4px; }
.captured .caps { font-family: 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'DejaVu Sans', serif; font-size: 20px; letter-spacing: -4px; }
.captured .caps.piece-w { color: #fffaf0; -webkit-text-stroke: 1px var(--ink); }
.captured b { font-size: .85rem; color: var(--muted); }
.move-panel { background: var(--paper); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px; }
.move-panel h3 { font: 700 .8rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.move-list { margin: 0; padding: 0 0 0 26px; max-height: 420px; overflow: auto; font-variant-numeric: tabular-nums; font-size: .94rem; }
.move-list li { padding: 2px 0; color: var(--muted); }
.move-list li span { display: inline-block; min-width: 56px; color: var(--ink); font-weight: 600; }
.promo { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(245,239,227,.7); z-index: 20; }
.promo-card { background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 16px; text-align: center; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }
.promo-card .piece { pointer-events: auto; border: 2px solid var(--ink); background: var(--paper); border-radius: 10px; width: 64px; height: 64px; font-size: 44px; }

/* battleship */
.bs-wrap { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bs-wrap.is-setup { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-inline: auto; }
.bs-wrap.is-setup .bs-enemy { display: none; }
.bs-wrap.hide-boards .bs-panel { visibility: hidden; }
.bs-panel { padding: 12px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--paper); }
.bs-panel h3 { font-size: 1.1rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.bs-enemy.active { border-color: var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); }
.bs-enemy.active h3::after { content: '●'; color: var(--red); font-size: .7rem; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.bs-grid { display: grid; grid-template-columns: 18px repeat(10, 1fr); gap: 2px; touch-action: manipulation; }
.bs-axis { font-size: .68rem; color: var(--muted); display: grid; place-items: center; font-weight: 700; }
.bs-cell { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 3px; background: #9cc4d2; transition: background-color .12s; overflow: visible; }
.bs-cell:disabled { cursor: default; }
.bs-cell.ship { background: #8b8f86; box-shadow: inset 0 0 0 1.5px var(--ink); }
.bs-cell.editable { cursor: pointer; }
.bs-cell.editable.ship:hover { background: #a9ada3; }
.bs-own.placing .bs-cell.editable:not(.ship):hover { background: var(--mustard); }
.bs-cell.aim { cursor: crosshair; }
.bs-cell.aim:hover { background: #7fb0c2; box-shadow: inset 0 0 0 2px var(--ink); }
.bs-cell.miss::after { content: ''; position: absolute; inset: 35%; border-radius: 50%; background: #fffaf0; border: 1.5px solid var(--ink); }
.bs-cell.hit { background: #e8a089; }
.bs-cell.hit::after, .bs-cell.sunk::after { content: ''; position: absolute; inset: 20%; background: linear-gradient(45deg, transparent 42%, var(--red) 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--red) 42% 58%, transparent 58%); }
.bs-cell.sunk { background: #5c4a44; box-shadow: inset 0 0 0 1.5px var(--ink); }
.bs-cell.sunk::after { background: linear-gradient(45deg, transparent 42%, #fffaf0 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, #fffaf0 42% 58%, transparent 58%); }
.bs-cell.revealed:not(.sunk) { background: #b3b5ad; }
.fx-splash::before { content: ''; position: absolute; inset: -40%; border-radius: 50%; border: 2px solid #fffaf0; animation: splash .6s ease-out forwards; z-index: 2; }
.fx-boom::before { content: ''; position: absolute; inset: -60%; border-radius: 50%; background: radial-gradient(circle, rgba(227,167,47,.9), rgba(196,71,45,.6) 40%, transparent 70%); animation: splash .5s ease-out forwards; z-index: 2; pointer-events: none; }
@keyframes splash { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.bs-fleet { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.bs-fleet .label { margin: 0 4px 0 0; }
.ship-pip { display: inline-flex; gap: 2px; } .ship-pip i { width: 9px; height: 9px; border-radius: 2px; background: #8b8f86; border: 1px solid var(--ink); }
.ship-pip.sunk i { background: var(--red); opacity: .5; }
.bs-setup { margin-top: 12px; display: grid; gap: 8px; }
.bs-setup p { margin: 0; }
.handoff { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; }
.handoff-card { text-align: center; padding: 28px; max-width: 380px; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }

/* word rush */
.wr-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; }
.wr-stage { position: relative; display: grid; gap: 14px; max-width: 640px; width: 100%; margin-inline: auto; }
.wr-hud { display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 10px; align-items: stretch; }
.wr-ring { --p: 1; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--p) * 360deg), var(--paper-2) 0); position: relative; border: 2px solid var(--ink); }
.wr-ring::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--ink); }
.wr-time { position: relative; font: 1.4rem var(--serif); font-variant-numeric: tabular-nums; }
.low .wr-ring { background: conic-gradient(var(--bad) calc(var(--p) * 360deg), var(--paper-2) 0); }
.wr-meter { padding: 10px 14px; border-radius: 12px; background: var(--paper); border: 1.5px solid var(--line-2); display: grid; align-content: center; }
.wr-meter small { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.wr-meter b { font: 1.45rem var(--serif); font-variant-numeric: tabular-nums; }
.wr-streak.hot { border-color: var(--ink); background: #fbf0d9; } .wr-streak.hot b { color: var(--red); }
.wr-timebar { height: 6px; border-radius: 6px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--line-2); }
.wr-timebar i { display: block; height: 100%; background: var(--green); transform-origin: left; transition: transform .25s linear; }
.low .wr-timebar i { background: var(--bad); }
.wr-prompt { text-align: center; padding: 22px 16px; border-radius: 16px; background: var(--paper); border: 1.5px solid var(--line-2); }
.wr-cat { margin: 0 0 12px; font: 700 .85rem var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--red); }
.wr-letter { width: 100px; height: 112px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; background: var(--mustard); color: var(--ink); font: 4.2rem/1 var(--serif); border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); }
.wr-letter.flip { animation: flip .4s var(--ease); }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: none; } }
.wr-ask { margin: 0; color: var(--ink-2); }
.wr-stage.pulse .wr-prompt { animation: glow .45s; }
@keyframes glow { 30% { box-shadow: 0 0 0 4px rgba(47,122,79,.3); } }
.wr-form { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.wr-input { font-size: 1.15rem !important; min-height: 54px !important; border-color: var(--ink) !important; }
.wr-form.done { opacity: .5; pointer-events: none; }
.wr-feedback { min-height: 1.5em; margin: 0; text-align: center; color: var(--ink-2); font-weight: 700; }
.wr-feedback.good { color: var(--good); } .wr-feedback.bad { color: var(--bad); }
.wr-pops { position: absolute; left: 50%; top: 42%; pointer-events: none; }
.wr-pop { position: absolute; transform: translateX(-50%); font: 1.9rem var(--serif); white-space: nowrap; animation: pop-up .9s var(--ease) forwards; }
.wr-pop.good { color: var(--good); }
@keyframes pop-up { from { opacity: 0; transform: translate(-50%, 10px); } 25% { opacity: 1; transform: translate(-50%, -10px); } to { opacity: 0; transform: translate(-50%, -54px); } }
.wr-log { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.wr-log li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .88rem; background: var(--paper); border: 1px solid var(--line-2); }
.wr-log li.ok i { color: var(--good); font-style: normal; font-weight: 700; } .wr-log li.no { color: var(--muted); text-decoration: line-through; } .wr-log li.no i { color: var(--bad); font-style: normal; }
.wr-countdown { position: absolute; inset: -6px; z-index: 5; display: grid; place-items: center; background: rgba(255,250,240,.92); border-radius: 16px; font: 7rem/1 var(--serif); color: var(--red); }
.wr-countdown.beat { animation: count .9s var(--ease); }
@keyframes count { from { transform: scale(1.4); opacity: 0; } 30% { transform: scale(1); opacity: 1; } }
.wr-side { width: 220px; padding: 14px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line-2); align-self: start; }
.wr-scores, .score-table { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.wr-scores li, .score-table li { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.wr-scores li.me, .score-table li.me { border-color: var(--ink); background: #fbf0d9; }
.wr-scores b, .score-table b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* result & modals */
.layer-host { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.layer-host > * { pointer-events: auto; }
.result-layer, .modal-layer { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: clamp(16px, 5vw, 48px) 14px; background: rgba(245, 239, 227, .9); border-radius: var(--r-lg); overflow-y: auto; animation: fade-in .25s var(--ease); }
.modal-layer { justify-content: center; }
.result-card, .modal-card { width: min(440px, 100%); text-align: center; padding: 26px 22px; border-radius: 16px; background: var(--card); border: 2px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); }
.result-card h2 { font-size: clamp(2rem, 5vw, 2.6rem); margin-bottom: 6px; }
.tone-good h2 { color: var(--green); } .tone-bad h2 { color: var(--bad); }
.result-sub { color: var(--ink-2); }
.rating-change { display: inline-flex; align-items: baseline; gap: 10px; padding: 8px 16px; border-radius: 10px; background: var(--paper); border: 1.5px solid var(--line-2); margin: 6px 0 18px; }
.rating-change .delta { font: 1.8rem var(--serif); }
.rating-change.up .delta { color: var(--good); } .rating-change.down .delta { color: var(--bad); }
.big-score { font: clamp(3rem, 10vw, 4.2rem)/1 var(--serif); margin: 8px 0; font-variant-numeric: tabular-nums; }
.record { color: var(--red); font-weight: 700; }
.missed { text-align: left; margin: 10px 0 18px; padding: 12px 14px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); font-size: .92rem; }
.missed ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.score-table { margin: 8px 0 16px; text-align: left; }
.guest-cta { margin-top: 18px; padding-top: 16px; border-top: 1.5px dashed var(--line-2); }
.guest-cta p { color: var(--ink-2); font-size: .92rem; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* guide */
.guide { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; margin-top: 44px; }
.guide-main { padding: clamp(20px, 3vw, 34px); border-radius: var(--r-lg); background: var(--card); border: 1.5px solid var(--line-2); }
.guide-main h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.guide-intro { color: var(--ink-2); font-size: 1.08rem; }
.guide-list { padding-left: 0; list-style: none; display: grid; gap: 10px; margin: 0 0 18px; counter-reset: g; }
.guide-list li { position: relative; padding-left: 34px; color: var(--ink-2); counter-increment: g; }
.guide-list li::before { content: counter(g); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: .85rem var(--serif); background: var(--paper-2); border: 1.5px solid var(--ink); color: var(--ink); }
.guide-list.tips li::before { content: '✓'; font: 700 .8rem var(--sans); background: #e3ece4; }
.guide-cards { display: grid; gap: 16px; align-content: start; }
.info-card { padding: 18px; border-radius: var(--r-lg); background: var(--card); border: 1.5px solid var(--line-2); }
.info-card p { color: var(--ink-2); font-size: .95rem; }
.chip-links { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-links a { padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--ink); text-decoration: none; font-size: .88rem; font-weight: 700; background: var(--paper); }
.chip-links a:hover { background: var(--mustard); color: var(--ink); }

/* leaderboard */
.lb-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 20px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex-shrink: 0; padding: 7px 16px; border-radius: 999px; border: 1.5px solid var(--line-2); text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: .94rem; background: var(--card); }
.tabs a:hover { border-color: var(--ink); color: var(--ink); }
.tabs a.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; padding-bottom: 40px; }
.lb-main .segmented { width: auto; margin-bottom: 18px; }
.lb-side { position: sticky; top: 88px; }
.podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; align-items: end; gap: 10px; margin-bottom: 20px; }
.podium-step { display: grid; justify-items: center; gap: 6px; text-align: center; padding-top: 12px; min-width: 0; }
.podium-step .avatar { width: 52px; height: 52px; }
.podium-step a { font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.podium-step b { font: 1.25rem var(--serif); }
.podium-step .step { width: 100%; display: grid; place-items: center; font: 2rem var(--serif); border-radius: 10px 10px 0 0; background: var(--card); border: 2px solid var(--ink); border-bottom: 0; }
.place-1 .step { height: 92px; background: #f3dca0; } .place-2 .step { height: 66px; background: #e3e3dc; } .place-3 .step { height: 48px; background: #ecd2bd; }
.place-1 .avatar { width: 64px; height: 64px; }
.podium-step.me a { color: var(--red); }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--card); }
.rank-table, .plain-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rank-table th, .plain-table th { text-align: left; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; background: var(--paper); font-weight: 700; border-bottom: 1.5px solid var(--line-2); }
.rank-table td, .plain-table td { padding: 10px 14px; border-top: 1px solid var(--line); }
.rank-table tbody tr:hover { background: var(--paper); }
.rank-table a { text-decoration: none; font-weight: 700; }
.rank-table .who { display: flex; align-items: center; gap: 10px; }
.rank-table .num { text-align: right; } .rank-table .strong { font-weight: 700; }
.rank-table tr.me { background: #fbf0d9; } .rank-table tr.me a { color: var(--red); }
.rank-table .empty { text-align: center; color: var(--muted); padding: 40px; }
.skeleton-row td { position: relative; height: 46px; overflow: hidden; }
.prose-narrow { max-width: 760px; } .prose-narrow p { color: var(--ink-2); }

/* play, lobby, friends */
.play-grid, .lobby-grid, .friends-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; align-items: start; padding-bottom: 30px; }
.game-picker { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.game-picker label { position: relative; cursor: pointer; }
.game-picker input { position: absolute; opacity: 0; }
.game-picker label > span { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 12px 8px; border-radius: 12px; background: var(--paper); border: 2px solid var(--line-2); transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; height: 100%; }
.game-picker .art { width: 74px; }
.game-picker b { font-size: .92rem; } .game-picker small { color: var(--muted); font-size: .78rem; }
.game-picker input:checked + span { border-color: var(--ink); background: #fbf0d9; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); transform: translate(-1px, -1px); }
.game-picker input:focus-visible + span { outline: 2.5px solid var(--blue); outline-offset: 2px; }
.wr-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.join-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#joinCode { text-transform: uppercase; letter-spacing: .3em; font: 1.25rem var(--serif); text-align: center; }
.invite-list { display: grid; gap: 8px; }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #fbf0d9; border: 1.5px solid #d9b56a; }
.friend-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.friend-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--paper); border: 1.5px solid var(--line-2); text-decoration: none; font-weight: 700; font-size: .9rem; }
.friend-chip i, .presence { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex-shrink: 0; border: 1.5px solid var(--card); }
.friend-chip.online i, .presence.on { background: var(--good); }
.gate { padding-bottom: 40px; }
.gate-card { max-width: 560px; padding: 30px; border-radius: var(--r-lg); background: var(--card); border: 2px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }
.gate-card p { color: var(--ink-2); }
.lobby { padding-top: 30px; }
.lobby-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.code-box { padding: 14px 18px; border-radius: 14px; background: var(--card); border: 2px dashed var(--ink); display: grid; gap: 8px; }
.lobby-code { font: 2.3rem/1 var(--serif); letter-spacing: .16em; color: var(--red); }
.seat-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.seat { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1.5px solid var(--line-2); }
.seat .presence { margin-left: auto; }
.seat.me { border-color: var(--ink); }
.seat.empty { border-style: dashed; background: transparent; }
.lobby-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.invite-friends { display: grid; gap: 6px; margin-bottom: 8px; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.friend-row .btn { margin-left: auto; }
.last-result { margin-top: 18px; padding: 12px 14px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.people-list { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.person > div:nth-child(2) { display: grid; min-width: 0; } .person a { font-weight: 700; text-decoration: none; }
.person .row-gap { margin-left: auto; flex-wrap: nowrap; }
.empty-state { padding: 20px; border-radius: 12px; border: 1.5px dashed var(--line-2); color: var(--muted); text-align: center; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 8px; background: #f6ddd5; border: 1.5px solid #dba08f; color: #7a2412; font-size: .94rem; }

/* auth */
.auth-layout { display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 360px); gap: clamp(24px, 5vw, 64px); justify-content: center; padding-block: clamp(30px, 6vw, 64px); align-items: start; }
.auth-card { padding: clamp(22px, 4vw, 36px); border-radius: var(--r-lg); background: var(--card); border: 2px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); }
.auth-card h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); }
.auth-switch { margin: 18px 0 0; color: var(--ink-2); text-align: center; }
.auth-aside { padding-top: 12px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; border-radius: 8px; }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.pw-toggle.on { color: var(--ink); }
.pw-meter { display: block; height: 5px; border-radius: 4px; background: var(--paper-2); margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .3s var(--ease), background-color .3s; }
.pw-meter i[data-level="ok"] { background: var(--mustard); } .pw-meter i[data-level="strong"] { background: var(--good); }
.nick-wrap { display: flex; align-items: center; gap: 8px; }
.nick-wrap input { flex: 1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .94rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--red); flex-shrink: 0; }
.check-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 12px; }
.check-list li { position: relative; padding-left: 30px; color: var(--ink-2); }
.check-list li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: #e3ece4; border: 1.5px solid var(--green); color: var(--green); }
.preview-card { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 26px; border-radius: 14px; background: var(--card); border: 2px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); rotate: -1.5deg; }
.preview-card div { display: grid; } .preview-card b { font: 1.25rem var(--serif); } .preview-card small { color: var(--muted); }

/* profile */
.profile-head { display: flex; align-items: center; gap: 22px; padding-block: clamp(26px, 5vw, 46px) 24px; flex-wrap: wrap; }
.profile-head h1 { margin: 0; } .profile-head p { margin: 4px 0 0; } .profile-head > .btn { margin-left: auto; }
.stat-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat-card { display: grid; gap: 2px; padding: 16px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line-2); text-decoration: none; transition: transform .2s var(--ease), border-color .2s; }
.stat-card:hover { transform: translateY(-2px); border-color: var(--ink); color: var(--ink); }
.stat-main { font: 2rem var(--serif); font-variant-numeric: tabular-nums; }
.stat-row { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: .86rem; }
.recent-list { display: grid; gap: 6px; }
.recent { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.outcome-pill { text-align: center; padding: 3px 8px; border-radius: 6px; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--paper-2); }
.recent.win .outcome-pill { background: #dcebdf; color: var(--good); }
.recent.loss .outcome-pill { background: #f6ddd5; color: var(--bad); }
.num.up { color: var(--good); } .num.down { color: var(--bad); }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 26px; }
.settings-grid form { margin: 0; padding: 18px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); align-content: start; }
.settings-grid h3 { margin: 0; }
.danger-zone { padding-top: 20px; border-top: 1.5px solid var(--line); max-width: 420px; }

/* prose / legal */
.prose { max-width: 760px; padding-block: clamp(30px, 5vw, 60px); }
.prose h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
.prose h2 { font-size: 1.5rem; margin-top: 1.8em; }
.prose p, .prose li { color: var(--ink-2); }
.prose li { margin-bottom: .4em; }
.prose code { background: var(--paper-2); padding: 2px 6px; border-radius: 5px; font-size: .88em; }
.prose a { color: var(--red); }
.contact-card { display: inline-grid; gap: 4px; padding: 18px 22px; border-radius: 14px; background: var(--card); border: 2px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); margin: 10px 0 20px; }
.contact-mail { font: 1.4rem var(--serif); color: var(--red); text-decoration: none; }

/* 404 */
.not-found { text-align: center; padding-block: clamp(50px, 10vw, 110px); display: grid; justify-items: center; }
.nf-board { display: flex; gap: 10px; margin-bottom: 26px; }
.nf-board i { width: 88px; height: 96px; border-radius: 14px; display: grid; place-items: center; background: var(--mustard); border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); font: 3.4rem var(--serif); font-style: normal; rotate: -4deg; }
.nf-board i.o { background: var(--card); rotate: 3deg; } .nf-board i:last-child { background: var(--red); color: #fffaf0; rotate: 6deg; }

/* footer */
.site-footer { margin-top: 40px; border-top: 2px solid var(--ink); background: var(--paper-2); padding: 46px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
.footer-grid h2 { font: 700 .8rem var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 14px; }
.footer-grid > div { display: grid; align-content: start; gap: 8px; }
.footer-grid a { text-decoration: none; font-size: .96rem; }
.footer-brand p { color: var(--ink-2); font-size: .95rem; max-width: 34ch; margin-top: 12px; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-top: 34px; padding-top: 20px; border-top: 1.5px solid var(--line-2); color: var(--muted); font-size: .88rem; }
.footer-langs { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-langs a { text-decoration: none; color: var(--muted); } .footer-langs a[aria-current] { color: var(--ink); font-weight: 700; }

/* toasts */
.toasts { position: fixed; z-index: 80; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-radius: 12px; background: var(--card); border: 2px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); font-size: .95rem; opacity: 0; transform: translateY(12px); transition: opacity .2s var(--ease), transform .25s var(--ease); }
.toast.in { opacity: 1; transform: none; } .toast.out { opacity: 0; transform: translateX(20px); }
.toast span { flex: 1; }
.toast-error { border-left: 8px solid var(--bad); } .toast-good { border-left: 8px solid var(--good); }
.toast-close { border: 0; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 2px 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .game-layout, .lb-layout { grid-template-columns: minmax(0, 1fr); }
  .game-side, .lb-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
  .game-side .side-card, .lb-side .side-card { margin: 0; }
  .ad-side { display: none; }
  .guide { grid-template-columns: minmax(0, 1fr); }
  .guide-cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .stat-cards { grid-template-columns: repeat(3, 1fr); }
  .chess-wrap { grid-template-columns: minmax(0, 1fr); }
  .chess-frame { margin-inline: auto; }
  .move-panel { width: min(600px, 100%); margin-inline: auto; } .move-list { max-height: 120px; display: flex; flex-wrap: wrap; gap: 0 4px; padding-left: 0; list-style: none; counter-reset: mv; }
  .move-list li { counter-increment: mv; } .move-list li::before { content: counter(mv) '.'; margin-right: 4px; } .move-list li span { min-width: 0; margin-right: 4px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .points { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-scene { max-width: 460px; margin: 0 auto; order: -1; }
  .game-list { grid-template-columns: repeat(2, 1fr); }
  .game-tile, .game-tile:nth-child(-n+2) { grid-column: span 1; }
  .game-tile:first-child { grid-column: span 2; }
  .top-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: span 2; }
  .play-grid, .lobby-grid, .friends-grid, .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .bs-wrap { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-inline: auto; }
  .wr-wrap { grid-template-columns: minmax(0, 1fr); }
  .wr-side { width: auto; order: -1; }
  .guest-note { grid-template-columns: auto 1fr; }
  .guest-note .btn { grid-column: span 2; justify-self: start; }
}
@media (max-width: 760px) {
  .hero-scene { max-width: 360px; }
  .section-head.row { flex-direction: column; align-items: start; }
  .game-title-art { width: 64px; } .game-title { gap: 12px; margin-bottom: 12px; }
  .game-app { padding: 12px; border-radius: 14px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
  .match-bar { gap: 6px; } .pl { padding: 6px 8px; gap: 8px; } .pl .avatar { width: 28px; height: 28px; } .pl-text b { font-size: .88rem; }
  .c4-grid { padding: 6px; }
  .bs-grid { grid-template-columns: 14px repeat(10, 1fr); gap: 1.5px; } .bs-panel { padding: 8px; }
  .wr-hud { grid-template-columns: auto 1fr 1fr; } .wr-hud .wr-meter:last-child { display: none; }
  .wr-ring { width: 62px; height: 62px; } .wr-time { font-size: 1.2rem; } .wr-meter b { font-size: 1.2rem; }
  .wr-letter { width: 84px; height: 94px; font-size: 3.4rem; }
  .wr-prompt { padding: 16px 12px; }
  .wr-form { grid-template-columns: 1fr auto; } .wr-form .btn-ghost { grid-column: span 2; min-height: 38px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .lobby-code { font-size: 1.9rem; }
  .wr-settings, .lobby-settings, .settings-grid { grid-template-columns: 1fr; }
  .points { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 560px) {
  .game-list { grid-template-columns: 1fr; }
  .game-tile:first-child { grid-column: auto; }
  .guest-note { grid-template-columns: 1fr; text-align: left; padding: 20px; }
  .guest-note .btn { grid-column: auto; }
  .recent { grid-template-columns: 60px 1fr auto; gap: 8px; }
  .footer-grid { gap: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal-ready .reveal { opacity: 1; transform: none; }
}

/* =====================================================================
   v3 — playful game style: sunny palette, chunky outlines, title screen
   ===================================================================== */
:root {
  --paper: #fff4dd; --paper-2: #ffe7b3; --card: #ffffff; --sunk: #f1e3c4;
  --ink: #23203a; --ink-2: #4b4763; --muted: #7c7690; --faint: #aaa3b8;
  --line: #f0dcb0; --line-2: #e3c27f;
  --red: #ff5c39; --red-2: #ef4a26; --green: #1f9e6e; --mustard: #ffc93c; --blue: #3d8bff; --sky: #58c4ff; --mint: #2dc68b;
  --good: #1f9e6e; --bad: #e8432a;
  --serif: 'Lilita One', 'Arial Black', Impact, sans-serif;
  --sans: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r: 14px; --r-lg: 20px;
}
body { background-color: var(--paper); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='none' stroke='%23f4e3bf' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M14 14l10 10M24 14L14 24'/%3E%3Ccircle cx='80' cy='30' r='6'/%3E%3Cpath d='M40 86l8 0M44 82l0 8'/%3E%3Ccircle cx='100' cy='96' r='2.5' fill='%23f4e3bf'/%3E%3C/g%3E%3C/svg%3E"); font-weight: 500; }
h1, h2, h3 { font-weight: 400; letter-spacing: .01em; line-height: 1.08; }
.display, .display-sm { letter-spacing: .01em; }
.lede, p { font-weight: 500; }
.eyebrow, .kicker { color: var(--red); font-weight: 900; }
.label { font-weight: 900; color: var(--ink); }

/* chunky game buttons */
.btn { border-width: 3px; border-radius: 14px; font-family: var(--serif); font-weight: 400; letter-spacing: .03em; font-size: 1.02rem; box-shadow: 0 5px 0 var(--bd); }
.btn:hover { box-shadow: 0 6px 0 var(--bd); transform: translateY(-1px); }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--bd); }
.btn-sm { font-size: .92rem; border-radius: 12px; box-shadow: 0 4px 0 var(--bd); }
.btn-xs { font-size: .82rem; box-shadow: 0 3px 0 var(--bd); border-width: 2px; }
.btn-lg { font-size: 1.15rem; min-height: 56px; padding: 12px 26px; }
.btn-ghost { font-family: var(--sans); font-weight: 800; letter-spacing: 0; box-shadow: none; }
.btn-ghost:hover, .btn-ghost:active { box-shadow: none; }
.btn-secondary { --bg: #fff; }
.btn-yellow { --bg: var(--mustard); }
.btn-yellow:hover { --bg: #ffd65e; }
.btn-play { --bg: var(--mustard); font-size: clamp(1.7rem, 4vw, 2.3rem); padding: 14px 54px; min-height: 76px; border-radius: 20px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 12px 34px -13px rgba(35, 32, 58, .3); text-transform: uppercase; animation: play-wiggle 3.5s ease-in-out infinite; }
.btn-play:hover { --bg: #ffd65e; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 14px 40px -15px rgba(35, 32, 58, .3); transform: translateY(-2px) scale(1.03); animation: none; }
.btn-play:active { transform: translateY(8px); box-shadow: 0 0 0 var(--ink); }
@keyframes play-wiggle { 0%, 88%, 100% { rotate: 0deg; } 91% { rotate: -3deg; } 94% { rotate: 3deg; } 97% { rotate: -1.5deg; } }
.link-arrow, .link-btn { font-weight: 900; }

/* cards get chunky outlines everywhere */
.panel, .side-card, .board-card, .info-card, .guide-main, .stat-card, .mode-card, .bs-panel, .wr-prompt, .gate-card, .guest-note { border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); border-radius: var(--r-lg); }
.guest-note { border-style: solid; background: #fff; }
.mode-card.mode-primary { background: #fff3cc; border-color: var(--ink); }
.mode-card { background: #fff; }
.mode-icon { background: var(--mustard); color: var(--ink); border-width: 3px; }
.game-app, .auth-card { border-width: 3px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 12px 34px -13px rgba(35, 32, 58, .3); border-radius: 24px; }
.dropdown-menu, .toast, .result-card, .modal-card, .promo-card, .handoff-card { border-width: 3px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); }
input:not([type=checkbox]):not([type=radio]), select { border-width: 3px; border-color: var(--ink); border-radius: 12px; font-weight: 700; }
.segmented { border: 3px solid var(--ink); background: #fff; }
.segmented button { font-family: var(--serif); font-weight: 400; letter-spacing: .03em; }
.segmented button.active { background: var(--mustard); color: var(--ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.badge { border-width: 2px; border-color: var(--ink); font-weight: 900; }
.badge-ranked { background: var(--mustard); color: var(--ink); }
.avatar { border-width: 2.5px; }

/* header */
.site-header { background: #fff; border-bottom: 3px solid var(--ink); backdrop-filter: none; }
.brand-name { font-size: 1.45rem; }
.main-nav a { font-weight: 800; color: var(--ink-2); border-radius: 10px; border: 0; }
.main-nav a:hover { background: var(--paper); }
.main-nav a[aria-current] { background: var(--mustard); color: var(--ink); }
.dropdown summary { font-weight: 800; }

/* title screen (start page) */
.title-screen { position: relative; overflow: hidden; isolation: isolate; min-height: min(90vh, 820px); display: grid; place-items: center; text-align: center; padding: clamp(50px, 8vw, 90px) 0 clamp(150px, 16vw, 200px); background: linear-gradient(#4dbaff, #8fd8ff 62%, #c9efff); border-bottom: 3px solid var(--ink); }
.sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.cloud { position: absolute; fill: #fff; opacity: .95; animation: cloud-drift 60s linear infinite; }
.cloud.c1 { width: 220px; top: 8%; left: 6%; } .cloud.c2 { width: 160px; top: 22%; right: 10%; animation-duration: 80s; animation-direction: reverse; opacity: .85; } .cloud.c3 { width: 120px; top: 52%; left: 16%; animation-duration: 70s; opacity: .7; }
@keyframes cloud-drift { 50% { transform: translateX(60px); } }
.rain { position: absolute; inset: 0; }
.drop-piece { position: absolute; top: -70px; animation: piece-fall var(--dur) linear var(--delay) infinite; opacity: .95; }
.drop-piece svg { width: 100%; height: auto; filter: drop-shadow(0 3px 0 rgba(35,32,58,.25)); }
@keyframes piece-fall { from { transform: translate(0, 0) rotate(0); } to { transform: translate(var(--sway), 1100px) rotate(var(--spin)); } }
.title-inner { position: relative; display: grid; justify-items: center; }
.title-kicker { display: inline-block; font: 900 .85rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); margin-bottom: 22px; rotate: -2deg; }
.game-logo { margin: 0; display: grid; justify-items: center; line-height: .88; animation: logo-in .8s cubic-bezier(.3, 1.5, .5, 1) both; }
.game-logo span { display: block; font-family: var(--serif); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 9px 0 var(--ink); }
.gl-1 { font-size: clamp(3.4rem, 11vw, 7.6rem); color: #fff; rotate: -3deg; }
.gl-2 { font-size: clamp(3rem, 9.4vw, 6.4rem); color: var(--mustard); rotate: 2deg; margin-top: .05em; }
@keyframes logo-in { from { opacity: 0; transform: scale(.4) translateY(-60px); } to { opacity: 1; transform: none; } }
.title-tagline { font: 900 clamp(1.1rem, 2.4vw, 1.45rem) var(--sans); color: var(--ink); margin: 26px 0 0; max-width: 34ch; background: rgba(255,255,255,.75); padding: 6px 16px; border-radius: 12px; }
.title-cta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; margin-top: 30px; }
.player-card { display: inline-flex; align-items: center; gap: 14px; margin-top: 30px; padding: 12px 14px 12px 12px; background: #fff; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); text-align: left; flex-wrap: wrap; justify-content: center; }
.pc-text { display: grid; line-height: 1.2; }
.pc-text small { font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pc-text b { font: 1.35rem var(--serif); letter-spacing: .02em; }
.pc-text .link-btn { justify-self: start; font-size: .85rem; }
.hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: clamp(90px, 12vw, 150px); z-index: -1; }
.hills .h1 { fill: #8bdc5e; stroke: var(--ink); stroke-width: 3; }
.hills .h2 { fill: #5cc35a; stroke: var(--ink); stroke-width: 3; }

/* home sections */
.section-head h2 { font-size: clamp(2rem, 4vw, 2.8rem); }
.game-tile { border-width: 3px; border-radius: 24px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 12px 34px -13px rgba(35, 32, 58, .3); }
.game-tile:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 16px 46px -17px rgba(35, 32, 58, .3); }
.game-tile-art { border-bottom-width: 3px; background-image: radial-gradient(rgba(255,255,255,.45) 2px, transparent 2.5px); background-size: 18px 18px; }
.t-wr { --tile-bg: #ffd75e; } .t-chess { --tile-bg: #ffb48a; } .t-bs { --tile-bg: #7fd0ff; } .t-c4 { --tile-bg: #9bb8ff; } .t-ttt { --tile-bg: #8fe3b8; }
.game-tile-body h3 { font-size: 1.75rem; }
.game-tile-links a { font-family: var(--serif); font-weight: 400; letter-spacing: .02em; font-size: 1.02rem; }
.tag { background: var(--red); color: #fff; font-family: var(--serif); font-weight: 400; letter-spacing: .06em; border-width: 2px; rotate: -4deg; }
.points { border: 0; }
.points li { background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 20px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); }
.points li:nth-child(1) svg { background: var(--mustard); } .points li:nth-child(2) svg { background: #7fd0ff; } .points li:nth-child(3) svg { background: #8fe3b8; } .points li:nth-child(4) svg { background: #ffb48a; }
.points svg { stroke: var(--ink); padding: 8px; width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--ink); }
.faq-list { border-top: 3px solid var(--ink); }
.faq-list details { border-bottom: 3px solid var(--ink); }
.faq-list summary { font-size: 1.25rem; }
.pos { font-family: var(--serif); }

/* game page */
.game-title h1 { font-size: clamp(2.3rem, 5vw, 3.2rem); }
.game-title-art { border-width: 3px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); background-image: radial-gradient(rgba(255,255,255,.45) 2px, transparent 2.5px); background-size: 14px 14px; }
.game-word-rush { --tile-bg: #ffd75e; } .game-chess { --tile-bg: #ffb48a; } .game-battleship { --tile-bg: #7fd0ff; } .game-connect-four { --tile-bg: #9bb8ff; } .game-tic-tac-toe { --tile-bg: #8fe3b8; }
.pl { border: 3px solid var(--ink); background: #fff; }
.pl.active { background: var(--mustard); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); animation: turn-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes turn-pop { from { transform: scale(.94); } }
.pl-text b { font-family: var(--serif); font-weight: 400; letter-spacing: .02em; font-size: 1.05rem; }
.match-status { font-size: 1.35rem; }

/* tic-tac-toe */
.ttt-cell:nth-child(-n+6) { border-bottom-width: 5px; }
.ttt-cell:not(:nth-child(3n)) { border-right-width: 5px; }
.mark { stroke-width: 13; }
.ttt-board.my-turn .ttt-cell:not(:disabled):hover { background: #fff3cc; }

/* connect four: disc in hand, bouncy drop, thud */
.c4-grid { border-radius: 20px; border-width: 4px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 12px 34px -13px rgba(35, 32, 58, .3); }
.c4-slot { border-width: 3px; background: #e9f2ff; box-shadow: inset 0 4px 0 rgba(35,32,58,.12); }
.disc { border-width: 3px; inset: -3px; background: radial-gradient(circle at 35% 30%, #ff8a6b, var(--red) 60%); box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.disc::before { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 3px solid rgba(35,32,58,.22); }
.disc.p1 { background: radial-gradient(circle at 35% 30%, #ffe08a, var(--mustard) 60%); }
.c4-ghost { position: absolute; bottom: 6px; left: calc((100% - 20px) / 7 * var(--col, 3) + 10px); width: calc((100% - 20px) / 7); aspect-ratio: 1; opacity: 0; transition: left .14s cubic-bezier(.3, 1.4, .5, 1), opacity .15s; }
.c4-ghost::before { display: none; }
.c4-ghost .disc { position: absolute; inset: 9%; }
.c4-ghost.show { opacity: 1; }
.c4-ghost.in .disc { animation: ghost-in .55s cubic-bezier(.3, 1.6, .5, 1) both; }
.c4-ghost.show .disc { box-shadow: inset 0 -4px 0 rgba(0,0,0,.15), 0 10px 0 -4px rgba(35,32,58,.18); }
@keyframes ghost-in { from { transform: translateY(-160%) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.c4-board.my-turn .c4-ghost.show:not(.in) .disc { animation: hover-bob 1.4s ease-in-out infinite; }
@keyframes hover-bob { 50% { transform: translateY(-5px); } }
.disc.drop { animation: c4-fall calc(var(--t, .5s) * 1.9) both; }
@keyframes c4-fall {
  0% { transform: translateY(calc(var(--rows) * -118% - 80%)); animation-timing-function: cubic-bezier(.5, 0, 1, .5); }
  55% { transform: translateY(0) scale(1); animation-timing-function: ease-out; }
  63% { transform: translateY(4%) scale(1.12, .84); animation-timing-function: ease-out; }
  74% { transform: translateY(-22%) scale(.96, 1.06); animation-timing-function: ease-in; }
  84% { transform: translateY(0) scale(1.05, .93); animation-timing-function: ease-out; }
  92% { transform: translateY(-6%); animation-timing-function: ease-in; }
  100% { transform: none; }
}
.c4-grid.thud { animation: thud .25s ease-out; }
@keyframes thud { 30% { transform: translateY(4px); } }
.c4-board.won .c4-slot.win .disc { animation: win-bounce .6s cubic-bezier(.3, 1.6, .5, 1) infinite alternate; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--ink); z-index: 3; }
@keyframes win-bounce { to { transform: translateY(-10%) scale(1.08); } }

/* chess */
.sq.light { background: #ffeccb; } .sq.dark { background: #e09a5f; }
.chess-board { border-width: 4px; border-radius: 12px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 12px 34px -13px rgba(35, 32, 58, .3); }

/* battleship: real hulls, sinking, debris */
.bs-grid { position: relative; }
.bs-ships { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.bs-cell { background: #74c6ee; border-radius: 4px; box-shadow: inset 0 -3px 0 rgba(35,32,58,.08); }
.bs-cell.ship { background: #74c6ee; box-shadow: inset 0 -3px 0 rgba(35,32,58,.08); }
.bs-cell.editable.ship:hover { background: #9bd8f5; }
.bs-cell.hit { background: #ffb39e; }
.bs-cell.sunk { background: #4c87a8; box-shadow: none; }
.bs-cell.revealed:not(.sunk) { background: #74c6ee; }
.bs-cell.miss::after, .bs-cell.hit::after, .bs-cell.sunk::after { z-index: 2; }
.bs-cell.miss::after { background: #fff; border: 2px solid var(--ink); }
.bs-cell.hit::after, .bs-cell.sunk::after { inset: 14%; background: radial-gradient(circle at 50% 60%, #ffe08a 0 22%, var(--red) 23% 52%, transparent 53%); }
.bs-cell.sunk::after { background: radial-gradient(circle, rgba(35,32,58,.55) 0 30%, transparent 31%); }
.ship-sprite { position: absolute; transition: left .15s, top .15s; }
.ship-sprite::before { content: ''; position: absolute; inset: 3px; background: linear-gradient(#e8ebf0, #b9c0cb); border: 3px solid var(--ink); border-radius: 12px 999px 999px 12px / 12px 50% 50% 12px; box-shadow: inset 0 -5px 0 rgba(0,0,0,.12); }
.ship-sprite.vertical::before { border-radius: 999px 999px 12px 12px / 50% 50% 12px 12px; }
.ship-sprite .deck { position: absolute; left: 24%; right: 28%; top: 50%; height: 5px; transform: translateY(-50%); background: repeating-linear-gradient(90deg, var(--ink) 0 5px, transparent 5px 11px); border-radius: 3px; }
.ship-sprite.vertical .deck { left: 50%; right: auto; top: 28%; bottom: 24%; width: 5px; height: auto; transform: translateX(-50%); background: repeating-linear-gradient(var(--ink) 0 5px, transparent 5px 11px); }
.ship-sprite .tower { position: absolute; left: 13%; top: 26%; width: 16%; height: 48%; background: var(--red); border: 2.5px solid var(--ink); border-radius: 5px; }
.ship-sprite.len-2 .tower { width: 24%; } .ship-sprite.len-2 .deck { display: none; }
.ship-sprite.vertical .tower { left: 26%; top: auto; bottom: 13%; width: 48%; height: 16%; }
.ship-sprite.vertical.len-2 .tower { height: 24%; }
.ship-sprite.sunk { transform: rotate(4deg) translateY(10%); filter: grayscale(.7) brightness(.8); opacity: .8; }
.ship-sprite.sunk .tower { background: #555; }
.ship-sprite.sinking { animation: sink 1.9s ease-in both; }
@keyframes sink { 0% { transform: none; filter: none; opacity: 1; } 15% { transform: rotate(-5deg) translateY(-4%); } 35% { transform: rotate(6deg) translateY(2%); filter: none; } 100% { transform: rotate(4deg) translateY(10%); filter: grayscale(.7) brightness(.8); opacity: .8; } }
.bubble { position: absolute; bottom: 30%; aspect-ratio: 1; border-radius: 50%; border: 2px solid #fff; background: rgba(255,255,255,.3); animation: bubble 1.5s ease-out both; }
@keyframes bubble { from { transform: translateY(0) scale(.5); opacity: 1; } to { transform: translateY(-70px) scale(1.2); opacity: 0; } }
.particle { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; z-index: 4; pointer-events: none; animation: particle .7s ease-out forwards; }
.particle.boom { background: var(--mustard); border: 1.5px solid var(--ink); }
.particle.boom:nth-child(odd) { background: var(--red); }
.particle.splash { background: #fff; border: 1.5px solid #2f9be0; width: 5px; height: 5px; }
@keyframes particle { to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }
.fx-boom::before { inset: -80%; background: radial-gradient(circle, #fff 0 12%, #ffe08a 13% 30%, rgba(255,92,57,.8) 31% 50%, transparent 52%); animation: boom-flash .5s ease-out forwards; }
@keyframes boom-flash { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
.bs-panel { background: #fff; }
.bs-enemy.active { box-shadow: 0 6px 0 var(--red); border-color: var(--red); }

/* word rush */
.wr-letter { border-width: 4px; border-radius: 18px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 12px 34px -13px rgba(35, 32, 58, .3); font-family: var(--serif); }
.wr-meter, .wr-side { border: 3px solid var(--ink); background: #fff; }
.wr-meter b { font-family: var(--serif); }
.wr-pop { font-family: var(--serif); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; color: var(--mustard) !important; font-size: 2.3rem; }
.wr-countdown { font-family: var(--serif); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; color: var(--mustard); }

/* result */
.result-card h2 { font-size: clamp(2.4rem, 6vw, 3.2rem); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; color: #fff; text-shadow: 0 5px 0 var(--ink); }
.tone-good h2 { color: var(--mustard); } .tone-bad h2 { color: #ffb39e; }
.result-layer, .modal-layer { background: rgba(77, 186, 255, .55); backdrop-filter: blur(3px); }

/* leaderboard */
.podium-step .step { border-width: 3px; font-family: var(--serif); }
.place-1 .step { background: var(--mustard); } .place-2 .step { background: #dfe7ef; } .place-3 .step { background: #ffb48a; }
.table-wrap { border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); }
.rank-table th { background: var(--mustard); color: var(--ink); border-bottom: 3px solid var(--ink); }
.tabs a { border-width: 3px; border-color: var(--ink); font-family: var(--serif); font-weight: 400; letter-spacing: .02em; }
.tabs a.active { background: var(--mustard); color: var(--ink); }

/* footer: dark board-game box bottom */
.site-footer { background: var(--ink); color: #f3eefc; border-top: 0; position: relative; margin-top: 60px; }
.site-footer::before { content: ''; position: absolute; left: 0; right: 0; top: -22px; height: 24px; background: radial-gradient(circle at 12px 24px, var(--ink) 12px, transparent 12.5px) 0 0 / 24px 24px repeat-x; }
.site-footer a, .footer-brand .brand { color: #fff; }
.site-footer a:hover { color: var(--mustard); }
.footer-grid h2 { color: var(--mustard); }
.footer-brand p, .footer-bottom { color: #b9b3cf; }
.footer-bottom { border-top-color: rgba(255,255,255,.15); }
.footer-langs a { color: #b9b3cf; } .footer-langs a[aria-current] { color: #fff; }

@media (max-width: 760px) {
  .title-screen { min-height: auto; padding-top: 44px; }
  .game-logo span { -webkit-text-stroke-width: 6px; text-shadow: 0 6px 0 var(--ink); }
  .btn-play { padding: 12px 40px; min-height: 66px; }
  .cloud.c1 { width: 130px; } .cloud.c2 { width: 100px; } .cloud.c3 { display: none; }
  .tabbar { border-top-width: 3px; }
  .tabbar a[aria-current] { color: var(--ink); }
  .tabbar a[aria-current] svg { background: var(--mustard); border-radius: 10px; padding: 2px; border: 2px solid var(--ink); width: 30px; height: 30px; }
}

/* =====================================================================
   v4 — calmer shadows, smaller titles, mascot, daily challenge, levels
   ===================================================================== */
/* lighter, shorter shadows */
.panel, .side-card, .board-card, .info-card, .guide-main, .stat-card, .mode-card, .bs-panel, .wr-prompt, .gate-card, .guest-note, .points li { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.game-app, .auth-card { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); }
.game-tile { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); }
.game-tile:hover { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 11px 31px -12px rgba(35, 32, 58, .3); transform: translateY(-3px); }
.btn { box-shadow: 0 3px 0 var(--bd); }
.btn:hover { box-shadow: 0 4px 0 var(--bd); }
.btn:active { transform: translateY(3px); }
.btn-sm, .btn-xs { box-shadow: 0 2px 0 var(--bd); }
.btn-play { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }
.btn-play:hover { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 11px 31px -12px rgba(35, 32, 58, .3); }
.btn-play:active { transform: translateY(5px); }
.dropdown-menu, .toast, .result-card, .modal-card, .promo-card, .handoff-card, .player-card, .table-wrap { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); }
.c4-grid, .chess-board { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }
.title-kicker { box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.pl.active { box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }

/* smaller, better balanced names and titles */
.brand-name { font-size: 1.22rem; }
.gl-1 { font-size: clamp(2.8rem, 8vw, 5.4rem); }
.gl-2 { font-size: clamp(2.4rem, 6.6vw, 4.5rem); }
.game-logo span { -webkit-text-stroke-width: 6px; text-shadow: 0 5px 0 var(--ink); }
.title-tagline { font-size: clamp(1rem, 2vw, 1.2rem); }
.btn-play { font-size: clamp(1.4rem, 3vw, 1.8rem); min-height: 64px; padding: 10px 44px; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.game-tile-body h3 { font-size: 1.4rem; }
.game-title h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); }
.display-sm { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.result-card h2 { font-size: clamp(1.9rem, 5vw, 2.4rem); -webkit-text-stroke-width: 5px; text-shadow: 0 3px 0 var(--ink); }
.match-status { font-size: 1.15rem; }
.pl-text b { font-size: .98rem; }
.pc-text b { font-size: 1.15rem; }
.faq-list summary { font-size: 1.12rem; }
.wr-pop { font-size: 1.9rem; }
.title-screen { min-height: min(80vh, 740px); }

/* mascot */
.mascot { width: 100%; height: auto; overflow: visible; }
.mascot .m-body { transform-origin: 50px 90px; animation: mascot-bounce 2.6s ease-in-out infinite; }
.mascot .m-eyes { transform-origin: 50px 46px; animation: blink-eyes 4.5s infinite; }
@keyframes mascot-bounce { 0%, 100% { transform: none; } 45% { transform: translateY(-5px) scale(1.02, .98); } 55% { transform: translateY(-5px) rotate(-3deg); } }
@keyframes blink-eyes { 0%, 92%, 100% { transform: none; } 95% { transform: scaleY(.1); } }
.mascot-spot { position: absolute; right: max(4%, calc(50% - 560px)); bottom: clamp(56px, 7vw, 92px); width: clamp(84px, 10vw, 130px); z-index: 1; }
.mascot-spot .mascot { animation: mascot-peek 1s cubic-bezier(.3, 1.6, .5, 1) .8s both; }
@keyframes mascot-peek { from { transform: translateY(60%) rotate(15deg); opacity: 0; } }
.speech { position: absolute; right: 85%; top: -6px; white-space: nowrap; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px; font: .95rem var(--serif); letter-spacing: .02em; box-shadow: 0 2px 5px rgba(35, 32, 58, .13); animation: pop-in .4s cubic-bezier(.3, 1.6, .5, 1) 1.5s both; }
.speech::after { content: ''; position: absolute; right: -11px; top: 14px; width: 14px; height: 14px; background: #fff; border-right: 3px solid var(--ink); border-top: 3px solid var(--ink); transform: rotate(45deg); }
.result-mascot { width: 84px; margin: -64px auto 4px; }
.nf-mascot { width: 130px; margin-bottom: 10px; }

/* daily challenge */
.daily-card { display: grid; grid-template-columns: auto 1fr 300px; gap: 28px; align-items: center; padding: 26px; background: #fff; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); position: relative; overflow: hidden; }
.daily-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 10px; background: repeating-linear-gradient(-45deg, var(--mustard) 0 10px, var(--ink) 10px 20px); }
.daily-cal { width: 104px; text-align: center; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); rotate: -4deg; margin-left: 8px; }
.daily-cal span { display: block; background: var(--red); color: #fff; font: 1rem var(--serif); letter-spacing: .1em; text-transform: uppercase; padding: 4px 0; border-bottom: 3px solid var(--ink); }
.daily-cal b { display: block; font: 3.2rem/1.25 var(--serif); }
.daily-body h2 { font-size: clamp(1.6rem, 3vw, 2rem); margin-bottom: 6px; }
.daily-body p { color: var(--ink-2); }
.daily-status, .daily-done { display: inline-block; margin: 12px 0 0; padding: 4px 12px; border-radius: 999px; background: #dff6ea; border: 2px solid var(--green); color: var(--green); font-weight: 900; }
.daily-top { align-self: stretch; padding: 14px; border-radius: 16px; background: var(--paper); border: 2px dashed var(--line-2); }
.daily-top .mini-list li { grid-template-columns: 22px 26px 1fr auto; }
.empty-top { display: block !important; color: var(--muted); font-weight: 700; }
.mode-card.mode-daily { background: #fff3cc; border-color: var(--ink); position: relative; }
.mode-card.mode-daily::after { content: '★'; position: absolute; right: 14px; top: 10px; font-size: 1.4rem; color: var(--red); }

/* levels & achievements */
.avatar-wrap { position: relative; display: inline-flex; }
.lvl-badge { position: absolute; right: -6px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--mustard); border: 2px solid var(--ink); font: .68rem/14px var(--serif); text-align: center; color: var(--ink); }
.xp-line { display: grid; gap: 3px; margin-top: 2px; min-width: 150px; }
.xp-text { font-size: .78rem; font-weight: 900; color: var(--muted); }
.xp-bar { display: block; height: 10px; border-radius: 6px; background: var(--paper-2); border: 2px solid var(--ink); overflow: hidden; }
.xp-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--mint) 0 6px, #25b07a 6px 12px); transition: width 1s cubic-bezier(.3, 1.2, .5, 1); }
.xp-bar-lg { height: 16px; border-radius: 9px; }
.xp-gain { margin: 4px 0 16px; padding: 10px 12px; border-radius: 12px; background: #f3fff8; border: 2px solid var(--green); text-align: left; }
.xp-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.xp-row b { font: 1.3rem var(--serif); color: var(--green); }
.xp-row span { font-weight: 900; color: var(--ink-2); }
.level-up { margin: 8px 0 0; font: 1.1rem var(--serif); color: var(--red); animation: pop-in .5s cubic-bezier(.3, 1.6, .5, 1); }
.progress-panel { margin-top: 0; }
.level-card { display: flex; align-items: center; gap: 18px; }
.level-coin { width: 74px; height: 74px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font: 2rem var(--serif); background: radial-gradient(circle at 35% 30%, #ffe08a, var(--mustard) 60%); border: 4px solid var(--ink); box-shadow: inset 0 0 0 5px rgba(255,255,255,.4), 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.level-info { flex: 1; display: grid; gap: 6px; }
.level-info b { font: 1.3rem var(--serif); letter-spacing: .02em; }
.ach-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ach { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 14px 10px; border-radius: 16px; background: var(--paper); border: 2px dashed var(--line-2); }
.ach b { font: 1rem var(--serif); letter-spacing: .02em; line-height: 1.15; }
.ach small { font-size: .78rem; color: var(--muted); line-height: 1.3; }
.ach-medal { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: #ddd6c8; border: 3px solid #b1a894; margin-bottom: 4px; }
.ach-medal svg { width: 30px; height: 30px; fill: none; stroke: #8f8673; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ach.got { background: #fff; border: 3px solid var(--ink); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.ach.got .ach-medal { background: var(--c); border-color: var(--ink); box-shadow: inset 0 0 0 4px rgba(255,255,255,.45); animation: medal-shine 4s ease-in-out infinite; }
.ach.got .ach-medal svg { stroke: var(--ink); }
.ach:not(.got) b { color: var(--muted); }
@keyframes medal-shine { 0%, 90%, 100% { transform: none; } 94% { transform: rotate(-10deg) scale(1.06); } 97% { transform: rotate(8deg); } }

@media (max-width: 900px) {
  .daily-card { grid-template-columns: auto 1fr; }
  .daily-top { grid-column: span 2; }
}
@media (max-width: 760px) {
  .mascot-spot { width: 76px; bottom: 50px; }
  .speech { display: none; }
  .game-logo span { -webkit-text-stroke-width: 5px; text-shadow: 0 4px 0 var(--ink); }
  .daily-card { grid-template-columns: 1fr; padding: 20px 20px 20px 26px; gap: 16px; }
  .daily-top { grid-column: auto; }
  .daily-cal { width: 84px; }
  .level-coin { width: 60px; height: 60px; font-size: 1.6rem; }
}

/* =====================================================================
   v5 — first-visit entry screen, installable app, phone fixes
   ===================================================================== */
html { overflow-x: clip; }
body { overflow-x: clip; }

/* entry screen: full-screen, app-like; the page underneath stays in the document for search engines */
.entry { display: none; }
html.entry-open body { overflow: hidden; }
html.entry-open .entry { display: grid; place-items: center; position: fixed; inset: 0; z-index: 200; overflow-y: auto; overscroll-behavior: contain; padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); background: linear-gradient(#4dbaff, #8fd8ff 60%, #c9efff); }
html.entry-leaving .entry { animation: entry-out .45s cubic-bezier(.5, 0, .75, 0) forwards; }
@keyframes entry-out { to { opacity: 0; transform: translateY(-4%) scale(1.04); } }
.entry-sky { position: fixed; inset: 0; pointer-events: none; }
.entry-card { position: relative; width: min(460px, 100%); display: grid; gap: 18px; justify-items: center; text-align: center; animation: pop-in .45s cubic-bezier(.3, 1.4, .5, 1); }
.entry-logo .gl-1 { font-size: clamp(2.8rem, 13vw, 4.4rem); }
.entry-logo .gl-2 { font-size: clamp(2.4rem, 11vw, 3.7rem); }
.entry-tag { margin: 0; font-weight: 800; color: var(--ink); background: rgba(255,255,255,.8); padding: 6px 14px; border-radius: 12px; max-width: 36ch; }
.entry-step { width: 100%; background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); padding: 16px; display: grid; gap: 12px; }
.entry-label { margin: 0; font: 1.05rem var(--serif); letter-spacing: .03em; color: var(--ink); }
.entry-langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.entry-langs a { position: relative; min-height: 44px; display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 12px; border: 2.5px solid var(--ink); background: var(--paper); text-decoration: none; font-weight: 800; color: var(--ink); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.entry-langs a:hover { background: #fff; color: var(--ink); }
.entry-langs a[aria-current] { background: var(--mustard); }
.entry-langs a.suggested { animation: lang-nudge 2.4s ease-in-out infinite; }
.entry-langs a.suggested { border-color: var(--red); }
.entry-langs a.suggested[data-hint]::after { content: attr(data-hint); position: absolute; left: 50%; top: -12px; transform: translateX(-50%); white-space: nowrap; font-size: .66rem; font-weight: 900; padding: 1px 7px; border-radius: 999px; background: var(--red); color: #fff; }
@keyframes lang-nudge { 0%, 80%, 100% { transform: none; } 86% { transform: translateY(-3px) rotate(-2deg); } 92% { transform: translateY(-1px) rotate(2deg); } }
.entry-guest { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 14px; text-align: left; background: var(--mustard); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); transition: transform .12s var(--ease), box-shadow .12s var(--ease); -webkit-tap-highlight-color: transparent; }
.entry-guest:hover { background: #ffd65e; transform: translateY(-1px); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); }
.entry-guest:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.entry-guest .avatar-lg { width: 54px; height: 54px; background: #fff; }
.entry-guest-text { flex: 1; display: grid; line-height: 1.2; min-width: 0; }
.entry-guest-text b { font: 1.35rem var(--serif); letter-spacing: .03em; font-weight: 400; }
.entry-guest-text small { font-weight: 700; color: var(--ink-2); overflow-wrap: anywhere; }
.entry-guest-text small span { font-weight: 900; color: var(--ink); }
.entry-arrow { width: 28px; height: 28px; flex-shrink: 0; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.entry-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.entry-accounts .btn { white-space: normal; text-align: center; }
.entry-perks { margin: 0; font-size: .86rem; color: var(--muted); font-weight: 700; }
.entry-tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.entry-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; font-weight: 800; box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.entry-chip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.entry-chip[aria-pressed="false"] .snd-on { opacity: .2; }
.entry-chip[aria-pressed="true"] { background: var(--mint); }
.entry-legal { margin: 0; font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.entry-legal a { color: var(--ink); }

/* phones: keep the header inside the screen (sign-in lives in the tab bar and the entry screen) */
@media (max-width: 760px) {
  .header-actions > .btn.only-guest { display: none !important; }
  .header-actions { gap: 4px; }
  .dropdown summary { padding: 4px 6px; }
  .section-head.row { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .brand-name { font-size: 1rem; }
  .entry-accounts { grid-template-columns: 1fr; }
}
@media (max-height: 700px) {
  .entry-card { gap: 12px; }
  .entry-logo .gl-1 { font-size: 2.6rem; } .entry-logo .gl-2 { font-size: 2.2rem; }
}
@media (max-width: 760px) {
  .title-screen { min-height: auto; padding: 30px 0 120px; }
  .title-kicker { display: none; }
  .title-cta { margin-top: 22px; }
  .player-card { margin-top: 22px; }
}
@media (max-height: 700px) { .entry-step { padding: 12px; gap: 9px; } }

/* =====================================================================
   v6 — layout fixes (no overlapping text), calmer Connect Four, checkers,
   challenges, featured Battleship
   ===================================================================== */
/* Names and small labels use the readable sans font; the display font stays for titles and buttons. */
.pl-text b, .pc-text b, .user-name b, .mini-list a, .podium-step a, .rank-table a, .friend-chip, .seat b { font-family: var(--sans); font-weight: 900; letter-spacing: 0; }
.game-logo { line-height: .98; }
.game-logo span + span { margin-top: .02em; }
h1, h2, h3 { overflow-wrap: anywhere; hyphens: auto; }
.game-tile-body h3 { line-height: 1.15; }

/* match bar: names can wrap to two lines instead of being cut to "Groovy…" */
.match-bar { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.pl { min-height: 58px; }
.pl-text b { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; font-size: .95rem; line-height: 1.15; }
.pl-text small { font-weight: 800; line-height: 1.2; }
.pl.active .pl-text small { color: var(--ink-2); }
.avatar-bot { background: #e3ecf5; }
.game-checkers .swatch-0 { background: #fff8ee; } .game-checkers .swatch-1 { background: var(--ink); }
@media (max-width: 760px) {
  .match-bar { gap: 4px; }
  .pl { padding: 6px; gap: 6px; min-height: 52px; }
  .pl .avatar { width: 30px; height: 30px; }
  .pl-text b { font-size: .82rem; }
  .pl-text small { font-size: .72rem; }
  .piece-swatch { width: 11px; height: 11px; }
  .vs { font-size: .85rem; }
  .match-status { font-size: 1.05rem; }
}
@media (max-width: 400px) { .pl .piece-swatch { display: none; } }

/* tic-tac-toe: three equal rows whatever is drawn inside them (marks no longer stretch their row) */
.ttt-board { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); border-radius: 16px; }
.ttt-cell { min-width: 0; min-height: 0; overflow: hidden; }
.ttt-cell .mark { position: absolute; inset: 17%; width: 66%; height: 66%; }
.ttt-cell.last { background: #fff6dc; }
.ttt-cell.win { background: #ffe9a8; }
.ttt-frame { padding: 6px; }

/* connect four: one quick, clean drop with a small settle; no wobble, shaking or endless bouncing */
.c4-ghost { transition: left .12s ease-out, opacity .15s; }
.c4-ghost.in .disc, .c4-board.my-turn .c4-ghost.show:not(.in) .disc { animation: none; }
.c4-ghost.show .disc { opacity: .85; }
.disc.drop { animation: c4-drop-clean var(--t, .4s) cubic-bezier(.45, .05, .8, .5) both; }
@keyframes c4-drop-clean {
  0% { transform: translateY(calc(var(--rows) * -118% - 80%)); }
  82% { transform: translateY(0); animation-timing-function: ease-out; }
  91% { transform: translateY(-5%); animation-timing-function: ease-in; }
  100% { transform: none; }
}
.c4-grid.thud { animation: none; }
.c4-board.won .c4-slot.win .disc { animation: c4-win .5s ease-out both; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); z-index: 3; }
@keyframes c4-win { 50% { transform: scale(1.1); } }
.c4-board.won .c4-slot:not(.win) .disc { filter: saturate(.55) brightness(.92); transition: filter .4s; }
.c4-slot.last:not(.win) .disc::after { inset: 40%; background: rgba(255,255,255,.75); }

/* checkers */
.ck-frame { width: min(560px, 100%); }
.ck-board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; border: 4px solid var(--ink); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 9px 25px -10px rgba(35, 32, 58, .3); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.ck-sq { position: relative; border: 0; padding: 0; aspect-ratio: 1; display: grid; place-items: center; min-width: 0; -webkit-tap-highlight-color: transparent; }
.ck-sq.light { background: #ffeccb; cursor: default; }
.ck-sq.dark { background: #b8642a; cursor: default; }
.ck-sq[data-file]:not([data-file=""])::after, .ck-sq[data-rank]:not([data-rank=""])::before { position: absolute; font: 800 clamp(8px, 1.4vw, 11px)/1 var(--sans); color: rgba(255, 236, 203, .85); pointer-events: none; z-index: 2; }
.ck-sq[data-file]:not([data-file=""])::after { content: attr(data-file); right: 3px; bottom: 3px; }
.ck-sq[data-rank]:not([data-rank=""])::before { content: attr(data-rank); left: 3px; top: 3px; }
.ck-board.my-turn .ck-sq.movable, .ck-board.my-turn .ck-sq.target, .ck-board.my-turn .ck-sq.selected { cursor: pointer; }
.ck-sq.last { box-shadow: inset 0 0 0 100px rgba(255, 201, 60, .35); }
.ck-sq.selected { box-shadow: inset 0 0 0 100px rgba(31, 158, 110, .45); }
.ck-sq.target::after { content: '' !important; position: absolute; inset: 34% !important; border-radius: 50%; background: rgba(255, 248, 238, .75); border: 2px solid var(--ink); z-index: 1; }
.ck-sq.must .ck-piece { box-shadow: 0 0 0 3px var(--mustard), 0 0 0 5px var(--ink); }
.ck-piece { position: relative; z-index: 1; width: 78%; height: 78%; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); pointer-events: none; }
.ck-piece::before { content: ''; position: absolute; inset: 20%; border-radius: 50%; border: 2.5px solid rgba(35,32,58,.2); }
.ck-piece.side-0 { background: radial-gradient(circle at 35% 30%, #fff, #f3e7d3 60%); }
.ck-piece.side-1 { background: radial-gradient(circle at 35% 30%, #5a5570, #23203a 65%); border-color: #0f0d1c; }
.ck-piece.side-1::before { border-color: rgba(255,255,255,.18); }
.ck-piece svg { position: relative; width: 56%; height: 56%; fill: var(--mustard); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.ck-piece.taken { opacity: .45; transform: scale(.85); transition: opacity .2s, transform .2s; }
.ck-poof { position: absolute; inset: 15%; border-radius: 50%; border: 3px solid #fff8ee; animation: splash .45s ease-out forwards; z-index: 3; pointer-events: none; }
.ck-count { display: flex; align-items: center; gap: 8px; min-height: 30px; margin: 6px 4px; font-weight: 900; color: var(--ink-2); }
.ck-mini { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--ink); background: #fff8ee; }
.ck-mini.side-1 { background: var(--ink); }

/* featured game tile (Battleship) */
.game-list { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.game-tile { grid-column: span 2; }
.game-tile:nth-child(-n+2) { grid-column: span 2; }
.game-tile-featured { grid-column: 1 / -1 !important; display: grid; grid-template-columns: 1.1fr 1fr; }
.game-tile-featured .game-tile-art { aspect-ratio: auto; min-height: 260px; border-bottom: 0; border-right: 3px solid var(--ink); }
.game-tile-featured .game-tile-art .art { width: min(78%, 420px); }
.game-tile-featured .game-tile-body { padding: clamp(20px, 3vw, 34px); justify-content: center; }
.game-tile-featured h3 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); }
.game-tile-featured .eyebrow { margin-bottom: 8px; }
.game-tile-featured .row-gap { margin-top: 8px; }
.game-tile:nth-child(2), .game-tile:nth-child(3) { grid-column: span 3; }
.t-ck { --tile-bg: #ffcf9e; }
.game-checkers { --tile-bg: #ffcf9e; }
.title-featured { margin: 14px 0 0; font-weight: 800; color: var(--ink); font-size: .98rem; }
@media (max-width: 900px) {
  .game-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-tile, .game-tile:nth-child(2), .game-tile:nth-child(3) { grid-column: span 1; }
  .game-tile-featured { grid-template-columns: 1fr; }
  .game-tile-featured .game-tile-art { min-height: 0; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 3px solid var(--ink); }
}
@media (max-width: 560px) {
  .game-list { grid-template-columns: minmax(0, 1fr); }
  .game-tile, .game-tile:nth-child(2), .game-tile:nth-child(3) { grid-column: auto; }
}

/* title screen: pieces fall only in the side lanes, mascot never covers the player card */
.drop-piece { opacity: .8; }
@media (max-width: 760px) {
  .mascot-spot { display: none; }
  .title-featured { font-size: .9rem; max-width: 30ch; }
}
@media (max-width: 1100px) { .speech { display: none; } }

/* challenges */
.ch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; padding-bottom: 20px; }
.ch-side { position: sticky; top: 88px; }
.ch-head { margin: 34px 0 14px; align-items: center; }
.ch-head h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 1.9rem); }
.ch-reset { font-weight: 900; font-variant-numeric: tabular-nums; background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 12px; font-size: .88rem; white-space: nowrap; }
.ch-streak { display: flex; gap: 20px; align-items: center; padding: 20px; background: #fff; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); }
.ch-streak.hot { background: linear-gradient(120deg, #fff 55%, #fff3cc); }
.ch-flame { position: relative; width: 84px; flex-shrink: 0; }
.ch-flame svg { width: 100%; height: auto; }
.ch-flame b { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font: 1.9rem/1 var(--serif); color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.ch-streak-body { min-width: 0; flex: 1; }
.ch-streak-body h2 { margin: 0 0 4px; font-size: clamp(1.4rem, 3vw, 1.8rem); }
.ch-streak-body p { margin: 0 0 12px; }
.ch-week { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 420px; }
.ch-week li { display: grid; justify-items: center; gap: 4px; font-size: .74rem; font-weight: 900; color: var(--muted); text-transform: uppercase; min-width: 0; }
.ch-week li span { overflow: hidden; max-width: 100%; }
.ch-week i { width: 100%; max-width: 38px; aspect-ratio: 1; border-radius: 50%; border: 2.5px dashed var(--line-2); background: var(--paper); }
.ch-week li.on i { border: 2.5px solid var(--ink); background: radial-gradient(circle at 35% 30%, #ffb08a, var(--red) 60%); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.ch-week li.today span { color: var(--ink); }
.ch-week li.today i { outline: 3px solid var(--mustard); outline-offset: 2px; }
.ch-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.ch-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.ch-card.skeleton { min-height: 78px; border-style: dashed; box-shadow: none; }
.ch-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; border: 3px solid var(--ink); background: #7fd0ff; }
.tier-1 .ch-icon { background: var(--mustard); } .tier-2 .ch-icon { background: #ff8a6b; } .tier-3 .ch-icon { background: #b9a2ff; }
.ch-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ch-text { display: grid; gap: 6px; min-width: 0; }
.ch-text b { font-weight: 900; line-height: 1.25; overflow-wrap: anywhere; }
.ch-text small { color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.ch-bar { display: block; height: 12px; border-radius: 8px; background: var(--paper-2); border: 2px solid var(--ink); overflow: hidden; }
.ch-bar i { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--mint) 0 6px, #25b07a 6px 12px); transition: width .8s cubic-bezier(.3, 1.2, .5, 1); }
.ch-reward { display: grid; justify-items: end; gap: 6px; }
.ch-xp { font: 1rem var(--serif); letter-spacing: .02em; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.ch-done { font-weight: 900; color: var(--good); white-space: nowrap; }
.ch-card.done { background: #f1fff7; }
.ch-card.done .ch-icon { background: var(--mint); }
.ch-card.compact { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 12px; gap: 10px; border-width: 2.5px; box-shadow: none; border-radius: 14px; }
.ch-card.compact .ch-icon { width: 36px; height: 36px; border-radius: 11px; border-width: 2.5px; }
.ch-card.compact .ch-icon svg { width: 19px; height: 19px; }
.ch-card.compact .ch-text b { font-size: .9rem; }
.ch-card.compact .ch-bar { height: 9px; }
.ch-card.compact .ch-text small { font-size: .74rem; }
.ch-card.compact .ch-xp { font-size: .85rem; }
.ch-bonus { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 16px; border: 3px dashed var(--ink); border-radius: 18px; background: #fffaf0; }
.ch-bonus div { display: grid; min-width: 0; }
.ch-bonus b { font-weight: 900; }
.ch-chest { width: 48px; flex-shrink: 0; }
.ch-chest.open svg { animation: pop-in .5s cubic-bezier(.3, 1.6, .5, 1); }
.ch-wr { margin-top: 34px; grid-template-columns: auto 1fr; }
.ch-rewards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ch-reward-card { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 16px 10px; background: var(--paper); border: 2.5px dashed var(--line-2); border-radius: 18px; }
.ch-reward-card .avatar { filter: grayscale(1) brightness(1.05); opacity: .55; }
.ch-reward-card.got { background: #fff; border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.ch-reward-card.got .avatar { filter: none; opacity: 1; }
.ch-reward-card b { font: 1rem var(--serif); letter-spacing: .02em; }
.ch-reward-card small { color: var(--ink-2); font-weight: 700; line-height: 1.3; }
.home-challenges { grid-template-columns: auto minmax(0, 1fr) 280px; }
.home-challenges .ch-list { margin: 4px 0 16px; }
.home-streak { display: grid; align-content: start; gap: 8px; }
.home-streak p { margin: 0; }
.home-streak-n { display: flex; align-items: baseline; gap: 8px; font-weight: 900; }
.home-streak-n b { font: 2.6rem/1 var(--serif); color: var(--red); }
.home-streak .ch-week li { font-size: .68rem; }
.side-challenges .ch-list { margin-bottom: 4px; }
.side-challenges .ch-card.compact { grid-template-columns: auto minmax(0, 1fr); }
.side-challenges .ch-card.compact .ch-reward { grid-column: 2; justify-items: start; grid-auto-flow: column; }
.result-challenges { margin: 4px 0 16px; padding: 12px 14px; border-radius: 14px; background: #fff3cc; border: 2.5px solid var(--ink); text-align: left; animation: pop-in .4s cubic-bezier(.3, 1.6, .5, 1) .3s both; }
.result-challenges ul { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 4px; }
.result-challenges li { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; }
.result-challenges li b { white-space: nowrap; color: var(--green); }
.result-challenges .link-arrow { margin-top: 4px; }
@media (max-width: 1080px) {
  .ch-layout { grid-template-columns: minmax(0, 1fr); }
  .ch-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
  .ch-side .side-card { margin: 0; }
}
@media (max-width: 900px) {
  .home-challenges { grid-template-columns: auto minmax(0, 1fr); }
  .home-challenges .daily-top { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .home-challenges { grid-template-columns: minmax(0, 1fr); }
  .home-challenges .daily-cal { display: none; }
  .ch-streak { padding: 16px; gap: 14px; align-items: flex-start; }
  .ch-flame { width: 62px; }
  .ch-flame b { font-size: 1.5rem; -webkit-text-stroke-width: 4px; }
  .ch-card { grid-template-columns: auto minmax(0, 1fr); padding: 12px; gap: 12px; }
  .ch-card .ch-reward { grid-column: 2; grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; }
  .ch-icon { width: 40px; height: 40px; }
  .ch-head { flex-direction: row !important; align-items: center !important; }
  .ch-wr { grid-template-columns: 1fr; }
}

/* avatars that still need unlocking */
.avatar-opt { position: relative; }
.avatar-opt.locked .avatar { filter: grayscale(1); opacity: .5; }
.avatar-lock { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; }
.avatar-lock svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }

/* profile: six games */
.stat-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; }

/* tab bar labels never collide */
@media (max-width: 760px) {
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 2px; }
}

/* battleship: deeper water, clearer grid */
.bs-grid { padding: 6px; border-radius: 12px; background: linear-gradient(#bfe6fb, #9fd6f5); border: 2.5px solid var(--ink); }
.bs-cell { background: linear-gradient(#7fcdf3, #5fb8e8); }
.bs-cell.aim:hover { background: #ffe08a; box-shadow: inset 0 0 0 2px var(--ink); }
.bs-cell.hit { background: #ffb39e; }
.bs-cell.sunk { background: #4c87a8; }
.bs-panel h3 { font-size: 1.15rem; }
.bs-own.under-fire h3::after { content: '●'; color: var(--red); font-size: .7rem; animation: blink 1.4s infinite; }

/* colour swatch sits on the avatar corner, leaving the whole width for the name */
.pl { position: relative; }
.pl .piece-swatch { position: absolute; left: 34px; bottom: 5px; margin: 0; width: 14px; height: 14px; }
.pl:last-child .piece-swatch { left: auto; right: 34px; margin: 0; }
.pl-text b { overflow-wrap: normal; word-break: normal; }
@media (max-width: 760px) {
  .pl .piece-swatch { left: 24px; bottom: 4px; width: 11px; height: 11px; display: block; }
  .pl:last-child .piece-swatch { right: 24px; }
  .pl-text b { font-size: clamp(.74rem, 3.4vw, .86rem); overflow-wrap: anywhere; }
  .vs { font-size: .78rem; }
}
.game-app:has(.result-layer) { min-height: 620px; }
.game-battleship .pl .piece-swatch, .game-word-rush .pl .piece-swatch { display: none !important; }
@media (max-width: 480px) {
  .match-bar .vs > span { display: none; }
  .match-bar .vs .timer { font-size: .8rem; padding: 2px 4px; }
  .match-bar { gap: 6px; }
  .pl-text b { font-size: clamp(.72rem, 3.3vw, .84rem); }
}

/* =====================================================================
   v7 — softer buttons, welcome back, live strip, four new games
   ===================================================================== */
/* buttons: a thin edge instead of a thick block shadow */
.btn { box-shadow: 0 2px 0 var(--bd); border-width: 2.5px; }
.btn:hover { box-shadow: 0 3px 0 var(--bd); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--bd); }
.btn-sm, .btn-xs { box-shadow: 0 1.5px 0 var(--bd); }
.btn-play { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); animation: none; }
.btn-play:hover { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); transform: translateY(-1px); }
.btn-play:active { transform: translateY(3px); box-shadow: none; }
.btn-ghost, .btn-ghost:hover { box-shadow: none; }
.entry-guest { box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.entry-guest:hover { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.entry-langs a, .entry-chip { box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.player-card, .title-kicker { box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.btn-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn-ico circle { fill: currentColor; stroke: none; }

/* entry: welcome back */
.entry-back { gap: 14px; }
.entry-back-head { display: flex; align-items: center; gap: 12px; text-align: left; }
.entry-back-head div { display: grid; min-width: 0; }
.entry-back-head b { font: 1.4rem var(--serif); letter-spacing: .02em; overflow-wrap: anywhere; }
.entry-back-head small { color: var(--ink-2); font-weight: 700; }
.entry-back-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.entry-stat { display: grid; justify-items: center; padding: 10px 6px; border-radius: 14px; background: var(--paper); border: 2px solid var(--ink); }
.entry-stat b { font: 1.8rem/1 var(--serif); color: var(--red); }
.entry-stat small { font-weight: 800; color: var(--ink-2); font-size: .8rem; text-align: center; line-height: 1.2; margin-top: 4px; }
.entry-back .btn-play { min-height: 56px; font-size: 1.3rem; }
html.signed-in .entry-how, html.signed-in .entry-langs-step { display: none; }

/* live strip */
.live-strip { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding: 10px 14px; background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex-shrink: 0; box-shadow: 0 0 0 0 rgba(255,92,57,.6); animation: live-pulse 2s infinite; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 8px rgba(255,92,57,0); } 100% { box-shadow: 0 0 0 0 rgba(255,92,57,0); } }
.live-label { font-family: var(--serif); font-weight: 400; letter-spacing: .03em; flex-shrink: 0; }
.live-track { flex: 1; min-width: 0; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.live-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 28px; width: max-content; }
.live-list.scrolling { animation: live-scroll var(--dur, 40s) linear infinite; }
.live-strip:hover .live-list { animation-play-state: paused; }
@keyframes live-scroll { to { transform: translateX(-50%); } }
.live-list li { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 700; font-size: .92rem; }
.live-list li a { text-decoration: none; color: var(--ink); }
.live-list li a:hover { color: var(--red); }
.live-list small { color: var(--muted); font-weight: 700; }
@media (max-width: 760px) { .live-strip { margin-top: 16px; padding: 8px 12px; } .live-list li { font-size: .85rem; } }

/* random game highlight */
.game-tile.rolled { outline: 4px solid var(--mustard); outline-offset: 3px; transform: translateY(-3px); }

/* game list: featured tile + nine equal tiles (3 per row on desktop) */
@media (min-width: 901px) { .game-tile:nth-child(2), .game-tile:nth-child(3) { grid-column: span 2; } }
.t-rv { --tile-bg: #8fe3b8; } .t-dt { --tile-bg: #ffd75e; } .t-hm { --tile-bg: #ffb48a; } .t-an { --tile-bg: #c9b6ff; }
.game-reversi { --tile-bg: #8fe3b8; } .game-dots { --tile-bg: #ffd75e; } .game-hangman { --tile-bg: #ffb48a; } .game-anagrams { --tile-bg: #c9b6ff; }
.game-reversi .swatch-0, .game-dots .swatch-0 { background: var(--ink); } .game-reversi .swatch-1 { background: #fff8ee; } .game-dots .swatch-1 { background: var(--blue); }
.game-dots .swatch-0 { background: var(--red); }
.game-hangman .info-friends, .game-anagrams .info-friends { display: none; }
.mode-card.mode-wide { grid-column: 1 / -1; max-width: 520px; width: 100%; justify-self: center; }

/* reversi */
.rv-frame, .dt-frame { width: min(540px, 100%); }
.rv-board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; padding: 6px; aspect-ratio: 1; background: #1d7a50; border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); }
.rv-cell { position: relative; border: 0; padding: 0; aspect-ratio: 1; min-width: 0; border-radius: 6px; background: #2fa36c; display: grid; place-items: center; cursor: default; -webkit-tap-highlight-color: transparent; }
.rv-cell.legal { cursor: pointer; }
.rv-cell.legal::after { content: ''; width: 24%; height: 24%; border-radius: 50%; background: rgba(255, 248, 238, .55); }
.rv-board.my-turn .rv-cell.legal:hover { background: #45b97f; }
.rv-cell.last { background: #48b67f; }
.rv-disc { width: 82%; height: 82%; border-radius: 50%; border: 2.5px solid var(--ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.rv-disc.side-0 { background: radial-gradient(circle at 35% 30%, #5a5570, #1c1a2e 65%); }
.rv-disc.side-1 { background: radial-gradient(circle at 35% 30%, #fff, #efe4cf 65%); }
.rv-disc.placed { animation: pop-in .25s ease-out; }
.rv-disc.flip { animation: rv-flip .4s ease-in-out both; }
@keyframes rv-flip { 0% { transform: scaleX(1); } 50% { transform: scaleX(0); } 100% { transform: scaleX(1); } }
.rv-score { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; margin: 0 4px 8px; }
.rv-count { display: inline-flex; align-items: center; gap: 8px; font: 1.3rem var(--serif); }
.rv-mini, .dt-mini { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--ink); display: inline-block; }
.rv-mini.side-0 { background: #23203a; } .rv-mini.side-1 { background: #fff8ee; }
.rv-pass { flex: 1; text-align: center; font-weight: 800; color: var(--ink-2); font-size: .9rem; }

/* dots and boxes */
.dt-board { width: 100%; height: auto; display: block; background: #fff; border: 4px solid var(--ink); border-radius: 16px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); touch-action: manipulation; }
.dt-dot { fill: var(--ink); pointer-events: none; }
.dt-box { fill: transparent; transition: fill .3s; }
.dt-box.side-0 { fill: #ffc2b0; } .dt-box.side-1 { fill: #b9d8ff; }
.dt-box.new { animation: dt-box .4s ease-out; }
@keyframes dt-box { from { opacity: 0; } }
.dt-line .dt-hit { stroke: transparent; stroke-width: 7; stroke-linecap: round; }
.dt-line .dt-stroke { stroke: #ece3d2; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 1.5 2.5; pointer-events: none; transition: stroke .15s; }
.dt-line.open { cursor: pointer; }
.dt-line.open:hover .dt-stroke, .dt-line.open:focus-visible .dt-stroke { stroke: var(--mustard); stroke-width: 2.6; stroke-dasharray: none; }
.dt-line:focus { outline: none; }
.dt-line.drawn .dt-stroke { stroke-width: 2.6; stroke-dasharray: none; }
.dt-line.drawn.side-0 .dt-stroke { stroke: var(--red); } .dt-line.drawn.side-1 .dt-stroke { stroke: var(--blue); }
.dt-line.last .dt-stroke { stroke-width: 3.4; }
.dt-mini.side-0 { background: #ffc2b0; border-color: var(--red); } .dt-mini.side-1 { background: #b9d8ff; border-color: var(--blue); }

/* hangman */
.hm-wrap, .an-wrap { display: grid; gap: 14px; max-width: 620px; margin-inline: auto; width: 100%; }
.hm-hud { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px; align-items: stretch; }
.an-hud { grid-template-columns: 1fr 1fr; }
.hm-hearts { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 12px; background: #fff; border: 3px solid var(--ink); }
.hm-heart svg { width: 26px; height: 26px; fill: var(--red); stroke: var(--ink); stroke-width: 2; }
.hm-heart.lost svg { fill: var(--paper-2); opacity: .6; }
.hm-stage { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: center; padding: 16px; border-radius: 18px; background: var(--paper); border: 3px solid var(--ink); }
.hm-drawing svg { width: 100%; height: auto; fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.hm-drawing g { opacity: .08; transition: opacity .3s; }
.hm-drawing g.on { opacity: 1; }
.hm-drawing g:nth-child(n+5).on { stroke: var(--red); }
.hm-main { text-align: center; min-width: 0; }
.hm-main .wr-cat { margin-bottom: 10px; }
.hm-word, .an-answer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.hm-tile { width: clamp(26px, 7vw, 38px); height: clamp(34px, 9vw, 46px); border-radius: 8px; border: 2.5px solid var(--ink); background: #fff; display: grid; place-items: center; font: clamp(1.1rem, 4vw, 1.5rem) var(--serif); }
.hm-tile.open { background: var(--mustard); animation: pop-in .25s ease-out; }
.hm-keys { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 5px; }
.hm-key { min-height: 44px; padding: 0; border-radius: 9px; border: 2.5px solid var(--ink); background: #fff; font: 1.05rem var(--serif); color: var(--ink); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.hm-key:hover:not(:disabled) { background: #fff3cc; }
.hm-key:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.hm-key:disabled { cursor: default; box-shadow: none; }
.hm-key.hit { background: var(--mint); }
.hm-key.miss { background: var(--paper-2); color: var(--faint); border-color: var(--line-2); }
@media (max-width: 560px) {
  .hm-keys { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .hm-stage { grid-template-columns: 76px minmax(0, 1fr); padding: 12px; gap: 10px; }
  .hm-hud { grid-template-columns: auto 1fr 1fr; gap: 6px; }
  .hm-heart svg { width: 20px; height: 20px; }
}

/* anagrams */
.an-prompt { padding: 18px 14px; }
.an-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 4px 0 16px; }
.an-tile { width: clamp(40px, 11vw, 54px); height: clamp(46px, 12vw, 60px); border-radius: 12px; border: 3px solid var(--ink); background: #fff; font: clamp(1.4rem, 5vw, 1.9rem) var(--serif); color: var(--ink); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); animation: an-in .35s ease-out both; animation-delay: calc(var(--i) * 40ms); }
.an-tile:nth-child(odd) { rotate: -3deg; } .an-tile:nth-child(even) { rotate: 2deg; }
.an-tile:hover { background: #fff3cc; }
.an-tile.used { opacity: .3; }
@keyframes an-in { from { transform: translateY(-14px); opacity: 0; } }
.an-wrap .wr-form { grid-template-columns: 1fr auto; }
/* word rows: one line, tiles shrink to fit the word length */
.hm-word, .an-answer, .an-tiles { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 42px)); justify-content: center; gap: 5px; }
.an-tiles { grid-template-columns: repeat(var(--n, 6), minmax(0, 56px)); gap: 6px; }
.hm-tile { width: auto; aspect-ratio: 5 / 6; height: auto; font-size: clamp(.95rem, 4.2vw, 1.5rem); }
.an-tile { width: auto; height: auto; aspect-ratio: 9 / 10; font-size: clamp(1.1rem, 5.4vw, 1.9rem); }
.hm-key.miss { background: #efe9df; color: #b3a998; border-color: #cfc5b4; text-decoration: line-through; }
@media (max-width: 560px) {
  .hm-stage { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .hm-drawing { width: 72px; }
  .hm-main { width: 100%; }
}
.entry-step { box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }

/* =====================================================================
   v8 — TideArcade: header that never breaks, static boards, avatar frames,
   quick match radar, clans, rewards, livelier games
   ===================================================================== */

/* ---------- brand ---------- */
.logo-mark { width: 36px; height: 36px; overflow: visible; }
.brand-name { font-size: 1.3rem; letter-spacing: .01em; white-space: nowrap; }
.brand-name em { color: var(--red); }
.brand:hover .logo-mark { transform: rotate(-8deg) scale(1.04); }
.logo-mark .logo-coin { transform-box: fill-box; transform-origin: center; }
.brand:hover .logo-coin { animation: coin-hop .6s cubic-bezier(.3, 1.6, .5, 1); }
.logo-mark .logo-wave { animation: logo-wave 3.2s ease-in-out infinite; }
@keyframes coin-hop { 40% { transform: translateY(-3px) scale(1.12); } }
@keyframes logo-wave { 50% { transform: translateX(-1.5px); } }

/* ---------- header: labels stay on one line; things drop out as the window narrows ---------- */
.main-nav { gap: 2px; min-width: 0; }
.main-nav a { white-space: nowrap; padding: 7px 11px; }
.header-row { gap: 16px; }
.user-name { white-space: nowrap; }
.user-name b { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1180px) {
  .header-actions .user-name { display: none; }
  .main-nav a { padding: 7px 9px; font-size: .95rem; }
}
@media (max-width: 960px) {
  .brand-name { display: none; }
  .header-actions .header-signup { display: none !important; }
  .header-row { gap: 10px; }
  .main-nav a { padding: 6px 8px; font-size: .92rem; }
}
@media (max-width: 760px) {
  .brand-name { display: inline; font-size: 1.15rem; }
}

/* ---------- static boards: squares never change size, whatever stands on them ---------- */
.chess-board { grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); container-type: inline-size; }
.sq { min-width: 0; min-height: 0; overflow: hidden; aspect-ratio: auto; transition: none; }
.piece { font-size: min(10.4vw, 62px); }
@supports (font-size: 1cqw) { .piece { font-size: 10.6cqw; } }
.ck-board { grid-template-rows: repeat(8, minmax(0, 1fr)); }
.ck-sq { min-height: 0; aspect-ratio: auto; transition: none; }
.captured { min-height: 32px; height: 32px; overflow: hidden; }
.captured .caps { line-height: 1; }
.ck-count { min-height: 32px; height: 32px; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(255, 201, 60, .38); }
.sq.last .piece, .ck-sq.last .ck-piece { animation: land .28s ease-out; }
@keyframes land { 0% { transform: scale(1.12); } 100% { transform: none; } }

/* ---------- avatar frames (earned on the reward road) ---------- */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.avatar[data-frame] { --fw: 3px; border: var(--fw) solid transparent; background: linear-gradient(var(--sunk), var(--sunk)) padding-box, var(--ring) border-box; box-shadow: 0 0 0 1.5px var(--ink); overflow: hidden; }
.avatar-sm[data-frame] { --fw: 2.5px; }
.avatar-lg[data-frame] { --fw: 5px; box-shadow: 0 0 0 2.5px var(--ink); }
.avatar-xl[data-frame] { --fw: 7px; box-shadow: 0 0 0 3px var(--ink); }
.avatar[data-frame="starter"] { --ring: linear-gradient(135deg, #58c4ff, #fff 55%, #58c4ff); }
.avatar[data-frame="bronze"] { --ring: linear-gradient(135deg, #f2b27a, #b8662a 50%, #f2b27a); }
.avatar[data-frame="silver"] { --ring: linear-gradient(135deg, #f4f6fa, #8d97a8 50%, #f4f6fa); }
.avatar[data-frame="gold"] { --ring: linear-gradient(var(--ang), #ffe27a, #d99a00, #fff3b0, #d99a00, #ffe27a); }
.avatar[data-frame="jade"] { --ring: linear-gradient(var(--ang), #7fe0b4, #11875c, #c9ffe6, #11875c, #7fe0b4); }
.avatar[data-frame="clan"] { --ring: repeating-conic-gradient(from var(--ang), #23203a 0 30deg, #ffc93c 30deg 60deg); }
.avatar[data-frame="tide"] { --ring: conic-gradient(from var(--ang), #1f7fd6, #7fd0ff, #fff, #7fd0ff, #1f7fd6); }
.avatar[data-frame="sunset"] { --ring: conic-gradient(from var(--ang), #ff5c39, #ffc93c, #ff7ab6, #ff5c39); }
.avatar[data-frame="storm"] { --ring: conic-gradient(from var(--ang), #5b3fd1, #a98bff, #e9e2ff, #a98bff, #5b3fd1); }
.avatar[data-frame="neon"] { --ring: conic-gradient(from var(--ang), #ff2fb3, #22e3ff, #fff36b, #ff2fb3); }
.avatar[data-frame="royal"] { --ring: conic-gradient(from var(--ang), #5a2a8a, #ffc93c, #5a2a8a, #ffc93c, #5a2a8a); }
.avatar[data-frame="legend"] { --ring: conic-gradient(from var(--ang), #ff5c39, #ffc93c, #2dc68b, #3d8bff, #b46bff, #ff5c39); }
.avatar[data-frame="duelist"] { --ring: repeating-conic-gradient(from var(--ang), #e8432a 0 45deg, #23203a 45deg 90deg); }
.avatar[data-frame="flame"] { --ring: conic-gradient(from var(--ang), #ff8a00, #ff3d2e, #ffd34d, #ff3d2e, #ff8a00); }
.avatar[data-frame="tide"], .avatar[data-frame="sunset"], .avatar[data-frame="neon"], .avatar[data-frame="legend"], .avatar[data-frame="duelist"] { animation: frame-spin 4s linear infinite; }
.avatar[data-frame="gold"], .avatar[data-frame="jade"], .avatar[data-frame="clan"] { animation: frame-spin 7s linear infinite; }
.avatar[data-frame="storm"], .avatar[data-frame="royal"] { animation: frame-spin 5s linear infinite, frame-glow 2.4s ease-in-out infinite; }
.avatar[data-frame="flame"] { animation: frame-spin 2.2s linear infinite, frame-flicker 1.1s steps(2) infinite; }
.avatar[data-frame="legend"], .avatar[data-frame="neon"] { filter: drop-shadow(0 0 4px rgba(255, 92, 180, .45)); }
@keyframes frame-spin { to { --ang: 360deg; } }
@keyframes frame-glow { 50% { box-shadow: 0 0 0 1.5px var(--ink), 0 0 12px 2px rgba(169, 139, 255, .8); } }
@keyframes frame-flicker { 50% { filter: drop-shadow(0 0 5px rgba(255, 138, 0, .75)); } }

/* ---------- setup: people first ---------- */
.setup-duel .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.setup-duel .mode-online { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 10px 28px; align-items: center; }
.mode-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mode-main p { margin: 0; }
.mode-side { display: grid; gap: 8px; justify-items: stretch; }
.mode-side .link-btn { justify-self: center; }
.mode-card.mode-online { position: relative; background: linear-gradient(160deg, #e5f6ff, #fff 65%); border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.mode-card.mode-online .mode-icon { background: #7fd0ff; animation: radar-ping 2.4s ease-out infinite; }
@keyframes radar-ping { 0% { box-shadow: 0 0 0 0 rgba(61, 139, 255, .45); } 70%, 100% { box-shadow: 0 0 0 12px rgba(61, 139, 255, 0); } }
.mode-card.mode-online .btn-play { font-size: clamp(1.1rem, 2.2vw, 1.35rem); min-height: 54px; padding: 8px 16px; white-space: normal; }
.mode-rating { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 !important; padding: 8px 12px; border-radius: 12px; background: #fff; border: 2px solid var(--ink); font-weight: 800; }
.mode-rating b { font: 1.5rem/1 var(--serif); color: var(--blue); }
.mode-card.mode-practice { background: var(--paper); border-style: dashed; box-shadow: none; }
.mode-card.mode-practice .mode-icon { background: #e3ecf5; }
.mode-card .link-btn { margin-top: 8px; align-self: center; }
.mm-waiting { display: block; margin-top: 2px; text-align: center; font-size: .85rem; font-weight: 800; color: var(--ink-2); }
.mm-waiting::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--mint); animation: live-pulse 2s infinite; vertical-align: 1px; }
.setup-local { display: block; margin: 16px auto 0; font-weight: 800; color: var(--ink-2); }
@media (max-width: 980px) and (min-width: 761px) { .setup-duel .mode-online { grid-template-columns: minmax(0, 1fr) 220px; } }
@media (max-width: 600px) { .setup-duel .mode-grid { grid-template-columns: minmax(0, 1fr); } .setup-duel .mode-online { grid-template-columns: minmax(0, 1fr); } }

/* ---------- quick match radar ---------- */
html.mm-open body { overflow: hidden; }
.mm-layer { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(35, 32, 58, .55); backdrop-filter: blur(3px); animation: fade-in .2s ease-out; overflow-y: auto; }
.mm-card { width: min(420px, 100%); padding: 22px 20px 18px; background: #fff; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); text-align: center; }
.mm-body { display: grid; justify-items: center; gap: 10px; }
.mm-body h2 { margin: 0; font-size: clamp(1.5rem, 5vw, 1.9rem); }
.mm-body .eyebrow { margin: 0; }
.radar { position: relative; width: min(230px, 62vw); aspect-ratio: 1; border-radius: 50%; margin: 6px 0; background: radial-gradient(circle, #1d3f5e 0, #12283f 70%); border: 4px solid var(--ink); box-shadow: inset 0 0 0 3px rgba(127, 208, 255, .25), 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); overflow: hidden; }
.radar-ring { position: absolute; border-radius: 50%; border: 1.5px solid rgba(127, 208, 255, .35); }
.radar-ring.r1 { inset: 12%; } .radar-ring.r2 { inset: 28%; } .radar-ring.r3 { inset: 42%; border-style: dashed; }
.radar::before, .radar::after { content: ''; position: absolute; background: rgba(127, 208, 255, .2); }
.radar::before { left: 50%; top: 0; bottom: 0; width: 1.5px; } .radar::after { top: 50%; left: 0; right: 0; height: 1.5px; }
.radar-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(45, 198, 139, 0) 0deg, rgba(45, 198, 139, 0) 290deg, rgba(45, 198, 139, .55) 355deg, rgba(160, 255, 210, .9) 360deg); animation: sweep 2.4s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.radar-blips { position: absolute; inset: 0; }
.blip { position: absolute; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: #a0ffd2; box-shadow: 0 0 10px 2px rgba(45, 198, 139, .8); animation: blip 2.4s ease-out infinite; }
@keyframes blip { 0%, 100% { opacity: .15; transform: scale(.6); } 12% { opacity: 1; transform: scale(1.15); } 40% { opacity: .7; transform: scale(1); } }
.radar-me { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; }
.radar-me .avatar { background-color: #fff; animation: me-breathe 2.4s ease-in-out infinite; }
@keyframes me-breathe { 50% { transform: scale(1.06); } }
.mm-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; margin: 4px 0 0; }
.mm-facts div { padding: 8px 4px; border-radius: 12px; background: var(--paper); border: 2px solid var(--ink); min-width: 0; }
.mm-facts dt { font-size: .72rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.mm-facts dd { margin: 2px 0 0; font: 1.05rem var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radar-near { font-weight: 800; color: var(--ink-2); font-size: .92rem; }
.radar-help { width: 100%; padding: 10px 12px; border-radius: 14px; background: #fff3cc; border: 2px solid var(--ink); }
.radar-help p { margin: 0 0 8px; font-weight: 700; font-size: .9rem; }
.mm-card.found { animation: found-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes found-pop { from { transform: scale(.9); } }
.vs-card { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; margin: 6px 0; }
.vs-side { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.vs-side b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.vs-side small { font: 1rem var(--serif); color: var(--blue); }
.vs-side.left { animation: vs-left .5s cubic-bezier(.3, 1.4, .5, 1) both; }
.vs-side.right { animation: vs-right .5s cubic-bezier(.3, 1.4, .5, 1) .1s both; }
@keyframes vs-left { from { transform: translateX(-60px); opacity: 0; } }
@keyframes vs-right { from { transform: translateX(60px); opacity: 0; } }
.vs-badge { font: 1.6rem var(--serif); color: #fff; background: var(--red); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 10px; rotate: -6deg; animation: pop-in .4s cubic-bezier(.3, 1.6, .5, 1) .3s both; }
.vs-count { font: 2.6rem/1 var(--serif); color: var(--mustard); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.vs-count.bump { animation: count .6s ease-out; }

/* ---------- match: mascot buddy, livelier status, mode tag ---------- */
.status-row { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; }
.buddy { width: 46px; flex-shrink: 0; transform-origin: 50% 100%; }
.buddy .mascot { display: block; }
.buddy.hop { animation: buddy-hop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes buddy-hop { 30% { transform: translateY(-9px) rotate(-6deg); } 60% { transform: translateY(0) scale(1.06, .94); } }
.match-status { margin: 0; padding: 4px 14px; border-radius: 999px; transition: background-color .2s; }
.match-status:empty { padding: 0; }
.match-status.mine { background: var(--mustard); border: 2.5px solid var(--ink); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.match-status.pop { animation: status-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes status-pop { from { transform: scale(.9); opacity: .4; } }
.mode-tag { align-self: center; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; white-space: nowrap; }
.mode-tag.tag-ranked { background: #7fd0ff; } .mode-tag.tag-friends { background: #8fe3b8; } .mode-tag.tag-practice { background: var(--paper-2); color: var(--ink-2); }
.timer.low { animation: timer-pulse .8s ease-in-out infinite; }
@keyframes timer-pulse { 50% { transform: scale(1.12); } }
.practice-note { display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; background: var(--paper-2); font-weight: 800; font-size: .88rem; color: var(--ink-2); }
@media (max-width: 760px) { .buddy { width: 38px; } .status-row { min-height: 44px; gap: 6px; } .match-status { padding: 3px 10px; } }

/* result card: the mascot sits on top of the card and is never cut off */
.result-layer { padding-top: max(70px, clamp(16px, 5vw, 48px)); }
.result-card { position: relative; overflow: visible; }
.result-mascot { width: 84px; margin: -66px auto 4px; }
.result-mascot .mascot { animation: mascot-cheer .9s cubic-bezier(.3, 1.6, .5, 1) both; }
.tone-bad .result-mascot .mascot { animation: mascot-sigh 1s ease-out both; }
@keyframes mascot-cheer { 0% { transform: translateY(30px) scale(.6); opacity: 0; } 60% { transform: translateY(-8px) scale(1.05); opacity: 1; } }
@keyframes mascot-sigh { 0% { transform: translateY(-10px); opacity: 0; } 100% { transform: none; } }

/* ---------- title screen ---------- */
.mascot-spot { overflow: visible; }
.mascot-spot .mascot { overflow: visible; }
@media (min-width: 761px) and (max-width: 1100px) { .mascot-spot { right: 3%; width: 80px; } }
.title-online { display: inline-flex; align-items: center; gap: 8px; margin: 18px 0 0; padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, .85); font-weight: 800; font-size: .92rem; }
.walkers { position: absolute; left: 0; right: 0; bottom: clamp(10px, 1.6vw, 22px); height: 44px; z-index: 0; pointer-events: none; overflow: hidden; }
.walker { position: absolute; bottom: 0; width: 38px; animation: walk-across var(--dur, 34s) linear var(--delay, 0s) infinite; }
.walker svg { width: 100%; height: auto; overflow: visible; }
.walker .wk-body { animation: walk-bob .5s ease-in-out infinite; }
.walker .wk-l { animation: step-l .5s ease-in-out infinite; transform-box: fill-box; transform-origin: top; }
.walker .wk-r { animation: step-r .5s ease-in-out infinite; transform-box: fill-box; transform-origin: top; }
.walker.w1 { --dur: 38s; --delay: -6s; }
.walker.w2 { --dur: 46s; --delay: -24s; width: 32px; }
.walker.w3 { --dur: 42s; --delay: -36s; width: 34px; animation-direction: reverse; }
.walker.w3 svg { transform: scaleX(-1); }
@keyframes walk-across { from { left: -60px; } to { left: calc(100% + 20px); } }
@keyframes walk-bob { 50% { transform: translateY(-2px) rotate(3deg); } }
@keyframes step-l { 50% { transform: rotate(18deg); } }
@keyframes step-r { 50% { transform: rotate(-18deg); } }
@media (max-width: 760px) { .walkers { bottom: 8px; } .walker { width: 30px; } .walker.w3 { display: none; } }

/* ---------- home: play with people ---------- */
.social { padding-top: 26px; }
.social-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.social-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 14px; align-items: center; padding: 16px; background: #fff; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); text-decoration: none; color: var(--ink); transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.social-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 10px 28px -11px rgba(35, 32, 58, .3); }
.social-card b { font: 1.25rem var(--serif); letter-spacing: .02em; font-weight: 400; }
.social-card > span:last-child { grid-column: 2; color: var(--ink-2); font-size: .92rem; font-weight: 600; line-height: 1.35; }
.sc-art { grid-row: span 2; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; border: 3px solid var(--ink); }
.sc-online .sc-art { background: #12283f; }
.sc-clans .sc-art { background: var(--mustard); }
.sc-rewards .sc-art { background: #ffb48a; }
.sc-art svg { width: 34px; height: 34px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sc-art .avatar-lg { width: 50px; height: 50px; }
.mini-radar { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(127, 208, 255, .5); overflow: hidden; }
.mini-radar::before { content: ''; position: absolute; inset: 0; background: conic-gradient(from 0deg, transparent 0 290deg, rgba(160, 255, 210, .9) 360deg); animation: sweep 2.4s linear infinite; }
.mini-radar i { position: absolute; left: 62%; top: 30%; width: 7px; height: 7px; border-radius: 50%; background: #a0ffd2; box-shadow: 0 0 6px #2dc68b; animation: blip 2.4s ease-out infinite; }
@media (max-width: 900px) { .social-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- clans ---------- */
.emblem { --clan: #23203a; width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 13px; background: var(--clan); border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); }
.emblem svg { width: 62%; height: 62%; fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.emblem-sm { width: 24px; height: 24px; border-width: 2px; border-radius: 8px; }
.emblem-lg { width: 58px; height: 58px; border-radius: 16px; }
.emblem-xl { width: 96px; height: 96px; border-radius: 26px; border-width: 4px; box-shadow: inset 0 -7px 0 rgba(0, 0, 0, .18), 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.clans-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }
.clans-side { position: sticky; top: 88px; display: grid; gap: 16px; }
.clans-side .side-card { margin: 0; }
.my-clan { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 20px; background: #fff3cc; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); text-decoration: none; color: var(--ink); }
.my-clan:hover { color: var(--ink); }
.my-clan div { flex: 1; display: grid; min-width: 0; }
.my-clan b { font: 1.25rem var(--serif); overflow-wrap: anywhere; }
.clan-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.clan-row { display: grid; grid-template-columns: 30px auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 10px 14px; background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; }
.clan-row.skeleton { min-height: 68px; border-style: dashed; }
.clan-row.top1 { background: #fff6d6; } .clan-row.top2 { background: #f4f6fa; } .clan-row.top3 { background: #fff0e6; }
.clan-name { display: grid; min-width: 0; text-decoration: none; }
.clan-name b { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-tag { display: inline-block; justify-self: start; font: .78rem/1.4 var(--sans); font-weight: 900; letter-spacing: .06em; padding: 0 7px; border-radius: 6px; background: var(--ink); color: #fff; white-space: nowrap; }
.clan-tag.big { font-size: .5em; vertical-align: middle; padding: 2px 10px; border-radius: 9px; }
.rank-table .clan-tag { margin-left: 6px; }
.clan-meta { display: grid; justify-items: end; font-size: .82rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.clan-lvl { color: var(--ink); }
.clan-wins { display: grid; justify-items: center; line-height: 1.1; min-width: 56px; }
.clan-wins b { font: 1.3rem var(--serif); color: var(--red); }
.clan-wins small { font-size: .7rem; font-weight: 800; color: var(--muted); }
.clan-empty { padding: 18px; text-align: center; background: #fff; border: 2.5px dashed var(--line-2); border-radius: 16px; }
.emblem-picker, .color-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { padding: 3px; border: 2.5px solid transparent; border-radius: 14px; background: none; line-height: 0; }
.pick[aria-checked="true"] { border-color: var(--ink); background: #fff3cc; }
.pick .emblem { width: 36px; height: 36px; border-radius: 11px; border-width: 2.5px; }
.swatch { display: block; width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--ink); }
.clan-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 22px; background: #fff; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); position: relative; overflow: hidden; }
.clan-head.skeleton { min-height: 160px; border-style: dashed; box-shadow: none; }
.clan-head::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--clan, var(--mustard)); }
.clan-head h1 { margin: 0 0 4px; }
.clan-head-text { min-width: 0; }
.clan-head-text .eyebrow { margin: 0 0 4px; }
.clan-about { margin: 0 0 10px; color: var(--ink-2); font-weight: 600; }
.clan-level { display: flex; align-items: center; gap: 12px; max-width: 420px; }
.clan-level > div { flex: 1; display: grid; gap: 4px; }
.clan-level .level-coin { width: 52px; height: 52px; font-size: 1.4rem; border-width: 3px; }
.clan-actions { display: grid; gap: 8px; justify-items: stretch; }
.member-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.member { display: grid; grid-template-columns: 26px auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; background: var(--paper); border: 2px solid var(--line-2); }
.member.me { background: #fff3cc; border-color: var(--ink); }
.member-name { display: flex; align-items: center; gap: 8px; min-width: 0; text-decoration: none; }
.member-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.role-pill { font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; padding: 1px 8px; border-radius: 999px; background: var(--mustard); border: 2px solid var(--ink); white-space: nowrap; }
.member-stat { display: grid; justify-items: center; line-height: 1.1; min-width: 54px; }
.member-stat b { font: 1.15rem var(--serif); }
.member-stat small { font-size: .68rem; font-weight: 800; color: var(--muted); text-align: center; }
.clan-edit summary { cursor: pointer; }
.clan-edit .stack { margin-top: 14px; }
.clan-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); text-decoration: none; font-size: .88rem; max-width: 100%; }
.clan-badge b { font-weight: 900; letter-spacing: .04em; }
.clan-badge span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 700; }
.profile-links { margin-top: 6px; gap: 14px; }
@media (max-width: 1000px) {
  .clans-layout { grid-template-columns: minmax(0, 1fr); }
  .clans-side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 760px) {
  .clan-row { grid-template-columns: 22px auto minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
  .clan-row .clan-meta { display: none; }
  .clan-row > :last-child { grid-column: 2 / -1; justify-self: start; }
  .clan-row > :last-child:empty { display: none; }
  .clan-head { grid-template-columns: auto minmax(0, 1fr); padding: 18px 16px; gap: 14px; }
  .clan-head .emblem-xl { width: 64px; height: 64px; border-radius: 18px; }
  .clan-actions { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; }
  .member { grid-template-columns: 22px auto minmax(0, 1fr) auto auto; gap: 8px; padding: 8px; }
}

/* ---------- rewards ---------- */
.rw-me-card, .rw-me-guest { display: flex; align-items: center; gap: 20px; padding: 20px; background: #fff; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); flex-wrap: wrap; }
.rw-me-guest > div { flex: 1; min-width: 200px; }
.rw-me-guest h2 { margin: 0 0 4px; }
.rw-me-guest p { margin: 0; }
.rw-me-text { flex: 1; min-width: 200px; display: grid; gap: 6px; }
.rw-level { font: 1.5rem var(--serif); }
.rw-next { margin: 4px 0 0; font-weight: 800; color: var(--red); }
.road { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; position: relative; }
.road::before { content: ''; position: absolute; left: 33px; top: 20px; bottom: 20px; width: 6px; border-radius: 3px; background: repeating-linear-gradient(var(--line-2) 0 10px, transparent 10px 18px); }
.road-stop { position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.road-level { position: relative; z-index: 1; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; align-content: center; background: #fff; border: 3px dashed var(--line-2); line-height: 1; }
.road-level small { font-size: .62rem; font-weight: 900; color: var(--muted); text-transform: uppercase; }
.road-level b { font: 1.7rem var(--serif); color: var(--muted); }
.road-stop.got .road-level { background: radial-gradient(circle at 35% 30%, #ffe08a, var(--mustard) 60%); border: 3px solid var(--ink); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.road-stop.got .road-level b, .road-stop.got .road-level small { color: var(--ink); }
.road-stop.next .road-level { border: 3px solid var(--red); animation: radar-ping 2.4s ease-out infinite; }
.road-items { display: flex; flex-wrap: wrap; gap: 10px; }
.road-item { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 12px; align-items: center; padding: 10px 14px; background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; min-width: min(260px, 100%); flex: 1; }
.road-item .avatar { grid-row: span 3; }
.road-item b { font-weight: 900; }
.road-item small { line-height: 1.2; }
.road-item .btn, .road-item .rw-on, .road-item .link-btn { justify-self: start; margin-top: 4px; }
.road-stop:not(.got) .road-item { background: var(--paper); border-style: dashed; border-color: var(--line-2); }
.road-stop:not(.got) .road-item .avatar:not([data-frame]) { filter: grayscale(1); opacity: .55; }
.road-check, .road-lock { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; }
.road-check { background: var(--mint); }
.road-check::after { content: ''; width: 10px; height: 6px; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: translateY(-2px) rotate(-45deg); }
.road-lock { background: var(--paper-2); border-color: var(--line-2); }
.road-lock::after { content: ''; width: 10px; height: 8px; border-radius: 2px; background: var(--faint); box-shadow: 0 -5px 0 -2px transparent; }
.rw-on { font-size: .78rem; font-weight: 900; color: var(--green); text-transform: uppercase; letter-spacing: .04em; }
.rw-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.rw-card { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 16px 10px; background: var(--paper); border: 2.5px dashed var(--line-2); border-radius: 18px; }
.rw-card.got { background: #fff; border: 3px solid var(--ink); box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
.rw-card:not(.got) .avatar:not([data-frame]) { filter: grayscale(1); opacity: .55; }
.rw-card b { font: 1.02rem var(--serif); }
.rw-card small { color: var(--ink-2); font-weight: 700; line-height: 1.3; }
.rw-state { font-size: .75rem; font-weight: 900; color: var(--muted); text-transform: uppercase; }
@media (max-width: 760px) {
  .road::before { left: 25px; }
  .road-stop { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
  .road-level { width: 56px; height: 56px; }
  .road-level b { font-size: 1.35rem; }
  .road-check, .road-lock { display: none; }
  .road-item { padding: 8px 10px; column-gap: 10px; }
  .road-item .avatar-lg { width: 52px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .avatar[data-frame], .walker, .walker *, .radar-sweep, .blip, .mini-radar::before, .logo-mark .logo-wave, .mode-card.mode-online .mode-icon { animation: none !important; }
}

/* =====================================================================
   v9 — phones first (most players are on a phone)
   ===================================================================== */
/* touch screens: no sticky hover lifts after a tap, quick press feedback instead */
a, button, summary, [role=tab] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (hover: none) {
  .game-tile:hover, .social-card:hover, .stat-card:hover, .btn:hover, .btn-play:hover, .entry-guest:hover { transform: none; }
  .btn:hover { box-shadow: 0 2px 0 var(--bd); } .btn-play:hover { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
  .game-tile:hover { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 8px 22px -9px rgba(35, 32, 58, .3); } .social-card:hover { box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
  .game-tile:active, .social-card:active, .clan-row:active, .my-clan:active { transform: scale(.985); transition: transform .08s; }
  .tabbar a:active svg { transform: scale(.88); }
}
.tabbar svg { transition: transform .12s; }

@media (max-width: 760px) {
  /* text fields at 16px so iPhones never zoom in while typing */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }

  /* every link and button is easy to hit with a thumb */
  .link-arrow, .link-btn { min-height: 44px; display: inline-flex; align-items: center; margin-top: 0; }
  .pc-text .link-btn { min-height: 32px; }
  .crumbs { margin: 8px 0 4px; font-size: .85rem; gap: 2px 6px; }
  .crumbs a { display: inline-block; padding: 8px 2px; }
  .chip-links a { min-height: 40px; display: inline-flex; align-items: center; }
  .tabs a { min-height: 42px; display: inline-flex; align-items: center; }
  .mini-list a, .podium-step a { padding-block: 6px; }
  .dropdown-menu a, .dropdown-menu button { min-height: 44px; }

  /* nothing smaller than 12px */
  .ch-text small, .ch-card.compact .ch-text small, .pl-text small, .pc-text small, .live-list small, .mm-facts dt,
  .road-level small, .clan-wins small, .member-stat small, .role-pill, .home-streak .ch-week li, .ch-week li, .tag,
  .game-tile-meta, .rw-state, .xp-text, .user-name small, .badge { font-size: .75rem !important; }

  /* tighter vertical rhythm */
  .section { padding-block: 26px; }
  .section-head { margin-bottom: 16px; }
  .section-head h2 { font-size: 1.6rem; }
  .page-head { padding-block: 14px 8px; }
  .page-head .lede { font-size: 1rem; margin-bottom: 0; }
  .display-sm { font-size: clamp(1.7rem, 8vw, 2.1rem); }
  .site-footer { margin-top: 44px; }

  /* home: compact "play with people" cards */
  .social { padding-top: 22px; }
  .social-grid { gap: 10px; }
  .social-card { padding: 12px; column-gap: 12px; border-radius: 16px; }
  .social-card b { font-size: 1.1rem; }
  .social-card > span:last-child { font-size: .88rem; }
  .sc-art { width: 52px; height: 52px; border-radius: 14px; }
  .sc-art svg { width: 28px; height: 28px; } .mini-radar { width: 38px; height: 38px; } .sc-art .avatar-lg { width: 42px; height: 42px; }

  /* home: leaderboards scroll sideways instead of stacking three tall cards */
  .top-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84%; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 10px; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .top-grid::-webkit-scrollbar { display: none; }
  .top-grid > * { scroll-snap-align: start; }
  .board-card { min-height: 0; padding: 16px; }
  .empty-board { margin: 6px 0; }
  .guest-note { grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; padding: 16px; }
  .guest-note .avatar-lg { width: 52px; height: 52px; }
  .guest-note h2 { font-size: 1.25rem; }
  .guest-note .btn { grid-column: 1 / -1; justify-self: stretch; }
  .daily-card { padding: 18px 16px 18px 24px; }
}

/* game list on phones: a row per game (picture left, text right) instead of a tall card */
@media (max-width: 560px) {
  .game-list { gap: 12px; }
  .game-tile:not(.game-tile-featured) { display: grid; grid-template-columns: 104px minmax(0, 1fr); border-radius: 18px; }
  .game-tile:not(.game-tile-featured) .game-tile-art { aspect-ratio: auto; border-bottom: 0; border-right: 3px solid var(--ink); }
  .game-tile:not(.game-tile-featured) .game-tile-art .art { width: 84%; }
  .game-tile-body { padding: 12px 14px; }
  .game-tile-body h3 { font-size: 1.2rem !important; margin-bottom: 2px; }
  .game-tile-body > p:not([class]) { font-size: .88rem; line-height: 1.4; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .game-tile:not(.game-tile-featured) .game-tile-meta { display: none; }
  .game-tile-links { padding-top: 6px; gap: 6px; border-top: 0; }
  .game-tile-links a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 12px; border: 2.5px solid var(--ink); font-size: .92rem !important; color: var(--ink); background: #fff; }
  .game-tile-links a:first-child { background: var(--mustard); }
  .game-tile .tag { font-size: .7rem !important; }
  .game-tile-featured .game-tile-art { aspect-ratio: 2 / 1; }
  .game-tile-featured .game-tile-body { padding: 16px; }
  .game-tile-featured .row-gap .btn { flex: 1; }
}

/* ---------- in a game on a phone: the board gets the whole screen ---------- */
@media (max-width: 760px) {
  html.in-match { --tabbar: 0px; }
  html.in-match .tabbar { display: none; }
  html.in-match body { padding-bottom: env(safe-area-inset-bottom); }
  html.in-match .game-page > .crumbs, html.in-match .game-page > .ad-slot, html.in-match .game-title { display: none; }
  html.in-match .game-page { padding-inline: 8px; padding-top: 8px; }
  html.in-match .game-app { padding: 8px; border-width: 2.5px; border-radius: 16px; min-height: 0; box-shadow: 0 1px 2px rgba(35, 32, 58, .07), 0 7px 19px -8px rgba(35, 32, 58, .3); }
  html.in-match .match { gap: 8px; }
  html.in-match .pl { min-height: 46px; padding: 5px 7px; }
  html.in-match .status-row { min-height: 40px; }
  html.in-match .buddy { width: 34px; }
  html.in-match .match-status { font-size: 1rem; }
  html.in-match .match-actions { gap: 6px; }
  html.in-match .match-actions .btn { min-height: 40px; }
  html.in-match .game-side { margin-top: 12px; }
  .game-app:has(.result-layer) { min-height: 560px; }

  /* chess: captured pieces and the move list take one slim line each */
  .captured { min-height: 26px; height: 26px; margin: 2px 4px; }
  .captured .caps { font-size: 17px; }
  .move-panel { padding: 6px 10px; border-radius: 10px; }
  .move-panel h3 { display: none; }
  .move-list { max-height: none; flex-wrap: nowrap !important; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .move-list::-webkit-scrollbar { display: none; }
  .move-list li { flex-shrink: 0; }
  .ck-count { min-height: 26px; height: 26px; margin: 2px 4px; }

  /* battleship: one board at a time, tabs to peek at the other */
  .bs-wrap:not(.is-setup) .bs-tabs { display: grid; }
  .bs-wrap:not(.is-setup)[data-show="enemy"] .bs-own, .bs-wrap:not(.is-setup)[data-show="own"] .bs-enemy { display: none; }
  .bs-wrap:not(.is-setup) .bs-panel h3 { display: none; }
  .bs-wrap:not(.is-setup) .bs-panel { animation: fade-in .2s ease-out; }
  .bs-wrap { gap: 8px; }
  .bs-panel { padding: 6px; border-width: 2.5px; }
  .bs-grid { grid-template-columns: 13px repeat(10, minmax(0, 1fr)); gap: 2px; padding: 4px; }
  .bs-axis { font-size: .62rem; }
  .bs-fleet { margin-top: 6px; }
  .bs-setup .row-gap { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; }
  .bs-setup .btn { min-height: 44px; padding-inline: 6px; }
}
.bs-tabs { display: none; grid-template-columns: 1fr 1fr; gap: 6px; }
.bs-tabs button { position: relative; min-height: 40px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; font: 900 .9rem var(--sans); color: var(--ink-2); }
.bs-tabs button[aria-selected="true"] { background: var(--mustard); color: var(--ink); box-shadow: 0 2px 5px rgba(35, 32, 58, .13); }
.bs-wrap:has(.bs-own.under-fire) .bs-tabs button:last-child::after { content: ''; position: absolute; top: 6px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: blink 1.4s infinite; }

/* radar pop-up on short phones */
@media (max-height: 700px) {
  .mm-card { padding: 16px 14px 12px; }
  .radar { width: min(180px, 50vw); }
  .mm-body { gap: 8px; }
}
@media (max-width: 380px) {
  .mm-facts { gap: 5px; }
  .mm-facts dd { font-size: .92rem; }
}

@media (max-width: 760px) {
  .move-panel:has(.move-list:empty) { display: none; }
  html.in-match .match-actions { flex-wrap: nowrap; justify-content: center; }
  html.in-match .match-actions .btn { padding-inline: 10px; font-size: .9rem; }
  html.in-match .match-actions .icon-btn { width: 40px; height: 40px; flex-shrink: 0; }
  html.in-match .mode-tag { font-size: .72rem !important; padding: 3px 8px; }
}
@media (max-width: 350px) { html.in-match .mode-tag { display: none; } }
@media (max-width: 760px) { .chess-wrap { gap: 6px; } }

@media (max-width: 560px) {
  .game-tile:not(.game-tile-featured) { grid-template-columns: 92px minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .game-tile:not(.game-tile-featured) .game-tile-body { display: contents; }
  .game-tile:not(.game-tile-featured) .game-tile-art { grid-row: 1 / span 2; grid-column: 1; }
  .game-tile:not(.game-tile-featured) h3 { grid-column: 2; margin: 12px 12px 2px 14px; }
  .game-tile:not(.game-tile-featured) .game-tile-body > p:not([class]) { grid-column: 2; margin: 0 12px 12px 14px; }
  .game-tile:not(.game-tile-featured) .game-tile-links { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 !important; padding: 10px; border-top: 3px solid var(--ink); background: #fff; }
  .game-tile-links a { justify-content: center; text-align: center; }
}
@media (max-width: 760px) {
  .crumbs { align-items: center; }
  .crumbs > span { line-height: 1; }
  .setup-head { margin-bottom: 12px; }
  .setup-head h2 { font-size: 1.35rem; }
  .mode-grid { gap: 12px; }
  .mode-card { padding: 16px; }
  .mode-icon { width: 40px; height: 40px; }
  .mode-card h3 { margin-top: 6px; }
  .mode-card.mode-online .mode-icon { width: 40px; height: 40px; }
}
@media (max-width: 760px) { .segmented button { white-space: nowrap; font-size: .88rem; padding-inline: 8px; min-height: 42px; } }

@media (max-width: 760px) {
  .lvl-badge { font-size: .75rem; min-width: 20px; height: 20px; line-height: 16px; }
  .avatar-edit-label { font-size: .75rem; }
  .board-card-head h3 a { display: inline-block; padding-block: 8px; }
  .live-list li a { display: inline-block; padding-block: 6px; }
  .member-name { min-height: 40px; }
  .clan-edit summary, .faq-list summary { min-height: 44px; display: flex; align-items: center; }
  .tag { font-size: .75rem !important; }
}
@media (max-width: 760px) {
  .result-layer { position: fixed; inset: 0; z-index: 120; border-radius: 0; padding: 74px 14px max(24px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
  .result-card { padding: 20px 16px; }
  .result-card .row-gap { display: grid; gap: 8px; }
  .result-card .row-gap .btn { width: 100%; min-height: 48px; }
  .guest-cta { margin-top: 12px; padding-top: 12px; }
  .guest-cta p { font-size: .9rem; margin-bottom: 8px; }
  .modal-layer { position: fixed; inset: 0; z-index: 120; border-radius: 0; }
  .game-app:has(.result-layer) { min-height: 0; }
}
@media (max-width: 760px) {
  .layer-host:has(.result-layer), .layer-host:has(.modal-layer) { z-index: 60; }
  .result-card .row-gap { justify-content: stretch; justify-items: stretch; }
}
@media (max-width: 760px) {
  .ach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ach { padding: 10px 6px; gap: 2px; }
  .ach-medal { width: 44px; height: 44px; }
  .ach-medal svg { width: 22px; height: 22px; }
  .ach b { font-size: .9rem; }
  .ach small { font-size: .75rem; }
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .stat-card { padding: 12px; }
  .game-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .game-picker label > span { padding: 8px 4px; }
  .game-picker .art { width: 52px; }
  .game-picker b { font-size: .82rem; line-height: 1.2; }
  .game-picker small { display: none; }
  .profile-head { gap: 14px; }
}
/* =====================================================================
   v10 — softer look, daily reward, emotes, rematch, played recently, tide
   ===================================================================== */
/* softer surfaces: thin ink outline, light shadow, a hint of warmth on hover */
.game-tile, .social-card, .mode-card, .side-card, .panel, .board-card, .ch-card, .rw-card.got, .road-item, .clan-row, .member { transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
@media (hover: hover) {
  .game-tile:hover, .social-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(35, 32, 58, .06), 0 18px 32px -16px rgba(35, 32, 58, .35); }
}
.btn-play { background-image: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 55%); }
.btn-primary { background-image: linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 60%); }

/* footer: a moving tide instead of the scalloped edge */
.site-footer::before { top: -30px; height: 32px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='32'%3E%3Cpath d='M0 16 Q30 2 60 16 T120 16 T180 16 T240 16 V32 H0Z' fill='%2323203a'/%3E%3C/svg%3E") repeat-x 0 100% / 240px 32px; animation: tide 11s linear infinite; z-index: 1; }
.site-footer::after { content: ''; position: absolute; left: 0; right: 0; top: -40px; height: 32px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='32'%3E%3Cpath d='M0 16 Q37.5 0 75 16 T150 16 T225 16 T300 16 V32 H0Z' fill='%237fd0ff'/%3E%3C/svg%3E") repeat-x 0 100% / 300px 32px; opacity: .7; animation: tide-back 17s linear infinite; pointer-events: none; }
@keyframes tide { to { background-position-x: 240px; } }
@keyframes tide-back { to { background-position-x: -300px; } }

/* played recently */
.played-recent { margin-top: 18px; }
.recent-title { font-size: 1.15rem; margin: 0 0 8px; }
.recent-row { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.recent-row::-webkit-scrollbar { display: none; }
.recent-card { flex: 0 0 auto; display: grid; grid-template-columns: 48px auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 8px 14px 8px 8px; min-height: 64px; background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; text-decoration: none; color: var(--ink); scroll-snap-align: start; box-shadow: 0 2px 5px rgba(35, 32, 58, .1); }
.recent-card:active { transform: scale(.97); }
.recent-art { grid-row: span 2; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--paper-2); border: 2px solid var(--ink); overflow: hidden; }
.recent-art .art { width: 86%; height: auto; }
.ra-battleship { background: #7fd0ff; } .ra-chess { background: #ffb48a; } .ra-checkers { background: #ffcf9e; } .ra-reversi { background: #8fe3b8; } .ra-dots { background: #ffd75e; }
.ra-connect-four { background: #9bb8ff; } .ra-tic-tac-toe { background: #8fe3b8; } .ra-word-rush { background: #ffd75e; } .ra-hangman { background: #ffb48a; } .ra-anagrams { background: #c9b6ff; }
.recent-card b { font-weight: 900; white-space: nowrap; }
.recent-card small { font-weight: 800; color: var(--muted); font-size: .75rem; white-space: nowrap; }

/* daily reward */
html.dr-open body { overflow: hidden; }
.dr-layer { position: fixed; inset: 0; z-index: 170; display: grid; place-items: center; padding: 16px; background: rgba(35, 32, 58, .55); backdrop-filter: blur(3px); animation: fade-in .2s ease-out; overflow-y: auto; overscroll-behavior: contain; }
.dr-layer.out { opacity: 0; transition: opacity .2s; }
.dr-card { position: relative; width: min(440px, 100%); display: grid; justify-items: center; gap: 10px; padding: 22px 18px 16px; text-align: center; background: linear-gradient(180deg, #fff6d6, #fff 45%); border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); }
.dr-card h2 { margin: 0; font-size: clamp(1.6rem, 6vw, 2rem); }
.dr-card .eyebrow { margin: 0; }
.dr-chest { width: 108px; filter: drop-shadow(0 8px 10px rgba(35, 32, 58, .25)); animation: chest-wobble 2.2s ease-in-out infinite; }
.dr-chest svg { overflow: visible; }
.dr-chest .lid { transform-box: fill-box; transform-origin: 10% 100%; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.dr-chest.open { animation: chest-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
.dr-chest.open .lid { transform: rotate(-38deg) translateY(-6px); }
@keyframes chest-wobble { 0%, 70%, 100% { transform: none; } 76% { transform: rotate(-6deg); } 82% { transform: rotate(5deg); } 88% { transform: rotate(-3deg); } }
@keyframes chest-pop { 40% { transform: scale(1.15) translateY(-6px); } }
.dr-gain { font: 2.4rem/1 var(--serif); color: var(--mustard); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; animation: count .7s ease-out; }
.dr-note { margin: 0; font-weight: 800; color: var(--ink-2); max-width: 32ch; }
.dr-days { list-style: none; margin: 6px 0 4px; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.dr-day { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; background: var(--paper); border: 2px dashed var(--line-2); min-width: 0; }
.dr-day small { font-size: .7rem; font-weight: 900; color: var(--muted); white-space: nowrap; }
.dr-day b { font: .95rem var(--serif); color: var(--muted); }
.dr-icon { width: 26px; height: 26px; display: grid; place-items: center; }
.dr-icon svg { width: 100%; height: 100%; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.dr-day.big .dr-icon svg { stroke-width: 3.5; }
.dr-day.done { background: #e8fbf1; border: 2px solid var(--green); }
.dr-day.done .dr-icon svg { stroke: var(--green); }
.dr-day.done b { color: var(--green); }
.dr-day.today { background: var(--mustard); border: 2.5px solid var(--ink); transform: translateY(-3px); box-shadow: 0 6px 14px -6px rgba(35, 32, 58, .5); animation: today-glow 1.6s ease-in-out infinite; }
.dr-day.today small, .dr-day.today b { color: var(--ink); }
.dr-day.today .dr-icon svg { stroke: var(--ink); }
@keyframes today-glow { 50% { box-shadow: 0 0 0 5px rgba(255, 201, 60, .45), 0 6px 14px -6px rgba(35, 32, 58, .5); } }
.dr-card .btn-play { min-height: 58px; font-size: 1.25rem; padding: 8px 16px; }
@media (max-width: 420px) {
  .dr-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dr-day.big { grid-column: span 1; }
  .dr-chest { width: 90px; }
}
@media (max-height: 640px) { .dr-chest { width: 72px; } .dr-card { gap: 6px; padding-top: 14px; } }

/* emotes */
.emote-tray { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: -2px; padding: 8px; background: #fff; border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 0 10px 24px -12px rgba(35, 32, 58, .45); }
.emote-tray button { width: 48px; height: 48px; font-size: 1.6rem; line-height: 1; border-radius: 14px; border: 2px solid var(--line-2); background: var(--paper); display: grid; place-items: center; }
.emote-tray button:active { transform: scale(.88); background: var(--mustard); }
.emote-btn[aria-expanded="true"] { background: var(--mustard); }
.pl { overflow: visible; }
.emote-bubble { position: absolute; z-index: 6; top: -24px; left: 50%; font-size: 2rem; line-height: 1; padding: 6px 9px; background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 8px 18px -8px rgba(35, 32, 58, .5); pointer-events: none; animation: emote-in 2.6s cubic-bezier(.3, 1.5, .5, 1) forwards; }
.emote-bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; margin-left: -6px; background: #fff; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); }
.status-row { position: relative; }
.status-row > .emote-bubble { top: -40px; }
@keyframes emote-in { 0% { transform: translate(-50%, 10px) scale(.3); opacity: 0; } 12% { transform: translate(-50%, 0) scale(1.1); opacity: 1; } 20% { transform: translate(-50%, 0) scale(1); } 85% { opacity: 1; transform: translate(-50%, -6px); } 100% { opacity: 0; transform: translate(-50%, -16px); } }

/* rematch offer */
.rematch-btn.offer { animation: offer-pulse 1s ease-in-out infinite; }
@keyframes offer-pulse { 50% { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(255, 201, 60, .45); } }

@media (prefers-reduced-motion: reduce) {
  .site-footer::before, .site-footer::after, .dr-chest, .dr-day.today, .rematch-btn.offer { animation: none !important; }
}
.dr-chest { margin-top: 10px; }
.dr-chest.open .lid { transform: rotate(-26deg) translateY(-2px); }
.dr-icon svg { stroke-linejoin: round; }
.dr-day.done .dr-icon svg, .dr-day.today .dr-icon svg { fill: rgba(255, 255, 255, .5); }
@media (max-width: 420px) { .dr-day.big { grid-column: span 2; } }.match { position: relative; grid-template-columns: minmax(0, 1fr); }
.match > * { min-width: 0; }
.emote-tray { position: absolute; z-index: 25; left: 0; right: 0; bottom: 58px; width: fit-content; max-width: calc(100% - 16px); margin-inline: auto; }
@media (max-width: 760px) {
  html.in-match .match-actions:has(.emote-btn) .mode-tag { display: none; }
  html.in-match .match-actions { flex-wrap: wrap; row-gap: 6px; }
  .emote-tray button { width: 46px; height: 46px; font-size: 1.5rem; }
}
.emote-tray { display: grid; grid-template-columns: repeat(6, auto); }
@media (max-width: 340px) { .emote-tray { grid-template-columns: repeat(3, auto); } }
