/* ==========================================================================
   TVX CTF theme — Phase 1 foundation.
   Depends only on tokens.css variables. No frameworks required; works with
   plain server-rendered CTFd markup. Core-driven pages (challenges board,
   scoreboard tables) keep their Alpine/data hooks — this file skins them.
   ========================================================================== */

/* ---- Base ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.tvx {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -120px, var(--tvx-world-glow), transparent 60%),
    var(--tvx-bg);
  color: var(--tvx-text);
  font-family: var(--tvx-font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

/* ---- World atmospheres: one world, subtle per-page weather ----------------
   body[data-tvx-world] retunes the ambient glow + accent used by the hero,
   section titles, and biome art. Pages set it via the tvx_world block. */
body.tvx[data-tvx-world="forest"] { --tvx-world-glow: rgba(90, 200, 110, 0.10); --tvx-world-accent: var(--tvx-cat-web); }
body.tvx[data-tvx-world="mine"] { --tvx-world-glow: rgba(224, 179, 78, 0.10); --tvx-world-accent: var(--tvx-cat-crypto); }
body.tvx[data-tvx-world="desert"] { --tvx-world-glow: rgba(224, 179, 78, 0.12); --tvx-world-accent: var(--tvx-cat-crypto); }
body.tvx[data-tvx-world="village"] { --tvx-world-glow: rgba(111, 183, 214, 0.10); --tvx-world-accent: var(--tvx-cat-osint); }
body.tvx[data-tvx-world="nether"] { --tvx-world-glow: rgba(194, 107, 232, 0.10); --tvx-world-accent: var(--tvx-cat-reverse); }
body.tvx[data-tvx-world="lab"] { --tvx-world-glow: rgba(77, 227, 255, 0.10); --tvx-world-accent: var(--tvx-cat-misc); }
body.tvx[data-tvx-world="arena"] { --tvx-world-glow: rgba(255, 200, 87, 0.09); --tvx-world-accent: var(--tvx-gold); }
body.tvx[data-tvx-world="hall"] { --tvx-world-glow: rgba(70, 224, 168, 0.10); --tvx-world-accent: var(--tvx-primary); }
body.tvx[data-tvx-world="gate"] { --tvx-world-glow: rgba(77, 227, 255, 0.08); --tvx-world-accent: var(--tvx-accent); }
body.tvx[data-tvx-world="depths"] { --tvx-world-glow: rgba(255, 93, 93, 0.08); --tvx-world-accent: var(--tvx-danger); }

body.tvx::before { /* faint underground grid backdrop */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 70%);
  z-index: 0;
}

body.tvx main,
body.tvx .tvx-footer { position: relative; z-index: 1; }
/* NOTE: .tvx-nav keeps its own z-index: 50 (set in the navigation section)
   so the mobile dropdown always paints above page content. */

a { color: var(--tvx-link); }
a:hover { color: var(--tvx-text); }

/* Skip link: hidden until keyboard focus */
.tvx-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--tvx-primary);
  color: var(--tvx-primary-ink);
  font-weight: 700;
  padding: var(--tvx-unit) calc(var(--tvx-unit) * 2);
  z-index: 100;
  border-radius: 0 0 var(--tvx-radius) 0;
}
.tvx-skip:focus-visible { left: 0; }

img { max-width: 100%; }

/* Visible keyboard focus everywhere */
.tvx :focus-visible {
  outline: 3px solid var(--tvx-accent);
  outline-offset: 2px;
  border-radius: var(--tvx-radius-sm);
}

/* ---- Type ---------------------------------------------------------------- */
.tvx-pixel {
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}

.tvx h1, .tvx h2, .tvx h3,
.tvx-jumbotron h1 {
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
  margin: 0 0 calc(var(--tvx-unit) * 2);
}

.tvx p, .tvx li, .tvx td, .tvx label, .tvx input, .tvx textarea, .tvx select {
  font-family: var(--tvx-font-body); /* readability first */
}

.tvx-muted { color: var(--tvx-muted); }
.tvx-faint { color: var(--tvx-faint); }

/* ---- Layout -------------------------------------------------------------- */
.tvx-container {
  width: 100%;
  max-width: var(--tvx-max-width);
  margin: 0 auto;
  padding: 0 calc(var(--tvx-unit) * 2);
}

.tvx-main { padding: calc(var(--tvx-unit) * 4) 0 calc(var(--tvx-unit) * 8); }

.tvx-jumbotron {
  border-bottom: var(--tvx-border-width) solid var(--tvx-border);
  background:
    linear-gradient(to bottom, rgba(70, 224, 168, 0.07), transparent),
    var(--tvx-surface);
  padding: calc(var(--tvx-unit) * 5) 0;
  margin-bottom: calc(var(--tvx-unit) * 4);
}

.tvx-grid { display: grid; gap: calc(var(--tvx-unit) * 2); }
.tvx-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.tvx-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tvx-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Navigation ---------------------------------------------------------- */
.tvx-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--tvx-bg-deep);
  border-bottom: var(--tvx-border-width) solid var(--tvx-border);
}

.tvx-nav-inner {
  display: flex;
  align-items: center;
  gap: calc(var(--tvx-unit) * 2);
  min-height: 60px;
}

.tvx-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--tvx-unit);
  white-space: nowrap;
  color: var(--tvx-text);
  text-decoration: none;
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
}

.tvx-brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
  background:
    linear-gradient(135deg, var(--tvx-primary) 0 50%, var(--tvx-primary-dim) 50% 100%);
  box-shadow:
    inset 3px 3px 0 var(--tvx-block-hi),
    inset -3px -3px 0 var(--tvx-block-lo),
    0 0 12px rgba(70, 224, 168, 0.45);
  image-rendering: pixelated;
}

.tvx-nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

/* ---- HUD navbar polish ----------------------------------------------------
   Inventory-slot links: pixel dividers, selected-slot active state. */
.tvx-nav-links a,
.tvx-nav-links button.tvx-nav-link {
  display: inline-block;
  padding: 7px 9px;
  color: var(--tvx-muted);
  text-decoration: none;
  border: 2px solid transparent;
  border-left: 1px solid var(--tvx-border);
  background: transparent;
  /* Phase 7: the pixel typeface + uppercase, so the HUD links read as part of
     the same game as the homepage menu (they were plain sans-serif before). */
  font-family: var(--tvx-font-pixel);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 90ms var(--tvx-ease), background-color 90ms var(--tvx-ease);
}
@media (prefers-reduced-motion: reduce) {
  .tvx-nav-links a, .tvx-nav-links button.tvx-nav-link { transition: none; }
}
.tvx-nav-links li:first-child a,
.tvx-nav-links li:first-child button.tvx-nav-link { border-left-color: transparent; }

/* Phase 7: collapse the HUD nav to its toggle menu at <=1180px, so the longer
   authenticated/admin link set never overflows the row (pixel font is wide). */
@media (max-width: 1180px) {
  .tvx-nav-toggle { display: inline-block; }
  .tvx-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--tvx-bg-deep);
    border-bottom: var(--tvx-border-width) solid var(--tvx-border);
    padding: var(--tvx-unit);
    z-index: 51;
  }
  .tvx-nav.open .tvx-nav-links { display: flex; }
}

.tvx-nav-links a:hover,
.tvx-nav-links button.tvx-nav-link:hover {
  color: var(--tvx-text);
  background: var(--tvx-surface-2);
  border-color: var(--tvx-border);
}

.tvx-nav-links a[aria-current="page"] {
  color: var(--tvx-primary);
  background: var(--tvx-surface-2);
  border-color: var(--tvx-border-bright);
  box-shadow: inset 0 -3px 0 var(--tvx-primary);
}

.tvx-nav-toggle {
  display: none;
  margin-left: auto;
  background: var(--tvx-elevated);
  color: var(--tvx-text);
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius);
  padding: var(--tvx-unit) calc(var(--tvx-unit) * 1.5);
  font: inherit;
  cursor: pointer;
}

.tvx-lang {
  display: inline-flex;
  align-items: center;
  gap: var(--tvx-unit);
}

/* ---- Buttons ------------------------------------------------------------- */
.tvx-btn {
  display: inline-block;
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  color: var(--tvx-text);
  background: var(--tvx-elevated);
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius);
  padding: calc(var(--tvx-unit) * 1.25) calc(var(--tvx-unit) * 2.5);
  box-shadow:
    inset 2px 2px 0 var(--tvx-block-hi),
    inset -2px -2px 0 var(--tvx-block-lo);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--tvx-speed-fast) var(--tvx-ease),
    box-shadow var(--tvx-speed-fast) var(--tvx-ease),
    background var(--tvx-speed-fast) var(--tvx-ease);
}

.tvx-btn:hover { transform: translateY(-1px); color: var(--tvx-text); }
.tvx-btn:active {
  transform: translateY(1px);
  box-shadow: inset 2px 2px 0 var(--tvx-block-lo);
}

.tvx-btn-primary {
  background: linear-gradient(to bottom, #54ecb4, #2fae7e);
  border-color: #0c3d2c;
  color: var(--tvx-primary-ink);
  text-shadow: none;
}
.tvx-btn-primary:hover { color: #03170f; }

.tvx-btn-accent {
  background: linear-gradient(to bottom, #61e9ff, #25a9cc);
  border-color: #0d3f4d;
  color: #03222b;
  text-shadow: none;
}
.tvx-btn-accent:hover { color: #03222b; }

.tvx-btn-danger {
  background: linear-gradient(to bottom, #ff7d6b, #c93a3a);
  border-color: #4d1111;
  color: #2b0606;
  text-shadow: none;
}

.tvx-btn-ghost { background: transparent; box-shadow: none; }

.tvx-btn-block { display: block; width: 100%; text-align: center; }
.tvx-btn-sm { font-size: 0.72rem; padding: var(--tvx-unit) calc(var(--tvx-unit) * 1.5); }

/* ---- Cards / panels ------------------------------------------------------ */
.tvx-card,
.tvx-panel {
  background: linear-gradient(to bottom, var(--tvx-surface-2), var(--tvx-surface));
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-radius: var(--tvx-radius);
  box-shadow:
    inset 2px 2px 0 var(--tvx-block-hi),
    inset -2px -2px 0 var(--tvx-block-lo),
    0 6px 18px rgba(0, 0, 0, 0.35);
}

/* ---- Instance panel (quest modal) ---------------------------------------- */
.tvx-instance-status { margin: 0 0 var(--tvx-unit); }
.tvx-instance-target { margin: 0 0 var(--tvx-unit); overflow-wrap: anywhere; }
.tvx-instance-actions { display: flex; flex-wrap: wrap; gap: var(--tvx-unit); }
.tvx-instance .tvx-alert { margin-top: var(--tvx-unit); margin-bottom: 0; }

.tvx-card { padding: calc(var(--tvx-unit) * 3); }
.tvx-panel { padding: calc(var(--tvx-unit) * 3); }

.tvx-card-title {
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--tvx-unit);
}

/* ---- Badges / tags ------------------------------------------------------- */
.tvx-badge,
.tvx-tag {
  display: inline-block;
  font-family: var(--tvx-font-pixel);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border: 2px solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius-sm);
  background: var(--tvx-elevated);
  color: var(--tvx-text);
}

.tvx-badge-warning { border-color: #6b4a08; background: #3a2a08; color: var(--tvx-warning); }

.tvx-badge-info { border-color: #0d3f4d; background: #0a2a33; color: var(--tvx-info); }

/* Difficulty / rarity helpers (also usable as challenge rarity) */
.tvx-rarity-common { border-color: var(--tvx-rarity-common); color: var(--tvx-rarity-common); }
.tvx-rarity-uncommon { border-color: var(--tvx-rarity-uncommon); color: var(--tvx-rarity-uncommon); }
.tvx-rarity-rare { border-color: var(--tvx-rarity-rare); color: var(--tvx-rarity-rare); }
.tvx-rarity-epic { border-color: var(--tvx-rarity-epic); color: var(--tvx-rarity-epic); }
.tvx-rarity-legendary { border-color: var(--tvx-rarity-legendary); color: var(--tvx-rarity-legendary); }
.tvx-rarity-insane { border-color: var(--tvx-rarity-insane); color: var(--tvx-rarity-insane); }

/* ---- Forms --------------------------------------------------------------- */
.tvx-field { margin-bottom: calc(var(--tvx-unit) * 2); }

.tvx-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--tvx-unit);
}

.tvx-input,
.tvx select.tvx-input,
.tvx textarea.tvx-input {
  width: 100%;
  background: var(--tvx-bg-deep);
  color: var(--tvx-text);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-radius: var(--tvx-radius);
  padding: calc(var(--tvx-unit) * 1.25) calc(var(--tvx-unit) * 1.5);
  font-size: 1rem;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.tvx-input::placeholder { color: var(--tvx-faint); }
.tvx-input:focus {
  border-color: var(--tvx-primary);
  outline: none;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(70, 224, 168, 0.35);
}

.tvx-help { color: var(--tvx-muted); font-size: 0.85rem; margin-top: 4px; display: block; }

/* WTForms passthrough: core templates emit .form-control etc. Skin them too. */
.tvx .form-control {
  background: var(--tvx-bg-deep);
  color: var(--tvx-text);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-radius: var(--tvx-radius);
  padding: calc(var(--tvx-unit) * 1.25) calc(var(--tvx-unit) * 1.5);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5);
}
.tvx .form-control:focus {
  border-color: var(--tvx-primary);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(70, 224, 168, 0.35);
  color: var(--tvx-text);
  background: var(--tvx-bg-deep);
}
.tvx .form-label { font-weight: 600; }

/* ---- Alerts / notifications ---------------------------------------------- */
.tvx-alert {
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-left-width: 6px;
  border-radius: var(--tvx-radius);
  background: var(--tvx-elevated);
  padding: calc(var(--tvx-unit) * 1.5) calc(var(--tvx-unit) * 2);
  margin-bottom: calc(var(--tvx-unit) * 2);
  text-align: center;
}
.tvx-alert-info { border-left-color: var(--tvx-info); }
.tvx-alert-success { border-left-color: var(--tvx-success); }
.tvx-alert-danger { border-left-color: var(--tvx-danger); }
.tvx-alert-warning { border-left-color: var(--tvx-warning); }

/* Bootstrap alert passthrough (core includes use .alert) */
.tvx .alert {
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-left-width: 6px;
  border-radius: var(--tvx-radius);
  background: var(--tvx-elevated);
  color: var(--tvx-text);
}

/* ---- Modal (quest dialog shell; core Bootstrap modals inherit) ------------ */
.tvx-modal-content {
  background: linear-gradient(to bottom, var(--tvx-surface-2), var(--tvx-surface));
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius);
  box-shadow:
    inset 2px 2px 0 var(--tvx-block-hi),
    0 12px 40px rgba(0, 0, 0, 0.6);
}
.tvx .modal-content {
  background: linear-gradient(to bottom, var(--tvx-surface-2), var(--tvx-surface));
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  color: var(--tvx-text);
}
.tvx .btn-close { filter: invert(1) grayscale(1); }
.tvx .nav-tabs { border-bottom-color: var(--tvx-border); }
.tvx .nav-tabs .nav-link { color: var(--tvx-muted); border-color: transparent; }
.tvx .nav-tabs .nav-link.active,
.tvx .nav-tabs .nav-link:hover {
  color: var(--tvx-text);
  background: var(--tvx-elevated);
  border-color: var(--tvx-border);
}

/* ---- Tooltip (CSS-only, progressive enhancement) -------------------------- */
.tvx-tip { position: relative; }
.tvx-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--tvx-bg-deep);
  color: var(--tvx-text);
  border: 2px solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius-sm);
  padding: 4px 8px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tvx-speed-fast) var(--tvx-ease);
  z-index: 60;
}
.tvx-tip:hover::after,
.tvx-tip:focus-visible::after { opacity: 1; }

/* ---- Progress bar -------------------------------------------------------- */
.tvx-progress {
  height: 18px;
  background: var(--tvx-bg-deep);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-radius: var(--tvx-radius-sm);
  overflow: hidden;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5);
  display: flex;
}
.tvx-progress > span {
  display: block;
  height: 100%;
  flex: none;
  background:
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.18) 0 6px, transparent 6px 12px),
    linear-gradient(to bottom, var(--tvx-primary), var(--tvx-primary-dim));
  transition: width var(--tvx-speed-slow) var(--tvx-ease);
}

/* ---- Status indicator ---------------------------------------------------- */
.tvx-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.tvx-status-dot {
  width: 10px;
  height: 10px;
  flex: none;
  background: var(--tvx-faint);
  box-shadow: inset 1px 1px 0 var(--tvx-block-hi), inset -1px -1px 0 var(--tvx-block-lo);
}
.tvx-status-online .tvx-status-dot { background: var(--tvx-success); box-shadow: 0 0 8px var(--tvx-success); }
.tvx-status-busy .tvx-status-dot { background: var(--tvx-warning); box-shadow: 0 0 8px var(--tvx-warning); }
.tvx-status-down .tvx-status-dot { background: var(--tvx-danger); box-shadow: 0 0 8px var(--tvx-danger); }

/* ---- Loading state ------------------------------------------------------- */
.tvx-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--tvx-unit) * 2);
  padding: calc(var(--tvx-unit) * 5);
  color: var(--tvx-muted);
}
.tvx-loading-blocks { display: inline-flex; gap: 4px; }
.tvx-loading-blocks span {
  width: 12px;
  height: 12px;
  background: var(--tvx-primary);
  box-shadow: inset 2px 2px 0 var(--tvx-block-hi), inset -2px -2px 0 var(--tvx-block-lo);
  animation: tvx-bounce 0.9s infinite var(--tvx-ease);
}
.tvx-loading-blocks span:nth-child(2) { animation-delay: 0.15s; background: var(--tvx-accent); }
.tvx-loading-blocks span:nth-child(3) { animation-delay: 0.3s; background: var(--tvx-gold); }
@keyframes tvx-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---- Block primitives ---------------------------------------------------- */
.tvx-block {
  position: relative;
  background: var(--tvx-elevated);
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius);
  box-shadow:
    inset 3px 3px 0 var(--tvx-block-hi),
    inset -3px -3px 0 var(--tvx-block-lo),
    0 4px 0 rgba(0, 0, 0, 0.4);
  transition: transform var(--tvx-speed-fast) var(--tvx-ease),
    box-shadow var(--tvx-speed-fast) var(--tvx-ease),
    border-color var(--tvx-speed-fast) var(--tvx-ease);
}

a.tvx-block, button.tvx-block { display: block; color: inherit; text-decoration: none; cursor: pointer; }

.tvx-block:hover,
a.tvx-block:hover {
  transform: translateY(-2px);
  border-color: var(--tvx-primary);
  box-shadow:
    inset 3px 3px 0 var(--tvx-block-hi),
    inset -3px -3px 0 var(--tvx-block-lo),
    0 6px 0 rgba(0, 0, 0, 0.4),
    0 0 16px rgba(70, 224, 168, 0.25);
  color: inherit;
}

.tvx-block.is-selected {
  border-color: var(--tvx-gold);
  box-shadow:
    inset 3px 3px 0 var(--tvx-block-hi),
    inset -3px -3px 0 var(--tvx-block-lo),
    0 0 0 2px var(--tvx-gold),
    0 0 20px rgba(255, 200, 87, 0.35);
}

/* Mining (pressed) + cracked states — decorative overlays only */
.tvx-block.is-mining { animation: tvx-shake var(--tvx-speed-slow) linear; }
@keyframes tvx-shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, -1px); }
}

.tvx-block.is-cracked::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    repeating-linear-gradient(35deg, transparent 0 10px, rgba(0, 0, 0, 0.35) 10px 12px),
    repeating-linear-gradient(-50deg, transparent 0 14px, rgba(0, 0, 0, 0.28) 14px 16px);
}

/* Particle burst container (spawned by tvx.js/home.js; inert without JS) */
.tvx-particles { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.tvx-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--tvx-particle-color, var(--tvx-primary));
  animation: tvx-particle 600ms var(--tvx-ease) forwards;
}
@keyframes tvx-particle {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--tvx-dx, 0px), var(--tvx-dy, -40px)) scale(0.4); opacity: 0; }
}

/* ---- Challenge card (quest) ---------------------------------------------- */
.tvx-challenge-card { padding: calc(var(--tvx-unit) * 2.5); height: 100%; }
.tvx-challenge-card .tvx-challenge-name {
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
}
.tvx-challenge-card .tvx-challenge-points {
  font-family: var(--tvx-font-pixel);
  color: var(--tvx-gold);
  font-size: 0.85rem;
}
.tvx-challenge-card.is-solved { border-color: var(--tvx-success); }
.tvx-challenge-card.is-solved::before {
  content: "CLEARED";
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--tvx-font-pixel);
  font-size: 0.62rem;
  color: #062b1a;
  background: var(--tvx-success);
  border-radius: var(--tvx-radius-sm);
  padding: 2px 6px;
}

/* Core board passthrough: keep core's challenge buttons functional + themed */
.tvx .challenge-button {
  background: linear-gradient(to bottom, var(--tvx-surface-2), var(--tvx-surface));
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-radius: var(--tvx-radius);
  color: var(--tvx-text);
  box-shadow:
    inset 2px 2px 0 var(--tvx-block-hi),
    inset -2px -2px 0 var(--tvx-block-lo);
}
.tvx .challenge-button:hover { border-color: var(--tvx-primary); color: var(--tvx-text); }
.tvx .challenge-solved { border-color: var(--tvx-success); }

/* ---- Category / biome card ----------------------------------------------- */
.tvx-biome-grid {
  display: grid;
  gap: calc(var(--tvx-unit) * 2);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tvx-biome {
  --biome: var(--tvx-primary);
  display: block;
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.tvx-biome-art {
  height: 96px;
  background:
    linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.45)),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--biome) 55%, black) 0 12px,
      color-mix(in srgb, var(--biome) 75%, black) 12px 24px),
    var(--tvx-bg-deep);
  border-bottom: var(--tvx-border-width) solid var(--tvx-border);
  position: relative;
}
/* pixel tufts: pure CSS squares, no images */
.tvx-biome-art::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 22px;
  background:
    linear-gradient(var(--biome), var(--biome)) 8% 0 / 12px 12px no-repeat,
    linear-gradient(var(--biome), var(--biome)) 30% 6px / 12px 12px no-repeat,
    linear-gradient(var(--biome), var(--biome)) 55% 0 / 12px 12px no-repeat,
    linear-gradient(var(--biome), var(--biome)) 78% 6px / 12px 12px no-repeat,
    linear-gradient(color-mix(in srgb, var(--biome) 60%, white), color-mix(in srgb, var(--biome) 60%, white)) 45% 2px / 8px 8px no-repeat;
}
.tvx-biome-body { padding: calc(var(--tvx-unit) * 2); }
.tvx-biome-name {
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
  font-size: 0.95rem;
}
.tvx-biome-desc { color: var(--tvx-muted); font-size: 0.85rem; margin: 0; }
.tvx-biome-count { margin-top: var(--tvx-unit); }

/* ---- Scoreboard ---------------------------------------------------------- */
.tvx-scoreboard { width: 100%; border-collapse: separate; border-spacing: 0; }
.tvx-scoreboard th {
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--tvx-muted);
  text-align: left;
  padding: var(--tvx-unit) calc(var(--tvx-unit) * 1.5);
  border-bottom: var(--tvx-border-width) solid var(--tvx-border);
}
.tvx-scoreboard td {
  padding: calc(var(--tvx-unit) * 1.25) calc(var(--tvx-unit) * 1.5);
  border-bottom: 1px solid var(--tvx-border);
}
.tvx-scoreboard tbody tr { transition: background var(--tvx-speed-fast) var(--tvx-ease); }
.tvx-scoreboard tbody tr:hover { background: var(--tvx-surface-2); }

/* Core scoreboard table passthrough */
.tvx table.table { color: var(--tvx-text); }
.tvx table.table thead th { color: var(--tvx-muted); border-bottom: var(--tvx-border-width) solid var(--tvx-border); }
.tvx table.table td, .tvx table.table th { border-color: var(--tvx-border); }
.tvx .table-striped tbody tr:nth-of-type(odd) { background: rgba(255, 255, 255, 0.02); }

/* ---- Hero / home ---------------------------------------------------------- */
.tvx-hero {
  text-align: center;
  padding: calc(var(--tvx-unit) * 8) 0 calc(var(--tvx-unit) * 6);
  position: relative;
}

.tvx-hero-title {
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  margin: calc(var(--tvx-unit) * 2) 0;
  color: var(--tvx-text);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.6), 0 0 32px rgba(70, 224, 168, 0.35);
}

/* floating block row under hero (decorative, aria-hidden) */
.tvx-hero-blocks { display: flex; justify-content: center; gap: 6px; margin-top: calc(var(--tvx-unit) * 4); }
.tvx-hero-blocks span {
  width: 22px;
  height: 22px;
  box-shadow: inset 3px 3px 0 var(--tvx-block-hi), inset -3px -3px 0 var(--tvx-block-lo);
  animation: tvx-float 3s ease-in-out infinite;
}
.tvx-hero-blocks span:nth-child(2n) { animation-delay: 0.4s; }
.tvx-hero-blocks span:nth-child(3n) { animation-delay: 0.8s; }
@keyframes tvx-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.tvx-section { margin-top: calc(var(--tvx-unit) * 7); }
.tvx-section-title {
  display: flex;
  align-items: center;
  gap: calc(var(--tvx-unit) * 1.5);
  margin-bottom: calc(var(--tvx-unit) * 3);
}
.tvx-section-title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--tvx-border-bright), transparent);
}

/* ---- Footer + display settings -------------------------------------------- */
.tvx-footer {
  border-top: var(--tvx-border-width) solid var(--tvx-border);
  background: var(--tvx-bg-deep);
  padding: calc(var(--tvx-unit) * 4) 0;
  margin-top: calc(var(--tvx-unit) * 8);
  color: var(--tvx-muted);
  font-size: 0.9rem;
}
.tvx-footer-inner {
  display: flex;
  gap: calc(var(--tvx-unit) * 3);
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
}

/* ---- Custom cursor hooks (cursor.js toggles these on <body>) -------------- */
/* NOTE: text entry always keeps the native cursor so selection never breaks. */
body.tvx-cursor-diamondsword,
body.tvx-cursor-diamondsword a,
body.tvx-cursor-diamondsword button { cursor: var(--tvx-cursor, auto); }
body.tvx-cursor-crosshair,
body.tvx-cursor-crosshair a,
body.tvx-cursor-crosshair button { cursor: var(--tvx-cursor, auto); }
body.tvx-cursor-sword,
body.tvx-cursor-sword a,
body.tvx-cursor-sword button { cursor: var(--tvx-cursor, auto); }
body.tvx-cursor-pickaxe,
body.tvx-cursor-pickaxe a,
body.tvx-cursor-pickaxe button { cursor: var(--tvx-cursor, auto); }
body.tvx-cursor-axe,
body.tvx-cursor-axe a,
body.tvx-cursor-axe button { cursor: var(--tvx-cursor, auto); }

.tvx input, .tvx textarea, .tvx select, .tvx [contenteditable="true"], .tvx pre {
  cursor: auto;
}

/* ---- Reveal on scroll (JS adds .is-visible; content visible without JS) --- */
.tvx-reveal { opacity: 1; }
html.tvx-js .tvx-reveal { opacity: 0; transform: translateY(12px); transition: opacity var(--tvx-speed-slow) var(--tvx-ease), transform var(--tvx-speed-slow) var(--tvx-ease); }
html.tvx-js .tvx-reveal.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   PHASE 2 — world system, enriched hero/biomes, quest board, modal sections,
   leaderboard, profiles, error flavors, extended block states, ambient FX.
   ========================================================================== */

/* ---- Voxel skyline + hex ticker + scanlines (hero atmosphere) ------------- */

@keyframes tvx-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* Floating ambient blocks (JS-spawned, capped; see home.js) */

.tvx-mote {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--tvx-mote-color, var(--tvx-primary));
  opacity: 0.55;
  animation: tvx-drift var(--tvx-mote-time, 9s) linear infinite;
}
@keyframes tvx-drift {
  from { transform: translateY(10px); }
  to { transform: translateY(-120px); }
}

/* ---- Biome cards: icon, counts, selected ---------------------------------- */
.tvx-biome-top { display: flex; align-items: center; gap: calc(var(--tvx-unit) * 1.5); margin-bottom: 4px; }
.tvx-biome-icon {
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--biome);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--biome) 60%, transparent));
}
.tvx-biome-icon svg { width: 100%; height: 100%; display: block; }
.tvx-biome-meta {
  display: flex;
  gap: var(--tvx-unit);
  align-items: center;
  margin-top: var(--tvx-unit);
  font-size: 0.8rem;
  color: var(--tvx-muted);
}
.tvx-biome-count-chip {
  font-family: var(--tvx-font-pixel);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius-sm);
  padding: 1px 6px;
  color: var(--tvx-text);
}
a.tvx-biome.is-selected { outline: 2px solid var(--tvx-gold); outline-offset: 2px; }

/* ---- Quest board: category edge, solves, rarity, locked -------------------- */
.tvx-challenge-card { border-left-width: 6px; }

.tvx-challenge-sub {
  display: flex;
  gap: var(--tvx-unit);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--tvx-muted);
}

/* rarity tints driven by data-tvx-rarity set from point value (visual only) */
.tvx-challenge-card[data-tvx-rarity="common"] { border-left-color: var(--tvx-rarity-common); }
.tvx-challenge-card[data-tvx-rarity="uncommon"] { border-left-color: var(--tvx-rarity-uncommon); }
.tvx-challenge-card[data-tvx-rarity="rare"] { border-left-color: var(--tvx-rarity-rare); }
.tvx-challenge-card[data-tvx-rarity="epic"] { border-left-color: var(--tvx-rarity-epic); }
.tvx-challenge-card[data-tvx-rarity="legendary"] { border-left-color: var(--tvx-gold); }
.tvx-challenge-card[data-tvx-rarity="insane"] {
  border-left-color: var(--tvx-rarity-insane);
  box-shadow: inset 3px 3px 0 var(--tvx-block-hi), inset -3px -3px 0 var(--tvx-block-lo),
    0 0 18px rgba(255, 93, 93, 0.28);
}







/* ---- Quest modal sections (quest/challenge book) --------------------------- */
.tvx-quest-kicker {
  font-family: var(--tvx-font-pixel);
  color: var(--tvx-accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  text-align: center;
  margin: 0 0 4px;
}
.tvx-quest-section { margin-top: calc(var(--tvx-unit) * 2); }
.tvx-quest-section > h3,
.tvx-quest-label {
  font-family: var(--tvx-font-pixel);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--tvx-muted);
  margin: 0 0 var(--tvx-unit);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--tvx-border);
}
.tvx-quest-desc { font-size: 0.95rem; }
.tvx-quest-desc pre, .tvx-quest-desc code { white-space: pre-wrap; word-break: break-word; }
.tvx-file-list { display: grid; gap: var(--tvx-unit); }
.tvx-conn {
  display: block;
  font-family: var(--tvx-font-pixel);
  font-size: 0.8rem;
  background: var(--tvx-bg-deep);
  border: 2px solid var(--tvx-border);
  border-radius: var(--tvx-radius-sm);
  padding: var(--tvx-unit) calc(var(--tvx-unit) * 1.5);
  overflow-x: auto;
  user-select: all;
}
.tvx-hint { margin-bottom: var(--tvx-unit); }
.tvx-hint summary { cursor: pointer; font-weight: 600; }
.tvx-hint summary:hover { color: var(--tvx-primary); }

/* ---- Leaderboard: medals, sticky head, compact rows ------------------------ */
.tvx-scoreboard thead th { position: sticky; top: 60px; background: var(--tvx-bg); z-index: 5; }
.tvx-scoreboard tbody tr { font-variant-numeric: tabular-nums; }
.tvx-scoreboard tr[data-tvx-medal="1"] { background: linear-gradient(to right, rgba(255, 215, 106, 0.13), transparent 65%); }
.tvx-scoreboard tr[data-tvx-medal="2"] { background: linear-gradient(to right, rgba(207, 216, 220, 0.10), transparent 65%); }
.tvx-scoreboard tr[data-tvx-medal="3"] { background: linear-gradient(to right, rgba(224, 153, 92, 0.12), transparent 65%); }

.tvx-score-num { font-family: var(--tvx-font-pixel); font-size: 0.9rem; color: var(--tvx-gold); }

/* ---- Profiles: hero card, avatar block, stats { text-align: center; padding: calc(var(--tvx-unit) * 5) 0; }
.tvx-avatar {
  width: 76px;
  height: 76px;
  margin: 0 auto calc(var(--tvx-unit) * 2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tvx-font-pixel);
  font-size: 2rem;
  color: var(--tvx-primary-ink);
  background: linear-gradient(135deg, var(--tvx-primary), var(--tvx-primary-dim));
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  box-shadow: inset 4px 4px 0 var(--tvx-block-hi), inset -4px -4px 0 var(--tvx-block-lo),
    0 0 24px rgba(70, 224, 168, 0.3);
  image-rendering: pixelated;
  text-transform: uppercase;
}


.tvx-stat-row { display: flex; gap: calc(var(--tvx-unit) * 3); justify-content: center; flex-wrap: wrap; margin-top: calc(var(--tvx-unit) * 2); }
.tvx-stat { text-align: center; }
.tvx-stat-value { font-family: var(--tvx-font-pixel); font-size: 1.4rem; color: var(--tvx-gold); }
.tvx-stat-label { font-size: 0.75rem; color: var(--tvx-muted); text-transform: uppercase; letter-spacing: 0.1em; }





.tvx-slot {
  display: flex;
  align-items: center;
  gap: var(--tvx-unit);
  background: var(--tvx-bg-deep);
  border: 2px solid var(--tvx-border);
  border-radius: var(--tvx-radius-sm);
  padding: var(--tvx-unit) calc(var(--tvx-unit) * 1.5);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5);
  text-decoration: none;
  color: inherit;
}
a.tvx-slot:hover { border-color: var(--tvx-primary); color: inherit; }
.tvx-slot-glyph {
  width: 26px;
  height: 26px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tvx-font-pixel);
  background: var(--tvx-elevated);
  border: 2px solid var(--tvx-border-bright);
  color: var(--tvx-primary);
  text-transform: uppercase;
}



/* awards shelf */
.tvx-awards { display: grid; gap: calc(var(--tvx-unit) * 2); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); text-align: center; }
.tvx-award { padding: calc(var(--tvx-unit) * 2); }
.tvx-award-glyph {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--tvx-unit);
  background: linear-gradient(135deg, var(--tvx-gold), #8a6420);
  border: 2px solid #4d3a10;
  box-shadow: inset 3px 3px 0 var(--tvx-block-hi), inset -3px -3px 0 var(--tvx-block-lo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tvx-font-pixel);
  color: #2b1f06;
}


.tvx-pagination { display: flex; gap: var(--tvx-unit); align-items: center; justify-content: center; margin-top: calc(var(--tvx-unit) * 3); }
.tvx-notification { margin-bottom: calc(var(--tvx-unit) * 2); }
.tvx-notification h3 { margin-top: 0; }

/* ---- Error flavors ----------------------------------------------------------
   Variants set by errors/<code>.html via data-tvx-err on the shell. */

.tvx-error-title { font-size: clamp(1.4rem, 4vw, 2.2rem); }
.tvx-error-code {
  display: inline-block;
  font-family: var(--tvx-font-pixel);
  border: 2px solid var(--tvx-border-bright);
  padding: 2px 12px;
  margin-bottom: calc(var(--tvx-unit) * 2);
  background: var(--tvx-elevated);
}

/* ---- Extended block states --------------------------------------------------- */
.tvx-block.is-disabled,
button.tvx-block:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.tvx-block.is-disabled:hover { transform: none; border-color: var(--tvx-border-bright); box-shadow:
    inset 3px 3px 0 var(--tvx-block-hi),
    inset -3px -3px 0 var(--tvx-block-lo),
    0 4px 0 rgba(0, 0, 0, 0.4); }
.tvx-block.is-locked {
  background: linear-gradient(to bottom, #141414, #0c0c0c);
  border-style: dashed;
  cursor: not-allowed;
}
.tvx-block.is-locked:hover { transform: none; border-color: var(--tvx-border-bright); }

/* two-stage mining crack: hairline, then deep */
.tvx-block.is-cracked-1::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: repeating-linear-gradient(35deg, transparent 0 16px, rgba(0, 0, 0, 0.3) 16px 18px);
}
.tvx-block.is-cracked-2::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    repeating-linear-gradient(35deg, transparent 0 10px, rgba(0, 0, 0, 0.4) 10px 12px),
    repeating-linear-gradient(-55deg, transparent 0 12px, rgba(0, 0, 0, 0.35) 12px 14px);
}

/* ---- Responsive ------------------------------------------------------------ */
@media (min-width: 1600px) {
  :root { --tvx-max-width: 1280px; }
  .tvx-hero-title { font-size: 4.6rem; }
}

@media (max-width: 1280px) {
  .tvx-nav-inner { gap: var(--tvx-unit); }
  .tvx-nav-links a,
  .tvx-nav-links button.tvx-nav-link { padding: var(--tvx-unit) var(--tvx-unit); }
}

@media (max-width: 1024px) {
  
  
}
@media (max-width: 900px) {
  .tvx-grid.cols-3, .tvx-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .tvx-nav-toggle { display: inline-block; }
  .tvx-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--tvx-bg-deep);
    border-bottom: var(--tvx-border-width) solid var(--tvx-border);
    padding: var(--tvx-unit);
  }
  .tvx-nav.open .tvx-nav-links { display: flex; }
  .tvx-nav-links a,
  .tvx-nav-links button.tvx-nav-link { width: 100%; text-align: left; }
}

@media (max-width: 600px) {
  .tvx-grid.cols-2, .tvx-grid.cols-3, .tvx-grid.cols-4 { grid-template-columns: 1fr; }
  .tvx-hero { padding: calc(var(--tvx-unit) * 5) 0 calc(var(--tvx-unit) * 4); }
  .tvx-card, .tvx-panel { padding: calc(var(--tvx-unit) * 2); }
  
  
  
  .tvx-scoreboard th:nth-child(3), .tvx-scoreboard td:nth-child(3) { white-space: nowrap; }
  .tvx-stat-row { gap: calc(var(--tvx-unit) * 2); }
}

/* ---- Reduced motion: kill animation, keep function -------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tvx *, .tvx *::before, .tvx *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html.tvx-js .tvx-reveal { opacity: 1; transform: none; }
}

/* Manual override via footer setting (data-tvx-motion="reduced" on <html>) */
html[data-tvx-motion="reduced"] .tvx *,
html[data-tvx-motion="reduced"] .tvx *::before,
html[data-tvx-motion="reduced"] .tvx *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
html[data-tvx-motion="reduced"].tvx-js .tvx-reveal { opacity: 1; transform: none; }

/* ==========================================================================
   TVX WORLD OVERHAUL — HUB realms, block states, HUD, achievement FX.
   Pure CSS (gradients only {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: calc(var(--tvx-unit) * 2) 0 0; padding: 0; list-style: none;
}




/* ---- Realm bands: one pixel texture per biome ---------------------------- */
.tvx-realm { overflow: hidden; }
.tvx-realm-band { height: 26px; border-bottom: var(--tvx-border-width) solid var(--tvx-border-bright); }
.tvx-realm-head { display: flex; align-items: baseline; gap: calc(var(--tvx-unit) * 1.5); flex-wrap: wrap; }
.tvx-realm-name { margin: 0; }
.tvx-realm-lore { margin: 0; }
.tvx-realm-crypto .tvx-realm-band {
  background:
    repeating-linear-gradient(0deg, transparent 0 10px, rgba(90, 60, 20, 0.5) 10px 12px),
    repeating-linear-gradient(90deg, #c9a24e 0 22px, #b28c3e 22px 24px, #d4af5c 24px 46px),
    linear-gradient(#8a6a2c, #6e5422);
}
.tvx-realm-forensics .tvx-realm-band {
  background:
    radial-gradient(circle at 12% 60%, #ffd75e 0 3px, transparent 4px),
    radial-gradient(circle at 68% 30%, #4de3ff 0 3px, transparent 4px),
    radial-gradient(circle at 86% 70%, #ffd75e 0 2px, transparent 3px),
    repeating-linear-gradient(90deg, #3a4149 0 16px, #31373e 16px 32px),
    linear-gradient(#23272d, #16181c);
}
/* final2-dev: Bonus Vault - emerald blocks with a gold seam. */
.tvx-realm-bonus .tvx-realm-band {
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 215, 94, 0.45) 22px 24px),
    repeating-linear-gradient(0deg, #1f8f63 0 8px, #19785a 8px 16px),
    linear-gradient(#1d6b51, #0f3a2c);
}
.tvx-realm-osint .tvx-realm-band {
  background:
    repeating-linear-gradient(90deg, transparent 0 30px, rgba(60, 35, 15, 0.6) 30px 34px),
    repeating-linear-gradient(0deg, #7a5230 0 8px, #6b472a 8px 16px),
    linear-gradient(#4e3319, #3a2612);
}
.tvx-realm-web .tvx-realm-band {
  background:
    linear-gradient(rgba(20, 60, 30, 0.55) 0 6px, transparent 6px),
    repeating-linear-gradient(90deg, #2c6e3f 0 14px, #35854a 14px 28px),
    linear-gradient(#1d4a29, #14341d);
}
.tvx-realm-pwn .tvx-realm-band {
  background:
    radial-gradient(circle at 10px 8px, #9aa7b4 0 2px, transparent 3px),
    radial-gradient(circle at 34px 8px, #9aa7b4 0 2px, transparent 3px),
    repeating-linear-gradient(90deg, #565e68 0 44px, #484f58 44px 46px),
    linear-gradient(#33373d, #23262b);
  background-size: auto, auto, 46px 18px, auto;
}
.tvx-realm-reverse .tvx-realm-band {
  background:
    linear-gradient(rgba(255, 90, 40, 0.35) 0 4px, transparent 4px 9px, rgba(255, 90, 40, 0.3) 9px 11px, transparent 11px),
    repeating-linear-gradient(90deg, #4a1620 0 18px, #3a1018 18px 36px),
    linear-gradient(#2a0a10, #1a060a);
}
.tvx-realm-misc .tvx-realm-band {
  background:
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(77, 227, 255, 0.18) 12px 14px),
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(77, 227, 255, 0.18) 12px 14px),
    linear-gradient(#1d3038, #142128);
}

/* ---- Challenge block states ------------------------------------------------ */
.tvx-block.is-locked {
  filter: brightness(0.55) saturate(0.6);
}

.tvx-challenge-card.is-running { border-color: var(--tvx-accent); }
.tvx-inst-chip {
  display: inline-block; font-family: var(--tvx-font-pixel); font-size: 0.62rem;
  letter-spacing: 0.05em; color: #062b26; background: var(--tvx-accent);
  border-radius: var(--tvx-radius-sm); padding: 2px 6px; margin-left: 6px;
  vertical-align: middle;
}
.tvx-challenge-card.is-solved::after {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.14) 45%, transparent 60%);
  background-size: 250% 100%;
  animation: tvx-enchant 3.2s var(--tvx-ease) infinite;
}
@keyframes tvx-enchant {
  0% { background-position: 120% 0; }
  60%, 100% { background-position: -20% 0; }
}
.tvx-challenge-card.is-expired { opacity: 0.55; }

/* ---- Submission feedback --------------------------------------------------- */
.tvx-alert { transition: transform var(--tvx-speed-fast) var(--tvx-ease); }
/* Damage shake (applied to the stable response row, survives re-renders). */
.tvs-shake { animation: tvx-damage 0.4s linear; }
@keyframes tvx-damage {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.tvx-xp-float {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  font-family: var(--tvx-font-pixel); color: var(--tvx-gold);
  font-size: 0.95rem; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.7);
  animation: tvx-xp-rise 1.6s var(--tvx-ease) forwards;
  pointer-events: none; z-index: 5;
}
@keyframes tvx-xp-rise {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -34px); }
}

/* ---- Player HUD (inventory-slot strip) -------------------------------------- */
.tvx-hud {
  display: flex; flex-wrap: wrap; gap: calc(var(--tvx-unit) * 1.5);
  margin-top: calc(var(--tvx-unit) * 3);
}
.tvx-hud[hidden] { display: none; }
.tvx-hud-slot {
  display: flex; align-items: center; gap: var(--tvx-unit);
  background: var(--tvx-bg-deep);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-radius: var(--tvx-radius-sm);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5);
  padding: 6px 10px; min-width: 0;
}
.tvx-hud-label {
  font-family: var(--tvx-font-pixel); font-size: 0.6rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--tvx-muted);
}
.tvx-hud-value {
  font-family: var(--tvx-font-pixel); font-size: 0.85rem; color: var(--tvx-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch;
}
.tvx-hud-value.is-gold { color: var(--tvx-gold); }

/* ---- First-blood achievement overlay ---------------------------------------- */
.tvx-achievement {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 3000; text-align: center;
  background: linear-gradient(to bottom, #3a2c10, #241b08);
  border: 3px solid var(--tvx-gold);
  border-radius: var(--tvx-radius);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.6), 0 0 34px rgba(255, 200, 87, 0.45);
  padding: calc(var(--tvx-unit) * 2) calc(var(--tvx-unit) * 4);
  animation: tvx-achieve-in 0.45s var(--tvx-ease);
  max-width: min(92vw, 560px);
}
.tvx-achievement[hidden] { display: none; }
.tvx-achievement-kicker {
  font-family: var(--tvx-font-pixel); color: var(--tvx-gold);
  letter-spacing: 0.14em; font-size: 0.75rem; margin: 0 0 4px;
}
.tvx-achievement-title { font-family: var(--tvx-font-pixel); margin: 0 0 4px; }

@keyframes tvx-achieve-in {
  0% { opacity: 0; transform: translate(-50%, -16px) scale(0.96); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ---- Cursor busy/disabled states ---------------------------------------------- */
.tvx [aria-busy="true"] { cursor: wait; }
.tvx button:disabled, .tvx input:disabled { cursor: not-allowed; }
.tvx-realm-wilds .tvx-realm-band {
  background:
    repeating-linear-gradient(90deg, transparent 0 20px, rgba(0, 0, 0, 0.35) 20px 22px),
    repeating-linear-gradient(0deg, #3d444c 0 12px, #343a42 12px 24px),
    linear-gradient(#262b31, #1a1d22);
}

/* ==========================================================================
   WORLD SHELL — transition veil, hotbar HUD, parallax scenery, menu blocks.
   ========================================================================== */

/* ---- Transition veil ------------------------------------------------------- */
.tvx-veil {
  position: fixed; inset: 0; z-index: 4000;
  background:
    radial-gradient(120% 90% at 50% 110%, var(--tvx-veil-tint, #4de3ff) 0%, transparent 55%),
    linear-gradient(rgba(5, 8, 7, 0.88), rgba(5, 8, 7, 0.94));
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s var(--tvx-ease);
}
.tvx-veil.is-covering { opacity: 1; pointer-events: all; }
.tvx-veil.is-instant { transition: none; }
body.tvx-entered .tvx-main {
  animation: tvx-world-enter 0.42s var(--tvx-ease);
}
@keyframes tvx-world-enter {
  0% { opacity: 0; transform: translateY(14px) scale(0.995); }
  100% { opacity: 1; transform: none; }
}

/* ---- Press-down feedback for world navigation ------------------------------- */
a.is-pressing, button.is-pressing {
  transform: translateY(2px) scale(0.985) !important;
  transition: transform 0.1s var(--tvx-ease) !important;
}

/* ---- Hotbar HUD -------------------------------------------------------------- */
.tvx-hotbar {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  z-index: 1500; display: flex; align-items: stretch; gap: 4px;
  background: linear-gradient(to bottom, var(--tvx-surface-2), var(--tvx-bg-deep));
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-radius: var(--tvx-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), inset 2px 2px 0 var(--tvx-block-hi);
  padding: 6px;
  max-width: calc(100vw - 24px);
}
.tvx-hotbar-slot {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 64px; padding: 6px 10px; border-radius: var(--tvx-radius-sm);
  color: var(--tvx-muted); text-decoration: none;
  border: 2px solid transparent;
}
.tvx-hotbar-slot:hover { color: var(--tvx-text); background: var(--tvx-surface); }
.tvx-hotbar-slot.is-active {
  color: var(--tvx-text); border-color: var(--tvx-primary);
  background: var(--tvx-surface);
  box-shadow: 0 0 12px rgba(70, 224, 168, 0.3), inset 2px 2px 0 var(--tvx-block-hi);
}
.tvx-hotbar-glyph { font-size: 1rem; line-height: 1; }
.tvx-hotbar-text {
  font-family: var(--tvx-font-pixel); font-size: 0.58rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.tvx-hotbar-chip {
  align-self: center; font-family: var(--tvx-font-pixel); font-size: 0.62rem;
  color: var(--tvx-gold); border-left: 2px solid var(--tvx-border);
  padding-left: 10px; margin-left: 2px; white-space: nowrap;
  max-width: 18ch; overflow: hidden; text-overflow: ellipsis;
}
body.has-hotbar .tvx-main { padding-bottom: 92px; }
body.has-hotbar .tvx-footer { padding-bottom: 96px; }
@media (max-width: 600px) {
  .tvx-hotbar-slot { min-width: 52px; padding: 5px 6px; }
  .tvx-hotbar-text { font-size: 0.52rem; }
  .tvx-hotbar-chip { display: none; }
}

/* ---- Character / guild identity -------------------------------------------- */
.tvx-character { text-align: center; }
.tvx-character-avatar { display: inline-block; }
.tvx-character-avatar .tvx-avatar {
  width: 84px; height: 84px; font-size: 2.2rem;
  border-width: 4px;
  box-shadow:
    inset 3px 3px 0 var(--tvx-block-hi),
    inset -3px -3px 0 var(--tvx-block-lo),
    0 0 0 3px var(--tvx-bg-deep),
    0 0 24px rgba(70, 224, 168, 0.25);
}



/* ---- Arena: self row + movement --------------------------------------------- */
.tvx-scoreboard tr.is-self {
  background: linear-gradient(to right, rgba(70, 224, 168, 0.16), transparent 70%);
  box-shadow: inset 3px 0 0 var(--tvx-primary);
}
.tvx-move-chip {
  display: inline-block; font-family: var(--tvx-font-pixel); font-size: 0.6rem;
  color: var(--tvx-gold); border: 2px solid var(--tvx-gold);
  border-radius: var(--tvx-radius-sm); padding: 1px 6px; margin-left: 8px;
  white-space: nowrap;
}

/* ==========================================================================
   v0.4.0 - 3D WORLD TITLE SCREEN
   The homepage background is a real WebGL canvas (static/js/world.js).
   This block owns only the mount, the fallback sky, the menu that sits
   over it, and the entry transition. Every selector is scoped to
   `.tvx-world*` / `.tvx-menu*` / `.tvx-realm-*` and only rendered by
   components/tvx/hero.html + biome-grid.html, so nothing here can leak
   into the challenge board, scoreboard, admin or error pages.

   LAYER ORDER (back to front):
     .tvx-world-fallback   CSS dusk sky - paints FIRST, stays if 3D fails
     .tvx-world-stage      the WebGL canvas (world.js appends it here)
     .tvx-world-scrim      legibility gradient behind the menu column only
     .tvx-world-entryfx    voxel shards for the entry transition
     .tvx-world-inner      the menu
   ========================================================================== */

.tvx-world {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  /* Centred title-screen stack. Was flex-start with the menu pinned to the
   * left third, which read as "webpage with a menu beside it" rather than
   * as a game front end. */
  justify-content: center;
  text-align: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(48px, 8vh, 96px) 0 clamp(72px, 11vh, 104px);
  background: #141a26;
}

/* ---- Fallback sky (always present, hidden behind a ready canvas) ------
   Geometry only. The palette lives in the v0.7.0 fallback block near the
   bottom of this file; the older purple-dusk gradient that used to sit here
   was fully overridden by it and was dead weight. */
.tvx-world-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
html[data-tvx-3d="ready"] .tvx-world-fallback { opacity: 0; }
.tvx-world-fallback { transition: opacity 420ms var(--tvx-ease); }

/* ---- 3D mount ---------------------------------------------------------- */
.tvx-world-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.tvx3d-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  /* The renderer already caps DPR; this keeps the canvas off the
     compositor's scaling path on high-density screens. */
  object-fit: cover;
}
html[data-tvx-3d="loading"] .tvx-world-stage { opacity: 0; }
html[data-tvx-3d="ready"] .tvx-world-stage { opacity: 1; }
.tvx-world-stage { transition: opacity 500ms var(--tvx-ease); }

/* ---- Legibility scrim: weighted to the menu side, not the whole frame - */
.tvx-world-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(100deg,
      rgba(8, 12, 16, 0.80) 0%,
      rgba(8, 12, 16, 0.52) 24%,
      rgba(8, 12, 16, 0.10) 48%,
      rgba(8, 12, 16, 0.0) 68%),
    linear-gradient(to bottom,
      rgba(8, 12, 16, 0.42) 0%,
      rgba(8, 12, 16, 0.0) 26%,
      rgba(8, 12, 16, 0.0) 66%,
      rgba(8, 12, 16, 0.5) 100%);
}
@media (max-width: 900px) {
  .tvx-world-scrim {
    background:
      linear-gradient(to bottom,
        rgba(8, 12, 16, 0.62) 0%,
        rgba(8, 12, 16, 0.3) 30%,
        rgba(8, 12, 16, 0.3) 58%,
        rgba(8, 12, 16, 0.7) 100%);
  }
}

/* ---- Menu ------------------------------------------------------------- */
/* One centred column over the live scene. The scrim behind it is a centred
 * radial (see .tvx-world-scrim), so the world's left and right thirds stay
 * at full brightness - there is no opaque panel anywhere in this block. */
.tvx-world-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  /* min() guards the 390px phone: a fixed 372px column plus padding would
     exceed the viewport and push a horizontal scrollbar onto the page. */
  max-width: min(372px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tvx-world-kicker {
  font-family: var(--tvx-font-pixel);
  color: #ffd98a;
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 0.6rem;
  margin: 0 0 10px;
  /* Optical centring: trailing letter-space pushes centred text right. */
  text-indent: 0.42em;
  /* Sits over bright sky, so it needs its own contrast, not just the scrim. */
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.95),
    0 0 12px rgba(0, 0, 0, 0.9),
    0 2px 10px rgba(0, 0, 0, 0.8);
}

/* The wordmark IS the logo here, so it is sized like one - the previous
   clamp(1.5rem, 3.4vw, 2.3rem) read as a section heading. Capped below the
   column width so the plate never has to clip its own glyphs. */
.tvx-world-title { margin: 0; line-height: 1; }

.tvx-world-tagline {
  color: #d9e8de;
  margin: 12px 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.tvx-menu {
  margin-top: clamp(18px, 3.4vh, 30px);
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
}

/* Blocky pixel-face glyph per action. Pure CSS, 2 tones. */

/* Game-menu button language: neutral grey stone face, hard bottom edge for
   the "pressable" read, lighter face on hover, face inset when pressed.
   Deliberately desaturated - the saturated green of the previous build made
   the row look like a themed web CTA rather than a game menu. The TVX green
   survives as the keyboard-focus ring, which is where it does useful work. */
.tvx-menu-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  /* v1.6.2 nav fix: let a flex pair item shrink below its content box and keep
     the (wide, uppercase, pixel-font) label contained. font-size scales down on
     narrow/paired buttons so long labels like LEADERBOARD/SETTINGS/ACCOUNT fit;
     text-indent compensates the trailing letter-spacing so centered text stays
     centered instead of drifting right out of the rectangle. */
  min-width: 0;
  white-space: nowrap;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  text-indent: 0.09em;
  color: #f1f4f2;
  text-decoration: none;
  /* v0.14.0 button rework.
   *
   * v0.12.0 added a `repeating-linear-gradient(45deg, ...)` dither across the
   * face. On screen that is NOT pixel art: those stripes are several pixels
   * wide, perfectly straight and evenly spaced, so the face reads as diagonal
   * carbon-fibre hatching and the buttons look like generic brushed-metal
   * panels. It is removed outright rather than retuned.
   *
   * A voxel-game menu button is a plain solid slab. All the character comes
   * from the edges: a light upper bevel, a dark lower bevel, a hard dark
   * outer border, and a 4px bottom "side face" that collapses when pressed.
   * The face itself is a controlled vertical value gradient, light at the top
   * to darker at the bottom, and nothing else. */
  background-color: #6b6f74;
  background-image: linear-gradient(to bottom, #8b9096 0%, #71767b 46%, #5d6267 100%);
  border: 2px solid #1b1e21;
  border-bottom-width: 4px;
  border-radius: 0;
  padding: 11px 18px;
  min-height: 44px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.26),
    inset -3px -3px 0 rgba(0, 0, 0, 0.34),
    0 3px 8px rgba(0, 0, 0, 0.4);
  transition:
    background-color 90ms var(--tvx-ease),
    background-image 90ms var(--tvx-ease),
    transform 90ms var(--tvx-ease),
    box-shadow 90ms var(--tvx-ease);
}
.tvx-menu-btn:hover {
  color: #ffffff;
  background-color: #7b8085;
  background-image: linear-gradient(to bottom, #9ba0a6 0%, #7f848a 46%, #6b7075 100%);
  transform: translateY(-1px);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.36),
    inset -3px -3px 0 rgba(0, 0, 0, 0.34),
    0 5px 12px rgba(0, 0, 0, 0.45);
}
.tvx-menu-btn:active,
.tvx-menu-btn.is-pressing {
  /* The face genuinely goes INSET and the bottom side-face collapses: the
     bevel swaps from raised to carved, so the button reads as physically
     pressed rather than merely nudged. */
  transform: translateY(2px);
  border-bottom-width: 2px;
  margin-bottom: 2px;
  background-color: #4c5155;
  background-image: linear-gradient(to bottom, #565b60 0%, #45494e 100%);
  box-shadow:
    inset 3px 3px 0 rgba(0, 0, 0, 0.46),
    inset -2px -2px 0 rgba(255, 255, 255, 0.12);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
/* Keyboard-only ring. 3px solid + offset so it clears the button's own
   bevel and stays visible against both the sky and the dark terrain. */
.tvx-menu-btn:focus-visible {
  outline: 3px solid var(--tvx-primary);
  outline-offset: 3px;
  color: #ffffff;
  background-color: #7b8085;
  background-image: linear-gradient(to bottom, #a2a7ad 0%, #868b91 46%, #72777d 100%);
}
/* v0.12.0: the disabled state existed only as a browser default (a greyed
   text colour), which left the raised face looking fully interactive. The
   face flattens and the bevel inverts so it reads as "not available". */
.tvx-menu-btn:disabled,
.tvx-menu-btn[aria-disabled="true"] {
  cursor: not-allowed;
  color: #868b90;
  background-color: #3a3e42;
  background-image: linear-gradient(to bottom, #43474b 0%, #34383c 100%);
  border-color: #14171a;
  border-bottom-width: 2px;
  transform: none;
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.42),
    inset -2px -2px 0 rgba(255, 255, 255, 0.05);
  text-shadow: none;
}
.tvx-menu-btn:disabled:hover,
.tvx-menu-btn[aria-disabled="true"]:hover {
  transform: none;
  color: #868b90;
  background-color: #3a3e42;
}

/* PLAY: one step brighter than the rest plus a gold hairline, so the primary
   action is obvious without turning the stack into a colour-coded dashboard.
   v0.14.0: the face language is IDENTICAL to every other button - same gray
   slab, same bevel geometry, same square corners. It is promoted by size and a
   restrained gold top edge only, never by turning into a neon green slab. */
.tvx-menu-primary {
  padding: 15px 20px;
  font-size: 1.06rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: #ffffff;
  background-color: #767b80;
  background-image: linear-gradient(to bottom, #979ca2 0%, #7c8187 46%, #686d72 100%);
  border-color: #1b1e21;
  border-top-color: var(--tvx-gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.30),
    inset -3px -3px 0 rgba(0, 0, 0, 0.34),
    0 3px 0 rgba(0, 0, 0, 0.45),
    0 0 22px rgba(255, 200, 87, 0.12);
}
.tvx-menu-primary:hover {
  color: #ffffff;
  background-color: #868b90;
  background-image: linear-gradient(to bottom, #a8adb3 0%, #8b9096 46%, #767b80 100%);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.40),
    inset -3px -3px 0 rgba(0, 0, 0, 0.32),
    0 5px 0 rgba(0, 0, 0, 0.45),
    0 0 26px rgba(255, 200, 87, 0.18);
}

/* ---- Status strip (real data only) ------------------------------------ */

.tvx-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(8, 12, 10, 0.66);
  border: 1px solid rgba(146, 172, 158, 0.3);
  color: #d8e6dd;
}
.tvx-status-key { color: #93ab9e; }
.tvx-status-val { color: #eef5ef; font-weight: 700; }
.tvx-status-muted .tvx-status-val { color: #9db3a8; font-weight: 400; }
.tvx-status-sep { color: #6b7f74; margin: 0 3px; }
/* Square dot + ring, so "online" is not carried by hue alone. */
.tvx-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.28);
  vertical-align: middle;
}
.tvx-status-online { color: #9ff0bf; }

/* ---- Realm art (Choose Your Realm cards) ------------------------------ */
.tvx-biome .tvx-biome-art {
  position: relative;
  height: 88px;
  border-bottom: 2px solid var(--tvx-border);
  background: linear-gradient(to bottom, rgba(70, 90, 80, 0.5), #10161c);
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 58%),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--biome) 26%, #0d1118) 0%, #10161c 100%);
  overflow: hidden;
}
.tvx-biome .tvx-biome-art::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(to bottom, var(--biome), rgba(0, 0, 0, 0.55));
  background:
    linear-gradient(to bottom,
      color-mix(in srgb, var(--biome) 62%, #000) 0%,
      color-mix(in srgb, var(--biome) 26%, #000) 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.32);
}
.tvx-realm-crypto .tvx-biome-art { --tvx-r-sil: 24px; }
.tvx-realm-forensics .tvx-biome-art { --tvx-r-sil: 56px; }
.tvx-realm-osint .tvx-biome-art { --tvx-r-sil: 32px; }
.tvx-realm-reverse .tvx-biome-art { --tvx-r-sil: 48px; }
.tvx-realm-web .tvx-biome-art { --tvx-r-sil: 40px; }
.tvx-realm-pwn .tvx-biome-art { --tvx-r-sil: 64px; }
.tvx-realm-misc .tvx-biome-art { --tvx-r-sil: 36px; }

.tvx-biome .tvx-biome-art::after {
  content: "";
  position: absolute;
  left: 8%;
  bottom: 42%;
  width: var(--tvx-r-sil, 40px);
  height: calc(var(--tvx-r-sil, 40px) * 0.9);
  background: var(--biome);
  background: color-mix(in srgb, var(--biome) 88%, #000);
  box-shadow:
    calc(var(--tvx-r-sil, 40px) * 0.22) calc(var(--tvx-r-sil, 40px) * -0.5) 0 0
      color-mix(in srgb, var(--biome) 62%, #000),
    calc(var(--tvx-r-sil, 40px) * 0.46) calc(var(--tvx-r-sil, 40px) * -0.95) 0 0
      color-mix(in srgb, var(--biome) 40%, #000),
    calc(var(--tvx-r-sil, 40px) * 1.5) 0 0 0
      color-mix(in srgb, var(--biome) 55%, #000),
    calc(var(--tvx-r-sil, 40px) * 1.8) calc(var(--tvx-r-sil, 40px) * -0.4) 0 0
      color-mix(in srgb, var(--biome) 38%, #000);
  opacity: 0.9;
}
.tvx-biome:hover .tvx-biome-art::after,
.tvx-biome:focus-visible .tvx-biome-art::after { filter: brightness(1.35); }
.tvx-biome:hover .tvx-biome-art { border-bottom-color: var(--biome); }
.tvx-biome.is-selected .tvx-biome-art::after {
  filter: brightness(1.45) saturate(1.15);
}
.tvx-biome.is-selected .tvx-biome-name::after {
  content: " · active";
  font-family: var(--tvx-font-pixel);
  font-size: 0.6rem;
  color: var(--tvx-gold);
  letter-spacing: 0.1em;
}

/* ---- PLAY transition: 3D dolly + voxel shards + veil ------------------ */
/* shell.js owns navigation and sets `tvx-world-entering`; world.js watches
   that class to run the camera dolly. The veil/shards are CSS, so the
   transition still completes even if the renderer died. */
body.tvx-world-entering .tvx-world-stage,
body.tvx-world-entering .tvx-world-fallback {
  animation: tvx-world-push 760ms cubic-bezier(0.5, 0, 0.25, 1) forwards;
}
@keyframes tvx-world-push {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.12); opacity: 0; }
}
body.tvx-world-entering .tvx-world-inner {
  animation: tvx-menu-out 320ms var(--tvx-ease) forwards;
}
@keyframes tvx-menu-out {
  0% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateX(-24px); }
}

.tvx-world-entryfx {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.tvx-entry-block {
  position: absolute;
  width: var(--tvx-entry-size, 18px);
  height: var(--tvx-entry-size, 18px);
  left: var(--tvx-entry-x, 50%);
  top: var(--tvx-entry-y, 50%);
  background: var(--tvx-entry-color, #46e0a8);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3),
              inset 0 -3px 0 rgba(0, 0, 0, 0.3);
  opacity: 0;
  will-change: transform, opacity;
}
body.tvx-world-entering .tvx-entry-block {
  animation: tvx-block-fly var(--tvx-entry-dur, 620ms) cubic-bezier(0.2, 0.75, 0.3, 1) forwards;
}
@keyframes tvx-block-fly {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.95; }
  100% {
    transform: translate3d(var(--tvx-entry-dx, 0), var(--tvx-entry-dy, -40px), 0) scale(0.35);
    opacity: 0;
  }
}

.tvx-veil.is-world-entry {
  background:
    linear-gradient(to bottom,
      rgba(18, 28, 24, 0) 0 10%,
      rgba(22, 34, 30, 0.5) 10% 24%,
      rgba(18, 30, 26, 0.84) 24% 60%,
      rgba(10, 18, 16, 0.97) 60% 100%),
    radial-gradient(120% 90% at 50% 110%,
      var(--tvx-veil-tint, #46e0a8) 0%, transparent 58%);
  background-size: 100% 400%, 100% 100%;
  background-position: 0 100%, 0 0;
}
.tvx-veil.is-world-entry.is-covering {
  animation: tvx-block-wipe 760ms cubic-bezier(0.5, 0, 0.25, 1) forwards;
}
@keyframes tvx-block-wipe {
  from { background-position: 0 100%, 0 0; }
  to { background-position: 0 0%, 0 0; }
}

/* ---- Hotbar: restrained, Minecraft-shaped, real links only ----------- */
.tvx-hotbar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  align-items: stretch;
  gap: 3px;
  background: linear-gradient(to bottom, #2c332e, #1a1f1c);
  border: 2px solid #12100e;
  border-bottom-width: 4px;
  border-radius: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), inset 2px 2px 0 rgba(255, 255, 255, 0.1);
  padding: 4px;
  max-width: calc(100vw - 24px);
}
.tvx-hotbar-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 66px;
  padding: 5px 10px;
  color: #9db3a8;
  text-decoration: none;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.03);
}
.tvx-hotbar-slot:hover {
  color: #eef5ef;
  background: rgba(255, 255, 255, 0.09);
  border-color: #4d6355;
}
.tvx-hotbar-slot.is-active {
  color: #f6faf4;
  border-color: #12100e;
  background: linear-gradient(to bottom, #4d6055, #35443a);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.16);
}
.tvx-hotbar-glyph { font-size: 0.95rem; line-height: 1; }
.tvx-hotbar-text {
  font-family: var(--tvx-font-pixel);
  font-size: 0.54rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tvx-hotbar-chip {
  align-self: center;
  font-family: var(--tvx-font-pixel);
  font-size: 0.58rem;
  color: var(--tvx-gold);
  border-left: 2px solid #4d6355;
  padding-left: 9px;
  margin-left: 2px;
  white-space: nowrap;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.has-hotbar .tvx-main { padding-bottom: 88px; }
body.has-hotbar .tvx-footer { padding-bottom: 92px; }

/* ---- Pause nonessential motion while the tab is hidden ---------------- */
html[data-tvx-tab="hidden"] .tvx-world *,
html[data-tvx-tab="hidden"] .tvx-ambient .tvx-mote {
  animation-play-state: paused !important;
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 900px) {
  /* Centre the menu and let the world sit behind it. */
  .tvx-world {
    justify-content: center;
    min-height: auto;
    padding: 72px 0 92px;
  }
  .tvx-world-inner {
    max-width: 420px;
    margin-left: 0;
    text-align: center;
    padding: 0 16px;
  }
  
  .tvx-world-tagline { font-size: 0.82rem; }
  
  .tvx-biome .tvx-biome-art { height: 76px; }
}
@media (max-width: 560px) {
  .tvx-world { padding: 60px 0 84px; }
  .tvx-world-kicker { letter-spacing: 0.24em; font-size: 0.56rem; }
  
  
  .tvx-status-chip { padding: 3px 7px; }
}
/* Short viewports (laptop, 1366x768): keep PLAY on screen. */
@media (min-width: 901px) and (max-height: 780px) {
  .tvx-world { padding: 32px 0 56px; }
  
  .tvx-menu { margin-top: 14px; }
  .tvx-menu-primary { padding: 12px 18px; }
  
}
@media (max-width: 600px) {
  .tvx-hotbar-slot { min-width: 54px; padding: 5px 7px; }
  .tvx-hotbar-text { font-size: 0.5rem; }
  .tvx-hotbar-chip { display: none; }
}

/* ---- Motion preferences ----------------------------------------------- */
/* Reduced motion: three.js is never fetched (home.js gate), the fallback
   sky stays, and the entry animation is skipped so navigation is instant. */
@media (prefers-reduced-motion: reduce) {
  .tvx-world-stage, .tvx-world-fallback { transition: none; }
  body.tvx-world-entering .tvx-world-stage,
  body.tvx-world-entering .tvx-world-fallback { animation: none !important; }
  body.tvx-world-entering .tvx-world-inner { animation: none !important; }
  .tvx-world-entryfx { display: none; }
}
html[data-tvx-motion="reduced"] .tvx-world-stage,
html[data-tvx-motion="reduced"] .tvx-world-fallback { transition: none; }
html[data-tvx-motion="reduced"] body.tvx-world-entering .tvx-world-stage,
html[data-tvx-motion="reduced"] body.tvx-world-entering .tvx-world-fallback,
html[data-tvx-motion="reduced"] body.tvx-world-entering .tvx-world-inner {
  animation: none !important;
}
html[data-tvx-motion="reduced"] .tvx-world-entryfx { display: none; }

/* ==========================================================================
   v0.8.1 - HOMEPAGE POLISH
   Everything here is scoped to pages that contain `.tvx-world` (the title
   screen). Challenges, scoreboard, profile, auth and admin keep the normal
   solid navbar and spacing. `:has()` is the primary hook; `body.tvx-is-home`
   (added by home.js) covers browsers without it. The two blocks below are
   identical on purpose: a selector list containing an unsupported :has()
   would be dropped whole, so they cannot be merged.
   ========================================================================== */

/* -- Navbar becomes a translucent overlay on the title screen only. Same
      links, same markup, same auth behaviour; it just stops being a heavy
      bar that fights the scene. -- */
body.tvx:has(.tvx-world) .tvx-nav {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, rgba(8, 12, 16, 0.78), rgba(8, 12, 16, 0));
  border-bottom: 0;
}
body.tvx:has(.tvx-world) .tvx-nav a,
body.tvx:has(.tvx-world) .tvx-nav button.tvx-nav-link { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85); }
body.tvx:has(.tvx-world) .tvx-main { padding: 0; }
body.tvx:has(.tvx-world) .tvx-world { padding-top: clamp(72px, 11vh, 120px); }

body.tvx-is-home .tvx-nav {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, rgba(8, 12, 16, 0.78), rgba(8, 12, 16, 0));
  border-bottom: 0;
}
body.tvx-is-home .tvx-nav a,
body.tvx-is-home .tvx-nav button.tvx-nav-link { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85); }
body.tvx-is-home .tvx-main { padding: 0; }
body.tvx-is-home .tvx-world { padding-top: clamp(72px, 11vh, 120px); }

/* Mobile dropdown must stay solid so links stay readable over the scene. */
@media (max-width: 900px) {
  body.tvx:has(.tvx-world) .tvx-nav.open .tvx-nav-links { background: rgba(8, 12, 16, 0.96); }
  body.tvx-is-home .tvx-nav.open .tvx-nav-links { background: rgba(8, 12, 16, 0.96); }
}

/* -- Vertical title-screen menu: PLAY, then a single column of actions.
      (Authoritative single-column rule now lives with .tvx-menu-secondary
      in the menu block; this used to be a second, conflicting definition.) -- */

/* -- 3D failure/unsupported: remove the canvas entirely so the composed CSS
      fallback below is what the visitor sees (never a black rectangle). -- */
html[data-tvx-3d="failed"] .tvx-world-stage,
html[data-tvx-3d="unsupported"] .tvx-world-stage { display: none; }

/* -- Fallback scene (v0.8.1) ------------------------------------------------
   Layered CSS voxel scene that mirrors the WebGL composition.

   WHY THIS EXISTS: measured live against the running Docker CTFd, the 3D
   world reaches data-tvx-3d="ready" in 1.1-2.7s (6/6 runs, zero errors) and
   renders correctly. But this fallback is what every visitor sees DURING
   that window, and permanently whenever webglAvailable() is false -
   hardware acceleration off, WebGL blocked, old browser. The previous
   fallback was one flat gradient plus two stepped bands: it read as a blue
   sky over green/brown stripes with no village and no trees, which is
   exactly what a live screenshot of the loading state looks like.

   Palette is taken from the 3D scene constants so the crossfade between
   fallback and canvas is not a colour jump:
     sky 3b6ab0 / 8fb0d8 / f3c995, rock 6f6a74, grass 5f9147, dirt 7a5c3a */
.tvx-fb {
  position: absolute;
  display: block;
  pointer-events: none;
}

.fb-sky {
  inset: 0;
  background: linear-gradient(to bottom,
    #2d5a9c 0%, #6f9ad2 30%, #a8c2e0 52%, #f0c091 74%, #f6cfa2 100%);
}
/* low sun sitting behind the range, matching the 3D key light */
.fb-sky::after {
  content: "";
  position: absolute;
  left: 58%; top: 34%;
  width: 34vmin; height: 34vmin;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(255, 241, 205, 0.95) 0%, rgba(255, 214, 150, 0.45) 42%,
    rgba(255, 200, 130, 0) 72%);
}

/* blocky cloud slabs - stepped edges, like the 3D clouds */
.fb-clouds {
  left: -4%; right: -4%; top: 6%; height: 20%;
  background:
    linear-gradient(#ffffff, #f2ece2) 4% 46% / 14% 34% no-repeat,
    linear-gradient(#ffffff, #ece6dc) 24% 12% / 9% 26% no-repeat,
    linear-gradient(#ffffff, #f4eee6) 44% 62% / 17% 30% no-repeat,
    linear-gradient(#ffffff, #e9e3da) 68% 24% / 11% 28% no-repeat,
    linear-gradient(#ffffff, #f3ede5) 86% 54% / 13% 32% no-repeat;
  opacity: 0.82;
  clip-path: polygon(0 100%, 0 46%, 9% 46%, 9% 22%, 16% 22%, 16% 54%, 27% 54%,
    27% 10%, 35% 10%, 35% 40%, 44% 40%, 44% 64%, 55% 64%, 55% 18%, 63% 18%,
    63% 48%, 72% 48%, 72% 28%, 81% 28%, 81% 60%, 90% 60%, 90% 34%, 100% 34%,
    100% 100%);
}

/* distant range: stepped peaks in the 3D rock grey. Sits high in frame to
   match where the 3D range sits relative to the horizon. */
.fb-range {
  left: -2%; right: -2%; bottom: 44%; height: 24%;
  background: linear-gradient(#7d7684 0%, #655f6c 100%);
  clip-path: polygon(0 100%, 0 62%, 5% 62%, 5% 40%, 10% 40%, 10% 22%, 15% 22%,
    15% 50%, 22% 50%, 22% 30%, 28% 30%, 28% 66%, 34% 66%, 34% 26%, 39% 26%,
    39% 8%, 44% 8%, 44% 38%, 52% 38%, 52% 18%, 57% 18%, 57% 54%, 64% 54%,
    64% 24%, 70% 24%, 70% 44%, 76% 44%, 76% 14%, 81% 14%, 81% 36%, 88% 36%,
    88% 20%, 93% 20%, 93% 52%, 100% 52%, 100% 100%);
}
/* snow caps: real triangular peaks sitting on the range crest.
   v0.8.1 took two attempts. First was a polygon of long horizontal runs
   (one wide white bar); second closed the polygon at 100%, which filled
   everything BELOW the peaks as a solid white wall. A cap only needs the
   zigzag between the baseline (46%) and the peaks - clip-path closes the
   shape for us, so the polygon must not run down to 100%. */
.fb-snow {
  left: 10%; right: 8%; bottom: 55%; height: 11%;
  background: linear-gradient(#f6f8fc, #dde4ee);
  clip-path: polygon(0 46%, 6% 8%, 12% 46%, 20% 46%, 26% 0, 32% 46%,
    44% 46%, 50% 14%, 56% 46%, 68% 46%, 74% 4%, 80% 46%, 90% 46%,
    95% 18%, 100% 46%);
}

/* mid hills: green, stepped, never flat */
.fb-hills {
  left: -2%; right: -2%; bottom: 32%; height: 20%;
  background: linear-gradient(#5d8a48 0%, #456f36 100%);
  clip-path: polygon(0 100%, 0 56%, 7% 56%, 7% 34%, 14% 34%, 14% 48%, 22% 48%,
    22% 26%, 29% 26%, 29% 44%, 38% 44%, 38% 22%, 46% 22%, 46% 40%, 55% 40%,
    55% 20%, 63% 20%, 63% 46%, 72% 46%, 72% 28%, 80% 28%, 80% 42%, 89% 42%,
    89% 24%, 100% 24%, 100% 100%);
}

/* foreground ground.
   v0.8.1 took two attempts to stop the "broad horizontal band" symptom.
   1st: height 22% left y 630-702 uncovered, and the SKY layer's warm
        bottom stop showed through it as a flat tan stripe.
   2nd: height 30% but the clip-path still began at 62% from the top, so
        only the bottom third of the element actually painted - same gap.
   This version starts the stepped top edge at 0-13% of a 34%-tall element,
   so the ground physically overlaps the hills and no sky can show under it. */
.fb-ground {
  left: 0; right: 0; bottom: 0; height: 34%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 22px, rgba(0,0,0,0.05) 22px 44px),
    linear-gradient(#63a04c 0 34%, #55893f 34% 42%,
      #7a5c3a 42% 70%, #63482c 70% 84%, #4d4a52 84% 100%);
  clip-path: polygon(0 100%, 0 13%, 6% 13%, 6% 4%, 13% 4%, 13% 11%,
    21% 11%, 21% 2%, 28% 2%, 28% 9%, 36% 9%, 36% 0%, 44% 0%, 44% 7%,
    53% 7%, 53% 3%, 61% 3%, 61% 8%, 70% 8%, 70% 4%, 78% 4%, 78% 10%,
    87% 10%, 87% 5%, 94% 5%, 94% 12%, 100% 12%, 100% 100%);
}
/* a second terrace tier in front of the ground, offset so the steps read */
.fb-terrace {
  left: 0; right: 0; bottom: 0; height: 12%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.07) 0 2px, transparent 2px 26px),
    linear-gradient(#6fae52 0 44%, #4e7c3a 44% 52%, #6b4f30 52% 100%);
  clip-path: polygon(0 100%, 0 56%, 12% 56%, 12% 30%, 26% 30%, 26% 50%, 40% 50%,
    40% 24%, 54% 24%, 54% 46%, 68% 46%, 68% 28%, 82% 28%, 82% 52%, 100% 52%,
    100% 100%);
}

/* forest on the left: stepped conifer treeline.
   v0.8.1 attempt: eight background strips clipped by a zigzag, which cut
   ACROSS the strips and produced green vertical bars rather than trees. A
   treeline is simpler as one shape: a zigzag of triangular teeth filled by
   a vertical green gradient, so every tooth reads as a conifer. */
.fb-trees {
  left: -2%; right: 34%; bottom: 20%; height: 30%;
  background: linear-gradient(#2f5f38 0%, #2a5333 46%, #1e4026 100%);
  clip-path: polygon(0 100%, 0 72%, 5% 72%, 5% 34%, 7% 6%, 9% 34%, 9% 62%,
    14% 62%, 14% 30%, 16% 2%, 18% 30%, 18% 58%, 23% 58%, 23% 38%, 25% 10%,
    27% 38%, 27% 66%, 32% 66%, 32% 32%, 34% 4%, 36% 32%, 36% 60%, 41% 60%,
    41% 36%, 43% 12%, 45% 36%, 45% 64%, 50% 64%, 50% 30%, 52% 8%, 54% 30%,
    54% 62%, 59% 62%, 59% 40%, 61% 16%, 63% 40%, 63% 66%, 68% 66%, 68% 34%,
    70% 10%, 72% 34%, 72% 62%, 77% 62%, 77% 38%, 79% 14%, 81% 38%, 81% 64%,
    86% 64%, 86% 32%, 88% 8%, 90% 32%, 90% 60%, 95% 60%, 95% 40%, 97% 20%,
    100% 40%, 100% 100%);
}

/* village on the right, matching where the 3D camera frames it. Kept fully
   inside the frame: the first attempt was clipped at the right edge. */
.fb-village {
  right: 5%; bottom: 24%; width: 32%; height: 19%;
}
.fb-house {
  position: absolute;
  bottom: 0;
  display: block;
  /* walls */
  background: linear-gradient(#8a6a3e 0 62%, #6d5230 62% 100%);
  /* stepped gable roof */
  clip-path: polygon(0 100%, 0 58%, 14% 58%, 14% 42%, 28% 42%, 28% 26%,
    42% 26%, 42% 12%, 58% 12%, 58% 26%, 72% 26%, 72% 42%, 86% 42%, 86% 58%,
    100% 58%, 100% 100%);
}
.fb-house i {
  position: absolute;
  left: 26%; bottom: 34%;
  width: 8%; height: 17%;
  display: block;
  background: #ffcf7a;
  box-shadow:
    52px 0 0 #ffbe5e,          /* second window          */
    26px 17px 0 #ffd98f,       /* upper storey window    */
    52px 17px 0 #ffc36a;       /* upper storey, 2nd bay  */
  /* cobble foundation strip */
  border-bottom: 6px solid #8e9199;
}
.fb-h1 { left: 2%;  width: 27%; height: 78%; }
.fb-h2 { left: 33%; width: 34%; height: 100%; }
.fb-h3 { left: 71%; width: 24%; height: 66%; }

/* Keep the legacy ::before/::after hooks inert so nothing double-paints. */
.tvx-world-fallback::before,
.tvx-world-fallback::after { content: none; }

/* The legibility scrim exists to protect menu text over the BUSY 3D scene.
   Over the calm CSS fallback that same radial is just a dark smudge across
   the sky, so the strong centre-weighted layer is applied only once the
   canvas is actually live; the fallback keeps only the edge gradients. */
.tvx-world-scrim {
  background: linear-gradient(to bottom,
    rgba(8, 12, 16, 0.46) 0%,
    rgba(8, 12, 16, 0.0) 22%,
    rgba(8, 12, 16, 0.0) 72%,
    rgba(8, 12, 16, 0.42) 100%);
}
/* Sized to the menu column's real extent (~372px wide, ~58% of a 900px
   viewport tall), not a generic centre blob, and falls to zero well inside
   the frame edges so the left and right thirds keep full brightness. */
html[data-tvx-3d="ready"] .tvx-world-scrim {
  background:
    radial-gradient(38% 56% at 50% 50%,
      rgba(6, 10, 9, 0.72) 0%,
      rgba(6, 10, 9, 0.46) 58%,
      rgba(6, 10, 9, 0.0) 82%),
    linear-gradient(to bottom,
      rgba(8, 12, 16, 0.46) 0%,
      rgba(8, 12, 16, 0.0) 22%,
      rgba(8, 12, 16, 0.0) 72%,
      rgba(8, 12, 16, 0.42) 100%);
}
@media (max-width: 900px) {
  .tvx-world-scrim {
    background:
      linear-gradient(to bottom,
        rgba(8, 12, 16, 0.40) 0%,
        rgba(8, 12, 16, 0.22) 30%,
        rgba(8, 12, 16, 0.30) 58%,
        rgba(8, 12, 16, 0.70) 100%);
  }
}

/* v0.8.1: on phones the title screen must still fill the viewport so the
   world is visible behind the menu (the 0.5.x rule let it shrink to the
   menu's height, leaving a black band and a cropped scene). */
@media (max-width: 900px) {
  body.tvx:has(.tvx-world) .tvx-world { min-height: 100vh; min-height: 100svh; }
  body.tvx-is-home .tvx-world { min-height: 100vh; min-height: 100svh; }
}

/* =======================================================================
   v0.10.0 - Game screens, settings UI, preference-driven presentation.

   Everything below is scoped to the TVX game shell (body.tvx-is-home and the
   #tvx-screens container). It does not touch CTFd routes, challenge pages or
   the account settings screen.
   ======================================================================= */

/* ---- UI scale ---------------------------------------------------------
   Applied as a CSS variable on <html> by home.js from the stored preference.
   Font-size based (not transform) so text reflows and stays selectable, and
   so rem-based CTFd components scale too. Clamped to the 80-120% the
   Settings screen allows. */
:root {
  --tvx-ui-scale: 1;
}

/* ---- Screen shell ------------------------------------------------------ */
/* Absolute inset, NOT height:100%: .tvx-world only has min-height, so a
   percentage height here collapses to 0 and the absolutely-positioned screens
   inside end up laid out but not hit-testable - clicks fall through to
   .tvx-world. Matching the sibling layers (stage/scrim) avoids that. */
.tvx-screens {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: block;
  pointer-events: auto;
}

.tvx-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* flex-start, NOT center: with `center` a frame taller than the viewport
     overflows above the scroll origin and its header becomes unreachable
     ("element is outside of the viewport"). The frame's own `margin: auto`
     centres it when it fits and top-aligns it safely when it does not. */
  justify-content: flex-start;
  padding: clamp(12px, 2.4vh, 28px);
  overflow: auto;
  overscroll-behavior: contain;
}

/* Hidden screens must not be reachable by keyboard or read by AT. */
.tvx-screen[hidden] {
  display: none !important;
}

.tvx-screen-frame {
  width: min(1180px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 18px);
}

/* Every game screen must clear the floating navbar, or the screen heading
   renders underneath it (the world-select title collided with the logo). */
@media (min-width: 901px) {
  .tvx-screen { padding-top: clamp(64px, 8vh, 92px); }
  .tvx-screen-menu { padding-top: clamp(64px, 8vh, 92px); }
}
/* The navbar stacks into two rows on narrow screens and is taller, so the
   heading needs more clearance there or it lands behind the logo + Menu. */
@media (max-width: 900px) {
  .tvx-screen { padding-top: clamp(92px, 15vh, 140px); }
}

/* Keep the world-select composition inside one viewport: the realm list
   scrolls internally instead of pushing the screen taller than the fold. */
.tvx-worlds-body { max-height: min(62vh, 560px); }
.tvx-realm-list { max-height: min(62vh, 560px); }

/* Short/landscape phones: allow the frame to scroll instead of clipping. */
@media (max-height: 560px) {
  .tvx-screen { align-items: flex-start; }
}

/* ---- Screen header ----------------------------------------------------- */
.tvx-screen-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--tvx-border);
}

.tvx-screen-kicker {
  margin: 0;
  font-size: calc(0.72rem * var(--tvx-ui-scale));
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--tvx-muted);
}

.tvx-screen-title {
  margin: 2px 0 0;
  font-size: calc(1.9rem * var(--tvx-ui-scale));
  line-height: 1.1;
  color: var(--tvx-text);
  text-shadow: 3px 3px 0 var(--tvx-shadow, rgba(0, 0, 0, 0.65));
}

.tvx-screen-title:focus { outline: none; }
.tvx-screen-title:focus-visible {
  outline: 3px solid var(--tvx-accent, #4de3ff);
  outline-offset: 4px;
}

.tvx-screen-subtitle {
  margin: 0 0 8px;
  font-size: calc(1rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
}

.tvx-screen-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Tabs -------------------------------------------------------------- */
.tvx-tabs {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.tvx-tab {
  font: inherit;
  font-size: calc(0.86rem * var(--tvx-ui-scale));
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 20px;
  color: var(--tvx-muted);
  background: var(--tvx-surface-2);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-bottom-width: 3px;
  cursor: pointer;
  /* Selected state is not colour-only: it also gains a bottom rail, bold
     weight and an inset marker, so it survives greyscale / colour blindness. */
  position: relative;
}

.tvx-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: transparent;
}

.tvx-tab.is-active {
  color: var(--tvx-text);
  background: var(--tvx-elevated);
  border-color: var(--tvx-border-bright);
  font-weight: 700;
}

.tvx-tab.is-active::after { background: var(--tvx-accent, #4de3ff); }

.tvx-tab:focus-visible {
  outline: 3px solid var(--tvx-accent, #4de3ff);
  outline-offset: 2px;
}

/* ---- World select ------------------------------------------------------ */
.tvx-worlds-body {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: clamp(10px, 1.4vw, 18px);
  /* Size each column to its content so the details panel no longer stretches
     to the tall realm list and leaves a large empty area; it now fits its
     content (min 280px) and scrolls internally only when a realm is full. */
  align-items: start;
  min-height: 0;
  overflow: hidden;
}
.tvx-explorer { max-height: min(62vh, 560px); min-height: 280px; }
.tvx-explorer-view[data-tvx-view="collection"] { overflow-y: auto; }

@media (max-width: 860px) {
  .tvx-worlds-body { grid-template-columns: 1fr; }
}

.tvx-realm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  max-height: min(58vh, 520px);
}

.tvx-realm-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  text-align: left;
  padding: 9px 10px;
  color: var(--tvx-text);
  background: var(--tvx-surface-2);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-left: 5px solid var(--realm-accent, var(--tvx-border-bright));
  cursor: pointer;
  position: relative;
}

.tvx-realm-btn:hover {
  background: var(--tvx-elevated);
  border-color: var(--tvx-border-bright);
}

/* Selection marker: a filled caret, not just a colour change. */
.tvx-realm-marker {
  width: 10px;
  height: 18px;
  flex: none;
  background: transparent;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.tvx-realm-btn.is-selected {
  background: var(--tvx-elevated);
  border-color: var(--tvx-border-bright);
  border-left-width: 5px;
  box-shadow: inset 0 0 0 2px var(--realm-accent, var(--tvx-border-bright));
}

.tvx-realm-btn.is-selected .tvx-realm-marker {
  background: var(--realm-accent, var(--tvx-border-bright));
}

.tvx-realm-btn.is-selected .tvx-realm-name { text-decoration: underline; }

.tvx-realm-btn:focus-visible {
  outline: 3px solid var(--tvx-accent, #4de3ff);
  outline-offset: 2px;
}

.tvx-realm-icon {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--realm-accent, var(--tvx-text));
}
.tvx-realm-icon svg { width: 100%; height: 100%; display: block; }

.tvx-realm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tvx-realm-name { font-weight: 700; font-size: calc(0.95rem * var(--tvx-ui-scale)); }
.tvx-realm-badge {
  font-size: calc(0.68rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tvx-realm-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--tvx-surface-2);
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

/* Original voxel horizon preview, tinted per realm by --realm-accent.
   A stepped blocky skyline drawn once as a masked SVG and tinted through
   `background-color`, so one silhouette serves all seven realms and the
   colour still follows the selection. Repeating-linear-gradient was tried
   first and read as a barcode, not as terrain. */
.tvx-realm-preview-art {
  position: relative;
  height: clamp(88px, 17vh, 160px);
  flex: none;
  border-bottom: var(--tvx-border-width) solid var(--tvx-border);
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--realm-accent) 16%, #0b1017),
    #05080c 70%);
  overflow: hidden;
}

.tvx-realm-preview-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--realm-accent);
  -webkit-mask-image: var(--tvx-skyline);
  mask-image: var(--tvx-skyline);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  opacity: 0.85;
  transition: background-color 200ms var(--tvx-ease, ease);
}

/* Stepped horizon: hills, a watchtower and two conifers, all axis-aligned
   blocks. Purely decorative and already inside an aria-hidden span. */
.tvx-realm-preview-art {
  --tvx-skyline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 60' shape-rendering='crispEdges'%3E%3Cg fill='%23000'%3E%3Crect x='0' y='46' width='160' height='14'/%3E%3Crect x='6' y='38' width='22' height='8'/%3E%3Crect x='11' y='31' width='12' height='7'/%3E%3Crect x='36' y='42' width='30' height='4'/%3E%3Crect x='42' y='33' width='18' height='9'/%3E%3Crect x='118' y='36' width='26' height='10'/%3E%3Crect x='124' y='27' width='14' height='9'/%3E%3Crect x='96' y='36' width='4' height='10'/%3E%3Crect x='89' y='26' width='18' height='10'/%3E%3Crect x='92' y='19' width='12' height='7'/%3E%3Crect x='68' y='14' width='11' height='32'/%3E%3Crect x='63' y='9' width='21' height='5'/%3E%3Crect x='148' y='40' width='4' height='6'/%3E%3Crect x='142' y='33' width='16' height='7'/%3E%3C/g%3E%3C/svg%3E");
}

.tvx-realm-preview-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.tvx-realm-preview-name {
  margin: 0;
  font-size: calc(1.25rem * var(--tvx-ui-scale));
  color: var(--tvx-text);
}

.tvx-realm-preview-desc {
  margin: 0;
  color: var(--tvx-muted);
  font-size: calc(0.92rem * var(--tvx-ui-scale));
}

.tvx-realm-preview-meta {
  margin: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tvx-realm-preview-hint {
  margin: 0;
  font-size: calc(0.76rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
}

.tvx-realm-count {
  font-size: calc(0.72rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
  border: 1px solid var(--tvx-border);
  padding: 1px 7px;
}
.tvx-realm-count[hidden] { display: none; }

/* ---- Servers ----------------------------------------------------------- */
.tvx-servers-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}
.tvx-servers-body[hidden] { display: none; }

.tvx-servers-note,
.tvx-servers-footnote {
  margin: 0;
  padding: 10px 12px;
  background: var(--tvx-surface-2);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-left: 5px solid var(--tvx-border-bright);
  color: var(--tvx-muted);
  font-size: calc(0.88rem * var(--tvx-ui-scale));
}

.tvx-server-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.tvx-server-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  align-items: center;
  padding: 14px;
  background: var(--tvx-surface-2);
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  border-left: 5px solid var(--tvx-accent, #4de3ff);
}

.tvx-server-main { display: flex; flex-direction: column; gap: 2px; }
.tvx-server-name { font-weight: 700; font-size: calc(1.02rem * var(--tvx-ui-scale)); }
.tvx-server-kind {
  font-size: calc(0.74rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tvx-server-facts {
  grid-column: 1 / -1;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0;
}
.tvx-server-fact { display: flex; flex-direction: column; gap: 2px; }
.tvx-server-fact dt {
  font-size: calc(0.68rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.tvx-server-fact dd {
  margin: 0;
  font-family: var(--tvx-font-pixel);
  font-size: calc(0.84rem * var(--tvx-ui-scale));
}

/* ---- Settings ---------------------------------------------------------- */
.tvx-settings-body {
  display: grid;
  grid-template-columns: minmax(150px, 200px) 1fr;
  gap: clamp(10px, 1.4vw, 18px);
  align-items: start;
}

@media (max-width: 760px) {
  .tvx-settings-body { grid-template-columns: 1fr; }
}

.tvx-settings-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

@media (max-width: 760px) {
  .tvx-settings-nav { flex-direction: row; flex-wrap: wrap; }
}

.tvx-set-tab {
  font: inherit;
  font-size: calc(0.86rem * var(--tvx-ui-scale));
  text-align: left;
  padding: 9px 12px;
  color: var(--tvx-muted);
  background: var(--tvx-surface-2);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-left: 5px solid transparent;
  cursor: pointer;
}

.tvx-set-tab.is-active {
  color: var(--tvx-text);
  background: var(--tvx-elevated);
  border-color: var(--tvx-border-bright);
  border-left-color: var(--tvx-accent, #4de3ff);
  font-weight: 700;
}

.tvx-set-tab:focus-visible {
  outline: 3px solid var(--tvx-accent, #4de3ff);
  outline-offset: 2px;
}

.tvx-settings-panel {
  background: var(--tvx-surface-2);
  border: var(--tvx-border-width) solid var(--tvx-border-bright);
  padding: clamp(10px, 1.4vw, 16px);
  min-height: 220px;
}

.tvx-set-page { display: flex; flex-direction: column; gap: 10px; }
.tvx-set-page[hidden] { display: none; }

.tvx-set-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 10px;
  align-items: center;
}

@media (max-width: 620px) {
  .tvx-set-row { grid-template-columns: 1fr; gap: 4px; }
}

.tvx-set-label {
  font-size: calc(0.9rem * var(--tvx-ui-scale));
  color: var(--tvx-text);
}

.tvx-set-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tvx-set-control input[type="range"] {
  flex: 1 1 160px;
  min-width: 130px;
  accent-color: var(--tvx-accent, #4de3ff);
}

.tvx-set-value {
  font-family: var(--tvx-font-pixel);
  font-size: calc(0.82rem * var(--tvx-ui-scale));
  min-width: 54px;
  text-align: right;
  color: var(--tvx-muted);
}

.tvx-set-control select {
  font: inherit;
  font-size: calc(0.88rem * var(--tvx-ui-scale));
  background: var(--tvx-bg-deep);
  color: var(--tvx-text);
  border: var(--tvx-border-width) solid var(--tvx-border);
  border-radius: var(--tvx-radius-sm, 2px);
  padding: 5px 8px;
}

/* Switch: a real button with role=switch, so it is keyboard operable and
   announces state. The knob position AND the border change, so the on/off
   state is not conveyed by colour alone. */
.tvx-switch {
  position: relative;
  width: 54px;
  height: 26px;
  flex: none;
  padding: 0;
  border: 3px solid var(--tvx-border-bright);
  background: var(--tvx-bg-deep);
  cursor: pointer;
}

.tvx-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 16px;
  background: var(--tvx-muted);
  transition: transform 140ms var(--tvx-ease, ease), background 140ms linear;
}

.tvx-switch.is-on { border-color: var(--tvx-accent, #4de3ff); }
.tvx-switch.is-on .tvx-switch-knob {
  transform: translateX(24px);
  background: var(--tvx-accent, #4de3ff);
}

.tvx-switch:focus-visible {
  outline: 3px solid var(--tvx-accent, #4de3ff);
  outline-offset: 3px;
}

/* Segmented control (cursor size). */
.tvx-seg { gap: 4px; }
.tvx-seg-btn {
  font: inherit;
  font-size: calc(0.82rem * var(--tvx-ui-scale));
  padding: 5px 12px;
  color: var(--tvx-muted);
  background: var(--tvx-bg-deep);
  border: var(--tvx-border-width) solid var(--tvx-border);
  cursor: pointer;
}
.tvx-seg-btn.is-on {
  color: var(--tvx-text);
  background: var(--tvx-elevated);
  border-color: var(--tvx-border-bright);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--tvx-accent, #4de3ff);
}
.tvx-seg-btn:focus-visible {
  outline: 3px solid var(--tvx-accent, #4de3ff);
  outline-offset: 2px;
}

.tvx-set-note,
.tvx-set-hint {
  margin: 0;
  font-size: calc(0.8rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
  border-left: 4px solid var(--tvx-border);
  padding-left: 10px;
}

.tvx-set-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.tvx-set-status {
  font-size: calc(0.8rem * var(--tvx-ui-scale));
  color: var(--tvx-accent, #4de3ff);
}

.tvx-settings-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 2px solid var(--tvx-border);
}

.tvx-settings-scope {
  margin: 0;
  font-size: calc(0.74rem * var(--tvx-ui-scale));
  color: var(--tvx-muted);
}

.tvx-btn-danger {
  color: #ffb4b4;
  border-color: #a34a4a;
}
.tvx-btn-danger:hover { background: rgba(163, 74, 74, 0.25); }

/* ---- Menu buttons are now <button> as well as <a> -------------------- */
/* .tvx-menu-btn already sets font, colour, background, border and padding
   for both element types, so no reset is needed. Only the UA cursor and
   text alignment are added - a `background: transparent` / `font: inherit`
   reset here fought the shared class and made <button> menu items render
   with a different face and type than the <a> ones. */
.tvx-menu button.tvx-menu-btn {
  cursor: pointer;
  text-align: center;
}

/* The title column centres itself in the viewport with `margin: auto`
   rather than `justify-content: center` on the screen: auto margins centre
   when the content fits and degrade to top-aligned (scrollable) when it does
   not, which is what stops the header being pushed out of reach. */
.tvx-screen-menu .tvx-world-inner { margin: auto; }

/* Clear the floating navbar so the kicker never renders underneath it. */
@media (min-width: 901px) {
  .tvx-screen-menu { padding-top: clamp(64px, 8vh, 92px); }
}

/* ---- Screen transitions ------------------------------------------------ */
.tvx-screen.is-entering { animation: tvx-screen-in 240ms var(--tvx-ease, ease) both; }
.tvx-screen.is-leaving { animation: tvx-screen-out 200ms var(--tvx-ease, ease) both; }

@keyframes tvx-screen-in {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes tvx-screen-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(0, -10px, 0); }
}

/* ---- Preference-driven presentation ------------------------------------ */

body.tvx-no-effects .tvx-mote,
body.tvx-no-effects .tvx-entry-block { display: none; }

body.tvx-no-menu-anim .tvx-menu-btn,
body.tvx-no-menu-anim .tvx-btn,
body.tvx-no-menu-anim .tvx-tab,
body.tvx-no-menu-anim .tvx-set-tab,
body.tvx-no-menu-anim .tvx-realm-btn { transition: none !important; }

body.tvx-no-menu-anim .tvx-screen.is-entering,
body.tvx-no-menu-anim .tvx-screen.is-leaving { animation: none; }

/* Reduce Motion: keep the feature working, drop the movement. Applied from
   the stored preference OR the OS setting; the OS setting alone must never be
   overridden to force MORE motion. */
body.tvx-reduced-motion .tvx-screen.is-entering,
body.tvx-reduced-motion .tvx-screen.is-leaving { animation: none; }
body.tvx-reduced-motion *,
body.tvx-reduced-motion *::before,
body.tvx-reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

body.tvx-high-contrast {
  --tvx-muted: #d8e2e8;
  --tvx-border: #9fb0bb;
  --tvx-border-bright: #ffffff;
}
body.tvx-high-contrast .tvx-screen,
body.tvx-high-contrast .tvx-settings-panel,
body.tvx-high-contrast .tvx-realm-preview {
  background: rgba(4, 6, 9, 0.92);
}
body.tvx-high-contrast .tvx-set-label,
body.tvx-high-contrast .tvx-realm-name,
body.tvx-high-contrast .tvx-screen-title { color: #ffffff; }
body.tvx-high-contrast .tvx-realm-btn.is-selected {
  box-shadow: inset 0 0 0 3px #ffffff;
}

body.tvx-large-text { font-size: 112.5%; }

/* UI scale, applied through a root font-size so rem-based components follow.
   html font-size is rem-based so this is safe and reversible. */
body.tvx { font-size: calc(1rem * var(--tvx-ui-scale)); }

/* ---- The homepage must not scroll -------------------------------------- */
/* Explicit height + clipping on the game shell. The title screen fills
   exactly one viewport; without this the document reports ~100px of
   scrollable overflow with no visible element causing it (every child
   measures within the viewport), which still produces a real 100px scroll
   range on the most important screen. Scoped to body.tvx-is-home so every
   other CTFd route keeps normal document flow. */
body.tvx-is-home,
body.tvx-is-home .tvx-main {
  height: 100vh;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}

/* With the navbar hidden, the shell's own padding/margins became dead bands:
   `.tvx-world` carried padding:99px 0 0 (a navbar-clearance rule at
   `body.tvx:has(.tvx-world) .tvx-world`, specificity 0,3,1) plus a 100px
   bottom margin on main. Together they offset the absolutely-positioned
   canvas and left a black strip above the scene.
   This selector deliberately out-specifies that clearance rule rather than
   losing to it on order. */
body.tvx.tvx-is-home:has(.tvx-world) .tvx-main,
body.tvx.tvx-is-home:has(.tvx-world) .tvx-world {
  padding: 0;
  margin: 0;
}

body.tvx.tvx-is-home:has(.tvx-world) .tvx-world {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.tvx-is-home .tvx-world {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.tvx-is-home .tvx-world-scrim { pointer-events: none; }

/* Navbar stays functional but recedes on the title screen so it does not
   dominate the composition. Other routes are untouched. */
body.tvx-is-home .tvx-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
}

/* Hide the footer settings strip on the game shell: the Settings screen
   supersedes it, and the old selects are a second, conflicting surface.
   They remain on every other route. */
body.tvx-is-home .tvx-footer { display: none; }

/* Navbar handling on the title screen.
   A full-width app navbar with 7+ text links cuts the frame in half and
   reads as a website, not a game. On the HOMEPAGE ONLY it is hidden - every
   destination it carried (leaderboard, teams, profile, account, login,
   register, challenges via PLAY) is reachable from the game menu itself.
   Other CTFd routes keep the navbar untouched. */
body.tvx-is-home .tvx-nav { display: none; }

/* The menu is the navigation, so give it the whole frame back. */
.tvx-screen-menu { padding-top: clamp(28px, 5vh, 56px); }

/* ---- Touch devices ----------------------------------------------------- */
/* No custom cursor, no fake pointer. The native cursor is used automatically
   (cursor.js refuses coarse pointers) and this keeps the chrome simple. */
@media (pointer: coarse) {
  .tvx-realm-marker { display: none; }
}

/* =========================================================================
   v1.1.0 VOXEL ADVENTURE UI SYSTEM
   Replaces the v1.0.0 flat-grey slab block. One control language for the
   Main Menu, World Select, Server Select, Settings, the confirm dialog and
   the hotbar. Original design; no game artwork is copied.

   MATERIAL  a dark basalt slab (#2d3238) with a hard 3px light top edge and
             a 4px dark lower lip, 2px ink outline and a 3px hard drop - a
             physical block that sits ON the world, never a glass panel.
   PRIMARY   the same slab cast in sunset amber (PLAY, ENTER WORLD) with dark
             ink type - the one warm object in the stack.
   TYPE      Silkscreen (self-hosted, OFL), sized on its 8px grid, hard
             pixel shadow. Long help text stays in the body face.
   SELECTION a pair of small cyan markers slide in on BOTH sides on hover and
             focus, so labels never move off-centre; the slab lifts 2px.
   PRESSED   1px down, bevel inverts, drop collapses.
   LOADING   [aria-busy] / .is-loading: a stepped cyan progress strip runs
             along the lower lip while navigation is in flight.
   FOCUS     3px cyan ring outside the outline (keyboard only).
   No gradients on faces, no hatching, no glow halos, no blur.
   ========================================================================= */
:root {
  --ui-ink: #0a0b0d;
  --ui-slab: #2d3238;
  --ui-slab-hover: #39404a;
  --ui-slab-down: #23272c;
  --ui-slab-hi: #59626e;
  --ui-slab-lo: #15171b;
  --ui-text: #f2f4ef;
  --ui-shadow: #050607;
  --ui-amber: #c98e2c;
  --ui-amber-hover: #d99d38;
  --ui-amber-down: #b07a22;
  --ui-amber-hi: #f6cb72;
  --ui-amber-lo: #7a5113;
  --ui-amber-text: #23170a;
  --ui-cyan: var(--tvx-accent);   /* brand diamond cyan - single source in tokens.css (#4de3ff) */
  --ui-cyan-deep: #1d8fa6;
  --ui-heading: #e7c57c;
  --ui-panel: rgba(15, 17, 20, 0.9);
  --ui-frame: #3a4049;
  --ui-slot: #111316;
  --ui-muted: #9aa2ab;
}

/* ---- Automatic scale on large displays (home.js applyAutoZoom) -------- */
.tvx-world-inner,
.tvx-screen-frame,
.tvx-hotbar { zoom: var(--tvx-auto-zoom, 1); }

/* ---- Title ---------------------------------------------------------- */

.tvx-world-kicker, .tvx-world-tagline { font-family: var(--tvx-font-pixel); }
.tvx-world-tagline { font-weight: 400; letter-spacing: 0.04em; font-size: 12px; }

/* ---- Slab buttons ------------------------------------------------------ */
.tvx-menu { gap: 10px; }
.tvx-menu-btn,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn,
.tvx-settings-foot .tvx-btn,
.tvx-dialog .tvx-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--tvx-font-pixel);
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: var(--ui-text);
  background: var(--ui-slab);
  background-image: none;
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow:
    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),
    0 3px 0 rgba(0, 0, 0, 0.5);
  text-shadow: 2px 2px 0 var(--ui-shadow);
  margin: 0;
  transform: none;
  cursor: pointer;
  transition: transform 110ms var(--tvx-ease, ease), background-color 110ms linear,
    box-shadow 110ms linear, color 110ms linear;
}
.tvx-menu-btn {
  width: 100%;
  min-height: 48px;
  padding: 10px 40px;
  font-size: 16px;
  letter-spacing: 0.06em;
}
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn,
.tvx-settings-foot .tvx-btn,
.tvx-dialog .tvx-btn {
  min-height: 38px;
  padding: 8px 30px;
  font-size: 12px;
  letter-spacing: 0.06em;
}
/* Selection markers: identical on both sides, so the label stays centred. */
.tvx-menu-btn::before, .tvx-menu-btn::after,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn::after,
.tvx-settings-foot .tvx-btn::before, .tvx-settings-foot .tvx-btn::after,
.tvx-dialog .tvx-btn::before, .tvx-dialog .tvx-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 6px;
  height: 10px;
  margin-top: -5px;
  background: var(--ui-cyan);
  opacity: 0;
  transition: opacity 110ms linear, transform 110ms var(--tvx-ease, ease);
  pointer-events: none;
}
.tvx-menu-btn::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn::before,
.tvx-settings-foot .tvx-btn::before, .tvx-dialog .tvx-btn::before {
  left: 12px;
  clip-path: polygon(0 0, 50% 0, 50% 20%, 100% 20%, 100% 80%, 50% 80%, 50% 100%, 0 100%);
  transform: translateX(-3px);
}
.tvx-menu-btn::after, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn::after,
.tvx-settings-foot .tvx-btn::after, .tvx-dialog .tvx-btn::after {
  right: 12px;
  clip-path: polygon(100% 0, 50% 0, 50% 20%, 0 20%, 0 80%, 50% 80%, 50% 100%, 100% 100%);
  transform: translateX(3px);
}
.tvx-menu-btn:hover, .tvx-menu-btn:focus-visible,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn:hover, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:focus-visible,
.tvx-settings-foot .tvx-btn:hover, .tvx-settings-foot .tvx-btn:focus-visible,
.tvx-dialog .tvx-btn:hover, .tvx-dialog .tvx-btn:focus-visible {
  color: #ffffff;
  background: var(--ui-slab-hover);
  border-color: var(--ui-ink);
  transform: translateY(-2px);
  box-shadow:
    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),
    0 5px 0 rgba(0, 0, 0, 0.5);
}
.tvx-menu-btn:hover::before, .tvx-menu-btn:hover::after,
.tvx-menu-btn:focus-visible::before, .tvx-menu-btn:focus-visible::after,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn:hover::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:hover::after,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn:focus-visible::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:focus-visible::after,
.tvx-settings-foot .tvx-btn:hover::before, .tvx-settings-foot .tvx-btn:hover::after,
.tvx-dialog .tvx-btn:hover::before, .tvx-dialog .tvx-btn:hover::after,
.tvx-dialog .tvx-btn:focus-visible::before, .tvx-dialog .tvx-btn:focus-visible::after {
  opacity: 1;
  transform: none;
}
.tvx-menu-btn:focus-visible,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn:focus-visible,
.tvx-settings-foot .tvx-btn:focus-visible,
.tvx-dialog .tvx-btn:focus-visible {
  outline: 3px solid var(--ui-cyan);
  outline-offset: 3px;
}
.tvx-menu-btn:active, .tvx-menu-btn.is-pressing,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn:active,
.tvx-settings-foot .tvx-btn:active,
.tvx-dialog .tvx-btn:active {
  background: var(--ui-slab-down);
  transform: translateY(1px);
  margin: 0;
  border-width: 2px;
  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);
  text-shadow: 1px 1px 0 var(--ui-shadow);
}
.tvx-menu-btn:disabled, .tvx-menu-btn[aria-disabled="true"],
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn:disabled, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn[aria-disabled="true"] {
  cursor: not-allowed;
  color: #6c7279;
  background: #202327;
  transform: none;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), 0 2px 0 rgba(0, 0, 0, 0.35);
  text-shadow: none;
}
.tvx-menu-btn:disabled::before, .tvx-menu-btn:disabled::after,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn:disabled::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:disabled::after { opacity: 0; }

/* Primary: sunset amber slab with ink type. */
.tvx-menu-primary,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-primary {
  color: var(--ui-amber-text);
  background: var(--ui-amber);
  text-shadow: 1px 1px 0 rgba(255, 228, 160, 0.45);
  box-shadow:
    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),
    0 3px 0 rgba(0, 0, 0, 0.5);
}
.tvx-menu-primary { min-height: 58px; font-size: 24px; font-weight: 700; letter-spacing: 0.12em; }
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-primary { min-height: 48px; font-size: 16px; font-weight: 700; letter-spacing: 0.1em; }
.tvx-menu-primary:hover, .tvx-menu-primary:focus-visible,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-primary:hover, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn-primary:focus-visible {
  color: var(--ui-amber-text);
  background: var(--ui-amber-hover);
  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),
    0 5px 0 rgba(0, 0, 0, 0.5);
}
.tvx-menu-primary::before, .tvx-menu-primary::after,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-primary::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn-primary::after { background: var(--ui-amber-text); }
.tvx-menu-primary:active, .tvx-menu-primary.is-pressing,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-primary:active {
  background: var(--ui-amber-down);
  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);
}

/* Destructive: basalt slab, warm-red label and markers. */
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-danger,
.tvx-settings-foot .tvx-btn-danger,
.tvx-dialog .tvx-btn-danger { color: #ffb2a6; }
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-danger::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn-danger::after,
.tvx-settings-foot .tvx-btn-danger::before, .tvx-settings-foot .tvx-btn-danger::after,
.tvx-dialog .tvx-btn-danger::before, .tvx-dialog .tvx-btn-danger::after { background: #ff8a76; }
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn-danger:hover, .tvx-settings-foot .tvx-btn-danger:hover,
.tvx-dialog .tvx-btn-danger:hover { color: #ffd6cf; }

/* Loading: a stepped progress strip on the lower lip. */
@keyframes tvx-ui-load { from { background-position: 0 0; } to { background-position: 32px 0; } }
.tvx-menu-btn.is-loading, .tvx-menu-btn[aria-busy="true"],
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn.is-loading, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn[aria-busy="true"] { cursor: progress; }
.tvx-menu-btn.is-loading::before, .tvx-menu-btn[aria-busy="true"]::before,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn.is-loading::before, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn[aria-busy="true"]::before { opacity: 0; }
.tvx-menu-btn.is-loading::after, .tvx-menu-btn[aria-busy="true"]::after,
:is(.tvx-screen, .tvx-main, .modal) .tvx-btn.is-loading::after, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn[aria-busy="true"]::after {
  opacity: 1;
  left: 6px; right: 6px; top: auto; bottom: 5px;
  width: auto; height: 4px; margin: 0;
  clip-path: none;
  transform: none;
  background: repeating-linear-gradient(90deg, var(--ui-cyan) 0 8px, transparent 8px 16px);
  animation: tvx-ui-load 0.5s steps(4) infinite;
}

/* ---- Status chips + hotbar in the same material -------------------------- */
.tvx-status-chip {
  font-family: var(--tvx-font-pixel);
  background: rgba(15, 17, 20, 0.82);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.07);
}
.tvx-hotbar {
  background: var(--ui-panel);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 0 0 2px var(--ui-frame), 0 4px 0 rgba(0, 0, 0, 0.45);
}
.tvx-hotbar-slot { font-family: var(--tvx-font-pixel); border-radius: 0; }

/* ---- Screen titles ----------------------------------------------------- */
.tvx-screen-kicker {
  font-family: var(--tvx-font-pixel);
  color: var(--ui-heading);
  margin-bottom: 6px;
  text-shadow: 2px 2px 0 #000;
}
.tvx-screen-title {
  display: inline-block;
  margin-top: 4px;
  padding: 6px 16px 8px;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fbf3df;
  text-shadow: 3px 3px 0 #000;
  background: rgba(12, 14, 17, 0.72);
  border: 2px solid var(--ui-ink);
  box-shadow: inset 0 0 0 2px var(--ui-frame), 0 4px 0 rgba(0, 0, 0, 0.45);
}
.tvx-screen-title:focus { outline: none; }
.tvx-screen-title:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 3px; }
.tvx-screen-head { border-bottom: 2px solid rgba(10, 11, 13, 0.6); }

/* ---- Panels: one framed material ------------------------------------- */
.tvx-screen .tvx-settings-panel,
.tvx-screen .tvx-realm-preview,
.tvx-screen .tvx-server-card,
.tvx-screen .tvx-realm-btn,
.tvx-dialog {
  background: var(--ui-panel);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow:
    inset 0 0 0 2px var(--ui-frame),
    inset 0 0 0 4px rgba(0, 0, 0, 0.45),
    0 4px 0 rgba(0, 0, 0, 0.4);
}
.tvx-screen .tvx-realm-btn { font-family: var(--tvx-font-pixel); }
.tvx-screen .tvx-realm-btn:hover { background: rgba(36, 40, 46, 0.94); }
.tvx-screen .tvx-realm-btn.is-selected {
  background: rgba(46, 51, 58, 0.96);
  box-shadow: inset 0 0 0 2px var(--ui-cyan), inset 0 0 0 4px rgba(0, 0, 0, 0.45), 0 4px 0 rgba(0, 0, 0, 0.4);
}
.tvx-screen .tvx-realm-btn.is-selected .tvx-realm-name { text-decoration: none; }
.tvx-realm-preview-name { font-family: var(--tvx-font-pixel); font-weight: 700; font-size: 24px; letter-spacing: 0.06em; }

/* ---- Tabs + segmented controls: dark slots, raised when selected -------- */
.tvx-screen .tvx-tab,
.tvx-screen .tvx-set-tab,
.tvx-screen .tvx-seg-btn {
  font-family: var(--tvx-font-pixel);
  font-weight: 600;
  color: #aeb5bc;
  background: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.5), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  text-shadow: 1px 1px 0 #000;
  transition: background-color 110ms linear, color 110ms linear;
}
.tvx-screen .tvx-set-tab { padding: 12px 12px 12px 18px; letter-spacing: 0.02em; text-transform: uppercase; font-size: 14px; }
.tvx-screen .tvx-tab, .tvx-screen .tvx-seg-btn { font-size: 12px; letter-spacing: 0.04em; }
.tvx-screen .tvx-tab:hover,
.tvx-screen .tvx-set-tab:hover,
.tvx-screen .tvx-seg-btn:hover { color: #ffffff; background: #1d2126; }
.tvx-screen .tvx-tab.is-active,
.tvx-screen .tvx-set-tab.is-active,
.tvx-screen .tvx-seg-btn.is-on {
  color: #ffffff;
  background: var(--ui-slab-hover);
  box-shadow: inset 0 3px 0 #6c7683, inset 0 -3px 0 var(--ui-slab-lo);
}
.tvx-screen .tvx-set-tab.is-active { box-shadow: inset 5px 0 0 var(--ui-cyan), inset 0 3px 0 #6c7683, inset 0 -3px 0 var(--ui-slab-lo); }
.tvx-screen .tvx-tab.is-active,
.tvx-screen .tvx-seg-btn.is-on { box-shadow: inset 0 -4px 0 var(--ui-cyan), inset 0 3px 0 #6c7683; }
.tvx-screen .tvx-tab::after { display: none; }
.tvx-screen .tvx-tab:focus-visible,
.tvx-screen .tvx-set-tab:focus-visible,
.tvx-screen .tvx-seg-btn:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }

/* ---- Settings layout ---------------------------------------------------- */
.tvx-screen .tvx-settings-panel { padding: 18px 22px 20px; }
.tvx-set-page { gap: 8px; }
.tvx-set-heading {
  margin: 14px 0 2px;
  padding-bottom: 6px;
  font-family: var(--tvx-font-pixel);
  font-weight: 600;
  font-size: calc(12px * var(--tvx-ui-scale, 1));
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ui-heading);
  border-bottom: 2px solid #23272c;
  text-shadow: 1px 1px 0 #000;
}
.tvx-set-page > .tvx-set-heading:first-child { margin-top: 0; }
.tvx-set-row { padding: 4px 0; min-height: 40px; }
.tvx-set-label {
  font-family: var(--tvx-font-pixel);
  font-weight: 400;
  font-size: calc(14px * var(--tvx-ui-scale, 1));
  color: #e9ece6;
  letter-spacing: 0.02em;
  text-align: left;
}
.tvx-set-value {
  font-family: var(--tvx-font-pixel);
  font-weight: 400;
  font-size: 14px;
  color: #ffffff;
  min-width: 62px;
  padding: 3px 6px;
  text-align: center;
  background: var(--ui-slot);
  border: 2px solid var(--ui-ink);
}
.tvx-screen .tvx-set-note,
.tvx-screen .tvx-set-hint {
  color: var(--ui-muted);
  border-left: 3px solid var(--ui-frame);
  font-size: calc(0.82rem * var(--tvx-ui-scale, 1));
  line-height: 1.45;
}
.tvx-set-note[data-tvx-music-state="playing"] { border-left-color: var(--ui-cyan); color: #cfeff6; }
.tvx-set-note[data-tvx-music-state="blocked"],
.tvx-set-note[data-tvx-music-state="loading"],
.tvx-set-note[data-tvx-music-state="starting"] { border-left-color: var(--ui-amber); color: #f1dcb0; }
.tvx-set-note[data-tvx-music-state="error"] { border-left-color: #ff8a76; color: #ffc9c0; }
.tvx-set-status { font-family: var(--tvx-font-pixel); color: var(--ui-cyan); }

/* Pixel slider: recessed slot, cyan fill up to the value, block thumb. */
.tvx-screen .tvx-set-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 26px;
  background: transparent;
  cursor: pointer;
  accent-color: var(--ui-cyan);
}
.tvx-screen .tvx-set-control input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  background: linear-gradient(to right, var(--ui-cyan-deep) 0 var(--tvx-fill, 50%), var(--ui-slot) var(--tvx-fill, 50%) 100%);
  border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12);
}
.tvx-screen .tvx-set-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 26px;
  margin-top: -9px;
  background: #c7cdd3;
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 3px 0 #ffffff, inset 0 -4px 0 #7b838c;
}
.tvx-screen .tvx-set-control input[type="range"]:hover::-webkit-slider-thumb { background: #e2e7eb; }
.tvx-screen .tvx-set-control input[type="range"]::-moz-range-track {
  height: 8px; background: var(--ui-slot); border: 2px solid var(--ui-ink);
}
.tvx-screen .tvx-set-control input[type="range"]::-moz-range-progress {
  height: 8px; background: var(--ui-cyan-deep); border: 2px solid var(--ui-ink);
}
.tvx-screen .tvx-set-control input[type="range"]::-moz-range-thumb {
  width: 10px; height: 22px; background: #c7cdd3; border: 2px solid var(--ui-ink);
  border-radius: 0; box-shadow: inset 0 3px 0 #ffffff, inset 0 -4px 0 #7b838c;
}
.tvx-screen .tvx-set-control input[type="range"]:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 4px; }

/* Pixel switch: recessed slot with an OFF/ON legend and a block knob. */
.tvx-screen .tvx-switch {
  width: 66px;
  height: 30px;
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  background: var(--ui-slot);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.tvx-screen .tvx-switch::after {
  content: "OFF";
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  font: 400 8px/1 var(--tvx-font-pixel);
  letter-spacing: 0.06em;
  color: #6e757c;
}
.tvx-screen .tvx-switch.is-on { background: var(--ui-cyan-deep); border-color: var(--ui-ink); }
.tvx-screen .tvx-switch.is-on::after { content: "ON"; right: auto; left: 8px; color: #e9fbff; }
.tvx-screen .tvx-switch-knob {
  top: 2px; left: 2px;
  width: 24px; height: 22px;
  background: #8b939b;
  box-shadow: inset 0 3px 0 #c3c9cf, inset 0 -3px 0 #4f565d;
  outline: 2px solid var(--ui-ink);
}
.tvx-screen .tvx-switch.is-on .tvx-switch-knob {
  transform: translateX(34px);
  background: #dff9ff;
  box-shadow: inset 0 3px 0 #ffffff, inset 0 -3px 0 #7fbfcc;
}
.tvx-screen .tvx-switch:hover .tvx-switch-knob { filter: brightness(1.12); }
.tvx-screen .tvx-switch:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 3px; }

/* Selects: recessed slot with a stepped pixel arrow. */
.tvx-screen .tvx-set-control select {
  -webkit-appearance: none;
  appearance: none;
  min-width: 220px;
  padding: 8px 38px 8px 12px;
  font-family: var(--tvx-font-pixel);
  font-weight: 400;
  font-size: calc(14px * var(--tvx-ui-scale, 1));
  color: #f2f4ef;
  background-color: var(--ui-slot);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' shape-rendering='crispEdges'%3E%3Cpath fill='%234de3ff' d='M0 0h12v2H10v2H8v2H4V4H2V2H0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.tvx-screen .tvx-set-control select:hover { background-color: #1a1d21; }
.tvx-screen .tvx-set-control select:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
.tvx-screen .tvx-set-control select option { background: #14161a; color: #f2f4ef; }

.tvx-settings-foot { border-top: 2px solid rgba(10, 11, 13, 0.6); }
.tvx-settings-scope { color: #c3c9ce; text-shadow: 1px 1px 0 #000; }

/* ---- Dialog -------------------------------------------------------------- */
.tvx-dialog {
  background: #15171b;
  max-width: min(480px, calc(100vw - 32px));
  padding: 20px 22px 18px;
  color: var(--ui-text);
}
.tvx-dialog::backdrop { background: rgba(5, 6, 8, 0.66); }
.tvx-dialog-title {
  margin: 0 0 10px;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ui-heading);
  text-shadow: 2px 2px 0 #000;
}
.tvx-dialog-body { margin: 0 0 18px; line-height: 1.5; color: #d4d9dc; font-size: 0.92rem; }
.tvx-dialog-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ---- Preferences that change presentation ------------------------------ */
body.tvx-high-contrast .tvx-menu-btn,
body.tvx-high-contrast :is(.tvx-screen, .tvx-main, .modal) .tvx-btn { border-color: #ffffff; color: #ffffff; }
body.tvx-high-contrast .tvx-menu-primary { color: #000; }
body.tvx-large-text .tvx-menu-btn { font-size: 24px; }
body.tvx-large-text .tvx-set-label { font-size: calc(16px * var(--tvx-ui-scale, 1)); }
body.tvx-large-text .tvx-set-note, body.tvx-large-text .tvx-set-hint { font-size: 1rem; }
body.tvx-no-menu-anim .tvx-menu-btn,
body.tvx-no-menu-anim :is(.tvx-screen, .tvx-main, .modal) .tvx-btn,
body.tvx-no-menu-anim .tvx-menu-btn::before,
body.tvx-no-menu-anim .tvx-menu-btn::after { transition: none; }
body.tvx-no-menu-anim .tvx-menu-btn:hover,
body.tvx-no-menu-anim .tvx-menu-btn:focus-visible,
body.tvx-no-menu-anim :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:hover,
body.tvx-no-menu-anim .tvx-menu-btn:active,
body.tvx-no-menu-anim :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:active { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .tvx-menu-btn, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn { transition: none; }
  .tvx-menu-btn:hover, .tvx-menu-btn:focus-visible, .tvx-menu-btn:active,
  :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:hover, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:active { transform: none; }
  .tvx-menu-btn.is-loading::after, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn.is-loading::after,
  .tvx-menu-btn[aria-busy="true"]::after, :is(.tvx-screen, .tvx-main, .modal) .tvx-btn[aria-busy="true"]::after { animation: none; }
}
body.tvx-reduced-motion .tvx-menu-btn:hover,
body.tvx-reduced-motion .tvx-menu-btn:active,
body.tvx-reduced-motion :is(.tvx-screen, .tvx-main, .modal) .tvx-btn:hover { transform: none; }

/* Phones: full-width stack, slightly shorter slabs. */
@media (max-width: 600px) {
  .tvx-menu-btn { min-height: 46px; padding: 9px 34px; }
  .tvx-menu-primary { min-height: 54px; }
  .tvx-screen .tvx-set-control select { min-width: 0; width: 100%; }
}

:is(.tvx-screen, .tvx-main, .modal) .tvx-btn .tvx-btn-glyph { display: none; }

/* Headings and the section rule align left so each settings page reads as a
   list of groups, not a centred poster. */
.tvx-settings-panel .tvx-set-heading { text-align: left; }
.tvx-screen .tvx-set-note, .tvx-screen .tvx-set-hint { text-align: left; font-family: var(--tvx-font-body); }
@media (max-width: 600px) {
  
  .tvx-menu-primary { font-size: 16px; }
  .tvx-screen-title { font-size: 24px; }
}

/* Labels that are <label> elements were losing the pixel face to an older,
   more specific rule; the screen scope wins here. */
.tvx-screen .tvx-set-row .tvx-set-label { font-family: var(--tvx-font-pixel); text-align: left; }
.tvx-screen .tvx-set-control select { min-width: 260px; }
/* Status chips: Silkscreen is wide, so the chips get the 8px size to keep
   the three of them on one line under the menu. */

.tvx-status-chip { font-size: 8px; letter-spacing: 0.06em; white-space: nowrap; }

/* Phones: the fixed hotbar covered the last settings rows; leave room for it. */
@media (max-width: 600px) {
  .tvx-screen { padding-bottom: 104px; }
}

/* =========================================================================
   v1.2.0 REALM EXPLORER (static/js/explorer.js)
   World Select is one viewport-fitted screen: realm list on the left, the
   in-place explorer on the right. The ONLY internal scroll is the challenge
   collection or the challenge body, and only when it really overflows. The
   frame is zoomed on large displays (--tvx-auto-zoom), so viewport heights
   used inside it are divided by that zoom to stay exact.
   ========================================================================= */
.tvx-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.tvx-screen-worlds .tvx-worlds-body {
  /* Viewport minus: screen top padding + header + tabs (~290px) and the
     fixed hotbar band at the bottom (~96px), so nothing sits under it. */
  /* Inside the zoomed frame both the header and this panel scale with the
     zoom, so the chrome is subtracted AFTER dividing the viewport by it. */
  --tvx-worlds-h: calc(100vh / var(--tvx-auto-zoom, 1) - 410px);
  height: clamp(360px, var(--tvx-worlds-h), 900px);
  max-height: none;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
}
.tvx-screen-worlds .tvx-realm-list { max-height: 100%; overflow-y: auto; padding-right: 2px; }
.tvx-screen-worlds .tvx-realm-btn { position: relative; padding-right: 64px; }

/* v1.6.x FIX (Task 2): keep the Submit Flag form reachable at every viewport.
   The explorer used to keep an independent max-height (min(62vh,560px)); when
   that exceeded the worlds-body's fixed height the body's overflow:hidden
   clipped the explorer's bottom — the flag input and Submit button — on
   shorter or again-restored windows, and the detail panel's own scroll never
   engaged. Because that body is overflow:hidden (not user-scrollable), focus
   or scrollIntoView could also scroll it programmatically and leave it offset,
   so the realm list and explorer stayed misaligned after a resize. Fix: on
   wide screens bind the explorer to the body height so its detail scroll
   region handles overflow, the submit form stays pinned and the body never has
   hidden overflow to drift into; at <=860px let the body flow at its natural
   height and the page scroll instead of clipping. On phones (<=760px) the body
   is a column flexbox that inherited align-items:start, which sized its
   children to their widest content: a long unbroken string or code line made
   the explorer thousands of px wide (pushing the flag form off-screen), and the
   horizontal realm row likewise grew to its full max-content width (formerly
   hidden by the clipping). Stretch both to the column width instead; the realm
   row keeps its own horizontal scroll. Everything is derived from live CSS
   (vh / %), so a resize-down-then-restore recomputes cleanly with no stale
   dimensions. */
@media (max-width: 860px) {
  .tvx-screen-worlds .tvx-worlds-body { height: auto; max-height: none; overflow: visible; }
}
@media (min-width: 861px) {
  .tvx-screen-worlds .tvx-explorer { max-height: 100%; min-height: 0; align-self: stretch; }
}
@media (max-width: 760px) {
  .tvx-screen-worlds .tvx-worlds-body { align-items: stretch; }
  .tvx-screen-worlds .tvx-worlds-body > * { min-width: 0; max-width: 100%; }
}
.tvx-realm-count {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  min-width: 40px; padding: 3px 6px; text-align: center;
  font-family: var(--tvx-font-pixel); font-size: 12px; color: #fff;
  background: var(--ui-slot); border: 2px solid var(--ui-ink);
}
.tvx-realm-count:empty { display: none; }
.tvx-realm-count.is-empty { color: #7d848b; }
.tvx-realm-count.is-clear { color: #0e1a10; background: #7bd88f; }

/* ---- explorer shell --------------------------------------------------- */
.tvx-explorer {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--ui-panel);
  border: 2px solid var(--ui-ink);
  box-shadow: inset 0 0 0 2px var(--ui-frame), inset 0 4px 0 2px color-mix(in srgb, var(--realm-accent) 55%, transparent),
    0 4px 0 rgba(0, 0, 0, 0.4);
}
.tvx-explorer-view { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; padding: 16px 18px; }
.tvx-explorer-view[hidden] { display: none; }
.tvx-explorer-head { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 2px solid rgba(10, 11, 13, 0.7); }
.tvx-explorer-name { margin: 0; font-family: var(--tvx-font-pixel); font-size: 24px; letter-spacing: 0.06em;
  text-transform: uppercase; color: #fbf3df; text-shadow: 2px 2px 0 #000; }
.tvx-explorer-name::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px;
  vertical-align: 2px; background: var(--realm-accent); box-shadow: 0 0 0 2px var(--ui-ink); }
.tvx-explorer-desc { margin: 4px 0 0; color: #c4cbd1; font-size: 0.9rem; max-width: 60ch; }
.tvx-explorer-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tvx-explorer-stat { font-family: var(--tvx-font-pixel); font-size: 12px; color: var(--ui-heading); }
.tvx-explorer-search input {
  width: 180px; padding: 7px 10px; font: inherit; color: #f2f4ef; background: var(--ui-slot);
  border: 2px solid var(--ui-ink); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55); border-radius: 0;
}
.tvx-explorer-search input:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
.tvx-explorer-state { padding: 18px 2px 4px; }
.tvx-explorer-state[hidden] { display: none; }
.tvx-ex-note { margin: 0 0 10px; color: #c9d0d6; line-height: 1.5; }
.tvx-ex-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tvx-ex-loading { display: flex; align-items: center; gap: 10px; color: #c9d0d6; padding: 6px 0; font-family: var(--tvx-font-pixel); font-size: 12px; }
@keyframes tvx-ex-spin { to { transform: rotate(360deg); } }
.tvx-ex-spinner { display: inline-block; width: 14px; height: 14px; border: 3px solid var(--ui-cyan);
  border-right-color: transparent; animation: tvx-ex-spin 0.8s steps(8) infinite; }

/* ---- challenge objects --------------------------------------------------- */
.tvx-quest-grid {
  list-style: none; margin: 12px 0 0; padding: 4px 4px 8px; flex: 1 1 auto; min-height: 0;
  overflow-y: auto; display: grid; gap: 12px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
}
.tvx-quest {
  position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 12px 10px 10px; cursor: pointer; text-align: center;
  color: #eef1f2; background: rgba(28, 31, 36, 0.92); border: 2px solid var(--ui-ink); border-radius: 0;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.07), inset 0 -3px 0 rgba(0, 0, 0, 0.45), 0 3px 0 rgba(0, 0, 0, 0.45);
  transition: transform 110ms var(--tvx-ease, ease), background-color 110ms linear, box-shadow 110ms linear;
}
.tvx-quest-plinth {
  display: grid; place-items: center; width: 76px; height: 76px;
  background: linear-gradient(to bottom, transparent 62%, rgba(0, 0, 0, 0.35) 62%),
    color-mix(in srgb, var(--realm-accent) 16%, #14161a);
  border: 2px solid var(--ui-ink); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.05);
  image-rendering: pixelated;
}
.tvx-quest-plinth svg { width: 56px; height: 56px; transition: transform 140ms var(--tvx-ease, ease); }
.tvx-quest-name { font-family: var(--tvx-font-pixel); font-size: 12px; line-height: 1.35; letter-spacing: 0.02em;
  overflow-wrap: anywhere; }
.tvx-quest-meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; font-size: 0.78rem; color: #aab2b9; margin-top: auto; }
.tvx-quest-pts { color: var(--ui-heading); font-family: var(--tvx-font-pixel); font-size: 12px; }
.tvx-quest-check { position: absolute; top: 6px; right: 6px; padding: 2px 5px; font-family: var(--tvx-font-pixel);
  font-size: 8px; color: #0e1a10; background: #7bd88f; border: 2px solid var(--ui-ink); }
.tvx-quest:hover, .tvx-quest:focus-visible {
  transform: translateY(-3px); background: rgba(40, 44, 51, 0.96);
  box-shadow: inset 0 0 0 2px var(--realm-accent), inset 0 -3px 0 rgba(0, 0, 0, 0.45), 0 6px 0 rgba(0, 0, 0, 0.45);
}
.tvx-quest:hover .tvx-quest-plinth svg, .tvx-quest:focus-visible .tvx-quest-plinth svg { transform: translateY(-2px) scale(1.06); }
.tvx-quest:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 3px; }
.tvx-quest:active { transform: translateY(1px); box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.5), 0 1px 0 rgba(0, 0, 0, 0.45); }
.tvx-quest.is-solved .tvx-quest-plinth { background: linear-gradient(to bottom, transparent 62%, rgba(0, 0, 0, 0.35) 62%), #1d2e22; }
.tvx-quest.is-current { box-shadow: inset 0 0 0 2px var(--ui-cyan), 0 3px 0 rgba(0, 0, 0, 0.45); }

/* ---- detail view --------------------------------------------------------- */
.tvx-quest-detail { gap: 10px; outline: none; }
.tvx-detail-bar { display: flex; }
.tvx-detail-head { display: flex; gap: 14px; align-items: center; padding-bottom: 10px; border-bottom: 2px solid rgba(10, 11, 13, 0.7); }
.tvx-detail-object { width: 68px; height: 68px; flex: none; }
.tvx-detail-object svg { width: 50px; height: 50px; }
.tvx-detail-name { margin: 0; font-family: var(--tvx-font-pixel); font-size: 24px; letter-spacing: 0.04em; color: #fbf3df;
  text-shadow: 2px 2px 0 #000; overflow-wrap: anywhere; }
.tvx-detail-sub { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tvx-detail-sub > span { padding: 2px 7px; font-family: var(--tvx-font-pixel); font-size: 12px; background: var(--ui-slot);
  border: 2px solid var(--ui-ink); color: #dfe4e8; }
.tvx-detail-sub .tvx-detail-solved { color: #0e1a10; background: #7bd88f; }
/* Challenge author (attribution), under the category / points chips. */
.tvx-detail-author { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.tvx-detail-author-label { font-family: var(--tvx-font-pixel); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: #9aa3ab; }
.tvx-detail-author-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  padding: 2px 7px; font-family: var(--tvx-font-pixel); font-size: 12px; color: #dfe4e8; background: var(--ui-slot);
  border: 2px solid var(--ui-ink); overflow-wrap: anywhere; }
.tvx-detail-author-name > span { min-width: 0; }
.tvx-detail-author-icon { width: 12px; height: 12px; flex: none; fill: currentColor; color: var(--ui-cyan); }
/* Long descriptions: the detail view is ONE scroll container. The description
   used to get only the height left after the back bar, header and pinned flag
   form (21-85px on 600-768px-tall screens, so it looked missing); now the
   header scrolls away with the text and only the flag form stays pinned. */
.tvx-quest-detail { overflow-y: auto; overscroll-behavior: contain; }
.tvx-quest-detail > * { flex-shrink: 0; }
.tvx-detail-scroll { flex: 1 0 auto; padding-right: 6px; }
.tvx-quest-detail > .tvx-submit { position: sticky; bottom: -16px; z-index: 1; margin-bottom: -16px;
  padding-bottom: 16px; background: rgb(15, 17, 20); /* opaque --ui-panel: text scrolling beneath must not show through */ }
.tvx-detail-desc { color: #e3e7ea; line-height: 1.6; font-size: 0.95rem; }
.tvx-detail-desc p { margin: 0 0 0.8em; }
.tvx-detail-desc a { color: var(--ui-cyan); }
.tvx-detail-desc code, .tvx-detail-conn code, .tvx-inst-conn code {
  padding: 1px 5px; background: var(--ui-slot); border: 1px solid #2c3036; color: #c9f5ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; overflow-wrap: anywhere; }
.tvx-detail-desc pre { padding: 10px; background: var(--ui-slot); border: 2px solid var(--ui-ink); overflow: auto; }
.tvx-detail-desc blockquote { margin: 0 0 0.8em; padding: 6px 12px; border-left: 4px solid var(--realm-accent, var(--ui-cyan));
  background: rgba(17, 19, 22, 0.55); color: #c9d0d6; }
.tvx-detail-desc hr { border: 0; border-top: 2px solid rgba(10, 11, 13, 0.7); margin: 1em 0; }
.tvx-md-table { max-width: 100%; overflow-x: auto; margin: 0 0 0.8em; }
.tvx-md-table table { border-collapse: collapse; font-size: 0.9rem; }
.tvx-md-table th, .tvx-md-table td { padding: 4px 10px; border: 1px solid #3a4049; text-align: left; overflow-wrap: normal; }
.tvx-md-table th { background: var(--ui-slot); color: var(--ui-heading); }
.tvx-detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.tvx-tag { padding: 2px 7px; font-size: 0.75rem; color: #b8c0c7; border: 1px solid #3a4049; }
.tvx-detail-block { margin-top: 14px; }
.tvx-detail-block h4, .tvx-inst-head h4 { margin: 0 0 8px; font-family: var(--tvx-font-pixel); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ui-heading); }
.tvx-file-list, .tvx-hint-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tvx-file { display: inline-block; padding: 6px 10px; color: #e9fbff; text-decoration: none; background: var(--ui-slot);
  border: 2px solid var(--ui-ink); font-family: var(--tvx-font-pixel); font-size: 12px; }
.tvx-file::before { content: "\2193  "; color: var(--ui-cyan); }
.tvx-file:hover, .tvx-file:focus-visible { background: #1f2329; outline: 2px solid var(--ui-cyan); }
.tvx-hint { padding: 8px 10px; background: rgba(17, 19, 22, 0.8); border: 2px solid var(--ui-ink); display: grid; gap: 6px; }
.tvx-hint-label { font-family: var(--tvx-font-pixel); font-size: 12px; color: #c9d0d6; }
.tvx-hint-body p { margin: 0; }

.tvx-submit { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: stretch;
  padding-top: 10px; border-top: 2px solid rgba(10, 11, 13, 0.7); }
.tvx-flag-input { min-width: 0; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem; color: #f2f4ef; background: var(--ui-slot); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55); border-radius: 0; }
.tvx-flag-input:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
.tvx-submit-result { grid-column: 1 / -1; margin: 0; min-height: 1.3em; font-family: var(--tvx-font-pixel); font-size: 12px; color: #c9d0d6; }
.tvx-submit-result.is-correct { color: #8ff0a4; }
.tvx-submit-result.is-wrong, .tvx-submit-result.is-error { color: #ff9c8a; }
.tvx-submit-result.is-warn { color: #f1d27a; }
.tvx-submit-result.is-info { color: #9fe6ff; }

/* ---- instance panel ------------------------------------------------------ */
.tvx-instance { margin: 0 0 14px; padding: 12px 14px; background: rgba(12, 14, 17, 0.88); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 0 0 2px #2a3038; }
.tvx-instance[hidden] { display: none; }
.tvx-inst-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tvx-inst-head h4 { margin: 0; }
.tvx-inst-led { width: 12px; height: 12px; background: #5b636d; box-shadow: 0 0 0 2px var(--ui-ink); }
.tvx-inst-state { font-family: var(--tvx-font-pixel); font-size: 12px; color: #dfe4e8; }
.tvx-inst-timer { margin-left: auto; padding: 3px 8px; font-family: var(--tvx-font-pixel); font-size: 16px; color: #e9fbff;
  background: var(--ui-slot); border: 2px solid var(--ui-ink); }
.tvx-inst-timer.is-low { color: #f1d27a; }
.tvx-inst-msg { margin: 8px 0; color: #c9d0d6; font-size: 0.9rem; }
.tvx-inst-conn { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.tvx-inst-conn code { font-size: 0.95rem; padding: 6px 8px; }
/* team access: tool keys (shown once; list = metadata only) */
.tvx-inst-conn code[data-tvx-inst-key], .tvx-inst-conn code[data-tvx-inst-curl] { overflow-wrap: anywhere; max-width: 100%; }
.tvx-inst-keys { list-style: none; margin: 4px 0 10px; padding: 0; display: grid; gap: 6px; }
.tvx-inst-keys li { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 0.9rem; }
.tvx-inst-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tvx-instance[data-phase="running"] .tvx-inst-led { background: #5ad16e; }
.tvx-instance[data-phase="starting"] .tvx-inst-led,
.tvx-instance[data-phase="requesting"] .tvx-inst-led,
.tvx-instance[data-phase="restarting"] .tvx-inst-led,
.tvx-instance[data-phase="stopping"] .tvx-inst-led,
.tvx-instance[data-phase="expiring"] .tvx-inst-led { background: #f1c04a; animation: tvx-ex-blink 1s steps(2) infinite; }
.tvx-instance[data-phase="failed"] .tvx-inst-led { background: #e5533f; }
.tvx-instance[data-phase="expired"] .tvx-inst-led { background: #8a5ad6; }
@keyframes tvx-ex-blink { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .tvx-ex-spinner, .tvx-instance .tvx-inst-led { animation: none !important; }
  .tvx-quest:hover, .tvx-quest:focus-visible { transform: none; }
}
body.tvx-reduced-motion .tvx-quest:hover, body.tvx-reduced-motion .tvx-quest:focus-visible { transform: none; }

/* ---- phones ------------------------------------------------------------- */
@media (max-width: 760px) {
  .tvx-screen-worlds .tvx-worlds-body { display: flex; flex-direction: column; height: auto; }
  .tvx-screen-worlds .tvx-realm-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; max-height: none; padding-bottom: 6px; }
  .tvx-screen-worlds .tvx-realm-item { flex: 0 0 auto; }
  .tvx-screen-worlds .tvx-realm-btn { width: auto; min-width: 190px; }
  .tvx-explorer { min-height: 60vh; }
  .tvx-quest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .tvx-explorer-search input { width: 100%; }
  .tvx-submit { grid-template-columns: 1fr; }
}

/* ---- the avatar's column (composition, v1.2.0) -----------------------
   world.js publishes the space the avatar occupies on the right edge as
   --tvx-avatar-reserve (only while it is drawn). Game screens other than
   the main menu centre their frame in the REMAINING width, so panels never
   cover the character at any desktop size. */
html[data-tvx-avatar] .tvx-screen:not(.tvx-screen-menu) {
  padding-right: calc(var(--tvx-avatar-reserve, 0px) + 12px);
}

/* Explorer content reads left-aligned (the screen container centres text). */
.tvx-explorer, .tvx-explorer .tvx-detail-desc, .tvx-explorer-head { text-align: left; }
.tvx-explorer .tvx-detail-desc ol, .tvx-explorer .tvx-detail-desc ul { padding-left: 1.4em; }
.tvx-screen-worlds .tvx-realm-name { font-size: 14px; }

/* =========================================================================
   v1.3.0 GAME-SCREEN DESIGN SYSTEM
   One material for every data screen (Leaderboard, Player Profile, Account)
   built from the tokens above: dark framed panels (--ui-panel), sharp 2px ink
   borders with an inner frame, amber for primary/score emphasis, cyan ONLY
   for selection / "this is you" / focus, Silkscreen for labels and numbers,
   the body face for prose. No gradients on surfaces, no blur, no glow.
   The same components render in the game shell (.tvx-screen) and on CTFd
   routes (.tvx-screen-standalone), so the slab buttons, tabs and panel
   rules scoped to .tvx-screen above apply to both.
   ========================================================================= */
.tvx-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- standalone mount (CTFd routes: /scoreboard, /user, /settings) ---- */
.tvx-screen.tvx-screen-standalone {
  position: relative;
  inset: auto;
  display: block;
  overflow: visible;
  padding: clamp(18px, 3vh, 32px) 16px clamp(32px, 6vh, 64px);
  min-height: calc(100vh - 180px);
}
.tvx-screen-standalone .tvx-screen-frame { margin: 0 auto; }
.tvx-screen-standalone .tvx-screen-title { margin: 0; }

/* ---- surfaces --------------------------------------------------------- */
.tvx-ds-panel {
  background: var(--ui-panel);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow:
    inset 0 0 0 2px var(--ui-frame),
    inset 0 0 0 4px rgba(0, 0, 0, 0.45),
    0 4px 0 rgba(0, 0, 0, 0.4);
  padding: 16px 18px;
  color: var(--ui-text);
  text-align: left;
  min-width: 0;
}
.tvx-ds-h {
  margin: 0 0 12px;
  padding-bottom: 6px;
  font-family: var(--tvx-font-pixel);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ui-heading);
  border-bottom: 2px solid #23272c;
  text-shadow: 1px 1px 0 #000;
}
.tvx-ds-k {
  font-family: var(--tvx-font-pixel);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-muted);
}
.tvx-ds-muted { color: var(--ui-muted); margin: 0 0 10px; }
.tvx-ds-meta { color: #c3c9ce; font-size: 0.86rem; text-shadow: 1px 1px 0 #000; }
.tvx-ds-note {
  margin: 12px 0 0;
  padding: 8px 12px;
  color: #d8dee3;
  background: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  border-left: 4px solid var(--ui-amber);
  font-size: 0.9rem;
}
.tvx-ds-note[hidden] { display: none; }
.tvx-ds-fine { margin: 12px 0 0; color: var(--ui-muted); font-size: 0.8rem; }
.tvx-ds-link {
  font-family: var(--tvx-font-pixel);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ui-cyan);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  /* WCAG 2.2 2.5.8: lift the tap area of these standalone secondary links
     (Back to game, Forgot password, footer links) to >=24px without changing
     the 11px text. Inline-block keeps them in the flex/text flow. */
  display: inline-block;
  padding: 7px 2px;
}
.tvx-ds-link:hover, .tvx-ds-link:focus-visible { border-bottom-color: var(--ui-cyan); outline: none; }

/* ---- chips -------------------------------------------------------------- */
.tvx-ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-family: var(--tvx-font-pixel);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  color: #dfe4e8;
  background: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  white-space: nowrap;
  vertical-align: middle;
}
.tvx-ds-chip[hidden] { display: none; }
.tvx-ds-chip.is-live { color: #bff3ff; }
.tvx-ds-chip.is-live::before { content: ""; width: 6px; height: 6px; background: var(--ui-cyan); }
.tvx-ds-chip.is-final { color: var(--ui-amber-hi); }
.tvx-ds-chip.is-idle { color: var(--ui-muted); }
.tvx-ds-chip.is-me { color: #06222a; background: var(--ui-cyan); border-color: #04161b; text-shadow: none; }
.tvx-ds-chip.is-tie { color: var(--ui-amber-hi); background: transparent; border-color: var(--ui-amber-lo); cursor: help; }

/* ---- bars, footers, filters -------------------------------------------- */
.tvx-ds-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
}
.tvx-ds-filter { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.tvx-ds-filter[hidden] { display: none; }
.tvx-ds-filter .tvx-seg-btn { padding: 6px 12px; cursor: pointer; }
.tvx-ds-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.tvx-ds-foot[hidden] { display: none; }
.tvx-ds-pager { display: flex; align-items: center; gap: 12px; }
.tvx-ds-pager[hidden] { display: none; }

/* ---- loading / empty / error / sign-in --------------------------------- */
.tvx-ds-state[hidden] { display: none; }
.tvx-ds-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
  padding: 24px 16px;
  text-align: center;
}
.tvx-ds-state-title {
  margin: 0;
  font-family: var(--tvx-font-pixel);
  font-size: 15px;
  letter-spacing: 0.06em;
  color: #f2f4ef;
  text-shadow: 2px 2px 0 #000;
}
.tvx-ds-state-text { margin: 0; color: var(--ui-muted); max-width: 46ch; }
.tvx-ds-state[data-state="error"] .tvx-ds-state-title { color: #ffb4a6; }
.tvx-ds-state[data-state="hidden"] .tvx-ds-state-title { color: var(--ui-amber-hi); }
.tvx-ds-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
/* Three pixel blocks; the lit block steps along. Static under reduced motion. */
.tvx-ds-spinner {
  width: 30px; height: 10px;
  background:
    linear-gradient(var(--ui-cyan), var(--ui-cyan)) 0 0 / 8px 10px no-repeat,
    linear-gradient(#18363d, #18363d) 11px 0 / 8px 10px no-repeat,
    linear-gradient(#18363d, #18363d) 22px 0 / 8px 10px no-repeat;
  animation: tvx-ds-step 0.9s steps(3, jump-none) infinite;
}
@keyframes tvx-ds-step {
  from { background-position: 0 0, 11px 0, 22px 0; }
  to { background-position: 22px 0, 0 0, 11px 0; }
}
@media (prefers-reduced-motion: reduce) { .tvx-ds-spinner { animation: none; } }
body.tvx-reduced-motion .tvx-ds-spinner { animation: none; }

/* ---- stat blocks ---------------------------------------------------------- */
.tvx-ds-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin: 0;
}
.tvx-ds-stat {
  padding: 10px 12px;
  background: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.5);
  min-width: 0;
}
.tvx-ds-stat dt {
  font-family: var(--tvx-font-pixel);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-muted);
  margin: 0 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tvx-ds-stat dd {
  margin: 0;
  font-family: var(--tvx-font-pixel);
  font-size: 22px;
  color: #ffffff;
  text-shadow: 2px 2px 0 #000;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tvx-ds-stat:first-child dd { color: var(--ui-amber-hi); }

/* =========================================================================
   LEADERBOARD
   ========================================================================= */
.tvx-lb { padding: 16px 18px 14px; }

/* Podium: CTFd top three in rank order. Visual order 2-1-3 (first place
   centre, tallest plinth) on wide screens; plain 1-2-3 when stacked. The
   rank number shown is always the API `pos`. */
.tvx-lb-podium {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}
.tvx-lb-podium[hidden] { display: none; }
.tvx-lb-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 0;
  text-align: center;
  background: rgba(20, 23, 27, 0.92);
  border: 2px solid var(--ui-ink);
  box-shadow: inset 0 0 0 2px var(--ui-frame), 0 4px 0 rgba(0, 0, 0, 0.4);
  min-width: 0;
}
.tvx-lb-slot.is-p1 { order: 2; --tvx-medal: var(--ui-amber); --tvx-medal-hi: var(--ui-amber-hi); --tvx-medal-lo: var(--ui-amber-lo); --tvx-plinth: 72px; }
.tvx-lb-slot.is-p2 { order: 1; --tvx-medal: #9aa4ae; --tvx-medal-hi: #d5dbe0; --tvx-medal-lo: #4c545c; --tvx-plinth: 44px; }
.tvx-lb-slot.is-p3 { order: 3; --tvx-medal: #a86b3c; --tvx-medal-hi: #d79a66; --tvx-medal-lo: #5a361a; --tvx-plinth: 22px; }
.tvx-lb-medal {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 20px;
  color: #15100a;
  background: var(--tvx-medal);
  border: 2px solid var(--ui-ink);
  box-shadow: inset 0 3px 0 var(--tvx-medal-hi), inset 0 -4px 0 var(--tvx-medal-lo);
}
.tvx-lb-pname {
  max-width: 100%;
  font-family: var(--tvx-font-pixel);
  font-size: 15px;
  letter-spacing: 0.03em;
  color: #ffffff;
  text-decoration: none;
  text-shadow: 2px 2px 0 #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.tvx-lb-pname:hover, a.tvx-lb-pname:focus-visible,
a.tvx-lb-name:hover, a.tvx-lb-name:focus-visible { color: var(--ui-cyan); outline: none; text-decoration: underline; text-underline-offset: 3px; }
.tvx-lb-pscore {
  font-family: var(--tvx-font-pixel);
  font-size: 26px;
  color: var(--tvx-medal-hi);
  text-shadow: 2px 2px 0 #000;
  font-variant-numeric: tabular-nums;
}
.tvx-lb-pscore small { font-size: 11px; color: var(--ui-muted); text-shadow: none; }
.tvx-lb-psub { color: #c3c9ce; font-size: 0.82rem; }
.tvx-lb-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 20px; }
.tvx-lb-psub { min-height: 1.2em; }
/* The plinth: a voxel step whose height encodes the place. */
.tvx-lb-plinth {
  align-self: stretch;
  height: var(--tvx-plinth);
  margin: 8px -10px 0;
  background-color: var(--ui-slab);
  background-image: linear-gradient(90deg, transparent 47%, rgba(0, 0, 0, 0.3) 47%, rgba(0, 0, 0, 0.3) 53%, transparent 53%);
  background-size: 24px 100%;
  border-top: 2px solid var(--ui-ink);
  box-shadow: inset 0 3px 0 var(--ui-slab-hi), inset 0 -4px 0 var(--ui-slab-lo);
}
.tvx-lb-slot.is-me { box-shadow: inset 0 0 0 2px var(--ui-cyan), 0 4px 0 rgba(0, 0, 0, 0.4); }
.tvx-lb-slot.is-vacant { background: rgba(14, 16, 19, 0.6); box-shadow: inset 0 0 0 2px #262b31; }
.tvx-lb-slot.is-vacant .tvx-lb-medal { background: #2a2f35; color: #6d757d; box-shadow: none; }
.tvx-lb-vacant { color: var(--ui-muted); font-family: var(--tvx-font-pixel); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

/* Ranked list: rows are slots, numbers right-aligned and tabular so ranks
   and scores line up at any length. */
.tvx-lb-list[hidden] { display: none; }
.tvx-lb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  table-layout: fixed;
}
.tvx-lb-table th {
  padding: 4px 12px;
  font-family: var(--tvx-font-pixel);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ui-muted);
  text-align: left;
  position: sticky;
  top: 0;
  background: #121519;
  z-index: 1;
}
.tvx-lb-table td {
  padding: 9px 12px;
  background: var(--ui-slot);
  border-top: 2px solid var(--ui-ink);
  border-bottom: 2px solid var(--ui-ink);
  color: #e9ece6;
  vertical-align: middle;
}
.tvx-lb-table td:first-child { border-left: 2px solid var(--ui-ink); }
.tvx-lb-table td:last-child { border-right: 2px solid var(--ui-ink); }
.tvx-lb-table tr:hover td { background: #171a1e; }
.tvx-lb-c-rank { width: 76px; }
.tvx-lb-c-extra { width: 104px; text-align: right; font-variant-numeric: tabular-nums; color: #c3c9ce; }
.tvx-lb-table th.tvx-lb-c-extra, .tvx-lb-table th.tvx-lb-c-score { text-align: right; }
.tvx-lb-c-score {
  width: 120px;
  text-align: right;
  font-family: var(--tvx-font-pixel);
  font-size: 15px;
  color: var(--ui-amber-hi);
  font-variant-numeric: tabular-nums;
}
.tvx-lb-users .tvx-lb-c-extra { display: none; }
.tvx-lb-rank { font-family: var(--tvx-font-pixel); font-size: 15px; color: #ffffff; }
.tvx-lb-c-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvx-lb-c-name .tvx-ds-chip { margin-left: 8px; }
.tvx-lb-name { color: #ffffff; text-decoration: none; font-weight: 600; }
.tvx-lb-table tr.is-me td { background: #16262b; border-color: #0e3a44; }
.tvx-lb-table tr.is-me td:first-child { box-shadow: inset 4px 0 0 var(--ui-cyan); }

/* In the game shell the list scrolls inside the panel, so the screen itself
   never needs a page scroll; on the CTFd route the page scrolls normally. */
@media (min-width: 761px) {
  /* The frame is bounded by the viewport (minus the screen padding, divided
     by the auto-zoom because the frame is zoomed) and laid out as a column:
     header, toolbar and podium keep their size, the ranked list takes the
     rest and scrolls inside the panel. */
  .tvx-screen-leaderboard:not(.tvx-screen-standalone) .tvx-screen-frame {
    max-height: calc((100vh - clamp(64px, 8vh, 92px) - clamp(12px, 2.4vh, 28px)) / var(--tvx-auto-zoom, 1));
    min-height: 0;
  }
  .tvx-screen-leaderboard:not(.tvx-screen-standalone) .tvx-lb {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  }
  .tvx-screen-leaderboard:not(.tvx-screen-standalone) .tvx-lb > * { flex: 0 0 auto; }
  .tvx-screen-leaderboard:not(.tvx-screen-standalone) .tvx-lb-list {
    flex: 1 1 auto; min-height: 120px; overflow: auto; overscroll-behavior: contain;
  }
}

/* Short windows (laptops at 125%, ~650-760px tall): a compact podium, so the
   ranked list keeps real room without the screen scrolling. */
@media (max-height: 760px) and (min-width: 701px) {
  .tvx-lb { padding: 12px 14px 10px; }
  .tvx-lb .tvx-ds-bar { margin-bottom: 8px; }
  .tvx-lb-podium { margin-bottom: 8px; gap: 8px; }
  .tvx-lb-slot { padding-top: 8px; gap: 3px; }
  .tvx-lb-medal { width: 32px; height: 32px; font-size: 15px; }
  .tvx-lb-pscore { font-size: 19px; }
  .tvx-lb-slot.is-p1 { --tvx-plinth: 30px; }
  .tvx-lb-slot.is-p2 { --tvx-plinth: 18px; }
  .tvx-lb-slot.is-p3 { --tvx-plinth: 8px; }
  .tvx-lb-plinth { margin-top: 4px; }
  .tvx-lb .tvx-ds-fine { margin-top: 6px; }
  .tvx-lb-table td { padding-top: 6px; padding-bottom: 6px; }
}
@media (max-width: 700px) {
  .tvx-lb-podium { grid-template-columns: 1fr; align-items: stretch; }
  .tvx-lb-slot { order: 0 !important; flex-direction: row; flex-wrap: wrap; justify-content: flex-start;
                 text-align: left; padding: 10px; gap: 6px 12px; }
  .tvx-lb-slot .tvx-lb-pname { flex: 1 1 0; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .tvx-lb-pscore { font-size: 20px; }
  .tvx-lb-plinth { display: none; }
  .tvx-lb-tags { justify-content: flex-start; }
  .tvx-lb-c-extra { display: none; }
  .tvx-lb-c-rank { width: 52px; }
  .tvx-lb-c-score { width: 88px; }
  .tvx-ds-filter { margin-left: 0; }
}

/* =========================================================================
   PLAYER PROFILE
   ========================================================================= */
.tvx-pf-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas: "id stats" "cats recent" "awards awards";
  gap: 12px;
}
.tvx-pf-grid[hidden] { display: none; }
.tvx-pf-id { grid-area: id; display: flex; gap: 16px; align-items: center; }
.tvx-pf-stats { grid-area: stats; display: flex; align-items: center; }
.tvx-pf-stats .tvx-ds-stats { width: 100%; }
.tvx-pf-cats { grid-area: cats; }
.tvx-pf-recent { grid-area: recent; }
.tvx-pf-awards { grid-area: awards; }
.tvx-pf-awards[hidden] { display: none; }
.tvx-pf-mono {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 40px;
  color: var(--ui-amber-text);
  background: var(--ui-amber);
  border: 2px solid var(--ui-ink);
  box-shadow: inset 0 4px 0 var(--ui-amber-hi), inset 0 -6px 0 var(--ui-amber-lo),
    inset 4px 0 0 rgba(255, 255, 255, 0.12), 0 4px 0 rgba(0, 0, 0, 0.45);
}
.tvx-pf-who { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tvx-pf-name {
  margin: 0;
  font-family: var(--tvx-font-pixel);
  font-size: 26px;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 3px 3px 0 #000;
  overflow-wrap: anywhere;
}
.tvx-pf-team { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tvx-pf-team[hidden] { display: none; }
.tvx-pf-teamlink { color: var(--ui-cyan); font-weight: 600; text-decoration: none; }
.tvx-pf-teamlink:hover, .tvx-pf-teamlink:focus-visible { text-decoration: underline; text-underline-offset: 3px; outline: none; }
.tvx-pf-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.tvx-pf-meta[hidden] { display: none; }
.tvx-pf-meta div { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.tvx-pf-meta dt { font-family: var(--tvx-font-pixel); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-muted); }
.tvx-pf-meta dd { margin: 0; color: #e9ece6; overflow-wrap: anywhere; }
.tvx-pf-meta a { color: var(--ui-cyan); }
.tvx-pf-links { display: flex; gap: 14px; flex-wrap: wrap; }

.tvx-pf-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tvx-pf-bar { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.tvx-pf-bar-name { font-family: var(--tvx-font-pixel); font-size: 11px; letter-spacing: 0.04em; color: #e9ece6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvx-pf-bar-track { height: 12px; background: var(--ui-slot); border: 2px solid var(--ui-ink); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.5); }
.tvx-pf-bar-fill { display: block; height: 100%; background: var(--tvx-realm, #7d8790); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25); }
.tvx-pf-bar-val { color: #c3c9ce; font-size: 0.82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tvx-pf [data-realm="crypto"] { --tvx-realm: var(--tvx-cat-crypto); }
.tvx-pf [data-realm="forensics"] { --tvx-realm: var(--tvx-cat-forensics); }
.tvx-pf [data-realm="osint"] { --tvx-realm: var(--tvx-cat-osint); }
.tvx-pf [data-realm="reverse"] { --tvx-realm: var(--tvx-cat-reverse); }
.tvx-pf [data-realm="web"] { --tvx-realm: var(--tvx-cat-web); }
.tvx-pf [data-realm="pwn"] { --tvx-realm: var(--tvx-cat-pwn); }
.tvx-pf [data-realm="misc"] { --tvx-realm: var(--tvx-cat-misc); }
.tvx-pf [data-realm="dfir"] { --tvx-realm: var(--tvx-cat-dfir); }
.tvx-pf [data-realm="cloud"] { --tvx-realm: var(--tvx-cat-cloud); }
.tvx-pf [data-realm="malware"] { --tvx-realm: var(--tvx-cat-malware); }
.tvx-pf [data-realm="bonus"] { --tvx-realm: var(--tvx-cat-bonus); }

.tvx-pf-log { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tvx-pf-log li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 7px 10px;
  background: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  border-left: 4px solid var(--tvx-realm, #4a525b);
}
.tvx-pf-log-name { color: #ffffff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvx-pf-log-cat { color: var(--ui-muted); font-size: 0.8rem; }
.tvx-pf-log-pts { font-family: var(--tvx-font-pixel); font-size: 13px; color: var(--ui-amber-hi); font-variant-numeric: tabular-nums; }
.tvx-pf-log-time { color: #aab2ba; font-size: 0.8rem; white-space: nowrap; }

@media (max-width: 860px) {
  .tvx-pf-grid { grid-template-columns: 1fr; grid-template-areas: "id" "stats" "cats" "recent" "awards"; }
}
@media (max-width: 520px) {
  .tvx-pf-id { flex-direction: column; }
  .tvx-pf-mono { width: 64px; height: 64px; font-size: 30px; }
  .tvx-pf-bar { grid-template-columns: 1fr auto; }
  .tvx-pf-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .tvx-pf-log li { grid-template-columns: minmax(0, 1fr) auto; }
  .tvx-pf-log-cat, .tvx-pf-log-time { font-size: 0.75rem; }
}

/* =========================================================================
   ACCOUNT (/settings) - CTFd form, the game material
   ========================================================================= */
.tvx-screen-account .tvx-settings-panel { padding: 18px 22px 22px; min-height: 0; }
.tvx-screen-standalone .tvx-screen-head-main { flex: 1 1 420px; min-width: 0; }
.tvx-screen-standalone .tvx-screen-subtitle { max-width: 64ch; margin: 8px 0 0; }
.tvx-screen-account .tvx-set-tab { display: block; width: 100%; }
.tvx-screen-account .tvx-set-tab.active {
  color: #ffffff;
  background: var(--ui-slab-hover);
  box-shadow: inset 5px 0 0 var(--ui-cyan), inset 0 3px 0 #6c7683, inset 0 -3px 0 var(--ui-slab-lo);
}
.tvx-screen-account .tvx-set-heading { font-size: 12px; margin-top: 20px; }
.tvx-screen-account .tab-pane > .tvx-set-heading:first-child,
.tvx-screen-account .tvx-acct-form > .tvx-set-heading:first-child { margin-top: 0; }
.tvx-acct-form { display: flex; flex-direction: column; gap: 12px; }
.tvx-acct-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tvx-acct-field .tvx-set-hint { margin: 0; }
.tvx-acct-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.tvx-screen-account .tvx-set-label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.tvx-screen-account .tvx-set-hint {
  color: var(--ui-muted);
  font-size: 0.84rem;
  line-height: 1.45;
  margin: -4px 0 0;
  border: 0;
  padding: 0;
}
.tvx-screen-account .tvx-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: #f2f4ef;
  background-color: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 1px #2a2f35;
  font: inherit;
}
.tvx-screen-account select.tvx-input {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ui-cyan) 50%), linear-gradient(135deg, var(--ui-cyan) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.tvx-screen-account select.tvx-input option { background: #14161a; color: #f2f4ef; }
.tvx-screen-account .tvx-input:hover { box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 1px #3a4049; }
.tvx-screen-account .tvx-input:focus,
.tvx-screen-account .tvx-input:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 1px; border-color: var(--ui-ink); }
.tvx-acct-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.tvx-acct-actions .tvx-btn-primary { min-width: 180px; }







@media (max-width: 760px) {
  .tvx-acct-pair { grid-template-columns: 1fr; }
  .tvx-screen-account .tvx-settings-nav { flex-direction: row; }
  .tvx-screen-account .tvx-set-tab { width: auto; flex: 1 1 0; }
  .tvx-acct-actions .tvx-btn-primary { width: 100%; }
  
  
}

@media (max-width: 620px) {
  .tvx-screen-standalone .tvx-screen-head { flex-direction: column; align-items: stretch; gap: 10px; }
  /* In a column the 420px basis became a 420px HEIGHT (dead gap under the title). */
  .tvx-screen-standalone .tvx-screen-head-main { flex: 0 0 auto; }
  .tvx-screen-standalone .tvx-screen-head-actions { flex-wrap: wrap; }
}

/* =========================================================================
   SETTINGS REFINEMENT (v1.3.0)
   - Labels no longer wrap: the label column fits the longest label
     ("Camera Parallax Sensitivity") at the pixel face size.
   - Section rhythm: one consistent space above every heading.
   - Hints sit under the control column on wide screens, so a row reads
     label -> control -> explanation instead of a full-width interruption.
   - Short windows (laptops at 125% scaling, ~650-760px tall) use a compact
     row height, so the panel needs far less internal scrolling.
   ========================================================================= */
.tvx-screen .tvx-set-row { grid-template-columns: 300px minmax(0, 1fr); column-gap: 18px; }
.tvx-screen .tvx-set-row .tvx-set-label { font-size: calc(13px * var(--tvx-ui-scale, 1)); line-height: 1.35; }
.tvx-screen .tvx-set-heading { margin: 18px 0 4px; }
.tvx-screen .tvx-set-page > .tvx-set-heading:first-child { margin-top: 0; }
@media (min-width: 761px) {
  .tvx-screen .tvx-set-row + .tvx-set-hint,
  .tvx-screen .tvx-set-row + .tvx-set-note { margin-left: 318px; margin-top: -4px; }
}
.tvx-screen .tvx-set-control input[type="range"] { flex: 1 1 200px; min-width: 120px; }
@media (max-height: 760px) and (min-width: 761px) {
  .tvx-screen .tvx-set-row { min-height: 34px; padding: 2px 0; }
  .tvx-screen .tvx-set-page { gap: 4px; }
  .tvx-screen .tvx-settings-panel { padding: 12px 18px 14px; }
  .tvx-screen .tvx-set-heading { margin-top: 12px; }
  .tvx-screen .tvx-set-tab { padding-top: 9px; padding-bottom: 9px; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .tvx-screen .tvx-set-row { grid-template-columns: 230px minmax(0, 1fr); }
  .tvx-screen .tvx-set-row + .tvx-set-hint,
  .tvx-screen .tvx-set-row + .tvx-set-note { margin-left: 248px; }
}
@media (max-width: 760px) {
  .tvx-screen .tvx-set-row { grid-template-columns: 1fr; }
}

/* No-JavaScript fallback on /scoreboard (server-rendered CTFd standings).
   The interactive board cannot load, so its empty shell is hidden. */
.tvx-lb-noscript { margin: 0 auto 32px; }
html:not(.tvx-js) .tvx-screen-leaderboard.tvx-screen-standalone .tvx-lb { display: none; }

/* =========================================================================
   v1.4.0 TITLE SCREEN
   Original TVX composition in the spirit of classic voxel-game title
   screens: block-extruded logo, tilted tagline, one centred slab stack,
   square utility buttons, version line in the corner. All live text and
   CSS - vector at every resolution (the screens are zoomed on large
   displays by home.js applyAutoZoom), no images, no game assets.
   ========================================================================= */
.tvx-screen-menu .tvx-world-inner.tvx-title {
  /* Hug the logo instead of a fixed box, so the column never reaches the
     avatar's side of the screen. */
  width: fit-content;
  max-width: calc(100vw - 32px);
  position: relative;
}
.tvx-title .tvx-world-kicker { margin-bottom: 4px; }

/* ---- Logo: two-tone pixel blocks with a stepped extrusion ---------------- */
.tvx-logo {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  margin: 0;
  padding: 0 0 0.24em;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: clamp(54px, 6.4vw, 104px);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-indent: 0.06em;
  /* One contained shadow under the whole wordmark, so the logo separates
     from busy scenery (brick roof, foliage) without a backing panel. */
  filter: drop-shadow(0 0.06em 0.12em rgba(0, 0, 0, 0.55));
}
.tvx-logo-gap { display: inline-block; width: 0.32em; }
/* Three layers per word: the span's own (transparent) text gives layout and
   the accessible name; ::before is the extrusion + ink outline; ::after is
   the banded face, painted last. (A text-clipped background on the span
   itself would be painted UNDER its z-index:-1 child in the same stacking
   context - the first build rendered the face dark for exactly that
   reason.) */
.tvx-logo-a, .tvx-logo-b {
  position: relative;
  display: inline-block;
  color: transparent;
  z-index: 0;
}
.tvx-logo-a::after, .tvx-logo-b::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  /* Banded fill (hard stops = pixel bevel, not a soft gradient). */
  background-image: linear-gradient(180deg,
    var(--tvx-logo-1) 0 16%, var(--tvx-logo-2) 16% 62%,
    var(--tvx-logo-3) 62% 84%, var(--tvx-logo-4) 84% 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  pointer-events: none;
}
.tvx-logo-a::before, .tvx-logo-b::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  color: var(--tvx-logo-side);
  -webkit-text-stroke: 0.07em #0b0c0e;
  text-shadow:
    0 0.035em 0 var(--tvx-logo-side),
    0 0.07em 0 var(--tvx-logo-side2),
    0 0.105em 0 var(--tvx-logo-side2),
    0 0.14em 0 #0b0c0e,
    0 0.2em 0.18em rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.tvx-logo-a {
  --tvx-logo-1: #ffffff; --tvx-logo-2: #dfe4e8; --tvx-logo-3: #bcc4ca; --tvx-logo-4: #98a1a8;
  --tvx-logo-side: #4b5258; --tvx-logo-side2: #30353a;
}
.tvx-logo-b {
  --tvx-logo-1: #fff0bf; --tvx-logo-2: #ffc554; --tvx-logo-3: #dc9a2e; --tvx-logo-4: #b8761d;
  --tvx-logo-side: #7a4c12; --tvx-logo-side2: #4f300a;
}
body.tvx-high-contrast .tvx-logo-a::after, body.tvx-high-contrast .tvx-logo-b::after { background: none; color: #ffffff; }

/* ---- Tagline: a tilted amber "splash" beside the logo -------------------- */
.tvx-title .tvx-splash {
  position: absolute;
  /* Minecraft-style splash set into the logo's lower-right CORNER, clearly
     below the glyph baseline (was crossing the letters). Pushed down + right
     so it reads as a deliberate accent, not collided with the wordmark; still
     clears the PLAY button below. */
  right: -1.1em;
  top: calc(1.6em + clamp(54px, 6.4vw, 104px) * 1.24);
  margin: 0;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #ffe36e;
  text-shadow: 2px 2px 0 #3d2c00;
  transform: rotate(-11deg);
  transform-origin: center;
  white-space: nowrap;
  animation: tvx-splash 1.7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes tvx-splash { from { scale: 1; } to { scale: 1.07; } }
@media (prefers-reduced-motion: reduce) { .tvx-title .tvx-splash { animation: none; } }
body.tvx-reduced-motion .tvx-title .tvx-splash,
body.tvx-no-menu-anim .tvx-title .tvx-splash { animation: none; }

/* ---- The stack ------------------------------------------------------------ */
.tvx-menu.tvx-menu-stack {
  width: min(440px, 100%);
  margin-top: clamp(18px, 3.2vh, 34px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Explicit heights (not padding + line-height), so full-width and paired
   buttons are exactly the same slab. */
.tvx-menu-stack .tvx-menu-btn { height: 46px; min-height: 0; padding-top: 0; padding-bottom: 0; font-size: 16px; line-height: 1; }
.tvx-menu-stack .tvx-menu-primary { height: 58px; font-size: 24px; }
.tvx-menu-pair { display: flex; gap: 10px; }
/* v1.6.2 nav fix: on narrow phones, text pairs (Leaderboard+Shop, Profile+Teams,
   Settings+Account) stack to full width so long uppercase pixel-font labels
   always fit. The icon-only utility row (.tvx-menu-util) stays horizontal -
   its fixed 42-46px squares fit fine. */
@media (max-width: 480px) {
  .tvx-menu-pair:not(.tvx-menu-util) { flex-direction: column; }
  /* the paired buttons use `flex: 1 1 0` for equal WIDTHS in a row; in a column
     that basis-0 would collapse their HEIGHT, so restore auto sizing (height:46px
     from .tvx-menu-stack .tvx-menu-btn then applies). */
  .tvx-menu-pair:not(.tvx-menu-util) > .tvx-menu-btn { flex: 0 0 auto; }
}
.tvx-menu-pair > .tvx-menu-btn {
  flex: 1 1 0;
  min-width: 0;
  /* Trimmed L/R padding (was 24px) so the longest half-width label
     ("Leaderboard") sits comfortably inside the button without shrinking the
     text or clipping; the corner studs (::before/::after at 9px) stay clear. */
  padding-left: 12px;
  padding-right: 12px;
  font-size: 15px;
  /* Tighter tracking on the 2-up pair buttons only (not PLAY/singles/global),
     so the longest label ("Leaderboard") stays comfortable even at the
     narrower tablet width. */
  letter-spacing: 0.015em;
  white-space: nowrap;
}
.tvx-menu-pair > .tvx-menu-btn::before { left: 9px; }
.tvx-menu-pair > .tvx-menu-btn::after { right: 9px; }
/* Square utility buttons: icon only (named by aria-label + title), so there
   is no label to push off-centre. */
.tvx-menu-pair > .tvx-menu-btn.tvx-menu-square {
  flex: 0 0 46px;
  width: 46px;
  padding: 0;
}
.tvx-menu-square::before, .tvx-menu-square::after { display: none; }
.tvx-menu-icon { width: 20px; height: 20px; fill: currentColor; display: block; }
.tvx-icon-sound .tvx-icon-x { display: none; }
[data-tvx-mute][aria-pressed="true"] .tvx-icon-wave { display: none; }
[data-tvx-mute][aria-pressed="true"] .tvx-icon-x { display: inline; }
[data-tvx-mute][aria-pressed="true"] { color: #ffb4a6; }

/* ---- Phase 4: character dock (controls anchored beneath the 3D avatar) ---- */
.tvx-char-dock { display: none; }
html[data-tvx-avatar] .tvx-char-dock {
  display: flex;
  gap: 8px;
  align-items: center;
  position: fixed;
  left: var(--tvx-avatar-cx);
  bottom: calc(var(--tvx-avatar-foot, 12px) + 8px);
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: auto;
}
.tvx-dock-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  color: #f1f4f2;
  background-color: #6b6f74;
  background-image: linear-gradient(to bottom, #8b9096 0%, #71767b 46%, #5d6267 100%);
  border: 2px solid #1b1e21;
  border-bottom-width: 4px;
  border-radius: 0;
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.26),
    inset -3px -3px 0 rgba(0, 0, 0, 0.34),
    0 3px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition:
    background-image 90ms var(--tvx-ease),
    transform 90ms var(--tvx-ease),
    box-shadow 90ms var(--tvx-ease);
}
.tvx-dock-icon { width: 22px; height: 22px; fill: currentColor; display: block; }
.tvx-dock-btn:hover { background-image: linear-gradient(to bottom, #9aa0a6 0%, #7e848a 46%, #686d72 100%); }
.tvx-dock-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.22), inset -3px -3px 0 rgba(0, 0, 0, 0.3);
}
.tvx-dock-btn:focus-visible { outline: 3px solid var(--tvx-accent); outline-offset: 2px; }
/* The dock carries notifications on desktop, so hide the menu's own bell there
   (its badge still syncs: notifications.js updates every [data-tvx-nt-badge]). */
html[data-tvx-avatar] .tvx-menu-bell { display: none; }
@media (prefers-reduced-motion: reduce) { .tvx-dock-btn { transition: none; } }

/* ---- Corner version line ---------------------------------------------------- */
.tvx-screen-menu .tvx-menu-corner {
  position: absolute;
  left: 14px;
  bottom: 10px;
  z-index: 3;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font-family: var(--tvx-font-pixel);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #f2f4ef;
  text-shadow: 2px 2px 0 #000;
  zoom: var(--tvx-auto-zoom, 1);
  pointer-events: none;
}
.tvx-corner-player { color: #cfe9f0; }
.tvx-corner-powered { color: #b9c2c8; }
body.tvx-hide-status .tvx-corner-player { display: none; }

/* ---- Phones: the logo wraps, the tagline sits under it, the corner text
   follows the menu instead of floating over it. ---------------------------- */
@media (max-width: 620px) {
  .tvx-logo { font-size: clamp(40px, 13vw, 60px); }
  .tvx-menu-pair > .tvx-menu-btn { font-size: 12px; padding-left: 10px; padding-right: 10px; letter-spacing: 0.04em; }
  .tvx-menu-pair > .tvx-menu-btn::before, .tvx-menu-pair > .tvx-menu-btn::after { display: none; }
  .tvx-menu-pair > .tvx-menu-btn.tvx-menu-square { flex-basis: 42px; width: 42px; }
  .tvx-title .tvx-splash { position: static; margin-top: 2px; font-size: 13px; transform: rotate(-4deg); }
  .tvx-screen-menu .tvx-menu-corner { position: static; align-items: center; margin: 18px auto 0; zoom: 1; }
  .tvx-menu-stack .tvx-menu-primary { font-size: 20px; }
}

/* =========================================================================
   v1.4.0 GATE SCREENS (sign in, create account, reset password, verify)
   The world is the backdrop: a still of the TVX world rendered by the
   theme's own renderer (static/img/world, see PROVENANCE.md) - full bleed,
   no blur, a light vignette only at the edges. One framed panel, the
   game's slab buttons, the design-system fields.
   ========================================================================= */
.tvx-screen.tvx-screen-standalone.tvx-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: clamp(20px, 5vh, 56px) 16px;
  background-color: #0e1412;
  background-image:
    radial-gradient(ellipse at center, rgba(5, 8, 7, 0) 45%, rgba(5, 8, 7, 0.55) 100%),
    image-set(url("../img/world/backdrop-1920.webp") 1x, url("../img/world/backdrop-3840.webp") 2x);
  background-size: cover;
  background-position: center 62%;
}
/* Large displays get the native 4K still regardless of pixel ratio. */
@media (min-width: 2200px) {
  .tvx-screen.tvx-screen-standalone.tvx-gate {
    background-image:
      radial-gradient(ellipse at center, rgba(5, 8, 7, 0) 45%, rgba(5, 8, 7, 0.55) 100%),
      url("../img/world/backdrop-3840.webp");
  }
}
/* The backdrop runs straight into the footer: the footer already reserves
   the hotbar space itself (padding-bottom), so the main area's own bottom
   padding/margin would only paint a dark band under the world. */
body.tvx[data-tvx-world="gate"] .tvx-main { padding: 0; margin: 0; }
body.tvx[data-tvx-world="gate"] .tvx-footer { margin-top: 0; }

.tvx-gate-panel {
  width: min(440px, 100%);
  padding: 22px 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  zoom: var(--tvx-gate-zoom, 1);
}
.tvx-gate-panel.tvx-gate-wide { width: min(560px, 100%); }
@media (min-width: 2200px) and (min-height: 1300px) { .tvx-gate-panel { --tvx-gate-zoom: 1.6; } }
@media (min-width: 3200px) and (min-height: 1900px) { .tvx-gate-panel { --tvx-gate-zoom: 2; } }

.tvx-gate-brand { align-self: center; text-decoration: none; line-height: 0; }
.tvx-gate-brand:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 4px; }
.tvx-logo.tvx-logo-mini { font-size: 38px; padding-bottom: 0.2em; }
.tvx-gate-title {
  margin: 0;
  text-align: center;
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 3px 3px 0 #000;
}
.tvx-gate-sub { margin: -6px 0 0; text-align: center; color: #c9d1d6; font-size: 0.92rem; line-height: 1.5; }

/* CTFd messages */
.tvx-gate-msg {
  padding: 10px 12px;
  background: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  border-left: 4px solid var(--ui-cyan);
  color: #dff6fb;
  font-size: 0.92rem;
  line-height: 1.45;
}
.tvx-gate-msg.is-error { border-left-color: #ff7a66; color: #ffd3cb; }

/* Fields */
.tvx-gate-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.tvx-gate .tvx-field { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; }
.tvx-gate .tvx-label {
  font-family: var(--tvx-font-pixel);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e9ece6;
}
.tvx-gate .tvx-input,
.tvx-gate-extra .form-control,
.tvx-gate-extra .form-select,
.tvx-gate-extra select,
.tvx-gate-extra input[type="text"],
.tvx-gate-extra input[type="email"],
.tvx-gate-extra input[type="url"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: #f2f4ef;
  background-color: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 1px #2a2f35;
  font: inherit;
  font-size: 1rem;
}
.tvx-gate .tvx-input:hover { box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 1px #3a4049; }
.tvx-gate .tvx-input:focus, .tvx-gate .tvx-input:focus-visible,
.tvx-gate-extra .form-control:focus, .tvx-gate-extra select:focus {
  outline: 3px solid var(--ui-cyan);
  outline-offset: 1px;
}
.tvx-gate .tvx-input[aria-invalid="true"] { box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 2px #ff7a66; }
.tvx-gate-extra label, .tvx-gate-extra .form-label {
  display: block; margin: 0 0 6px;
  font-family: var(--tvx-font-pixel); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: #e9ece6;
}
.tvx-gate-extra .mb-3, .tvx-gate-extra .form-group { margin: 0 0 12px; }
.tvx-gate-extra small, .tvx-gate-extra .form-text { color: var(--ui-muted); }
.tvx-gate-extra:empty { display: none; }
.tvx-gate .tvx-help { color: var(--ui-muted); font-size: 0.84rem; line-height: 1.4; margin-top: -4px; }
.tvx-gate .tvx-help:empty { display: none; }
.tvx-gate .tvx-help-error { color: #ffb4a6; }
.tvx-gate-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Password with a show/hide button inside the field */
.tvx-pw { position: relative; }
.tvx-pw .tvx-input { padding-right: 76px; }
.tvx-pw-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  min-width: 60px;
  padding: 0 8px;
  font-family: var(--tvx-font-pixel);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e9ece6;
  background: var(--ui-slab);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -2px 0 var(--ui-slab-lo);
  cursor: pointer;
}
.tvx-pw-toggle:hover { background: var(--ui-slab-hover); color: #ffffff; }
.tvx-pw-toggle[aria-pressed="true"] { color: var(--ui-cyan); }
.tvx-pw-toggle:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 1px; }

.tvx-gate-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.tvx-gate .tvx-btn-block { width: 100%; }
.tvx-gate .tvx-btn-primary { min-height: 48px; font-size: 15px; }
.tvx-gate-or { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--ui-muted);
  font-family: var(--tvx-font-pixel); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.tvx-gate-or::before, .tvx-gate-or::after { content: ""; flex: 1; height: 2px; background: #23272c; }
.tvx-gate-legal { text-align: center; margin: 0; }
.tvx-gate-legal a { color: var(--ui-cyan); }
.tvx-gate-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  padding-top: 12px;
  border-top: 2px solid #23272c;
  color: #c3c9ce;
  font-size: 0.9rem;
}
.tvx-gate-foot .tvx-gate-back { flex-basis: 100%; text-align: center; }

@media (max-width: 520px) {
  .tvx-screen.tvx-screen-standalone.tvx-gate { align-items: flex-start; padding-top: 16px; }
  .tvx-gate-panel { padding: 18px 16px 16px; }
  .tvx-gate-pair { grid-template-columns: 1fr; }
  .tvx-logo.tvx-logo-mini { font-size: 30px; }
}

/* v1.4.0 footer: one link to the game Settings (the Display panel is gone). */
.tvx-footer-settings { display: flex; align-items: center; gap: 10px; color: var(--ui-muted); }

/* =========================================================================
   v1.4.0 ONE LOOK ON EVERY CTFd ROUTE
   Teams, Users, Notifications, team pages, the legacy /challenges board and
   error pages keep their templates and behaviour; they now use the same
   materials as the game screens. The slab button rules above were widened
   from .tvx-screen to :is(.tvx-screen, .tvx-main, .modal) (same specificity), so
   every content button is the same amber/basalt slab. Here: the page header
   carries the world backdrop, and fields / tables use the design-system
   slot material.
   ========================================================================= */
.tvx-jumbotron {
  background-color: #0e1412;
  background-image:
    linear-gradient(rgba(7, 10, 9, 0.74), rgba(7, 10, 9, 0.88)),
    url("../img/world/backdrop-1920.webp");
  background-size: cover;
  background-position: center 58%;
  border-bottom: 2px solid var(--ui-ink);
  box-shadow: inset 0 -2px 0 var(--ui-frame);
}
.tvx-jumbotron h1 { text-shadow: 3px 3px 0 #000; }
.tvx-jumbotron .tvx-muted, .tvx-jumbotron p { color: #c9d1d6; }

:is(.tvx-main, .modal) :is(.tvx-input, .form-control, .form-select):not(.tvx-flag-input) {
  min-height: 42px;
  padding: 9px 12px;
  color: #f2f4ef;
  background-color: var(--ui-slot);
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 1px #2a2f35;
}
:is(.tvx-main, .modal) :is(.tvx-input, .form-control, .form-select):not(.tvx-flag-input):focus {
  outline: 3px solid var(--ui-cyan);
  outline-offset: 1px;
  border-color: var(--ui-ink);
}

.tvx-main .tvx-scoreboard { border-collapse: separate; border-spacing: 0 4px; }
.tvx-main .tvx-scoreboard th {
  font-family: var(--tvx-font-pixel);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ui-muted);
  background: transparent;
  border: 0;
}
.tvx-main .tvx-scoreboard td {
  background: var(--ui-slot);
  border-top: 2px solid var(--ui-ink);
  border-bottom: 2px solid var(--ui-ink);
}
.tvx-main .tvx-scoreboard td:first-child { border-left: 2px solid var(--ui-ink); }
.tvx-main .tvx-scoreboard td:last-child { border-right: 2px solid var(--ui-ink); }
.tvx-main .tvx-scoreboard tbody tr:hover td { background: #171a1e; }
.tvx-main .tvx-progress { background: var(--ui-slot); border: 2px solid var(--ui-ink); border-radius: 0; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.5); }
.tvx-main .tvx-progress > span { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.22); }

/* v1.4.0 typography: fixed-width, tabular figures where values change or
   must be copied exactly (instance countdown, host:port, flag input). */
.tvx-inst-timer { font-family: var(--tvx-font-mono); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.tvx-inst-conn code, .tvx-flag-input { font-family: var(--tvx-font-mono); }

/* v1.4.0: the fallback shows a still of the SAME world (rendered by the theme's
   own renderer), over the CSS scene. It is the first paint while the 3D world
   boots (and crossfades into it), and the polished background if WebGL is
   unavailable or fails. If the image cannot load, the CSS scene beneath shows. */
.tvx-world-fallback::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../img/world/backdrop-1920.webp") center 60% / cover no-repeat;
}
@media (min-width: 2200px), (min-resolution: 1.5dppx) {
  .tvx-world-fallback::after { background-image: url("../img/world/backdrop-3840.webp"); }
}

/* v1.4.0: on the homepage the game menu (and each screen's Back button) IS the
   navigation; the route-page hotbar would duplicate it. It was only hidden by
   accident (covered by the 3D layer) and showed through when WebGL was off. */
body.tvx-is-home .tvx-hotbar { display: none; }

/* v1.5.0: render fallback explanation (title-screen corner + Settings > Video). */
.tvx-screen-menu .tvx-menu-corner .tvx-corner-render { pointer-events: auto; color: var(--ui-amber-hi); text-decoration: underline; text-underline-offset: 3px; }
.tvx-screen-menu .tvx-menu-corner .tvx-corner-render[hidden] { display: none; }
.tvx-screen-menu .tvx-menu-corner .tvx-corner-render:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
.tvx-render-status { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border-left-color: var(--ui-amber) !important; color: #f1dcb0 !important; }
.tvx-render-status[hidden] { display: none; }

/* v1.5.0 rights line (footer + title-screen corner). */
.tvx-rights { margin: 0 0 4px; font-family: var(--tvx-font-pixel); font-size: 11px; letter-spacing: 0.04em; color: #c9d1d6; }
.tvx-rights a, .tvx-corner-rights a { color: var(--ui-cyan); text-decoration: underline; text-underline-offset: 3px; }

.tvx-screen-menu .tvx-menu-corner .tvx-corner-rights { color: #d7dde1; }
.tvx-screen-menu .tvx-menu-corner .tvx-corner-rights a { pointer-events: auto; }
.tvx-screen-menu .tvx-menu-corner .tvx-corner-rights a:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }

/* =========================================================================
   v1.5.0 DIRECTORY SCREENS (/teams, /users) - card list, CTFd hooks intact
   ========================================================================= */
.tvx-screen-dir .tvx-dir-panel { padding: 16px 20px 20px; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.tvx-dir-search { display: grid; grid-template-columns: minmax(130px, 180px) minmax(0, 1fr) auto auto; gap: 10px; align-items: stretch; }
.tvx-screen-dir .tvx-input {
  width: 100%; min-height: 42px; padding: 9px 12px; color: var(--ui-text);
  background-color: var(--ui-slot); border: 2px solid var(--ui-ink); border-radius: 0;
}
.tvx-screen-dir .tvx-input:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 1px; }
.tvx-dir-meta { margin: 0; color: var(--ui-muted); font-size: 0.9rem; }
.tvx-dir-meta strong { color: var(--ui-text); }
.tvx-dir-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tvx-dir-row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.8fr) minmax(0, 1.6fr) minmax(0, 1fr) auto;
  gap: 10px 16px; align-items: center; padding: 10px 14px; background: var(--ui-slab);
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo); border: 2px solid var(--ui-ink);
}
.tvx-dir-row:hover { background: var(--ui-slab-hover); }
.tvx-screen-dir .tvx-dir-list:not(:has(.tvx-dir-members)) .tvx-dir-row { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) minmax(0, 1fr) auto; }
.tvx-dir-name { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; font-weight: 700; color: var(--ui-text); overflow-wrap: anywhere; }
.tvx-dir-name a { color: var(--ui-text); text-decoration: none; }
.tvx-dir-name a:hover, .tvx-dir-name a:focus-visible { color: var(--ui-cyan); text-decoration: underline; }
.tvx-dir-cell { min-width: 0; color: #c9d1d6; font-size: 0.92rem; overflow-wrap: anywhere; }

.tvx-dir-web a { color: var(--ui-cyan); white-space: nowrap; }
.tvx-dir-empty { margin: 0; padding: 18px; text-align: center; color: var(--ui-muted); border: 2px dashed var(--ui-frame); }
.tvx-dir-pages { display: flex; gap: 8px; justify-content: center; align-items: center; }
.tvx-dir-pages .page-select { width: auto; min-width: 72px; }
@media (max-width: 760px) {
  .tvx-dir-search { grid-template-columns: 1fr 1fr; }
  .tvx-dir-search .tvx-dir-q { grid-column: 1 / -1; grid-row: 1; }
  .tvx-dir-row, .tvx-screen-dir .tvx-dir-list:not(:has(.tvx-dir-members)) .tvx-dir-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tvx-dir-name { grid-column: 1 / -1; }
  .tvx-dir-cell:empty { display: none; }
}

/* =========================================================================
   v1.5.0 TEAM SCREENS (/team, /teams/<id>)
   ========================================================================= */
.tvx-screen-team .tvx-settings-panel { padding: 16px 20px 20px; min-height: 0; }
.tvx-team-title { overflow-wrap: anywhere; }
.tvx-team-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.tvx-team-badges:empty { display: none; }
.tvx-team-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; align-items: start; }
.tvx-team-id { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.tvx-team-avatar { flex: 0 0 auto; margin: 0; }
.tvx-team-stats { margin: 0; justify-content: flex-start; }
.tvx-team-field { margin: 10px 0 0; color: #c9d1d6; overflow-wrap: anywhere; }
.tvx-team-field > span:first-child { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-muted); }
.tvx-team-field a { color: var(--ui-cyan); }
.tvx-screen-team .tvx-set-heading { font-size: 12px; margin: 18px 0 10px; text-align: left; }
.tvx-screen-team .tvx-team-members > .tvx-set-heading,
.tvx-screen-team .tvx-team-section > .tvx-set-heading:first-child { margin-top: 0; }
.tvx-team-count { margin-left: 6px; padding: 1px 7px; color: var(--ui-amber-text); background: var(--ui-amber); font-size: 11px; }
.tvx-team-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tvx-team-note { margin: 16px 0 0; color: var(--ui-muted); font-size: 0.9rem; }
.tvx-member-row, .tvx-screen-team .tvx-dir-list:not(:has(.tvx-dir-members)) .tvx-member-row { grid-template-columns: minmax(0, 1fr) auto; }
.tvx-member-row .tvx-slot-glyph { width: 28px; height: 28px; display: inline-grid; place-items: center; font-size: 13px; }
.tvx-member-score { color: var(--ui-heading); white-space: nowrap; }
.tvx-badge-captain { color: var(--ui-amber-text); background: var(--ui-amber-hi); }
.tvx-team-cat { display: inline-block; margin: 0 12px 0 0; }
.tvx-table-scroll { overflow-x: auto; max-width: 100%; }
@media (max-width: 860px) {
  .tvx-team-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .tvx-team-tools { grid-template-columns: minmax(0, 1fr); }
}
/* Phones: each solve becomes a card (name / category + value / time). */
@media (max-width: 600px) {
  .tvx-team-section .tvx-scoreboard thead { display: none; }
  .tvx-team-section .tvx-scoreboard, .tvx-team-section .tvx-scoreboard tbody { display: block; width: 100%; }
  .tvx-team-section .tvx-scoreboard tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; margin: 0 0 6px; padding: 8px 10px;
    background: var(--ui-slab); border: 2px solid var(--ui-ink);
  }
  .tvx-main .tvx-team-section .tvx-scoreboard td { display: block; padding: 0; border: 0; background: none; }
  .tvx-main .tvx-team-section .tvx-scoreboard td:first-child { grid-column: 1 / -1; font-weight: 700; overflow-wrap: anywhere; }
  .tvx-main .tvx-team-section .tvx-scoreboard td.solve-time { grid-column: 1 / -1; color: var(--ui-muted); font-size: 0.85rem; }
}

/* =========================================================================
   v1.6.x TEAMS REDESIGN — squad-card listing + richer team detail.
   Teams-scoped classes only; the shared .tvx-dir-* directory list (used by
   /users and member lists) is left untouched. Real server data only: no
   points/rank on the listing (not computed there) and no invented stats.
   ========================================================================= */
/* ---- Listing: integrated search toolbar ---- */
.tvx-teams-bar { display: grid; grid-template-columns: minmax(130px, 190px) minmax(0, 1fr) auto auto; gap: 10px; align-items: end; }
.tvx-teams-bar-cell { min-width: 0; display: flex; flex-direction: column; }
.tvx-teams-bar-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ui-muted); margin: 0 0 4px; }
.tvx-teams-bar .tvx-btn { min-height: 42px; }
.tvx-teams-sum { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; color: var(--ui-muted); font-size: 0.92rem; }
.tvx-teams-sum strong { color: var(--ui-heading); font-family: var(--tvx-font-pixel); font-size: 0.95rem; }
.tvx-teams-sum-page { color: var(--ui-muted); font-size: 0.82rem; }

/* ---- Listing: squad-card grid ---- */
.tvx-tgrid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr)); }
.tvx-tcard { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px;
  align-items: start; padding: 14px; background: var(--ui-slab); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo);
  transition: background var(--tvx-speed) var(--tvx-ease), border-color var(--tvx-speed) var(--tvx-ease); }
.tvx-tcard:hover { background: var(--ui-slab-hover); }
.tvx-tcard:focus-within { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
.tvx-tcard.is-self { border-color: var(--ui-cyan); box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo), 0 0 0 1px var(--ui-cyan); }
.tvx-tcard-avatar { width: 48px; height: 48px; display: grid; place-items: center; font-family: var(--tvx-font-pixel);
  font-size: 20px; line-height: 1; color: var(--tvx-primary-ink); background: var(--tc, var(--tvx-primary)); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 3px 0 var(--tvx-block-hi), inset 0 -4px 0 var(--tvx-block-lo); }
.tvx-tcard-body { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.tvx-tcard-name { margin: 0; font-size: 1rem; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.tvx-tcard-name a, .tvx-tcard-name span { color: var(--ui-text); text-decoration: none; }
.tvx-tcard-name a:hover, .tvx-tcard-name a:focus-visible { color: var(--ui-cyan); text-decoration: underline; }
/* The whole card is the click target for the team link; inner links sit above it. */
.tvx-tcard-name a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.tvx-tcard-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.tvx-tcard-badges:empty { display: none; }
.tvx-tcard-badges a, .tvx-tcard-web { position: relative; z-index: 1; }
.tvx-tcard-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 2px 0 0; }
.tvx-tcard-stat { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tvx-tcard-stat dt { margin: 0; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-muted); }
.tvx-tcard-stat dd { margin: 0; font-size: 0.9rem; color: var(--ui-text); overflow-wrap: anywhere; }
.tvx-tcard-aff { flex: 1 1 100%; }
.tvx-tcard-web { align-self: flex-start; color: var(--ui-cyan); font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
.tvx-tcard-web:hover, .tvx-tcard-web:focus-visible { text-decoration: underline; }

/* ---- Listing: polished empty state ---- */
.tvx-teams-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 18px; }
.tvx-teams-empty-glyph { font-size: 30px; line-height: 1; color: var(--ui-muted); opacity: 0.6; }
.tvx-teams-empty-text { margin: 0; color: var(--ui-muted); }

/* ---- Detail: points/cleared as stat panels ---- */
.tvx-team-stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.tvx-team-stats .tvx-stat { margin: 0; padding: 8px 14px; min-width: 78px; background: var(--ui-slot); border: 2px solid var(--ui-ink); text-align: center; }
.tvx-team-stats .tvx-stat-value { font-family: var(--tvx-font-pixel); font-size: 1.25rem; color: var(--ui-heading); }
.tvx-team-stats .tvx-stat-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ui-muted); }

/* ---- Detail: member rows as cards (scoped; shared .tvx-dir-row untouched) ---- */
.tvx-team-members .tvx-member-row { padding: 10px 12px; background: var(--ui-slab); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo);
  transition: background var(--tvx-speed) var(--tvx-ease); }
.tvx-team-members .tvx-member-row:hover { background: var(--ui-slab-hover); }
.tvx-team-members .tvx-member-row:focus-within { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
.tvx-team-members .tvx-slot-glyph { background: var(--ui-slot); border: 2px solid var(--ui-ink); color: var(--ui-heading); }
.tvx-team-members .tvx-badge-captain { font-weight: 700; }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .tvx-teams-bar { grid-template-columns: 1fr 1fr; }
  .tvx-teams-bar-q { grid-column: 1 / -1; grid-row: 1; }
}
@media (max-width: 420px) {
  .tvx-tcard { grid-template-columns: 1fr; }
  .tvx-tcard-avatar { width: 40px; height: 40px; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .tvx-tcard, .tvx-team-members .tvx-member-row { transition: none; }
}

/* =========================================================================
   v1.5.0 SHOP SCREEN (#/shop)
   ========================================================================= */
.tvx-shop-wallet { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 12px;
  font-family: var(--tvx-font-pixel); font-size: 13px; color: var(--ui-heading);
  background: var(--ui-slot); border: 2px solid var(--ui-ink); }
.tvx-shop-coin { width: 14px; height: 14px; background: var(--ui-amber-hi);
  box-shadow: inset -3px -3px 0 var(--ui-amber), inset 2px 2px 0 #fff3c4; }
.tvx-shop-wallet-label { color: var(--ui-muted); font-size: 11px; }
/* final2-dev.2: negative balance = owed coins after a reward reversal */
.tvx-shop-wallet.is-negative { border-color: #ff6b5b; color: #ffb3a1; box-shadow: inset 4px 0 0 #ff6b5b; }
.tvx-db-tile-coins.is-negative { box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo), inset 4px 0 0 #ff6b5b; }
.tvx-db-tile-coins.is-negative .tvx-db-value { color: #ffb3a1; }
.tvx-shop-body { display: flex; flex-direction: column; gap: 10px; }
.tvx-shop-tabs { flex-wrap: wrap; gap: 6px; }
.tvx-shop-tabs .tvx-set-tab { width: auto; }
.tvx-shop-tabs .tvx-set-tab.active { color: #fff; background: var(--ui-slab-hover);
  box-shadow: inset 0 -4px 0 var(--ui-cyan), inset 0 3px 0 #6c7683; }
.tvx-screen-shop .tvx-shop-panel { padding: 14px 18px 18px; min-height: 0; max-height: min(58vh, 560px); overflow: auto; }
.tvx-shop-note { margin: 0 0 12px; color: var(--ui-muted); font-size: 0.9rem; }
.tvx-shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tvx-shop-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--ui-slab);
  border: 2px solid var(--ui-ink); box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo); }
.tvx-shop-card:not(.is-owned):hover { border-color: var(--ui-frame-hi, #5a6672); }
.tvx-shop-card.is-owned { box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo), inset 4px 0 0 var(--ui-cyan); }
.tvx-shop-art { display: grid; place-items: center; height: 72px; background: var(--ui-slot); border: 2px solid var(--ui-ink); }
.tvx-shop-art img { image-rendering: pixelated; }

/* ---- v1.6.x Change Outfit: skin thumbnails, current-outfit preview, modal ---- */
/* Minecraft-skin face cropped from the 64x64 atlas head-front cell (8,8)-(16,16),
   magnified + pixelated. Only receives the same-origin proxy image. */
.tvx-skin-thumb { display: inline-block; width: 56px; height: 56px; image-rendering: pixelated;
  background-repeat: no-repeat; background-size: 448px 448px; background-position: -56px -56px;
  background-color: var(--ui-slot); border: 2px solid var(--ui-ink); }
.tvx-skin-thumb-lg { width: 72px; height: 72px; background-size: 576px 576px; background-position: -72px -72px; }

.tvx-outfit-preview { display: flex; gap: 14px; align-items: center; margin: 0 0 12px; padding: 10px 12px;
  background: var(--ui-slab); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo); }
.tvx-outfit-art { flex: 0 0 auto; display: grid; place-items: center; }
.tvx-outfit-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tvx-outfit-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ui-muted); }
.tvx-outfit-name { font-family: var(--tvx-font-pixel); font-size: 13px; color: var(--ui-heading); overflow-wrap: anywhere; }
.tvx-outfit-change { margin-top: 2px; }

.tvx-outfit-backdrop { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; padding: 16px;
  background: var(--tvx-overlay, rgba(7, 10, 9, 0.72)); }
.tvx-outfit-dialog { width: min(560px, 100%); max-height: min(82vh, 640px); display: flex; flex-direction: column;
  padding: 14px 16px 16px; background: var(--ui-panel, #14171a); border: 2px solid var(--ui-frame);
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.5); }
.tvx-outfit-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tvx-outfit-title { margin: 0; font-family: var(--tvx-font-pixel); font-size: 15px; color: var(--ui-heading); }
.tvx-outfit-close { min-width: 36px; }
.tvx-outfit-list { overflow-y: auto; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.tvx-outfit-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 10px; background: var(--ui-slab); border: 2px solid var(--ui-ink); }
.tvx-outfit-card.is-on { border-color: var(--ui-cyan); }
.tvx-outfit-card-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tvx-outfit-card-name { font-weight: 700; color: var(--ui-text); overflow-wrap: anywhere; }
.tvx-outfit-card-tag { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-muted); }
.tvx-outfit-current { white-space: nowrap; }
.tvx-outfit-status { margin: 10px 0 0; min-height: 1em; }
.tvx-outfit-status.is-ok { color: var(--ui-cyan); }
.tvx-outfit-status.is-error { color: var(--tvx-danger, #ff5d5d); }
@media (max-width: 560px) {
  .tvx-outfit-list { grid-template-columns: minmax(0, 1fr); }
  .tvx-outfit-preview { flex-wrap: wrap; }
}
.tvx-shop-team-sample { font-weight: 700; font-size: 1.05rem; padding: 0 8px; text-align: center; overflow-wrap: anywhere; }
.tvx-shop-name { margin: 0; font-size: 0.95rem; color: var(--ui-text); }
.tvx-shop-blurb { margin: 2px 0 0; font-size: 0.82rem; color: #c9d1d6; line-height: 1.4; }
.tvx-shop-price { margin: 4px 0 0; font-family: var(--tvx-font-pixel); font-size: 11px; color: var(--ui-heading); }
.tvx-shop-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.tvx-shop-tag { font-family: var(--tvx-font-pixel); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 7px; color: var(--ui-muted); border: 2px solid var(--ui-frame); }
.tvx-shop-tag.is-on { color: var(--ui-amber-text); background: var(--ui-amber-hi); border-color: var(--ui-ink); }
.tvx-shop-actions .tvx-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.tvx-shop-status { min-height: 1.4em; margin: 12px 0 0; font-size: 0.9rem; color: #c9d1d6; }
.tvx-shop-status.is-ok { color: #9be564; }
.tvx-shop-status.is-error { color: #ffb4b4; }
.tvx-shop-loading { color: var(--ui-muted); margin: 0; }
.tvx-shop-earn { color: #c9d1d6; font-size: 0.88rem; }
.tvx-shop-earn summary { cursor: pointer; color: var(--ui-cyan); }
.tvx-shop-earn p { margin: 6px 0 0; }
@media (max-width: 620px) {
  .tvx-shop-grid { grid-template-columns: minmax(0, 1fr); }
  .tvx-screen-shop .tvx-shop-panel { max-height: none; }
}


/* ==========================================================================
   v1.6.0 DESIGN SYSTEM - segmented pixel slider (Checkpoint B)
   The native <input type="range"> is kept (keyboard, screen readers, step
   precision untouched); only its track and thumb are drawn as blocks.
   The lit portion is the exact value (--tvx-fill, set by home.js), so a
   segment can be partly lit: the track looks segmented without rounding
   the setting. See docs/TVX-DESIGN-SYSTEM.md.
   ========================================================================== */
.tvx-screen .tvx-set-control input[type="range"] {
  --tvx-seg: calc(100% / var(--tvx-seg-count, 20));
  height: 30px;
}
.tvx-screen .tvx-set-control input[type="range"]::-webkit-slider-runnable-track {
  height: 18px;
  border: 2px solid var(--ui-ink);
  box-shadow: none;
  background:
    repeating-linear-gradient(to right,
      transparent 0 calc(var(--tvx-seg) - var(--tvx-seg-gap, 3px)),
      var(--ui-ink) calc(var(--tvx-seg) - var(--tvx-seg-gap, 3px)) var(--tvx-seg)),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0 3px, transparent 3px calc(100% - 3px), rgba(0, 0, 0, 0.38) calc(100% - 3px)),
    linear-gradient(to right, var(--tvx-seg-on, #4de3ff) 0 var(--tvx-fill, 50%), var(--tvx-seg-off, #23272d) var(--tvx-fill, 50%) 100%);
}
.tvx-screen .tvx-set-control input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 30px;
  margin-top: -6px;
  background: #c7cdd3;
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 3px 0 #ffffff, inset 0 -4px 0 #7b838c, inset 3px 0 0 #e3e7ea, inset -3px 0 0 #9aa2ab;
}
.tvx-screen .tvx-set-control input[type="range"]:hover::-webkit-slider-thumb { background: #e2e7eb; }
.tvx-screen .tvx-set-control input[type="range"]:active::-webkit-slider-thumb {
  background: #ffffff;
  box-shadow: inset 0 3px 0 #ffffff, inset 0 -4px 0 var(--ui-cyan-deep), inset 3px 0 0 #ffffff, inset -3px 0 0 #b9c1c8;
}
.tvx-screen .tvx-set-control input[type="range"]::-moz-range-track {
  height: 14px;
  border: 2px solid var(--ui-ink);
  background:
    repeating-linear-gradient(to right,
      transparent 0 calc(var(--tvx-seg) - var(--tvx-seg-gap, 3px)),
      var(--ui-ink) calc(var(--tvx-seg) - var(--tvx-seg-gap, 3px)) var(--tvx-seg)),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0 3px, transparent 3px calc(100% - 3px), rgba(0, 0, 0, 0.38) calc(100% - 3px)),
    linear-gradient(to right, var(--tvx-seg-on, #4de3ff) 0 var(--tvx-fill, 50%), var(--tvx-seg-off, #23272d) var(--tvx-fill, 50%) 100%);
}
/* The lit part is drawn on the track so its segments line up; the native
   progress bar would restart the pattern at its own width. */
.tvx-screen .tvx-set-control input[type="range"]::-moz-range-progress { height: 0; border: 0; background: transparent; }
.tvx-screen .tvx-set-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 26px;
  background: #c7cdd3;
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 3px 0 #ffffff, inset 0 -4px 0 #7b838c;
}
.tvx-screen .tvx-set-control input[type="range"]:active::-moz-range-thumb { background: #ffffff; }
.tvx-screen .tvx-set-control input[type="range"]:disabled { cursor: not-allowed; opacity: 0.45; filter: grayscale(1); }
/* Narrow screens: fewer, larger blocks (same value precision). */
@media (max-width: 520px) {
  .tvx-screen .tvx-set-control input[type="range"] { --tvx-seg: calc(100% / 10); }
}

/* =========================================================================
   v1.6.0 DESIGN SYSTEM - CHECKPOINT C (Teams, Team, Account, World Select)
   Shared components only; no per-screen clones.
   - Dialogs: Bootstrap moves .modal under <body>, outside .tvx-main, so the
     slab buttons and slot fields never reached them (Edit Team showed a
     plain green SUBMIT). The shared selectors above now read
     :is(.tvx-screen, .tvx-main, .modal) - same specificity - and the dialog
     shell, labels and hints below match the gate/Account forms.
   ========================================================================= */
.tvx .modal-content {
  background: #121519;
  border: 2px solid var(--ui-ink);
  border-radius: 0;
  box-shadow: inset 0 0 0 2px var(--ui-frame), inset 0 4px 0 2px #4a525d, 0 12px 40px rgba(0, 0, 0, 0.6);
  color: var(--ui-text);
}
.tvx .modal-header { border-bottom: 2px solid #23272c; padding: 16px 20px 12px; }
.tvx .modal-header .modal-action { margin: 0; font-family: var(--tvx-font-pixel); font-size: 20px; letter-spacing: 0.08em; color: var(--ui-heading); text-shadow: 2px 2px 0 #000; }
.tvx .modal-body { padding: 16px 20px 20px; }
.tvx .modal-footer { border-top: 2px solid #23272c; }
.modal .tvx-field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; min-width: 0; }
.modal .tvx-field > b { display: contents; font-weight: inherit; }
.modal .tvx-label, .modal .form-label {
  margin: 0; font-family: var(--tvx-font-pixel); font-weight: 400; font-size: 12px;
  letter-spacing: 0.06em; text-transform: uppercase; color: #e9ece6;
}
.modal .tvx-help { margin: 0; color: var(--ui-muted); font-size: 0.84rem; line-height: 1.4; }
.modal .tvx-help:empty { display: none; }
.modal hr { border-color: #23272c; opacity: 1; }
.modal .tvx-btn-primary.modal-action { float: right; min-width: 180px; }
.tvx .modal-backdrop.show { opacity: 0.72; }

/* Solves table on the team pages: it sits in .tvx-table-scroll (overflow-x),
   which becomes the sticky containing block, so the leaderboard's
   `thead th { position: sticky; top: 60px }` pushed the header 60px down onto
   the first row (labels printed over "Crypto", "150", ...). */
.tvx-table-scroll .tvx-scoreboard thead th { position: static; }

/* Team directory: the signed-in player's own team (server data). */
.tvx-dir-row.is-self { box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo), inset 4px 0 0 var(--ui-cyan); }
.tvx-badge-self { color: #04222a; background: var(--ui-cyan); }
.tvx-dir-row:focus-within { outline: 3px solid var(--ui-cyan); outline-offset: 1px; }
.tvx-dir-row:focus-within a:focus-visible { outline: 0; }

/* Account / dialogs: native selects keep their real value; the blank option
   now has a visible label (template), and the arrow area stays clear. */
:is(.tvx-main, .modal) select:is(.tvx-input, .form-select) { padding-right: 36px; text-overflow: ellipsis; }
:is(.tvx-main, .modal) select:is(.tvx-input, .form-select) option { color: #f2f4ef; background: #15181c; }
.tvx-acct-results:empty { display: none; }
.tvx-acct-results .tvx-alert { text-align: left; display: flex; align-items: center; gap: 10px; }
.tvx-acct-results .tvx-alert .btn-close { margin-left: auto; flex: 0 0 auto; }
.tvx-alert-danger { color: #ffd3cb; }

/* =========================================================================
   v1.6.0 D - AVATARS, FRAMES, NAMEPLATES, PODIUM ARMOUR, CATEGORY FILTER
   ========================================================================= */
/* Pixel portrait (avatar2d.js): a 32x32 canvas scaled with crisp pixels. */
.tvx-av {
  --av: 64px;
  --fr-a: #2a2f35; --fr-b: #0a0b0d;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: var(--av); height: var(--av);
  padding: 3px;
  background: var(--ui-ink);
  box-shadow: inset 0 0 0 1px #3a4049;
}
.tvx-av-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.tvx-av-sm { --av: 32px; padding: 2px; }
.tvx-av-md { --av: 48px; }
.tvx-av-lg { --av: 96px; padding: 5px; }
.tvx-av-podium { --av: 84px; padding: 4px; }

/* Profile frames (shop): block-pattern borders from two catalog colours. */
.tvx-frame { padding: 6px; background-color: var(--fr-b); box-shadow: inset 0 0 0 2px var(--ui-ink); }
.tvx-av-sm.tvx-frame { padding: 3px; }
.tvx-av-lg.tvx-frame { padding: 9px; }
.tvx-frame-plank { background-image: repeating-linear-gradient(90deg, var(--fr-a) 0 10px, var(--fr-b) 10px 12px); }
.tvx-frame-cobble { background-image: linear-gradient(45deg, var(--fr-a) 25%, transparent 25% 75%, var(--fr-a) 75%),
  linear-gradient(45deg, var(--fr-a) 25%, transparent 25% 75%, var(--fr-a) 75%);
  background-size: 10px 10px; background-position: 0 0, 5px 5px; background-color: #5c6168; }
.tvx-frame-circuit { background-image: linear-gradient(90deg, transparent 45%, var(--fr-b) 45% 55%, transparent 55%),
  linear-gradient(0deg, transparent 45%, var(--fr-b) 45% 55%, transparent 55%); background-size: 12px 12px; background-color: var(--fr-a); }
.tvx-frame-crystal { background-image: linear-gradient(135deg, var(--fr-a) 0 40%, var(--fr-b) 40% 60%, var(--fr-a) 60%); background-size: 8px 8px; }
.tvx-frame-bloom { background-image: radial-gradient(var(--fr-a) 30%, transparent 32%); background-size: 9px 9px; background-color: var(--fr-b); }

/* Nameplate title (shop): curated text under a player's name. */
.tvx-nameplate {
  display: inline-block; max-width: 100%; padding: 2px 8px;
  font-family: var(--tvx-font-pixel); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: #ffe9a8; background: #2b2416; border: 2px solid var(--ui-ink);
  box-shadow: inset 0 1px 0 #5c4a24; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Podium armour tiers: original material-inspired tints (display only). */
.tvx-lb-slot.is-netherite { --tvx-medal: #4a4246; --tvx-medal-hi: #e6d8f5; --tvx-medal-lo: #1d191b; }
.tvx-lb-slot.is-diamond   { --tvx-medal: #4fd6d2; --tvx-medal-hi: #b8fbf8; --tvx-medal-lo: #1f8a87; }
.tvx-lb-slot.is-gold      { --tvx-medal: #e8b730; --tvx-medal-hi: #ffe27a; --tvx-medal-lo: #9c6c0c; }
.tvx-lb-slot.is-netherite .tvx-lb-medal { color: #f1e8ff; }
.tvx-lb-slot.is-netherite .tvx-lb-plinth { background-color: #2e2a2c; box-shadow: inset 0 3px 0 #5a5054, inset 0 -4px 0 #18151a; }
.tvx-lb-slot.is-diamond .tvx-lb-plinth { background-color: #2a7f7c; box-shadow: inset 0 3px 0 #67d9d4, inset 0 -4px 0 #165553; }
.tvx-lb-slot.is-gold .tvx-lb-plinth { background-color: #9c7418; box-shadow: inset 0 3px 0 #e8c25a, inset 0 -4px 0 #5e4408; }
.tvx-lb-slot .tvx-av { box-shadow: inset 0 0 0 1px var(--tvx-medal-hi), 0 3px 0 rgba(0, 0, 0, 0.45); }
.tvx-lb-rep { color: #c3c9ce; font-size: 0.8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvx-lb-slot.is-vacant .tvx-av { opacity: 0.3; }

/* Category filter: same segmented blocks as the bracket filter. Arabic
   labels get a face that has the glyphs (the pixel face is Latin only). */
.tvx-lb-cats .tvx-lb-cat { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif; font-size: 15px; font-weight: 700; letter-spacing: 0; text-transform: none; min-width: 72px; }
@media (max-height: 760px) and (min-width: 701px) {
  .tvx-av-podium { --av: 56px; padding: 3px; }
}
@media (max-width: 700px) {
  .tvx-av-podium { --av: 64px; }
}

/* v1.6.0 profile choice groups: real radio inputs drawn as block toggles. */
.tvx-choice { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.tvx-choice legend { float: none; width: auto; padding: 0; margin: 0 0 6px; }
.tvx-choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tvx-choice-opt { position: relative; display: block; margin: 0; cursor: pointer; }
.tvx-choice-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tvx-choice-face {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 10px;
  font-family: var(--tvx-font-pixel); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; text-align: center;
  color: #d9dee2; background: var(--ui-slab); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo);
  transition: background-color var(--tvx-speed-fast) linear;
}
.tvx-choice-opt:hover .tvx-choice-face { background: var(--ui-slab-hover); }
.tvx-choice-opt input:checked + .tvx-choice-face {
  color: #04222a; background: var(--ui-cyan);
  box-shadow: inset 0 2px 0 #b8f5ff, inset 0 -3px 0 var(--ui-cyan-deep);
}
.tvx-choice-opt input:focus-visible + .tvx-choice-face { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
.tvx-choice-opt input:disabled + .tvx-choice-face { opacity: 0.45; cursor: not-allowed; }
.tvx-country { display: flex; flex-direction: column; gap: 6px; }
.tvx-country .tvx-country-filter { min-height: 38px; font-size: 0.95rem; }
.tvx-acct-profile { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid #23272c; }
.tvx-acct-incomplete { text-align: left; }
@media (max-width: 380px) { .tvx-choice-row { grid-template-columns: 1fr; } }
/* Profile ID card: the pixel portrait replaces the letter monogram. */
.tvx-pf-mono.has-avatar { width: auto; height: auto; padding: 0; background: none; box-shadow: none; border: 0; }
.tvx-pf-who .tvx-nameplate { margin: 2px 0 6px; }
.tvx-pf-incomplete { margin: 0 0 10px; }
@media (max-width: 700px) { .tvx-pf-mono.has-avatar .tvx-av-lg { --av: 72px; padding: 4px; } }

/* v1.6.0 team banners (shop): pixel patterns in the team colour. The
   stepped bottom edge is a clip-path polygon (no images). */
.tvx-banner {
  --bn: #4de3ff; --bn-field: #1a1d22;
  display: inline-block; flex: 0 0 auto; width: 44px; height: 64px;
  background-color: var(--bn-field); border: 2px solid var(--ui-ink);
  clip-path: polygon(0 0, 100% 0, 100% 86%, 75% 86%, 75% 93%, 50% 93%, 50% 100%, 25% 93%, 25% 86%, 0 86%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.12);
}
.tvx-banner-chevron { background-image: linear-gradient(135deg, transparent 38%, var(--bn) 38% 52%, transparent 52%), linear-gradient(225deg, transparent 38%, var(--bn) 38% 52%, transparent 52%); background-size: 50% 100%; background-repeat: no-repeat; background-position: 0 0, 100% 0; }
.tvx-banner-cross { background-image: linear-gradient(90deg, transparent 40%, var(--bn) 40% 60%, transparent 60%), linear-gradient(0deg, transparent 42%, var(--bn) 42% 56%, transparent 56%); }
.tvx-banner-checker { background-image: linear-gradient(45deg, var(--bn) 25%, transparent 25% 75%, var(--bn) 75%), linear-gradient(45deg, var(--bn) 25%, transparent 25% 75%, var(--bn) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.tvx-banner-tower { background-image: linear-gradient(var(--bn), var(--bn)), linear-gradient(var(--bn), var(--bn)), linear-gradient(var(--bn), var(--bn)), linear-gradient(var(--bn), var(--bn));
  background-size: 40% 50%, 14% 10%, 14% 10%, 14% 10%; background-position: 50% 70%, 30% 18%, 50% 18%, 70% 18%; background-repeat: no-repeat; }
.tvx-banner-lg { width: 64px; height: 92px; }
.tvx-shop-art .tvx-av { margin: 0 auto; }
.tvx-shop-art .tvx-nameplate { font-size: 12px; padding: 6px 10px; }
.tvx-shop-empty { grid-column: 1 / -1; margin: 0; padding: 18px; text-align: center; color: var(--ui-muted); border: 2px dashed var(--ui-frame); }
.tvx-shop-inv-tab { margin-left: 4px; padding-left: 16px; border-left: 2px solid var(--ui-frame); }
.tvx-shop-art { height: auto; min-height: 84px; padding: 6px; }

/* v1.6.0 notifications board + player portraits on route pages. */
.tvx-notice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tvx-notice { padding: 12px 14px; background: var(--ui-slab); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo), inset 4px 0 0 var(--ui-amber); }
.tvx-notice-title { margin: 0 0 6px; font-family: var(--tvx-font-pixel); font-size: 14px; letter-spacing: 0.04em; color: var(--ui-heading); }
.tvx-notice-body { color: #e3e7ea; line-height: 1.5; overflow-wrap: anywhere; }
.tvx-notice-body > :last-child { margin-bottom: 0; }
.tvx-notice-time { margin: 6px 0 0; color: var(--ui-muted); font-size: 0.82rem; }
.tvx-member-row .tvx-slot-glyph.has-avatar { width: auto; height: auto; background: none; border: 0; box-shadow: none; padding: 0; }
.tvx-member-row .tvx-nameplate { font-size: 9px; padding: 1px 6px; }
.tvx-player-portrait.has-avatar .tvx-av-lg { --av: 88px; }
.tvx-player-who { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.tvx-team-id .tvx-banner { align-self: center; }

/* v1.6.0 in-game notification toasts (live.js). */
.tvx-toasts { position: fixed; top: 16px; right: 16px; z-index: 1200; display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.tvx-toast { position: relative; pointer-events: auto; padding: 10px 40px 10px 14px; background: #121519;
  border: 2px solid var(--ui-ink); box-shadow: inset 0 0 0 2px var(--ui-frame), inset 5px 0 0 var(--ui-cyan), 0 6px 0 rgba(0, 0, 0, 0.45); }
.tvx-toast.is-alert { box-shadow: inset 0 0 0 2px var(--ui-frame), inset 5px 0 0 var(--ui-amber), 0 6px 0 rgba(0, 0, 0, 0.45); }
.tvx-toast-title { margin: 0 0 4px; font-family: var(--tvx-font-pixel); font-size: 13px; letter-spacing: 0.04em; color: var(--ui-heading); }
.tvx-toast-body { margin: 0; color: #e3e7ea; font-size: 0.92rem; line-height: 1.45; overflow-wrap: anywhere; }
.tvx-toast-close { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 2px solid var(--ui-ink);
  background: var(--ui-slab); color: #e9ece6; font-size: 18px; line-height: 1; cursor: pointer; }
.tvx-toast-close:hover { background: var(--ui-slab-hover); }
.tvx-toast-close:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 1px; }

/* ---- v1.6.1 panel host: CTFd pages inside the game document ------------------
   panelhost.js layers the page (its own full TVX layout) over the menu so the
   game document and its music player never unload. The game's own hotbar is
   hidden underneath (the page brings its own); live toasts stay on top. */
.tvx-panelhost {
  position: fixed; inset: 0; z-index: 1400;
  background: var(--tvx-bg-deep, #0b0f0e);
}
.tvx-panelhost[hidden] { display: none; }
.tvx-panelhost-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--tvx-bg-deep, #0b0f0e); }
html[data-tvx-panel-open] .tvx-hotbar { visibility: hidden; }
html[data-tvx-panel-open] .tvx-toasts { z-index: 1450; }
/* v1.6.1 Staff console link in the title-screen corner (Staff / Admin only). */
.tvx-screen-menu .tvx-menu-corner .tvx-corner-staff { pointer-events: auto; color: var(--ui-cyan); text-decoration: underline; text-underline-offset: 3px; display: inline-block; padding: 5px 2px; }
.tvx-screen-menu .tvx-menu-corner .tvx-corner-staff:focus-visible { outline: 3px solid var(--ui-cyan); outline-offset: 2px; }
/* Post-v1.6.1 leaderboard rows: character portrait + The End chip. */
.tvx-lb-c-name .tvx-av { vertical-align: middle; margin-right: 8px; }
.tvx-ds-chip.is-end { background: #2b2410; color: #ffd25e; border-color: #8a6a1e; }
/* Post-v1.6.1 notifications: bell badge + #/notifications screen. */
.tvx-menu-bell { position: relative; }
.tvx-nt-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  background: #c8352a; color: #fff; font-size: 11px; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px #1a1a1a; pointer-events: none; }
.tvx-nt-body { max-width: 860px; margin: 0 auto; width: 100%; overflow-y: auto; max-height: calc(100vh - 220px); }
.tvx-nt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tvx-nt-item { background: rgba(20, 22, 26, 0.88); border: 2px solid #3a3f47; padding: 12px 14px; }
.tvx-nt-item.is-new { border-color: #49c6d8; }
.tvx-nt-item.is-pinned { border-color: #d8b049; }
.tvx-nt-item.is-important .tvx-nt-cat, .tvx-nt-item.is-maintenance .tvx-nt-cat { background: #5a1f1a; color: #ffd0c8; }
.tvx-nt-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.tvx-nt-time { margin-left: auto; font-size: 12px; opacity: 0.75; }
.tvx-nt-title { font-size: 18px; margin: 0 0 6px; overflow-wrap: anywhere; }
.tvx-nt-line { margin: 0 0 4px; overflow-wrap: anywhere; white-space: pre-wrap; }
.tvx-nt-link { margin-top: 6px; }
/* Post-v1.6.1 temple emblem link (tracks the 3D emblem; see world-next.js). */
.tvx-temple-link { position: absolute; z-index: 1; visibility: hidden; pointer-events: auto; cursor: pointer;
  display: block; background: transparent; border: 0; }
.tvx-temple-link:hover, .tvx-temple-link:focus-visible { outline: 3px solid #e9b949; outline-offset: 3px;
  box-shadow: 0 0 18px rgba(56, 214, 255, 0.55); }
/* Post-v1.6.1 Sponsors page. */
.tvx-sponsors-body { max-width: 980px; margin: 0 auto; width: 100%; }
.tvx-sponsor-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tvx-sponsor-card { background: rgba(20, 22, 26, 0.9); border: 2px solid #3a3f47; padding: 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tvx-sponsor-logo { max-width: 160px; max-height: 80px; object-fit: contain; image-rendering: auto; }
.tvx-sponsor-name { font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.tvx-sponsor-card:hover { border-color: var(--tvx-accent); }
/* Phase 6: polished, game-like sponsors empty state. */
.tvx-sponsor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 40px 24px;
  max-width: 460px;
  margin: 24px auto;
}
.tvx-sponsor-empty-icon { color: var(--tvx-accent); }
.tvx-sponsor-empty-icon svg { width: 56px; height: 56px; fill: currentColor; display: block; }
.tvx-sponsor-empty-title {
  font-family: var(--tvx-font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1rem;
  margin: 0;
  color: #f1f4f2;
}
.tvx-sponsor-empty-text { margin: 0; color: var(--tvx-muted); line-height: 1.55; }
/* Post-v1.6.1 community links (homepage, top right; clear of menu and avatar). */
.tvx-social { position: absolute; top: 18px; right: 22px; z-index: 3; display: flex; gap: 8px; pointer-events: auto; }
@media (max-width: 720px) { .tvx-social { top: auto; bottom: 14px; right: 12px; } }

/* ==========================================================================
   About Us - CTFd route /about (plugins/tvx_staff/views.py), theme template
   about.html. v1.6.2.
   Every selector is scoped under .tvx-screen-about (or, for the backdrop,
   under body:has(.tvx-screen-about)), so no rule here can reach another
   route; the page itself only reuses existing design-system pieces
   (.tvx-ds-panel, .tvx-ds-h/-k/-fine, .tvx-btn, .tvx-screen-head/-kicker/
   -title/-subtitle).
   ========================================================================== */

/* ---- World backdrop ------------------------------------------------------
   v1.6.2: the screen sits over the same render the gate screens use, so the
   route reads as another screen of the same game instead of a bare article.

   The layer is painted by body::after and NEVER by a descendant of
   .tvx-main: .tvx-main carries the 0.42s tvx-world-enter transform, and a
   transformed ancestor re-anchors (and re-scales) anything fixed inside it,
   which would make the backdrop jump when the enter animation ends.

   Layer order matches two existing recipes exactly - the .tvx-gate vignette
   over the .tvx-jumbotron scrim - so headings, fine print and buttons keep
   the contrast they have on the plain dark route background. The rule only
   exists while :has(.tvx-screen-about) matches, i.e. on this route only;
   browsers without :has() simply keep today's plain background. */
body.tvx:has(.tvx-screen-about)::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #0e1412;
  background-image:
    radial-gradient(ellipse at center, rgba(5, 8, 7, 0) 45%, rgba(5, 8, 7, 0.55) 100%),
    linear-gradient(rgba(7, 10, 9, 0.74), rgba(7, 10, 9, 0.88)),
    image-set(url("../img/world/backdrop-1920.webp") 1x, url("../img/world/backdrop-3840.webp") 2x);
  background-size: cover;
  background-position: center, center, center 62%;
  background-repeat: no-repeat;
}

.tvx-screen-about .tvx-screen-frame {
  width: min(960px, 100%);
  gap: clamp(16px, 2.4vh, 26px);
  /* The frame is now a .tvx-ds-panel as well (template change), so the slab
     padding is its 16px/18px default unless overridden here: a screen-wide
     slab needs more room than one content card. */
  padding: clamp(16px, 3vw, 26px);
}

/* ---- A / G: hero + closing panel ---------------------------------------- */
.tvx-screen-about .tvx-about-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: clamp(18px, 3vw, 28px);
}
.tvx-screen-about .tvx-about-kicker { margin: 0; }
.tvx-screen-about .tvx-about-title {
  margin: 0;
  font-size: clamp(24px, 4.4vw, 40px);
  line-height: 1.15;
}
.tvx-screen-about .tvx-about-lede {
  margin: 0;
  max-width: 78ch;
  font-size: calc(1rem * var(--tvx-ui-scale, 1));
  line-height: 1.6;
  color: var(--tvx-muted);
}
.tvx-screen-about .tvx-about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}
/* Explicit: the closing call to action is the one centred block on the page. */
.tvx-screen-about .tvx-about-cta { align-items: center; text-align: center; }
.tvx-screen-about .tvx-about-cta .tvx-about-lede { text-align: center; }
.tvx-screen-about .tvx-about-cta .tvx-about-actions { justify-content: center; }

/* ---- B / C: prose blocks ------------------------------------------------- */
.tvx-screen-about .tvx-about-prose {
  font-size: calc(0.98rem * var(--tvx-ui-scale, 1));
  line-height: 1.65;
}
.tvx-screen-about .tvx-about-prose p { margin: 0 0 10px; }
.tvx-screen-about .tvx-about-prose p:last-child { margin-bottom: 0; }

/* ---- D / E / F: bare sections (heading + grid on the screen background) --- */
.tvx-screen-about .tvx-about-sect {
  font-size: 16px;
  letter-spacing: 0.1em;
  margin: 6px 0 14px;
  padding-bottom: 8px;
  border-bottom-color: var(--ui-ink);
}

/* ---- D: schedule --------------------------------------------------------- */
.tvx-screen-about .tvx-about-schedule {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tvx-screen-about .tvx-about-round {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tvx-screen-about .tvx-about-round-k { margin: 0; color: var(--ui-heading); }
/* The date is data, not layout: it wraps instead of being clipped or
   ellipsised (the .tvx-ds-stat cells above ellipsis, which must not happen to
   "Date to be announced"). Uppercasing is CSS only, so the source stays
   readable - and the closing CTA below quotes the same value. */
.tvx-screen-about .tvx-about-round-date {
  margin: 0;
  font-family: var(--tvx-font-pixel);
  font-size: clamp(18px, 2.6vw, 24px);
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fbf3df;
  text-shadow: 3px 3px 0 #000;
  overflow-wrap: anywhere;
}
.tvx-screen-about .tvx-about-round-note {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--tvx-muted);
}

/* ---- E: why participate -------------------------------------------------- */
.tvx-screen-about .tvx-about-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tvx-screen-about .tvx-about-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tvx-screen-about .tvx-about-card-t {
  margin: 0;
  font-family: var(--tvx-font-pixel);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-heading);
  text-shadow: 2px 2px 0 #000;
}
.tvx-screen-about .tvx-about-card-p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #d8dee3;
}

/* ---- F: explore links ---------------------------------------------------- */
.tvx-screen-about .tvx-about-links {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.tvx-screen-about .tvx-about-link { width: 100%; }
/* WCAG 2.2 2.5.8: the default screen button row is 38px; on this page the
   buttons ARE the page's primary tap targets, so lift them to 48px.
   Scoped, so no other route's buttons change size. */
.tvx-screen-about .tvx-btn { min-height: 48px; }

/* ---- narrow screens ------------------------------------------------------ */
@media (max-width: 700px) {
  .tvx-screen-about .tvx-about-schedule,
  .tvx-screen-about .tvx-about-cards { grid-template-columns: minmax(0, 1fr); }
  .tvx-screen-about .tvx-about-title { font-size: clamp(22px, 7vw, 30px); }
  .tvx-screen-about .tvx-about-sect { font-size: 14px; }
  /* Full-width actions: the primary slab's 30px side padding plus 16px letter
     tracking makes "JOIN THE COMPETITION" wider than a 390px viewport, which
     would push the hero out of its panel. */
  .tvx-screen-about .tvx-about-actions { width: 100%; flex-direction: column; }
  .tvx-screen-about .tvx-about-actions .tvx-btn { width: 100%; padding-inline: 14px; }
}

/* No motion of its own: only the shared slab-button hover, which the global
   .tvx reduced-motion rule (tvx.css ~L1171) already collapses to 0.01ms. */

/* ---- Featured Cave Expedition entrance (main menu) ---------------------- *
 * A prominent voxel cave mouth + a readable JOIN CAVE sign. Builds on
 * .tvx-menu-btn for the proven slab/bevel/press behaviour, then overrides to a
 * taller, left-aligned two-part layout (pixel-art tile + sign). Static art, so
 * the shared reduced-motion rule already covers it. */
.tvx-cave-entry {
  justify-content: flex-start;
  gap: 16px;
  min-height: 76px;
  padding: 12px 18px;
  text-align: left;
  white-space: normal;
  /* cooler, green-tinted "stone cave" face, distinct from the grey menu slabs */
  background-color: #2b3a32;
  background-image: linear-gradient(to bottom, #3a4f44 0%, #26332c 48%, #1b2620 100%);
  border-top-color: var(--tvx-primary);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.14),
    inset -3px -3px 0 rgba(0, 0, 0, 0.40),
    0 3px 0 rgba(0, 0, 0, 0.45),
    0 0 22px rgba(70, 224, 168, 0.14);
}
.tvx-cave-entry:hover {
  background-color: #32433a;
  background-image: linear-gradient(to bottom, #445d50 0%, #2d3c33 48%, #202d26 100%);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.20),
    inset -3px -3px 0 rgba(0, 0, 0, 0.40),
    0 5px 0 rgba(0, 0, 0, 0.45),
    0 0 28px rgba(70, 224, 168, 0.26);
}
/* pixel-art cave-mouth tile (crisp hard-stop stone frame + stepped dark arch) */
.tvx-cave-art {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  background-color: #5d6267;
  background-image: linear-gradient(to bottom, #787d82 0 18%, #5d6267 18% 100%);
  border: 2px solid #15110c;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.14), inset -2px -2px 0 rgba(0, 0, 0, 0.45);
  image-rendering: pixelated;
}
.tvx-cave-opening {
  position: absolute;
  left: 14px; right: 14px; top: 22px; bottom: 6px;
  background: #05080e;
  box-shadow: 0 0 0 2px #0c1f18;
}
.tvx-cave-opening::before {       /* narrower top block -> blocky stepped arch */
  content: "";
  position: absolute;
  left: 4px; right: 4px; bottom: 100%; height: 6px;
  background: #05080e;
}
.tvx-cave-ore { position: absolute; width: 5px; height: 5px; }
.tvx-cave-ore-gold { left: 6px; top: 9px; background: var(--tvx-gold); box-shadow: 0 0 4px rgba(255, 216, 100, 0.85); }
.tvx-cave-ore-gem { right: 7px; top: 15px; background: var(--tvx-primary); box-shadow: 0 0 4px rgba(70, 224, 168, 0.85); }
.tvx-cave-torch { position: absolute; right: 8px; bottom: 10px; width: 4px; height: 7px; background: #ffae4a; box-shadow: 0 0 7px 2px rgba(255, 150, 40, 0.7); }
/* the sign */
.tvx-cave-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.tvx-cave-sign {
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: 0.16em;
  color: var(--tvx-primary);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  line-height: 1;
}
.tvx-cave-entry:hover .tvx-cave-sign { color: #6effc0; }
.tvx-cave-sub {
  font-family: var(--tvx-font-pixel);
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: #cfe6da;
  text-transform: none;
  line-height: 1.1;
}
/* ---- final2-dev: player Dashboard (#/dashboard) ------------------------------------
   Same slab / slot / ink language as the shop and profile screens. No animation:
   values are static text; the only change over time is the instance countdown. */
.tvx-screen-dashboard .tvx-db-body { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px 18px;
  max-height: min(68vh, 760px); overflow: auto; }
.tvx-db-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tvx-db-tiles[hidden], .tvx-db-grid[hidden] { display: none; }
.tvx-db-tile, .tvx-db-panel { background: var(--ui-slab); border: 2px solid var(--ui-ink);
  box-shadow: inset 0 2px 0 var(--ui-slab-hi), inset 0 -3px 0 var(--ui-slab-lo); padding: 10px 12px; min-width: 0; }
.tvx-db-label, .tvx-db-h { margin: 0 0 4px; font-family: var(--tvx-font-pixel); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ui-heading); display: flex; align-items: center; gap: 6px; }
.tvx-db-h { font-size: 12px; margin-bottom: 8px; }
.tvx-db-sub { margin: 10px 0 4px; font-size: 0.8rem; color: var(--ui-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tvx-db-value { margin: 0; font-family: var(--tvx-font-pixel); font-size: 20px; color: var(--ui-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tvx-db-note { margin: 4px 0 0; color: var(--ui-muted); font-size: 0.85rem; }
.tvx-db-note a { color: var(--ui-cyan); }
.tvx-db-bar { display: block; height: 8px; margin-top: 6px; background: var(--ui-slot); border: 2px solid var(--ui-ink); }
.tvx-db-bar > span { display: block; height: 100%; width: 0; background: var(--tvx-realm, var(--ui-cyan)); }
.tvx-db-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tvx-db-wide { grid-column: span 3; }
.tvx-db-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tvx-db-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 8px;
  background: var(--ui-slot); border: 2px solid var(--ui-ink); font-size: 0.9rem; color: var(--ui-text); }
.tvx-db-row-main { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.tvx-db-row-side { color: var(--ui-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tvx-db-row-note { flex-basis: 100%; color: var(--ui-muted); font-size: 0.8rem; }
.tvx-db-row.is-in .tvx-db-row-side { color: #9be564; }
.tvx-db-row.is-out .tvx-db-row-side { color: #ff9e6d; }
.tvx-db-row.is-mine { box-shadow: inset 4px 0 0 var(--ui-cyan); }
.tvx-db-row.is-queued { box-shadow: inset 4px 0 0 var(--ui-amber-hi); }
.tvx-db-inst.is-running { box-shadow: inset 4px 0 0 #5ac86e; }
.tvx-db-inst.is-failed { box-shadow: inset 4px 0 0 #ff7a59; }
.tvx-db-inst.is-pending, .tvx-db-inst.is-stopping { box-shadow: inset 4px 0 0 var(--ui-amber-hi); }
.tvx-db-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tvx-db-empty { color: var(--ui-muted); font-size: 0.9rem; padding: 4px 0; }
.tvx-db-realms { list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tvx-db-realm { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px;
  background: var(--ui-slot); border: 2px solid var(--ui-ink); box-shadow: inset 4px 0 0 var(--tvx-realm, var(--ui-cyan)); }
.tvx-db-realm.is-bonus { border-color: color-mix(in srgb, var(--tvx-cat-bonus) 70%, #000); }
.tvx-db-realm-name { font-family: var(--tvx-font-pixel); font-size: 11px; color: var(--tvx-realm, var(--ui-text)); }
.tvx-db-realm-count { color: var(--ui-text); font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; }
.tvx-db-realm-pts { grid-column: 1 / -1; color: var(--ui-muted); font-size: 0.8rem; }
.tvx-db-realm .tvx-db-bar { grid-column: 1 / -1; margin-top: 2px; }
.tvx-screen-dashboard .tvx-ds-state[data-kind="error"] { color: #ffb3a1; }
.tvx-screen-dashboard .tvx-ds-state[data-kind="ok"] { color: #b6f0a8; }
.tvx-screen-dashboard .tvx-ds-state:empty { display: none; }
/* Panel-level states are one line, not the 180 px full-screen empty state (UI check finding). */
.tvx-db-panel .tvx-ds-state { min-height: 0; padding: 4px 0 8px; align-items: flex-start; text-align: left;
  color: var(--ui-muted); font-size: 0.9rem; }
.tvx-db-body > .tvx-ds-state:empty { display: none; }
@media (max-width: 900px) {
  .tvx-db-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tvx-db-grid { grid-template-columns: minmax(0, 1fr); }
  .tvx-db-wide { grid-column: auto; }
  .tvx-screen-dashboard .tvx-db-body { max-height: none; overflow: visible; padding: 10px; }
}
@media (max-width: 420px) {
  .tvx-db-tiles { grid-template-columns: minmax(0, 1fr); }
  .tvx-db-value { font-size: 17px; }
}

/* ---- final2-dev: shop scope tags + History tab ---------------------------------------- */
.tvx-shop-scope { margin: 2px 0 0; font-size: 0.78rem; letter-spacing: 0.02em; padding: 2px 6px; width: fit-content;
  border: 2px solid var(--ui-ink); background: var(--ui-slot); color: var(--ui-muted); }
.tvx-shop-scope.is-team { color: #bfe9ff; box-shadow: inset 3px 0 0 var(--ui-cyan); }
.tvx-shop-scope.is-personal { color: #e9ece6; box-shadow: inset 3px 0 0 var(--ui-amber-hi); }
.tvx-shop-scope.is-reward { color: #b6f0a8; box-shadow: inset 3px 0 0 #5ac86e; }
.tvx-shop-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; grid-column: 1 / -1; }
.tvx-shop-tx { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 6px 10px; background: var(--ui-slot);
  border: 2px solid var(--ui-ink); color: var(--ui-text); font-size: 0.9rem; }
.tvx-shop-tx-amt { font-variant-numeric: tabular-nums; font-family: var(--tvx-font-pixel); font-size: 12px; }
.tvx-shop-tx.is-in .tvx-shop-tx-amt { color: #9be564; }
.tvx-shop-tx.is-out .tvx-shop-tx-amt { color: #ff9e6d; }
.tvx-shop-tx.is-refunded, .tvx-shop-tx.is-reversed { opacity: 0.75; }
.tvx-shop-tx-meta { grid-column: 1 / -1; color: var(--ui-muted); font-size: 0.8rem; }

/* ---- final2-dev.1: Teams as blocks ------------------------------------------------------
   Original pixel treatment (no game textures): bevelled slab, 4px speckle, team colour
   along the top edge, top-3 trims in diamond / gold / iron tones. Equal card heights. */
.tvx-tgrid-blocks { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; align-items: stretch; }
.tvx-tblock { grid-template-columns: auto minmax(0, 1fr); align-content: start; overflow: hidden; padding-top: 16px;
  background-color: var(--ui-slab);
  background-image: linear-gradient(45deg, rgba(255,255,255,0.025) 25%, transparent 25% 75%, rgba(255,255,255,0.025) 75%),
                    linear-gradient(45deg, rgba(255,255,255,0.025) 25%, transparent 25% 75%, rgba(255,255,255,0.025) 75%);
  background-size: 8px 8px; background-position: 0 0, 4px 4px;
  box-shadow: inset 0 4px 0 var(--tc, var(--ui-slab-hi)), inset 0 -3px 0 var(--ui-slab-lo), 4px 4px 0 rgba(0,0,0,0.35); }
.tvx-tblock.is-diamond { border-color: #4fd8d2; box-shadow: inset 0 4px 0 #4fd8d2, inset 0 -3px 0 #1d8f8b, 0 0 0 1px #4fd8d2, 4px 4px 0 rgba(0,0,0,0.35); }
.tvx-tblock.is-gold { border-color: #f6cf3f; box-shadow: inset 0 4px 0 #f6cf3f, inset 0 -3px 0 #b07f0c, 0 0 0 1px #f6cf3f, 4px 4px 0 rgba(0,0,0,0.35); }
.tvx-tblock.is-iron { border-color: #c9ced3; box-shadow: inset 0 4px 0 #c9ced3, inset 0 -3px 0 #7c8389, 0 0 0 1px #c9ced3, 4px 4px 0 rgba(0,0,0,0.35); }
.tvx-tblock-top { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tvx-tblock-banner { position: absolute; top: 4px; right: 10px; width: 22px; height: 32px; opacity: 0.9; }
.tvx-tblock-stats .tvx-tcard-stat dd { font-variant-numeric: tabular-nums; font-weight: 700; }
.tvx-emblem { display: block; image-rendering: pixelated; flex: none; box-shadow: 0 0 0 2px var(--ui-ink), 3px 3px 0 rgba(0,0,0,0.45); }
.tvx-rank-medal { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; padding: 2px 6px;
  font-family: var(--tvx-font-pixel); font-size: 11px; color: var(--ui-text); background: var(--ui-slot);
  border: 2px solid var(--ui-ink); box-shadow: inset 2px 2px 0 rgba(255,255,255,0.12); font-variant-numeric: tabular-nums; }
.tvx-rank-medal.is-diamond { background: #4fd8d2; color: #062625; box-shadow: inset 2px 2px 0 #b4fff9, inset -2px -2px 0 #1d8f8b; }
.tvx-rank-medal.is-gold { background: #f6cf3f; color: #2a1a02; box-shadow: inset 2px 2px 0 #fff3a1, inset -2px -2px 0 #b07f0c; }
.tvx-rank-medal.is-iron { background: #d3d3d3; color: #1b1d1f; box-shadow: inset 2px 2px 0 #ffffff, inset -2px -2px 0 #8c8c8c; }
.tvx-screen-kicker .tvx-rank-medal { margin-left: 6px; vertical-align: middle; }
.tvx-badge-end { background: #2fe39a; color: #062018; }
.tvx-team-hero { display: flex; align-items: center; gap: 16px; }
.tvx-team-extras { margin-top: 12px; }
.tvx-team-realms, .tvx-team-achs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tvx-team-realm { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--ui-slot);
  border: 2px solid var(--ui-ink); box-shadow: inset 4px 0 0 var(--tvx-realm, var(--ui-cyan)); }
.tvx-team-realm[data-realm="dfir"] { --tvx-realm: var(--tvx-cat-dfir); } .tvx-team-realm[data-realm="cloud"] { --tvx-realm: var(--tvx-cat-cloud); }
.tvx-team-realm[data-realm="malware"] { --tvx-realm: var(--tvx-cat-malware); } .tvx-team-realm[data-realm="reverse"] { --tvx-realm: var(--tvx-cat-reverse); }
.tvx-team-realm[data-realm="web"] { --tvx-realm: var(--tvx-cat-web); } .tvx-team-realm[data-realm="pwn"] { --tvx-realm: var(--tvx-cat-pwn); }
.tvx-team-realm[data-realm="crypto"] { --tvx-realm: var(--tvx-cat-crypto); }
.tvx-team-realm[data-realm="osint"] { --tvx-realm: var(--tvx-cat-osint); } .tvx-team-realm[data-realm="bonus"] { --tvx-realm: var(--tvx-cat-bonus); }
.tvx-team-realm-n { color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.tvx-team-ach { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--ui-slot); border: 2px solid var(--ui-ink); }
.tvx-team-ach-ico { width: 12px; height: 12px; flex: none; background: var(--ui-amber-hi); box-shadow: inset -2px -2px 0 var(--ui-amber); }
.tvx-team-ach.is-first_blood .tvx-team-ach-ico { background: #ff6b5b; box-shadow: inset -2px -2px 0 #a3271c; }
.tvx-team-ach.is-the_end .tvx-team-ach-ico { background: #2fe39a; box-shadow: inset -2px -2px 0 #138a5c; }
.tvx-team-swatch { display: inline-block; width: 14px; height: 14px; background: var(--tc); border: 2px solid var(--ui-ink); vertical-align: middle; }
.tvx-staff-pub { display: inline-block; padding: 1px 6px; margin-left: 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  color: #0b1013; background: var(--rank, #bfe9ff); box-shadow: inset 2px 2px 0 rgba(255,255,255,0.45), inset -2px -2px 0 rgba(0,0,0,0.3); vertical-align: middle; }
@media (max-width: 520px) {
  .tvx-tgrid-blocks { grid-template-columns: minmax(0, 1fr); }
  .tvx-tblock { grid-template-columns: auto minmax(0, 1fr); }
  .tvx-team-hero { gap: 10px; }
  .tvx-team-hero .tvx-emblem { width: 52px; height: 52px; }
}

/* ---- tvx_institutions: University / School classification ---------------- */
:root { --tvx-inst-uni: #6fb3ff; --tvx-inst-school: #f6c453; }
.tvx-inst { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; min-width: 0; }
.tvx-inst-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; font-family: var(--tvx-font-pixel);
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.4; white-space: nowrap;
  border: 2px solid currentColor; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35); background: rgba(0, 0, 0, 0.35); }
.tvx-inst-badge.is-university { color: var(--tvx-inst-uni); }
.tvx-inst-badge.is-school { color: var(--tvx-inst-school); }
.tvx-inst-badge.is-unclassified { color: var(--tvx-muted); border-style: dashed; }
.tvx-inst-ico { width: 12px; height: 12px; flex: none; }
.tvx-inst-name { color: var(--tvx-text); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tvx-tcard-inst { margin: 2px 0 6px; min-width: 0; }
.tvx-tcard-inst .tvx-inst-name { font-size: 0.8rem; color: var(--tvx-muted); }
.tvx-optional { color: var(--tvx-muted); font-family: var(--tvx-font-body, inherit); font-size: 0.8em; font-weight: 400; letter-spacing: 0; text-transform: none; }
.tvx-inst-name-row { margin-top: 4px; }
.tvx-inst-name-row[hidden] { display: none; }

.tvx-inst-pick { border: 2px solid var(--tvx-border); padding: 10px 12px; margin: 12px 0; }
.tvx-inst-pick legend { padding: 0 6px; width: auto; }
.tvx-inst-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.tvx-inst-type { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer;
  border: 2px solid var(--tvx-border); background: var(--tvx-surface-2); font-family: var(--tvx-font-pixel); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em; }
.tvx-inst-type:has(input:checked) { border-color: var(--tvx-primary); box-shadow: inset 0 0 0 2px var(--tvx-primary-dim); }
.tvx-inst-type input { accent-color: var(--tvx-primary); }
.tvx-inst-type:has(input[value="university"]) .tvx-inst-ico { color: var(--tvx-inst-uni); }
.tvx-inst-type:has(input[value="school"]) .tvx-inst-ico { color: var(--tvx-inst-school); }

.tvx-inst-panel { margin-top: calc(var(--tvx-unit) * 2); }
.tvx-inst-current { margin-bottom: 8px; }
.tvx-inst-form { margin-top: 8px; }
.tvx-inst-form select[size] { min-height: 9em; }
.tvx-inst-pending { padding: 8px 10px; border: 2px dashed var(--tvx-warning); margin: 8px 0; }
.tvx-inst-msg { min-height: 1.2em; margin: 6px 0 0; color: var(--tvx-success); }
.tvx-inst-msg.is-error { color: var(--tvx-danger); }


.tvx-lb-inst { display: flex; align-items: center; gap: 4px; margin-top: 2px; min-width: 0; max-width: 100%; }
.tvx-lb-inst .tvx-inst-badge { font-size: 8px; padding: 0 4px; border-width: 1px; }
.tvx-lb-inst .tvx-inst-name { font-size: 0.72rem; color: var(--tvx-muted); }
.tvx-lb-c-name .tvx-lb-inst { flex-basis: 100%; }
.tvx-lb-slot .tvx-lb-inst { justify-content: center; }
.tvx-lb-inst-top { display: block; font-size: 0.72rem; color: var(--tvx-muted); }
.tvx-lb-insttype { margin-left: 4px; }
@media (max-width: 560px) {
  .tvx-lb-inst .tvx-inst-name { max-width: 60vw; }
}
