/* ==========================================================================
   TVX v1.8.2 - glow design system + pixel icons
   Loaded after tvx.css and layered on it: the slab bevel, pixel type and
   selection markers stay; this file adds ONE set of tokens for illuminated
   edges and applies them by tier (primary / secondary / utility / panel),
   plus the icon sprite styles (components/tvx/icons.html).
   No animation loops: every effect is a box-shadow / border / filter that
   changes on hover, focus, press or selection, with short transitions that
   are dropped under Reduce Motion.
   ========================================================================== */
:root {
  --tvx-g-gold: #f5b942;
  --tvx-g-cyan: #22d3ee;
  --tvx-g-teal: #2dd4bf;
  --tvx-g-green: #6cc24a;
  --tvx-g-white: #f8fafc;
  /* slab bevel (same stack as tvx.css) so glows can be appended to it */
  --tvx-bevel: inset 0 3px 0 var(--ui-slab-hi), inset 0 -4px 0 var(--ui-slab-lo),
    inset 3px 0 0 rgba(255, 255, 255, 0.05), inset -3px 0 0 rgba(0, 0, 0, 0.22);
  --tvx-bevel-hover: inset 0 3px 0 #6c7683, inset 0 -4px 0 var(--ui-slab-lo),
    inset 3px 0 0 rgba(255, 255, 255, 0.06), inset -3px 0 0 rgba(0, 0, 0, 0.22);
  --tvx-bevel-gold: inset 0 3px 0 var(--ui-amber-hi), inset 0 -4px 0 var(--ui-amber-lo),
    inset 3px 0 0 rgba(255, 255, 255, 0.12), inset -3px 0 0 rgba(0, 0, 0, 0.18);
  /* glow tiers: an edge line + a soft halo, never a neon blur */
  --tvx-glow-sub: 0 0 0 1px rgba(34, 211, 238, 0.34), 0 0 12px rgba(34, 211, 238, 0.12);
  --tvx-glow-mid: 0 0 0 1px rgba(34, 211, 238, 0.6), 0 0 18px rgba(34, 211, 238, 0.26);
  --tvx-glow-hi: 0 0 0 2px rgba(34, 211, 238, 0.85), 0 0 24px rgba(34, 211, 238, 0.4);
  --tvx-glow-gold: 0 0 0 2px rgba(245, 185, 66, 0.78), 0 0 26px rgba(245, 185, 66, 0.5), 0 0 70px rgba(245, 185, 66, 0.22);
  --tvx-glow-gold-hi: 0 0 0 2px rgba(255, 214, 120, 0.95), 0 0 32px rgba(245, 185, 66, 0.65), 0 0 90px rgba(245, 185, 66, 0.28);
  --tvx-drop: 0 3px 0 rgba(0, 0, 0, 0.5);
  --tvx-drop-hover: 0 5px 0 rgba(0, 0, 0, 0.5);
  --tvx-ui-t: 140ms;
}

/* ---- Pixel icons ---------------------------------------------------------- */
.tvx-ico {
  width: 1.3em;
  height: 1.3em;
  flex: none;
  display: inline-block;
  fill: currentColor;
  shape-rendering: crispEdges;
  vertical-align: -0.24em;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.55));
  pointer-events: none;
}
.tvx-ico-gold { color: var(--tvx-g-gold); }
.tvx-ico-cyan { color: var(--tvx-g-cyan); }
/* menu labels: icon + label centred as one unit (the button is a flex row) */
.tvx-screen-menu .tvx-menu-btn .tvx-ico { width: 20px; height: 20px; margin-right: 4px; color: var(--tvx-g-cyan); }
.tvx-screen-menu .tvx-menu-btn .tvx-ico-gold { color: var(--tvx-g-gold); }
.tvx-screen-menu .tvx-menu-primary .tvx-ico { width: 24px; height: 24px; color: currentColor; filter: drop-shadow(1px 1px 0 rgba(255, 228, 160, 0.45)); }
.tvx-screen-menu .tvx-menu-btn:hover .tvx-ico:not(.tvx-ico-gold),
.tvx-screen-menu .tvx-menu-btn:focus-visible .tvx-ico:not(.tvx-ico-gold) { color: var(--tvx-g-white); }
.tvx-screen-menu .tvx-menu-primary:hover .tvx-ico,
.tvx-screen-menu .tvx-menu-primary:focus-visible .tvx-ico { color: currentColor; }
.tvx-screen .tvx-btn .tvx-ico { width: 16px; height: 16px; }

/* ---- Main menu: secondary slabs (medium cyan edge) -------------------------- */
.tvx-screen-menu .tvx-menu-btn {
  border-color: #0f1418;
  box-shadow: var(--tvx-bevel), var(--tvx-drop), var(--tvx-glow-sub);
  transition: transform var(--tvx-ui-t) var(--tvx-ease, ease), background-color var(--tvx-ui-t) linear,
    box-shadow var(--tvx-ui-t) linear, color var(--tvx-ui-t) linear, border-color var(--tvx-ui-t) linear;
}
.tvx-screen-menu .tvx-menu-btn:hover,
.tvx-screen-menu .tvx-menu-btn:focus-visible {
  border-color: #155e6b;
  box-shadow: var(--tvx-bevel-hover), var(--tvx-drop-hover), var(--tvx-glow-mid);
}
.tvx-screen-menu .tvx-menu-btn:focus-visible { outline: 2px solid var(--tvx-g-cyan); outline-offset: 3px; box-shadow: var(--tvx-bevel-hover), var(--tvx-drop-hover), var(--tvx-glow-hi); }
.tvx-screen-menu .tvx-menu-btn:active,
.tvx-screen-menu .tvx-menu-btn.is-pressing {
  box-shadow: inset 0 4px 0 var(--ui-slab-lo), inset 0 -2px 0 rgba(255, 255, 255, 0.08), 0 1px 0 rgba(0, 0, 0, 0.5), var(--tvx-glow-hi);
}

/* ---- PLAY: the strongest light on the screen (gold edge + ambient halo) ---- */
.tvx-screen-menu .tvx-menu-primary {
  border-color: #6b4708;
  box-shadow: var(--tvx-bevel-gold), var(--tvx-drop), var(--tvx-glow-gold);
}
.tvx-screen-menu .tvx-menu-primary:hover,
.tvx-screen-menu .tvx-menu-primary:focus-visible {
  border-color: #8a5d0c;
  box-shadow: inset 0 3px 0 #ffe09a, inset 0 -4px 0 var(--ui-amber-lo), inset 3px 0 0 rgba(255, 255, 255, 0.14),
    inset -3px 0 0 rgba(0, 0, 0, 0.18), var(--tvx-drop-hover), var(--tvx-glow-gold-hi);
}
.tvx-screen-menu .tvx-menu-primary:focus-visible { outline-color: var(--tvx-g-gold); }
.tvx-screen-menu .tvx-menu-primary:active,
.tvx-screen-menu .tvx-menu-primary.is-pressing {
  box-shadow: inset 0 4px 0 var(--ui-amber-lo), inset 0 -2px 0 rgba(255, 255, 255, 0.15), 0 1px 0 rgba(0, 0, 0, 0.5), var(--tvx-glow-gold);
}

/* ---- Utility squares: subtle; a pressed toggle gets the stronger accent ---- */
.tvx-screen-menu .tvx-menu-square { box-shadow: var(--tvx-bevel), var(--tvx-drop), 0 0 0 1px rgba(34, 211, 238, 0.12); }
.tvx-screen-menu .tvx-menu-square .tvx-menu-icon { color: var(--tvx-g-white); filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.55)); }
.tvx-screen-menu .tvx-menu-square:hover .tvx-menu-icon,
.tvx-screen-menu .tvx-menu-square:focus-visible .tvx-menu-icon { color: var(--tvx-g-cyan); }
.tvx-screen-menu .tvx-menu-square[aria-pressed="true"] { border-color: #6b2c22; box-shadow: var(--tvx-bevel), var(--tvx-drop), 0 0 0 1px rgba(255, 140, 120, 0.45), 0 0 12px rgba(255, 140, 120, 0.18); }

/* ---- Social links: brand icon + label, clean cyan edge --------------------- */
.tvx-social .tvx-social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: #0f1418;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35), 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 12px rgba(34, 211, 238, 0.12);
  transition: box-shadow var(--tvx-ui-t) linear, color var(--tvx-ui-t) linear, transform var(--tvx-ui-t) var(--tvx-ease, ease);
}
.tvx-social .tvx-social-link .tvx-ico { width: 18px; height: 18px; color: var(--tvx-g-cyan); }
.tvx-social .tvx-social-link:hover,
.tvx-social .tvx-social-link:focus-visible {
  color: var(--tvx-g-white);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.7), 0 4px 0 rgba(0, 0, 0, 0.5), 0 0 18px rgba(34, 211, 238, 0.3);
}
.tvx-social .tvx-social-link:focus-visible { outline: 2px solid var(--tvx-g-cyan); outline-offset: 3px; }

/* ---- Character dock: a pedestal slab tied to the character ----------------- */
html[data-tvx-avatar] .tvx-char-dock {
  --tvx-dock-size: 46px;
  gap: 8px;
  padding: 6px;
  /* tvx.css places the box as if it were one button tall; the pedestal adds
     6px padding + 2px border on each side, so the top edge would ride 16px up
     into the feet - keep it 14px clear of the soles instead. */
  bottom: max(12px, calc(var(--tvx-avatar-sole, var(--tvx-avatar-foot, 12px)) - 14px - var(--tvx-dock-size) - 16px));
  background: linear-gradient(180deg, rgba(14, 20, 28, 0.72), rgba(9, 12, 17, 0.82));
  border: 2px solid #0b0f13;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.05),
    0 4px 0 rgba(0, 0, 0, 0.45), 0 0 18px rgba(34, 211, 238, 0.1);
}
.tvx-char-dock .tvx-dock-btn {
  background: rgba(24, 30, 38, 0.92);
  border-color: #0b0f13;
  box-shadow: inset 0 0 0 2px var(--ui-frame), inset 0 3px 0 rgba(255, 255, 255, 0.06), 0 3px 0 rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(34, 211, 238, 0.2);
}
.tvx-char-dock .tvx-dock-icon { width: 22px; height: 22px; color: var(--tvx-g-white); filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.6)); }
.tvx-char-dock .tvx-dock-btn:hover,
.tvx-char-dock .tvx-dock-btn:focus-visible {
  background: rgba(30, 40, 50, 0.95);
  box-shadow: inset 0 0 0 2px rgba(34, 211, 238, 0.55), inset 0 3px 0 rgba(255, 255, 255, 0.08), 0 4px 0 rgba(0, 0, 0, 0.45),
    0 0 16px rgba(34, 211, 238, 0.35);
}
.tvx-char-dock .tvx-dock-btn:hover .tvx-dock-icon,
.tvx-char-dock .tvx-dock-btn:focus-visible .tvx-dock-icon { color: var(--tvx-g-cyan); }
.tvx-char-dock .tvx-dock-btn:focus-visible { outline: 2px solid var(--tvx-g-cyan); outline-offset: 3px; }

/* ---- Character grounding ----------------------------------------------------
   A soft contact shadow under the soles plus a faint cool/warm pool, sized from
   the published rig box (--tvx-avatar-sole minus --tvx-avatar-foot is 7% of the
   box height; the figure is ~0.32 of it wide). Its top edge sits just below the
   soles so the feet themselves are not darkened. */
.tvx-char-ground { display: none; }
html[data-tvx-avatar] .tvx-char-ground {
  --tvx-g-w: calc((var(--tvx-avatar-sole, 40px) - var(--tvx-avatar-foot, 12px)) * 5.6);
  display: block;
  position: fixed;
  left: var(--tvx-avatar-cx);
  bottom: calc(var(--tvx-avatar-sole, 40px) - var(--tvx-g-w) * 0.08);
  width: var(--tvx-g-w);
  height: calc(var(--tvx-g-w) * 0.15);
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.38) 50%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
  z-index: 5;                    /* above the world canvas, under the dock (6) */
}
html[data-tvx-avatar] .tvx-char-ground::after {
  content: "";
  position: absolute;
  inset: -60% -35%;
  background: radial-gradient(closest-side, rgba(34, 211, 238, 0.09), rgba(34, 211, 238, 0) 70%);
}
/* only on the menu screen, where the character stands in the open */
html[data-tvx-avatar] body:not(:has(.tvx-screen-menu.is-active)) .tvx-char-ground { display: none; }

/* ---- Panels and cards: restrained illuminated edges ------------------------ */
.tvx-screen .tvx-explorer,
.tvx-screen .tvx-realm-list,
.tvx-ds-panel {
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.12), 0 0 22px rgba(34, 211, 238, 0.05);
}
.tvx-screen .tvx-realm-btn[aria-selected="true"] {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--realm-accent, var(--tvx-g-cyan)) 70%, transparent),
    0 0 16px color-mix(in srgb, var(--realm-accent, var(--tvx-g-cyan)) 30%, transparent);
}
.tvx-screen .tvx-realm-btn:focus-visible { outline: 2px solid var(--tvx-g-cyan); outline-offset: 2px; }
/* worlds header actions: icon + label */
.tvx-screen-head-actions .tvx-btn { display: inline-flex; align-items: center; gap: 8px; }
.tvx-screen-head-actions .tvx-btn .tvx-ico { color: var(--tvx-g-cyan); }
.tvx-screen-head-actions .tvx-btn:hover .tvx-ico,
.tvx-screen-head-actions .tvx-btn:focus-visible .tvx-ico { color: var(--tvx-g-white); }
/* search field: magnifier inside the input */
.tvx-explorer-search { position: relative; }
.tvx-explorer-search .tvx-ico-search { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--ui-text-dim, #9aa3ad); }
.tvx-explorer .tvx-explorer-search input { padding-left: 34px; }
.tvx-explorer-search:focus-within .tvx-ico-search { color: var(--tvx-g-cyan); }

/* ---- Motion preferences ---------------------------------------------------- */
body.tvx-reduced-motion .tvx-screen-menu .tvx-menu-btn,
body.tvx-reduced-motion .tvx-social .tvx-social-link,
body.tvx-reduced-motion .tvx-char-dock .tvx-dock-btn { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .tvx-screen-menu .tvx-menu-btn, .tvx-social .tvx-social-link, .tvx-char-dock .tvx-dock-btn { transition: none; }
}

/* ---- Phones: social row in the page flow ----------------------------------
   Pinned to the bottom edge (tvx.css, <=720px) it sat on top of the corner
   text whenever that text grew a line (signed in: player + team) - already
   so before v1.8.2; the icons made it wider. In flow above the title it can
   never collide; labels stay. */
@media (max-width: 720px) {
  .tvx-screen-menu .tvx-social { position: static; justify-content: center; margin: 4px 0 10px; }
}

/* ---- v1.8.3 label containment ----------------------------------------------
   V2.2 put a 20 px icon in every menu button; in the 2-up pair rows the
   longest label (LEADERBOARD, ~9.4 em in Silkscreen) then outgrew a ~160 px
   button (834 px tablets, narrow windows, zoom). Each pair button is now a
   size container and its label + icon are sized from the button's own width:
     label  15 px max, scaled so 10 em always fit beside the icon
     icon   20 px max, 14 px min
   Every pair label uses the same divisor, so a row's labels stay one size.
   Last line of defence everywhere: labels can never paint outside their
   button (clip; no ellipsis needed when the sizing holds). */
.tvx-screen-menu .tvx-menu-btn { min-width: 0; }
.tvx-screen-menu .tvx-menu-btn .tvx-menu-label { min-width: 0; overflow: hidden; white-space: nowrap; }
.tvx-screen-menu .tvx-menu-pair:not(.tvx-menu-util) > .tvx-menu-btn {
  container-type: inline-size;
  gap: 6px;
  padding-left: 10px;
  padding-right: 10px;
}
@supports (container-type: inline-size) {
  .tvx-screen-menu .tvx-menu-pair:not(.tvx-menu-util) > .tvx-menu-btn .tvx-menu-label {
    font-size: clamp(10px, calc((100cqi - 30px) / 10.2), 15px);
  }
  .tvx-screen-menu .tvx-menu-pair:not(.tvx-menu-util) > .tvx-menu-btn .tvx-ico {
    width: clamp(14px, 12cqi, 20px);
    height: clamp(14px, 12cqi, 20px);
    margin-right: 0;
  }
}
@supports not (container-type: inline-size) {
  @media (max-width: 1100px) {
    .tvx-screen-menu .tvx-menu-pair:not(.tvx-menu-util) > .tvx-menu-btn { font-size: 12px; letter-spacing: 0; }
    .tvx-screen-menu .tvx-menu-pair:not(.tvx-menu-util) > .tvx-menu-btn .tvx-ico { width: 16px; height: 16px; }
  }
}
/* the social links get the same guarantee */
.tvx-social .tvx-social-link { min-width: 0; white-space: nowrap; }

/* ---- v1.8.3 fallback character (no 3D world) ---------------------------------
   Stands where the 3D character stands, on the world still image. */
.tvx-fallback-char[hidden] { display: none; }
.tvx-fallback-char {
  position: absolute;
  right: 9vw;
  bottom: 6vh;
  height: min(62vh, 640px);
  aspect-ratio: 1 / 2;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 18px 14px rgba(0, 0, 0, 0.45));
}
.tvx-fallback-char [data-tvx-fallback-stage], .tvx-fallback-char .tvx-av { display: block; width: 100%; height: 100%; }
.tvx-fallback-char .tvx-av.tvx-av-stage { border: 0; background: none; box-shadow: none; }
/* NG-rc2: phones keep the character too (bottom-right, under the menu, like the 3D path) */
@media (max-width: 900px), (max-aspect-ratio: 1/1) { .tvx-fallback-char { right: 2vw; bottom: 1.2vh; height: min(24vh, 280px); } }
/* narrow tablets / windows (481-900 px): the menu column is ~330 px, so the
   pair buttons give the label the padding back (6 px) - LEADERBOARD stays at
   ~11 px instead of ~10 px; the 10 px floor above remains the guarantee. */
@media (max-width: 900px) and (min-width: 481px) {
  .tvx-screen-menu .tvx-menu-pair:not(.tvx-menu-util) > .tvx-menu-btn { padding-left: 6px; padding-right: 6px; gap: 5px; }
}

/* ---- v1.8.4 lite presentation: CSS-only parallax + idle (no redraws) -------
   html[data-tvx-lite] = software still / frozen slow world / still image.
   --tvx-px/--tvx-py (-1..1) come from one rAF-throttled pointer listener. */
html[data-tvx-lite] .tvx3d-canvas,
html[data-tvx-lite] .tvx-world-fallback::after {
  transform: translate3d(calc(var(--tvx-px, 0) * -10px), calc(var(--tvx-py, 0) * -6px), 0) scale(1.03);
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
html[data-tvx-lite] .tvx-fallback-char {
  transform: translate3d(calc(var(--tvx-px, 0) * -22px), calc(var(--tvx-py, 0) * -8px), 0);
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.tvx-reduced-motion .tvx3d-canvas, body.tvx-reduced-motion .tvx-world-fallback::after,
body.tvx-reduced-motion .tvx-fallback-char { transform: none !important; animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  html[data-tvx-lite] .tvx3d-canvas, html[data-tvx-lite] .tvx-world-fallback::after, html[data-tvx-lite] .tvx-fallback-char { transform: none !important; animation: none !important; transition: none !important; }
}
