/* ==========================================================================
   tinybag — Retro CRT Spatial Portfolio + HexPath (01–08)
   Inspired by ntch.design's CRT bezel, dark dot-matrix board, corner sticker,
   and Teletext overlay.
   ========================================================================== */

@font-face {
  font-family: "Cubic11";
  src: url("assets/Cubic_11_1.100_R.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-bg: #000000;
  --color-screen: #111111;
  --color-dot: #303030;
  --color-accent: #dfcd2e;
  --color-accent-deep: #b8a316;
  --color-fg: #ffffff;
  --color-fg-muted: #a6a6a6;
  --color-fg-invert: #000000;
  --color-teletext-cyan: #57e2e5;
  --color-teletext-green: #69db7c;
  --color-teletext-red: #ff6b6b;

  --font-display: "Arial Narrow", "Impact", "Haettenschweiler", "Bahnschrift Condensed", "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "Courier New", monospace;
  --font-pixel: "Cubic11", "Microsoft YaHei", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- CRT Outer Frame & Curved Screen ---------- */

.crt-root {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  padding: clamp(10px, 1.8vw, 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.crt-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--color-screen);
  border-radius: clamp(22px, 3.4vw, 44px);
  overflow: hidden;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.055),
    inset 0 0 60px rgba(0, 0, 0, 0.82),
    0 0 0 1px #080808;
  transform: scale(0.94);
  opacity: 0;
  animation: crtPowerOn 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes crtPowerOn {
  0% {
    transform: scale(0.92, 0.86);
    opacity: 0;
    filter: brightness(1.6) contrast(1.2);
  }
  55% {
    opacity: 1;
  }
  100% {
    transform: scale(1, 1);
    opacity: 1;
    filter: brightness(1) contrast(1);
  }
}

.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.015) 0px,
      rgba(255, 255, 255, 0.015) 1px,
      rgba(0, 0, 0, 0.13) 1px,
      rgba(0, 0, 0, 0.13) 3px
    );
}

.crt-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 41;
  border-radius: inherit;
  background:
    radial-gradient(
      ellipse at center,
      rgba(0, 0, 0, 0) 60%,
      rgba(0, 0, 0, 0.34) 86%,
      rgba(0, 0, 0, 0.78) 100%
    );
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 0.85),
    inset 2px 0 8px rgba(255, 48, 88, 0.08),
    inset -2px 0 8px rgba(60, 210, 255, 0.08);
}

/* ---------- Interactive 2D Spatial Board ---------- */

.board-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  z-index: 1;
  transition: opacity 0.35s ease;
}

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

.board-viewport.is-dimmed {
  pointer-events: none;
}

.dot-grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  background-image: radial-gradient(circle, #303030 1.2px, transparent 1.2px);
  background-size: 34px 34px;
  background-position: 0 0;
}

.world-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* ---------- Center Hero Display Card (Photo + tinybag) ---------- */

.hero-card {
  position: absolute;
  left: -300px;
  top: -210px;
  width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  pointer-events: auto;
  cursor: default;
}

.hero-frame {
  position: relative;
  width: 600px;
  height: 338px;
  border-radius: 26px;
  overflow: hidden;
  background: #0a0b10;
  border: 3px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.68),
    0 0 0 1px rgba(0, 0, 0, 0.85);
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  filter: contrast(1.04) saturate(1.04);
}

.hero-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse at center,
      rgba(0, 0, 0, 0) 56%,
      rgba(0, 0, 0, 0.32) 100%
    );
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.hero-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -2px;
}

.hero-name {
  position: relative;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 56px;
  line-height: 0.96;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  text-transform: lowercase;
  -webkit-text-stroke: 2.2px #000000;
  paint-order: stroke fill;
  text-shadow:
    0 5px 0 #000000,
    4px 6px 0 rgba(0, 0, 0, 0.85),
    0 12px 26px rgba(0, 0, 0, 0.55);
  transform: rotate(-1.5deg);
}

/* ---------- Clickable #2: Hexagon Game Card (next to center) ---------- */

.board-item.hexagon-card {
  position: absolute;
  left: 360px;
  top: -175px;
  width: 280px;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  outline: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.hexagon-card .card-backdrop {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(155deg, #27a8bc 0%, #1d879d 55%, #176c81 100%);
  border: 3px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.62),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s ease,
    box-shadow 0.32s ease;
}

.hexagon-card:hover .card-backdrop,
.hexagon-card:focus-visible .card-backdrop {
  transform: translateY(-8px) scale(1.035) rotate(0.8deg);
  border-color: var(--color-accent);
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.75),
    0 0 0 3px rgba(223, 205, 46, 0.35);
}

.hexagon-card:active .card-backdrop {
  transform: translateY(-2px) scale(0.99);
}

.card-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
  display: block;
  transform: scale(1.12);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hexagon-card:hover .card-preview-img {
  transform: scale(1.18);
}

.card-preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.08) 0%,
    rgba(0, 0, 0, 0) 45%,
    rgba(0, 0, 0, 0.34) 100%
  );
  pointer-events: none;
}

.card-blob-float {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 58px;
  height: 58px;
  image-rendering: pixelated;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.hexagon-card:hover .card-blob-float,
.hexagon-card:focus-visible .card-blob-float {
  animation: cardBlobBob 1.4s ease-in-out infinite;
}

@keyframes cardBlobBob {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.74);
  border: 1.5px solid rgba(223, 205, 46, 0.72);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.card-hover-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  opacity: 0.88;
  transform: translateY(2px);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.hexagon-card:hover .card-hover-label,
.hexagon-card:focus-visible .card-hover-label {
  opacity: 1;
  transform: translateY(-2px);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 32px;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--color-accent);
  -webkit-text-stroke: 1.4px #000000;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #000000;
}

.card-subtitle {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.02em;
}

/* ---------- Clickable #1: Top-Left Scalloped Yellow ? / X Sticker ---------- */

.help-sticker {
  position: fixed;
  top: clamp(18px, 3vh, 34px);
  left: clamp(8px, 1.4vw, 22px);
  width: 118px;
  height: 82px;
  z-index: 80;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transform: rotate(6deg);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  perspective: 600px;
}

.help-sticker:hover,
.help-sticker:focus-visible {
  transform: rotate(2deg) scale(1.07) translateY(-2px);
}

.help-sticker:active {
  transform: rotate(4deg) scale(0.97);
}

.sticker-shadow {
  position: absolute;
  inset: 6px 4px -4px 4px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  filter: blur(8px);
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.help-sticker:hover .sticker-shadow {
  transform: translate(4px, 7px) scale(1.04);
  opacity: 0.85;
}

.sticker-body {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.help-sticker.is-open .sticker-body {
  transform: rotateY(180deg);
}

.sticker-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 3px 0 #000000);
}

.sticker-shape {
  fill: var(--color-accent);
  stroke: #000000;
  stroke-width: 4.5;
  transition: fill 0.25s ease;
}

.sticker-inner-ring {
  fill: none;
  stroke: #000000;
  stroke-width: 2.6;
  opacity: 0.92;
}

.help-sticker.is-open .sticker-shape {
  fill: #8d8d8d;
}

/* Subtle corner peel illusion on hover */
.sticker-peel {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 18px;
  height: 18px;
  border-radius: 3px 0 12px 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, #dcdcdc 65%, #9a9a9a 100%);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: scale(0.3) rotate(12deg);
  transition: opacity 0.22s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.help-sticker:hover:not(.is-open) .sticker-peel {
  opacity: 0.95;
  transform: scale(1) rotate(0deg);
}

.sticker-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  color: #000000;
  line-height: 1;
  pointer-events: none;
  backface-visibility: hidden;
}

.sticker-glyph-q {
  font-size: 38px;
  transform: translateY(-1px);
}

.sticker-glyph-x {
  font-size: 46px;
  transform: rotateY(180deg) translateY(-2px);
}

/* ---------- Teletext 00 — HELP Overlay ---------- */

.teletext-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(22px, 4vw, 56px);
  opacity: 0;
  visibility: hidden;
  transform: scale(1.03);
  transition:
    opacity 0.28s ease,
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0.28s;
}

.teletext-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition:
    opacity 0.26s ease,
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
}

.teletext-inner {
  width: min(920px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(18px, 3vh, 32px);
  padding-top: 26px;
}

.teletext-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--color-accent);
  color: #000000;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: clamp(12px, 1.3vw, 15px);
  letter-spacing: 0.08em;
}

.tt-page {
  background: #000000;
  color: var(--color-accent);
  padding: 2px 8px;
}

.teletext-body {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 3vh, 28px);
}

.teletext-hero-quote {
  border-left: 5px solid var(--color-accent);
  padding-left: clamp(14px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tt-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--color-teletext-cyan);
}

.tt-headline {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(32px, 5.2vw, 60px);
  line-height: 0.98;
  letter-spacing: 0.03em;
  color: var(--color-accent);
}

.tt-subcopy {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.45vw, 17px);
  color: #ffffff;
  line-height: 1.5;
}

.tt-note {
  font-family: var(--font-sans);
  font-size: clamp(13px, 1.25vw, 15px);
  color: var(--color-fg-muted);
  line-height: 1.55;
  max-width: 64ch;
}

.teletext-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2.2vw, 24px);
}

.tt-panel {
  border: 2px solid #2b2b2b;
  background: #0a0a0a;
  padding: clamp(14px, 2vw, 22px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tt-panel-head {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #000000;
  background: var(--color-teletext-cyan);
  align-self: flex-start;
  padding: 3px 10px;
}

.tt-contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
}

.tt-label {
  color: var(--color-fg-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.tt-link {
  color: var(--color-accent);
  font-size: clamp(14px, 1.4vw, 17px);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid rgba(223, 205, 46, 0.45);
  padding-bottom: 1px;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.tt-link:hover {
  color: #ffffff;
  border-color: #ffffff;
}

.tt-copy-btn {
  background: #1b1b1b;
  border: 1.5px solid var(--color-accent);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tt-copy-btn:hover {
  background: var(--color-accent);
  color: #000000;
}

.tt-contact-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-teletext-green);
  letter-spacing: 0.06em;
}

.tt-keys {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.tt-keys li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d7d7d7;
}

.tt-keys kbd {
  display: inline-block;
  min-width: 62px;
  text-align: center;
  padding: 2px 7px;
  background: #1e1e1e;
  border: 1px solid #484848;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.teletext-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tt-color-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 6px;
}

.tt-color-bars .bar-y { background: var(--color-accent); }
.tt-color-bars .bar-c { background: var(--color-teletext-cyan); }
.tt-color-bars .bar-g { background: var(--color-teletext-green); }
.tt-color-bars .bar-r { background: var(--color-teletext-red); }

.tt-footer-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-fg-muted);
  letter-spacing: 0.08em;
}

/* ---------- Focused Hexagon Game Stage ---------- */

.game-stage {
  position: absolute;
  inset: 0;
  z-index: 25;
  border-radius: inherit;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.92);
  pointer-events: none;
  transition:
    opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0.32s;
}

.game-stage.is-active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
  transition:
    opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
}

.hex-game-mount {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-pixel);
}

/* ---------- HexPath Game Internal Pixel UI ---------- */

.hex-shell {
  position: relative;
  width: 100%;
  height: 100%;
  background: #239eb4 url("assets/art/07_sea/sea_00.png") center / cover no-repeat;
  image-rendering: pixelated;
  overflow: hidden;
  user-select: none;
}

.hex-board-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  cursor: pointer;
}

/* Level Select Screen (4×2 pixel stone frames for Levels 01–08) */
.hex-select-view {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 48px);
  gap: clamp(16px, 2.6vh, 28px);
  background: radial-gradient(ellipse at center, rgba(16, 75, 92, 0.25) 0%, rgba(7, 36, 48, 0.56) 100%);
  transition: opacity 0.24s ease;
}

.hex-select-view.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.hex-select-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.hex-select-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: 0.08em;
  color: var(--color-accent);
  -webkit-text-stroke: 2px #1b2229;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #1b2229;
}

.hex-select-sub {
  font-family: var(--font-pixel);
  font-size: clamp(13px, 1.3vw, 16px);
  color: #f6eed8;
  text-shadow: 0 2px 0 rgba(16, 26, 36, 0.85);
}

.hex-level-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 178px));
  gap: clamp(12px, 1.8vw, 22px);
  width: min(820px, 100%);
  justify-content: center;
}

.hex-level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #fff;
  font-family: var(--font-pixel);
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.hex-level-card:hover {
  transform: translateY(-4px) scale(1.03);
}

.hex-level-card:active {
  transform: translateY(0) scale(0.98);
}

.hex-stone-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #5c5373;
  border: 4px solid #2b2538;
  box-shadow:
    inset 0 4px 0 #7b7296,
    inset 0 -5px 0 #3f3852,
    0 6px 0 rgba(16, 22, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

.hex-level-card.is-cleared .hex-stone-box {
  background: #677789;
  border-color: #25303d;
  box-shadow:
    inset 0 4px 0 #8fa1b5,
    inset 0 -5px 0 #465465,
    0 6px 0 rgba(16, 22, 32, 0.55);
}

.hex-level-card:hover .hex-stone-box {
  border-color: var(--color-accent);
}

.hex-mini-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hex-cleared-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.5));
}

.hex-plaque {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  background: #d8c295;
  border: 3px solid #4a3925;
  box-shadow:
    inset 0 2px 0 #f2e4c2,
    inset 0 -3px 0 #b39869,
    0 4px 0 rgba(16, 22, 32, 0.45);
  color: #2c2216;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hex-plaque-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: #6b4b22;
}

.hex-plaque-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hex-exit-desk-btn {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  background: #b83b3b;
  border: 3px solid #3c1414;
  box-shadow:
    inset 0 3px 0 #dd6464,
    inset 0 -3px 0 #892626,
    0 4px 0 rgba(0, 0, 0, 0.45);
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.hex-exit-desk-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.hex-exit-desk-btn:active {
  transform: translateY(1px);
}

/* ---------- Gameplay HUD ---------- */

.hex-hud {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px 18px;
}

.hex-hud.is-hidden {
  display: none;
}

.hex-hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-left: 112px; /* Leave room for top-left ? sticker */
}

.hex-hud-top-left,
.hex-hud-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hex-level-pill {
  padding: 7px 14px;
  border-radius: 8px;
  background: rgba(24, 34, 46, 0.84);
  border: 2.5px solid #e7d4ab;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  color: #fff6dc;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hex-level-pill strong {
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.hex-icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(240, 224, 186, 0.94);
  border: 3px solid #3c2f1f;
  box-shadow:
    inset 0 2px 0 #fff6dc,
    inset 0 -3px 0 #bfa574,
    0 4px 0 rgba(0, 0, 0, 0.38);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #241d15;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.hex-icon-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.hex-icon-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.hex-icon-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.hex-icon-btn img {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  pointer-events: none;
}

.hex-icon-btn.is-active {
  background: #ffe875;
  border-color: #2a1e0c;
}

.hex-icon-btn.is-play {
  width: 50px;
  background: #5fd17a;
  box-shadow:
    inset 0 2px 0 #9df3ae,
    inset 0 -3px 0 #36934d,
    0 4px 0 rgba(0, 0, 0, 0.38);
}

.hex-icon-btn.is-stop {
  width: 50px;
  background: #eb6a5b;
  box-shadow:
    inset 0 2px 0 #ff9c8f,
    inset 0 -3px 0 #b03a2d,
    0 4px 0 rgba(0, 0, 0, 0.38);
}

.hex-hint-banner {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, 86vw);
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(25, 31, 41, 0.94);
  border: 2.5px solid var(--color-accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color: #fff6d9;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  pointer-events: auto;
  display: none;
}

.hex-hint-banner.is-visible {
  display: block;
}

.hex-status-toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(34, 24, 24, 0.92);
  border: 2px solid #f07b67;
  color: #ffdcd5;
  font-size: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.hex-status-toast.is-visible {
  opacity: 1;
}

/* Bottom Tray + Controls */
.hex-hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.hex-controls-left,
.hex-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hex-tray-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

/* Variant bubble above tray (for Splitter 3 shapes & Turn flip) */
.hex-variant-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(30, 38, 49, 0.92);
  border: 2.5px solid #d9c396;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42);
}

.hex-variant-bar.is-visible {
  display: flex;
}

.hex-variant-btn {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  background: #c8b083;
  border: 2.5px solid #4a3a26;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}

.hex-variant-btn.is-selected {
  background: #ffe985;
  border-color: #1f170d;
  box-shadow: 0 0 0 2px #fff;
}

.hex-variant-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.hex-tray {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #c7ad7c;
  border: 4px solid #4d3b26;
  box-shadow:
    inset 0 4px 0 #a98e5e,
    inset 0 -3px 0 #e6d3a7,
    0 6px 0 rgba(0, 0, 0, 0.42);
}

.hex-slot {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 8px;
  background: #ead9b4;
  border: 3px solid #6b5338;
  box-shadow: inset 0 -3px 0 #cfb98a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.hex-slot:hover {
  transform: translateY(-2px);
}

.hex-slot.is-selected {
  background: #fff5d1;
  border-color: #ffffff;
  box-shadow:
    0 0 0 3px #2b2116,
    0 4px 10px rgba(0, 0, 0, 0.35);
}

.hex-slot.is-empty {
  opacity: 0.48;
}

.hex-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

.hex-slot-count {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 5px;
  background: #cf3c3c;
  border: 2px solid #2b1414;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.hex-slot.is-empty .hex-slot-count {
  background: #6c6c6c;
}

.hex-slot-tip {
  font-size: 12px;
  color: #f9f0d5;
  text-shadow: 0 2px 0 rgba(16, 24, 34, 0.88);
  letter-spacing: 0.02em;
}

/* Victory Modal */
.hex-win-modal {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(11, 24, 34, 0.62);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hex-win-modal.is-visible {
  display: flex;
}

.hex-win-card {
  width: min(390px, 92vw);
  padding: 24px 24px 20px;
  border-radius: 14px;
  background: #e9d9b4;
  border: 4px solid #3d2f1e;
  box-shadow:
    inset 0 4px 0 #fff5d8,
    inset 0 -5px 0 #c1aa7b,
    0 14px 40px rgba(0, 0, 0, 0.55);
  color: #2b2116;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.hex-win-blob {
  width: 68px;
  height: 68px;
  image-rendering: pixelated;
}

.hex-win-title {
  font-size: 24px;
  font-weight: 700;
  color: #2a2117;
}

.hex-win-meta {
  font-size: 14px;
  color: #5e4b34;
}

.hex-win-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.hex-pixel-btn {
  padding: 9px 18px;
  border-radius: 8px;
  background: #5fd17a;
  border: 3px solid #223b28;
  box-shadow:
    inset 0 2px 0 #a3f5b4,
    inset 0 -3px 0 #39964f,
    0 4px 0 rgba(0, 0, 0, 0.35);
  color: #16291a;
  font-family: var(--font-pixel);
  font-size: 15px;
  cursor: pointer;
}

.hex-pixel-btn.is-secondary {
  background: #d8c295;
  border-color: #4a3925;
  box-shadow:
    inset 0 2px 0 #f4e6c7,
    inset 0 -3px 0 #b19664,
    0 4px 0 rgba(0, 0, 0, 0.35);
  color: #2b2116;
}

.hex-pixel-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .teletext-grid {
    grid-template-columns: 1fr;
  }

  .hex-level-grid {
    grid-template-columns: repeat(2, minmax(110px, 165px));
    max-height: 68vh;
    overflow-y: auto;
    padding: 4px;
  }

  .hex-hud-top {
    padding-left: 86px;
  }

  .help-sticker {
    width: 96px;
    height: 68px;
    top: 12px;
    left: 6px;
  }

  .sticker-glyph-q { font-size: 32px; }
  .sticker-glyph-x { font-size: 38px; }
}

@media (max-width: 640px) {
  .hex-hud-bottom {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hex-slot {
    width: 52px;
    height: 52px;
  }

  .hex-icon-btn {
    width: 38px;
    height: 38px;
  }
}
