:root {
  --bg: #0c0906;
  --surface: rgba(26, 18, 11, 0.85);
  --surface-2: #1e150d;
  --surface-card: linear-gradient(180deg, rgba(34, 24, 15, 0.9) 0%, rgba(18, 12, 7, 0.95) 100%);
  --text: #f7eedc;
  --text-bright: #ffffff;
  --muted: #bda882;
  --accent: #d89d3a;
  --accent-bright: #f4c871;
  --accent-deep: #a9701f;
  --accent-2: #33d6a6;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --radius: 18px;
  --font-display: "Cinzel", "Playfair Display", -apple-system, BlinkMacSystemFont, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow-card: 0 18px 42px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 235, 190, 0.08);
  --shadow-hover: 0 24px 50px rgba(0, 0, 0, 0.65), 0 0 30px rgba(216, 157, 58, 0.22), inset 0 1px 0 rgba(255, 245, 220, 0.16);
  font-size: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -15%, rgba(220, 160, 60, 0.16) 0%, transparent 70%),
    radial-gradient(circle 600px at 10% 25%, rgba(180, 80, 30, 0.09) 0%, transparent 60%),
    radial-gradient(circle 500px at 90% 80%, rgba(216, 157, 58, 0.07) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 36px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 9, 6, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(216, 157, 58, 0.16);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.brand:hover {
  transform: translateY(-1px);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(244, 200, 113, 0.45), 0 6px 16px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.brand:hover .brand-logo {
  transform: rotate(4deg) scale(1.05);
  box-shadow: 0 0 0 2px rgba(244, 200, 113, 0.75), 0 0 20px rgba(216, 157, 58, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff3dc 0%, #f4c871 60%, #d89d3a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-size: 0.64rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  opacity: 0.85;
}

/* TOPBAR NAVIGATION BAR */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(216, 157, 58, 0.18);
  padding: 4px 6px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(216, 157, 58, 0.3);
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: #fff6e5;
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(216, 157, 58, 0.22) 0%, rgba(216, 157, 58, 0.1) 100%);
  color: #fff8ee;
  border: 1px solid rgba(244, 200, 113, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nav-tab.active .nav-tab-dot {
  background: var(--accent-bright);
  box-shadow: 0 0 8px var(--accent-bright);
}

.nav-tab-external {
  color: var(--muted);
  opacity: 0.85;
}
.nav-tab-external:hover {
  opacity: 1;
  color: var(--accent-bright);
}
.nav-ext-icon {
  margin-left: 2px;
  opacity: 0.75;
}

@media (max-width: 920px) {
  .topbar-nav {
    display: none;
  }
}

.link-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(216, 157, 58, 0.2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
}
.link-btn:hover {
  background: rgba(216, 157, 58, 0.14);
  border-color: rgba(244, 200, 113, 0.45);
  color: #fff6e5;
  transform: translateY(-1px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.identity-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(216, 157, 58, 0.22);
  padding: 6px 14px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.identity-badge-name {
  color: #fff6e5;
  font-weight: 600;
}

.identity-badge-role {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(216, 157, 58, 0.18);
  border: 1px solid rgba(216, 157, 58, 0.35);
  color: var(--accent-bright);
}

.identity-badge-role.role-admin {
  background: rgba(51, 214, 166, 0.18);
  border-color: rgba(51, 214, 166, 0.4);
  color: var(--accent-2);
}

#btn-switch-player {
  background: transparent;
  border: none;
  padding: 0 0 0 6px;
  color: var(--accent-bright);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: underline;
  border-radius: 0;
}
#btn-switch-player:hover {
  color: #ffffff;
  background: transparent;
  transform: none;
}

main#app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 32px 80px;
}

.screen { display: none; }
.screen.active { display: block; animation: fadein 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: linear-gradient(180deg, rgba(34, 24, 15, 0.85) 0%, rgba(20, 14, 8, 0.92) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(216, 157, 58, 0.18);
  border-radius: var(--radius);
  padding: 34px;
  margin: 24px auto;
  box-shadow: var(--shadow-card);
  position: relative;
}
.card.narrow { max-width: 520px; }
.card.wide { max-width: 960px; }

h1 {
  margin-top: 0;
  font-size: 1.85rem;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff6e5;
}
h2 {
  font-size: 1.25rem;
  margin: 4px 0;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
  color: #fff8eb;
}
h3 {
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  font-weight: 600;
}

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; }

label {
  display: block;
  margin: 18px 0 6px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

input[type="password"], input[type="text"], input[type="number"], textarea {
  width: 100%;
  background: rgba(18, 12, 7, 0.7);
  border: 1px solid rgba(216, 157, 58, 0.22);
  border-radius: 12px;
  color: var(--text);
  padding: 13px 16px;
  font-size: 0.98rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
input:focus, textarea:focus {
  outline: none;
  background: rgba(26, 18, 10, 0.9);
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(216, 157, 58, 0.25);
}

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 12px;
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
}

.btn-primary {
  background: linear-gradient(135deg, #dfa239 0%, #f5cb74 50%, #c98a24 100%);
  color: #1a0e02;
  border: 1px solid rgba(255, 245, 220, 0.35);
  box-shadow: 0 6px 20px rgba(216, 157, 58, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(216, 157, 58, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px solid rgba(216, 157, 58, 0.2);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  border-color: rgba(244, 200, 113, 0.45);
  color: #fff6e5;
  background: rgba(216, 157, 58, 0.12);
  transform: translateY(-1px);
}
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.error {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 0.9rem;
}

.hub-header {
  text-align: center;
  margin: 8px 0 42px;
}

.hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-bright);
  background: rgba(216, 157, 58, 0.1);
  border: 1px solid rgba(216, 157, 58, 0.25);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #33d6a6;
  box-shadow: 0 0 10px #33d6a6;
  animation: pulse-dot 2.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.hub-header h1 {
  justify-content: center;
  font-size: 2.5rem;
  letter-spacing: 0.03em;
  font-weight: 700;
  margin: 0 0 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fae4b5 45%, #d89d3a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(216, 157, 58, 0.25));
}
.hub-logo-full {
  max-width: 136px;
  width: 100%;
  height: auto;
  margin: 0 auto 20px;
  display: block;
  border-radius: 22px;
  border: 1px solid rgba(244, 200, 113, 0.3);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.6),
    0 0 50px rgba(216, 157, 58, 0.25);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.hub-logo-full:hover {
  transform: scale(1.03) rotate(-0.5deg);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.7),
    0 0 65px rgba(244, 200, 113, 0.35);
}
.hub-subtitle {
  margin: 8px auto 0;
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
  line-height: 1.55;
  letter-spacing: 0.01em;
}
.hub-subtitle-name { color: #fff6e5; font-weight: 700; }

.hub-header-compact { margin: 0 0 28px; }
.hub-header-compact h1 { font-size: 1.75rem; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  justify-content: center;
  gap: 24px;
  width: 100%;
}

@media (min-width: 1100px) {
  #screen-wings .game-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  #screen-hub .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

.game-card {
  background: linear-gradient(180deg, rgba(32, 22, 14, 0.88) 0%, rgba(18, 12, 7, 0.94) 100%);
  border: 1px solid rgba(216, 157, 58, 0.18);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.25s ease,
              box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(244, 200, 113, 0.35) 50%, transparent 100%);
  pointer-events: none;
}

.game-card:not(.disabled) {
  cursor: pointer;
}

.game-card:not(.disabled):hover {
  transform: translateY(-5px);
  border-color: rgba(244, 200, 113, 0.45);
  box-shadow: var(--shadow-hover);
}

.game-card.disabled {
  opacity: 0.65;
  filter: saturate(0.85);
  cursor: default;
}

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.badge-gold {
  background: rgba(216, 157, 58, 0.35);
  border: 1px solid rgba(244, 200, 113, 0.6);
  color: #fff6e5;
}

.badge-amber {
  background: rgba(224, 110, 40, 0.35);
  border: 1px solid rgba(240, 140, 70, 0.6);
  color: #ffe9dd;
}

.badge-emerald {
  background: rgba(51, 214, 166, 0.28);
  border: 1px solid rgba(51, 214, 166, 0.6);
  color: #e0fff5;
}

.badge-violet {
  background: rgba(138, 118, 214, 0.35);
  border: 1px solid rgba(160, 140, 240, 0.6);
  color: #f1edff;
}

.badge-noir {
  background: rgba(198, 90, 74, 0.35);
  border: 1px solid rgba(220, 110, 95, 0.6);
  color: #ffebe8;
}

.badge-sunny {
  background: rgba(255, 190, 60, 0.35);
  border: 1px solid rgba(255, 210, 90, 0.6);
  color: #fffce8;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--muted);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag-chip {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(216, 157, 58, 0.14);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.btn-arrow {
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.game-card:hover .btn-primary .btn-arrow {
  transform: translateX(4px);
}

.game-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 14px 0 8px;
  color: #fff6e5;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.game-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  flex-grow: 1;
  margin: 0 0 16px;
}

.game-card-art {
  height: 100px;
  border-radius: 12px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(216, 157, 58, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.game-card-art.art-2 { background: linear-gradient(135deg, #a63c22, #e07a4a); }
.game-card-art.art-3 { background: linear-gradient(135deg, #1f6e58, #3fae94); }
.game-card-art.art-4 { background: linear-gradient(135deg, #2b2318, #4a3d26); }
.game-card-art.art-5 { background: linear-gradient(135deg, #7a3418, #c9702f); }

.game-card-icon { width: 40px; height: 40px; color: rgba(255,250,238,0.95); }
.game-card-icon svg { width: 100%; height: 100%; }

/* "Pro" gradient badge treatment: layered gradients + soft inset/outer
   shadows for a more polished, dimensional feel than the flat single-tone
   .art-N banners - built entirely in CSS so it scales to all 17 training
   modules without needing a unique illustration per module. Default hue
   is warm gold; pro-teal/pro-ember/pro-violet give variety, pro-locked is
   the dim metal tone for modules that aren't unlocked yet. */
.game-card-art-pro {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 25% 15%, rgba(255,255,255,0.38), transparent 45%),
    linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 52%, var(--accent-deep) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -10px 18px rgba(0,0,0,0.28),
    0 10px 20px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,241,214,0.22);
}
.game-card-art-pro::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(200deg, rgba(255,255,255,0.16), transparent 55%);
  pointer-events: none;
}
.game-card-art-pro .game-card-icon {
  width: 46px;
  height: 46px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 3px 6px rgba(50,25,0,0.45));
}
.game-card-art-pro.pro-teal {
  background:
    radial-gradient(120% 140% at 25% 15%, rgba(255,255,255,0.32), transparent 45%),
    linear-gradient(135deg, #5fe6c2 0%, #2f9e82 52%, #175042 100%);
}
.game-card-art-pro.pro-ember {
  background:
    radial-gradient(120% 140% at 25% 15%, rgba(255,255,255,0.32), transparent 45%),
    linear-gradient(135deg, #ef8f5c 0%, #c9552c 52%, #7a3418 100%);
}
.game-card-art-pro.pro-violet {
  background:
    radial-gradient(120% 140% at 25% 15%, rgba(255,255,255,0.3), transparent 45%),
    linear-gradient(135deg, #8a76d6 0%, #5c48a3 52%, #362a6b 100%);
}
.game-card-art-pro.pro-locked {
  background:
    radial-gradient(120% 140% at 25% 15%, rgba(255,255,255,0.16), transparent 45%),
    linear-gradient(135deg, #746c5c 0%, #4a4438 52%, #2a261f 100%);
}
.game-card-art-pro.pro-noir {
  background:
    radial-gradient(120% 140% at 25% 15%, rgba(255,255,255,0.28), transparent 45%),
    linear-gradient(135deg, #c65a4a 0%, #8a2f2f 52%, #451414 100%);
}
.game-card-art-pro.pro-sunny {
  background:
    radial-gradient(120% 140% at 25% 15%, rgba(255,255,255,0.34), transparent 45%),
    linear-gradient(135deg, #ffd66b 0%, #e0983a 52%, #8a5316 100%);
}

/* Painted game-icon artwork (Picture Mirror, Emoji Charades, Code Mirror,
   Prompt Repair Shop) - a generated illustration fills the card banner
   instead of the flat gradient + line-icon treatment. Taller than the
   plain gradient banner so the artwork has room to read clearly. */
.game-card-art-photo {
  height: 165px;
  background-size: cover;
  background-position: center 40%;
  border-radius: 12px;
  border: 1px solid rgba(216, 157, 58, 0.24);
  margin-bottom: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.game-card-art-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(14, 10, 6, 0.65) 100%);
  pointer-events: none;
}

.game-card:hover .game-card-art-photo {
  transform: scale(1.025);
  border-color: rgba(244, 200, 113, 0.5);
}

.game-card p { color: var(--muted); font-size: 0.9rem; flex-grow: 1; }

.info-icon-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(216,157,58,0.16);
  color: var(--accent-bright);
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  z-index: 2;
}
.info-icon-btn:hover, .info-icon-btn:focus-visible { background: var(--accent); color: #201404; }

/* MODULE INFO POPUP */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,7,3,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-card {
  background: linear-gradient(180deg, rgba(216,157,58,0.05), transparent 120px), var(--surface);
  border: 1px solid rgba(216,157,58,0.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px;
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: fadein 0.15s ease;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: rgba(216,157,58,0.25); }
.modal-card h3:first-of-type { margin-top: 18px; }

.more-games-note { text-align: center; font-size: 0.85rem; margin: 28px 0 0; }

.back-link { display: inline-block; margin-bottom: 14px; }

.hub-header-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}
.hub-header-links .back-link { margin-bottom: 0; }
.hub-header-sep { color: var(--muted); }

.identity-badge-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.howto {
  background: rgba(26, 18, 11, 0.7);
  border: 1px solid rgba(216, 157, 58, 0.2);
  border-radius: 14px;
  padding: 4px 18px;
  margin: 6px 0 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.howto[open] {
  background: rgba(30, 21, 13, 0.85);
  border-color: rgba(244, 200, 113, 0.4);
}
.howto summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-bright);
  padding: 13px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before {
  content: "?";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: #1a0e02;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.howto p {
  color: var(--text);
  line-height: 1.65;
  margin: 0 0 16px;
  font-size: 0.92rem;
}

.rules-list { color: var(--text); line-height: 1.7; padding-left: 22px; }
.howto .rules-list { margin: 4px 0 16px; }

.game-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  color: rgba(255,250,238,0.95);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.game-icon-badge svg { width: 22px; height: 22px; }
.game-icon-badge.gib-mirror { background: linear-gradient(135deg, var(--accent), var(--accent-bright)); }
.game-icon-badge.gib-emoji { background: linear-gradient(135deg, #a63c22, #e07a4a); }
.game-icon-badge.gib-code { background: linear-gradient(135deg, #1f6e58, #3fae94); }
.game-icon-badge.gib-repair { background: linear-gradient(135deg, #7a3418, #c9702f); }
.game-icon-badge.gib-arcade { background: linear-gradient(135deg, #a63c22, #e07a4a); }

/* Training badges get the same layered-gradient "pro" treatment as the
   module cards (see .game-card-art-pro) instead of a flat two-tone
   gradient - covers the course header, the module-list header, and every
   individual training game's own header in one rule. */
.game-icon-badge.gib-training {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 150% at 25% 15%, rgba(255,255,255,0.4), transparent 50%),
    linear-gradient(135deg, #8a76d6 0%, #5c48a3 55%, #362a6b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -6px 10px rgba(0,0,0,0.3),
    0 4px 14px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,241,214,0.22);
}
.game-icon-badge.gib-training svg {
  filter: drop-shadow(0 2px 3px rgba(20,10,40,0.5));
}
.game-icon-badge.gib-escape {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 150% at 25% 15%, rgba(255,255,255,0.34), transparent 50%),
    linear-gradient(135deg, #c65a4a 0%, #8a2f2f 55%, #451414 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -6px 10px rgba(0,0,0,0.3),
    0 4px 14px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,241,214,0.22);
}
.game-icon-badge.gib-escape svg {
  filter: drop-shadow(0 2px 3px rgba(20,10,40,0.5));
}
.game-icon-badge.gib-robot {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 150% at 25% 15%, rgba(255,255,255,0.4), transparent 50%),
    linear-gradient(135deg, #ffd66b 0%, #e0983a 55%, #8a5316 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -6px 10px rgba(0,0,0,0.3),
    0 4px 14px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,241,214,0.22);
}
.game-icon-badge.gib-robot svg {
  filter: drop-shadow(0 2px 3px rgba(60,35,0,0.5));
}

/* Human vs. AI: Next-Word Showdown - a small bar-chart row per candidate
   next token, showing the real model's own top-5 probabilities. */
.predict-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  font-size: 0.9rem;
}
.predict-rank { width: 20px; color: var(--muted); font-weight: 700; flex-shrink: 0; }
.predict-token { width: 110px; flex-shrink: 0; font-weight: 600; overflow-wrap: anywhere; }
.predict-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}
.predict-bar-fill { display: block; height: 100%; background: var(--accent); }
.predict-pct { width: 44px; text-align: right; flex-shrink: 0; color: var(--muted); font-size: 0.82rem; }
.predict-row.matched { color: var(--accent-2); }
.predict-row.matched .predict-token { color: var(--accent-2); }
.predict-row.matched .predict-bar-fill { background: var(--accent-2); }

.level-picker {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.level-btn {
  flex: 1;
  background: rgba(25, 17, 10, 0.75);
  border: 1px solid rgba(216, 157, 58, 0.18);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 10px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.level-btn .level-num { font-weight: 700; font-size: 0.95rem; }
.level-btn .level-tag { font-size: 0.75rem; color: var(--muted); }
.level-btn:hover {
  border-color: rgba(244, 200, 113, 0.4);
  background: rgba(216, 157, 58, 0.1);
  transform: translateY(-2px);
}
.level-btn.active {
  border-color: var(--accent-bright);
  background: linear-gradient(135deg, rgba(216, 157, 58, 0.28) 0%, rgba(216, 157, 58, 0.12) 100%);
  box-shadow: 0 4px 14px rgba(216, 157, 58, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.level-btn.active .level-tag { color: #fff8ee; font-weight: 500; }

.theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.theme-btn {
  flex: 1 1 auto;
  min-width: 130px;
  background: rgba(25, 17, 10, 0.75);
  border: 1px solid rgba(216, 157, 58, 0.18);
  border-radius: 12px;
  color: var(--text);
  padding: 11px 14px;
  cursor: pointer;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.theme-btn:hover {
  border-color: rgba(244, 200, 113, 0.4);
  background: rgba(216, 157, 58, 0.1);
  transform: translateY(-1px);
}
.theme-btn.active {
  border-color: var(--accent-bright);
  background: linear-gradient(135deg, rgba(216, 157, 58, 0.28) 0%, rgba(216, 157, 58, 0.12) 100%);
  color: #fff9ee;
  box-shadow: 0 4px 14px rgba(216, 157, 58, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.level-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(216, 157, 58, 0.15);
  border: 1px solid rgba(216, 157, 58, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
  vertical-align: middle;
  margin-left: 8px;
}

.round-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.round-timer-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  background: rgba(216, 157, 58, 0.15);
  border: 1px solid rgba(216, 157, 58, 0.4);
  border-radius: 6px;
  padding: 2px 10px;
}
.round-timer.negative .round-timer-value {
  color: var(--danger);
  background: rgba(255,107,107,0.12);
  border-color: rgba(255,107,107,0.4);
}


.loading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  margin: 20px 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.image-wrap { text-align: center; margin: 18px 0; }
.image-wrap img {
  max-width: 100%;
  max-height: 480px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.input-with-mic { display: flex; align-items: flex-start; gap: 8px; }
.input-with-mic textarea { flex: 1; width: auto; min-width: 0; }

.mic-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mic-btn:hover { border-color: rgba(255,255,255,0.25); }
.mic-btn.listening {
  background: var(--danger);
  border-color: var(--danger);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,107,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(255,107,107,0); }
}

.clue-block { text-align: center; margin: 4px 0 18px; }
.clue-block .level-badge { margin-right: 10px; }
.clue-block .hint { margin: 8px 0 0; }

/* Category badge (Movie / Idiom / Phrase) - shown immediately alongside
   the emoji string, unlike the optional hint below, so a player always
   knows upfront what kind of answer they're guessing. Uses the teal
   accent so it reads as distinct from the orange difficulty badges. */
.clue-block .category-badge {
  display: block;
  width: fit-content;
  margin: 0 auto 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(51, 214, 166, 0.14);
  border-color: rgba(51, 214, 166, 0.45);
  padding: 5px 16px;
}

.emoji-display-wrap { text-align: center; margin: 18px 0; }
.emoji-display {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 36px 44px;
  font-size: 3rem;
  line-height: 1.3;
  letter-spacing: 0.08em;
  max-width: 100%;
  word-break: break-word;
}

.result-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 24px 0;
}
.result-image-col {
  background: rgba(22, 15, 9, 0.7);
  border: 1px solid rgba(216, 157, 58, 0.2);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.result-image-col h3 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-bright);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-image-col img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(216, 157, 58, 0.25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  display: block;
  min-height: 120px;
  background: var(--surface-2);
}

.code-block-wrap { margin: 18px 0; }
.code-block {
  background: rgba(14, 10, 6, 0.85);
  border: 1px solid rgba(216, 157, 58, 0.2);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #fff4dc;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}
.result-image-col .code-block { min-height: 120px; max-height: 360px; }
.tournament-result-card .code-block {
  max-height: 220px;
  font-size: 0.78rem;
  margin-bottom: 10px;
}

.score-block {
  text-align: center;
  margin: 30px auto 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(216, 157, 58, 0.22);
  border-radius: 18px;
  padding: 24px;
  max-width: 480px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.score-number {
  font-size: 3.4rem;
  font-weight: 800;
  font-family: var(--font-display);
  background: linear-gradient(180deg, #ffffff 0%, #f4c871 60%, #d89d3a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.score-max { font-size: 1.4rem; color: var(--muted); font-weight: 600; -webkit-text-fill-color: var(--muted); }
.score-bar-track {
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(216, 157, 58, 0.2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
  padding: 2px;
}
.score-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(216, 157, 58, 0.5);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1), background 0.8s ease;
}
  background: var(--danger);
  transition: width 0.6s ease, background 0.6s ease;
}

.feedback {
  line-height: 1.6;
  min-height: 1.6em;
  white-space: pre-wrap;
}

.reveal-box {
  background: rgba(22, 16, 9, 0.75);
  border: 1px solid rgba(216, 157, 58, 0.18);
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.reveal-label {
  color: var(--accent-bright);
  font-weight: 700;
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
#reveal-prompt-text {
  font-style: italic;
  color: #fff6e5;
  line-height: 1.6;
}

/* CUSTOM MODERN SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0c0906;
}
::-webkit-scrollbar-thumb {
  background: rgba(216, 157, 58, 0.3);
  border-radius: 999px;
  border: 2px solid #0c0906;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(244, 200, 113, 0.55);
}

/* "AI's ideal prompt" - the optional, on-demand reverse-engineered-prompt
   learning aid. Teal accent border so it visually reads as a distinct,
   optional extra rather than part of the required score/reveal flow. */
.ideal-prompt-block { border: 1px solid rgba(51, 214, 166, 0.35); }
.ideal-prompt-block .hint { margin: 6px 0 12px; }
.ideal-prompt-block .loading-row { margin-top: 10px; }
.ideal-prompt-text { font-style: italic; line-height: 1.6; margin: 12px 0 0; }

.result-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 16px;
}
.player-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.player-row input[type="text"] { flex: 1; margin: 0; }
.player-row .remove-player-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  padding: 4px 10px;
}
.player-row .remove-player-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.tournament-join-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(216,157,58,0.16);
}
.tournament-open-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 14px;
}
.tournament-open-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid rgba(216,157,58,0.14);
  border-radius: 10px;
  padding: 10px 14px;
}
.tor-name { font-weight: 700; color: var(--text); }
.tor-meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.join-by-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0 4px;
}
.join-by-code-row input[type="text"] { flex: 1; margin: 0; }

.escape-case-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 18px;
}
.escape-case-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid rgba(216,157,58,0.14);
  border-radius: 10px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.escape-case-row-main { flex: 1 1 220px; min-width: 0; }
.escape-case-row-title { font-weight: 700; color: var(--text); font-size: 1.05rem; }
.escape-case-row-tagline { font-size: 0.85rem; color: var(--muted); margin-top: 3px; }
.escape-case-row-status { font-size: 0.8rem; color: var(--accent-2); margin-top: 6px; font-weight: 600; }
.escape-case-row-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.player-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}
.player-status-chip {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.player-status-chip.current { border-color: var(--accent); color: var(--text); }
.player-status-chip.done { color: var(--accent-2); border-color: rgba(51,214,166,0.4); }

.tournament-original-block {
  text-align: center;
  margin: 18px 0 0;
}
.tournament-original-block .reveal-label { display: block; margin-bottom: 8px; }
.tournament-original-image {
  max-width: 260px;
  width: 100%;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
}
.tournament-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.tournament-result-card {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.tournament-result-card.winner {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2);
}
.tournament-result-card img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--surface);
}
.tournament-result-card .trc-winner-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.tournament-result-card .trc-name { font-weight: 700; }
.tournament-result-card .trc-score { font-size: 1.7rem; font-weight: 800; margin: 4px 0 8px; }
.tournament-result-card .trc-feedback { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.tournament-result-card .trc-prompt { font-size: 0.8rem; color: var(--muted); font-style: italic; margin-top: 10px; }

.standings-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.standings-row {
  display: flex;
  justify-content: space-between;
  background: var(--surface-2);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
}
.standings-row.leader { border: 1px solid var(--accent-2); }
.standings-name { font-weight: 600; }
.standings-detail { color: var(--muted); }

.champion-block {
  text-align: center;
  margin: 20px 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-2);
}

.bracket-view {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 8px 2px 18px;
  margin: 10px 0;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 14px;
  min-width: 200px;
  flex-shrink: 0;
}
.bracket-round-title {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.bracket-match {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
}
.bracket-match.playable {
  border-color: var(--accent);
  cursor: pointer;
}
.bracket-match.playable:hover { background: rgba(216, 157, 58, 0.12); }
.bracket-match.done { opacity: 0.85; }
.bracket-slot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}
.bracket-slot.winner-slot { font-weight: 700; color: var(--accent-2); }
.bracket-slot.bye-slot { color: var(--muted); font-style: italic; }
.bracket-slot .bracket-score { color: var(--muted); font-variant-numeric: tabular-nums; }
.bracket-slot.winner-slot .bracket-score { color: var(--accent-2); }
.bracket-match-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 4px;
}
.bracket-match-tag.tbd { color: var(--muted); }

.match-tally {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0 22px;
}
.match-tally-item {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 140px;
}
.match-tally-item .mt-name { font-weight: 700; font-size: 0.9rem; }
.match-tally-item .mt-score { font-size: 1.3rem; font-weight: 800; margin-top: 2px; }
.match-tally-item .mt-score .mt-score-max { font-size: 0.8rem; color: var(--muted); font-weight: 500; }

.sub-round-heading { margin: 8px 0 14px; font-size: 1rem; color: var(--text); }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.profile-card {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 16px;
}
.profile-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.profile-card-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 2px; }
.profile-card-name .identity-badge-role { margin-left: 6px; vertical-align: middle; }
.profile-card-id {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}
.profile-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.profile-role-toggle-btn, .profile-delete-btn { font-size: 0.78rem; white-space: nowrap; }
.profile-delete-btn:hover { color: #ff6b6b; }

.profile-create-block {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}
.profile-create-block label { margin-top: 0; }
.profile-create-row { display: flex; gap: 10px; align-items: flex-start; }
.profile-create-row input { flex: 1; margin: 0; }
.profile-create-row .btn-primary { margin-top: 0; white-space: nowrap; }
.new-profile-id {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin: 4px 0;
}
.profile-stats-toggle {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.profile-stats-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.profile-stats-summary::-webkit-details-marker { display: none; }
.profile-stats-summary::before {
  content: "\25B8";
  display: inline-block;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.profile-stats-toggle[open] > .profile-stats-summary::before { transform: rotate(90deg); }
.profile-stats-toggle[open] > .profile-stats-summary { margin-bottom: 2px; }

/* Picture Mirror's admin-only "cached challenge images" viewer. */
.image-pool-admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 4px;
}
.image-pool-bucket {
  margin-top: 12px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 14px;
}
.image-pool-bucket-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.image-pool-bucket-summary::-webkit-details-marker { display: none; }
.image-pool-bucket-summary::before {
  content: "\25B8";
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  transition: transform 0.15s ease;
}
.image-pool-bucket[open] > .image-pool-bucket-summary::before { transform: rotate(90deg); }
.image-pool-bucket-count {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}
.image-pool-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.image-pool-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.image-pool-row:hover { border-color: var(--accent); background: rgba(216, 157, 58, 0.12); }
.image-pool-row-prompt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-pool-row-when {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.image-pool-detail-image {
  width: 100%;
  max-width: 480px;
  display: block;
  margin: 14px auto;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--surface-2);
}
.image-pool-detail-prompt-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 16px 0 4px;
}
.image-pool-detail-prompt {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
}

.profile-game-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.profile-game-block:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.profile-game-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 6px;
}
.profile-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 3px 0;
}
.profile-stat-row span:last-child { color: var(--text); font-weight: 600; text-align: right; }
.profile-stat-subheading {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.75;
  margin: 8px 0 2px;
}
.profile-stat-row-sub {
  padding-left: 10px;
  font-size: 0.78rem;
}
.profile-stat-row-sub span:first-child { color: var(--muted); }
.profile-rank-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(216, 157, 58, 0.15);
  border: 1px solid rgba(216, 157, 58, 0.4);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 4px;
  vertical-align: middle;
}

.repair-requirements-list { color: var(--text); line-height: 1.7; padding-left: 22px; margin: 10px 0 16px; }
.repair-testcase-msg {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.repair-testcase-msg .reveal-label { display: inline; margin-right: 6px; }
.repair-attempts-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px 12px;
  margin: 12px 0 6px;
}
.repair-result-row {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--muted);
}
.repair-result-row.pass { border-left-color: var(--accent-2); }
.repair-result-row.fail { border-left-color: var(--danger); }
.repair-result-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.85rem; }
.repair-result-row.pass .repair-result-tag { color: var(--accent-2); }
.repair-result-row.fail .repair-result-tag { color: var(--danger); }
.repair-result-msg { color: var(--muted); font-size: 0.82rem; font-style: italic; margin-top: 2px; }
.repair-result-note { color: var(--danger); font-size: 0.82rem; margin-top: 4px; }
.repair-score-line { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }
.repair-repaired-tag { color: var(--accent-2); font-weight: 700; }
.repair-repaired-banner { border: 1px solid rgba(51,214,166,0.4); }

/* ---------------------------------------------------------------------
   AI Escape Room - one continuous multi-stage case rather than repeated
   short rounds, so it gets its own small set of layout pieces: a stage
   header with a countdown timer and progress dots, evidence cards, a
   suspect-interrogation chat panel, and an admin content-editor layout.
   Reuses .reveal-box / .repair-attempts-badge / .repair-result-row /
   .level-btn / .btn-primary / .btn-secondary / .standings-row / .hint
   from the rest of the app wherever the shape already matches.
--------------------------------------------------------------------- */
.escape-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.escape-timer {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-bright);
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
}
.escape-timer.over-time { color: var(--danger); }

.escape-stage-dots {
  display: flex;
  gap: 8px;
  margin: 10px 0 14px;
}
.escape-stage-dot {
  width: 30px;
  height: 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.1);
}
.escape-stage-dot.done { background: var(--accent-2); border-color: var(--accent-2); }
.escape-stage-dot.current { background: linear-gradient(90deg, var(--accent), var(--accent-bright)); border-color: var(--accent-bright); }

.escape-evidence-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 18px;
}
.escape-evidence-card {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
}
.escape-evidence-title {
  font-weight: 700;
  color: var(--accent-bright);
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.escape-evidence-body { color: var(--text); font-size: 0.92rem; line-height: 1.55; margin: 0; }

.escape-chat-panel {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
}
.escape-chat-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 12px;
}
.escape-chat-target-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.escape-chat-target-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(216,157,58,0.14);
}
.escape-chat-transcript {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.escape-chat-empty { color: var(--muted); font-size: 0.85rem; font-style: italic; }
.escape-chat-bubble {
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 88%;
}
.escape-chat-bubble.you {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: #201404;
  font-weight: 600;
}
.escape-chat-bubble.them {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
}
.escape-chat-bubble-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.75;
  margin-bottom: 2px;
}
.escape-chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.escape-chat-input-row textarea { flex: 1; margin: 0; }

.escape-answer-block { margin-top: 8px; }
.escape-answer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 4px;
}
.escape-final-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 10px 0;
}
.escape-final-fields label { margin-bottom: 2px; }

/* Admin content editor */
.escape-admin-card {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.escape-admin-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.escape-admin-card-head strong { color: var(--accent-bright); }
.escape-admin-evidence-row {
  border-top: 1px dashed rgba(255,255,255,0.12);
  padding-top: 8px;
  margin-top: 8px;
}
.escape-admin-remove-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}
.escape-admin-remove-btn:hover { color: var(--danger); border-color: var(--danger); }

/* ---------------------------------------------------------------------
   Ulta-Pulta Robot - many short, independently-generated missions rather
   than one continuous story, so its own pieces are simpler than Escape
   Room's: a row of object chips, a goal checklist with a per-goal status
   (pending / done / funny mis-fire), a turn badge for duel mode, and a
   small costume gallery for solo-mode collectibles. Reuses .reveal-box /
   .repair-attempts-badge / .level-btn / .btn-primary / .input-with-mic /
   .mic-btn / .standings-table / .hint / .error from the rest of the app.
--------------------------------------------------------------------- */
.ultapulta-turn-badge {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.85rem;
  color: #201404;
  background: linear-gradient(135deg, #ffd66b, #e0983a);
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
}

.ultapulta-object-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
}
.ultapulta-object-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 7px 14px 7px 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.ultapulta-object-chip-icon { font-size: 1.2rem; line-height: 1; }

.ultapulta-goal-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
}
.ultapulta-goal-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.ultapulta-goal-item .ultapulta-goal-status {
  flex-shrink: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}
.ultapulta-goal-item .ultapulta-goal-text { color: var(--text); line-height: 1.5; }
.ultapulta-goal-item .ultapulta-goal-note {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
  margin-top: 2px;
}
.ultapulta-goal-item.done { border-left-color: var(--accent-2); }
.ultapulta-goal-item.funny { border-left-color: var(--accent); }

/* The in-play progress row (#ultapulta-goal-list) only ever holds an icon
   and a short "Part N" label now (the real goal text moved to the results
   screen's #ultapulta-goal-reveal, which keeps the stacked layout above
   since it has actual sentences to read) - so lay it out as a compact
   horizontal row of chips instead of one-per-line, to save vertical space. */
#ultapulta-goal-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}
#ultapulta-goal-list .ultapulta-goal-item {
  flex: 0 1 auto;
  padding: 8px 12px;
}
#ultapulta-goal-list .ultapulta-goal-text { white-space: nowrap; }
#ultapulta-goal-list .ultapulta-goal-note { white-space: normal; }

.ultapulta-instruction-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 10px;
  flex-wrap: wrap;
}

.ultapulta-costume-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 10px 0 6px;
}
.ultapulta-costume-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 64px;
}
.ultapulta-costume-item-icon { font-size: 1.6rem; }
.ultapulta-costume-item-label { font-size: 0.7rem; color: var(--muted); text-align: center; }

@media (max-width: 640px) {
  .escape-final-fields { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .result-images { grid-template-columns: 1fr; }
  .card { padding: 22px; }

  .topbar { flex-wrap: wrap; row-gap: 10px; padding: 14px 18px; }
  .topbar-actions { flex-wrap: wrap; row-gap: 8px; gap: 10px 14px; }
  .identity-badge { flex-wrap: wrap; padding-right: 0; border-right: none; margin-right: 0; }
  .identity-badge-label { display: none; }
  main#app { padding: 20px 18px 48px; }
}

/* ---------------------------------------------------------------------
   AI Training - Module 3 (The AI Tools Landscape): Tool Dispatcher,
   Live or Stale?, Lock It Down, The Tool Salesman. Reuses .reveal-box /
   .level-btn / .repair-result-row / .repair-attempts-badge; only the bits
   below are new (streak pill, web-access badge, mock settings switches,
   the salesman chat transcript).
   --------------------------------------------------------------------- */
.streak-pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(216,157,58,0.12);
  border: 1px solid rgba(216,157,58,0.3);
  border-radius: 999px;
  padding: 3px 12px;
  margin: 0 0 6px;
}
.streak-pill:empty { display: none; }

.stale-tool-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 12px;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--muted);
}
.stale-tool-badge.web-on { color: var(--accent-2); border-color: rgba(51,214,166,0.45); background: rgba(51,214,166,0.08); }
.stale-tool-badge.web-off { color: #ffb454; border-color: rgba(255,180,84,0.45); background: rgba(255,180,84,0.08); }

.lockit-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 12px;
}
.lockit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.lockit-row-text { flex: 1 1 240px; min-width: 0; }
.lockit-row-label { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.lockit-row-desc { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.lockit-row-why { flex-basis: 100%; font-size: 0.85rem; color: var(--text); margin-top: 2px; }
.lockit-row.pass { border-left-color: var(--accent-2); }
.lockit-row.fail { border-left-color: var(--danger); }
.lockit-row.either { border-left-color: var(--muted); }
.lockit-tag { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-left: 8px; }
.lockit-row.pass .lockit-tag { color: var(--accent-2); }
.lockit-row.fail .lockit-tag { color: var(--danger); }
.lockit-row.either .lockit-tag { color: var(--muted); }

.lockit-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.lockit-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.15s ease;
}
.lockit-switch[aria-checked="true"] { background: rgba(51,214,166,0.35); border-color: rgba(51,214,166,0.6); }
.lockit-switch[aria-checked="true"]::after { transform: translateX(20px); }
.lockit-switch:disabled { cursor: default; opacity: 0.85; }
.lockit-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.salesman-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 6px;
}
.salesman-chat:empty { display: none; }
.salesman-msg {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.salesman-msg.you { align-self: flex-end; background: rgba(216,157,58,0.15); border: 1px solid rgba(216,157,58,0.3); }
.salesman-msg.vendor { align-self: flex-start; background: var(--surface-2); border: 1px solid rgba(255,255,255,0.08); }
.salesman-msg .salesman-who { display: block; font-size: 0.72rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.04em; }

#salesman-reveal { margin-top: 16px; }
#btn-lockit-submit { margin-top: 4px; }
#dispatcher-feedback, #stale-feedback { margin-top: 10px; }

/* ---- AI Training: Modules 4 and 5 (prompting games) ---- */
.forge-input { width: 100%; margin-bottom: 12px; resize: vertical; min-height: 44px; }
.output-box {
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  font-size: 0.92rem;
  max-height: 340px;
  overflow-y: auto;
}
.forge-breakdown { display: grid; gap: 8px; margin: 14px 0; }
.forge-row {
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 9px 12px;
  background: rgba(0,0,0,0.18);
}
.forge-row.pass { border-left-color: var(--accent-2); }
.forge-row.mid { border-left-color: var(--warn); }
.forge-row.fail { border-left-color: var(--danger); }
.forge-row-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.forge-chip {
  font-size: 0.78rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.forge-row-note { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.forge-ideal { padding: 8px 2px 2px; font-size: 0.88rem; line-height: 1.5; }

.duel-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.duel-col { min-width: 0; }
@media (max-width: 720px) { .duel-cols { grid-template-columns: 1fr; } }

.check-list { list-style: none; margin: 10px 0 6px; padding: 0; display: grid; gap: 5px; font-size: 0.86rem; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; }
.check-list .check-mark { font-weight: 800; width: 1.1em; flex: none; color: var(--muted); }
.check-list li.pass .check-mark { color: var(--accent-2); }
.check-list li.fail .check-mark { color: var(--danger); }
.check-list li.fail { color: var(--text); }

.fewshot-examples { display: grid; gap: 8px; margin: 8px 0 14px; }
.fewshot-example {
  display: flex; flex-direction: column; gap: 4px;
  text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 12px;
}
.fewshot-example:hover { border-color: rgba(255,255,255,0.25); }
.fewshot-example.selected { border-color: var(--accent-bright); background: rgba(216,157,58,0.14); box-shadow: 0 0 0 1px var(--accent-bright) inset; }
.fewshot-example-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.fewshot-example-text { font-size: 0.88rem; line-height: 1.45; }

.showwork-steps { display: grid; gap: 8px; margin: 12px 0; }
.showwork-step {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 12px;
}
.showwork-step:hover:not(:disabled) { border-color: var(--accent-bright); }
.showwork-step:disabled { cursor: default; }
.showwork-step-num { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.showwork-step.faulty { border-color: var(--danger); background: rgba(255,107,107,0.12); }
.showwork-step.wrong-pick { border-color: var(--warn); opacity: 0.8; }
.showwork-answer { font-weight: 700; padding: 6px 4px 0; }
#btn-showwork-sound, #btn-missing-next, #btn-showwork-next, #btn-forge-next, #btn-duel-next, #btn-refine-next, #btn-fewshot-next, #btn-forge-submit, #btn-duel-submit, #btn-fewshot-run { margin-top: 10px; }
#refine-draft { margin: 6px 0 10px; }
#refine-turns { margin: 8px 0; }

/* ---- AI Training: Modules 6-8 ---- */
.classify-items { display: grid; gap: 10px; margin: 12px 0; }
.classify-item {
  border: 1px solid rgba(255,255,255,0.1);
  border-left: 4px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 11px 13px;
  background: rgba(0,0,0,0.2);
}
.classify-item.correct { border-left-color: var(--accent-2); }
.classify-item.wrong { border-left-color: var(--danger); }
.classify-text { line-height: 1.45; }
.classify-detail {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: rgba(255,255,255,0.05); font-size: 0.86rem; color: var(--muted); line-height: 1.45;
}
.classify-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.classify-opt {
  font: inherit; font-size: 0.85rem; cursor: pointer; color: var(--text);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; padding: 6px 14px;
}
.classify-opt:hover:not(:disabled) { border-color: var(--accent-bright); }
.classify-opt.active { background: rgba(216,157,58,0.22); border-color: var(--accent-bright); font-weight: 700; }
.classify-opt:disabled { cursor: default; }
.classify-opt.right-answer { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.classify-item.wrong .classify-opt.active:not(.right-answer) { border-color: var(--danger); background: rgba(255,107,107,0.16); }
.classify-explain { margin-top: 9px; font-size: 0.86rem; line-height: 1.45; color: var(--text); opacity: 0.92; }
.aud-results { display: grid; gap: 14px; margin: 10px 0; }
.aud-card { border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 4px 12px 8px; background: rgba(0,0,0,0.12); }
.aud-field { margin-bottom: 4px; }
#sheet-facts, #sheet-left-output, #sheet-right-output { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; white-space: pre; overflow-x: auto; }
#btn-tone-submit, #btn-sheet-submit, #btn-actions-submit, #btn-mortem-submit, #btn-aud-submit, #btn-flaws-submit, #btn-audit-submit, #btn-cite-submit, #btn-decides-submit,
#btn-tone-next, #btn-sheet-next, #btn-actions-next, #btn-mortem-next, #btn-aud-next, #btn-flaws-next, #btn-audit-next, #btn-cite-next, #btn-decides-next { margin-top: 10px; }

/* ---- AI Training: Modules 9-11 ---- */
#btn-pic-submit, #btn-script-submit, #btn-builder-submit, #btn-chain-submit, #btn-cfo-submit, #btn-tool-submit, #btn-approach-submit, #btn-value-submit, #btn-pilots-submit,
#btn-pic-next, #btn-script-next, #btn-builder-next, #btn-chain-next, #btn-cfo-next, #btn-tool-next, #btn-approach-next, #btn-value-next, #btn-pilots-next { margin-top: 10px; }
#chain-steps h3 { margin: 10px 0 6px; font-size: 0.95rem; }


/* --- Module 16-17: playbook builder, certificate --------------------------------- */
.pb-list { display: grid; gap: 10px; margin: 10px 0 14px; }
.pb-entry { border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 12px 14px; background: rgba(0,0,0,0.18); }
.pb-entry-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.pb-entry-head strong { flex: 1 1 240px; }
.pb-chip { font-size: 0.78rem; padding: 2px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.15); color: var(--muted, #c9b78a); }
.pb-chip-good { border-color: rgba(80, 200, 150, 0.6); color: #7fe0b5; }
.pb-details { margin: 6px 0 8px; }
.pb-details summary { cursor: pointer; font-size: 0.9rem; }
#screen-game-playbook label { display: block; margin: 12px 0 4px; }
#screen-game-playbook .reveal-box { margin: 14px 0; }
#screen-game-playbook input.forge-input { width: 100%; box-sizing: border-box; }
#btn-exam-cert-card { margin-top: 8px; width: 100%; }
.certificate {
  background: #fbf6e9; color: #2b2112; border: 6px double #b8892b; border-radius: 6px;
  padding: 36px 28px; text-align: center; margin: 18px 0;
}
.certificate .cert-brand { font-family: Georgia, "Times New Roman", serif; font-size: 1.6rem; letter-spacing: 0.12em; color: #8a5f12; }
.certificate .cert-kicker { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: #8a7a52; margin-bottom: 14px; }
.certificate h1 { font-family: Georgia, "Times New Roman", serif; color: #2b2112; margin: 8px 0 18px; text-align: center; }
.certificate .cert-line { margin: 10px auto; max-width: 34em; line-height: 1.5; color: #3a2f1a; }
.certificate .cert-name { font-family: Georgia, "Times New Roman", serif; font-size: 2rem; margin: 10px 0 14px; border-bottom: 1px solid #b8892b; display: inline-block; padding: 0 24px 6px; }
.certificate .cert-meta { display: flex; justify-content: space-around; gap: 24px; margin-top: 30px; }
.certificate .cert-meta > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.certificate .cert-value { border-bottom: 1px solid #3a2f1a; padding-bottom: 4px; min-height: 1.4em; }
.certificate small { color: #6b5b36; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.7rem; }
@media print {
  body * { visibility: hidden !important; }
  #certificate, #certificate * { visibility: visible !important; }
  #certificate { position: absolute; left: 0; top: 0; width: 100%; box-sizing: border-box; margin: 0; }
}
#screen-certificate .certificate h1 { text-align: center; justify-content: center; }

/* ---- Module story card + audio ---- */
.story-card {
  background: var(--surface-2);
  border: 1px solid rgba(216,157,58,0.22);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px 10px;
  margin: 6px 0 20px;
}
.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.story-label {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.story-controls { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.story-controls[hidden] { display: none; }
.story-controls .btn-secondary { padding: 6px 14px; font-size: 0.85rem; width: auto; margin: 0; }
.story-controls .btn-secondary[hidden] { display: none; }
.story-rate-label { font-size: 0.8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.story-rate { font-size: 0.82rem; padding: 4px 6px; border-radius: 6px; background: var(--surface); color: var(--text); border: 1px solid rgba(255,255,255,0.15); width: auto; margin: 0; }
.story-text { color: var(--text); line-height: 1.75; font-size: 1rem; margin: 0 0 6px; }
.story-sentence { transition: background-color 0.2s; border-radius: 4px; padding: 1px 0; }
.story-current { background: rgba(216,157,58,0.28); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.story-status { min-height: 1.1em; margin: 0 0 4px; font-size: 0.8rem; }

/* ---- Module "Go deeper" references ---- */
.refs-section { margin: 26px 0 4px; }
.refs-section > summary::before { content: "\2197"; }
.ref-list { list-style: none; margin: 4px 0 6px; padding: 0; }
.ref-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid rgba(216,157,58,0.14); }
.ref-item:first-child { border-top: none; }
.ref-badge { flex: 0 0 112px; width: 112px; box-sizing: border-box; text-align: center; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: rgba(216,157,58,0.18); color: var(--accent-bright); margin-top: 2px; }
.ref-video { background: rgba(214,96,64,0.22); color: #f0a58f; }
.ref-paper { background: rgba(110,150,220,0.2); color: #a9c4f2; }
.ref-report { background: rgba(90,180,140,0.2); color: #9ad8bc; }
.ref-standard { background: rgba(170,130,220,0.2); color: #cdb3f0; }
.ref-course { background: rgba(230,200,90,0.2); color: #ecd78a; }
.ref-body { min-width: 0; }
.ref-title { font-weight: 700; color: var(--text); text-decoration: none; border-bottom: 1px solid rgba(216,157,58,0.5); overflow-wrap: anywhere; }
.ref-title:hover, .ref-title:focus-visible { color: var(--accent-bright); }
.ref-ext { color: var(--accent-bright); }
.ref-source { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.ref-why { color: var(--text); font-size: 0.88rem; line-height: 1.55; margin: 4px 0 0; }
.ref-note { margin: 6px 0 12px; }
@media (max-width: 560px) {
  .ref-item { flex-direction: column; gap: 6px; }
  .ref-badge { flex: 0 0 auto; width: auto; align-self: flex-start; }
}

/* ---- Course briefings ("About this course") ---- */
.course-about-btn { margin-top: 8px; width: 100%; padding: 9px 16px; font-size: 0.88rem; }
.game-card .btn-primary + .course-about-btn { margin-top: 8px; }
.course-about-link { margin-left: 14px; }
.course-about-row { margin-top: 2px; }
.course-about-row .course-about-link { margin-left: 0; }
.modal-card.course-brief { max-width: 760px; max-height: 88vh; }
.cb-kicker { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-bright); margin: 2px 40px 4px 0; }
.course-brief h1 { font-size: 1.7rem; margin-bottom: 4px; padding-right: 36px; }
.cb-tagline { color: var(--muted); font-size: 1rem; line-height: 1.55; margin: 0 0 14px; }
.cb-who { background: var(--surface-2); border: 1px solid rgba(216,157,58,0.16); border-radius: 10px; padding: 10px 14px; margin: 4px 0 6px; }
.cb-who p { margin: 2px 0 0; line-height: 1.5; }
.cb-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.course-brief h3 { margin: 20px 0 8px; }
.cb-outcomes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cb-outcomes li { position: relative; padding: 2px 0 2px 26px; line-height: 1.5; }
.cb-outcomes li::before { content: "\2713"; position: absolute; left: 2px; top: 2px; color: var(--accent-2); font-weight: 800; }
.cb-how { margin: 0; display: grid; gap: 6px; }
.cb-how > div { display: grid; grid-template-columns: 220px 1fr; gap: 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid rgba(216,157,58,0.12); }
.cb-how dt { font-weight: 700; color: var(--accent-bright); }
.cb-how dd { margin: 0; line-height: 1.45; }
.cb-good { margin-top: 16px; }
.cb-good p { color: var(--text); line-height: 1.55; }
.cb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cb-actions .btn-primary, .cb-actions .btn-secondary { margin-top: 0; }
@media (max-width: 600px) {
  .modal-overlay { padding: 10px; }
  .modal-card.course-brief { padding: 22px 18px; max-height: 92vh; }
  .course-brief h1 { font-size: 1.4rem; }
  .cb-how > div { grid-template-columns: 1fr; gap: 2px; }
  .cb-actions .btn-primary, .cb-actions .btn-secondary { width: 100%; }
}

/* ---- Picture Mirror: prepare the picture library (admin) ---- */
.prep-shell { max-width: 1000px; }
.prep-h { margin: 22px 0 6px; }
.prep-grid-wrap { overflow-x: auto; }
.prep-grid { width: 100%; border-collapse: separate; border-spacing: 6px; font-size: 0.88rem; }
.prep-grid th { text-align: left; color: var(--muted); font-weight: 600; padding: 2px 4px; font-size: 0.8rem; }
.prep-theme { white-space: nowrap; padding-right: 8px; }
.prep-cell { background: var(--surface-2); border: 1px solid rgba(216,157,58,0.14); border-radius: 8px; padding: 6px 10px; min-width: 110px; }
.prep-cell-num { font-weight: 800; font-size: 1.05rem; }
.prep-cell-bar { height: 5px; border-radius: 99px; background: rgba(255,255,255,0.07); margin-top: 4px; overflow: hidden; }
.prep-cell-bar span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.4s ease; }
.prep-cell.full .prep-cell-bar span { background: var(--accent-2); }
.prep-cell.empty .prep-cell-num { color: var(--muted); }
.prep-cell.working { border-color: rgba(51,214,166,0.55); box-shadow: 0 0 0 1px rgba(51,214,166,0.25) inset; animation: prep-pulse 1.6s ease-in-out infinite; }
@keyframes prep-pulse { 50% { border-color: rgba(51,214,166,0.15); } }
.prep-progress { margin: 18px 0 4px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid rgba(216,157,58,0.2); }
.prep-progress.running { border-color: rgba(51,214,166,0.45); }
.prep-progress.error { border-color: rgba(255,107,107,0.5); }
.prep-progress-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; align-items: baseline; }
.prep-progress-head strong { display: inline-flex; align-items: center; gap: 8px; }
.prep-spinner { width: 14px; height: 14px; }
.prep-bar { margin: 10px 0 8px; }
.prep-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9rem; color: var(--muted); }
.prep-stats strong { color: var(--text); }
.prep-progress .btn-secondary { margin-top: 10px; }
.prep-form { margin-top: 6px; }
.prep-form.prep-disabled { opacity: 0.55; }
.prep-row { margin: 12px 0; }
.prep-row label, .prep-label { display: block; margin: 0 0 6px; font-size: 0.9rem; color: var(--muted); }
.prep-row input[type="number"] { width: 120px; background: var(--surface-2); border: 1px solid rgba(216,157,58,0.16); border-radius: 10px; color: var(--text); padding: 10px 12px; font-size: 1rem; font-family: inherit; }
.prep-row .hint { margin: 4px 0 0; }
.prep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.prep-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prep-chip { background: var(--surface-2); color: var(--text); border: 1px solid rgba(216,157,58,0.22); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.prep-chip[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent), var(--accent-bright)); color: #201404; border-color: transparent; font-weight: 700; }
.prep-chip:disabled { cursor: not-allowed; }
.prep-all { font-size: 0.8rem; margin-left: 6px; }
.prep-check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 0.92rem; margin: 14px 0 6px; line-height: 1.45; }
.prep-check input { margin-top: 3px; }
.prep-estimate { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: rgba(0,0,0,0.18); line-height: 1.55; font-size: 0.92rem; }
.prep-rules-line { color: var(--accent-2); }
.prep-from-viewer { margin: 4px 0 14px; }
@media (max-width: 640px) {
  .prep-two { grid-template-columns: 1fr; }
  .prep-cell { min-width: 70px; padding: 5px 7px; }
}

/* ---- Listen button on "How to play" / "How it's judged" sections ---- */
.howto summary .howto-listen {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  color: var(--accent-bright);
  border: 1px solid rgba(216,157,58,0.35);
  border-radius: 999px;
  padding: 3px 11px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.4;
}
.howto summary .howto-listen:hover, .howto summary .howto-listen:focus-visible { border-color: var(--accent); background: rgba(216,157,58,0.14); outline: none; }
.howto summary .howto-listen.playing { background: var(--accent); color: #201404; border-color: transparent; }
.howto summary .howto-listen span { font-size: 0.7rem; }

/* ---- Tournament control room (admin) ---- */
.cr-shell { max-width: 1180px; }
.cr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cr-head h1 { margin-bottom: 4px; }
.cr-live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--accent-2); white-space: nowrap; margin-top: 8px; }
.cr-live-dot span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); animation: cr-blink 2s ease-in-out infinite; }
.cr-live-dot.stale { color: var(--warn); }
.cr-live-dot.stale span { background: var(--warn); animation: none; }
@keyframes cr-blink { 50% { opacity: 0.25; } }
.cr-h { margin: 24px 0 10px; }
.cr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cr-card { text-align: left; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid rgba(216,157,58,0.16); border-radius: 12px; padding: 14px 16px; transition: border-color 0.15s ease, transform 0.15s ease; }
.cr-card:hover, .cr-card:focus-visible { border-color: rgba(216,157,58,0.5); transform: translateY(-1px); outline: none; }
.cr-card-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.78rem; }
.cr-game { color: var(--muted); font-weight: 700; }
.cr-code { margin-left: auto; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.cr-card-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.cr-card-line { font-size: 0.88rem; line-height: 1.45; }
.cr-card-foot { font-size: 0.78rem; color: var(--muted); }
.cr-finished { margin-top: 20px; }
.cr-finished summary { cursor: pointer; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.cr-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
.cr-bar span { display: block; height: 100%; background: linear-gradient(90deg, #2d7d6a, #33d6a6); border-radius: 99px; transition: width 0.5s ease; }
.cr-bar.big { height: 12px; flex: 1; }
.cr-bar.small { height: 6px; width: 110px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.cr-pill { display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: rgba(255,255,255,0.08); color: var(--muted); }
.cr-pill.cr-live, .cr-pill.cr-playing { background: rgba(255,180,84,0.18); color: var(--warn); }
.cr-pill.cr-done, .cr-pill.cr-champion, .cr-pill.cr-finished { background: rgba(51,214,166,0.16); color: var(--accent-2); }
.cr-pill.cr-ready { background: rgba(143,179,255,0.16); color: #a9c4f2; }
.cr-pill.cr-out { background: rgba(255,107,107,0.12); color: #ff9c9c; }
.cr-detail-bar { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 12px; }
.cr-champion { padding: 12px 16px; border-radius: 12px; background: rgba(51,214,166,0.10); border: 1px solid rgba(51,214,166,0.4); font-size: 1.05rem; margin-bottom: 12px; }
.cr-overall { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 14px; font-size: 0.92rem; }
.cr-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cr-tile { background: var(--surface-2); border: 1px solid rgba(216,157,58,0.14); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.cr-tile span { font-size: 0.74rem; color: var(--muted); }
.cr-tile strong { font-size: 1.5rem; line-height: 1.2; }
.cr-tile em { font-style: normal; font-size: 0.74rem; color: var(--muted); }
.cr-tile.hot { border-color: rgba(255,180,84,0.5); }
.cr-tile.hot strong { color: var(--warn); }
.cr-attention { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: rgba(255,180,84,0.10); border: 1px solid rgba(255,180,84,0.45); line-height: 1.5; }
.cr-ready-note { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: rgba(143,179,255,0.08); border: 1px solid rgba(143,179,255,0.3); line-height: 1.5; font-size: 0.92rem; }
.cr-stages { display: grid; gap: 8px; }
.cr-stage { display: grid; grid-template-columns: 130px 1fr 260px; gap: 12px; align-items: center; }
.cr-stage-name { font-weight: 700; }
.cr-stage-bar { height: 14px; border-radius: 99px; background: rgba(255,255,255,0.06); overflow: hidden; display: flex; }
.cr-stage-bar span { height: 100%; }
.s-done, .cr-legend .l-done { background: #33d6a6; }
.s-playing, .cr-legend .l-playing { background: #ffb454; }
.s-ready, .cr-legend .l-ready { background: #8fb3ff; }
.s-waiting, .cr-legend .l-waiting { background: rgba(255,255,255,0.18); }
.cr-stage-count { font-size: 0.84rem; color: var(--muted); }
.cr-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 0.78rem; color: var(--muted); margin-top: 8px; }
.cr-legend span { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -8px; }
.cr-table-wrap { overflow-x: auto; }
.cr-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.cr-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.78rem; padding: 6px 8px; border-bottom: 1px solid rgba(216,157,58,0.18); white-space: nowrap; }
.cr-table td { padding: 9px 8px; border-bottom: 1px solid rgba(216,157,58,0.08); vertical-align: top; }
.cr-stage-row th { padding-top: 16px; color: var(--accent-bright); font-family: var(--font-display); font-size: 0.95rem; text-transform: none; letter-spacing: 0; }
.cr-row-bye td { opacity: 0.55; }
.cr-row-playing td { background: rgba(255,180,84,0.05); }
.cr-players { min-width: 200px; }
.cr-vs { color: var(--muted); font-size: 0.75rem; margin: 0 8px; }
.cr-winner { color: var(--accent-2); font-weight: 800; }
.cr-loser { color: var(--muted); }
.cr-waiting-on { margin-top: 4px; font-size: 0.78rem; color: var(--warn); }
.cr-total { font-weight: 800; font-size: 1rem; }
.cr-subs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cr-sub { font-size: 0.74rem; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,0.06); white-space: nowrap; }
.cr-sub.open { border: 1px dashed rgba(255,180,84,0.5); }
.cr-sub b { font-weight: 600; }
.cr-sub b.w { color: var(--accent-2); font-weight: 800; }
.cr-prog, .cr-timing { white-space: nowrap; color: var(--muted); font-size: 0.84rem; }
.cr-warn { color: var(--warn); font-weight: 700; }
.cr-standings td:nth-child(n+4) { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .cr-stage { grid-template-columns: 1fr; gap: 4px; }
  .cr-head { flex-direction: column; }
  .cr-cards { grid-template-columns: 1fr; }
}
/* Tournament control room: AI cost */
.cr-spend { margin: 6px 0 4px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid rgba(216,157,58,0.16); }
.cr-spend > summary { cursor: pointer; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.cr-spend-total { margin-left: auto; font-size: 1.1rem; color: var(--accent-bright); }
.cr-spend-table { margin-top: 10px; }
.cr-spend-table td { white-space: nowrap; }
.cr-spend-sum td { border-top: 1px solid rgba(216,157,58,0.3); font-weight: 700; }
.cr-spend-actions { margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cr-mini { margin-top: 0; padding: 5px 12px; font-size: 0.82rem; }
.cr-cost { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cr-tile.cost strong { color: var(--accent-bright); }

/* ---- Emoji Charades: puzzle library + hosted tournaments ---- */
.tournament-open-row .tor-main { flex: 1; min-width: 0; }
.tournament-open-row .tor-view-btn { white-space: nowrap; }
#emoji-theme-picker .theme-btn, #emoji-tournament-theme-picker .theme-btn { white-space: nowrap; }
.elib-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 8px; }
.elib-toolbar select {
  background: var(--surface-2); color: var(--text); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 9px 12px; font: inherit; min-width: 0; max-width: 100%;
}
.elib-toolbar .elib-clear.danger { background: var(--danger); border-color: var(--danger); color: #1a0d0d; }
.elib-table-wrap { overflow-x: auto; margin-top: 6px; }
.elib-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.elib-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.elib-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: top; }
.elib-table td .hint { margin: 2px 0 0; font-size: 0.8rem; }
.elib-emoji { font-size: 1.35rem; white-space: nowrap; letter-spacing: 0.04em; }
#emoji-match-subround-display { font-size: 2.2rem; }
@media (max-width: 560px) {
  .elib-table th:nth-child(5), .elib-table td:nth-child(5) { display: none; }
  .elib-emoji { font-size: 1.1rem; white-space: normal; }
}
#emoji-library-links { margin-top: 14px; }
.elib-toolbar > * { margin: 0; }
#code-library-links { margin-top: 14px; }
.clib-task { max-width: 420px; line-height: 1.4; }
.clib-code summary { cursor: pointer; color: var(--accent-bright); font-size: 0.85rem; }
.clib-code .code-block { margin-top: 8px; max-width: 460px; font-size: 0.78rem; }
#code-match-subround-result .reveal-box .code-block { margin-top: 8px; }
@media (max-width: 560px) { .clib-task { max-width: none; } }

/* Ulta-Pulta mission library: the hidden goals of a kept mission. */
.ulib-goals { margin: 6px 0 4px; padding-left: 18px; max-width: 420px; font-size: 0.82rem; line-height: 1.4; }
.ulib-goals .ulib-trap { color: var(--accent-bright); font-weight: 600; }

/* ---- Event mode (public nights) ---- */
.ev-banner { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 9999; max-width: min(92vw, 560px); padding: 10px 16px; border-radius: 12px; background: rgba(255,180,84,0.18); border: 1px solid rgba(255,180,84,0.6); color: var(--text); font-size: 0.92rem; text-align: center; backdrop-filter: blur(6px); box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
.ev-banner.ev-banner-bad { background: rgba(255,107,107,0.2); border-color: rgba(255,107,107,0.65); }
.ev-organiser-link { display: block; margin-top: 10px; font-size: 0.85rem; }
.ev-unlock-btn { margin-left: 8px; font-size: 0.82rem; }
#screen-identity .card.ev-public { display: flex; flex-direction: column; }
#screen-identity .card.ev-public > h1 { order: -4; }
#screen-identity .card.ev-public > p.muted { order: -3; }
#screen-identity .card.ev-public > .tournament-join-block { order: -2; margin-top: 8px; padding-top: 0; border-top: 0; }
#screen-identity .card.ev-public > label[for="input-identity-search"] { margin-top: 24px; }
.ev-dialog-back { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ev-dialog-back[hidden] { display: none; }
.ev-dialog-actions { display: flex; gap: 10px; margin-top: 12px; }
.ev-live { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; margin: 14px 0 6px; border-radius: 14px; background: rgba(51,214,166,0.07); border: 1px solid rgba(51,214,166,0.35); }
.ev-live.ev-status-low { background: rgba(255,180,84,0.1); border-color: rgba(255,180,84,0.55); }
.ev-live.ev-status-out, .ev-live.ev-paused { background: rgba(255,107,107,0.1); border-color: rgba(255,107,107,0.55); }
.ev-live-main { flex: 1 1 260px; }
.ev-live-num { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; }
.ev-live-label { color: var(--muted); margin: 4px 0 8px; font-size: 0.9rem; }
.ev-warn { color: var(--warn); margin: 8px 0 0; font-weight: 600; }
.ev-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; cursor: pointer; }
.ev-check input { width: auto; margin-top: 4px; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.ev-join { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,0.03); border: 1px solid rgba(216,157,58,0.2); }
.ev-qr { background: #fff; padding: 4px; border-radius: 10px; line-height: 0; }
.ev-url { font-size: 1.15rem; font-weight: 700; word-break: break-all; }
.ev-links { display: flex; gap: 10px; flex-wrap: wrap; }
.ev-links a { text-decoration: none; display: inline-block; }
.ev-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.ev-danger { border-color: rgba(255,107,107,0.6); color: var(--danger); }
.cr-tools { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: rgba(143,179,255,0.07); border: 1px solid rgba(143,179,255,0.3); }
.cr-tools-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.cr-tools-row input { flex: 1 1 220px; margin: 0; }
.cr-wo { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cr-wo-btn { font: inherit; font-size: 0.75rem; padding: 4px 9px; border-radius: 8px; cursor: pointer; background: transparent; color: var(--text); border: 1px solid rgba(216,157,58,0.45); }
.cr-wo-btn:hover { background: rgba(216,157,58,0.14); }
.cr-wo-btn.armed { background: var(--warn); color: #1b1206; border-color: var(--warn); font-weight: 700; }
