/*
 * Trick or Treat (TrickOrTreat.php).
 * Same studio chrome as the Gameshow page (styles/gameshow.css): flat dark panels,
 * a faint grid, condensed headings. Lime is the one bright colour; Kandy orange
 * only appears where Kandy is counted.
 */

.tot-page {
  --tot-bg:          #070a08;
  --tot-surface:     #0d120e;
  --tot-surface-2:   #131a15;
  --tot-surface-3:   #1a231c;
  --tot-line:        #1e2920;
  --tot-line-strong: #2d3b30;
  --tot-text:        #e6ede4;
  --tot-text-soft:   #c2ccc0;
  --tot-muted:       #8a978c;
  --tot-faint:       #5a675c;
  --tot-lime:        #b8f230;
  --tot-lime-hi:     #d4ff6a;
  --tot-lime-ink:    #0c1404;
  --tot-lime-glow:   rgba(184, 242, 48, 0.35);
  --tot-kandy:       #ff9a3c;
  --tot-danger:      #ff6b6b;
  --tot-radius-sm:   6px;
  --tot-radius:      10px;
  --tot-display:     'Barlow Condensed', 'Inter', system-ui, sans-serif;
  --tot-body:        'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  margin: 0;
  padding: 0;
  background-color: var(--tot-bg);
  background-image:
    linear-gradient(rgba(184, 242, 48, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 242, 48, 0.028) 1px, transparent 1px),
    radial-gradient(50% 42% at 50% -8%, rgba(184, 242, 48, 0.20), transparent 70%),
    radial-gradient(38% 40% at 4% 100%, rgba(120, 60, 220, 0.16), transparent 70%),
    radial-gradient(34% 36% at 98% 96%, rgba(255, 138, 31, 0.10), transparent 70%);
  background-size: 32px 32px, 32px 32px, 100% 100%, 100% 100%, 100% 100%;
  background-attachment: scroll, scroll, fixed, fixed, fixed;
  color: var(--tot-text);
  font-family: var(--tot-body);
  font-size: 14px;
  cursor: auto;
}

.tot-page *,
.tot-page *::before,
.tot-page *::after { box-sizing: border-box; }

.tot-page :focus-visible {
  outline: 2px solid var(--tot-lime);
  outline-offset: 2px;
}

.tot-page h1,
.tot-page h2,
.tot-page h3,
.tot-page p { margin: 0; }

.tot-page button,
.tot-page input,
.tot-page select { font-family: inherit; }

.tot-ico {
  width: 16px;
  height: 16px;
  flex: none;
}

.tot-kandy {
  width: 20px;
  height: 20px;
  flex: none;
}

/* ─── Shell ─────────────────────────────────────────────────────────────── */

.tot-shell {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tot-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.tot-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tot-faint);
}

.tot-title h1 {
  font-family: var(--tot-display);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin-top: 4px;
  color: var(--tot-text);
}

.tot-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tot-countdown,
.tot-balance {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--tot-line-strong);
  border-radius: 999px;
  background: var(--tot-surface);
  white-space: nowrap;
}

.tot-countdown[hidden] { display: none; }

.tot-countdown { color: var(--tot-muted); font-size: 12px; }
.tot-countdown .tot-ico { width: 14px; height: 14px; }
.tot-countdown strong {
  font-family: var(--tot-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--tot-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.tot-countdown.is-soon strong { color: var(--tot-lime); }
.tot-countdown.is-over strong { color: var(--tot-danger); }

.tot-balance strong {
  font-family: var(--tot-display);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tot-kandy);
}

.tot-balance-unit {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tot-muted);
}

.tot-balance.is-bump strong { animation: tot-bump 0.5s ease; }

@keyframes tot-bump {
  40% { transform: scale(1.25); color: var(--tot-lime-hi); }
}

.tot-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.tot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--tot-radius-sm);
  background: var(--tot-lime);
  color: var(--tot-lime-ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.tot-btn:hover { background: var(--tot-lime-hi); }
.tot-btn:disabled { opacity: 0.5; cursor: default; }

.tot-btn-ghost {
  background: transparent;
  border-color: var(--tot-line-strong);
  color: var(--tot-text-soft);
}

.tot-btn-ghost:hover { background: var(--tot-surface-3); color: var(--tot-text); }

.tot-btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--tot-danger);
}

.tot-btn-danger-ghost:hover { background: rgba(255, 107, 107, 0.1); }

.tot-btn-sm { height: 34px; padding: 0 12px; font-size: 12px; }

.tot-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--tot-line-strong);
  border-radius: var(--tot-radius-sm);
  background: rgba(13, 18, 14, 0.88);
  color: var(--tot-text-soft);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.tot-icon-btn:hover { background: var(--tot-surface-3); color: var(--tot-text); }
.tot-icon-btn.is-active { color: var(--tot-lime); border-color: rgba(184, 242, 48, 0.5); }

/* ─── Stage and camera ──────────────────────────────────────────────────── */

.tot-stage {
  position: relative;
  min-width: 0;
  height: min(78vh, 820px);
  min-height: 460px;
  background: var(--tot-surface);
  border: 1px solid var(--tot-line);
  border-radius: var(--tot-radius);
  overflow: hidden;
}

.tot-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.tot-viewport.is-dragging { cursor: grabbing; }

/* The board at its real size (1164px square); the camera moves this one element */
.tot-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 1164px;
  height: 1164px;
  transform-origin: 0 0;
}

.tot-world.is-moving { will-change: transform; }
.tot-world.is-gliding { transition: transform 0.45s cubic-bezier(0.22, 0.8, 0.3, 1); }
.tot-world.is-following { transition: transform 0.2s linear; }

.tot-board {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: #0a0f0b;
  box-shadow: 0 0 0 2px #1f2b22, 0 0 0 7px #0b100c, 0 0 0 8px rgba(184, 242, 48, 0.35), 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* ─── Spaces ────────────────────────────────────────────────────────────── */

.tot-tile {
  position: absolute;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid #243026;
  background: linear-gradient(180deg, #19221b 0%, #121914 100%);
  color: var(--tot-text);
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
}

.tot-tile:hover { border-color: #3b4c3e; }

.tot-tile-banner {
  position: relative;
  flex: none;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  background: var(--banner, #3b4a3f);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--banner-ink, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tot-tile-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 6px 4px;
}

.tot-tile-name {
  font-family: var(--tot-display);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--tot-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.tot-tile.is-empty .tot-tile-name { color: var(--tot-faint); }

.tot-prize-wrap {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.tot-prize {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
}

.tot-prize img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Blog border on the viewer's avatar: same proportions as the Limited Shop's .ls-border.
   The border art is taller than it is wide and hangs below the box, as it does there. */
.tot-border {
  --ava: 27px;
  position: relative;
  display: inline-block;
  flex: none;
  width: calc(var(--ava) * 1.75);
  height: calc(var(--ava) * 1.75);
}

.tot-border-ava {
  position: absolute;
  top: calc(var(--ava) * 0.375);
  left: calc(var(--ava) * 0.375);
  width: var(--ava);
  height: var(--ava);
  border: 2px solid #fff;
  border-radius: 50%;
  background-color: #e6e6e6;
  background-repeat: no-repeat;
  background-size: 180%;
  background-position: top;
}

.tot-page .tot-border-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--ava) * 2.5);
  max-width: none;
  max-height: none;
  pointer-events: none;
}

.tot-tile.is-landscape .tot-border { --ava: 23px; }
.tot-tile.is-corner .tot-border { --ava: 30px; }
.tot-inspect-art .tot-border { --ava: 40px; }
.tot-gain-art .tot-border { --ava: 25px; }

/* Bigger on the board. A transform, so it grows around the avatar without moving the
   name, prize amount or bonuses. */
.tot-tile .tot-border {
  transform: scale(1.3);
  transform-origin: 50% 50%;
}

.tot-pick-art {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
}

.tot-pick-art .tot-border { --ava: 20px; }

.tot-prize-amount {
  font-family: var(--tot-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--tot-lime);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tot-tile-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 20px;
  padding: 0 4px 5px;
}

.tot-bonus {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--tot-text-soft);
  font-variant-numeric: tabular-nums;
}

.tot-bonus .tot-kandy { width: 14px; height: 14px; }
.tot-bonus img { width: 13px; height: 13px; object-fit: contain; }
.tot-bonus-kandy { color: var(--tot-kandy); }

/* Portrait (top and bottom rows): prize under the name */
.tot-tile.is-portrait .tot-tile-name { min-height: 2.1em; display: -webkit-box; }

/* Landscape (left and right columns): prize beside the name */
.tot-tile.is-landscape .tot-tile-body {
  flex-direction: row;
  gap: 8px;
  padding: 4px 10px 2px;
}

.tot-tile.is-landscape .tot-tile-name { flex: 1; text-align: left; font-size: 14px; }
.tot-tile.is-landscape .tot-prize { width: 40px; height: 40px; }
.tot-tile.is-landscape .tot-prize-wrap { order: -1; }
.tot-tile.is-landscape .tot-tile-banner { height: 18px; }
.tot-tile.is-landscape .tot-tile-foot { justify-content: flex-start; padding-left: 10px; min-height: 18px; }

/* Corners */
.tot-tile.is-corner .tot-tile-banner { height: 26px; font-size: 9.5px; }
.tot-tile.is-corner .tot-tile-name { font-size: 18px; }
.tot-tile.is-corner .tot-prize { width: 52px; height: 52px; }
.tot-tile.is-corner .tot-tile-body { gap: 4px; }

/* Start: the lime corner, with the direction of travel */
.tot-tile.is-start {
  background:
    radial-gradient(80% 80% at 50% 60%, rgba(184, 242, 48, 0.18), transparent 70%),
    linear-gradient(180deg, #1a2414 0%, #10170c 100%);
}

.tot-tile.is-start .tot-tile-banner { background: var(--tot-lime); color: var(--tot-lime-ink); }

.tot-start-arrow {
  width: 40px;
  height: 40px;
  color: var(--tot-lime);
}

.tot-tile-foot.is-start {
  flex-wrap: wrap;
  row-gap: 2px;
  padding-bottom: 7px;
}

.tot-start-collect {
  flex-basis: 100%;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tot-lime);
}

.tot-tile.is-start .tot-tile-name {
  font-size: 30px;
  font-weight: 800;
  color: var(--tot-lime);
  letter-spacing: 0.04em;
}

/* Spaces the player has landed on: a lime tick in the banner */
.tot-tile-tick {
  position: absolute;
  right: 4px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  padding: 2px;
  border-radius: 50%;
  background: var(--tot-lime);
  color: var(--tot-lime-ink);
}

/* Prize waiting on the rest of the set */
.tot-tile-lock {
  position: absolute;
  left: 4px;
  top: 50%;
  margin-top: -7px;
  height: 14px;
  padding: 0 4px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 8.5px;
  line-height: 14px;
  letter-spacing: 0.02em;
}

.tot-tile.is-claimed .tot-prize img { filter: grayscale(0.85) brightness(0.7); }

.tot-tile.is-selected {
  z-index: 2;
  border-color: var(--tot-text);
  box-shadow: 0 0 0 1px var(--tot-text);
}

.tot-tile.is-here {
  z-index: 1;
  border-color: var(--tot-lime);
  box-shadow: 0 0 0 1px var(--tot-lime), 0 0 22px var(--tot-lime-glow);
}

.tot-tile.is-land { animation: tot-land 0.7s ease-out; }

@keyframes tot-land {
  0%   { box-shadow: 0 0 0 1px var(--tot-lime), 0 0 0 0 rgba(184, 242, 48, 0.8); }
  100% { box-shadow: 0 0 0 1px var(--tot-lime), 0 0 0 26px rgba(184, 242, 48, 0); }
}

/* ─── Board centre ──────────────────────────────────────────────────────── */

.tot-center {
  position: absolute;
  left: 150px;
  top: 150px;
  width: 864px;
  height: 864px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  pointer-events: none;
  background:
    radial-gradient(50% 50% at 50% 50%, rgba(184, 242, 48, 0.07), transparent 70%),
    linear-gradient(rgba(184, 242, 48, 0.04) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(184, 242, 48, 0.04) 1px, transparent 1px) 0 0 / 48px 48px;
}

.tot-center-eyebrow {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--tot-muted);
}

.tot-center-mark {
  font-family: var(--tot-display);
  font-size: 150px;
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--tot-lime);
  text-shadow: 0 0 40px rgba(184, 242, 48, 0.25), 0 6px 0 #304a07;
  transform: rotate(-4deg);
}

.tot-center-rule {
  width: 120px;
  height: 3px;
  margin-top: 18px;
  background: var(--tot-line-strong);
}

.tot-center-note {
  font-size: 17px;
  line-height: 1.55;
  color: var(--tot-muted);
}

/* ─── Player piece ──────────────────────────────────────────────────────── */

.tot-token {
  position: absolute;
  left: 0;
  top: 0;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  z-index: 5;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1);
}

.tot-token-hop {
  display: block;
  width: 100%;
  height: 100%;
}

.tot-token.is-hopping .tot-token-hop { animation: tot-hop 0.2s ease-out; }

@keyframes tot-hop {
  50% { transform: translateY(-16px) scale(1.06); }
}

.tot-token-ava {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--tot-lime);
  background-color: #1c2a12;
  background-repeat: no-repeat;
  background-size: 130%;
  background-position: top center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(7, 10, 8, 0.85);
}

/* Shadow under the piece */
.tot-token::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -7px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  filter: blur(2px);
  z-index: -1;
}

/* ─── Overlays on the stage ─────────────────────────────────────────────── */

.tot-zoom {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tot-dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 10;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--tot-line-strong);
  border-radius: 14px;
  background: rgba(10, 14, 11, 0.92);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tot-dice {
  display: flex;
  gap: 6px;
}

.tot-die {
  width: 34px;
  height: 34px;
  flex: none;
}

.tot-die-face { fill: #f2f6ee; }
.tot-die-pip { fill: #0f160a; }
.tot-die.is-spent .tot-die-face { fill: none; stroke: var(--tot-line-strong); stroke-width: 2; stroke-dasharray: 4 3; }
.tot-die.is-spent .tot-die-pip { display: none; }
/* The die being rolled, tumbling above the dock (bottom is set from the dock's height) */
.tot-roll-die {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 11;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 0.25s;
}

.tot-roll-die[hidden] { display: none; }

.tot-roll-die .tot-die {
  width: 76px;
  height: 76px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 22px rgba(184, 242, 48, 0.25));
}

.tot-roll-die.is-rolling .tot-die { animation: tot-tumble 0.36s linear infinite; }
.tot-roll-die.is-landed .tot-die { animation: tot-die-land 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.tot-roll-die.is-out { opacity: 0; }

@keyframes tot-tumble {
  0%   { transform: translateY(0) rotate(0deg); }
  25%  { transform: translateY(-16px) rotate(90deg); }
  50%  { transform: translateY(0) rotate(180deg); }
  75%  { transform: translateY(-10px) rotate(270deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

@keyframes tot-die-land {
  from { transform: scale(1.25) rotate(-12deg); }
}

.tot-dock-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 132px;
}

.tot-roll {
  height: 46px;
  padding: 0 28px;
  border: 0;
  border-radius: 8px;
  background: var(--tot-lime);
  color: var(--tot-lime-ink);
  font-family: var(--tot-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 0 #6c9412, 0 0 24px rgba(184, 242, 48, 0.25);
  transition: transform 0.08s, box-shadow 0.08s, background-color 0.15s;
}

.tot-roll:hover { background: var(--tot-lime-hi); }
.tot-roll:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #6c9412, 0 0 18px rgba(184, 242, 48, 0.2); }

.tot-roll:disabled {
  background: var(--tot-surface-3);
  color: var(--tot-faint);
  box-shadow: none;
  cursor: default;
}

.tot-dock-note {
  font-size: 11px;
  font-weight: 500;
  color: var(--tot-muted);
  text-align: center;
  white-space: nowrap;
}

.tot-dock-note:empty { display: none; }

/* Landing result */
.tot-result {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 5, 0.55);
}

.tot-result[hidden] { display: none; }

.tot-result-box {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border: 1px solid var(--tot-line-strong);
  border-top: 4px solid var(--banner, var(--tot-lime));
  border-radius: var(--tot-radius);
  background: var(--tot-surface-2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: tot-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes tot-pop {
  from { transform: scale(0.88); opacity: 0; }
}

.tot-result-roll {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tot-muted);
}

.tot-result-box h2 {
  font-family: var(--tot-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.tot-result-gains {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tot-gain {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--tot-line);
  border-radius: var(--tot-radius-sm);
  background: var(--tot-surface);
  text-align: left;
}

.tot-gain-art {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
}

.tot-gain-art img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tot-gain-art .tot-kandy { width: 34px; height: 34px; }

.tot-gain-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tot-gain-text strong { font-size: 14px; font-weight: 700; }
.tot-gain-text span { font-size: 12px; color: var(--tot-muted); }
.tot-gain.is-kandy strong { color: var(--tot-kandy); }
.tot-gain.is-muted { opacity: 0.7; }

.tot-result-empty { font-size: 13px; color: var(--tot-muted); }

.tot-result-set {
  font-size: 12px;
  color: var(--tot-text-soft);
}

.tot-result-set strong { color: var(--tot-lime); }

.tot-result .tot-btn { min-width: 140px; margin-top: 4px; }

/* ─── Side panels ───────────────────────────────────────────────────────── */

.tot-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.tot-panel {
  padding: 16px;
  background: var(--tot-surface);
  border: 1px solid var(--tot-line);
  border-radius: var(--tot-radius);
}

.tot-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.tot-panel-title {
  font-family: var(--tot-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tot-panel-meta {
  font-size: 12px;
  color: var(--tot-muted);
}

/* Selected space */
.tot-inspect-card {
  overflow: hidden;
  border: 1px solid var(--tot-line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, #19221b 0%, #111712 100%);
}

.tot-inspect-banner {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: var(--banner);
  color: var(--banner-ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.tot-inspect-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 12px;
}

.tot-inspect-art {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  flex: none;
  border-radius: var(--tot-radius-sm);
  background: rgba(0, 0, 0, 0.25);
}

.tot-inspect-art img { max-width: 64px; max-height: 64px; object-fit: contain; }
.tot-inspect-art .tot-start-arrow { width: 34px; height: 34px; }

.tot-inspect-name {
  font-family: var(--tot-display);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  word-break: break-word;
}

.tot-inspect-prize {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tot-text-soft);
}

.tot-inspect-prize.is-none { color: var(--tot-faint); font-weight: 500; }

.tot-inspect-rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--tot-line);
}

.tot-inspect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--tot-line);
  font-size: 12.5px;
  color: var(--tot-muted);
}

.tot-inspect-row:last-child { border-bottom: 0; }

.tot-inspect-row strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--tot-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tot-inspect-row strong img { width: 15px; height: 15px; object-fit: contain; }
.tot-inspect-row .tot-kandy { width: 17px; height: 17px; }
.tot-inspect-row .is-good { color: var(--tot-lime); }

.tot-set-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--tot-line);
}

.tot-set-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px 0 4px;
  border: 1px solid var(--tot-line-strong);
  border-radius: 12px;
  background: var(--tot-surface);
  color: var(--tot-text-soft);
  font-size: 11.5px;
  cursor: pointer;
}

.tot-set-chip::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--banner);
}

.tot-set-chip.is-landed { border-color: rgba(184, 242, 48, 0.45); color: var(--tot-text); }
.tot-set-chip.is-landed::before { box-shadow: 0 0 0 2px var(--tot-lime); }

.tot-inspect-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.tot-inspect-actions .tot-btn { flex: 1; }

.tot-inspect-hint {
  margin-top: 8px;
  text-align: center;
}

/* Admin drag and drop: the selected space can be picked up and dropped on another */
.tot-page.is-admin .tot-tile.is-selected:not(.is-start) { cursor: grab; }
.tot-viewport.is-moving-tile,
.tot-viewport.is-moving-tile .tot-tile { cursor: grabbing; }

.tot-tile.is-ghost {
  z-index: 30;
  pointer-events: none;
  opacity: 0.95;
  transform: scale(1.06) rotate(-2deg);
  box-shadow: 0 0 0 2px var(--tot-lime), 0 20px 44px rgba(0, 0, 0, 0.65);
}

.tot-tile.is-drag-source {
  opacity: 0.3;
  border-style: dashed;
}

.tot-tile.is-drop-target {
  z-index: 3;
  border-color: var(--tot-lime);
  box-shadow: inset 0 0 0 2px var(--tot-lime), 0 0 24px var(--tot-lime-glow);
}

/* Leaderboard */
.tot-lb {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tot-lb-row {
  display: grid;
  grid-template-columns: 26px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--tot-radius-sm);
}

.tot-lb-row:nth-child(odd) { background: rgba(255, 255, 255, 0.018); }
.tot-lb-row.is-me { background: rgba(184, 242, 48, 0.08); box-shadow: inset 2px 0 0 var(--tot-lime); }

.tot-lb-rank {
  font-family: var(--tot-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--tot-faint);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tot-lb-row:nth-child(1) .tot-lb-rank { color: var(--tot-lime); }
.tot-lb-row:nth-child(2) .tot-lb-rank,
.tot-lb-row:nth-child(3) .tot-lb-rank { color: var(--tot-text-soft); }

.tot-lb-ava {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--tot-surface-3);
  background-repeat: no-repeat;
  background-size: 130%;
  background-position: top center;
}

.tot-lb-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.tot-lb-name:hover { text-decoration: underline; }

.tot-lb-score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--tot-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--tot-kandy);
  font-variant-numeric: tabular-nums;
}

.tot-lb-score .tot-kandy { width: 16px; height: 16px; }

/* Footnote under the leaderboard */
.tot-lb-prize {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--tot-muted);
}

.tot-lb-prize img { width: 13px; height: 13px; object-fit: contain; }

/* Updates: a chat-style log filling its panel, newest line at the bottom */
.tot-feed-panel { padding: 10px 12px; }

.tot-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* Like a chat, a short log sits at the bottom and fills upwards */
.tot-feed > :first-child { margin-top: auto; }

.tot-feed-line {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--tot-text-soft);
  overflow-wrap: anywhere;
}

.tot-feed-line strong { color: var(--tot-text); font-weight: 600; }
.tot-feed-line.is-new { animation: tot-feed-in 0.4s ease-out; }

@keyframes tot-feed-in {
  from { opacity: 0; transform: translateY(4px); }
}

.tot-feed-time {
  margin-right: 2px;
  font-size: 11px;
  color: var(--tot-faint);
  font-variant-numeric: tabular-nums;
}

.tot-feed-user { font-weight: 700; text-decoration: none; }
.tot-feed-user:hover { text-decoration: underline; }

.tot-feed-empty {
  padding: 14px 4px;
  font-size: 13px;
  color: var(--tot-muted);
}

.tot-lb-empty {
  padding: 14px 4px;
  font-size: 13px;
  color: var(--tot-muted);
}

/* ─── Dialogs (admin) ───────────────────────────────────────────────────── */

.tot-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--tot-line-strong);
  border-radius: var(--tot-radius);
  background: var(--tot-surface-2);
  color: var(--tot-text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.tot-dialog-sm { width: min(420px, calc(100vw - 24px)); }

.tot-dialog::backdrop { background: rgba(3, 5, 4, 0.7); }

.tot-dialog-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
}

.tot-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tot-dialog-head h2 {
  font-family: var(--tot-display);
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tot-dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.tot-grow { flex: 1; }

.tot-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 20px;
}

.tot-editor-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.tot-editor-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tot-preview-slot {
  position: relative;
  display: grid;
  place-items: center;
  padding: 18px 0;
  border: 1px dashed var(--tot-line-strong);
  border-radius: var(--tot-radius-sm);
  background: var(--tot-bg);
}

/* The preview tile is laid out in the flow instead of on the board */
.tot-preview-slot .tot-tile {
  position: relative;
  pointer-events: none;
}

.tot-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tot-field[hidden] { display: none; }

.tot-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--tot-text-soft);
}

.tot-field > span small { font-weight: 500; color: var(--tot-faint); margin-left: 4px; }

.tot-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tot-hint {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--tot-faint);
}

.tot-page .tot-dialog input[type="text"],
.tot-page .tot-dialog input[type="search"],
.tot-page .tot-dialog input[type="number"],
.tot-page .tot-dialog input[type="datetime-local"],
.tot-page .tot-dialog select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--tot-line-strong);
  border-radius: var(--tot-radius-sm);
  background: var(--tot-bg);
  color: var(--tot-text);
  font-size: 14px;
  color-scheme: dark;
}

.tot-page .tot-dialog input:focus,
.tot-page .tot-dialog select:focus {
  outline: none;
  border-color: var(--tot-lime);
  box-shadow: 0 0 0 3px rgba(184, 242, 48, 0.15);
}

.tot-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tot-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--banner);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.tot-swatch.is-on { border-color: var(--tot-text); }

.tot-swatch-custom {
  position: relative;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border: 1px dashed var(--tot-line-strong);
  border-radius: 6px;
  cursor: pointer;
}

.tot-swatch-custom input {
  position: absolute;
  inset: -6px;
  width: 40px;
  height: 40px;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.tot-picked {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(184, 242, 48, 0.4);
  border-radius: var(--tot-radius-sm);
  background: rgba(184, 242, 48, 0.06);
}

.tot-picked[hidden] { display: none; }

.tot-picked img,
.tot-item-results img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: none;
}

.tot-picked > span:not(.tot-pick-art) { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tot-item-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--tot-line);
  border-radius: var(--tot-radius-sm);
}

.tot-item-results:empty { display: none; }

.tot-item-results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--tot-line);
  font-size: 13px;
}

.tot-item-results li:last-child { border-bottom: 0; }
.tot-item-results li:hover,
.tot-item-results li[aria-selected="true"] { background: var(--tot-surface-3); }
.tot-item-results small { margin-left: auto; color: var(--tot-faint); }
.tot-item-results .tot-item-none { cursor: default; color: var(--tot-muted); }

.tot-flash {
  min-height: 0;
  font-size: 13px;
  color: var(--tot-danger);
}

.tot-flash:empty { display: none; }

/* ─── Toast ─────────────────────────────────────────────────────────────── */

.tot-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 1px solid var(--tot-line-strong);
  border-radius: 8px;
  background: var(--tot-surface-3);
  color: var(--tot-text);
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.tot-toast.is-error { border-color: rgba(255, 107, 107, 0.5); }

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .tot-body { grid-template-columns: minmax(0, 1fr); }
  .tot-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .tot-stage { height: 68vh; min-height: 420px; }
}

@media (max-width: 720px) {
  .tot-shell { padding: 12px 10px 20px; gap: 10px; }
  .tot-side { grid-template-columns: minmax(0, 1fr); }
  .tot-title h1 { font-size: 28px; }
  .tot-bar-right { width: 100%; }
  .tot-stage { height: 64vh; min-height: 380px; }
  .tot-editor-grid { grid-template-columns: minmax(0, 1fr); }
  .tot-editor-preview { order: -1; }
  .tot-preview-slot { padding: 12px 0; }
}

@media (max-width: 480px) {
  .tot-dock { gap: 10px; padding: 8px 8px 8px 10px; bottom: 10px; }
  .tot-die { width: 28px; height: 28px; }
  .tot-dice { gap: 4px; }
  .tot-roll { height: 42px; padding: 0 18px; font-size: 20px; }
  .tot-dock-main { min-width: 108px; }
  .tot-zoom { top: 8px; right: 8px; }
  .tot-icon-btn { width: 34px; height: 34px; }
  .tot-countdown-label { display: none; }
  .tot-field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tot-world.is-gliding,
  .tot-world.is-following,
  .tot-token { transition: none; }
  .tot-token.is-hopping .tot-token-hop,
  .tot-roll-die .tot-die,
  .tot-tile.is-land,
  .tot-result-box,
  .tot-feed-line.is-new { animation: none; }
}
