/* ==========================================================================
   LowKey Games - Modern Lightweight CSS
   Pure vanilla, mobile-first, 60fps responsive styling (<20KB)
   ========================================================================== */

:root {
  --bg-main: #0b0f17;
  --bg-card: #131b26;
  --bg-card-hover: #1b2636;
  --bg-surface: #16202e;
  --bg-elevated: #1e293b;
  --border-subtle: #243247;
  --border-active: #38bdf8;
  --border-focus: #38bdf8;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #8b9bb4;

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header & Navigation */
.site-header {
  background: rgba(19, 27, 38, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-logo {
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

/* Subdomain Switcher Navigation */
.network-nav-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: var(--radius-full);
}

.network-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  text-decoration: none;
}

.network-nav-link:hover {
  color: var(--text-main);
  background: var(--bg-elevated);
}

.network-nav-link.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

@media (max-width: 860px) {
  .network-nav-tabs {
    display: none;
  }
}

.header-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-user-chip:hover {
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow);
}

.user-code-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: var(--accent-cyan);
}

.header-actions {
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

/* Hero Section */
.hero-section {
  padding: 36px 0 24px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-full);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero-subtitle {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  font-size: 1rem;
}

/* Games Grid - Mobile Friendly Cards */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 16px;
}

.section-heading h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-md);
}

.game-card.featured {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.05) 0%, var(--bg-card) 60%);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.game-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.game-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.game-info .tagline {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

.game-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 18px;
  flex-grow: 1;
}

.game-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.meta-tag {
  background: var(--bg-elevated);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #04121d;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7dd3fc, var(--accent-cyan));
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
}

/* PhyloClade Game Screen Styles */
.game-play-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 20px 0 40px;
  box-shadow: var(--shadow-md);
}

/* Setup Screen */
.setup-header {
  text-align: center;
  margin-bottom: 24px;
}

.setup-header h2 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.mode-selector {
  margin: 24px 0;
  background: var(--bg-elevated);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.mode-selector-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: block;
}

.mode-options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.mode-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.mode-radio-card:hover {
  border-color: var(--accent-cyan);
}

.mode-radio-card.selected,
.mode-radio-card:has(input:checked) {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.mode-radio-card input {
  margin-top: 3px;
  accent-color: var(--accent-cyan);
}

.mode-card-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.mode-card-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Group Selection Grid */
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.group-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.group-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
}

.group-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.group-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.group-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.group-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-grow: 1;
}

.group-subgroups-preview {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 6px;
  border-radius: 4px;
}

/* In-Game HUD */
.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.hud-group-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.hud-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.mode-normal { background: rgba(56, 189, 248, 0.15); color: var(--accent-cyan); }
.mode-timed { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.mode-learning { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }

.hud-stat-pill {
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  border: 1px solid var(--border-subtle);
}

.hud-timer {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
  border-color: var(--accent-amber);
  font-weight: 700;
}

/* Taxon Presentation Card */
.taxon-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 720px) {
  .taxon-card {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

.taxon-art-wrapper {
  background: #0d1219;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
}

.organism-svg, .organism-specimen-img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-md);
}

.organism-art-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.critical-error-plate, .organism-load-error-plate {
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
  animation: criticalPulse 2s infinite ease-in-out;
}

@keyframes criticalPulse {
  0%, 100% { border-color: rgba(239, 68, 68, 0.7); box-shadow: 0 0 15px rgba(239, 68, 68, 0.2); }
  50% { border-color: rgba(239, 68, 68, 1); box-shadow: 0 0 25px rgba(239, 68, 68, 0.45); }
}

.taxon-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.taxon-common-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.taxon-scientific-name {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--accent-cyan);
}

.taxon-rank-badge {
  display: inline-block;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  width: fit-content;
  border: 1px solid var(--border-subtle);
}

.taxon-diagnostic-feature {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--accent-emerald);
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #a7f3d0;
  margin-top: 4px;
}

/* Question Prompt & Subgroups Grid */
.question-prompt {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-main);
  text-align: center;
}

.subgroup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.btn-subgroup-option {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 14px 12px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn-subgroup-option:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.btn-subgroup-option:disabled {
  cursor: default;
  opacity: 0.9;
}

.btn-subgroup-option.correct-highlight {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--accent-emerald) !important;
  color: #6ee7b7 !important;
  font-weight: 700;
}

.btn-subgroup-option.selected-correct {
  background: var(--accent-emerald) !important;
  color: #032b1d !important;
  border-color: var(--accent-emerald) !important;
  font-weight: 800;
}

.btn-subgroup-option.selected-incorrect {
  background: var(--accent-rose) !important;
  color: #ffffff !important;
  border-color: var(--accent-rose) !important;
}

.btn-subgroup-option.revealed-learning {
  background: rgba(16, 185, 129, 0.25) !important;
  border: 2px dashed var(--accent-emerald) !important;
  color: #a7f3d0 !important;
}

.learning-tag {
  display: block;
  font-size: 0.68rem;
  background: var(--accent-emerald);
  color: #032b1d;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

/* Feedback Box */
.feedback-box {
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  animation: fadeIn 0.25s ease-out;
}

.feedback-correct {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--accent-emerald);
}

.feedback-incorrect {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid var(--accent-rose);
}

.learning-mode-card {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--accent-cyan);
}

.feedback-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.feedback-reason p {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.45;
}

.feedback-taxonomy-chip {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--accent-cyan);
}

.learning-hint {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  margin-top: 6px;
}

/* Previous Specimen Review Panel (shown below active question) */
.previous-feedback-card {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-top: 14px;
  margin-bottom: 20px;
  animation: fadeIn 0.25s ease-out;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.previous-feedback-card.prev-correct {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(17, 24, 39, 0.8) 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.08);
}

.previous-feedback-card.prev-incorrect {
  border-color: rgba(244, 63, 94, 0.45);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.08) 0%, rgba(17, 24, 39, 0.8) 100%);
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.08);
}

.previous-feedback-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.previous-feedback-badge {
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.previous-feedback-badge.badge-correct {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.previous-feedback-badge.badge-incorrect {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.previous-feedback-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.previous-feedback-title strong {
  color: var(--accent-cyan);
}

.previous-feedback-clade-info {
  font-size: 0.88rem;
  margin: 4px 0 6px 0;
  color: var(--text-muted);
}

.previous-feedback-reason {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 6px 0 0 0;
}

.previous-feedback-reason strong {
  color: var(--text-main);
}

.previous-clade-pill {
  display: inline-block;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.82rem;
}

/* Previous Feedback Thumbnail and Body Layout */
.previous-feedback-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.previous-feedback-thumbnail {
  width: 96px;
  height: 64px;
  min-width: 96px;
  max-width: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #0b131e;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  margin-top: 2px;
}

.previous-feedback-thumbnail .organism-art-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.previous-feedback-thumbnail img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  display: block !important;
}

.previous-feedback-thumbnail svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
}

.previous-feedback-content {
  flex: 1;
  min-width: 0;
}

/* ========================================================
   Active Gameplay Presentation: Drastically Reduced Header
   Keeps top header (LowKey Games + Profile) up at all times.
   Replaces big hero banner & nav with sleek 1-liner active game bar.
   ======================================================== */
.site-header {
  transition: all 0.2s ease;
}

body.game-active-mode .site-header,
body.results-mode .site-header {
  display: block !important;
  background: rgba(11, 15, 23, 0.96) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
}

body.game-active-mode .site-header .header-inner,
body.results-mode .site-header .header-inner {
  height: 44px !important;
}

body.game-active-mode .brand-logo,
body.results-mode .brand-logo {
  font-size: 1.05rem !important;
  gap: 8px !important;
}

body.game-active-mode .brand-icon,
body.results-mode .brand-icon {
  width: 26px !important;
  height: 26px !important;
  font-size: 0.9rem !important;
}

body.game-active-mode .header-user-chip,
body.results-mode .header-user-chip {
  padding: 3px 10px !important;
  font-size: 0.8rem !important;
}

.header-user-badges {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-amber);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 2px;
  white-space: nowrap;
}

/* 1-Liner Active Game Subheader */
.active-game-bar {
  display: none;
}

body.game-active-mode .active-game-bar {
  display: block !important;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  position: sticky;
  top: 44px; /* Sticks right below the 44px top header */
  z-index: 99;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.active-game-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
}

.active-game-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-game-indicator-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-emerald);
  flex-shrink: 0;
}

.btn-active-exit {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-active-exit:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fff;
}

.active-game-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-active-share {
  background: transparent;
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-active-share:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* Hide bulky pre-game elements during active mode */
body.game-active-mode .hero-section,
body.game-active-mode .portal-nav-bar,
body.game-active-mode .site-nav,
body.game-active-mode #daily-launch-container,
body.game-active-mode .games-showcase,
body.game-active-mode #phyloclade-setup-banner,
body.game-active-mode .site-footer {
  display: none !important;
}

body.game-active-mode main.container {
  padding-top: 8px !important;
}

body.game-active-mode .game-play-container {
  margin-top: 0 !important;
}

body.game-active-mode .versus-container {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Mobile-Specific Refinements for Zero-Scroll Pacing */
@media (max-width: 768px) {
  body.game-active-mode main.container,
  body.results-mode main.container {
    padding: 0 !important;
    max-width: 100% !important;
  }

  body.game-active-mode .game-play-container,
  body.results-mode .game-play-container,
  body.game-active-mode .versus-container,
  body.results-mode .versus-container {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-radius: 0 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    padding-top: 4px !important;
  }

  .header-user-chip .profile-label {
    display: none;
  }
}

/* Mobile-only pieces of the play screen (hidden on desktop) */
.prev-strip,
.clues-marker,
.active-game-sub,
.hud-short {
  display: none;
}

/* ========================================================
   PhyloClade Mobile Layout
   The specimen photo is the focus: a one-line HUD and a one-line
   previous-answer strip sit above it, the answer buttons follow, and
   the anatomical clue plus the full previous answer sit below a
   "CLUES" marker. The card wrappers use display: contents so their
   children can be reordered as items of #screen-play.
   ======================================================== */
@media (max-width: 680px) {
  .game-play-container {
    padding: 8px 10px 14px 10px;
    margin: 4px 0 16px 0;
    border-radius: var(--radius-md);
  }

  .active-game-sub {
    display: inline;
    color: var(--text-muted);
    font-weight: 600;
  }

  /* Compact header while playing: icon-only brand, no Portal Home link (Exit Game is in the bar) */
  .brand-logo span {
    white-space: nowrap;
  }

  body.game-active-mode .brand-logo span,
  body.game-active-mode .header-home-link {
    display: none;
  }

  .header-home-link {
    white-space: nowrap;
  }

  .active-game-title-wrap {
    flex: 1;
    min-width: 0;
  }

  .active-game-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-active-exit {
    flex-shrink: 0;
    margin-left: 8px;
  }

  #screen-play:not(.hidden) {
    display: flex;
    flex-direction: column;
  }

  #screen-play .taxon-card,
  #screen-play .taxon-details {
    display: contents;
  }

  #screen-play .game-hud { order: 1; }
  #screen-play .prev-strip { order: 2; }
  #screen-play .taxon-art-wrapper { order: 3; }
  #screen-play .taxon-rank-badge { order: 4; }
  #screen-play .taxon-common-name { order: 5; }
  #screen-play .question-prompt { order: 6; }
  #screen-play .subgroup-grid { order: 7; }
  #screen-play .game-controls-bar { order: 8; }
  #screen-play .clues-marker { order: 9; }
  #screen-play .taxon-diagnostic-feature { order: 10; }
  #screen-play #feedback-box { order: 11; }
  #screen-play .taxon-attribution { order: 12; }
  #screen-play .taxon-scientific-name { order: 13; }

  /* One-line HUD: mode, score, timer and streak */
  .game-hud {
    flex-wrap: nowrap;
    padding-bottom: 5px;
    margin-bottom: 6px;
    gap: 4px;
  }

  .hud-group-title,
  .hud-label {
    display: none;
  }

  .hud-short {
    display: inline;
  }

  .hud-badges {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 4px;
    white-space: nowrap;
  }

  .hud-stat-pill, .mode-pill {
    font-size: 0.72rem;
    padding: 2px 7px;
  }

  /* One-line previous answer; tap to jump to the full explanation */
  .prev-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 6px;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .prev-strip.hidden {
    display: none;
  }

  .prev-strip.prev-correct {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.1);
  }

  .prev-strip.prev-incorrect {
    border-color: rgba(244, 63, 94, 0.45);
    background: rgba(244, 63, 94, 0.1);
  }

  .prev-strip-icon {
    font-weight: 800;
    flex-shrink: 0;
  }

  .prev-strip.prev-correct .prev-strip-icon { color: #6ee7b7; }
  .prev-strip.prev-incorrect .prev-strip-icon { color: #fda4af; }

  .prev-strip-text {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .prev-strip-more {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-dim);
    font-size: 0.7rem;
  }

  /* Specimen photo: as large as the screen allows */
  .taxon-art-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #090e17;
    border-radius: var(--radius-md);
    padding: 2px 0;
  }

  .taxon-art-wrapper .organism-art-wrapper,
  .taxon-art-wrapper .organism-specimen-img {
    height: clamp(170px, calc(100svh - 420px), 440px) !important;
    max-height: clamp(170px, calc(100svh - 420px), 440px) !important;
    border-radius: var(--radius-sm) !important;
  }

  .taxon-art-wrapper .organism-specimen-img {
    object-fit: contain !important;
  }

  .taxon-art-wrapper .organism-plate-container {
    max-width: 100% !important;
  }

  .taxon-art-wrapper svg {
    max-height: clamp(170px, calc(100svh - 420px), 440px) !important;
    width: auto !important;
  }

  .taxon-art-wrapper .organism-attribution-badge {
    display: none !important; /* The full credit is shown below the clues */
  }

  .taxon-rank-badge {
    align-self: center;
    font-size: 0.68rem;
    padding: 1px 6px;
    line-height: 1.1;
    margin-top: 5px;
  }

  .taxon-common-name {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 2px 0 0 0;
    line-height: 1.15;
    text-align: center;
  }

  .taxon-scientific-name {
    display: none;
  }

  /* One short line above the answer buttons */
  .question-prompt {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 4px 0 0 0;
    line-height: 1.2;
    color: var(--text-muted);
  }

  .question-prompt strong {
    color: var(--accent-cyan);
  }

  #screen-play .btn-phylogeny { order: 10; }

  /* Compact 3-Column Subgroup Touch Grid */
  .subgroup-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 6px;
    margin-bottom: 5px;
  }

  .btn-subgroup-option {
    min-height: 40px;
    padding: 4px 3px;
    font-size: 0.80rem;
    font-weight: 700;
    line-height: 1.15;
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  }

  .btn-subgroup-option:hover:not(:disabled) {
    transform: none; /* Avoid tap layout bounce on mobile */
  }

  .game-controls-bar {
    margin-top: 4px;
    justify-content: center;
  }

  #btn-quit-game {
    padding: 5px 14px;
    font-size: 0.78rem;
  }

  /* "CLUES" marker tells players there is more below the buttons */
  .clues-marker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 8px 0;
    color: var(--accent-emerald);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
  }

  .clues-marker::before,
  .clues-marker::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(16, 185, 129, 0.35);
  }

  .taxon-diagnostic-feature {
    font-size: 0.86rem;
    padding: 8px 10px;
    margin: 0 0 10px 0;
    line-height: 1.4;
    border-radius: var(--radius-sm);
    width: 100%;
    box-sizing: border-box;
  }

  .taxon-attribution {
    margin-top: 8px !important;
    font-size: 0.72rem !important;
    text-align: center;
  }

  /* Full previous answer, below the clue */
  .previous-feedback-card {
    padding: 10px 12px;
    margin: 0 0 6px 0;
    border-radius: var(--radius-sm);
  }

  .previous-feedback-body {
    gap: 10px;
  }

  .previous-feedback-thumbnail {
    width: 72px;
    height: 50px;
    min-width: 72px;
    max-width: 72px;
    border-radius: 4px;
  }

  .previous-feedback-thumbnail .organism-attribution-badge {
    display: none !important;
  }

  .previous-feedback-header {
    gap: 6px;
    margin-bottom: 4px;
  }

  .previous-feedback-badge {
    font-size: 0.68rem;
    padding: 1px 6px;
  }

  .previous-feedback-title {
    font-size: 0.82rem;
  }

  .previous-feedback-clade-info {
    font-size: 0.8rem;
    margin: 2px 0 4px 0;
    line-height: 1.35;
  }

  .previous-clade-pill {
    font-size: 0.74rem;
    padding: 1px 5px;
  }

  .previous-feedback-reason {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .learning-mode-card {
    padding: 10px 12px;
    margin-bottom: 8px;
  }

  .learning-mode-card .feedback-title {
    font-size: 0.9rem;
    margin-bottom: 4px;
  }

  .learning-mode-card .feedback-reason p {
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0 0 4px 0;
  }

  .learning-mode-card .learning-hint {
    display: none;
  }
}

@media (max-width: 680px) and (max-height: 650px) {
  .btn-subgroup-option {
    min-height: 36px;
    font-size: 0.76rem;
    padding: 3px 2px;
  }
}

/* Short desktop windows (laptops): the photo shrinks with the window but stays the main thing on screen */
@media (min-width: 681px) and (max-height: 650px) {
  .taxon-art-wrapper .organism-art-wrapper,
  .taxon-art-wrapper .organism-specimen-img {
    height: clamp(180px, calc(100vh - 300px), 300px) !important;
    max-height: clamp(180px, calc(100vh - 300px), 300px) !important;
  }

  .btn-subgroup-option {
    min-height: 34px;
    font-size: 0.75rem;
    padding: 3px 2px;
  }

  .previous-feedback-card {
    padding: 3px 6px;
    margin-bottom: 4px;
  }
}

/* Game Controls Footer */
.game-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Summary Screen */
.summary-card {
  text-align: center;
  max-width: 500px;
  margin: 0 auto 24px;
}

.summary-code-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.summary-code-badge span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.summary-code-badge strong {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 1.4rem;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
}

.summary-grid-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.stat-tile {
  background: var(--bg-elevated);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
}

.stat-val.highlight {
  color: var(--accent-cyan);
}

.summary-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Leaderboard Hub Section */
.leaderboard-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 32px 0 48px;
}

.leaderboard-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  justify-content: space-between;
}

/* Leaderboard Game Switcher Tabs */
.leaderboard-game-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 14px 2px;
  margin-bottom: 12px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.lb-game-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lb-game-tab:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.lb-game-tab.active {
  color: #fff;
  background: var(--bg-elevated);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.lb-game-tab[data-game="phyloclade"].active {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.25);
}

.lb-game-tab[data-game="cladespeed"].active {
  border-color: var(--accent-amber);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
}

.lb-game-tab[data-game="phyloversus"].active {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.25);
}

.lb-game-tab[data-game="daily_challenge"].active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

/* Personal Best & Active Identity Card */
.leaderboard-personal-card {
  background: linear-gradient(135deg, rgba(22, 32, 46, 0.75), rgba(15, 23, 42, 0.85));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.lb-personal-main {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.lb-personal-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-personal-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.lb-personal-stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.lb-stat-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.lb-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.lb-stat-pill strong {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-top: 2px;
}

/* Game Badge Pills in Table */
.badge-game {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-game-all {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-game-phyloclade {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-game-cladespeed {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-game-phyloversus {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-game-daily {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.rank-1 { color: #fbbf24; }
.rank-2 { color: #e2e8f0; }
.rank-3 { color: #f97316; }

.select-dropdown {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

.select-dropdown:focus {
  border-color: var(--accent-cyan);
}

.leaderboard-table-wrapper {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.leaderboard-table th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.leaderboard-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-table tr:hover {
  background: var(--bg-card-hover);
}

.user-row-highlight {
  background: rgba(56, 189, 248, 0.08) !important;
  border-left: 3px solid var(--accent-cyan);
}

.player-code-cell {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-weight: 700;
}

.you-badge {
  background: var(--accent-cyan);
  color: #04121d;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 800;
  margin-left: 6px;
}

/* User Code Modal */
/* The overlay scrolls, so a modal taller than the screen stays reachable; the auto
   margin centers it when it fits and pins it to the top when it doesn't. */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 200;
  padding: 16px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  margin: auto;
  box-shadow: var(--shadow-md);
}

/* Header (with the close button) stays visible while the modal scrolls */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card);
  padding: 8px 0;
}

@media (max-width: 680px) {
  .modal-overlay {
    padding: 8px;
  }

  .modal-card {
    padding: 14px;
  }

  .modal-header .btn-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .profile-section-card {
    padding: 12px;
  }

  .profile-input-group {
    flex-wrap: wrap;
  }

  .profile-restore-grid {
    grid-template-columns: 1fr !important;
  }
}

.modal-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.code-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.code-input {
  flex-grow: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Accessibility - Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* CladeSpeed Answer Queue & Accessibility Enhancements */
.speed-queue-section {
  margin-top: 24px;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.speed-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.speed-queue-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-queue-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-queue-count {
  font-size: 0.78rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.speed-accessibility-badges {
  display: flex;
  gap: 6px;
}

.access-pill {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.access-pill.pill-visual {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.access-pill.pill-screen {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Real-Time Flash Banner for Hearing-Impaired Accessibility */
.speed-flash-banner {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: flashPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.speed-flash-banner.flash-correct {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(17, 24, 39, 0.9) 100%);
  border: 1px solid #10b981;
  color: #6ee7b7;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
}

.speed-flash-banner.flash-incorrect {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.25) 0%, rgba(17, 24, 39, 0.9) 100%);
  border: 1px solid #f43f5e;
  color: #fda4af;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.2);
}

@keyframes flashPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Rolling Answer Queue Container */
.speed-answer-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}

.speed-queue-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
  padding: 12px 0;
  text-align: center;
}

/* Individual Queue Card */
.speed-queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  animation: queueItemIn 0.22s ease-out;
  transition: border-color 0.15s ease;
}

.speed-queue-item.queue-item-correct {
  border-left: 4px solid #10b981;
}

.speed-queue-item.queue-item-incorrect {
  border-left: 4px solid #f43f5e;
}

@keyframes queueItemIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.speed-queue-thumb {
  width: 48px;
  height: 48px;
  min-width: 48px;
  max-width: 48px;
  border-radius: var(--radius-sm);
  background: #0b131e;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.speed-queue-thumb .organism-art-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  background: transparent !important;
}

.speed-queue-thumb img,
.speed-queue-thumb svg {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.speed-queue-info {
  flex-grow: 1;
  min-width: 0;
}

.speed-queue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.speed-queue-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.speed-queue-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.speed-queue-badge.badge-correct {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.speed-queue-badge.badge-incorrect {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.speed-queue-details {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.speed-queue-sci {
  font-style: italic;
  font-family: Georgia, serif;
  color: var(--accent-cyan);
}

/* Keyboard hint badges on action buttons */
.speed-key-hint {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

.speed-key-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-main);
}

/* Button feedback animations */
.btn-speed-choice.feedback-correct {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.25) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3) !important;
}

.btn-speed-choice.feedback-incorrect {
  border-color: #f43f5e !important;
  background: rgba(244, 63, 94, 0.25) !important;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.3) !important;
}

.btn-speed-choice:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid var(--accent-cyan) !important;
  outline-offset: 3px !important;
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   EXPANSION SUITE: PORTAL TABS, DAILY, VERSUS, FIELD GUIDE, CLADOGRAM, BADGES
   ========================================================================== */

/* 1. Portal Navigation Tabs */
.portal-nav-bar {
  background: rgba(19, 27, 38, 0.94);
  border: 1.5px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 8px;
  margin-bottom: 24px;
  position: sticky;
  top: 12px;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.portal-nav-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
}

.portal-nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

.nav-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(99, 102, 241, 0.3) 100%);
  color: #38bdf8;
  border: 1.5px solid #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.nav-tab-badge {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

/* 2. Daily Challenge Banner & Modal */
#daily-launch-container {
  min-height: 82px;
}

.daily-promo-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.daily-completed-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.daily-art-box {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.daily-art-box svg {
  max-width: 100%;
  max-height: 100%;
}

.btn-daily-choice {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 14px 12px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-daily-choice:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.daily-feedback {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-size: 0.92rem;
  animation: fadeIn 0.25s ease-out;
}

.daily-feedback.fb-correct {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  color: #6ee7b7;
}

.daily-feedback.fb-incorrect {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--accent-rose);
  color: #fda4af;
}

/* 3. PhyloVersus Triplet Challenge - Streamlined Horizontal Layout & Clean UI */
.versus-container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 4px;
}

.versus-top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: rgba(19, 27, 38, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.versus-breadcrumbs {
  font-size: 0.88rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.versus-breadcrumbs .active-crumb {
  color: var(--accent-cyan);
  font-weight: 700;
}

.btn-versus-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-versus-back:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  transform: translateX(-3px);
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.2);
}

.versus-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
}

.versus-prompt-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
}

.versus-prompt-pill strong {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 3-Column Streamlined Horizontal Layout */
.versus-cards-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
  width: 100%;
}

@media (max-width: 768px) {
  .versus-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
}

/* Modern Streamlined Triplet Card */
.versus-card {
  background: var(--bg-surface, #16202e);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 14px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.22s ease,
              box-shadow 0.22s ease,
              background 0.22s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  user-select: none;
  min-height: 230px;
  overflow: hidden;
}

.versus-card:hover:not(.locked) {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 16px rgba(56, 189, 248, 0.25);
}

.versus-card:active:not(.locked) {
  transform: translateY(-1px);
}

.versus-card.locked {
  cursor: default;
}

/* Candidate Identifier Pill */
.versus-candidate-pill {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
}

/* Specimen photo: the whole plate is shown (letterboxed), never cropped */
.versus-card-art {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  background: #0b0f17;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
}

.versus-card-art .organism-plate-container {
  max-width: 100% !important;
  height: 100%;
}

.versus-card-art .organism-art-wrapper,
.versus-card-art .organism-specimen-img {
  height: 100% !important;
  border-radius: var(--radius-sm) !important;
}

.versus-card-art .organism-specimen-img {
  object-fit: contain !important;
}

/* Phones: photo on the left, name and button on the right, so all three candidates fit on screen */
@media (max-width: 768px) {
  .versus-card {
    display: grid;
    grid-template-columns: 46% 1fr;
    grid-template-areas:
      "art pill"
      "art info"
      "art btn";
    grid-template-rows: auto 1fr auto;
    column-gap: 10px;
    align-items: center;
    text-align: left;
    min-height: 0;
    padding: 8px;
  }

  .versus-card .versus-candidate-pill {
    grid-area: pill;
    justify-self: start;
    margin-bottom: 2px;
  }

  .versus-card-art {
    grid-area: art;
    height: 130px;
    margin-bottom: 0;
  }

  .versus-card .versus-card-info {
    grid-area: info;
    margin-bottom: 4px;
    min-width: 0;
  }

  .versus-card .btn-versus-select {
    grid-area: btn;
    padding: 6px 8px;
    font-size: 0.8rem;
  }
}

.versus-card-art svg {
  max-width: 90px;
  max-height: 72px;
  width: auto;
  height: auto;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
  transition: transform 0.2s ease;
}

.versus-card:hover:not(.locked) .versus-card-art svg {
  transform: scale(1.08);
}

/* Info Section */
.versus-card-info {
  width: 100%;
  margin-bottom: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.versus-card-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 2px 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.versus-card-sci {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
  margin: 0 0 4px 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Reveal Clade Slot */
.versus-clade-reveal {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 6px;
  margin-top: 4px;
  line-height: 1.3;
  animation: fadeIn 0.3s ease;
}

.versus-role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-outgroup {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-sister {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Clean, Premium Action Button */
.btn-versus-select {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18) 0%, rgba(99, 102, 241, 0.24) 100%);
  color: #38bdf8;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

.versus-card:hover:not(.locked) .btn-versus-select {
  background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5), 0 3px 10px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

/* Post-Selection State Styling */
.versus-card.card-correct-pick {
  border: 2px solid #10b981 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.35) !important;
}

.versus-card.card-correct-pick .btn-versus-select {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5) !important;
}

.versus-card.card-incorrect-pick {
  border: 2px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.35) !important;
}

.versus-card.card-incorrect-pick .btn-versus-select {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

.versus-card.card-true-outgroup {
  border: 2px solid #38bdf8 !important;
  background: rgba(56, 189, 248, 0.12) !important;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4) !important;
}

.versus-card.card-true-outgroup .btn-versus-select {
  background: #0284c7 !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
}

.versus-card.card-sister-dimmed {
  opacity: 0.6;
}

.versus-card.card-sister-dimmed .btn-versus-select {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
}

/* Feedback & Education Banner */
.versus-feedback-card {
  margin-top: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  animation: fadeIn 0.25s ease-out;
}

.versus-feedback-card.fb-correct {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.versus-feedback-card.fb-incorrect {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
}

/* 4. Field Guide & Specimen Compendium ("TaxaDex") */
.fg-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.fg-search-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .fg-search-row {
    grid-template-columns: 1fr;
  }
}

.fg-search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  width: 100%;
}

.fg-search-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.fg-filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  width: 100%;
}

.fg-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fg-progress-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.fg-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
  width: 0%;
  transition: width 0.4s ease;
}

.fg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.fg-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.fg-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-cyan);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.fg-card-thumb {
  height: 140px;
  background: #090d16;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fg-card-thumb svg {
  max-width: 100%;
  max-height: 100%;
}

.fg-status-pill {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.pill-discovered {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.pill-locked {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.fg-undiscovered .fg-card-thumb svg {
  filter: grayscale(1) opacity(0.4);
}

.fg-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.fg-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.fg-card-title {
  font-size: 1.05rem;
  margin: 0;
  color: var(--text-main);
}

.fg-clade-tag {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  white-space: nowrap;
}

.fg-card-sci {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted);
  margin: 0 0 6px 0;
}

.fg-card-trait {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fg-tax-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.fg-tax-rank {
  color: var(--text-muted);
  font-weight: 600;
}

.fg-tax-val {
  color: var(--accent-cyan);
  font-style: italic;
}

/* 5. Cladogram Tree of Life Viewer */
.cladogram-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.cladogram-svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.cladogram-node:hover text {
  fill: var(--accent-cyan) !important;
}

.clado-detail-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

.clado-detail-card h4 {
  margin: 0 0 8px 0;
  color: var(--accent-cyan);
  font-size: 1.05rem;
}

.clado-detail-card p {
  margin: 4px 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-main);
}

/* 6. Achievements & Badges */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.ach-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}

.ach-card.ach-unlocked {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(19, 27, 42, 0.95));
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.1);
}

.ach-card.ach-locked {
  opacity: 0.65;
  filter: grayscale(0.7);
}

.ach-card-icon {
  font-size: 2.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.ach-card-body {
  flex: 1;
}

.ach-card-title {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text-main);
}

.ach-status-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-ach-unlocked {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
}

.badge-ach-locked {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.ach-card-desc {
  margin: 6px 0 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Achievement Toast Notification */
.achievement-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: #101726;
  border: 2px solid var(--accent-amber);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 380px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.achievement-toast.toast-show {
  transform: translateY(0);
  opacity: 1;
}

.ach-toast-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.ach-toast-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent-amber);
  margin-bottom: 2px;
}

.ach-toast-title {
  margin: 0;
  font-size: 1rem;
  color: #ffffff;
}

.ach-toast-desc {
  margin: 3px 0 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ==========================================================================
   PLAYER PROFILE & RECOVERY CODE MODAL
   ========================================================================== */
.profile-section-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}

.profile-field-row {
  display: flex;
  flex-direction: column;
}

.profile-field-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.profile-badge-secure {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
}

.profile-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.profile-code-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
}

.profile-code-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.profile-key-font {
  color: var(--accent-amber);
  letter-spacing: 1px;
}

.profile-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
  display: block;
  line-height: 1.35;
}

/* Clade Session Setup Banner & Indicators */
.clade-selector-banner {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.cs-banner-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.cs-banner-text h3 {
  margin: 0 0 4px 0;
  font-size: 1.05rem;
  color: var(--accent-cyan);
}

.cs-banner-text p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Game Flow Badge */
.badge-flow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  margin-bottom: 8px;
  width: fit-content;
}

.badge-flow.flow-custom {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-flow.flow-rush {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-flow.flow-versus {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-flow.flow-word {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-flow.flow-trivia {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.25);
}

.btn-game-card-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

/* Focus Pulse on Setup */
@keyframes setupPulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6); }
  70% { box-shadow: 0 0 0 14px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.setup-pulse-highlight {
  animation: setupPulse 1.2s ease-out 2;
  border-color: var(--accent-cyan) !important;
}


/* ==========================================================================
   PLAYER PROFILE PANEL (js/profile.js)
   ========================================================================== */
.profile-sync-status {
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.profile-sync-status.sync-online {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.profile-sync-status.sync-offline {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.profile-section-title {
  margin: 0 0 10px 0;
  font-size: 0.95rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-message {
  margin-top: 10px;
  font-size: 0.84rem;
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.35;
}

.profile-message.msg-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.profile-message.msg-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.profile-restore-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.profile-badge-games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 6px;
}

.profile-badge-game {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.profile-badge-game.has-badges {
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--text-main);
}

.profile-badge-game-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-badge-game strong {
  color: var(--accent-amber);
}

/* Badges page: one heading per game */
.ach-game-heading {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 14px 0 2px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
}

.ach-game-heading:first-child {
  margin-top: 0;
}

.ach-game-count {
  font-size: 0.85rem;
  color: var(--accent-amber);
}

/* Site footer text */
.site-footer p {
  margin: 4px 0;
  line-height: 1.5;
}

.site-footer a {
  color: var(--text-muted);
}

/* Games Hub category headings & compact desktop layout */
.games-category {
  margin-bottom: 24px;
}

/* auto-fill keeps a lone card (e.g. the only Chess game) at normal card width */
.games-category .games-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  margin-bottom: 0;
}

.games-category-title {
  font-size: 0.92rem;
  color: var(--accent-cyan);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.games-category-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.28), transparent);
}

.btn-card-details-toggle {
  margin-left: auto;
  align-self: flex-start;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn-card-details-toggle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
}

@media (max-width: 768px) {
  .btn-card-details-toggle,
  .btn-toggle-all-cards {
    display: none !important;
  }
}

@media (min-width: 769px) {
  /* Compact desktop Games Hub: collapse descriptions/tags by default and flow single-game categories in a 3-col grid */
  #games-catalog.games-catalog-root {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 18px;
    align-items: start;
    margin-bottom: 24px;
  }

  #games-catalog.games-catalog-root .games-category {
    margin-bottom: 0;
  }

  #games-catalog.games-catalog-root .games-category-multi {
    grid-column: 1 / -1;
    margin-bottom: 4px;
  }

  #games-catalog.games-catalog-root .games-category-multi .games-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  #games-catalog.games-catalog-root .games-category-single .games-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #games-catalog.games-catalog-root .games-category-title {
    font-size: 0.82rem;
    margin: 0 0 8px 0;
  }

  #games-catalog.games-catalog-root .game-card {
    padding: 13px 15px;
    border-radius: var(--radius-md);
  }

  #games-catalog.games-catalog-root .game-card .card-top {
    gap: 11px;
    margin-bottom: 8px;
    align-items: center;
  }

  #games-catalog.games-catalog-root .game-card .game-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.35rem;
    border-radius: var(--radius-sm);
  }

  #games-catalog.games-catalog-root .game-card .game-info {
    min-width: 0;
    flex: 1;
  }

  #games-catalog.games-catalog-root .game-card .game-info h3 {
    font-size: 1.02rem;
    margin-bottom: 1px;
    line-height: 1.2;
  }

  #games-catalog.games-catalog-root .game-card .game-info .tagline {
    font-size: 0.78rem;
    display: block;
    line-height: 1.25;
  }

  #games-catalog.games-catalog-root .game-card .badge-flow {
    font-size: 0.64rem;
    padding: 1px 6px;
    margin-bottom: 2px;
  }

  /* Collapsed by default on desktop unless expanded via Info / Expand Details */
  #games-catalog.games-catalog-root .game-card:not(.card-expanded) .game-card-details {
    display: none;
  }

  #games-catalog.games-catalog-root .game-card.card-expanded .game-desc {
    font-size: 0.84rem;
    margin-bottom: 10px;
    line-height: 1.45;
  }

  #games-catalog.games-catalog-root .game-card.card-expanded .game-meta-tags {
    margin-bottom: 10px;
    gap: 4px;
  }

  #games-catalog.games-catalog-root .game-card .game-card-actions {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
  }

  #games-catalog.games-catalog-root .game-card .btn-game-card-action {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  #games-catalog.games-catalog-root .game-card .game-card-subactions {
    width: auto;
    flex-shrink: 0;
    gap: 5px;
  }

  #games-catalog.games-catalog-root .game-card .game-card-subactions button {
    flex: 0 0 auto;
    width: auto;
    margin-top: 0;
    padding: 8px 9px;
    font-size: 0.76rem;
    white-space: nowrap;
  }
}

.badge-flow.flow-chess {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.badge-game-chess {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

/* ==========================================================================
   CHESS TRAINER (chess.html, js/chessTrainer.js)
   ========================================================================== */
.chess-start {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.chess-howto {
  background: var(--bg-elevated);
  padding: 18px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  text-align: left;
  border: 1px solid var(--border-subtle);
}

.chess-howto h4 {
  color: var(--accent-cyan);
  margin: 0 0 8px 0;
  font-size: 1rem;
}

.chess-howto ul {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-left: 20px;
  line-height: 1.7;
  margin: 0 0 10px 0;
}

.chess-howto-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.chess-hud {
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}

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

@media (min-width: 860px) {
  .chess-layout {
    grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  }
}

.chess-board-wrap {
  width: 100%;
  max-width: min(560px, calc(100svh - 150px));
  margin: 0 auto;
}

.chess-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  user-select: none;
  -webkit-user-select: none;
}

.cb-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.cb-square {
  position: relative;
}

.cb-light { background: #ebecd0; }
.cb-dark { background: #739552; }

.cb-square.cb-highlight.cb-light { background: #f5f682; }
.cb-square.cb-highlight.cb-dark { background: #b9ca43; }

.cb-piece {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cb-coord {
  position: absolute;
  font-size: clamp(8px, 1.6vw, 11px);
  font-weight: 700;
  line-height: 1;
  z-index: 1;
}

.cb-rank { top: 3px; left: 3px; }
.cb-file { bottom: 2px; right: 3px; }
.cb-light .cb-coord { color: #739552; }
.cb-dark .cb-coord { color: #ebecd0; }

.cb-arrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.cb-arrow line {
  stroke-width: 0.17;
  stroke-linecap: round;
  opacity: 0.85;
}

.cb-arrow-preview line { stroke: #2563eb; }
.cb-arrow-preview path { fill: #2563eb; }
.cb-arrow-perfect line { stroke: #059669; }
.cb-arrow-perfect path { fill: #059669; }
.cb-arrow-good line { stroke: #d97706; }
.cb-arrow-good path { fill: #d97706; }
.cb-arrow-blunder line { stroke: #dc2626; }
.cb-arrow-blunder path { fill: #dc2626; }

.chess-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chess-turn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.chess-to-move {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
}

.chess-side-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #94a3b8;
}

.chess-side-dot.side-w { background: #ffffff; }
.chess-side-dot.side-b { background: #111827; }

.chess-context {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chess-question {
  margin: 0;
  font-weight: 600;
  color: var(--text-muted);
}

.chess-candidates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chess-candidate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 58px;
  padding: 8px 6px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chess-candidate:hover {
  border-color: var(--accent-cyan);
}

.chess-candidate.selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.18);
}

.chess-candidate-san {
  font-size: 1.2rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chess-candidate.rated-perfect { border-color: rgba(16, 185, 129, 0.6); }
.chess-candidate.rated-good { border-color: rgba(245, 158, 11, 0.6); }
.chess-candidate.rated-blunder { border-color: rgba(239, 68, 68, 0.6); }
.chess-candidate.rated.selected { background: rgba(255, 255, 255, 0.06); }
.chess-candidate.viewing { box-shadow: 0 0 0 2px var(--accent-cyan); }

.chess-your-move {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.chess-rating-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.tag-perfect { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.tag-good { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.tag-blunder { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.chess-eval {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chess-actions .btn-primary {
  width: 100%;
  padding: 12px 18px;
  font-size: 1rem;
}

.chess-actions .btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chess-feedback {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 0.88rem;
  line-height: 1.45;
  animation: fadeIn 0.25s ease-out;
}

.chess-feedback.feedback-perfect { border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.08); }
.chess-feedback.feedback-good { border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.08); }
.chess-feedback.feedback-blunder { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.08); }

.chess-feedback-title {
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.chess-points {
  float: right;
  font-weight: 800;
  color: var(--accent-amber);
}

.chess-feedback-row {
  margin: 3px 0;
}

.chess-feedback-label {
  display: inline-block;
  min-width: 112px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.chess-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-main);
}

.chess-feedback-evals {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chess-feedback-hint {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.chess-quit-row {
  display: flex;
  justify-content: center;
}

.chess-quit-row .btn-secondary {
  font-size: 0.8rem;
  padding: 6px 14px;
}

@media (max-width: 680px) {
  .chess-arena {
    padding: 8px !important;
  }

  .chess-hud {
    margin-bottom: 6px;
  }

  .chess-layout {
    gap: 8px;
  }

  .chess-board-wrap {
    max-width: min(100%, calc(100svh - 300px));
  }

  .chess-candidate {
    min-height: 50px;
  }

  .chess-candidate-san {
    font-size: 1.05rem;
  }

  .chess-feedback-label {
    min-width: 0;
    display: block;
  }

  .chess-question {
    display: none;
  }
}
/* ==========================================================================
   FAQ PAGE (faq.html, js/faq.js)
   ========================================================================== */
.faq-page {
  max-width: 860px;
  padding-bottom: 32px;
}

.faq-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.faq-toc-link {
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
}

.faq-toc-link:hover {
  border-color: var(--accent-cyan);
}

.faq-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  scroll-margin-top: 16px;
}

.faq-section h2 {
  font-size: 1.2rem;
  margin: 0 0 10px 0;
}

.faq-divider {
  font-size: 1.05rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 28px 0 12px 0;
}

.faq-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.faq-game-head h2 {
  margin: 0;
}

.faq-play {
  font-size: 0.82rem;
  padding: 6px 14px;
  text-decoration: none;
}

.faq-game-tagline {
  margin: 4px 0 8px 0;
  color: var(--accent-cyan);
  font-size: 0.88rem;
}

.faq-item {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-main);
  list-style-position: inside;
}

.faq-item summary:hover {
  color: var(--accent-cyan);
}

.faq-item p {
  margin: 8px 0 2px 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.faq-badges {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.faq-badges strong {
  color: var(--text-main);
}

.faq-badge-icon {
  display: inline-block;
  width: 1.6em;
}

.footer-links a {
  margin-right: 14px;
}
a.nav-tab-btn {
  text-decoration: none;
}

/* ==========================================================================
   DAILY SPRINT (daily modal, js/dailyChallenge.js)
   ========================================================================== */
.daily-hud {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.daily-id {
  text-align: center;
  margin-bottom: 14px;
}

.daily-question {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.daily-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.btn-daily-choice:disabled {
  cursor: default;
  transform: none;
}

.btn-daily-choice.daily-choice-correct {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--accent-emerald);
  color: #6ee7b7;
}

.btn-daily-choice.daily-choice-wrong {
  background: var(--accent-rose);
  border-color: var(--accent-rose);
  color: #ffffff;
}

.daily-clue {
  margin-top: 14px;
}

.daily-attribution {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 680px) {
  /* Full-screen sprint, laid out like the PhyloClade play screen */
  #daily-modal {
    padding: 0;
  }

  #daily-modal .modal-card {
    max-width: 100% !important;
    min-height: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    padding: 8px 10px 16px;
  }

  #daily-modal .modal-header {
    margin-bottom: 4px;
    padding: 2px 0;
  }

  #daily-modal .modal-header h3 {
    font-size: 0.95rem !important;
  }

  .daily-body {
    display: flex;
    flex-direction: column;
  }

  .daily-body .daily-hud { order: 1; }
  .daily-body .prev-strip { order: 2; }
  .daily-body .daily-art-box { order: 3; }
  .daily-body .daily-id { order: 4; }
  .daily-body .daily-question { order: 5; }
  .daily-body .daily-options-grid { order: 6; }
  .daily-body .clues-marker { order: 7; }
  .daily-body .daily-clue { order: 8; }
  .daily-body #daily-feedback-box { order: 9; }
  .daily-body .daily-attribution { order: 10; }

  .daily-hud {
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 6px;
    white-space: nowrap;
  }

  .daily-art-box {
    height: clamp(170px, calc(100svh - 400px), 440px);
    margin-bottom: 6px;
  }

  .daily-art-box .organism-attribution-badge {
    display: none !important;
  }

  .daily-id {
    margin-bottom: 6px;
  }

  #daily-org-name {
    font-size: 1rem !important;
    margin: 0 !important;
  }

  #daily-org-sci {
    font-size: 0.78rem !important;
    margin: 0 0 2px 0 !important;
  }

  #daily-clade-info {
    font-size: 0.7rem !important;
  }

  .daily-question {
    display: none;
  }

  .daily-options-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .btn-daily-choice {
    min-height: 40px;
    padding: 4px 3px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.15;
    border-radius: var(--radius-sm);
  }

  .btn-daily-choice:hover {
    transform: none;
  }

  .daily-clue {
    margin: 0 0 10px 0;
    font-size: 0.86rem;
    padding: 8px 10px;
  }

  .daily-feedback {
    margin-top: 0;
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}
@media (max-width: 680px) {
  .daily-art-box .organism-art-wrapper,
  .daily-art-box .organism-specimen-img {
    height: 100% !important;
    max-height: 100% !important;
  }
}

/* Phones: the portal menu shows every tab as a labelled 3 x 2 grid instead of a sideways scroll */
@media (max-width: 680px) {
  .portal-nav-bar {
    position: static;
    padding: 8px;
    margin-bottom: 16px;
  }

  .portal-nav-bar::before {
    content: "☰ MENU";
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: var(--text-dim);
    margin: 0 0 6px 4px;
  }

  .portal-nav-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    overflow: visible;
    padding: 0;
  }

  .nav-tab-btn {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    min-height: 52px;
    font-size: 0.78rem;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  .nav-tab-btn:hover {
    transform: none;
  }

  .nav-tab-badge {
    font-size: 0.62rem;
    padding: 1px 6px;
  }

  #tab-btn-cladograms .nav-tab-badge {
    display: none;
  }

  /* Header: keep the profile chip and sound button on screen */
  .header-user-chip .user-code-val {
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .site-header .brand-logo span {
    display: none;
  }
}
/* PhyloClade setup: floating "next step" arrow (js/game.js showNextArrow) */
.setup-next-arrow {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 150;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 18px 6px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--accent-cyan);
  background: rgba(14, 165, 233, 0.92);
  color: #0b0f17;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: setupArrowBob 1.4s ease-in-out infinite;
}

.setup-next-arrow.hidden {
  display: none;
}

.setup-next-icon {
  font-size: 1.3rem;
  line-height: 1;
}

@keyframes setupArrowBob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 4px); }
}

@media (prefers-reduced-motion: reduce) {
  .setup-next-arrow {
    animation: none;
  }
}
.profile-streak {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: -4px 0 10px 0;
}

.profile-streak strong {
  color: var(--accent-amber);
}

@media (max-width: 480px) {
  /* The brand icon already links home; keep the profile chip and sound button on screen */
  .header-home-link {
    display: none;
  }
}

#setup-step-group {
  scroll-margin-top: 70px; /* clear the sticky header */
}

/* ========================================================
   PhyloClade: Display Phylogeny button (below the clue)
   ======================================================== */
.btn-phylogeny {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  margin: 8px 0 4px 0;
  padding: 7px 14px;
  font-size: 0.85rem;
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.btn-phylogeny:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--accent-emerald);
}

.btn-phylogeny.hidden {
  display: none;
}

@media (max-width: 680px) {
  .btn-phylogeny {
    width: 100%;
    margin: 0 0 10px 0;
  }
}

/* Cladogram drawing, key and details */
.cladogram-scroll {
  overflow-x: auto;
  background: #090d16;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.cladogram-key {
  margin: 8px 2px 0 2px;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.cladogram-details {
  margin-top: 12px;
}

.clado-detail-card .clado-note {
  color: #fcd34d;
  font-size: 0.84rem;
}

.cladogram-inner:hover {
  fill: #ffffff;
}

/* ========================================================
   Quick Play (hub card button + pop-up)
   ======================================================== */
.btn-quick-play {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  border-color: rgba(251, 191, 36, 0.5);
  color: #fcd34d;
  cursor: pointer;
}

.btn-quick-play:hover {
  background: rgba(251, 191, 36, 0.12);
  border-color: #fbbf24;
}

.quickplay-card {
  max-width: 480px;
}

.qp-label {
  margin: 4px 0 8px 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.qp-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.qp-times .qp-chip {
  flex: 1;
  justify-content: center;
}

.qp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.qp-chip:hover {
  border-color: rgba(56, 189, 248, 0.6);
}

.qp-chip.selected {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.16);
  color: #ffffff;
}

.qp-more-label {
  display: block;
  margin: -4px 0 6px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.qp-more {
  width: 100%;
  max-width: 100%;
  margin-bottom: 18px;
}

.qp-more.selected {
  border-color: var(--accent-cyan);
}

.qp-start {
  width: 100%;
  padding: 13px 18px;
  font-size: 1.05rem;
}

/* ========================================================
   CladeSpeed: prompt above the answer buttons
   ======================================================== */
.speed-question-prompt {
  margin: 0 0 10px 0;
  font-size: 0.95rem;
}

@media (max-width: 680px) {
  .speed-question-prompt {
    display: block;
    margin: 0 0 6px 0;
    font-size: 0.85rem;
  }
}

/* ========================================================
   Home page: Support and CRV Science Network
   ======================================================== */
.crv-links {
  display: grid;
  gap: 28px;
  margin: 8px auto 32px auto;
  padding-top: 28px;
  border-top: 1px solid var(--border-subtle);
}

.crv-links-title {
  margin: 0 0 6px 0;
  font-size: 1.2rem;
}

.crv-links-text {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.crv-links-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.crv-links-network {
  margin-top: 10px;
}

.crv-link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.crv-link-card:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-2px);
}

.crv-link-card strong {
  display: block;
  font-size: 0.98rem;
}

.crv-link-card small {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.crv-link-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.crv-link-current {
  border-color: rgba(16, 185, 129, 0.45);
}

body.game-active-mode .crv-links {
  display: none !important;
}

/* ========================================================
   Cookie banner (EU/UK/CH visitors only, js/analytics.js)
   ======================================================== */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.cookie-banner-text {
  margin: 0;
  flex: 1;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-main);
}

.cookie-banner-text a {
  color: var(--accent-cyan);
}

.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.cookie-banner-actions button {
  width: auto;
  padding: 8px 16px;
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    bottom: 10px;
    left: 10px;
    right: 10px;
  }

  .cookie-banner-actions button {
    flex: 1;
  }
}

/* Phylogeny pop-up: as much width as possible for the tree on phones */
@media (max-width: 680px) {
  #phylogeny-modal {
    padding: 8px;
  }

  #phylogeny-modal .modal-card {
    width: 100% !important;
    padding: 14px 12px;
  }

  #phylogeny-modal .modal-body {
    padding: 4px 0 !important;
  }
}

/* ========================================================
   Results screens (every game): summary at the top, then the actions
   ======================================================== */
body.results-mode .hero-section,
body.results-mode .portal-nav-bar,
body.results-mode #daily-launch-container,
body.results-mode .games-showcase,
body.results-mode #phyloclade-setup-banner,
body.results-mode .versus-top-nav-bar,
body.results-mode #view-versus .section-heading,
body.results-mode .la-start,
body.results-mode .ww-start,
body.results-mode .fold-start,
body.results-mode .chess-start,
body.results-mode .wrd-start,
body.results-mode .triv-start,
body.results-mode #speed-start-view,
body.results-mode #screen-setup,
body.results-mode .active-game-bar {
  display: none !important;
}

body.results-mode main.container {
  padding-top: 12px;
}

body.results-mode .game-play-container,
body.results-mode .versus-container {
  margin-top: 8px !important;
}

body.results-mode .summary-card {
  margin-top: 4px !important;
  margin-bottom: 16px !important;
}

.results-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.results-actions .btn-primary,
.results-actions .btn-secondary {
  width: auto;
  padding: 11px 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

@media (max-width: 480px) {
  .results-actions .btn-primary,
  .results-actions .btn-secondary {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
    padding: 10px 12px;
  }
}

/* Share pop-up */
.share-card {
  max-width: 460px;
}

.share-preview {
  margin: 0 0 14px 0;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: all;
}

.share-actions {
  display: flex;
  gap: 10px;
}

.share-actions button {
  flex: 1;
}

.share-actions .hidden {
  display: none;
}

.share-status {
  margin: 10px 0 0 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  color: #6ee7b7;
  text-align: center;
}

/* Game Card Subactions & Share Game Buttons */
.game-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.game-card-subactions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.game-card-subactions button {
  flex: 1;
  font-size: 0.85rem;
  padding: 8px 12px;
}

.btn-share-game {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-share-game:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.share-link-input-group {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.share-url-box {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #38bdf8;
  font-family: monospace;
  outline: none;
  user-select: all;
  min-width: 0;
}

.share-url-box:focus {
  border-color: var(--accent-cyan);
}

/* ========================================================
   FoldLab (foldlab.html)
   ======================================================== */
.badge-flow.flow-fold,
.badge-game-foldlab {
  background: rgba(192, 132, 252, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(192, 132, 252, 0.35);
}

.fold-arena {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.fold-howto {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.fold-howto h4 {
  margin: 0 0 8px 0;
  color: var(--accent-cyan);
}

.fold-howto ul {
  margin: 0;
  padding-left: 4px;
  list-style: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.fold-howto li {
  margin-bottom: 6px;
}

.fold-howto-note {
  margin: 10px 0 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.fl-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: -2px;
  border: 2px solid;
}

.fl-dot-oily { background: #fbbf24; border-color: #b45309; }
.fl-dot-water { background: #38bdf8; border-color: #0369a1; }

.fold-start-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.fold-start-buttons button {
  width: auto;
  padding: 14px 26px;
  font-size: 1.05rem;
}

.fold-daily-note {
  margin: 10px 0 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fold-hud {
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fold-goal {
  margin: 4px 0 8px 0;
  font-size: 0.95rem;
  color: var(--text-main);
}

.fold-board {
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: radial-gradient(circle at 50% 40%, #0c4a6e 0%, #082f49 60%, #062033 100%);
  overflow: hidden;
  touch-action: manipulation;
}

.fl-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.fl-touch {
  stroke: #fde047;
  stroke-width: 0.1;
  stroke-dasharray: 0.12 0.1;
  filter: drop-shadow(0 0 0.08px #fde047);
}

.fl-staple-link {
  stroke: #c084fc;
  stroke-width: 0.2;
  stroke-linecap: round;
}

.fl-tappable {
  cursor: pointer;
}

.fl-tappable:hover .fl-bead-core {
  stroke: #ffffff;
}

.fl-shake .fl-bead-core {
  animation: flShake 0.3s ease;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes flShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-12%); }
  75% { transform: translateX(12%); }
}

.fold-meter {
  margin: 8px 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.fold-meter strong {
  color: var(--text-main);
}

.fold-meter.fl-meter-best {
  color: #6ee7b7;
}

.fold-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}

.fold-actions button {
  width: auto;
  padding: 10px 16px;
}

.fold-actions .btn-primary {
  padding: 10px 24px;
}

.fold-feedback {
  text-align: left;
  margin: 6px 0 10px 0;
}

.fl-result {
  text-align: center;
  margin-bottom: 10px;
}

.fl-stars {
  font-size: 2rem;
  letter-spacing: 4px;
}

.fl-stars-off {
  color: var(--text-dim);
}

.fl-verdict {
  font-size: 0.95rem;
  color: var(--text-main);
}

.fl-fact {
  background: rgba(192, 132, 252, 0.1);
  border: 1px solid rgba(192, 132, 252, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.fl-fact-title {
  font-weight: 800;
  color: #e9d5ff;
  margin-bottom: 4px;
}

.fl-fact p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
}

.fl-fact .fl-fact-more {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.fl-next {
  width: 100%;
  padding: 12px;
}

.fold-quit-row {
  margin-top: 8px;
}

.fold-quit-row button {
  width: auto;
  font-size: 0.8rem;
  padding: 6px 14px;
}

@media (max-width: 680px) {
  .fold-goal { font-size: 0.86rem; margin: 2px 0 6px 0; }
  .fold-board { max-width: min(100%, calc(100svh - 300px)); }
  .fold-meter { font-size: 0.82rem; margin: 6px 0; }
  .fold-actions button { padding: 9px 12px; font-size: 0.85rem; }
}

/* ========================================================
   Look-Alikes (lookalikes.html): reuses the PhyloVersus card styles
   ======================================================== */
.badge-game-lookalikes {
  background: rgba(244, 114, 182, 0.15);
  color: #f9a8d4;
  border: 1px solid rgba(244, 114, 182, 0.35);
}

.la-arena {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.la-start {
  max-width: 640px;
  margin: 0 auto;
}

.la-question {
  margin: 4px 0 12px 0;
  font-size: 1.02rem;
  font-weight: 600;
}

button.la-card {
  font: inherit;
  color: inherit;
  width: 100%;
}

.la-reveal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin: 4px 0;
}

.la-twin-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(244, 114, 182, 0.18);
  color: #f9a8d4;
  border: 1px solid rgba(244, 114, 182, 0.4);
}

.la-feedback {
  text-align: left;
}

.la-verdict {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.la-pair,
.la-why {
  margin: 0 0 8px 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.la-why {
  color: var(--text-muted);
}

.la-next {
  width: 100%;
  margin-top: 4px;
  padding: 12px;
}

@media (max-width: 768px) {
  .la-reveal { justify-content: flex-start; }
  .la-question { font-size: 0.9rem; margin: 2px 0 8px 0; }
}

/* ========================================================
   Where in the World? (whereworld.html)
   ======================================================== */
.badge-game-whereworld {
  background: rgba(52, 211, 153, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.ww-arena {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.ww-start {
  max-width: 640px;
  margin: 0 auto;
}

.ww-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 2fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 12px;
}

.ww-art {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0b0f17;
}

.ww-art .organism-plate-container {
  max-width: 100% !important;
}

.ww-art .organism-specimen-img {
  object-fit: contain !important;
}

.ww-name {
  margin: 8px 0 0 0;
  font-size: 1.2rem;
}

.ww-sci {
  margin: 2px 0 4px 0;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.ww-credit {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ww-question {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.ww-kind {
  margin: 2px 0 8px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ww-map {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #0c2a44;
}

.ww-svg {
  display: block;
  width: 100%;
  height: auto;
}

.ww-shape {
  stroke: #0b1a2b;
  stroke-width: 0.4;
  cursor: pointer;
  transition: fill 0.15s ease;
}

.ww-sea { fill: #12395c; }
.ww-land { fill: #6b7f5a; }
.ww-map:not(.ww-locked) .ww-sea:hover { fill: #1d5585; }
.ww-map:not(.ww-locked) .ww-land:hover { fill: #8aa173; }
.ww-shape.ww-native { fill: #10b981 !important; }
.ww-shape.ww-wrong { fill: #ef4444 !important; }
.ww-locked .ww-shape { cursor: default; }

.ww-label {
  font-size: 6.5px;
  font-weight: 700;
  font-family: system-ui, sans-serif;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1.4px;
}

.ww-label-land { fill: #f8fafc; }
.ww-label-sea { fill: #93c5fd; font-style: italic; }

.ww-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}

.ww-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.ww-chip-sea { border-color: rgba(96, 165, 250, 0.4); }
.ww-chip:hover:not(:disabled) { border-color: var(--accent-cyan); }
.ww-chip:disabled { cursor: default; opacity: 0.55; }
.ww-chip.ww-native { opacity: 1; background: rgba(16, 185, 129, 0.25); border-color: #10b981; }
.ww-chip.ww-wrong { opacity: 1; background: rgba(239, 68, 68, 0.25); border-color: #ef4444; }

.ww-feedback {
  text-align: left;
}

.ww-verdict {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.ww-native-line,
.ww-note {
  margin: 0 0 8px 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.ww-note {
  color: var(--text-muted);
}

.ww-next {
  width: 100%;
  margin-top: 4px;
  padding: 12px;
}

@media (max-width: 768px) {
  .ww-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ww-species {
    display: grid;
    grid-template-columns: 42% 1fr;
    grid-template-areas: "art name" "art sci" "art credit";
    column-gap: 10px;
    text-align: left;
    align-items: center;
  }

  .ww-art { grid-area: art; }
  .ww-art .organism-art-wrapper,
  .ww-art .organism-specimen-img { height: 120px !important; }
  .ww-name { grid-area: name; margin: 0; font-size: 1.05rem; align-self: end; }
  .ww-sci { grid-area: sci; }
  .ww-credit { grid-area: credit; align-self: start; }
  .ww-question { font-size: 0.95rem; }
  .ww-kind { font-size: 0.78rem; margin-bottom: 6px; }
  .ww-chip { font-size: 0.74rem; padding: 5px 8px; }
}

/* Daily Challenge note on game pages (js/dailyRotation.js) */
.daily-page-notice {
  margin: 0 auto 12px auto;
  max-width: 640px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
}

/* ========================================================
   Footer link bar (About · Press · FAQ · Privacy · Contact)
   ======================================================== */
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 10px 0;
  font-size: 0.85rem;
}

.site-footer .footer-links a {
  margin: 0;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.site-footer .footer-links a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.site-footer .footer-links a + a::before {
  content: "·";
  display: inline-block;
  margin: 0 10px;
  color: var(--text-dim);
}

/* ========================================================
   About, Press, Privacy and Contact pages
   ======================================================== */
.doc-page {
  max-width: 800px;
  padding-top: 28px;
  padding-bottom: 40px;
}

.doc-card,
.doc-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 20px;
}

.doc-header {
  background: transparent;
  border: none;
  padding: 0 4px;
}

.doc-card-compact {
  padding: 20px 24px;
}

.doc-kicker {
  margin: 0 0 6px 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.doc-kicker a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.doc-page h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 12px 0;
}

.doc-page h2 {
  font-size: 1.2rem;
  margin: 26px 0 10px 0;
  color: var(--text-main);
}

.doc-page p,
.doc-page li {
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 0.97rem;
}

.doc-page p {
  margin: 0 0 12px 0;
}

.doc-page strong {
  color: var(--text-main);
}

.doc-page a {
  color: var(--accent-cyan);
}

.doc-lead {
  font-size: 1.08rem !important;
  color: var(--text-main) !important;
}

.doc-meta {
  font-size: 0.85rem !important;
}

.doc-list {
  padding-left: 20px;
  margin: 0 0 12px 0;
}

.doc-list li {
  margin-bottom: 8px;
}

.doc-links {
  list-style: none;
  padding-left: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 16px;
}

.doc-summary {
  padding: 14px 16px;
  margin: 8px 0 4px 0;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--text-main);
  line-height: 1.6;
}

/* Press list and press release */
.press-list {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.press-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.press-item:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-2px);
}

.press-date {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.press-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
}

.press-summary {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.press-more {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.press-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  letter-spacing: 0.06em;
}

.press-release h1 {
  font-size: 1.75rem;
}

.press-dateline {
  color: var(--text-main);
}

.press-quote {
  margin: 20px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--accent-cyan);
  background: rgba(56, 189, 248, 0.07);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-main);
  line-height: 1.65;
}

.press-boilerplate {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.press-boilerplate h2,
.press-contact h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.press-contact {
  margin-top: 20px;
}

.press-end {
  text-align: center;
  letter-spacing: 0.3em;
  font-weight: 700;
  margin-top: 24px !important;
}

/* Contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0 18px 0;
}

.contact-form label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 8px;
}

.contact-form input[type="text"],
.contact-form textarea,
.contact-form select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
}

.contact-form textarea {
  resize: vertical;
}

.contact-subject-row {
  display: flex;
  align-items: stretch;
}

.contact-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.contact-subject-row input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

.contact-form .contact-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-muted);
}

.contact-send {
  width: auto;
  align-self: flex-start;
  margin-top: 12px;
  padding: 12px 24px;
}

.contact-status {
  min-height: 1.2em;
  color: #6ee7b7 !important;
}

@media (max-width: 600px) {
  .doc-card { padding: 20px 18px; }
  .doc-page h1 { font-size: 1.6rem; }
  .press-release h1 { font-size: 1.4rem; }
  .contact-send { width: 100%; }
}

.doc-card > h2:first-child {
  margin-top: 0;
}


/* Contact form: optional email, error status, and the off-screen spam trap */
.contact-form input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
}

.contact-optional {
  font-weight: 500;
  color: var(--text-dim);
}

.contact-status.contact-status-error {
  color: #fca5a5 !important;
}

.contact-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* World map (js/worldMap.js): each continent its own muted shade so region borders read clearly */
.ww-globe { fill: #12395c; }
.ww-svg .ww-shape { stroke-width: 0.35; }
.ww-svg .ww-sea { fill: #12395c; stroke: none; }
.ww-svg .ww-land { stroke: rgba(15, 23, 42, 0.35); }
.ww-region-NA { fill: #7f9a5c; }
.ww-region-SA { fill: #5f9a72; }
.ww-region-EU { fill: #8c8fb0; }
.ww-region-AF { fill: #b39a5f; }
.ww-region-AS { fill: #a07f63; }
.ww-region-OC { fill: #b5845a; }
.ww-region-AN { fill: #cfd8e3; }
.ww-map:not(.ww-locked) .ww-sea:hover { fill: #1d5585; }
.ww-map:not(.ww-locked) .ww-land:hover { filter: brightness(1.18); }
.ww-svg .ww-label { font-size: 9px; stroke-width: 2px; }
.ww-svg .ww-label-land { fill: #ffffff; }

.ww-svg .ww-label-land { font-size: 13px; }
.ww-svg .ww-label-sea { font-size: 11px; }


/* ========================================================
   FoldLab board v2 (FoldLabBoard in js/foldLab.js)
   ======================================================== */
.fl-grid-major { stroke: rgba(186, 230, 253, 0.16); stroke-width: 0.025; }
.fl-grid-minor { stroke: rgba(186, 230, 253, 0.06); stroke-width: 0.02; }

.fl-backbone-shadow {
  fill: none;
  stroke: rgba(2, 6, 23, 0.55);
  stroke-width: 0.26;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fl-backbone {
  fill: none;
  stroke: #cbd5e1;
  stroke-width: 0.14;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fl-svg .fl-touch {
  stroke: #fde047;
  stroke-width: 0.12;
  stroke-dasharray: 0.12 0.08;
  stroke-linecap: round;
  animation: flTouchFlow 0.9s linear infinite;
  filter: drop-shadow(0 0 0.06px #fde047);
}

@keyframes flTouchFlow {
  to { stroke-dashoffset: -0.4; }
}

.fl-svg .fl-staple-link {
  stroke: #c084fc;
  stroke-width: 0.22;
  stroke-linecap: round;
}

.fl-pull {
  stroke-width: 0.07;
  stroke-linecap: round;
}

.fl-pull-oily { stroke: #fde047; }
.fl-pull-staple { stroke: #d8b4fe; }

.fl-core-oily { stroke: #92400e; stroke-width: 0.04; }
.fl-core-water { stroke: #075985; stroke-width: 0.04; }
.fl-core-staple { stroke: #6b21a8; stroke-width: 0.04; }

.fl-bead-label {
  font-size: 0.3px;
  font-weight: 800;
  fill: #3b0764;
  text-anchor: middle;
  pointer-events: none;
}

.fl-anchor { fill: #0f172a; pointer-events: none; }
.fl-sad { font-size: 0.3px; pointer-events: none; }

.fl-tappable:hover .fl-bead-core,
.fl-hovered .fl-bead-core {
  stroke: #ffffff;
  stroke-width: 0.06;
}

.fl-ghost-chain {
  fill: none;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 0.08;
  stroke-dasharray: 0.12 0.1;
  pointer-events: none;
}

.fl-ghost-bead {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 0.04;
  stroke-dasharray: 0.08 0.06;
  pointer-events: none;
}

.fl-hint-ring {
  fill: none;
  stroke: #34d399;
  stroke-width: 0.07;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: flHintPulse 1.1s ease-in-out infinite;
}

@keyframes flHintPulse {
  0%, 100% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.45; }
}

.fold-coach {
  min-height: 1.4em;
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.fold-coach-good { color: #6ee7b7; }
.fold-coach-warn { color: #fca5a5; }
.fold-coach-hint { color: #34d399; }

.fold-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin: 8px 0 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.fold-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.fold-legend .fl-dot { width: 11px; height: 11px; }
.fl-legend-arrow { color: #fde047; font-weight: 800; }
.fl-legend-link { display: inline-block; width: 18px; border-top: 3px dashed #fde047; }
.fl-legend-anchor { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle, #0f172a 30%, #94a3b8 35%); }

.fold-hint-btn {
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

.fold-hint-btn small {
  font-weight: 600;
  opacity: 0.8;
}

.fold-actions {
  flex-wrap: wrap;
}

/* Start-screen demo */
.fold-demo-wrap {
  max-width: 300px;
  margin: 0 auto 16px auto;
}

.fold-demo {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: radial-gradient(circle at 50% 40%, #0c4a6e 0%, #082f49 60%, #062033 100%);
  overflow: hidden;
}

.fold-demo-caption {
  min-height: 2.6em;
  margin: 8px 0 0 0;
  font-size: 0.86rem;
  color: var(--text-main);
}

@media (max-width: 680px) {
  .fold-coach { font-size: 0.82rem; margin-bottom: 6px; }
  .fold-legend { font-size: 0.7rem; gap: 3px 10px; }
  .fold-demo-wrap { max-width: 220px; }
  .fold-board { max-width: min(100%, calc(100svh - 360px)); }
}

.fl-svg .fl-pull { stroke-width: 0.11; }
.fl-pull-halo { stroke: #0f172a; stroke-width: 0.19; stroke-linecap: round; }


/* Swing-direction arrows (FoldLabBoard.swingArrows) */
.fl-swing-small {
  fill: none;
  stroke: rgba(226, 232, 240, 0.55);
  stroke-width: 0.045;
  stroke-linecap: round;
  pointer-events: none;
}

.fl-swing-small.fl-swing-focus {
  stroke: #67e8f9;
  stroke-width: 0.06;
}

.fl-swing-path-halo {
  fill: none;
  stroke: #0f172a;
  stroke-width: 0.17;
  stroke-linecap: round;
  pointer-events: none;
}

.fl-swing-path {
  fill: none;
  stroke: #67e8f9;
  stroke-width: 0.09;
  stroke-linecap: round;
  stroke-dasharray: 0.18 0.1;
  pointer-events: none;
  animation: flTouchFlow 0.9s linear infinite;
}

.fl-swing-target {
  fill: rgba(103, 232, 249, 0.15);
  stroke: #67e8f9;
  stroke-width: 0.04;
  stroke-dasharray: 0.08 0.06;
  pointer-events: none;
}

.fl-legend-swing {
  color: #67e8f9;
  font-weight: 800;
}

/* ==========================================================================
   FIVE LETTER WORD GAME (Word Games)
   ========================================================================== */
.wrd-arena {
  max-width: 680px;
  margin: 20px auto 40px;
}

.wrd-start,
.wrd-play,
.wrd-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wrd-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.wrd-mode-btn {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.wrd-mode-btn.active,
.wrd-mode-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.wrd-custom-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wrd-custom-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.wrd-input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 14px;
  font-size: 1.05rem;
  font-family: inherit;
  letter-spacing: 2px;
  text-transform: uppercase;
  width: 160px;
}

.wrd-input:focus {
  outline: none;
  border-color: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.25);
}

.wrd-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.wrd-tiles-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 16px;
}

.wrd-tile {
  width: 54px;
  height: 58px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease;
  user-select: none;
}

.wrd-tile.active {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
  animation: tilePulse 1s ease infinite alternate;
}

@keyframes tilePulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.wrd-tile.filled {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.wrd-history-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 12px;
}

.wrd-history-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.wrd-history-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.wrd-guess-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.wrd-guess-row:last-child {
  border-bottom: none;
}

.wrd-guess-row.win-row {
  background: rgba(16, 185, 129, 0.15);
}

.wrd-guess-word {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wrd-guess-char {
  width: 32px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wrd-guess-char.flagged,
.wrd-guess-char.excluded {
  background: rgba(239, 68, 68, 0.28) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
  text-decoration: line-through !important;
  font-weight: 800 !important;
}

.wrd-guess-char.approved,
.wrd-guess-char.confirmed {
  background: rgba(16, 185, 129, 0.3) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.wrd-overlap-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wrd-overlap-0 { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); border: 1px solid rgba(255, 255, 255, 0.1); }
.wrd-overlap-1 { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.wrd-overlap-2 { background: rgba(245, 158, 11, 0.22); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); }
.wrd-overlap-3 { background: rgba(56, 189, 248, 0.18); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.wrd-overlap-4 { background: rgba(168, 85, 247, 0.22); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.45); }
.wrd-overlap-5 { background: rgba(16, 185, 129, 0.25); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.6); box-shadow: 0 0 12px rgba(52, 211, 153, 0.3); }

/* Letter Management Toolbar */
.wrd-manage-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.wrd-select-letter {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 1rem;
  font-weight: 700;
  height: 38px;
}

.btn-wrd-tool-x {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 6px 14px;
  font-weight: 800;
  border-radius: var(--radius-sm);
  cursor: pointer;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-wrd-tool-plus {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #6ee7b7;
  padding: 6px 14px;
  font-weight: 800;
  border-radius: var(--radius-sm);
  cursor: pointer;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-wrd-tool-clear {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  height: 38px;
}

/* Virtual Keyboard */
.wrd-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 8px;
  user-select: none;
}

.wrd-kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.wrd-key {
  height: 44px;
  min-width: 30px;
  flex: 1;
  max-width: 44px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}

.wrd-key:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.wrd-key:active {
  transform: translateY(1px);
}

.wrd-key-wide {
  max-width: 68px;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
}

.wrd-key.key-excluded {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #f87171 !important;
  border-color: #ef4444 !important;
  text-decoration: line-through;
  opacity: 0.75;
}

.wrd-key.key-confirmed {
  background: rgba(16, 185, 129, 0.28) !important;
  color: #34d399 !important;
  border-color: #10b981 !important;
  font-weight: 800;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.35);
}

.wrd-exclude-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 4px;
}

.wrd-flag-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.wrd-flag-chip {
  padding: 2px 7px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  border-radius: 4px;
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.wrd-approved-chip {
  padding: 2px 7px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  border-radius: 4px;
  color: #6ee7b7;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   ROGUELIKE SPACE TRIVIA (Trivia)
   ========================================================================== */
.triv-cockpit {
  max-width: 860px;
  margin: 20px auto 40px;
}

.triv-start,
.triv-play,
.triv-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.triv-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  background: rgba(11, 19, 38, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.triv-gauge {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.triv-gauge-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.triv-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.triv-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.triv-bar-health {
  background: linear-gradient(90deg, #ef4444, #10b981);
}

.triv-bar-fuel {
  background: linear-gradient(90deg, #f59e0b, #38bdf8);
}

.triv-system-header {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.triv-system-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.triv-star-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 0 16px currentColor;
  flex-shrink: 0;
}

.triv-system-info h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  color: #fff;
}

.triv-system-type {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.triv-topics-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.triv-topic-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

/* Celestial Objects Grid */
.triv-objects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 10px 0;
}

.triv-obj-card {
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.triv-obj-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.triv-obj-card.scanned-correct {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.06);
}

.triv-obj-card.scanned-wrong {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
  opacity: 0.8;
}

.triv-obj-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.triv-obj-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.triv-obj-title-wrap h4 {
  margin: 0;
  font-size: 1rem;
  color: #fff;
}

.triv-obj-type {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.triv-obj-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.triv-diff-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.triv-diff-easy { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }
.triv-diff-medium { background: rgba(249, 115, 22, 0.18); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.35); }
.triv-diff-hard { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

.triv-badge-pill {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.btn-scan {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-scan:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

.btn-scan:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hyperdrive Navigation Row */
.triv-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 8px;
  flex-wrap: wrap;
}

.triv-jump-btns {
  display: flex;
  gap: 10px;
}

.btn-jump {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.95rem;
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #c084fc;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-jump:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.35);
  border-color: rgba(168, 85, 247, 0.7);
  transform: translateY(-1px);
}

.jump-cost-metric {
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.3px;
  margin-left: 4px;
  background: rgba(0, 0, 0, 0.28);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: inline-flex;
  align-items: center;
}

.btn-jump:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-escape-pod {
  background: rgba(239, 68, 68, 0.25) !important;
  border: 2px solid #ef4444 !important;
  color: #fca5a5 !important;
  animation: podPulse 1.2s ease infinite alternate;
}

@keyframes podPulse {
  0% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.3); }
  100% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.8); }
}

/* Scanner Terminal Modal / Overlay */
.triv-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.triv-scanner-card {
  background: #0d1527;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  margin: auto;
}

.triv-modal-close-x {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.triv-modal-close-x:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}

.triv-scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  padding-right: 36px;
}

.triv-question-text {
  font-size: 1.15rem;
  line-height: 1.5;
  color: #fff;
  font-weight: 600;
}

.triv-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.triv-option-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s ease;
}

.triv-option-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(4px);
}

.triv-option-btn.opt-correct {
  background: rgba(16, 185, 129, 0.28) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
  font-weight: 700;
}

.triv-option-btn.opt-wrong {
  background: rgba(239, 68, 68, 0.28) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

.triv-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.triv-telemetry-result {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.45;
  margin-top: 4px;
}

.triv-telemetry-correct {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.triv-telemetry-wrong {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.triv-btn-continue {
  width: 100%;
  padding: 13px 20px;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
  transition: all 0.15s ease;
}

.triv-btn-continue:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.triv-system-ready-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(56, 189, 248, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.5);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  animation: readyPulse 1.4s ease-in-out infinite alternate;
}

@keyframes readyPulse {
  0% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.2); }
  100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.5); }
}

.triv-obj-card.triv-obj-focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.7) !important;
  transform: translateY(-3px) scale(1.02);
  transition: all 0.25s ease;
}

/* Mobile Responsiveness & Touch Optimizations */
@media (max-width: 600px) {
  .wrd-arena,
  .triv-cockpit {
    padding: 0 4px;
    margin-top: 10px;
    margin-bottom: 24px;
  }
  .wrd-tile {
    width: 46px;
    height: 52px;
    font-size: 1.55rem;
  }
  .wrd-tiles-container {
    gap: 6px;
  }
  .wrd-manage-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }
  .wrd-manage-toolbar label {
    grid-column: span 2;
    margin-bottom: -2px;
  }
  .wrd-select-letter {
    grid-column: span 2;
    width: 100%;
    font-size: 16px; /* Prevents iOS auto-zoom */
  }
  .btn-wrd-tool-x,
  .btn-wrd-tool-plus {
    width: 100%;
    justify-content: center;
    font-size: 0.88rem;
    padding: 8px 6px;
  }
  .btn-wrd-tool-clear {
    grid-column: span 2;
    width: 100%;
    justify-content: center;
  }
  .wrd-keyboard {
    gap: 5px;
    margin: 8px 0;
  }
  .wrd-kb-row {
    gap: 4px;
  }
  .wrd-key {
    height: 44px;
    min-width: 24px;
    font-size: 0.95rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .wrd-key-wide {
    max-width: 50px;
    font-size: 0.75rem;
  }
  .wrd-history-card {
    max-height: 280px;
  }
  .wrd-history-list {
    max-height: 220px;
  }
  .wrd-guess-row {
    padding: 8px 10px;
  }
  .wrd-guess-char {
    width: 28px;
    height: 32px;
    font-size: 0.95rem;
    touch-action: manipulation;
  }
  .wrd-overlap-pill {
    padding: 4px 8px;
    font-size: 0.78rem;
  }
  .triv-hud {
    grid-template-columns: 1fr 1fr;
    padding: 10px 12px;
    gap: 8px;
  }
  .triv-system-header {
    padding: 12px 14px;
  }
  .triv-objects-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .triv-system-ready-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 14px 12px;
  }
  .triv-system-ready-banner button {
    width: 100%;
    justify-content: center;
  }
  .triv-jump-btns {
    width: 100%;
    flex-direction: column;
  }
  .btn-jump {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .triv-modal-backdrop {
    padding: 8px;
    align-items: flex-start;
    padding-top: 20px;
  }
  .triv-scanner-card {
    padding: 16px 14px;
    max-height: 90vh;
  }
  .triv-modal-close-x {
    width: 38px;
    height: 38px;
    top: 10px;
    right: 10px;
  }
  .triv-option-btn {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 0.92rem;
  }
}



