/* ==========================================================================
   Color Guess Challenge - Modern Refined Stylesheet
   Default: Elegant Soft Charcoal / Muted Slate Dark Theme
   Light Theme: Crisp Off-White Warm Neutral Theme
   ========================================================================== */

:root {
  /* DARK CHARCOAL THEME (DEFAULT) */
  --bg-primary: #121826;
  --bg-surface: #1B2434;
  --bg-surface-elevated: #243044;
  --bg-surface-subtle: #161F2E;
  
  --border-color: #2E3D52;
  --border-color-hover: #405470;
  --border-strong: #F1F5F9;
  
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --accent-brand: #6366F1;
  --accent-brand-hover: #818CF8;
  --accent-green: #10B981;
  --accent-green-hover: #34D399;
  --accent-blue: #3B82F6;
  --accent-blue-hover: #60A5FA;
  --accent-coral: #F43F5E;
  --accent-coral-hover: #FB7185;
  --accent-amber: #F59E0B;
  --accent-purple: #8B5CF6;

  --badge-bg: #243044;
  --badge-text: #38BDF8;
  --input-bg: #161F2E;
  --thumb-box-bg: #FFFFFF;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
  --shadow-card: 0 4px 8px -1px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.55);
  --shadow-btn: 0 2px 5px rgba(0, 0, 0, 0.3);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  /* CRISP LIGHT THEME (ALTERNATIVE) */
  --bg-primary: #F8F9FA;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F1F5F9;
  --bg-surface-subtle: #F8FAFC;
  
  --border-color: #E2E8F0;
  --border-color-hover: #CBD5E1;
  --border-strong: #0F172A;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  --accent-brand: #6366F1;
  --accent-brand-hover: #4F46E5;
  --accent-green: #10B981;
  --accent-green-hover: #059669;
  --accent-blue: #3B82F6;
  --accent-blue-hover: #2563EB;
  --accent-coral: #F43F5E;
  --accent-coral-hover: #E11D48;
  --accent-amber: #F59E0B;
  --accent-purple: #8B5CF6;

  --badge-bg: #0F172A;
  --badge-text: #38BDF8;
  --input-bg: #FFFFFF;
  --thumb-box-bg: #FFFFFF;

  --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-btn: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Layout Containers */
.app-container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ==========================================================================
   COMPACT INTEGRATED HEADER
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  margin-bottom: 10px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-subtle);
  gap: 8px;
  min-height: 48px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  padding: 2px;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.brand-titles {
  display: flex;
  align-items: center;
  gap: 5px;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.brand-badge {
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.4px;
  border: 1px solid var(--border-color);
}

/* Category Segmented Control */
.category-nav-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-full);
}

.cat-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cat-nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.cat-nav-btn.active {
  background: var(--accent-brand);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.4);
}

.cat-nav-icon {
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
  transform: translateY(-1px);
}

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

/* ==========================================================================
   RESPONSIVE HEADER FOR MOBILE (< 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .app-container {
    padding: 6px 8px;
  }

  .app-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: 6px 10px;
    gap: 6px;
    margin-bottom: 8px;
    border-radius: var(--radius-lg);
  }

  .brand-logo {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
  }

  .header-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    justify-self: end;
  }

  .category-nav-bar {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 2px;
    padding: 2px;
    border-radius: var(--radius-md);
  }

  .cat-nav-btn {
    flex: 1;
    padding: 5px 4px;
    font-size: 0.74rem;
    justify-content: center;
    min-height: 32px;
    gap: 3px;
    border-radius: var(--radius-sm);
  }

  .cat-nav-icon {
    font-size: 0.8rem;
  }

  .cat-nav-text {
    font-size: 0.73rem;
  }
}

/* Views Management */
.view-section {
  display: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.view-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   VIEW 1: GAMEPLAY SECTION
   ========================================================================== */
.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-subtle);
  gap: 6px;
  flex-wrap: wrap;
}

.game-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-cat-badge {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.4px;
  border: 1px solid var(--border-color);
}

.game-round-counter {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Single Compact Difficulty Selector Dropdown */
.diff-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.diff-dropdown-btn {
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.diff-dropdown-btn:hover {
  background: var(--border-color);
  border-color: var(--border-color-hover);
}

.diff-dropdown-arrow {
  font-size: 0.62rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
  line-height: 1;
}

.diff-dropdown-wrapper.open .diff-dropdown-arrow {
  transform: rotate(180deg);
}

.diff-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 3px;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 105px;
  z-index: 150;
}

.diff-dropdown-wrapper.open .diff-dropdown-menu {
  display: flex;
  animation: dropdownFade 0.15s ease;
}

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

.diff-option-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  transition: all 0.1s ease;
}

.diff-option-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.diff-option-btn.active {
  background: var(--accent-brand);
  color: #FFFFFF;
  font-weight: 800;
}

.diff-opt-icon {
  font-size: 0.75rem;
}

.diff-opt-text {
  font-size: 0.72rem;
}

.btn-sm-reset {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm-reset:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Main Two-Column Layout */
.game-main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .game-main-layout {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 14px;
    align-items: start;
  }
}

/* Asset Container Box */
.asset-container {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.target-info-header {
  text-align: center;
  margin-bottom: 8px;
  width: 100%;
}

.target-item-title {
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 2px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.target-question {
  display: inline-block;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 700;
}

/* SVG Display Stage */
.svg-stage {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  background: #FFFFFF; /* High-contrast white canvas inside stage ensures perfect SVG transparency rendering */
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.svg-stage svg {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xs);
  transition: transform 0.2s ease;
}

.asset-loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.target-locator-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-amber);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ==========================================================================
   COLOR PICKER COMPONENT (3 VERTICAL SLIDERS & PROMINENT PREVIEW)
   ========================================================================== */
.controls-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.panel-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.panel-subtitle {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.cp-composer-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 1. LARGE PROMINENT COMPOSED COLOR PREVIEW CARD */
.cp-large-preview-card {
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cp-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cp-preview-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
}

.cp-hex-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

.cp-large-live-swatch {
  width: 100%;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: background-color 0.05s ease;
}

.cp-swatch-glare {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), transparent);
  pointer-events: none;
}

/* 2. THREE VERTICAL SLIDERS GRID */
.cp-vertical-sliders-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.cp-v-slider-col {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cp-v-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1px;
}

.cp-v-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cp-v-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  padding: 0 5px;
  border-radius: var(--radius-full);
}

.cp-v-track-container {
  height: 125px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: none;
}

@media (min-width: 768px) {
  .cp-v-track-container {
    height: 140px;
  }
}

/* Range input styled as vertical */
.cp-v-range {
  -webkit-appearance: slider-vertical;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl; /* bottom is min (0), top is max */
  width: 22px;
  height: 120px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  outline: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  margin: 0 auto;
}

@media (min-width: 768px) {
  .cp-v-range {
    height: 135px;
    width: 24px;
  }
}

/* Chrome / Safari WebKit Slider Thumb */
.cp-v-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 16px;
  border-radius: var(--radius-full);
  background: #FFFFFF;
  border: 2px solid #0F172A;
  cursor: grab;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease;
}

.cp-v-range::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.12);
  background: #FEF08A;
}

/* Firefox Slider Thumb */
.cp-v-range::-moz-range-thumb {
  width: 28px;
  height: 16px;
  border-radius: var(--radius-full);
  background: #FFFFFF;
  border: 2px solid #0F172A;
  cursor: grab;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Hue Rainbow Gradient Track (Bottom = 0°, Top = 360°) */
.cp-hue-v-slider {
  background: linear-gradient(
    to top,
    #FF0000 0%,
    #FFFF00 17%,
    #00FF00 33%,
    #00FFFF 50%,
    #0000FF 67%,
    #FF00FF 83%,
    #FF0000 100%
  );
}

/* Submit Guess Button */
.btn-submit-guess {
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  background: var(--accent-green);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-btn);
  transition: all 0.15s ease;
}

.btn-submit-guess:hover {
  background: var(--accent-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.btn-submit-guess:active {
  transform: translateY(1px);
}

/* ==========================================================================
   REVEAL PANEL (SCORE & COMPARISON)
   ========================================================================== */
.round-reveal-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.2s ease;
}

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

.hidden {
  display: none !important;
}

.reveal-score-banner {
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
}

.reveal-score-hero {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 2px;
}

.reveal-score-val {
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.reveal-score-max {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-muted);
}

.reveal-rating-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 3px;
  border: 1px solid transparent;
}

.reveal-delta-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.reveal-comparison-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.reveal-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.reveal-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.reveal-swatch {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.reveal-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-next-round {
  width: 100%;
  padding: 11px 14px;
  background: var(--accent-blue);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-btn);
  transition: all 0.15s ease;
}

.btn-next-round:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-1px);
}

.btn-next-round:active {
  transform: translateY(1px);
}

/* ==========================================================================
   VIEW 2: FINAL RESULTS SCREEN WITH THUMBNAILS & PROMINENT USERNAME
   ========================================================================= */
.results-card-container {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 18px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.results-hero-header {
  text-align: center;
  margin-bottom: 14px;
}

.res-pill {
  display: inline-block;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: 0.4px;
  border: 1px solid var(--border-color);
}

/* PROMINENT USERNAME DISPLAY */
.res-player-display {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent-brand);
  margin-bottom: 2px;
  letter-spacing: -0.3px;
}

.res-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.res-score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 6px;
}

.res-avg-score {
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.res-score-max {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-muted);
}

.res-percentile-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-green);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
}

/* Username input field for viral card customisation */
.username-customizer-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.username-label-group {
  display: flex;
  flex-direction: column;
}

.username-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

.username-subtext {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.username-input {
  background: var(--input-bg);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 8px;
  max-width: 140px;
  outline: none;
  transition: border-color 0.15s ease;
}

.username-input:focus {
  border-color: var(--accent-brand);
}

.breakdown-header-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.4px;
}

/* 5-Rounds Breakdown Rows with Thumbnails */
.result-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.result-breakdown-row {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  gap: 8px;
  box-shadow: var(--shadow-subtle);
}

.r-num {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  width: 18px;
  flex-shrink: 0;
}

/* Thumbnail with Original Full-Color Asset */
.r-thumb-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: var(--thumb-box-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.r-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.r-info {
  flex: 1;
  min-width: 0;
}

.r-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r-part {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r-swatches-box {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.r-swatch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.r-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.r-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.r-vs {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
}

.r-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
  min-width: 38px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.r-score {
  font-size: 1.05rem;
  font-weight: 900;
}

.r-score-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Rendered Canvas Image Preview */
.rendered-card-preview-box {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.rendered-card-img {
  max-width: 300px;
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

/* Action Buttons Grid */
.results-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

@media (min-width: 600px) {
  .results-actions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

.btn-action-primary {
  padding: 10px 14px;
  background: var(--accent-brand);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-btn);
  transition: all 0.15s ease;
}

.btn-action-primary:hover {
  background: var(--accent-brand-hover);
  transform: translateY(-1px);
}

.btn-action-primary:active {
  transform: translateY(1px);
}

.btn-action-secondary {
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-subtle);
  transition: all 0.15s ease;
}

.btn-action-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
}

.btn-action-secondary:active {
  transform: translateY(1px);
}

/* Results Footer Nav */
.results-footer-nav {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.results-footer-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.results-cat-pills {
  display: flex;
  gap: 5px;
}

.footer-cat-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.footer-cat-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-color-hover);
}

/* Footer & Legal */
.app-footer {
  margin-top: auto;
  padding: 16px 10px 8px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.footer-nav {
  display: flex;
  gap: 12px;
  list-style: none;
}

.footer-link {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.footer-link:hover {
  color: var(--accent-brand);
  text-decoration: underline;
}

.footer-copy {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  max-width: 440px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  padding: 2px 6px;
}

.modal-close-btn:hover {
  color: var(--accent-coral);
}

.modal-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Toast */
.game-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
}

.game-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   HOMEPAGE HEADLINE & SEO CONTENT SECTIONS
   ========================================================================== */
.game-headline-bar {
  text-align: center;
  margin-bottom: 8px;
  padding: 2px 4px;
}

.game-main-h1 {
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  line-height: 1.2;
}

.game-main-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

@media (min-width: 640px) {
  .game-headline-bar {
    margin-bottom: 10px;
  }
  .game-main-h1 {
    font-size: 1.4rem;
  }
  .game-main-subtitle {
    font-size: 0.86rem;
  }
}

/* SEO Content Section Below Game */
.seo-content-section {
  margin-top: 22px;
  margin-bottom: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

.seo-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .seo-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .seo-card-full {
    grid-column: 1 / -1;
  }
}

.seo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.seo-heading {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  line-height: 1.3;
}

.seo-text {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.seo-text strong {
  color: var(--text-primary);
  font-weight: 700;
}

.seo-highlight {
  font-weight: 600;
  color: var(--badge-text);
}

.seo-list {
  padding-left: 18px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seo-list li::marker {
  color: var(--accent-brand);
  font-weight: 800;
}

.seo-category-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* FAQ Section */
.seo-faq-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-top: 2px;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.seo-faq-main-title {
  font-size: 1.1rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.seo-faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .seo-faq-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

.seo-faq-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seo-faq-q {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.35;
}

.seo-faq-a {
  font-size: 0.81rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
