/* ============================================================
   WORDTHIS: BLOCK RAIN  —  Design System (wordy-crush palette)
   ============================================================ */

/* ---------- Display font: Baloo 2 (Pack AO) ---------- */
/* SELF-HOSTED, never fetched from Google at runtime: the app has to render
   identically offline and inside a WebView with no network, and a blocked
   font request would leave headings in the fallback (or, with the default
   font-display, invisible for up to 3s). Files live in www/assets/fonts/
   and ship in the APK/IPA like any other asset.

   WHY BALOO 2, and why NOT Fredoka. Fredoka was the first pick — rounder,
   more obviously a game face, and less than half the bytes. It was rejected
   on evidence: its Google `latin-ext` subset DOES NOT CONTAIN the five
   glyphs that are uniquely Turkish (s-cedilla, g-breve and the dotted I —
   U+011E/011F/0130/015E/015F). The 4.5 KB subset size was the tell. Loaded
   with no unicode-range to hide behind, every one of those five fell back
   to the system font, which on a screen reading "Karsilikli" or "Oyunlarim"
   would have mixed two typefaces inside one word. Baloo 2 and Nunito both
   cover Turkish completely; Baloo 2 is 14 KB smaller and is a display face
   rather than a text face, so it won.

   ONE variable file per subset covers weights 400-800, so every heading
   weight costs zero extra bytes. Google's subset split is kept because
   Turkish needs BOTH files and nothing else: the dotless i and c/o/u with
   diacritics live in `latin`, the five above in `latin-ext`. The
   unicode-range pair is what lets an all-ASCII screen download only the
   33 KB `latin` file and pull the 27 KB `latin-ext` one lazily.

   Licence: SIL Open Font License 1.1 - www/assets/fonts/OFL.txt ships with
   the font, which is what the licence requires. */
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;   /* never block first paint on a font */
  src: url('../assets/fonts/baloo2-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../assets/fonts/baloo2-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Design tokens ---------- */
:root {
  /* Base surfaces lightened one step app-wide (Pack J) — the secondary pages
     read less like a black hole while body text (#eee) stays well above AA. */
  --bg:           #212138;
  --bg-card:      #262644;
  --bg-dark:      #1a1a30;
  --bg-darkest:   #101018;
  --accent:       #4db6ac;
  --accent-hover: #5ec8bf;
  --gold:         #f0b429;
  --green:        #3ddc84;
  --red:          #e94560;
  --pink:         #f48fb1;
  --text:         #eee;
  --text-muted:   #9a9ab2; /* lifted with the lighter surfaces (contrast kept) */

  /* Pack AO — ONE display face, used for the brand, menu buttons, page and
     dialog headings ONLY. Body copy, list rows, legal pages and the in-game
     HUD deliberately stay on the system stack: a display face everywhere
     reads as a toy, and Baloo 2's round counters cost legibility in a
     12-line privacy policy. The fallback is the SAME stack body text uses,
     so a font that never arrives degrades to today's design, not to Times.
     Rounded system faces come first so the swap is barely visible. */
  --font-display: 'Baloo 2', 'Segoe UI Variable Display', 'Segoe UI', Tahoma,
                  Geneva, Verdana, sans-serif;

  /* Pack AO — title-banner gradient. Kept as four stops + two angles so the
     panel can be re-themed from one place (a winter season variant overrides
     these under .menu-page[data-season="winter"], see below). The sweep runs
     warm violet -> indigo -> teal across the diagonal: it picks up the sunset
     pink at the top of the beach sky and the sea band at the bottom, so the
     panel reads as part of the scene instead of a card dropped onto it.
     At alpha 0.90 the sky no longer reads THROUGH the panel the way it
     did — the glass now comes from the specular sheen, the lit top edge
     and the lift shadow rather than from transparency. That is the price
     of the contrast numbers below, and it was worth paying.

     THE TINT IS A CONTRAST DECISION, not a taste one, and it was settled
     by measurement. The wordmark on top is itself a four-colour animated
     gradient (pink -> cyan -> green -> gold), so the panel has to stay
     clear of it at EVERY point of the sweep — in HUE as much as in
     lightness. The first pass ran violet -> teal, which put a cyan
     wordmark on a teal panel: 2 degrees of hue separation at the worst
     point, and the right half of the word simply disappeared.

     Honest numbers, composited over the brightest sky the panel sits on
     and under the sheen layer below (worst case), min:avg across all four
     text stops x all four panel stops:
       pre-Pack-AO flat indigo   1.05 : 2.41
       violet -> teal (rejected) 1.04 : 2.41,  hue separation  2 deg
       these values              1.79 : 4.02,  hue separation 40 deg
     So this is a clear improvement on what shipped before, but it is NOT
     AA for the pink stop and never was: a four-colour gradient that
     includes #FF0D72 cannot clear 4.5:1 over anything the sky still shows
     through. What carries it is what always carried it — 27px display
     weight (WCAG large-text territory) plus the opaque drop-shadow on
     .profile-card-banner .menu-title. Keeping the panel in the violet /
     indigo band is what stops the sweep colliding with it; do not move
     these stops toward cyan, green or gold. */
  --banner-g1: rgba(58, 26, 78, 0.90);     /* warm plum, top-left        */
  --banner-g2: rgba(36, 26, 86, 0.90);     /* indigo, the body           */
  --banner-g3: rgba(26, 28, 76, 0.90);     /* deep blue-violet           */
  --banner-g4: rgba(44, 21, 70, 0.90);     /* violet, bottom-right       */
  --banner-angle: 152deg;
  --banner-border: rgba(255,255,255,0.30);
  --border:       rgba(77,182,172,0.25);
  --border-dim:   rgba(255,255,255,0.08);
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-pill:  999px;

  /* Pack AJ: the one gap between a dialog's last line of text and its button
     row. Every overlay in the app (game over, arcade hand result, async
     result, quit/exit notices, name and delete prompts, training callout)
     takes its breathing room from here — the explanatory sentence used to
     sit directly on top of the buttons in anything that wasn't the solo
     game-over card. */
  --dialog-actions-gap: calc(22px * var(--ui-scale));

  /* ---------- Proportional UI scale (Pack AR) ----------
     ONE factor, written by main.js (Viewport.apply) from the viewport
     measured against the DESIGN REFERENCE — the 390x844 iPhone layout every
     number in this file was laid out for. Every fixed dimension below is
     `calc(<the phone number>px * var(--ui-scale))`, and the root font-size
     is scaled too so every `rem` follows without being touched, so a big
     screen gets the SAME composition at a larger size instead of a
     phone-sized island floating in the middle of an iPad.

     It is NEVER below 1, and a dead band snaps every phone-sized viewport
     to exactly 1 (see main.js) — so the phone layout is bit-identical to
     what Pack AE/AP measured, by construction rather than by luck. Keep it
     that way: a new fixed px value that is not multiplied here will grow
     out of proportion with everything around it on a tablet.

     This is deliberately NOT `transform: scale()` on the shell (that is the
     separate SHRINK path for short windows): the board canvas has to be
     LAID OUT at its real size so renderer.js can size the backing store to
     rect x DPR and keep the tiles crisp on an iPad's high-DPI screen. */
  --ui-scale: 1;

  /* ---------- UI type scale (Pack V) ----------
     ONE knob per step for every NON-home, NON-board surface: list rows,
     usernames, profile / settings / leaderboard / Karşılıklı / legal pages,
     dialogs, chat and toasts. iOS renders the old literal px noticeably
     larger than Android did, and usernames in particular dominated their
     rows; this scale steps everything down ~10% without touching padding,
     so touch targets are unchanged (a type-scale change, not a squeeze).
     --fs-md is the BODY FLOOR (13.5px) — nothing that carries prose or a
     row's primary text may go below it. The home screen (.menu-*,
     .tetro-btn-label, .profile-card--home, .icon-glass-btn) and the game
     board (.gt-*, .ag-*, #controls, #turn-timer, .sidebar-*, #hint-panel,
     .next-label) keep their own literal sizes on purpose — those two are
     laid out to the pixel and are explicitly out of scope. */
  --fs-xxs: calc(10.5px * var(--ui-scale));  /* micro chrome: badges, pills  */
  --fs-xs:  calc(11.5px * var(--ui-scale));  /* meta lines, hints, timestamps */
  --fs-sm:  calc(12.5px * var(--ui-scale));  /* secondary text, small buttons */
  --fs-md:  calc(13.5px * var(--ui-scale));  /* BODY + row primary  (floor)   */
  --fs-lg:  calc(15px   * var(--ui-scale));  /* page/section titles           */
  --fs-xl:  calc(16.5px * var(--ui-scale));  /* hero titles inside a page     */

  /* Standard page frame — every SPA page keeps this distance to the screen
     edges; combined with env(safe-area-inset-*) below for notch devices */
  --page-pad: calc(16px * var(--ui-scale));
  --pad-top:    max(var(--page-pad), env(safe-area-inset-top));
  --pad-right:  max(var(--page-pad), env(safe-area-inset-right));
  --pad-bottom: max(var(--page-pad), env(safe-area-inset-bottom));
  --pad-left:   max(var(--page-pad), env(safe-area-inset-left));
  /* Pack AC — the game column's width. Phones: the full viewport (unchanged).
     Wide viewports (below): the SAME mobile layout, scaled — capped by width
     and by height so a 2:3 board + 52px header + 117px D-pad fits without
     scrolling; the old desktop sidebar/stat-bar arrangement is gone. */
  /* Pack AE-fit — the VIRTUAL viewport. main.js (Viewport.fit) writes the
     visible viewport size here in px on load/resize/orientation/visualViewport
     events (innerHeight IS the dynamic viewport height — no dvh needed, and
     no dvh support required). When the window is SHORTER than the comfortable
     minimum, #app is transform-scaled down and these carry the larger
     virtual size the layout is computed at (real / scale). The vw/vh values
     below are only the no-JS fallback. */
  --vw: 100vw;
  --vh: 100vh;
  /* Pack AE-fit: height-aware at EVERY width (phones included — a short
     phone window, or any browser with its toolbar showing, used to overflow
     at the bottom and scroll). 212px = the tallest chrome the game page can
     carry above+below the board: async header 46+43, gt-main pad 4, frame
     2, and the read-only #ag-wait block 128 (D-pad 117 is smaller); solo's
     52px header leaves ~57px slack. The board is width-driven
     (aspect-ratio 2:3), so capping the column caps the height. */
  /* Pack AP: the outer max() is a FLOOR, not styling. (--vh - 212px) goes
     negative on a viewport shorter than the chrome it subtracts -- an iPad
     Slide Over / Stage Manager window dragged short, or a desktop window
     pulled down to a strip. A negative length makes the whole min() invalid,
     the board column collapses to 0, and the canvas is laid out at zero
     size. 180px is the narrowest column that still renders 8 columns. */
  /* Pack AR: the 212px chrome budget and the 520px cap are both design-
     reference numbers, so both ride --ui-scale — the board grows in step
     with the header and D-pad above and below it, never independently. */
  --shell-w: max(180px, min(var(--vw), calc((var(--vh) - 212px * var(--ui-scale)) * 0.6667)));
}

@media (min-width: 769px) {
  :root { --page-pad: calc(24px * var(--ui-scale)); }
}
/* Anything wider than a phone (≥500px — tablets from 768 up included) also
   caps the column at 520px (the mobile layout, scaled — never stretched). */
@media (min-width: 500px) {
  :root { --shell-w: max(180px, min(var(--vw), calc(520px * var(--ui-scale)),
                         calc((var(--vh) - 212px * var(--ui-scale)) * 0.6667))); }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Kill the WebView/mobile-browser rectangular tap flash (doesn't inherit — set on *) */
* { -webkit-tap-highlight-color: transparent; }

/* App should feel native, not like a web page: no text selection, no
   long-press callout/context menu, no iOS double-tap zoom. Inputs and
   contenteditable stay selectable/editable — this must never block typing.
   Pack R: user-select is NOT an inherited property — the old html,body rule
   never reached buttons/labels/rows, so iOS long-press-drag opened the text
   magnifier (loupe) on them. The universal selector covers every element at
   ZERO specificity, so the element-level opt-ins below (and the lobby room
   code's user-select:all) still win. */
* {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html, body {
  /* Effective touch-action intersects down the ancestor chain, so root-level
     manipulation already applies app-wide (kills the 300ms double-tap-zoom
     delay); #board and the D-pad .btn keep their touch-action:none. */
  touch-action: manipulation;
}
/* Boot backdrop (Pack Y): index.html ships <body class="pre-splash"> so the
   FIRST paint — before the router's 180ms fade mounts the splash page, and
   before any JS at all — is already the splash's #050208 instead of the
   lighter --bg. splash.js drops the class on advance, so every later page
   transition keeps the --bg backdrop it always had. */
body.pre-splash { background: #050208; }
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* Focus: no ring on pointer/tap focus, but keep a border-radius-respecting ring
   for keyboard navigation (box-shadow follows the element's rounded corners) */
button:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) { outline: none; }
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77,182,172,0.55);
}

html, body {
  height: 100%;
  /* Pack AE-fit: the DOCUMENT never scrolls. #app is exactly the viewport
     and each .page is its own scroll container (see below). */
  overflow: hidden;
  background: var(--bg);
  /* (body.pre-splash below overrides this until the splash advances) */
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
}

/* Pack AR: the root font-size IS the scale for every `rem` in this file —
   the brand wordmark, the game header title and badges, the async vs-bar.
   16px is the browser default, so at scale 1 nothing moves. */
html { font-size: calc(16px * var(--ui-scale)); }

/* ---------- App container ---------- */
/* History: Pack X moved this to 100dvh (a 100vh floor is taller than the
   visible viewport under a collapsing mobile URL bar and made every page
   scroll by the toolbar height). Pack AE-fit replaces the unit entirely with
   --vh, written in px by main.js from innerHeight — the same dynamic height,
   available on every WebView, and adjustable for the scaled-shell case. */
#app {
  /* Pack AE-fit: EXACTLY the (virtual) viewport, clipped — nothing below it
     can ever push a document scrollbar. Below the comfortable minimum height
     main.js sets width/height to the virtual size and transform-scales the
     whole shell down (the "letterbox" approach). */
  height: var(--vh);
  overflow: hidden;
  transform-origin: 0 0;
  transition: opacity 0.18s ease;
}

/* ---------- Shared page layout ---------- */
/* Page shell: header row (.page-topbar) + content + optional .page-footer
   pinned inside the padding. dvh (not vh) so mobile URL bars don't force a
   scrollbar; content scrolls only when it truly overflows. */
.page {
  /* Pack AE-fit: fills #app and SCROLLS INTERNALLY when its content is
     taller (leaderboard, legal text, badges, settings on a short window) —
     the document itself never scrolls. */
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: var(--pad-top) var(--pad-right) var(--pad-bottom) var(--pad-left);
  /* Pack AR. At scale 1 this is the unchanged 480px cap. Above it the
     column grows with the REFERENCE WIDTH (390px x scale), not with the cap
     — that distinction is the whole point. Scaling the cap itself sent the
     column to 671px on an iPad Air while the type and padding inside it only
     grew 1.398x, so the four home cards got wider much faster than they got
     taller and read as slabs with a small label floating in them. 390 x
     scale is what "the phone layout, proportionally bigger" actually means,
     and max() keeps the cap as the floor so nothing below the dead band
     moves. */
  max-width: max(480px, calc(390px * var(--ui-scale)));
  margin: 0 auto;
  box-sizing: border-box;
}

/* Footer action row — pinned to the bottom of the page, inside the padding.
   Multiple actions stack with a consistent gap. */
.page-footer {
  margin-top: auto;
  padding-top: 14px;
}
.page-footer > * + * { margin-top: 10px; }

/* ---------- Shared: page topbar ---------- */
/* Grid (not flex/space-between) so the title is TRULY centered regardless of
   back-button label width (varies per language) — the button sits in its own
   column and never shifts the centered title. */
.page-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  /* Comfortable breathing room above the header so the back button isn't
     glued to the screen top — adds to the page's safe-area .pad-top. */
  padding-top: 8px;
  padding-bottom: 20px;
}
.page-topbar > .wc-back-btn { justify-self: start; }

.page-topbar-title {
  grid-column: 2;
  font-family: var(--font-display);   /* Pack AO */
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--accent);
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* ---------- Shared: back button ---------- */
/* Gentle link-style: lighter weight, no boxy fill — reads as a soft nav link,
   not a button. The '‹' chevron sits a touch larger than the label. */
.wc-back-btn {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 6px 6px 2px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
  transition: color 0.15s, opacity 0.15s;
}
.wc-back-btn:hover { color: var(--accent); background: none; }
.wc-back-btn:active:not(:disabled) { opacity: 0.7; }

/* ---------- Shared: primary button ---------- */
.primary-btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  transition: background 0.15s, transform 0.1s;
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.08); }
.primary-btn:active { transform: scale(0.98); }

/* ---------- Shared: secondary button ---------- */
.secondary-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.secondary-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Shared: lang pill ---------- */
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(77,182,172,0.3);
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lang-pill:hover { border-color: var(--accent); background: #26264a; color: var(--text); }
.lang-pill--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
/* Splash chain (Pack Y): ONE hex — #050208 — from the native launch screen to
   this page. The Android launch drawable + iOS LaunchScreen are #050208
   (tools/gen-icons.js BG), and capacitor.config.json backgroundColor +
   body.pre-splash below match it, so no differently-colored frame can flash
   between the native splash and this screen. Keep all of them in sync. */
.splash-screen {
  position: fixed;
  inset: 0;
  background: #050208;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 12px;
}

.splash-text {
  font-family: var(--font-display);   /* Pack AO */
  font-size: 3rem;
  /* Baloo 2 tops out at 800. 900 would synthesise a fake bold — heavier
     strokes, mangled round counters — so the weight comes down to the
     real maximum and the face's own heft carries it. */
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  opacity: 0;
  transition: opacity 600ms ease;
  background: linear-gradient(135deg, #FF0D72, #0DC2FF, #0DFF72, #FFE138);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

.splash-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  opacity: 0;
  transition: opacity 600ms ease 200ms;
}

@keyframes gradient-shift {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* ============================================================
   MENU PAGE
   ============================================================ */
.menu-title {
  font-family: var(--font-display);   /* Pack AO */
  font-size: 2rem;
  font-weight: 800;   /* the face's real maximum — see .splash-text */
  letter-spacing: 0.1em;
  color: #fff;
  background: linear-gradient(135deg, #FF0D72, #0DC2FF, #0DFF72, #FFE138);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

/* Block-rain device (menu.js _titleRainTiles) — three gem tiles falling away
   from the end of the wordmark. Sized in em so it tracks the title font and
   preserves the nowrap fit; the palette fills + light stroke tie it to the
   board pieces, and drop-shadow gives the same lifted-card depth as the old
   tetromino T. Unaffected by the parent's background-clip:text. */
.title-rain {
  height: 0.98em;
  width: auto;
  vertical-align: -0.34em;   /* the tiles hang BELOW the baseline — they fall */
  margin-left: 0.14em;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.45));
}

/* ---------- Sky backdrop (home only) ---------- */
.menu-page {
  gap: 0;
  position: relative;
  overflow-x: hidden; /* clip the drifting cloud/bird motifs, not the page scroll */
}
/* Pack K vertical rhythm: the content column fills the page so the action
   buttons can be pushed toward the BOTTOM (margin-top:auto on .tetro-actions)
   — the dead zone under the buttons moved above them, into the scene. */
.menu-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Bottom strip: online count + version, centered under the buttons. */
.menu-footer {
  position: relative;
  z-index: 1;
  padding-top: 12px;
  text-align: center;
}
/* Approximate online-player count — hidden until Presence delivers a count
   (offline → simply never shows). */
.menu-online {
  font-size: calc(12.5px * var(--ui-scale));
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  display: none;
}
.menu-online--visible { display: block; }
/* App version (CONFIG.VERSION — the single source) — small and muted. */
.menu-version {
  margin-top: 3px;
  font-size: calc(11px * var(--ui-scale));
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.menu-online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(61,220,132,0.8);
  vertical-align: 1px;
}
.menu-sky {
  /* Pack AR: FIXED, not absolute. .menu-page is a .page, so it is capped at
     480px x --ui-scale and centred — an absolute backdrop stopped at the
     column edge and left flat --bg either side of it on any screen wider
     than the column (every iPad, every desktop window). The scene is the
     app's backdrop, not the column's: it now spans the whole shell and the
     centred column sits ON it, so the width a big screen does not use reads
     as deliberate space rather than as a hole. (Inside a transformed #app —
     the short-window shrink path — `fixed` resolves against #app, which IS
     the shell, so the short-window case is unchanged.) */
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
/* Season palettes — the single [data-season] switch (menu.js _currentSeason)
   drives both this gradient and which motif set is rendered. */
.menu-sky[data-season="summer"] {
  /* Sky blue → sunset pink → sea blue → sand at the bottom. The button zone
     (~34–52%) stays soft for readability; sea + sand sit below the horizon. */
  background: linear-gradient(180deg,
    #6fb0e0 0%, #9fc9ea 16%, #c9d6ec 34%, #f2c8d6 50%,
    #ffd6b0 60%, #4db4ec 66%, #2585c9 78%,
    #bfe0f0 83%, #ecd9a2 88%, #dcc47e 100%);
}
.menu-sky[data-season="winter"] {
  /* Cold sky → pale horizon → snowfield. */
  background: linear-gradient(180deg,
    #8fb8d8 0%, #b9d4e6 20%, #d8e6ef 40%, #e9f1f6 58%,
    #f4f8fb 72%, #eaf2f8 84%, #dfeaf2 100%);
}

.menu-sky-cloud, .menu-sky-bird, .menu-sky-sun {
  position: absolute;
  will-change: transform;
}
.menu-sky-sun { top: 5%; right: 10%; width: 84px; height: 84px; opacity: 0.95;
  filter: drop-shadow(0 0 26px rgba(255,196,80,0.75)); }
/* Distant mountains at the horizon (Pack O) — gray-brown, blurred for depth of
   field, base pinned to the sea line (the summer sea band starts at 66%). */
.menu-sky-mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34%;
  width: 100%;
  height: 54px;
  opacity: 0.8;
  filter: blur(2.5px);
}
/* Cloud-over-sun dimming (Pack O): this overlay and .menu-sky-cloud--1 run the
   SAME 70s linear infinite cycle from t=0, so the fade always lands while the
   cloud crosses the sun (sun center sits at ~79–85vw; the cloud reaches it at
   ~57–70% of its 170vw sweep across viewport widths). Opacity-only on a
   composited layer — atmosphere, not a strobe. */
.menu-sky-dim {
  position: absolute;
  inset: 0;
  background: #1c2740;
  opacity: 0;
  will-change: opacity;
  animation: sky-sun-dim 70s linear infinite;
}
@keyframes sky-sun-dim {
  0%, 56%   { opacity: 0; }
  60%       { opacity: 0.055; }
  66%       { opacity: 0.055; }
  71%, 100% { opacity: 0; }
}
.menu-sky-cloud { width: 130px; opacity: 0.9; }
.menu-sky-cloud--1 { top: 8%;  left: -25%; animation: sky-drift-cloud 70s linear infinite; }
.menu-sky-cloud--2 { top: 17%; left: -40%; width: 95px; opacity: 0.7; animation: sky-drift-cloud 95s linear infinite 4s; }
.menu-sky-bird { width: 26px; opacity: 0.8; }
.menu-sky-bird--1 { top: 13%; left: -6%; animation: sky-drift-bird 42s linear infinite 2s; }
.menu-sky-bird--2 { top: 21%; left: -10%; width: 20px; opacity: 0.6; animation: sky-drift-bird 55s linear infinite 14s; }
/* Boat drifts RIGHT→LEFT across the sea band (summer only). Anchored off the
   right edge and translated fully off the left; transform-only so it's cheap. */
.menu-sky-boat {
  position: absolute;
  top: 68%;
  right: -22%;
  width: 58px;
  opacity: 0.92;
  will-change: transform;
  filter: drop-shadow(0 2px 4px rgba(20,60,90,0.35));
  animation: sky-drift-boat 80s linear infinite 6s;
}

/* Beach items on the sand band (Pack M, summer only; refined Pack O). Static
   by design — the boat already provides motion. Anchored low at the side edges
   so they never sit under the action buttons or the centered footer text.
   Pack O: smaller, slightly rotated, soft-blurred and lower-contrast so they
   read as DISTANT SCENERY, never as tappable controls (pointer-events: none —
   redundant with the .menu-sky parent but explicit on purpose). */
.menu-sand-ball, .menu-sand-bucket, .menu-sand-shovel {
  position: absolute;
  pointer-events: none;
  opacity: 0.72;
  filter: blur(1.2px) drop-shadow(0 2px 2px rgba(120,90,40,0.25));
}
/* The ball keeps a lighter blur so it still clearly reads as a beach ball. */
.menu-sand-ball   { bottom: 4.5%; left: 9%;  width: 30px; transform: rotate(14deg);
                    opacity: 0.8; filter: blur(0.6px) drop-shadow(0 2px 2px rgba(120,90,40,0.25)); }
.menu-sand-bucket { bottom: 3%;   right: 9%;  width: 30px; transform: rotate(7deg); }
.menu-sand-shovel { bottom: 2.5%; right: 19%; width: 17px; transform: rotate(-24deg); }

/* Winter motifs */
.menu-snowman {
  position: absolute;
  bottom: 2%;
  left: 50%;
  width: 92px;
  height: 126px;
  margin-left: -46px;
  overflow: visible;
  filter: drop-shadow(0 6px 10px rgba(60,90,120,0.28));
}
.menu-snow {
  position: absolute;
  top: -6%;
  border-radius: 50%;
  background: #fff;
  opacity: 0.85;
  box-shadow: 0 0 4px rgba(255,255,255,0.6);
  will-change: transform;
  animation-name: snow-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes sky-drift-cloud { from { transform: translateX(0); } to { transform: translateX(170vw); } }
@keyframes sky-drift-bird  { from { transform: translateX(0); } to { transform: translateX(180vw); } }
@keyframes sky-drift-boat  { from { transform: translateX(0); } to { transform: translateX(-150vw); } }
@keyframes snow-fall {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(14px, 112vh, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .menu-sky-cloud, .menu-sky-bird, .menu-snow, .menu-sky-boat,
  .menu-sky-dim { animation: none; }
  .menu-sky-dim { opacity: 0; } /* no dimming without the cloud motion */
  .menu-snow { display: none; }
  .menu-sky-cloud--1 { left: 4%; }
  .menu-sky-cloud--2 { left: 46%; }
  .menu-sky-bird--1  { left: 68%; }
  .menu-sky-bird--2  { left: 22%; }
  .menu-sky-boat     { right: 30%; }
}

/* ---------- Top bar: settings + leaderboard (left), profile (right) ---------- */
.menu-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
}
.menu-topbar-left { display: flex; gap: 8px; }

/* Pack AB: testers reported the four home icon buttons melting into the
   sky. True glass now: a stronger frosted fill + a heavier blur so the
   animated backdrop visibly blurs THROUGH the disc (web/@supports path).
   The native fallback (blur disabled wholesale under html.is-native for
   WebView perf) is a MORE OPAQUE indigo fill — same family as the native
   .tetro-btn skin — never plain transparency. */
.icon-glass-btn {
  position: relative; /* anchors .icon-dot (Pack V) */
  width: calc(44px * var(--ui-scale));
  height: calc(44px * var(--ui-scale));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(20px * var(--ui-scale));
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.32);
  background: linear-gradient(165deg,
    rgba(255,255,255,0.30), rgba(255,255,255,0.13) 55%, rgba(255,255,255,0.20));
  box-shadow:
    0 5px 18px rgba(0,0,0,0.32),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 2px rgba(0,0,0,0.22);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.icon-glass-btn:hover { filter: brightness(1.15); }
.icon-glass-btn:active {
  transform: scale(0.94);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 2px rgba(0,0,0,0.2);
}
html.is-native .icon-glass-btn {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: linear-gradient(165deg,
    rgba(84,88,132,0.78), rgba(56,58,96,0.66) 55%, rgba(74,78,120,0.72));
}

/* "New event" dot on a top-bar icon button (Pack V — pending friend request
   on the home profile button). Same gold as .menu-badge / .mm-bubble so the
   notification language stays consistent; the dark ring keeps it readable
   where the glass sits over the bright summer sky. Non-interactive: the tap
   belongs to the button underneath. */
.icon-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #FFD700;
  border: 2px solid rgba(16,16,32,0.55);
  box-shadow: 0 0 7px rgba(255,215,0,0.75);
  pointer-events: none;
}

/* ---------- Profile card ---------- */
.profile-card {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: calc(24px * var(--ui-scale)) calc(20px * var(--ui-scale)) calc(26px * var(--ui-scale));
  border-radius: calc(36px * var(--ui-scale));
  border: 1px solid rgba(255,255,255,0.18);
  background: linear-gradient(165deg,
    rgba(255,255,255,0.12), rgba(255,255,255,0.04) 55%, rgba(255,255,255,0.07));
  /* Same depth model as the action buttons (Pack J): lit top edge, shaded
     bottom edge, soft lift shadow. */
  box-shadow:
    0 12px 34px rgba(0,0,0,0.38),
    inset 0 1px 0 rgba(255,255,255,0.24),
    inset 0 -2px 4px rgba(0,0,0,0.18);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}
html.is-native .profile-card { -webkit-backdrop-filter: none; backdrop-filter: none; }

.profile-card-banner { padding: calc(17px * var(--ui-scale)) calc(22px * var(--ui-scale)) calc(18px * var(--ui-scale)); } /* taller title panel (Pack K) */
.profile-card-banner .menu-title {
  /* Sized to fit inside the oval banner at 360–390px widths without wrapping. */
  font-size: 1.72rem;
  /* Pack AO: Baloo 2 is narrower than Segoe, so the wordmark got SMALLER
     (173.3px, was 184.3px) and the banner fit improved to 24.3px of slack in
     the 360px card — tracking is opened back up a touch to use it. */
  letter-spacing: 0.07em;
  white-space: nowrap;
  /* Pack AO: the panel behind the wordmark is now COLOURED, so the glyphs
     need a real dark edge rather than only a cyan glow — the animated
     gradient sweeps through teal and green, which used to sit on flat
     indigo and now crosses the banner's own teal corner. A tight opaque
     shadow restores the separation at every point of the sweep; the cyan
     bloom stays for the lift. drop-shadow (not text-shadow) because the
     glyphs are a clipped gradient, not painted text. */
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.55))
          drop-shadow(0 2px 6px rgba(0,0,0,0.5))
          drop-shadow(0 0 18px rgba(13,194,255,0.34));
}
/* Home title banner: SAME translucent glass family as the four .tetro-btn
   cards (Pack K — the old sky-blue tint clashed once the buttons went indigo
   glass). Deliberately translucent, not opaque: the sky must read through.
   Two-class selector so it wins over the neutral .title-banner skin defined
   later in the file. */
.profile-card .profile-card-banner {
  /* Pack AO — TINTED glass, not a flat fill. Two layers stacked in one
     background property (first = on top): a specular white sheen that
     keeps the panel reading as glass, over the four-stop colour sweep
     from the --banner-g* tokens. The old flat indigo is what those
     tokens replaced; the glass treatment itself (lit top edge, shaded
     base, lift shadow, border highlight) is untouched below. */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.20), rgba(255,255,255,0.03) 46%,
                    rgba(255,255,255,0) 62%, rgba(0,0,0,0.10)),
    linear-gradient(var(--banner-angle),
      var(--banner-g1), var(--banner-g2) 38%, var(--banner-g3) 70%, var(--banner-g4));
  border-color: var(--banner-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.34),
    inset 0 -2px 5px rgba(0,0,0,0.26),
    0 6px 18px rgba(28,20,58,0.30);
}
/* Winter re-theme hook (Pack AO). menu.js stamps data-season on .menu-page
   as well as on .menu-sky, so the banner can follow the season the same
   way the sky gradient does — cold blues instead of the summer sweep.
   Overriding only the TOKENS means the glass layers above never change. */
.menu-page[data-season="winter"] {
  --banner-g1: rgba(26, 40, 82, 0.90);
  --banner-g2: rgba(22, 46, 92, 0.90);
  --banner-g3: rgba(20, 40, 86, 0.90);
  --banner-g4: rgba(28, 34, 78, 0.90);
}

.profile-card-body { margin-top: calc(16px * var(--ui-scale)); }

.profile-avatar {
  width: calc(56px * var(--ui-scale));
  height: calc(56px * var(--ui-scale));
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #3a8f86);
  border: 2px solid rgba(255,255,255,0.2);
}
.profile-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar-initials { font-size: 22px; font-weight: 800; color: #08302b; }

.profile-name {
  margin-top: 10px;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-account {
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-account--guest { cursor: pointer; }
.profile-link-hint { color: var(--accent); font-weight: 700; }

/* Async-MP win rate on the home profile card (Pack J). Hidden until the
   my-matches subscription delivers at least one finished match. Pack R:
   BLUE per user request. The card's effective surface (white glass over the
   summer sky) sits around L≈0.70 relative luminance; a plain vivid blue like
   #1d4ed8 measures only ~4.8:1 there (AA, but thin) — #1e40af measures
   ~6.2:1, comfortably AA while still reading clearly blue. */
.profile-winrate {
  margin-top: 5px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #1e40af;
  display: none;
}
.profile-winrate--visible { display: block; }

/* Profile page (editable): same card skin, name becomes an input */
.profile-card--edit { margin-bottom: 20px; }
.profile-card--edit .profile-card-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.profile-name-input { max-width: 220px; text-align: center; }

/* Home card (Pack L): a step LARGER than the profile-page card, and tappable
   — the whole card routes to the profile page. */
.profile-card--home { cursor: pointer;
  padding: calc(28px * var(--ui-scale)) calc(22px * var(--ui-scale)) calc(30px * var(--ui-scale)); }
.profile-card--home:active { transform: scale(0.99); }
.profile-card--home .profile-avatar {
  width: calc(76px * var(--ui-scale)); height: calc(76px * var(--ui-scale)); }
.profile-card--home .profile-avatar-initials { font-size: calc(30px * var(--ui-scale)); }
.profile-card--home .profile-name { font-size: calc(17px * var(--ui-scale));
  margin-top: calc(12px * var(--ui-scale));
  /* Pack O: the home card floats on the BRIGHT summer sky (~#c9d6ec–#f2c8d6
     behind the white glass) — white was unreadable there. Dark teal measures
     ~5.4:1 on that surface (AA for normal text; the name is 17px/700).
     Scoped to --home: the profile-page card sits on the dark app background
     where light text stays correct. */
  color: #0c5f55; }
.profile-card--home .profile-account { font-size: calc(13px * var(--ui-scale)); }
/* Pack AC: provider mark (Apple / Google G / envelope) left of the name; the
   account-state line under the name is gone. Same dark teal as the name so
   the mark reads as part of it, slightly muted. */
.profile-card--home .profile-name {
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.profile-provider {
  display: inline-flex; width: 16px; height: 16px; flex: 0 0 auto;
  color: #0c5f55; opacity: 0.85;
}
.profile-provider svg { width: 100%; height: 100%; display: block; }
.profile-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The home card is OUT of the Pack V type-scale pass — .profile-name and
   .profile-account already had --home overrides, .profile-winrate did not,
   so it gets one here to keep its original size. */
.profile-card--home .profile-winrate { font-size: calc(12.5px * var(--ui-scale)); }

/* Preset avatar glyph (avatars.js): gradient disc + white SVG, fills its
   host (.profile-avatar or .avatar-choice). */
.avatar-glyph {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-glyph svg { width: 62%; height: 62%; display: block; }

/* Avatar picker (profile page, linked accounts only). Pack O: 6-up with the
   22-avatar set — cells stay ≥40px on a 360px screen ((360−2×16 page pad
   −2×16 group pad −5×8 gaps)/6 ≈ 42px), so tap targets hold. */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.avatar-choice {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.avatar-choice:active { transform: scale(0.92); }
.avatar-choice--active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,194,255,0.25);
}

/* Immutable guest name (Pack L identity rules) */
.name-locked { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; }
.settings-group .name-locked { align-items: flex-start; text-align: left; }
.name-locked-name { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.name-locked-hint { font-size: var(--fs-xs); color: var(--text-muted); }

/* Account deletion (Pack L): deliberately muted — present but not inviting */
.danger-zone { margin-top: 28px; margin-bottom: 8px; text-align: center; }
.danger-link {
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-decoration: underline;
  cursor: pointer;
}
.danger-link:active { color: var(--red); }
.delete-explain { text-align: left; line-height: 1.45; }

/* ---------- Four tetromino-themed action buttons ---------- */
.tetro-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Pack AR: the gap grows with the cards, but at 0.75x the rate — at iPad
     scale a proportional 14->20px gutter pushed the 2x2 block wider than the
     profile card above it and the composition came apart. The cards are what
     should read bigger; the air between them only has to keep them apart. */
  gap: calc(14px * (0.25 + 0.75 * var(--ui-scale)));
  margin-top: calc(14px * var(--ui-scale));
  flex: 0 0 auto;
}
/* (Pack AC: the ≥600px 4-across variant is gone — the 2×2 phone grid is
   the ONLY arrangement; .page's 480px max-width centers the column.) */

.tetro-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(8px * var(--ui-scale));
  min-height: calc(96px * var(--ui-scale));
  padding: calc(16px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border-radius: var(--radius-lg);
  overflow: hidden; /* clips the ::before gloss to the rounded corners */
  /* Premium glass (Pack J): TRANSLUCENT again — the sky reads through the
     frosted blur — but clearly denser than the backdrop, so the card reads
     raised. Depth comes from the edge treatment: bright top edge, dark
     bottom edge (inset shadows), soft drop shadow underneath. */
  border: 1px solid rgba(255,255,255,0.22);
  /* Pack M: fill dropped a big step (0.62→0.40 peak) — more scene reads
     through; the raised look now leans on the edge/gloss/shadow model and
     the label text-shadow keeps white text legible over the sand band. */
  background: linear-gradient(165deg,
    rgba(58,58,98,0.40), rgba(40,40,72,0.32) 55%, rgba(64,64,106,0.38));
  box-shadow:
    0 12px 28px rgba(0,0,0,0.42),          /* lift off the scene */
    0 2px 6px rgba(0,0,0,0.28),            /* contact shadow */
    inset 0 1px 0 rgba(255,255,255,0.30),  /* lit top edge */
    inset 0 -2px 4px rgba(0,0,0,0.30);     /* darker bottom edge */
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
  color: #fff;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, filter 0.15s;
}
/* Specular top gloss — a soft light sweep across the upper half. */
.tetro-btn::before {
  content: '';
  position: absolute;
  inset: 0 0 55% 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.02));
  pointer-events: none;
}
.tetro-btn > * { position: relative; } /* content above the gloss layer */
.tetro-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  filter: brightness(1.08);
  box-shadow:
    0 14px 30px rgba(77,182,172,0.26),
    inset 0 1px 0 rgba(255,255,255,0.32),
    inset 0 -2px 4px rgba(0,0,0,0.30);
}
/* Press: sink INTO the scene — shadow collapses, top light dims. */
.tetro-btn:active {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.96);
  box-shadow:
    0 4px 10px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 0 2px 6px rgba(0,0,0,0.24);
}
.tetro-btn:disabled {
  opacity: 0.5;
  filter: grayscale(0.4);
  pointer-events: none;
}
html.is-native .tetro-btn {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  /* No blur in the WebView, so the fill stays denser than the web glass —
     but Pack M drops it from near-opaque (0.95) to a translucent 0.72 so
     the scene reads through on device too. */
  background: linear-gradient(165deg,
    rgba(60,60,100,0.74), rgba(44,44,78,0.70) 55%, rgba(66,66,108,0.72));
}

/* Fixed-height slot centres each motif so buttons stay equal height even
   though the trimmed SVGs differ in intrinsic size (uniform cell scale). */
.tetro-icon-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(46px * var(--ui-scale));
}
/* The SVG carries intrinsic px width/height attributes (bbox x TETRO_CELL),
   and the four motifs must keep their RELATIVE sizes — so this scales the
   painted vector rather than forcing a common height. Vector, so crisp. */
.tetro-icon { display: block; transform: scale(var(--ui-scale)); }
.tetro-btn-label {
  /* Revision 4: bigger, heavier, wider-tracked — a confident game-menu label.
     NO text-transform: uppercase (Turkish dotless-ı casing is locale-fragile);
     the i18n strings themselves carry the casing.
     Pack AO: on the display face, and MEASURED rather than guessed —
     Baloo 2 is noticeably NARROWER than Segoe at the same px (its round
     forms are tall, not wide), which bought the room to go up two steps
     instead of one. At 360px, where each card is 149px wide, the longest
     label in either language ("Nasıl Oynanır?") lands at 118.5px — a 30.5px
     margin, wider than the 16px/0.05em Segoe version had. Tracking still
     comes down: this face sets its own rhythm and 0.05em pulled the
     rounds apart. */
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.015em;
  text-align: center;
  /* Guarantees white-on-sand contrast now that the fill is more transparent.
     Pack AO adds a third, tighter shadow: the rounder Baloo 2 strokes have
     less edge contrast against the glass than Segoe's flatter ones. */
  text-shadow: 0 1px 1px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.60),
               0 2px 7px rgba(0,0,0,0.35);
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-page { gap: 0; }

.settings-group {
  margin-bottom: 28px;
}
.settings-group-label {
  font-size: var(--fs-xxs);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Sub-label under a settings control (Pack AM) — one muted sentence saying
   what the choice actually does. Below the --fs-md body floor on purpose:
   this is meta text under a control, not prose. */
.settings-help {
  margin-top: 8px;
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--text-muted);
}

.settings-lang-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  /* Glass rollout (Pack G2) */
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border-radius: var(--radius-md);
  cursor: pointer;
}
.settings-toggle-label { font-size: var(--fs-md); font-weight: 600; }

.settings-toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.settings-toggle input { opacity: 0; width: 0; height: 0; }

.settings-toggle-slider {
  position: absolute;
  inset: 0;
  background: #555;
  border-radius: 26px;
  transition: background 0.3s;
  cursor: pointer;
}
.settings-toggle input:checked + .settings-toggle-slider { background: var(--accent); }

.settings-toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}
.settings-toggle input:checked + .settings-toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   LANGMODE PAGE
   ============================================================ */
.langmode-page { gap: 0; }

.langmode-section-label {
  font-size: var(--fs-xxs);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.langmode-lang-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.langmode-lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(77,182,172,0.3);
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.langmode-lang:hover { border-color: var(--accent); background: #26264a; color: var(--text); }
.langmode-lang--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   MULTIPLAYER LOBBY
   ============================================================ */
.mp-lobby-page { gap: 0; }

/* Two side-by-side entry cards (Pack AB): title / big icon / mini
   description. Fits 360px: (360 − 32 page pad − 12 gap) / 2 = 158px each. */
.mp-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.mp-match-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 132px;
  padding: 18px 12px;
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  /* glass edge model consistent with .btn-glass / .tetro-btn */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -1px 2px rgba(0,0,0,0.20),
    0 4px 14px rgba(0,0,0,0.25);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}
.mp-match-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(77,182,172,0.2);
}
.mp-match-card--active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent), 0 6px 20px rgba(77,182,172,0.25);
}
.mp-match-icon { font-size: 2.2rem; line-height: 1; }
.mp-match-label { font-size: var(--fs-md); font-weight: 700; letter-spacing: 0.06em; }
.mp-match-desc  { font-size: var(--fs-xxs); color: var(--text-muted); line-height: 1.4; }
/* (.mp-match-card--wide / .mp-match-text died with the Pack AB two-card row) */

/* Oda — inline room create / join-by-code panel (replaces the old modal). */
.mp-room-panel {
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.mp-room-panel .langmode-section-label { margin-bottom: 14px; }
.mp-room-panel .room-code-input { margin-top: 0; }

.room-code-input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-dark);
  border: 1px solid #34345c;
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: 'Consolas', 'Roboto Mono', 'Courier New', monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-indent: 0.35em; /* re-center: compensates the trailing letter-spacing */
  text-align: center;
  text-transform: uppercase;
  outline: none;
}
.room-code-input:focus { border-color: var(--accent); }
.room-code-input::placeholder { color: var(--text-muted); font-size: 18px; letter-spacing: 0.2em; }

.room-hint {
  margin-top: 10px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Join/create buttons inline under the code input (the hub page has the
   Oyunlarım list below, so no pinned page-footer here) */
.room-btn-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.room-btn-row .primary-btn,
.room-btn-row .secondary-btn { flex: 1; }

/* Matchmaking overlay */
.mp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,24,0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 20px;
}
.mp-overlay--visible { opacity: 1; pointer-events: auto; }

.mp-overlay-card {
  background: linear-gradient(160deg, rgba(52,52,86,0.96), rgba(20,20,38,0.95));
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.14);
  transform: translateY(10px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.2,0.8,0.3,1.2);
}
.mp-overlay--visible .mp-overlay-card { transform: translateY(0) scale(1); }

.mp-overlay-spinner {
  font-size: 2.4rem;
  margin: 8px 0 10px;
  display: block;
  animation: mp-wobble 1.4s ease-in-out infinite;
}
@keyframes mp-wobble {
  0%,100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}
.mp-overlay-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.mp-room-code {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(77,182,172,0.45);
  padding: 8px 0 4px;
  user-select: all;
}

/* ============================================================
   GAME PAGE
   ============================================================ */
.game-page {
  height: 100%;       /* Pack AE-fit: the board column is sized to FIT (--shell-w) — never scrolls */
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0;
  overflow: hidden;
  /* UI Redesign: deep navy arena atmosphere — a static layered background
     (vignette + faint honeycomb + base gradient). All pre-rasterized by the
     browser once; zero per-frame cost next to the canvas.
     Pack AR adds the first layer: a soft cool glow centred on the board
     COLUMN. This backdrop already spanned the full page width (max-width is
     none here), so the letterbox either side of a centred portrait column
     was never flat --bg — but it was undifferentiated, and on a landscape
     iPad that read as the phone layout stranded in the middle. The glow puts
     the light where the board is, so the unused width reads as room around
     the stage. Its size tracks --shell-w, so it is the column's halo at
     every scale; at phone widths the column fills the viewport and the layer
     is invisible. One more gradient on an element that already had three —
     still rasterized once, still zero per-frame cost. */
  background:
    radial-gradient(calc(var(--shell-w) * 1.45) 62% at 50% 38%,
                    rgba(86,112,208,0.17), rgba(10,14,32,0) 72%),
    radial-gradient(120% 90% at 50% 30%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.42) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cg fill='none' stroke='%237a98ff' stroke-opacity='0.05' stroke-width='1.4'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, #10172e 0%, #0b1122 45%, #070b18 100%);
}

/* --- Game topbar — same header standard as .page-topbar, full-bleed bg --- */
.gt-topbar {
  min-height: calc(52px * var(--ui-scale) + env(safe-area-inset-top));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) var(--pad-right) 0 var(--pad-left);
  /* Pack AC: on wide viewports the bar stays full-bleed but its CONTENT is
     held to the board column (--shell-w) — same [back][title][badges]
     spacing as on a phone instead of the back button and score chip
     drifting to the screen edges. On phones the max() resolves to the
     normal page padding. */
  padding-left:  max(var(--pad-left),  calc((100% - var(--shell-w)) / 2 + 8px));
  padding-right: max(var(--pad-right), calc((100% - var(--shell-w)) / 2 + 8px));
  /* Premium HUD bar: navy glass with a lit top edge + shaded seam below */
  background: linear-gradient(180deg, rgba(30,38,72,0.92), rgba(16,21,44,0.92));
  border-bottom: 1px solid rgba(122,152,255,0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 6px 18px rgba(0,0,0,0.35);
  z-index: 10;
}
/* Async runs a TWO-row header (this + .ag-vs-bar) — Pack AB tightens row 1
   to 46px so the board starts higher (target: assets/ss/p1.jpg RIGHT). The
   back button (~36px) and 1.15rem title still fit with air. Solo keeps 52. */
.gt-topbar--async { min-height: calc(46px * var(--ui-scale) + env(safe-area-inset-top)); }

.gt-title {
  /* Sized down in Pack AE: at 1.15rem/0.14em the solo header read as a tight
     fit between the back button and the [lang][lv][score] group. */
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 0 16px rgba(122,152,255,0.35);
}

.gt-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Level badge — background = the current level color (CONFIG.LEVELS). The
   light border keeps the dark early-level colors (L1 black) visible on the
   dark topbar. */
.gt-level-badge {
  background: #000;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -1px 0 rgba(0,0,0,0.35),
              0 2px 6px rgba(0,0,0,0.4);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.gt-level-badge--pop { animation: level-pop 0.5s ease-out; }
@keyframes level-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Language badge — same pill shape/size as the level badge, but a steady blue
   (distinct from the level color ramp) so EN/TR reads at a glance (Pack G2). */
.gt-lang-badge {
  background: linear-gradient(180deg, #2f5cab, #1f3f7a);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-pill);
  padding: 4px 9px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -1px 0 rgba(0,0,0,0.35),
              0 2px 6px rgba(0,0,0,0.4);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.gt-score-chip {
  /* Score = the HUD's jewel — revision 3: a CONVEX outset capsule (bombeli),
     solid filled navy dome: lit top edge + shaded bottom inside, lift shadow
     below (the old recessed-well insets are gone) */
  background: linear-gradient(180deg, #35528a 0%, #1d3158 48%, #101c3a 100%);
  border: 1px solid rgba(110,231,220,0.55);
  border-radius: var(--radius-pill);
  padding: 4px 16px;
  font-size: 1rem;
  font-weight: 800;
  color: #7ffff0;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: center;
  box-shadow: inset 0 2px 2px rgba(255,255,255,0.28), inset 0 -3px 6px rgba(0,0,0,0.5),
              0 3px 8px rgba(0,0,0,0.5);
  text-shadow: 0 0 10px rgba(94,200,191,0.55);
}

/* --- Async MP header row 2 (Pack Q): avatars + names + scores mirrored
   around the center separator, one thin power bar under each side. Replaces
   the old in-title vs-scores AND the board's top-left power panel. --- */
/* Pack W — two-line sides:
     line A  [av] name … score      |      score … name [av]
     line B  ▬▬▬░░░ [Lv]            |      [Lv] ░░░▬▬▬
   Pack AB compression (target: assets/ss/p1.jpg RIGHT — score row and power
   bars pulled together, less vertical padding):
     Pack W   3 + 26(head) + 2 + 14(foot) + 3 = 48px
     Pack AB  2 + 24(head) + 2 + 13(foot) + 2 = 43px
   (head = the 24px avatar, tallest thing on line A; the score chip measures
   ~22px). Combined with the 46px async row 1, the header block drops
   100 → 89px and the board top rises ~11px.                              */
.ag-vs-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px var(--pad-right) 2px var(--pad-left);
  /* Pack AC: content held to the board column on wide viewports (see .gt-topbar) */
  padding-left:  max(var(--pad-left),  calc((100% - var(--shell-w)) / 2 + 8px));
  padding-right: max(var(--pad-right), calc((100% - var(--shell-w)) / 2 + 8px));
  background: linear-gradient(180deg, rgba(22,28,54,0.92), rgba(13,17,36,0.92));
  border-bottom: 1px solid rgba(122,152,255,0.14);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  z-index: 9;
}
.ag-vs-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ag-vs-head {
  display: flex;
  align-items: center;
  gap: 5px;      /* every px here goes to the username (Pack W) */
  min-width: 0;
}
.ag-vs-side--opp .ag-vs-head { justify-content: flex-end; }
/* Line B. Fixed 14px so the bar's centre line and the chip agree, and so the
   header height is arithmetic rather than font-metric luck. The bar takes the
   remaining width; the chip is pinned to the INNER end of each side, which is
   simply DOM order (bar→chip on the left side, chip→bar on the right). */
.ag-vs-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 13px; /* Pack AB: one px shaved with the rest of the header */
  min-width: 0;
}
.ag-vs-name {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-vs-side--opp .ag-vs-name { color: var(--pink); text-align: right; }
.gt-vs-sep { color: var(--text-muted); font-weight: 800; flex-shrink: 0; }
.ag-vs-bar .gt-score-chip {
  min-width: 38px;
  padding: 3px 8px;
  font-size: 0.88rem;
  flex-shrink: 0;
}
.gt-score-chip--opp {
  background: rgba(244,143,177,0.12);
  border-color: rgba(244,143,177,0.4);
  color: var(--pink);
}

/* Per-player MP level chip (Pack U) — the solo header badge skin, scaled down
   again in Pack W now that it rides the power-bar line: an explicit 14px box
   with line-height to match, so it can't out-grow .ag-vs-foot and push the
   header (and the board) down. The background is set from
   CONFIG.MP_LEVELS[n].color in JS. Scoped to .ag-vs-bar so it also wins over
   the mobile .gt-level-badge compaction rule further down. */
.ag-vs-bar .ag-lv-badge {
  flex-shrink: 0;
  height: 13px; /* Pack AB: tracks the compressed .ag-vs-foot */
  padding: 0 6px;
  font-size: 0.62rem;
  line-height: 11px;
  border-radius: 7px;
  letter-spacing: 0;
}

/* Tappable mini avatar (→ profile card modal, Pack Q) */
.ag-vs-avatar {
  width: 24px;  /* Pack AB: 26 → 24, sets line A's height in the tighter bar */
  height: 24px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #3a8f86);
  border: 1px solid rgba(255,255,255,0.35);
  cursor: pointer;
}
.ag-vs-avatar .profile-avatar-initials { font-size: 11px; }
.ag-vs-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ag-vs-avatar:active { filter: brightness(1.2); }

/* Thin per-player power bar: the track carries the full red→orange→green
   ramp (green ≈ the ≥6 clear gate); a dark cover hides the unfilled part
   from the CENTER side, so my bar fills left→center and the opponent's
   mirrored bar fills right→center. */
.ag-pow {
  position: relative;
  flex: 1;          /* Pack W: shares line B with the Lv chip */
  min-width: 0;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(90deg, #ff4d4d, #ffa726 42%, #2ecc71 62%);
}
.ag-pow--opp { background: linear-gradient(270deg, #ff4d4d, #ffa726 42%, #2ecc71 62%); }
.ag-pow--ready { box-shadow: 0 0 6px rgba(46,204,113,0.55); } /* clear-ready */
.ag-pow-cover {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 90%;
  background: rgba(12,12,24,0.86);
  transition: width 0.25s ease;
}
.ag-pow--opp .ag-pow-cover { right: auto; left: 0; }

/* --- Game main area --- */
.gt-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  padding-top: 10px;
}

.gt-inner {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  transform-origin: top center;
  /* natural width is set by its children */
}

/* --- Canvas container (mirrors old #game-container) --- */
#game-container {
  position: relative;
  /* Recessed arena frame: thin steel-blue rim, rounded, sunk into the page.
     No overflow:hidden — the desktop #ui bar sits ABOVE at top:-46px. */
  border: 1px solid rgba(122,152,255,0.22);
  border-radius: 16px;
  background: #101830;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05),
              0 12px 34px rgba(0,0,0,0.55),
              0 0 0 4px rgba(8,12,26,0.6);
  flex-shrink: 0;
}
/* Inner lip shadow over the canvas edge — the board reads as sunk INTO the
   frame. Sits under the HUD overlays (they are z-index 5+). */
#game-container::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 15px;
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 3px 10px rgba(0,0,0,0.55), inset 0 -2px 8px rgba(0,0,0,0.4);
}

canvas#board {
  display: block;
  /* Fixed logical size — the renderer resizes the backing store to CSS size × DPR,
     so layout must NOT follow the width/height attributes (feedback loop). */
  width: 896px;
  height: 1344px;
  background: #101830;   /* matches the renderer's arena base — no flash on load */
  border-radius: 15px;   /* CSS-clips the square canvas corners to the frame */
  touch-action: none;
}

/* Rejected selection (Pack U async min-length rule): a short board shake
   pairs with the toast so the refusal is felt as well as read. Transform-only
   and short — it can't fight the renderer (which never touches CSS transforms
   on the canvas). */
.board-shake { animation: board-shake 0.3s ease-in-out; }
@keyframes board-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(2px); }
}
/* Pack AG bomb blast (arcade): a SOFT shake for radius ≥2 / chain blasts —
   a couple of px, both axes, so it reads as a thud, not a rejection. */
.board-shake--soft { animation: board-shake-soft 0.28s ease-out; }
@keyframes board-shake-soft {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(-2px, 2px); }
  50%      { transform: translate(2px, -1px); }
  75%      { transform: translate(-1px, 1px); }
}
@media (prefers-reduced-motion: reduce) {
  .board-shake--soft { animation: none; }
}

/* (Pack AC: the desktop stat bar #ui/.stat-box above the canvas was deleted
   — the markup still renders the #ui div, hidden by the unified block below.) */

/* --- Flash message overlay on canvas --- */
/* UI Redesign: the completed word is a golden hero moment, not a boxed alert —
   free-floating glowing type that pops in with a spring and fades out. */
#message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffd75e;
  text-shadow:
    0 2px 0 rgba(90,50,0,0.55),
    0 3px 8px rgba(0,0,0,0.65),
    0 0 22px rgba(255,190,60,0.55),
    0 0 52px rgba(255,150,20,0.30);
  pointer-events: none;
  text-align: center;
  width: 90%;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  white-space: pre-line;
}
#message.msg-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: word-pop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes word-pop {
  0%   { transform: translate(-50%, -50%) scale(0.55); }
  60%  { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #message.msg-visible { animation: none; }
}

/* --- Sidebar: next piece + score + power bar --- */
#next-panel {
  position: absolute;
  left: calc(100% + 14px);
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 14px 12px;
  /* Glass rollout (Pack G2) — desktop sidebar; the mobile overlay keeps its
     dark board-legible bg (overridden in the mobile media query below). */
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border: 1px solid rgba(77,182,172,0.2);
  border-radius: 10px;
  width: 186px;
}

.next-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

#next-canvas {
  display: block;
  /* Tiles are drawn on a transparent canvas; the recessed well behind them */
  background: radial-gradient(80% 80% at 50% 40%, rgba(20,30,60,0.6), rgba(5,8,18,0.8));
  border-radius: 10px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}

.sidebar-divider {
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 2px 0;
}

.sidebar-score-total {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.sidebar-score-last {
  font-size: 17px;
  font-weight: 700;
  color: var(--green);
  min-height: 22px;
}

.sidebar-opponent-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--pink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
  text-align: center;
}

.sidebar-opponent-score {
  font-size: 24px;
  font-weight: 800;
  color: var(--pink);
  font-variant-numeric: tabular-nums;
}

/* --- Power bar --- */
#power-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.power-segment {
  height: 13px;
  border-radius: 4px;
  background: #222;
  transition: background 0.12s, box-shadow 0.12s;
}
.power-segment.lit.zone-amber { background: #f5a623; }
.power-segment.lit.zone-green { background: #0DFF72; }
.power-segment.lit.zone-gold  {
  background: #FFD700;
  box-shadow: 0 0 8px 2px rgba(255,215,0,0.65);
}
#power-value { font-size: 12px; color: var(--text-muted); letter-spacing: 1px; }
#power-label.danger,
#power-ring-label.danger { color: #ff4444; animation: danger-pulse 0.8s ease-in-out infinite; }

/* --- Doughnut power ring (mobile only; desktop keeps the sidebar bar) --- */
#power-ring-panel { display: none; }

/* --- Hint widget: longest formable word, top-center overlay (solo only) --- */
#hint-panel {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(22,30,58,0.88), rgba(10,14,30,0.9));
  border: 1px solid rgba(122,152,255,0.22);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.4);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255,200,60,0.4);
  white-space: nowrap;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Value-change pop (revision 3): the "3 harfli × 2 → 4 harfli × 1" moment
   must catch the eye — overshoot scale + a bright gold flash of the panel
   border/glow, settling back to the resting skin. */
@keyframes hint-pop {
  0%   { opacity: 0.2; transform: translateX(-50%) scale(0.7);
         filter: brightness(2.4);
         border-color: rgba(255,215,0,0.95);
         box-shadow: 0 0 16px rgba(255,200,60,0.75), inset 0 1px 0 rgba(255,255,255,0.08); }
  45%  { opacity: 1;   transform: translateX(-50%) scale(1.28);
         filter: brightness(1.7);
         border-color: rgba(255,215,0,0.85);
         box-shadow: 0 0 14px rgba(255,200,60,0.6), inset 0 1px 0 rgba(255,255,255,0.08); }
  100% { opacity: 1;   transform: translateX(-50%) scale(1);
         filter: brightness(1);
         border-color: rgba(122,152,255,0.22);
         box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.4); }
}
#hint-panel.hint-pop { animation: hint-pop 0.55s cubic-bezier(0.2, 1.3, 0.4, 1); }
@media (prefers-reduced-motion: reduce) {
  #hint-panel.hint-pop { animation: none; }
}

/* Arcade grace period (Pack AK): the countdown pill takes board top-centre
   for those 10 seconds, which is exactly where the hint panel sits. The panel
   goes rather than stacking under the pill — the green hint MARK is still on
   the board, which is the part that actually points anywhere. */
.game-page--grace #hint-panel { display: none; }

/* --- Color-bomb widget (Pack AG, solo only) --- */
/* Desktop: the power dial overlay is hidden (power lives in the sidebar), so
   the widget takes the board's free top-left corner; the mobile media query
   below moves it UNDER the dial. Same panel skin as #hint-panel/Next. */
#bomb-widget {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: linear-gradient(180deg, rgba(22,30,58,0.88), rgba(10,14,30,0.9));
  border: 1px solid rgba(122,152,255,0.22);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.4);
  font-size: 14px;
  font-weight: 800;
  color: #8d99bb;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#bomb-widget .bomb-emoji { font-size: 16px; filter: grayscale(1); opacity: 0.55; }
#bomb-widget.bomb-ready { color: #FFD700; border-color: rgba(255,201,60,0.65); }
#bomb-widget.bomb-ready .bomb-emoji { filter: none; opacity: 1; }
#bomb-widget.bomb-ready { animation: bomb-pulse 1.6s ease-in-out infinite; }
@keyframes bomb-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.4); }
  50%      { box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 14px rgba(255,201,60,0.6); }
}
@media (prefers-reduced-motion: reduce) {
  #bomb-widget.bomb-ready { animation: none; }
}
/* Bomb progress dialog (Pack AG2): "Sarı: 20/30" rows with a fill bar; ready
   rows carry an enabled 💣 button. Shares the gameover-overlay/modal shell. */
.bomb-dialog { width: min(340px, calc(100vw - 32px)); }
.bomb-rows {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 14px 0 4px;
}
.bomb-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bomb-row-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.45);
  flex: 0 0 auto;
}
.bomb-row-name {
  width: 62px;
  flex: 0 0 auto;
  text-align: left;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #dfe6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bomb-row-bar {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
  overflow: hidden;
}
.bomb-row-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 0;
  transition: width 0.2s ease;
}
.bomb-row-num {
  width: 46px;
  flex: 0 0 auto;
  text-align: right;
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #aab4d6;
}
.bomb-row-btn {
  width: 34px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  border: 1px solid rgba(255,201,60,0.6);
  background: linear-gradient(180deg, rgba(60,48,20,0.9), rgba(30,22,8,0.9));
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
}
.bomb-row-btn:disabled {
  opacity: 0.28;
  filter: grayscale(1);
  cursor: default;
  border-color: rgba(255,255,255,0.18);
  box-shadow: none;
}
.bomb-row-btn:not(:disabled):active { transform: scale(0.92); }
.bomb-row--ready .bomb-row-num { color: #FFD700; }

/* Level-up interstitial (Pack AD) — pauses the game under a centered card so
   the new minimum-word-length rule gets read; tap or ~2.6s dismisses. */
.levelup-overlay {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,7,18,0.55);
  opacity: 0; transition: opacity 0.2s ease;
}
.levelup-overlay--visible { opacity: 1; }
.levelup-card {
  background: linear-gradient(180deg, rgba(26,35,66,0.97), rgba(12,17,36,0.97));
  border: 1px solid rgba(255,215,0,0.55);
  border-radius: calc(16px * var(--ui-scale));
  padding: calc(22px * var(--ui-scale)) calc(30px * var(--ui-scale));
  text-align: center;
  max-width: min(calc(320px * var(--ui-scale)), 84vw);
  box-shadow: 0 0 30px rgba(255,200,60,0.25), 0 10px 30px rgba(0,0,0,0.6),
              inset 0 1px 0 rgba(255,255,255,0.1);
  transform: scale(0.85);
  transition: transform 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.levelup-overlay--visible .levelup-card { transform: scale(1); }
.levelup-title {
  font-family: var(--font-display);   /* Pack AO */
  font-size: calc(30px * var(--ui-scale)); font-weight: 800; color: #FFD700;
  letter-spacing: 0.03em;
  text-shadow: 0 0 14px rgba(255,200,60,0.6), 0 2px 4px rgba(0,0,0,0.6);
}
.levelup-info {
  margin-top: 10px;
  font-size: var(--fs-md); line-height: 1.5;
  color: var(--text);
  white-space: pre-line; /* the i18n string carries a deliberate line break */
}

/* Turn-handover countdown (Pack AE) — same interstitial family as the
   level-up card, but the number carries the weight instead of a title. */
.ready-card { padding: 18px 34px; }
.ready-title {
  font-family: var(--font-display);   /* Pack AO */
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.ready-count {
  margin-top: 4px;
  font-size: 56px;
  font-weight: 900;
  line-height: 1.1;
  color: #FFD700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(255,200,60,0.6), 0 2px 6px rgba(0,0,0,0.6);
}
@keyframes ready-pop {
  0%   { transform: scale(1.45); opacity: 0.25; }
  55%  { transform: scale(0.96); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* Final "Hazır!" beat (1.5.0) — word, not digit: one size down so it fits. */
.ready-count--go { font-size: 32px; padding: 9px 0; }
.ready-count--pop { animation: ready-pop 0.32s cubic-bezier(0.2, 1.3, 0.4, 1); }
@media (prefers-reduced-motion: reduce) {
  .ready-count--pop { animation: none; }
}

/* First-game 8-direction hint (Pack AC): a 3×3 letter grid with the centre
   tile lit and eight arrows pulsing outward in sequence, then "Anladım". */
.dirhint-card { max-width: min(calc(340px * var(--ui-scale)), 88vw); padding: calc(20px * var(--ui-scale)) calc(22px * var(--ui-scale)) calc(18px * var(--ui-scale)); }
.dirhint-title { font-size: 22px; }
.dirhint-svg { width: 168px; height: 168px; margin: 10px auto 2px; display: block; }
.dirhint-tile { fill: rgba(40,56,110,0.92); stroke: rgba(122,152,255,0.35); stroke-width: 1; }
.dirhint-tile--mid { fill: #b8860b; stroke: #FFD700; }
.dirhint-letter {
  fill: #dfe6ff; font-size: 20px; font-weight: 800; font-family: inherit;
  text-anchor: middle; dominant-baseline: central;
}
.dirhint-letter--mid { fill: #fff; }
.dirhint-arrow {
  stroke: #FFD700; stroke-width: 3; stroke-linecap: round; opacity: 0.35;
  animation: dirhint-pulse 1.44s ease-in-out infinite;
}
@keyframes dirhint-pulse { 0%, 100% { opacity: 0.3; } 25% { opacity: 1; } }
.dirhint-info { font-size: var(--fs-md); margin-top: 8px; }
.dirhint-ok { margin-top: var(--dialog-actions-gap); width: 100%; }
@media (prefers-reduced-motion: reduce) {
  .dirhint-arrow { animation: none; opacity: 0.9; }
}

@keyframes danger-pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
@keyframes seg-flash {
  0%   { filter: brightness(3) saturate(2); }
  100% { filter: brightness(1) saturate(1); }
}
.power-segment.flash { animation: seg-flash 0.45s ease-out forwards; }

/* --- Mobile HUD --- */
#mobile-hud { display: none; }

/* --- On-screen D-pad (shortened so it clears the gesture bar on short screens
   like the Redmi) ---
   [Sol]  [Sağ]  [        ]   Sol/Sağ on the top row, Aşağı centered beneath
      [Aşağı]    [ Rotate ]   them, Rotate spanning both rows.  */
/* D-pad grid — ONE rule, used by solo, training, socket MP and async MP
   alike (they all render the same #controls markup from renderGamePageHTML,
   and there has never been a per-mode override).

   Pack X layout — Sol/Sağ on the TOP ROW ONLY; Aşağı in the middle column
   (bottom row); Rotate spanning both rows:

       col       1        2       3        4
       row 1   [ Sol ] [      ] [ Sağ ] [ Rotate ]
       row 2   [     ] [ Aşağı] [     ] [ Rotate ]

   Aşağı is centered on the Sol/Sağ midline BY CONSTRUCTION: col 1 and col 3 are
   both 1fr, so the midpoint between their centers is exactly col 2's center.
   Every button still STARTS at row 1, so the top edges remain identical by
   construction — the Pack V Rotate-alignment fix stays structural rather than
   a per-button align-self.

   Pack X3 — geometry lifted from the measured mockup
   (assets/buttons-layout-new.png, 400px wide): Sol/Sağ ≈105px with a 20px gap,
   Aşağı 122×46 centered on their midline, Rotate 137 wide (1.3× a direction
   key) with ~24px separating it from the cluster, row gap ~5px, and the dead
   space under the block red-boxed as "silinmeli" (deleted via the mobile
   padding rule below). Aşağı is WIDER than the Sol–Sağ gap in the mockup, so
   the Pack W/X "own column" scheme can't express it — the grid is now THREE
   columns and Aşağı spans cols 1/3 on the bottom row, centered:

       col       1        2        3
       row 1   [ Sol ] [ Sağ ] [ Rotate ]
       row 2   [   Aşağı   ]   [ Rotate ]

   Centering stays structural (cols 1+2 are both 1fr → the span's center IS the
   Sol/Sağ midline), and the Pack O tap-stealing hazard cannot return: Sol/Sağ
   live only on row 1, Aşağı only on row 2 — no shared cell, hit areas disjoint
   by construction. Both rows are 44px (the app's standard target; the mockup's
   46px Aşağı reads as the same button under its shadow). All buttons still
   start at row 1 or sit alone in their row, so top edges can't misalign. */
#controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  grid-template-rows: calc(44px * var(--ui-scale)) calc(44px * var(--ui-scale));
  column-gap: calc(20px * var(--ui-scale));
  row-gap: calc(5px * var(--ui-scale));
  width: calc(450px * var(--ui-scale));
  padding: 0 0 calc(8px * var(--ui-scale));
  margin: 0 auto;
}

.btn {
  color: #fff;
  /* Grid items get an automatic min-width of their min-content (padding + the
     26px icon ≈ 68px). At 360px that floor swallowed the track ratios outright
     — every direction key rendered 68px wide and the fr weights did nothing.
     min-width:0 lets the declared proportions hold at EVERY width; the 40px
     touch floor is guaranteed by the fr math instead (smallest cell at 360px
     is Aşağı at 52×40). */
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(14px * var(--ui-scale));
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  touch-action: none; /* hold-to-repeat: the browser must not steal the pointer for scrolling */
}

/* Sol / Sağ: top row only (44px). Rotate keeps the full height (rows 1/3 =
   93px incl. the row gap). All three start at row 1, so their top edges match
   by construction — the Pack V misalignment cannot recur. */
.btn-left   { grid-column: 1; grid-row: 1; }
.btn-right  { grid-column: 2; grid-row: 1; }
/* The 20px column gap plus this margin ≈ the mockup's 24px between the
   direction cluster and Rotate — two visually distinct thumb groups. */
.btn-rotate { grid-column: 3; grid-row: 1 / 3; margin-left: calc(4px * var(--ui-scale)); }
/* Aşağı: spans the two direction columns on the BOTTOM row and self-centers
   on the Sol–Sağ midline (both tracks are 1fr, so the span's centre IS the
   midline — centring stays structural, not a magic number). Sol/Sağ live only
   on row 1 and Aşağı only on row 2, so no grid cell — and no hit area — is
   shared; this is a real 44px-tall target, not an ::after reconstruction.

   Pack AK narrowed it from the mockup's 53% to 32%: with solo on hard drop a
   stray Aşağı no longer nudges a piece, it FIRES it, so a thumb sliding off
   ◀/▶ onto the overhang costs the placement. At 390px wide the key goes
   117.9px → 71.2px and the overhang under each side button 48.9px → 25.5px.
   It cannot reach zero: the Sol–Sağ gap is 20px, so a key that overhangs
   nothing would be below the 44px touch floor. 32% is the widest setting that
   keeps the whole key inside the middle third of the cluster. */
.btn-drop   { grid-column: 1 / 3; grid-row: 2; justify-self: center; width: 32%; }

/* Inline SVG icons (stroke = currentColor) — ONE size for every button
   (Pack X3, per the mockup: "symbols same size and font"). The rotate glyph's
   34px override is gone; its stroke-width now matches the chevrons (2.6, set
   in the gamepage.js markup). */
#controls .btn svg { width: calc(26px * var(--ui-scale)); height: calc(26px * var(--ui-scale)); pointer-events: none; }

/* --- Instructions --- */
#instructions {
  margin: 4px auto 8px;
  font-size: 0.82em;
  color: var(--text-muted);
  text-align: center;
  width: 450px;
  line-height: 1.4;
}

/* ============================================================
   GAME OVER OVERLAY
   ============================================================ */
.gameover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,24,0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 7000;
  opacity: 0;
  transition: opacity 0.25s;
  padding: 20px;
}
.gameover-overlay--visible { opacity: 1; }

.gameover-modal {
  /* Glass card language (soft gradient + translucent-white border + inset
     top highlight), kept near-opaque so dialog text stays crisp. */
  background: linear-gradient(160deg, rgba(52,52,86,0.96), rgba(20,20,38,0.95));
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-lg);
  padding: calc(30px * var(--ui-scale)) calc(26px * var(--ui-scale)) calc(24px * var(--ui-scale));
  width: 100%;
  max-width: calc(360px * var(--ui-scale));
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.14);
  transform: translateY(12px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.2,0.8,0.3,1.2);
}
.gameover-overlay--visible .gameover-modal { transform: translateY(0) scale(1); }

.gameover-title {
  font-family: var(--font-display);   /* Pack AO */
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  /* text-transform dropped with the display face: Baloo 2's caps are
     wide, and uppercasing Turkish in CSS is locale-fragile anyway
     (i -> I instead of I-dotted). The i18n strings carry their casing. */
}
/* Result numeral (Pack W). 52px was a shout, and in the async result — which
   prints TWO totals and a dash — five-digit scores overflowed the 308px of
   modal content width outright. Display numerals sit deliberately OUTSIDE the
   Pack V --fs-* scale (that scale tops out at 16.5px, it is for body text);
   these are hand-set instead. It still counts up and still glows, it just
   stops filling the card.
     solo   38px → "123450" ≈ 137px, fits with room to spare
     async  28px → "12345 — 12345" ≈ 216px in 308px                       */
.gameover-score {
  font-size: calc(38px * var(--ui-scale));
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(77,182,172,0.42);
  margin: 6px 0 0;
  line-height: 1.15;
}
.gameover-label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  /* The gap below now belongs to .gameover-actions (one token, every dialog
     — Pack AJ); this margin only ever spaced THIS label from the buttons. */
  margin-bottom: 0;
}
.gameover-actions {
  display: flex;
  gap: calc(12px * var(--ui-scale));
  margin-top: var(--dialog-actions-gap);
}
/* Three destinations (Pack AJ arcade result: Tekrar | Aşamalar | Sonraki).
   One-word labels each, so they stay side by side down to 360px — tighter
   gap and padding, one step down in size. */
.gameover-actions--three { gap: 8px; }
.gameover-actions--three .gameover-btn {
  padding: 13px 6px;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
}
/* Three-way dialogs (Pack AE — the guest-progress transfer question): the
   labels are full sentences, so side-by-side they would each wrap to two or
   three lines on a 360px phone. Stacked keeps one label per row. */
.gameover-actions--stacked { flex-direction: column; gap: 10px; }
.gameover-btn {
  flex: 1;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #2a2a4e;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.gameover-btn:hover { border-color: var(--accent); color: var(--text); filter: brightness(1.12); }
.gameover-btn--primary {
  background: linear-gradient(135deg, var(--accent), #3fa79c);
  border-color: var(--accent);
  color: #0b2a25;
}
.gameover-btn--primary:hover { filter: brightness(1.08); }

/* ============================================================
   TOAST
   ============================================================ */
.wc-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #2a2a3e;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.wc-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Pack S variants: top placement (opponent-move toast — slides down from
   under the header) and two-line messages ('\n' via pre-line, centered). */
.wc-toast--top {
  bottom: auto;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  transform: translateX(-50%) translateY(-16px);
}
.wc-toast--top.wc-toast--visible { transform: translateX(-50%) translateY(0); }
.wc-toast--multi {
  white-space: pre-line;
  text-align: center;
  line-height: 1.45;
  max-width: calc(100vw - 32px);
}
/* Pack U: tappable toasts (the global opponent-move toast opens the match) */
.wc-toast--tappable { pointer-events: auto; cursor: pointer; }
/* Opponent-move panel: top-down blue→aqua gradient, first line small and
   muted, the move itself bold (the '\n' split is done in CSS, not markup —
   textContent stays injection-proof). */
/* Pack W: a step smaller again (13.5 → 11.5 body, 11.5 → 10.5 for the name
   line). The move line now lists every word WITH its own points, so it is
   carrying more text than it used to in the same strip across the screen —
   and a transient panel is chrome, not reading matter. Gradient, tap-to-open
   and the max-width truncation are unchanged. */
.wc-toast--move {
  background: linear-gradient(180deg, #1e4fd8, #17b6b0);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0,0,0,0.4);
  padding: 8px 16px;
  font-size: var(--fs-xs);
  font-weight: 800;
  max-width: calc(100vw - 24px);
}
.wc-toast--move::first-line {
  font-size: var(--fs-xxs);
  font-weight: 600;
}

/* ============================================================
   MOBILE  ≤ 768 px
   ============================================================ */
/* ============================================================
   GAME LAYOUT — Pack AC: this used to be the `@media (max-width: 768px)`
   phone block. It now applies at EVERY width: wide viewports get the SAME
   arrangement (power dial top-left, bomb widget under it, Next top-right,
   header row identical) scaled up through --shell-w (capped by width and
   height in :root). The desktop-only rules it used to override — the
   896×1344 fixed canvas, the #next-panel sidebar with the segmented power
   bar, the 450px D-pad, #instructions, the JS transform scaler — are now
   dead at all widths (see SESSION_NOTES Pack AC for the list).
   ============================================================ */

  /* (Pack AE-fit: the old `.game-page { overflow-y: auto; }` escape hatch is
     gone — the column is height-capped, so nothing is left to scroll to.) */

  .gt-main {
    align-items: flex-start;
    justify-content: center;
    padding-top: 4px;
    overflow: visible;
  }

  .gt-inner { transform: none !important; }

  #game-container {
    width: calc(var(--shell-w) - 8px);
    border-width: 1px;
    border-radius: calc(14px * var(--ui-scale));
  }
  #game-container::after { border-radius: calc(13px * var(--ui-scale)); }
  canvas#board { border-radius: calc(13px * var(--ui-scale)); }

  canvas#board {
    width: 100%;
    aspect-ratio: 896 / 1344;
    height: auto;
  }

  /* Stat bar hidden on mobile */
  #ui { display: none; }

  /* Next panel: small translucent overlay at top-right of board. Fixed 84px
     width so it is the SAME box size as the Güç ring overlay at top-left. */
  #next-panel {
    left: auto;
    top: calc(6px * var(--ui-scale));
    right: calc(6px * var(--ui-scale));
    background: linear-gradient(180deg, rgba(22,30,58,0.88), rgba(10,14,30,0.9));
    border: 1px solid rgba(122,152,255,0.22);
    border-radius: calc(12px * var(--ui-scale));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.4);
    padding: calc(5px * var(--ui-scale)) calc(7px * var(--ui-scale));
    gap: calc(3px * var(--ui-scale));
    pointer-events: none;
    z-index: 5;
    width: calc(84px * var(--ui-scale));
    box-sizing: border-box;
  }

  /* Hide score/power from overlay panel on mobile — they live in #mobile-hud */
  #next-panel .sidebar-divider,
  #score-total-label, #score-total,
  #score-last-word-label, #score-last-move,
  #power-label, #power-bar, #power-value,
  #opponent-name, #opponent-score { display: none; }

  .next-label { font-size: calc(10px * var(--ui-scale)); letter-spacing: 1px; }
  #next-canvas {
    width: calc(64px * var(--ui-scale)) !important;
    height: calc(64px * var(--ui-scale)) !important;
  }

  /* Hint widget: shrink so it never collides with the ring (left, ~72px)
     or the Next overlay (right, ~80px) — at 390px that leaves ~230px */
  #hint-panel {
    font-size: calc(11px * var(--ui-scale));
    letter-spacing: 0.6px;
    padding: calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale));
    max-width: calc(100% - 190px * var(--ui-scale));
  }

  /* Async status panel (Pack Q): same footprint as the D-pad it replaces.
     Selector carries .game-page (Pack S): the base #ag-wait rule (width
     450px) sits LATER in this file — same specificity would let it win even
     on phones, which is exactly the Redmi "info panel wider than the screen"
     overflow. The extra class makes this mobile block authoritative. */
  .game-page #ag-wait {
    width: calc(var(--shell-w) - 16px * var(--ui-scale));
    max-width: 100%;
    margin: calc(8px * var(--ui-scale)) auto 0;
    /* Pack AE-fit: same bottom clearance rule as the D-pad (16px floor) so
       the read-only block (8+12+92+16 = 128px) stays inside the 212px chrome
       budget that sizes the board column. */
    padding: calc(12px * var(--ui-scale)) calc(12px * var(--ui-scale))
             max(calc(16px * var(--ui-scale)), calc(env(safe-area-inset-bottom) + 10px));
    min-height: calc(92px * var(--ui-scale)); /* matches the D-pad footprint */
  }
  /* Terser status text on phones — wraps to two lines, never overflows. */
  .game-page .ag-wait-main { font-size: calc(13px * var(--ui-scale)); line-height: 1.35; }
  .game-page .ag-wait-sub  { font-size: calc(11.5px * var(--ui-scale)); }
  /* Pack W level hint: one step smaller again on phones so the TR sentence
     stays at two lines at 360px inside the 92px panel. */
  .game-page .ag-wait-hint {
    font-size: calc(11px * var(--ui-scale));
    margin-top: calc(6px * var(--ui-scale));
    padding-top: calc(6px * var(--ui-scale));
  }

  /* Power ring overlay: top-left of the board, mirrors the Next overlay — SAME
     84px box size and padding so the two HUD corners match (Pack G2). */
  /* The copper dial FLOATS on the board like the reference mock — the canvas
     draws its own bezel, so no boxed panel behind it (Next keeps its box). */
  #power-ring-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(2px * var(--ui-scale));
    position: absolute;
    left: calc(6px * var(--ui-scale));
    top: calc(6px * var(--ui-scale));
    z-index: 5;
    background: none;
    border: none;
    box-shadow: none;
    padding: calc(5px * var(--ui-scale)) calc(7px * var(--ui-scale));
    pointer-events: none;
    width: calc(84px * var(--ui-scale));
    box-sizing: border-box;
  }
  #power-ring {
    display: block;
    width: calc(64px * var(--ui-scale));
    height: calc(64px * var(--ui-scale));
  }
  /* Bomb widget sits DIRECTLY UNDER the power dial on phones (Pack AG2 —
     same x-alignment: the same 84px column as the ring panel, content
     centered), below the dial's ~94px band. */
  #bomb-widget {
    left: calc(6px * var(--ui-scale));
    top: calc(100px * var(--ui-scale));
    width: calc(84px * var(--ui-scale));
    justify-content: center;
    box-sizing: border-box;
    padding: calc(4px * var(--ui-scale)) calc(6px * var(--ui-scale));
    font-size: calc(13px * var(--ui-scale));
  }
  /* Copper letter-spaced label under the dial (reference "POWER") */
  #power-ring-label {
    color: #d9a05f;
    letter-spacing: 0.16em;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  }

  /* Header: compact the title + badges so [back][title][lang][lv][score] never
     overflow the narrowest phones now that the lang badge was added (Pack G2) */
  .gt-title { font-size: 0.88rem; letter-spacing: 0.05em; }
  .gt-lang-badge, .gt-level-badge { font-size: 0.72rem; padding: 3px 7px; }

  /* Async header row 2 (Pack Q): compact names/chips so
     [(av) Name (490) — (403) Name (av)] fits at 360px */
  .ag-vs-bar { gap: 6px; }
  .ag-vs-name { font-size: 0.72rem; }
  .ag-vs-bar .gt-score-chip {
    min-width: calc(36px * var(--ui-scale));
    padding: calc(3px * var(--ui-scale)) calc(8px * var(--ui-scale));
    font-size: 0.84rem;
  }

  /* Mobile HUD — rendered only in multiplayer (opponent score); solo shows
     the score in the header chip and power in the ring */
  #mobile-hud {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    width: calc(var(--shell-w) - 16px * var(--ui-scale));
    margin: calc(6px * var(--ui-scale)) auto 0;
    padding: calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale));
    /* Glass rollout (Pack G2) */
    background: linear-gradient(135deg, #32325a, var(--bg-card));
    border: 1px solid #444;
    border-radius: 8px;
  }
  .mobile-hud-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
  }
  #mobile-opponent-section {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }
  .mobile-opponent-score {
    font-size: 20px;
    font-weight: 800;
    color: var(--pink);
    font-variant-numeric: tabular-nums;
  }

  /* D-pad bottom clearance (Pack AB, per p1.jpg LEFT: the buttons flirted
     with the Android gesture/nav bar — immersive WebViews often REPORT the
     bottom inset as 0, so the Pack X3 10px floor was the only gap). Floor
     raised to 16px as an explicit minimum margin; the env() branch still
     wins where the inset IS reported. (Pack X3 history: the G2 24px floor
     was a dead band, 10px overshot the trim — 16 is the split.) */
  #controls {
    width: calc(var(--shell-w) - 16px * var(--ui-scale));
    margin: calc(8px * var(--ui-scale)) auto 0;
    padding: 0 0 max(calc(16px * var(--ui-scale)), calc(env(safe-area-inset-bottom) + 10px));
  }

  /* Instructions: hidden in-game — the freed space goes to the D-pad */
  #instructions { display: none; }

/* ============================================================
   PLAYER NAME INPUT (settings page + game-over name modal)
   ============================================================ */
.name-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.name-input::placeholder { color: var(--text-muted); font-weight: 400; }
.name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77,182,172,0.18);
}
.gameover-modal .name-input {
  margin: 4px 0 20px;
  text-align: center;
}

/* ============================================================
   LEADERBOARD PAGE
   ============================================================ */
.lb-seg-row { margin-bottom: 20px; }

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  /* Glass rollout (Pack G2) */
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.lb-row--me {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px rgba(77,182,172,0.25);
}

.lb-rank {
  width: 28px;
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.lb-rank--1 { color: #ffd54f; }
.lb-rank--2 { color: #cfd8dc; }
.lb-rank--3 { color: #bf8970; }

.lb-name {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.lb-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: var(--fs-md);
  color: var(--text-muted);
  line-height: 1.5;
}
.lb-retry-row {
  text-align: center;
  padding-bottom: 20px;
}

/* ============================================================
   SPLASH BRAND + LANGSETUP PAGE
   ============================================================ */
.splash-brand {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 600ms ease;
}

.langsetup-page {
  justify-content: center;
  gap: 40px;
}

.langsetup-hero { text-align: center; }

.langsetup-label {
  margin-top: 12px;
  font-size: var(--fs-md);
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.langsetup-btns {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.langsetup-btn {
  width: min(320px, 100%);
  padding: 18px 24px;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.15s, border-color 0.2s;
}
.langsetup-btn:hover { border-color: var(--accent); transform: translateY(-2px); }

/* ============================================================
   AUTH PAGE
   ============================================================ */
.auth-page {
  justify-content: center;
  gap: 28px;
}

.auth-hero { text-align: center; }

.auth-subtitle {
  margin-top: 10px;
  font-size: var(--fs-md);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.auth-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.auth-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(320px, 100%);
  padding: 14px 20px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s, background 0.2s;
}
.auth-btn:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.12); }
.auth-btn:disabled { opacity: 0.7; }

.auth-btn-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Inline brand marks (Pack AG — Apple/Google SVGs on the auth buttons) */
.auth-btn-icon svg { width: 20px; height: 20px; display: block; }

.auth-btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.soon-badge {
  margin-left: auto;
  padding: 2px 10px;
  font-size: var(--fs-xxs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg-darkest);
  background: var(--accent);
  border-radius: 999px;
}

.auth-email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(320px, 100%);
  margin: 0 auto;
}

.auth-tabs {
  display: flex;
  gap: 6px;
}

.auth-tab {
  flex: 1;
  padding: 8px 4px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: color 0.2s, border-color 0.2s;
}
.auth-tab--active {
  color: #fff;
  border-color: var(--accent);
  background: rgba(77, 182, 172, 0.12);
}

.auth-guest {
  margin: 8px auto 0;
  padding: 10px 18px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.auth-guest:hover { color: #fff; }

/* ============================================================
   SETTINGS — ACCOUNT ROW
   ============================================================ */
/* Pack Z polish: state line on top, button full-width below — so the Hesap
   button and the Rozetler button above it share the exact same width and
   height (both are plain .secondary-btn geometry: 100% × 12px/20px padding
   at --fs-md). */
.settings-account-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.settings-account-state {
  font-size: var(--fs-md);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-account-btn {
  width: 100%;
  padding: 12px 20px;      /* = .secondary-btn defaults = .profile-badges-btn */
  font-size: var(--fs-md);
}

/* ============================================================
   ASYNC MULTIPLAYER (turn-based) — banner, word timer, Oyunlarım
   ============================================================ */

/* Async status panel (Pack Q): sits in the D-pad footprint in the modes that
   hide the controls — opponent-turn status + remaining deadline (read-only),
   or the result-reopen chip (finished). The in-board banner is gone. */
#ag-wait {
  width: 450px;
  max-width: calc(100vw - 16px); /* Pack S: never wider than the screen */
  margin: 8px auto 8px;
  padding: 16px 14px;
  box-sizing: border-box;
  text-align: center;
  background: rgba(10,10,18,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
}
.ag-wait-main {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #FFD700;
}
.ag-wait-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
/* Pack W: the viewer's OWN level + minimum word length, under the deadline.
   Wraps freely — the TR sentence is ~57 chars and only just fits 316px of
   panel on a 360px screen. Separated by a hairline so it reads as a hint
   about the next turn rather than more status about this one. */
.ag-wait-hint {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
}
.ag-result-chip {
  font-size: 14px;
  font-weight: 800;
  color: #FFD700;
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.45);
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
}
.ag-result-chip:active { background: rgba(255,215,0,0.2); }

/* Shared ✕ close for the result overlay + avatar profile modal (Pack Q) */
.ag-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ag-modal-close:active { background: rgba(255,255,255,0.2); color: #fff; }
.ag-result-modal { position: relative; }
/* Two totals + separator on one line — a step below the solo hero numeral
   (Pack W). The dash is muted and lighter so the eye lands on the scores. */
.ag-result-modal .gameover-score { font-size: 28px; }
.ag-result-dash {
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 10px;
}
.ag-timeout-line { margin-top: 6px; color: #FFD700; }
/* End-reason line (Pack Y): bottom of the text block, small/muted, em-dash
   framed in the markup ("— Tahta Doldu —"). capitalize turns the i18n
   lowercase reason ("tahta doldu") into title case — safe here, no dotless-ı
   pitfalls in any of the reason strings. */
.ag-result-reason {
  margin-top: 10px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: capitalize;
  letter-spacing: 0.04em;
}

/* Avatar profile modal: the profile-card skin centered on the dark overlay */
.ag-profile-modal {
  position: relative;
  width: 100%;
  max-width: 300px;
  padding: 28px 24px 26px;
}
.ag-profile-modal .profile-card-body { margin-top: 0; }
/* The home DarkGreen win-rate color is unreadable on the dark overlay */
.ag-profile-modal .profile-winrate { color: #7bd88f; }

/* 10s word-window pill: circular countdown + Bitir chip (Pack U — replaces
   the bare number; the ring depletes over the window and the color walks
   calm → warning → urgent). Sits at board top-center, clear of the Next
   overlay in the top-right corner (async has no power-ring overlay). */
#turn-timer {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, rgba(22,30,58,0.94), rgba(10,14,30,0.94));
  border: 1px solid rgba(77,182,172,0.55);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 12px rgba(0,0,0,0.45);
  padding: 5px 12px 5px 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  transition: border-color 0.3s, color 0.3s;
}
.turn-ring {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.turn-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* deplete from 12 o'clock, clockwise */
}
.turn-ring circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}
.turn-ring-track { stroke: rgba(255,255,255,0.14); }
.turn-ring-prog {
  stroke: currentColor;
  /* JS writes stroke-dasharray/offset every 100ms; the matching transition
     smooths the steps into a continuous sweep for one style write per tick. */
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
}
#turn-timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}
/* Warning (≤5 s) and urgent (≤3 s): the ring, border and text shift, and the
   whole pill breathes once per second so it registers peripherally. */
#turn-timer.turn-timer--warn {
  color: #FFD700;
  border-color: rgba(255,215,0,0.6);
}
#turn-timer.turn-timer--urgent {
  color: #ff5252;
  border-color: rgba(255,82,82,0.7);
  animation: turn-timer-pulse 1s ease-in-out infinite;
}
@keyframes turn-timer-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.07); }
}
@media (prefers-reduced-motion: reduce) {
  #turn-timer.turn-timer--urgent { animation: none; }
  .turn-ring-prog { transition: none; }
}
/* Pack T: with multiple words per turn the early-finish affordance matters —
   the Bitir segment reads as a proper button chip inside the pill. */
.turn-timer-finish {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}
.turn-timer-finish:active { background: rgba(255,255,255,0.3); }
#turn-timer-saving { font-size: 13px; padding: 0 6px; color: #fff; }

/* Phase-driven control states (async: no controls when watching, dimmed
   during the word window — the piece is already locked) */
#controls.controls--hidden { display: none; }
#controls.controls--dimmed { opacity: 0.25; pointer-events: none; }

/* Menu badge: count of matches where it's your turn (sits on .tetro-btn,
   which carries its own position:relative) */
.menu-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #FFD700;
  color: #1a1a2e;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Saved-game mark on the home "Oyna" button (Pack AE). Sits in the same
   top-right corner as .menu-badge (its host .tetro-btn is position:relative)
   but is a plain glyph, not a count chip — it reports state, not a number.
   pointer-events:none so the whole button stays one tap target. */
/* Arcade completion star on Oyna (Pack AK) — mirrors the save mark in the
   opposite corner at the same size. Its COLOUR carries the number (white at
   0%, through gold, to green at 100%), written inline by menu.js; the dark
   outline keeps a white star readable on the button's light glass. */
.menu-star-mark {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 0 2px rgba(0,0,0,0.85), 0 1px 2px rgba(0,0,0,0.6);
}

.menu-save-mark {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 15px;
  line-height: 1;
  opacity: 0.92;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.55));
}

/* Oyunlarım list */
.mm-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
/* Offline banner above the list (Pack S): the cached rows below stay usable,
   this just flags that they show the last known state. */
.mm-offline-note {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,183,77,0.10);
  border: 1px solid rgba(255,183,77,0.30);
  color: #ffb74d;
  font-size: var(--fs-xs);
  text-align: center;
}
.mm-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #32325a, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s;
}
.mm-card:active { transform: scale(0.98); }
.mm-card--turn { border-color: #FFD700; box-shadow: 0 0 14px rgba(255,215,0,0.18); }
.mm-card-main { min-width: 0; flex: 1; } /* flex:1 keeps text left of the side
                                            group now the avatar leads the row */
/* Row primary text sits one step BELOW the body floor (Pack X): a match row is
   a compact list item, not prose — the name is identified by the avatar disc
   next to it, and the trimmed size buys back width for the badge/bubble/✕
   group at 360px. The prose floor (--fs-md) still governs real body text. */
.mm-opp {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mm-code {
  margin-left: 8px;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 2px;
  color: #FFD700;
  background: rgba(255,215,0,0.12);
  border-radius: 5px;
  padding: 1px 6px;
}
.mm-score {
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.mm-card-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Full-width Aktif|Biten tabs (Pack R — the Pack N TR|EN chips row is gone,
   the list follows the app language; the tabs take the freed row). */
.mm-tab-row .segmented { width: 100%; }

/* Opponent avatar disc on a match row (Pack R): denormalized preset id on the
   match doc, or a name-initial fallback (all pre-Pack-R docs). Fixed size so
   every card variant (active/finished/invite) aligns. */
.mm-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
}
/* The global initials color is dark (tuned for the teal preset disc) — on the
   dark fallback disc it needs the muted light tone instead. */
.mm-avatar .profile-avatar-initials { font-size: var(--fs-sm); color: var(--text-muted); }

/* Unread-chat bubble on a match card (Pack N): ALWAYS rendered so the card
   layout never jitters when it appears — invisible until the match has unread
   messages (live since Pack I via Match.hasUnread). */
.mm-bubble {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  visibility: hidden;
  color: #FFD700;
}
.mm-bubble svg { display: block; width: 100%; height: 100%; }
.mm-bubble--on { visibility: visible; }
.mm-badge-turn {
  background: #FFD700;
  color: #1a1a2e;
  font-size: var(--fs-xxs);
  font-weight: 800;
  letter-spacing: 0.8px;
  border-radius: 999px;
  padding: 5px 10px;
}
.mm-status { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.mm-status--hot { color: #FFD700; }
.mm-result {
  font-size: var(--fs-xxs);
  font-weight: 800;
  letter-spacing: 0.6px;
  border-radius: 999px;
  padding: 5px 10px;
}
/* Result chips (Pack AB colors): win = LimeGreen — bright, so the text goes
   DARK (#103b10 on #32CD32 ≈ 8:1, white would be ~1.9:1); lose = red, but
   material red 700 rather than pure #F00 so the white bold text clears AA
   (#fff on #D32F2F ≈ 6.1:1 vs ~4.0:1 on pure red); draw stays gray. */
.mm-result--win  { background: #32CD32; color: #103b10; }
.mm-result--lose { background: #D32F2F; color: #fff; }
.mm-result--draw { background: rgba(255,255,255,0.22); color: #fff; }

/* Swipe-to-delete on finished rows (Pack AB): the card slides left over a
   red Sil button pinned behind it. touch-action pan-y keeps vertical list
   scrolling with the browser while horizontal drags reach the JS handler
   (mymatchespage._wireSwipe). The card's gradient is opaque enough to fully
   cover the button at rest. */
.mm-swipe { position: relative; touch-action: pan-y; }
.mm-swipe .mm-card {
  position: relative;
  z-index: 1;
  transition: transform 0.18s ease-out;
}
.mm-del-btn {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 0;
  width: 76px;
  border-radius: var(--radius-lg);
  background: #D32F2F;
  color: #fff;
  font-weight: 800;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
}
.mm-del-btn:active { background: #b3261e; }
.mm-cancel {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.mm-cancel:active { background: rgba(255,68,68,0.25); color: #fff; }

/* ============================================================
   TRAINING (Antrenman) — lesson callouts, progress dots, tier legend
   ============================================================ */

/* Glass panel, top-center over the board (below the hint line). Absolute in
   #game-container so it scales with the board; only the panel is interactive. */
#training-callout {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  width: max-content;
  max-width: 80%;
  background: linear-gradient(180deg, rgba(22,30,58,0.94), rgba(10,14,30,0.94));
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 6px 24px rgba(0,0,0,0.45);
}
.tr-progress {
  font-size: 10.5px;
  font-weight: 700; /* Pack R: softened from 800 — the callout read too heavy */
  letter-spacing: 0.7px;
  color: rgba(255,215,0,0.85);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 6px;
}
.tr-progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
}
.tr-progress-dot.tr-dot-now  { background: #FFD700; }
.tr-progress-dot.tr-dot-done { background: #0DFF72; }
.tr-callout-text {
  /* Pack R: softened — a touch smaller, explicit normal weight and a gently
     muted tone; the callout is a tooltip, not a headline. */
  font-size: var(--fs-xs);
  font-weight: 400;
  line-height: 1.55;
  color: rgba(232,235,245,0.82);
}
.tr-callout-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: var(--dialog-actions-gap);
}
/* ============================================================
   LEGAL PAGES (terms / privacy)
   ============================================================ */

.legal-body {
  white-space: pre-line;       /* the docs are stored as plain text */
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  overflow-y: auto;
  padding-bottom: 24px;
}
.legal-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
}
.legal-link {
  background: none;
  border: none;
  padding: 4px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}
.legal-link:active { color: var(--text); }

/* ============================================================
   GLASS BUTTON SYSTEM
   .btn-glass (+ --primary/--danger/--ghost, --sm/--lg) is the canonical
   API; the legacy button classes are grouped in below so every existing
   button wears the same skin without markup churn. This block sits at the
   END of the file on purpose — it must win equal-specificity ties.
   ============================================================ */

/* Standalone defaults (layout) for elements that only carry .btn-glass */
.btn-glass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: var(--fs-md);
  font-weight: 700;
  border-radius: var(--radius-md);
}

/* Shared glass skin */
.btn-glass,
.primary-btn, .secondary-btn, .auth-btn, .gameover-btn, .langsetup-btn,
#controls .btn {
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(165deg,
    rgba(255,255,255,0.12), rgba(255,255,255,0.04) 55%, rgba(255,255,255,0.07));
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.16);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.1s, filter 0.15s, border-color 0.15s;
}

/* Variant: primary (accent-filled) */
.btn-glass--primary,
.primary-btn, .gameover-btn--primary {
  background: linear-gradient(165deg, rgba(94,200,191,0.92), rgba(63,167,156,0.72));
  border-color: rgba(94,200,191,0.75);
  color: #08302b;
  box-shadow: 0 4px 18px rgba(77,182,172,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}

/* Variant: danger */
.btn-glass--danger,
.gameover-btn--danger {
  background: linear-gradient(165deg, rgba(233,69,96,0.85), rgba(160,38,58,0.65));
  border-color: rgba(233,69,96,0.65);
  color: #fff;
}

/* Variant: ghost (back buttons, tertiary actions) */
.btn-glass--ghost,
.wc-back-btn {
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-muted);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Sizes */
.btn-glass--sm { padding: 8px 14px;  font-size: var(--fs-sm); border-radius: 10px; }
.btn-glass--lg { padding: 16px 24px; font-size: var(--fs-lg); border-radius: var(--radius-lg); }

/* Premium title banner — glass panel behind the "WordThis" title on the
   auth + menu heroes. Same visual language as .btn-glass (not a button). */
.title-banner {
  display: inline-block;
  padding: 14px 34px 15px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--banner-border);
  /* Pack AO: the same two-layer tinted glass as the home banner, so the
     brand panel looks identical on the auth and language-setup heroes.
     Those sit on the DARK app background rather than the beach sky, so
     the sheen is a touch stronger to keep the panel off the backdrop. */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.04) 46%,
                    rgba(255,255,255,0) 62%, rgba(0,0,0,0.12)),
    linear-gradient(var(--banner-angle),
      var(--banner-g1), var(--banner-g2) 38%, var(--banner-g3) 70%, var(--banner-g4));
  box-shadow: 0 10px 32px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.26);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
/* Subtle glow around the animated gradient text (drop-shadow, not text-shadow —
   it follows the clipped gradient glyphs) */
.title-banner .menu-title {
  filter: drop-shadow(0 0 14px rgba(13,194,255,0.28));
}
.title-banner + .auth-subtitle { margin-top: 14px; }

/* D-pad — physical game controls (UI Redesign): raised indigo metal keys with
   a lit top edge, shaded base and a real press-down state. Overrides the
   generic glass skin above (same block, later = wins the tie). */
#controls .btn {
  background: linear-gradient(180deg, #3a4374 0%, #2a3158 45%, #1e2340 100%);
  border: 1px solid rgba(140,160,255,0.28);
  border-radius: 16px;
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.22),
              inset 0 -3px 6px rgba(0,0,0,0.35),
              0 5px 14px rgba(0,0,0,0.5);
  color: #dfe6ff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
/* Rotate/drop identities kept, same physical treatment */
#controls .btn-rotate {
  background: linear-gradient(180deg, #6b4fa8 0%, #533a86 45%, #3a2763 100%);
  border-color: rgba(180,140,255,0.4);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.26),
              inset 0 -3px 6px rgba(0,0,0,0.35),
              0 5px 14px rgba(0,0,0,0.5),
              0 0 18px rgba(140,95,220,0.22);
}
#controls .btn-drop {
  background: linear-gradient(180deg, #a84f57 0%, #86333c 45%, #5e2129 100%);
  border-color: rgba(255,140,150,0.38);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.24),
              inset 0 -3px 6px rgba(0,0,0,0.35),
              0 5px 14px rgba(0,0,0,0.5);
}
/* Pack AH: first arcade hand — Aşağı is the pace-setter (manual drop), so it
   breathes a warm glow until pressed once (gamepage _arcDropCue). */
#controls .btn-drop--cue { animation: btn-drop-cue 1.4s ease-in-out infinite; }
@keyframes btn-drop-cue {
  0%, 100% { box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.24), inset 0 -3px 6px rgba(0,0,0,0.35), 0 5px 14px rgba(0,0,0,0.5), 0 0 0 0 rgba(255,179,71,0.0); filter: brightness(1); }
  50%      { box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.24), inset 0 -3px 6px rgba(0,0,0,0.35), 0 5px 14px rgba(0,0,0,0.5), 0 0 0 5px rgba(255,179,71,0.45); filter: brightness(1.25); }
}
@media (prefers-reduced-motion: reduce) {
  #controls .btn-drop--cue { animation: none; filter: brightness(1.2); }
}
/* Press: the key physically sinks — travel + flattened shadow, not a fade */
#controls .btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.99);
  filter: brightness(1.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14),
              inset 0 3px 8px rgba(0,0,0,0.4),
              0 2px 6px rgba(0,0,0,0.45);
}

/* Pressed */
.btn-glass:active:not(:disabled),
.primary-btn:active:not(:disabled),
.secondary-btn:active:not(:disabled),
.auth-btn:active:not(:disabled),
.gameover-btn:active:not(:disabled),
.langsetup-btn:active:not(:disabled),
.wc-back-btn:active:not(:disabled) {
  transform: scale(0.97);
  filter: brightness(1.18);
}
/* (#controls .btn has its own physical press state in the D-pad block above) */

/* Disabled */
.btn-glass:disabled,
.primary-btn:disabled, .secondary-btn:disabled, .auth-btn:disabled,
.gameover-btn:disabled, .langsetup-btn:disabled, #controls .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Solid-ish fallback where backdrop-filter isn't supported */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  /* #controls .btn is NOT here — its D-pad skin above is already opaque */
  .btn-glass, .secondary-btn, .auth-btn, .gameover-btn, .langsetup-btn {
    background: linear-gradient(165deg, #34345c, #262646);
  }
  .title-banner { background: linear-gradient(165deg, #2c2c52, #232343); }
}

/* Native WebView: drop the blur (compositing cost next to the game canvas —
   frame-drop guard on the D-pad). The translucent gradients carry the look. */
html.is-native .btn-glass,
html.is-native .primary-btn, html.is-native .secondary-btn,
html.is-native .auth-btn, html.is-native .gameover-btn,
html.is-native .langsetup-btn, html.is-native #controls .btn,
html.is-native .title-banner {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ============================================================
   SCORE FLIGHT (+N flying from the board to the header total)
   ============================================================ */
.score-fly {
  position: fixed;
  z-index: 6000;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 900;
  color: var(--green);
  text-shadow: 0 2px 6px rgba(0,0,0,0.65), 0 0 14px rgba(61,220,132,0.5);
  pointer-events: none;
  will-change: transform, opacity;
}
.score-fly--gold {
  color: #FFD700;
  font-size: 30px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.65), 0 0 18px rgba(255,200,60,0.6),
               0 0 40px rgba(255,160,20,0.35);
}

/* ============================================================
   SEGMENTED CONTROL  [ TR | EN ]
   Two options; the ::before thumb slides under the active half.
   ============================================================ */
.segmented {
  position: relative;
  display: flex;
  width: min(220px, 100%);
  margin: 0 auto;
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}
.segmented::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background: linear-gradient(165deg, rgba(94,200,191,0.92), rgba(63,167,156,0.72));
  box-shadow: 0 2px 10px rgba(77,182,172,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
.segmented--second::before { transform: translateX(100%); }
/* Pack AF: N-option variant (arcade tabs) — full width, thumb slot = the
   inner width / N, positioned by --seg-i (settings.js initSegmented). */
.segmented--n4 { width: 100%; }
.segmented--n4::before {
  width: calc(25% - 2px);
  transform: translateX(calc(var(--seg-i, 0) * 100%));
}
.segmented--n4 .segmented-opt { padding: 9px 0; font-size: var(--fs-sm); letter-spacing: 0.02em; }

.segmented-opt {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 9px 0;
  border-radius: var(--radius-pill);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: color 0.2s;
}
.segmented-opt--active { color: #08302b; }

/* ============================================================
   ORIENTATION GUARD (landscape phones — web/tablet; native is
   portrait-locked in the manifest). Shown purely via the media
   query; main.js mirrors the same query onto
   body.is-landscape-blocked so the game loops pause gravity.
   ============================================================ */
#orientation-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(10,10,24,0.94);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.orientation-card {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}
.orientation-icon {
  font-size: 44px;
  margin-bottom: 12px;
  display: inline-block;
  transform: rotate(90deg);
}
/* Pack AE-fit: `pointer: coarse` limits the rotate prompt to touch devices —
   a short desktop browser window is not a phone held sideways; it gets the
   scaled-down portrait layout instead (main.js Viewport). */
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  #orientation-overlay { display: flex; }
}

/* Settings: version line pinned centered at the very bottom of the page
   (Pack O — same CONFIG.VERSION source as the home footer's .menu-version;
   .page is already a flex column, so margin-top:auto pins it). */
.settings-version {
  margin-top: auto;
  padding-top: 26px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Oyunlarım card focus flash (duplicate Rastgele points at the live search) */
.mm-card--flash { animation: mm-card-flash 1.2s ease-out; }
@keyframes mm-card-flash {
  0%, 45% { border-color: var(--accent); box-shadow: 0 0 14px rgba(77,182,172,0.55); }
  100%    { border-color: inherit; box-shadow: none; }
}

/* Auth page: native-only "Uygulamadan Çık" — visually separated from the
   sign-in options by a divider. Sits AFTER the glass block on purpose: the
   danger tint must win the equal-specificity tie with .btn-glass--ghost. */
.auth-exit-row {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-dim);
  text-align: center;
}
.auth-exit-btn {
  color: var(--red);
  border-color: rgba(233,69,96,0.35);
}

/* ==========================================================================
   Pack I — Social & Chat (match chat sheet, unread dot, friends/blocked
   rows, challenge cards). Novel selectors only — nothing here re-skins the
   shared button classes, so sitting after the legacy-button block is safe.
   ========================================================================== */

/* Chat entry button in the async match header (beside the lang badge). */
.gt-chat-btn {
  position: relative;
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-dim);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  color: #cfd3ee;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.gt-chat-btn svg { width: 16px; height: 16px; display: block; }
.gt-chat-btn:active { opacity: 0.7; }
.gt-chat-dot {
  position: absolute;
  top: -3px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffd700;
  border: 2px solid #1a1a2e;
  display: none;
}
.gt-chat-dot--on { display: block; }

/* Bottom-sheet chat panel (over the async match screen). */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(10, 10, 22, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.chat-overlay--visible { opacity: 1; }
.chat-sheet {
  width: 100%;
  max-width: 560px;
  height: min(68dvh, 560px);
  display: flex;
  flex-direction: column;
  background: #232345;
  border: 1px solid var(--border-dim);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateY(14px);
  transition: transform 0.18s ease;
}
.chat-overlay--visible .chat-sheet { transform: translateY(0); }

.chat-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-dim);
}
.chat-head-name {
  font-weight: 700;
  font-size: var(--fs-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-head-actions { display: flex; gap: 6px; flex-shrink: 0; }
.chat-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: var(--fs-lg);
  line-height: 1;
  cursor: pointer;
}
.chat-icon-btn:active { opacity: 0.7; }

/* Kebab dropdown */
.chat-menu {
  position: absolute;
  top: 46px;
  right: 12px;
  z-index: 2;
  min-width: 190px;
  background: #2b2b52;
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-menu-item {
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: var(--fs-md);
  cursor: pointer;
}
.chat-menu-item:disabled { color: var(--text-muted); cursor: default; }
.chat-menu-item:not(:disabled):active { background: rgba(255, 255, 255, 0.08); }
.chat-menu-item--danger { color: var(--red); }

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-empty {
  margin: auto;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
  padding: 0 20px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 82%; }
.chat-msg--own { align-self: flex-end; align-items: flex-end; }
.chat-msg--opp { align-self: flex-start; align-items: flex-start; }
.chat-msg-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  font-size: var(--fs-md);
  line-height: 1.35;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg--own .chat-msg-bubble {
  background: rgba(77, 182, 172, 0.28);
  border: 1px solid rgba(77, 182, 172, 0.35);
  border-bottom-right-radius: 4px;
}
.chat-msg--opp .chat-msg-bubble {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-dim);
  border-bottom-left-radius: 4px;
}
.chat-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  padding: 0 4px;
}
.chat-msg-blocked { font-style: italic; color: var(--text-muted); }

.chat-notice {
  padding: 8px 14px;
  font-size: var(--fs-xs);
  color: var(--amber, #f0a05c);
  text-align: center;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px 4px;
  border-top: 1px solid var(--border-dim);
}
.chat-input-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: var(--fs-md);
}
.chat-input-row input:disabled { opacity: 0.5; }
.chat-send-btn {
  width: 44px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #10102a;
  font-size: var(--fs-xl);
  cursor: pointer;
}
.chat-send-btn:disabled { opacity: 0.4; cursor: default; }
.chat-send-btn:not(:disabled):active { opacity: 0.8; }

/* Report dialog bits (inside the shared gameover-modal shell). */
.report-quote {
  margin-top: 8px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-style: italic;
  word-break: break-word;
}
.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.report-reason {
  padding: 10px 12px;
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.report-reason--active {
  border-color: var(--accent);
  background: rgba(77, 182, 172, 0.18);
}
.report-block-btn { width: 100%; margin-top: 8px; }

/* Friends / blocked rows on the profile page. */
.social-box { display: flex; flex-direction: column; gap: 8px; }
.social-sub-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 2px 0;
}
.social-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.social-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}
.social-avatar--initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
  font-size: var(--fs-lg);
}
.social-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-md);
  font-weight: 600;
}
.social-btn {
  flex-shrink: 0;
  padding: 7px 10px;
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  min-height: 34px;
}
.social-btn:active { opacity: 0.75; }
.social-btn--primary {
  border-color: rgba(77, 182, 172, 0.4);
  background: rgba(77, 182, 172, 0.2);
}
.social-btn--ghost { color: var(--text-muted); }

/* Challenge (invite) cards on Oyunlarım. */
.mm-card--invite { cursor: default; }
.mm-invite-actions { display: flex; gap: 8px; margin-top: 8px; }
.mm-invite-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  min-height: 36px;
}
.mm-invite-btn:active { opacity: 0.75; }
.mm-invite-btn--accept {
  border-color: rgba(61, 220, 132, 0.45);
  background: rgba(61, 220, 132, 0.18);
  color: var(--green);
}

/* ---------- Badges page (Pack Z) ---------- */
/* The page scrolls (allowed here — 8 sections). Medallions are one visual
   family: circular glass discs, category emoji + tier value; earned = vivid
   gold, unearned = greyed same emblem (filter, not different art). */
.badges-page { padding-bottom: 28px; }
.bdg-count {
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 2px 0 6px;
}
.bdg-section {
  margin-top: 16px;
  padding: 12px 14px 14px;
  border: 1px solid var(--border-dim);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}
.bdg-section-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.bdg-sub-label {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  margin: 8px 0 4px;
}
.bdg-row {
  display: flex;
  flex-wrap: wrap;      /* 10-tier rows wrap instead of shrinking below 44px */
  gap: 8px;
}
.bdg-medal {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(165deg,
    rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04) 60%);
  color: var(--text);
}
.bdg-medal .bdg-medal-icon {
  font-size: 17px;
  line-height: 1;
  filter: grayscale(1) brightness(0.75);
  opacity: 0.55;
}
.bdg-medal .bdg-medal-t {
  font-size: var(--fs-xxs);
  line-height: 1;
  color: var(--text-muted);
  font-weight: 700;
}
.bdg-medal--on {
  border-color: rgba(255, 215, 0, 0.65);
  background: radial-gradient(circle at 50% 32%,
    rgba(255, 226, 130, 0.38), rgba(180, 120, 20, 0.22) 70%);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.bdg-medal--on .bdg-medal-icon { filter: none; opacity: 1; }
.bdg-medal--on .bdg-medal-t { color: #ffe08a; }
.bdg-medal--tipped { outline: 2px solid rgba(255, 255, 255, 0.45); }
.bdg-medal:active { transform: scale(0.94); }
.bdg-tip {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  background: rgba(20, 20, 40, 0.92);
  font-size: var(--fs-sm);
}
.bdg-tip-name { font-weight: 800; }
.bdg-tip-req { color: var(--text-muted); margin-top: 3px; font-size: var(--fs-xs); }
.bdg-tip-progress { margin-top: 4px; font-size: var(--fs-xs); }
.bdg-tip-progress--done { color: var(--green); font-weight: 800; }
.bdg-note {
  margin-top: 18px;
  text-align: center;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

/* Own-profile badge summary (Pack Z, Phase 4): one full-width button whose
   label IS the earned count ("3/50") — tapping anywhere on it opens the
   Rozetler page. */
.profile-badges-btn {
  width: 100%;
  font-size: var(--fs-md);
  font-weight: 700;
}

/* Badge count line in the async profile modal (Pack Z, Phase 4) — sits under
   the win-rate line; same quiet weight. */
.ag-profile-badges {
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ============================================================
   ARCADE — "Oyna" page + hand result (Pack AF)
   ============================================================ */
.arcade-page { display: flex; flex-direction: column; }
.arc-tabs { flex-shrink: 0; margin-bottom: 12px; }
.arc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.arc-stage-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 8px;
  font-size: var(--fs-sm); color: var(--text-muted);
}
.arc-stage-stars { color: #FFD700; font-weight: 700; }
.arc-stage-locked {
  margin: 0 0 10px; padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.4;
}
/* The tile grid is the ONLY scroll region of the page (Pack AE-fit shell:
   the page itself never scrolls at 390×850 — 4 rows of tiles fit; taller
   grids scroll in here). */
.arc-grid-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 2px 8px; }
.arc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.arc-tile {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(165deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04) 55%, rgba(255,255,255,0.07));
  box-shadow: 0 4px 14px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.16);
  color: var(--text);
  min-width: 0;
}
.arc-tile:active:not(:disabled) { transform: scale(0.96); filter: brightness(1.15); }
.arc-tile--locked { opacity: 0.45; cursor: default; }
.arc-tile--done { border-color: rgba(255,215,0,0.45); }
.arc-tile-no { font-size: var(--fs-xl); font-weight: 800; line-height: 1; }
.arc-tile-obj { font-size: 13px; line-height: 1; min-height: 14px; }
.arc-tile-stars { display: flex; gap: 1px; line-height: 1; }
.arc-star { font-size: 11px; color: rgba(255,255,255,0.22); }
.arc-star--on { color: #FFD700; text-shadow: 0 0 6px rgba(255,215,0,0.55); }
.arc-free-card {
  margin-top: 6px; padding: 18px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(165deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03) 55%, rgba(255,255,255,0.06));
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.arc-free-title { font-size: var(--fs-xl); font-weight: 800; }
.arc-free-desc { font-size: var(--fs-md); color: var(--text-muted); line-height: 1.45; }
.arc-free-btn { margin-top: 4px; }

/* In-game: the arcade shell hides the power dial (no power economy) and the
   bomb widget; the level badge shows the pieces left instead (gamepage). */
.game-page--arcade #power-ring-panel { display: none !important; }
.game-page--arcade #bomb-widget { display: none !important; }

/* Next-piece well on the hand's LAST piece (Pack AJ): nothing is coming, so
   the frame dims and says so by looking switched off — the renderer draws
   no tile, this keeps the empty box from reading as a glitch. */
#next-panel.next-panel--empty { opacity: 0.45; }
#next-panel.next-panel--empty #next-canvas { filter: grayscale(1); }

/* First-run arcade intro cards (Pack AJ) — the levelup/dirhint glass family. */
.arcintro-card { max-width: min(340px, 88vw); padding: 20px 22px 18px; }
.arcintro-title { font-size: 22px; }
.arcintro-info { font-size: var(--fs-md); margin-top: 10px; text-align: left; }
.arcintro-svg { width: 190px; height: auto; margin: 12px auto 2px; display: block; }
.arcintro-dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.arcintro-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.arcintro-dot--on { background: #FFD700; }
.arcintro-ok { margin-top: var(--dialog-actions-gap); width: 100%; }
/* Card 1 — board, hanging piece, fired path, the four keys. */
.ai-board { fill: rgba(9,14,32,0.9); stroke: rgba(122,152,255,0.3); stroke-width: 1.5; }
.ai-tile  { fill: #3877FF; stroke: rgba(255,255,255,0.35); stroke-width: 1; }
.ai-ghost { fill: rgba(56,119,255,0.16); stroke: rgba(122,152,255,0.5); stroke-width: 1.5; stroke-dasharray: 4 3; }
.ai-dash  { stroke: rgba(255,215,0,0.7); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 3 5; }
.ai-key   { fill: rgba(40,56,110,0.9); stroke: rgba(122,152,255,0.35); stroke-width: 1; }
.ai-key--hot { fill: #b8860b; stroke: #FFD700; animation: arcintro-key 1.5s ease-in-out infinite; }
.ai-glyph { fill: none; stroke: #dfe6ff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ai-glyph--hot { stroke: #fff; }
.ai-glyph-fill { fill: #dfe6ff; stroke: none; }
@keyframes arcintro-key {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.45); }
}
/* Card 2 — letter patch, traced word, bomb cross. */
.ai-cell { fill: rgba(40,56,110,0.92); stroke: rgba(122,152,255,0.35); stroke-width: 1; }
.ai-cell--on { fill: #b8860b; stroke: #FFD700; }
.ai-letter {
  fill: #dfe6ff; font-size: 19px; font-weight: 800; font-family: inherit;
  text-anchor: middle; dominant-baseline: central;
}
.ai-letter--on { fill: #fff; }
.ai-trace { fill: none; stroke: #FFD700; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; }
.ai-dot   { fill: #fff; opacity: 0.9; }
.ai-bomb  { fill: #0b0b12; stroke: rgba(255,179,71,0.9); stroke-width: 2; }
.ai-fuse  { fill: none; stroke: #ffb347; stroke-width: 2.5; stroke-linecap: round; }
.ai-arm   { stroke: #ff7043; stroke-width: 4; stroke-linecap: round; opacity: 0.75; }
@media (prefers-reduced-motion: reduce) {
  .ai-key--hot { animation: none; filter: brightness(1.3); }
}

/* Hand result overlay */
.arc-result-hand { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 4px; }
.arc-result-stars { display: flex; justify-content: center; gap: 8px; margin: 10px 0 4px; }
.arc-star--big {
  font-size: 34px;
  transform: scale(0.4);
  opacity: 0.35;
  transition: transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.3s;
  transition-delay: calc(var(--i, 1) * 0.22s);
}
.gameover-overlay--visible .arc-star--big { transform: scale(1); }
.gameover-overlay--visible .arc-star--big.arc-star--on { opacity: 1; }
.arc-result-goal { margin-top: 8px; font-size: var(--fs-sm); color: var(--text-muted); }
.arc-result-goal--met { color: #3ddc84; }
@media (prefers-reduced-motion: reduce) {
  .arc-star--big { transition: none; transform: scale(1); }
}

/* ============================================================
   ZİNCİR MODU (exp/chain-reaction)
   ============================================================ */
/* Oyna page: five tabs (Aşama 1·2·3 · Serbest · Zincir). Two-line labels are
   allowed — at 360px each slot is ~65px and "Serbest Mod" would not fit. */
.segmented--n5 { width: 100%; }
.segmented--n5::before {
  width: calc(20% - 2px);
  transform: translateX(calc(var(--seg-i, 0) * 100%));
}
.segmented--n5 .segmented-opt {
  padding: 6px 2px; font-size: var(--fs-xs); letter-spacing: 0.01em;
  line-height: 1.15; white-space: normal;
}

/* The cards strip sits between the board and the D-pad, so the board column
   gives up its height: the 212px chrome budget grows by the strip (58px). */
.game-page--chain {
  --shell-w: max(180px, min(var(--vw), calc((var(--vh) - 192px * var(--ui-scale)) * 0.5457)));
}
@media (min-width: 500px) {
  .game-page--chain {
    --shell-w: max(180px, min(var(--vw), calc(520px * var(--ui-scale)),
                   calc((var(--vh) - 192px * var(--ui-scale)) * 0.5457)));
  }
}
.game-page--chain #power-ring-panel,
.game-page--chain #bomb-widget,
.game-page--chain #hint-panel { display: none !important; }

.chain-cards {
  flex-shrink: 0;
  display: flex;
  gap: calc(6px * var(--ui-scale));
  width: calc(var(--shell-w) - 16px * var(--ui-scale));
  max-width: 100%;
  height: calc(50px * var(--ui-scale));
  margin: calc(8px * var(--ui-scale)) auto 0;
}
.chain-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); color: var(--text-muted);
  border: 1px dashed rgba(122,152,255,0.25); border-radius: calc(12px * var(--ui-scale));
}
.chain-card {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  padding: calc(3px * var(--ui-scale)) calc(4px * var(--ui-scale));
  border-radius: calc(12px * var(--ui-scale));
  border: 1px solid rgba(122,152,255,0.30);
  background: linear-gradient(180deg, rgba(30,42,86,0.95), rgba(14,20,44,0.95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 3px 10px rgba(0,0,0,0.35);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.chain-card:active { transform: scale(0.97); }
.chain-card:disabled { opacity: 0.45; cursor: default; }
.chain-card-kind {
  font-size: calc(9.5px * var(--ui-scale)); font-weight: 800; letter-spacing: 0.08em;
  color: var(--chain-kind, #9fb4ff);
}
.chain-card-word {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-display, inherit);
  font-size: calc(16px * var(--ui-scale)); font-weight: 800; letter-spacing: 0.04em; line-height: 1.1;
}
.chain-card-meta { font-size: calc(10px * var(--ui-scale)); color: rgba(255,255,255,0.65); }
.chain-card--safe  { --chain-kind: #7dd3fc; }
.chain-card--combo { --chain-kind: #ffc93c; border-color: rgba(255,201,60,0.45); }
.chain-card--space { --chain-kind: #6ee7b7; }
.chain-card--word  { --chain-kind: #c4b5fd; }
.chain-card--sel {
  border-color: #5ef0ff;
  box-shadow: 0 0 0 2px rgba(94,240,255,0.55), 0 0 18px rgba(94,240,255,0.35),
              inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-2px);
}
.chain-best-line { margin-top: 6px; color: #ffc93c; }

/* ============================================================
   GÖRÜNÜM PAKETİ (exp/chain-reaction) — toward the WordThis mockup
   (Unity tasarım önerisi, img5): a painted dusk landscape behind the board,
   a neon-lit board frame, ring sockets + glowing beads (renderer.js), glossy
   neon keys. All static CSS / prebaked sprites — zero per-frame cost.
   ============================================================ */
.game-page {
  background:
    /* board halo — the light sits where the board is */
    radial-gradient(calc(var(--shell-w) * 1.25) 52% at 50% 42%,
                    rgba(80,120,255,0.20), rgba(10,14,32,0) 72%),
    /* edge vignette */
    radial-gradient(130% 95% at 50% 40%, rgba(0,0,0,0) 58%, rgba(0,0,0,0.55) 100%),
    /* far crystal peaks + shoreline (silhouettes, both sides) */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' preserveAspectRatio='none'%3E%3Cpath fill='%23221a4d' d='M0 92 L22 60 L38 78 L58 40 L74 70 L92 55 L112 96 L140 104 L180 110 L220 110 L262 104 L290 96 L306 62 L322 76 L340 34 L358 66 L376 50 L400 84 L400 200 L0 200Z'/%3E%3Cpath fill='%23140f33' d='M0 120 L18 96 L30 108 L46 82 L60 112 L84 122 L316 122 L336 104 L350 88 L364 110 L382 92 L400 116 L400 200 L0 200Z'/%3E%3Cpath fill='%235a3fbf' fill-opacity='0.55' d='M46 82 L52 96 L44 104Z M350 88 L356 100 L346 106Z M58 40 L64 58 L54 62Z M340 34 L347 52 L336 56Z'/%3E%3Crect y='122' width='400' height='78' fill='%230b0a26'/%3E%3C/svg%3E")
      center bottom / 100% 46% no-repeat,
    /* sunset glow on the horizon, warm on both sides like the mockup */
    radial-gradient(42% 16% at 12% 66%, rgba(255,160,90,0.55), rgba(255,120,80,0) 70%),
    radial-gradient(42% 16% at 88% 64%, rgba(255,130,100,0.45), rgba(255,120,80,0) 70%),
    /* night sky → violet dusk → horizon */
    linear-gradient(180deg, #070b26 0%, #121a55 30%, #2a2477 50%, #5a3584 63%,
                    #2a1c58 72%, #0b0a26 82%, #06061a 100%);
}

/* Neon board frame */
#game-container {
  border: 1.5px solid rgba(110,180,255,0.80);
  background: rgba(10,16,40,0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10),
              0 0 0 1px rgba(80,140,255,0.25),
              0 0 16px rgba(70,150,255,0.55),
              0 0 42px rgba(70,120,255,0.28),
              0 14px 34px rgba(0,0,0,0.55);
}

/* NEXT well + hint pill: lit edges in the same blue */
#next-panel {
  border-color: rgba(110,180,255,0.55) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 12px rgba(70,150,255,0.30),
              0 4px 12px rgba(0,0,0,0.4) !important;
}
#hint-panel {
  border: 1px solid rgba(110,180,255,0.55);
  border-radius: 999px;
  padding-left: 14px; padding-right: 14px;
  color: #dfe8ff;
  text-shadow: 0 0 8px rgba(120,170,255,0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 12px rgba(70,150,255,0.30);
}

/* Header: gradient wordmark + a gem on the score chip */
.gt-title {
  font-family: var(--font-display, inherit);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  white-space: nowrap;
  background: linear-gradient(180deg, #ffffff 0%, #bfe6ff 45%, #4fa8ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 8px rgba(80,160,255,0.55));
}
.gt-topbar .gt-score-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border-color: rgba(110,180,255,0.75);
  box-shadow: inset 0 2px 2px rgba(255,255,255,0.28), inset 0 -3px 6px rgba(0,0,0,0.5),
              0 0 12px rgba(70,150,255,0.35), 0 3px 8px rgba(0,0,0,0.5);
}
.gt-topbar .gt-score-chip::before {
  content: '';
  width: calc(14px * var(--ui-scale)); height: calc(14px * var(--ui-scale));
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2367e8ff' d='M6 3h12l4 6-10 12L2 9z'/%3E%3Cpath fill='%23ffffff' fill-opacity='0.65' d='M6 3h6l-4 6H2z'/%3E%3Cpath fill='%230b6fb8' fill-opacity='0.55' d='M12 21l4-12h6z'/%3E%3C/svg%3E")
              center / contain no-repeat;
  filter: drop-shadow(0 0 4px rgba(103,232,255,0.7));
}

/* D-pad: glossy blue keys with a neon edge; rotate = vivid purple */
#controls .btn,
#controls .btn-drop {
  background: linear-gradient(180deg, #3460c4 0%, #1f3c8e 50%, #142862 100%);
  border: 1.5px solid rgba(120,185,255,0.75);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.30),
              inset 0 -3px 6px rgba(0,0,0,0.35),
              0 0 12px rgba(70,150,255,0.35),
              0 5px 14px rgba(0,0,0,0.5);
  color: #eaf2ff;
}
#controls .btn-rotate {
  background: linear-gradient(180deg, #a76bff 0%, #7d3ff0 50%, #5523b8 100%);
  border: 1.5px solid rgba(215,180,255,0.85);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.34),
              inset 0 -3px 6px rgba(0,0,0,0.30),
              0 0 22px rgba(160,90,255,0.55),
              0 5px 14px rgba(0,0,0,0.5);
}

/* ---- Zincir modu: word tray (above the board) ---- */
.chain-tray {
  flex-shrink: 0;
  display: flex; align-items: center; gap: calc(8px * var(--ui-scale));
  width: calc(var(--shell-w) - 8px); max-width: 100%;
  height: calc(34px * var(--ui-scale));
  margin: calc(6px * var(--ui-scale)) auto 0;
  padding: 0 calc(10px * var(--ui-scale));
  border-radius: 999px;
  border: 1px solid rgba(110,180,255,0.45);
  background: linear-gradient(180deg, rgba(24,34,72,0.92), rgba(10,14,34,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 10px rgba(70,150,255,0.22);
}
.chain-tray-last { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px;
  overflow: hidden; white-space: nowrap; }
.chain-tray-word { font-family: var(--font-display, inherit); font-weight: 800;
  font-size: calc(14px * var(--ui-scale)); letter-spacing: 0.05em; color: #fff;
  overflow: hidden; text-overflow: ellipsis; }
.chain-tray-pts { font-size: calc(11px * var(--ui-scale)); color: #ffc93c; font-weight: 700; }
.chain-tray-hint { font-size: calc(11px * var(--ui-scale)); color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; }
.chain-tray-slots { display: flex; gap: calc(3px * var(--ui-scale)); flex-shrink: 0; }
.chain-slot {
  width: calc(20px * var(--ui-scale)); height: calc(20px * var(--ui-scale));
  border-radius: 50%;
  border: 1px dashed rgba(140,170,255,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(10px * var(--ui-scale)); font-weight: 800; color: #fff;
}
.chain-slot--on {
  border: none;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.75), var(--slot) 45%, rgba(0,0,0,0.55) 120%);
  box-shadow: 0 0 6px var(--slot);
  text-shadow: 0 1px 1px rgba(0,0,0,0.6);
}
.chain-tray-count { flex-shrink: 0; min-width: calc(28px * var(--ui-scale)); text-align: right;
  font-size: calc(11px * var(--ui-scale)); font-weight: 800; color: #9fb4ff; }
/* letters flying board → tray (fixed on <body>) */
.chain-fly {
  position: fixed; z-index: 60; pointer-events: none;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 15px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.85), var(--slot) 45%, rgba(0,0,0,0.5) 120%);
  box-shadow: 0 0 14px var(--slot), 0 0 4px #fff;
}

/* ---- Zincir modu: KOMBO banner (over the board) ---- */
.chain-banner {
  position: absolute; left: 50%; top: 38%; z-index: 30; pointer-events: none;
  transform: translate(-50%, -50%);
  text-align: center; white-space: nowrap;
  animation: chain-banner-pop 1.4s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
  --cb: #5ef0ff;
}
.chain-banner--m3 { --cb: #ffc93c; }
.chain-banner--m4, .chain-banner--m5 { --cb: #ff5ac8; }
.chain-banner-mult {
  font-family: var(--font-display, inherit); font-weight: 800;
  font-size: calc(40px * var(--ui-scale)); letter-spacing: 0.04em; line-height: 1;
  color: #fff;
  -webkit-text-stroke: 1px rgba(0,0,0,0.25);
  text-shadow: 0 0 10px var(--cb), 0 0 26px var(--cb), 0 0 48px var(--cb), 0 3px 0 rgba(0,0,0,0.45);
}
.chain-banner--m3 .chain-banner-mult { font-size: calc(46px * var(--ui-scale)); }
.chain-banner--m4 .chain-banner-mult, .chain-banner--m5 .chain-banner-mult { font-size: calc(52px * var(--ui-scale)); }
.chain-banner-word {
  margin-top: 4px; font-family: var(--font-display, inherit); font-weight: 800;
  font-size: calc(18px * var(--ui-scale)); letter-spacing: 0.08em; color: #fff;
  text-shadow: 0 0 10px var(--cb), 0 2px 0 rgba(0,0,0,0.5);
}
.chain-banner-word span { color: #ffc93c; }
@keyframes chain-banner-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-6deg); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(2deg); }
  30%  { transform: translate(-50%, -50%) scale(0.95) rotate(0deg); }
  40%  { transform: translate(-50%, -50%) scale(1.05); }
  78%  { opacity: 1; transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -75%) scale(0.9); }
}

/* ---- Zincir modu: end-of-chain summary (the breath out) ---- */
.chain-summary {
  position: absolute; inset: 0; z-index: 31; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(60% 45% at 50% 45%, rgba(255,200,80,0.18), rgba(0,0,0,0) 70%);
  animation: chain-summary-fade 1.7s ease forwards;
}
.chain-summary-card {
  text-align: center; padding: 14px 26px 16px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(40,28,90,0.92), rgba(16,12,40,0.92));
  border: 1.5px solid rgba(255,201,60,0.8);
  box-shadow: 0 0 24px rgba(255,201,60,0.45), 0 0 60px rgba(255,120,200,0.25), 0 12px 30px rgba(0,0,0,0.5);
  animation: chain-summary-in 0.55s cubic-bezier(0.2, 1.4, 0.3, 1);
}
.chain-summary-title {
  font-family: var(--font-display, inherit); font-weight: 800; letter-spacing: 0.08em;
  font-size: calc(30px * var(--ui-scale)); color: #ffc93c;
  text-shadow: 0 0 14px rgba(255,201,60,0.8);
}
.chain-summary-line { font-size: calc(13px * var(--ui-scale)); color: #e6ecff; margin-top: 2px; }
.chain-summary-pts {
  font-family: var(--font-display, inherit); font-weight: 800;
  font-size: calc(34px * var(--ui-scale)); color: #fff; margin-top: 4px;
  text-shadow: 0 0 16px rgba(94,240,255,0.8);
}
@keyframes chain-summary-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes chain-summary-fade { 0%, 82% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .chain-banner, .chain-summary, .chain-summary-card { animation: none; }
}

/* the uppercase wordmark is wider — the back label must never wrap */
#btn-back-game { white-space: nowrap; }
/* Zincir modu narrows the column (tray + cards take height), so the D-pad
   narrows with it — the drop key's padding was crushing its chevron to 3px.
   The glyph never shrinks; the key keeps a touch-safe minimum width. */
#controls .btn svg { flex-shrink: 0; }
.game-page--chain #controls .btn-drop {
  padding-left: 0; padding-right: 0;
  min-width: calc(56px * var(--ui-scale));
}

/* ---- Zincir modu: no falling piece → no D-pad. The cards are the controls
   now, so they take the D-pad's place at the bottom (taller, safe-area aware)
   and the board gets the height back (chrome budget 312 → 186px). ---- */
.game-page--chain #controls { display: none !important; }
.game-page--chain .chain-cards {
  height: calc(56px * var(--ui-scale));
  margin-bottom: max(calc(16px * var(--ui-scale)), calc(env(safe-area-inset-bottom) + 10px));
}
.chain-card--feed { --chain-kind: #9fb4ff; border-style: dashed; }

/* found-words strip: chips, newest first */
.chain-tray-words {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: calc(5px * var(--ui-scale));
  overflow: hidden; white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
          mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.chain-chip {
  flex-shrink: 0; display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px calc(8px * var(--ui-scale)); border-radius: 999px;
  font-family: var(--font-display, inherit); font-weight: 800;
  font-size: calc(12px * var(--ui-scale)); letter-spacing: 0.04em; color: #dfe8ff;
  background: rgba(110,150,255,0.14); border: 1px solid rgba(110,180,255,0.30);
}
.chain-chip b { font-size: calc(10px * var(--ui-scale)); color: #ffc93c; font-weight: 700; }
.chain-chip--new {
  color: #fff; background: rgba(94,240,255,0.18); border-color: rgba(94,240,255,0.7);
  box-shadow: 0 0 10px rgba(94,240,255,0.35);
  animation: chain-chip-in 0.45s cubic-bezier(0.2, 1.4, 0.3, 1);
}
@keyframes chain-chip-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chain-chip--new { animation: none; } }

/* ---- Zincir modu: the waiting block lives UNDER the board, so the corner
   NEXT preview is gone. The strip is 2 cell-rows tall (6×9 board: 2/9 of its
   height = a third of its width), which is why the column factor above went
   0.6667 → 0.5457: board 1.5w + strip ≈0.333w = 1.833w of height. ---- */
.game-page--chain #next-panel { display: none !important; }
.chain-stage-wrap {
  flex-shrink: 0;
  width: calc(var(--shell-w) - 8px); max-width: 100%;
  margin: calc(4px * var(--ui-scale)) auto 0;
  padding: 0 1px;
  border-radius: calc(12px * var(--ui-scale));
  border: 1px dashed rgba(110,180,255,0.35);
  background: rgba(10,16,40,0.55);
}
.chain-stage { display: block; width: 100%; cursor: grab; touch-action: none; }
.chain-stage:active { cursor: grabbing; }
/* the strip must sit flush under the board: the flexible main area would
   otherwise absorb the spare height BETWEEN them — push it above the cards */
.game-page--chain .gt-main { flex: 0 0 auto; }
.game-page--chain .chain-cards { margin-top: auto; }

/* ---- Zincir modu level themes: the page backdrop follows the level
   (data-chain-lv, set by _chainApplyTheme) — same layers as the base
   backdrop above, recoloured: 2 forest, 3 night, 4 embers. ---- */
.game-page--chain[data-chain-lv="2"] {
  background:
    /* board halo — the light sits where the board is */
    radial-gradient(calc(var(--shell-w) * 1.25) 52% at 50% 42%,
                    rgba(70,200,150,0.20), rgba(10,14,32,0) 72%),
    /* edge vignette */
    radial-gradient(130% 95% at 50% 40%, rgba(0,0,0,0) 58%, rgba(0,0,0,0.55) 100%),
    /* far crystal peaks + shoreline (silhouettes, both sides) */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' preserveAspectRatio='none'%3E%3Cpath fill='%23163a33' d='M0 92 L22 60 L38 78 L58 40 L74 70 L92 55 L112 96 L140 104 L180 110 L220 110 L262 104 L290 96 L306 62 L322 76 L340 34 L358 66 L376 50 L400 84 L400 200 L0 200Z'/%3E%3Cpath fill='%230d241f' d='M0 120 L18 96 L30 108 L46 82 L60 112 L84 122 L316 122 L336 104 L350 88 L364 110 L382 92 L400 116 L400 200 L0 200Z'/%3E%3Cpath fill='%233fbf8a' fill-opacity='0.55' d='M46 82 L52 96 L44 104Z M350 88 L356 100 L346 106Z M58 40 L64 58 L54 62Z M340 34 L347 52 L336 56Z'/%3E%3Crect y='122' width='400' height='78' fill='%23061512'/%3E%3C/svg%3E")
      center bottom / 100% 46% no-repeat,
    /* sunset glow on the horizon, warm on both sides like the mockup */
    radial-gradient(42% 16% at 12% 66%, rgba(180,240,190,0.35), rgba(255,120,80,0) 70%),
    radial-gradient(42% 16% at 88% 64%, rgba(120,220,200,0.30), rgba(255,120,80,0) 70%),
    /* night sky → violet dusk → horizon */
    linear-gradient(180deg, #05161a 0%, #0f3a3f 30%, #1d5a52 50%, #3f7a5e 63%,
                    #183a33 72%, #08201b 82%, #04100d 100%);
}
.game-page--chain[data-chain-lv="3"] {
  background:
    /* board halo — the light sits where the board is */
    radial-gradient(calc(var(--shell-w) * 1.25) 52% at 50% 42%,
                    rgba(150,90,255,0.24), rgba(10,14,32,0) 72%),
    /* edge vignette */
    radial-gradient(130% 95% at 50% 40%, rgba(0,0,0,0) 58%, rgba(0,0,0,0.55) 100%),
    /* far crystal peaks + shoreline (silhouettes, both sides) */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' preserveAspectRatio='none'%3E%3Cpath fill='%23180f3a' d='M0 92 L22 60 L38 78 L58 40 L74 70 L92 55 L112 96 L140 104 L180 110 L220 110 L262 104 L290 96 L306 62 L322 76 L340 34 L358 66 L376 50 L400 84 L400 200 L0 200Z'/%3E%3Cpath fill='%230d0824' d='M0 120 L18 96 L30 108 L46 82 L60 112 L84 122 L316 122 L336 104 L350 88 L364 110 L382 92 L400 116 L400 200 L0 200Z'/%3E%3Cpath fill='%239a6bff' fill-opacity='0.55' d='M46 82 L52 96 L44 104Z M350 88 L356 100 L346 106Z M58 40 L64 58 L54 62Z M340 34 L347 52 L336 56Z'/%3E%3Crect y='122' width='400' height='78' fill='%2305031a'/%3E%3C/svg%3E")
      center bottom / 100% 46% no-repeat,
    /* sunset glow on the horizon, warm on both sides like the mockup */
    radial-gradient(42% 16% at 12% 66%, rgba(160,110,255,0.40), rgba(255,120,80,0) 70%),
    radial-gradient(42% 16% at 88% 64%, rgba(90,140,255,0.35), rgba(255,120,80,0) 70%),
    /* night sky → violet dusk → horizon */
    linear-gradient(180deg, #03030f 0%, #0b0a26 30%, #1a1250 50%, #2b1a66 63%,
                    #120c33 72%, #06041a 82%, #020109 100%);
}
.game-page--chain[data-chain-lv="4"] {
  background:
    /* board halo — the light sits where the board is */
    radial-gradient(calc(var(--shell-w) * 1.25) 52% at 50% 42%,
                    rgba(255,120,70,0.22), rgba(10,14,32,0) 72%),
    /* edge vignette */
    radial-gradient(130% 95% at 50% 40%, rgba(0,0,0,0) 58%, rgba(0,0,0,0.55) 100%),
    /* far crystal peaks + shoreline (silhouettes, both sides) */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' preserveAspectRatio='none'%3E%3Cpath fill='%233a1418' d='M0 92 L22 60 L38 78 L58 40 L74 70 L92 55 L112 96 L140 104 L180 110 L220 110 L262 104 L290 96 L306 62 L322 76 L340 34 L358 66 L376 50 L400 84 L400 200 L0 200Z'/%3E%3Cpath fill='%23200a0c' d='M0 120 L18 96 L30 108 L46 82 L60 112 L84 122 L316 122 L336 104 L350 88 L364 110 L382 92 L400 116 L400 200 L0 200Z'/%3E%3Cpath fill='%23ff7a3d' fill-opacity='0.55' d='M46 82 L52 96 L44 104Z M350 88 L356 100 L346 106Z M58 40 L64 58 L54 62Z M340 34 L347 52 L336 56Z'/%3E%3Crect y='122' width='400' height='78' fill='%23120406'/%3E%3C/svg%3E")
      center bottom / 100% 46% no-repeat,
    /* sunset glow on the horizon, warm on both sides like the mockup */
    radial-gradient(42% 16% at 12% 66%, rgba(255,140,60,0.65), rgba(255,120,80,0) 70%),
    radial-gradient(42% 16% at 88% 64%, rgba(255,90,50,0.55), rgba(255,120,80,0) 70%),
    /* night sky → violet dusk → horizon */
    linear-gradient(180deg, #120408 0%, #2a0a14 30%, #4a1420 50%, #8a2a22 63%,
                    #3a0e12 72%, #160406 82%, #0a0204 100%);
}
.game-page--chain { transition: background 0.6s ease; }

/* ---- word strip: chips are buttons (tap → meaning) + the meaning flash ---- */
.chain-chip { cursor: pointer; font-family: var(--font-display, inherit); }
.chain-tray--meaning { border-color: rgba(255,201,60,0.6); box-shadow: 0 0 12px rgba(255,201,60,0.25); }
.chain-tray-meaning {
  flex: 1; min-width: 0; text-align: left; cursor: pointer;
  background: none; border: 0; padding: 0; color: #e6ecff;
  font-size: calc(11.5px * var(--ui-scale));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: chain-chip-in 0.35s ease;
}
.chain-tray-meaning b { font-family: var(--font-display, inherit); color: #ffc93c; letter-spacing: 0.04em; }
.chain-tray-meaning i { color: #9fb4ff; font-style: normal; font-size: 0.9em; }

/* ---- meaning card ---- */
.chain-meaning-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(4,6,18,0.55);
  opacity: 0; transition: opacity 0.18s ease;
}
.chain-meaning-overlay--visible { opacity: 1; }
.chain-meaning-card {
  width: min(340px, 100%); max-height: 70vh; overflow-y: auto;
  padding: 18px 18px 14px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(30,40,86,0.97), rgba(12,16,40,0.97));
  border: 1.5px solid rgba(110,180,255,0.7);
  box-shadow: 0 0 24px rgba(70,150,255,0.35), 0 16px 40px rgba(0,0,0,0.55);
  color: #e6ecff;
}
.chain-meaning-word {
  font-family: var(--font-display, inherit); font-weight: 800; letter-spacing: 0.06em;
  font-size: var(--fs-xl); color: #fff; margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(94,240,255,0.5);
}
.chain-meaning-sense { font-size: var(--fs-md); line-height: 1.45; margin-bottom: 8px; }
.chain-meaning-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-right: 6px; border-radius: 50%;
  background: rgba(94,240,255,0.18); color: #5ef0ff; font-size: var(--fs-xxs); font-weight: 800;
}
.chain-meaning-pos { color: #9fb4ff; font-style: italic; margin-right: 6px; font-size: var(--fs-sm); }
.chain-meaning-loading, .chain-meaning-none { font-size: var(--fs-md); color: var(--text-muted); }
.chain-meaning-src { margin-top: 6px; font-size: var(--fs-xxs); color: var(--text-muted); }
.chain-meaning-close { margin-top: 10px; text-align: center; font-size: var(--fs-xs); color: var(--text-muted); }

/* ============================================================
   ANA EKRAN — KOYU TEMA (dark-home pass)
   The home used to sit on a bright midday beach with light glass cards; it
   read washed-out next to the neon game screen. All three seasons are now
   dusk/night scenes and every surface on top of them is DARK glass with a
   lit edge — the same language as the game page. Text that was tuned dark
   for the bright sky (username teal, win-rate blue) is light again.
   Season = calendar (menu.js _currentSeason): autumn Sep–Nov, winter
   Dec–Feb, summer otherwise; `wortris_season` overrides.
   ============================================================ */
.menu-sky[data-season="summer"] {
  /* dusk over the sea: night indigo → violet → rose/orange horizon → deep sea */
  /* horizon at ~77%: the scenery lives BELOW the buttons, where the screen
     is otherwise empty — at 63% the sunset sat hidden behind the cards */
  background: linear-gradient(180deg,
    #0a0f2e 0%, #17204f 20%, #2e2a6a 38%, #5a3484 54%, #a04a78 66%,
    #e8794e 73%, #f2a35e 76%, #24427a 78%, #142c58 89%, #0b1a3c 100%);
}
.menu-sky[data-season="winter"] {
  /* moonlit night over snow */
  background: linear-gradient(180deg,
    #060b22 0%, #0f1b44 30%, #1c2c5c 50%, #2e4274 64%, #4a6090 74%,
    #3e5280 86%, #2c3c62 100%);
}
.menu-sky[data-season="autumn"] {
  /* smoky plum sky → ember horizon → dark hills */
  background: linear-gradient(180deg,
    #120a1c 0%, #2a1230 24%, #4a1c3a 44%, #8a3040 62%, #c8643a 71%,
    #e08a44 75%, #3a1a1c 79%, #24100f 90%, #140809 100%);
}

/* summer motifs at dusk: the sun sits on the horizon, clouds are lit from
   below, the far ridges and the boat are silhouettes; the beach toys go
   (no sand band any more) */
.menu-sky[data-season="summer"] .menu-sky-sun {
  top: auto; bottom: 19%; right: 16%; width: 96px; height: 96px;
  filter: drop-shadow(0 0 30px rgba(255,140,70,0.85));
}
.menu-sky[data-season="summer"] .menu-sky-cloud { filter: brightness(0.5) sepia(0.4) hue-rotate(-25deg) blur(1px); opacity: 0.18; }
.menu-sky[data-season="summer"] .menu-sky-mountains { bottom: 22%; filter: blur(2px) brightness(0.28) saturate(0.6); opacity: 0.95; }
.menu-sky[data-season="summer"] .menu-sky-boat { top: 81%; filter: brightness(0.35) drop-shadow(0 0 6px rgba(255,150,90,0.35)); }
.menu-sky[data-season="summer"] .menu-sky-bird path { stroke: #1a1630; }
.menu-sand-ball, .menu-sand-bucket, .menu-sand-shovel { display: none; }

.menu-stars {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px;
  border-radius: 50%; background: transparent;
}

/* winter: moon, moonlit hills, a dimmer snowman */
.menu-moon {
  position: absolute; bottom: 20%; left: 12%; width: 60px; height: 60px;
  filter: drop-shadow(0 0 22px rgba(200,220,255,0.55));
}
.menu-hills {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34%;
}
.menu-hills--snow { height: 24%; }
.menu-sky[data-season="winter"] .menu-snowman {
  left: auto; right: 10%; margin-left: 0; width: 76px; height: 104px;
  filter: brightness(0.78) drop-shadow(0 0 14px rgba(170,200,255,0.30));
}

/* autumn: ember sun on the ridge, tree silhouettes, falling leaves */
.menu-autumn-sun {
  position: absolute; bottom: 19%; left: 32%; width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #ffd28a, #f08a3a 55%, #c8452e);
  box-shadow: 0 0 40px rgba(240,120,60,0.7);
}
.menu-tree { position: absolute; bottom: 4%; width: 120px; height: 168px; }
.menu-tree--l { left: -18px; }
.menu-tree--r { right: -26px; transform: scaleX(-1); width: 104px; height: 146px; }
.menu-leaf {
  position: absolute; top: -6%; opacity: 0.9;
  will-change: transform;
  animation-name: leaf-fall; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes leaf-fall {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  25%  { transform: translate3d(18px, 28vh, 0) rotate(90deg); }
  50%  { transform: translate3d(-10px, 56vh, 0) rotate(200deg); }
  75%  { transform: translate3d(16px, 84vh, 0) rotate(290deg); }
  100% { transform: translate3d(0, 112vh, 0) rotate(380deg); }
}
@media (prefers-reduced-motion: reduce) {
  .menu-leaf { display: none; }
}

/* ---- surfaces: dark glass + lit edge ---- */
.icon-glass-btn {
  border: 1px solid rgba(140,175,255,0.40);
  background: linear-gradient(165deg, rgba(34,40,86,0.70), rgba(18,22,52,0.62) 55%, rgba(28,34,74,0.68));
  box-shadow: 0 5px 18px rgba(0,0,0,0.45), 0 0 10px rgba(90,140,255,0.18),
              inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 2px rgba(0,0,0,0.35);
}
html.is-native .icon-glass-btn {
  background: linear-gradient(165deg, rgba(34,40,86,0.92), rgba(18,22,52,0.90) 55%, rgba(28,34,74,0.92));
}
.profile-card--home {
  border: 1px solid rgba(140,175,255,0.34);
  background: linear-gradient(165deg, rgba(30,36,80,0.66), rgba(14,18,44,0.58) 55%, rgba(24,30,68,0.64));
  box-shadow: 0 14px 36px rgba(0,0,0,0.5), 0 0 22px rgba(80,130,255,0.16),
              inset 0 1px 0 rgba(255,255,255,0.16), inset 0 -2px 4px rgba(0,0,0,0.3);
}
html.is-native .profile-card--home {
  background: linear-gradient(165deg, rgba(30,36,80,0.90), rgba(14,18,44,0.88) 55%, rgba(24,30,68,0.90));
}
.profile-card--home .profile-name,
.profile-card--home .profile-provider { color: #eef2ff; }
.profile-card--home .profile-winrate { color: #8fd3ff; }
.tetro-btn {
  border: 1px solid rgba(140,175,255,0.32);
  background: linear-gradient(165deg, rgba(32,38,84,0.66), rgba(16,20,48,0.60) 55%, rgba(28,34,76,0.66));
  box-shadow: 0 12px 28px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3), 0 0 14px rgba(80,130,255,0.14),
              inset 0 1px 0 rgba(255,255,255,0.20), inset 0 -2px 4px rgba(0,0,0,0.35);
}
.tetro-btn::before { background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0)); }
.tetro-btn:hover {
  border-color: rgba(94,240,255,0.7);
  box-shadow: 0 14px 30px rgba(0,0,0,0.5), 0 0 18px rgba(94,240,255,0.30),
              inset 0 1px 0 rgba(255,255,255,0.22), inset 0 -2px 4px rgba(0,0,0,0.35);
}
html.is-native .tetro-btn {
  background: linear-gradient(165deg, rgba(32,38,84,0.90), rgba(16,20,48,0.88) 55%, rgba(28,34,76,0.90));
}
.menu-sky[data-season="autumn"] .menu-hills { height: 25%; }

/* ===== "Diğer Oyunlarımız" (web only, moregamespage.js) ===== */
.menu-moregames {
  margin: 6px auto 2px;
  padding: calc(6px * var(--ui-scale)) calc(14px * var(--ui-scale));
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  background: rgba(14,16,40,0.55);
  color: #eef2ff;
  font: inherit;
  font-size: calc(12.5px * var(--ui-scale));
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.menu-moregames:active { opacity: 0.7; }
.moregames-page { gap: 10px; }
.og-section-title {
  margin: 10px 2px 0;
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.6);
}
.og-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}
.og-card--self { border-color: rgba(255,201,60,0.45); }
.og-icon {
  width: calc(64px * var(--ui-scale));
  height: calc(64px * var(--ui-scale));
  border-radius: 22%;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.og-body { min-width: 0; flex: 1; }
.og-name { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 800; color: #fff; }
.og-desc { margin-top: 2px; font-size: var(--fs-md); color: rgba(255,255,255,0.75); line-height: 1.35; }
.og-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.og-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: #1c1f3a;
  border: 1px solid rgba(255,255,255,0.25);
}
.og-link--web { background: #2b7bd6; border-color: #2b7bd6; }
.og-link .store-ico { width: calc(17px * var(--ui-scale)); height: calc(17px * var(--ui-scale)); margin-right: 7px; flex: none; }
.og-link:active { opacity: 0.75; }
.og-soon { font-size: var(--fs-sm); font-weight: 700; color: #ffc93c; }
.og-studio { display: flex; flex-direction: column; align-items: center; margin: 4px 0 6px; }
.og-studio-logo {
  width: calc(96px * var(--ui-scale));
  height: calc(96px * var(--ui-scale));
  border-radius: 22%;
  box-shadow: 0 6px 22px rgba(40,120,255,0.35), 0 2px 8px rgba(0,0,0,0.5);
}
.og-studio-name {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: calc(26px * var(--ui-scale));
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.01em;
}
.og-studio-sub { font-size: var(--fs-md); color: rgba(255,255,255,0.6); }
