/* Self-hosted Google Fonts */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('/static/fonts/nunito-variable-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/static/fonts/fredoka-variable-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* WorldWise - Main Styles */

/* @layer order declaration - defines priority order for all layers */
@layer tokens, reset, base, layout, components, pages, utilities, animations;

/* Design Tokens - 60+ tokens defining the visual language */
@layer tokens {
  :root {
    /* ===== Colors - Primary Palette ===== */
    --color-primary: #58CC02; /* Duolingo green - vibrant but light */
    --color-primary-dark: #46A302;
    --color-primary-light: #7ED321;
    --color-secondary: #1CB0F6; /* Sky blue */
    --color-secondary-dark: #1899D6;
    --color-accent: #FF9600; /* Vibrant orange */
    --color-accent-dark: #E08600;

    /* ===== Colors - Semantic ===== */
    --color-success: #58CC02;
    --color-danger: #FF4B4B;
    --color-warning: #FFC800;
    --color-info: #1CB0F6;
    --color-error: #FF4B4B;

    /* ===== Colors - Neutrals (light to dark) ===== */
    --color-neutral-50: #F9FAFB;
    --color-neutral-100: #F3F4F6;
    --color-neutral-200: #E5E7EB;
    --color-neutral-300: #D1D5DB;
    --color-neutral-400: #9CA3AF;
    --color-neutral-500: #6B7280;
    --color-neutral-600: #4B5563;
    --color-neutral-700: #374151;
    --color-neutral-800: #1F2937;
    --color-neutral-900: #111827;

    /* ===== Colors - Surfaces ===== */
    --color-bg: #E5F6FF; /* Pastel gradient start - light sky blue */
    --color-bg-end: #F0E6FF; /* Gradient end - light lavender */
    --color-surface: #FFFFFF;
    --color-surface-hover: #F7F7F7;
    --color-surface-active: #EFEFEF;

    /* ===== Colors - Decorative Blobs ===== */
    --color-blob-peach: #FFDAB9;
    --color-blob-mint: #B2DFDB;
    --color-blob-pink: #F8BBD0;
    --color-blob-opacity: 0.25;

    /* ===== Colors - Round Types ===== */
    --color-round-calc: #4F9BF5; /* Vibrant blue */
    --color-round-word: #9B59B6; /* Vibrant purple */
    --color-round-flag: #FF9600; /* Vibrant orange */
    --color-round-silhouette: #1ABC9C; /* Vibrant teal */
    --color-round-capital: #E74C3C; /* Warm red - government/cities */
    --color-round-currency: #27AE60; /* Green - money association */

    /* ===== Colors - Text ===== */
    --color-text: #3C3C3C; /* Dark text for readability */
    --color-text-light: #777777;
    --color-text-inverse: #FFFFFF;
    --color-text-muted: #AFAFAF;

    /* ===== Typography - Families ===== */
    --font-display: 'Fredoka', sans-serif;
    --font-body: 'Nunito', sans-serif;
    --font-mono: 'Courier New', monospace;

    /* ===== Typography - Sizes ===== */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;

    /* ===== Typography - Weights ===== */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* ===== Typography - Line Heights ===== */
    --leading-tight: 1.2;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;

    /* ===== Spacing ===== */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* ===== Borders & Radii ===== */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --radius-full: 9999px;
    --border-width: 2px;
    --border-thick: 3px;

    /* ===== Shadows ===== */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-button: 0 4px 0 rgba(0, 0, 0, 0.2); /* Duolingo style - bottom heavy */
    --shadow-button-active: 0 2px 0 rgba(0, 0, 0, 0.2); /* Pressed button shadow */

    /* ===== Transitions ===== */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ===== Z-index ===== */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-toast: 400;

    /* Legacy aliases — preserve backward compatibility */
    --primary: var(--color-primary);
    --primary-dark: var(--color-primary-dark);
    --secondary: var(--color-secondary);
    --danger: var(--color-danger);
    --bg: var(--color-bg);
    --bg-card: var(--color-surface);
    --text: var(--color-text);
    --text-muted: var(--color-text-muted);
    --border: var(--color-neutral-200);
    --success: var(--color-success);
    --warning: var(--color-warning);
  }
}

/* Reset layer - universal reset */
@layer reset {
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
}

/* Base layer - element-level styles */
@layer base {
  body {
    font-family: var(--font-body);
    background: url('/static/images/background.png') center center / cover no-repeat fixed;
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-6) var(--space-3);
  }

  /* Decorative background blobs */
  body::before,
  body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
  }
  body::before {
    width: clamp(200px, 30vw, 400px);
    height: clamp(200px, 30vw, 400px);
    background: var(--color-blob-peach);
    opacity: var(--color-blob-opacity);
    top: -5%;
    right: -8%;
  }
  body::after {
    width: clamp(180px, 25vw, 350px);
    height: clamp(180px, 25vw, 350px);
    background: var(--color-blob-mint);
    opacity: var(--color-blob-opacity);
    bottom: 10%;
    left: -10%;
  }
  main::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    width: clamp(150px, 20vw, 280px);
    height: clamp(150px, 20vw, 280px);
    background: var(--color-blob-pink);
    opacity: calc(var(--color-blob-opacity) * 0.8);
    top: 50%;
    right: -5%;
  }

  @media (max-width: 640px) {
    body::before { width: 150px; height: 150px; opacity: 0.15; }
    body::after { width: 120px; height: 120px; opacity: 0.15; }
    main::after { width: 100px; height: 100px; opacity: 0.12; }
  }

  /* Desktop-only decorative blobs (progressive enhancement) */
  .blob-desktop {
    display: none;
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
  }

  @media (min-width: 1024px) {
    .blob-desktop {
      display: block;
    }

    .blob-desktop-1 {
      width: 200px;
      height: 200px;
      background: var(--color-blob-peach);
      opacity: var(--color-blob-opacity);
      top: 30%;
      right: 5%;
    }

    .blob-desktop-2 {
      width: 160px;
      height: 160px;
      background: var(--color-blob-mint);
      opacity: calc(var(--color-blob-opacity) * 0.7);
      bottom: 20%;
      left: 3%;
    }
  }

  h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--color-text);
  }

  h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2);
  }

  h2 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-3);
  }

  h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
  }

  a {
    text-decoration: none;
  }
}

/* Layout layer - structural layout */
@layer layout {
  main {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  /* Tablet and desktop container widening */
  @media (min-width: 768px) {
    main {
      max-width: 500px;
    }
  }

  @media (min-width: 1024px) {
    main {
      max-width: 600px;
    }
  }

  @media (max-width: 640px) {
    main {
      overflow-y: visible;
      padding-bottom: var(--space-4);
      /* Scrollbar styling for webkit browsers */
      scrollbar-width: thin;
      scrollbar-color: var(--color-neutral-300) transparent;
    }

    main::-webkit-scrollbar {
      width: 4px;
    }

    main::-webkit-scrollbar-track {
      background: transparent;
    }

    main::-webkit-scrollbar-thumb {
      background: var(--color-neutral-300);
      border-radius: 4px;
    }
  }

  .card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-5);
    border: none;
  }
}

/* Components layer - all component classes */
@layer components {
  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-xl);
    font-size: 1rem;
    font-weight: var(--font-semibold);
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    text-decoration: none;
    box-shadow: var(--shadow-button);
  }

  .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
  }

  .btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }

  .btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: var(--shadow-button-active);
  }

  .btn-primary {
    background: var(--primary);
    color: white;
  }

  .btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
  }

  .btn-secondary {
    background: var(--secondary);
    color: white;
  }

  .btn-secondary:hover:not(:disabled) {
    background: #059669;
  }

  .btn-danger {
    background: var(--danger);
    color: white;
  }

  .btn-danger:hover:not(:disabled) {
    background: #dc2626;
  }

  .btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
  }

  .btn-outline:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
  }

  .btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
  }

  .btn-glow-start {
    animation: start-match-glow 2s ease-in-out infinite;
  }

  .btn-block {
    width: 100%;
  }

  .btn-letter {
    width: 80px;
    height: 80px;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: var(--radius-xl);
  }

  .btn-letter:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }

  .btn-letter:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: var(--shadow-button-active);
  }

  /* Round images */
  .round-image {
    max-width: 300px;
    max-height: 200px;
    margin: 1rem auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }

  .round-image.flag {
    border: 2px solid var(--border);
  }

  .round-image.silhouette {
    border: 2px solid var(--border);
    background: var(--bg);
  }

  /* Round image scaling on wider screens */
  @media (min-width: 768px) {
    .round-image {
      max-width: 350px;
    }
  }

  @media (min-width: 1024px) {
    .round-image {
      max-width: 400px;
    }
  }

  /* Forms */
  .form-group {
    margin-bottom: 1rem;
  }

  .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: var(--font-semibold);
    color: var(--color-text-light);
  }

  .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: var(--border-width) solid var(--color-neutral-200);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    color: var(--color-text);
    transition: all var(--transition-fast);
    font-family: var(--font-body);
    box-shadow: var(--shadow-sm);
  }

  .form-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
  }

  .form-input::placeholder {
    color: var(--color-text-muted);
  }

  .form-input.input-lg {
    padding: 1rem;
    font-size: 1.25rem;
    text-align: center;
    letter-spacing: 0.1em;
  }

  /* Toggle switch */
  .switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
  }

  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .3s;
    border-radius: 26px;
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
  }

  input:checked + .slider {
    background-color: var(--danger);
  }

  input:checked + .slider:before {
    transform: translateX(24px);
  }

  /* Room Code Display */
  .room-code {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    letter-spacing: 0.15em;
    text-align: center;
    color: var(--color-secondary);
    background: var(--color-surface);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-xl);
    font-family: var(--font-mono);
    box-shadow: var(--shadow-md);
    border: var(--border-thick) solid var(--color-secondary);
    display: inline-block;
  }

  .room-code.clickable {
    cursor: pointer;
    transition: all var(--transition-normal);
  }

  .room-code.clickable:hover {
    background: var(--color-secondary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }

  .room-code-label {
    text-align: center;
    color: var(--color-text-light);
    font-size: var(--text-sm);
    margin-bottom: 0.5rem;
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  .room-code-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
  }

  .copy-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--color-text-light);
    transition: color 0.2s;
  }

  .copy-btn:hover {
    color: var(--color-secondary);
  }

  .copy-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: fadeInOut 1.5s ease-in-out;
  }

  @keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
  }

  /* Player List */
  .player-list {
    list-style: none;
  }

  .player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
  }

  .player-item:last-child {
    margin-bottom: 0;
  }

  .player-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    color: var(--color-text-inverse);
    border: 3px solid var(--color-secondary);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-display);
  }

  /* Per-player color differentiation */
  .player-item:nth-child(1) .player-avatar {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
  }
  .player-item:nth-child(2) .player-avatar {
    background: var(--color-primary);
    border-color: var(--color-primary);
  }
  .player-item:nth-child(3) .player-avatar {
    background: var(--color-accent);
    border-color: var(--color-accent);
  }
  .player-item:nth-child(4) .player-avatar {
    background: var(--color-warning);
    border-color: var(--color-warning);
  }

  .player-name {
    font-weight: 500;
  }

  /* Disconnected player indicator */
  .player-disconnected {
    opacity: 0.5;
  }

  .player-disconnected .player-status {
    color: var(--color-warning, #f59e0b);
    font-size: 0.75rem;
    margin-left: 0.5rem;
  }

  /* Player score class - replaces inline style */
  .player-score {
    font-weight: var(--font-semibold);
    font-size: var(--text-xl);
    font-family: var(--font-display);
    color: var(--color-text);
  }

  /* Position medal for scoreboard */
  .position-medal {
    font-size: var(--text-lg);
    margin-right: var(--space-1);
  }

  .player-badge {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--color-neutral-200);
    color: var(--color-text);
    font-weight: var(--font-semibold);
    font-family: var(--font-body);
  }

  .player-badge.host {
    background: var(--color-warning);
    color: var(--color-neutral-800);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-full);
  }

  .player-badge.you {
    background: var(--color-secondary);
    color: var(--color-text-inverse);
  }

  /* Status */
  .status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    font-weight: var(--font-medium);
  }

  .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-neutral-300);
  }

  .status.connected .status-dot {
    background: var(--color-success);
  }

  .status.connecting .status-dot {
    background: var(--color-warning);
  }

  .status.disconnected .status-dot {
    background: var(--color-danger);
  }

  /* Error components */
  .error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
  }

  .error-message {
    background: var(--danger);
    color: white;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    text-align: center;
  }

  /* Loading */
  .loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
  }

  .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
  }

  .spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
  }

  /* Privacy components */
  .privacy-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
  }

  .privacy-badge.private {
    background: var(--danger);
    color: white;
  }

  .privacy-badge.public {
    background: var(--success);
    color: white;
  }

  .privacy-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
  }

  /* Connection indicator dot - fixed in header */
  .connection-indicator {
    position: absolute;
    top: 50%;
    right: var(--space-4);
    transform: translateY(-50%);
  }

  .connection-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-neutral-300);
    transition: background var(--transition-fast);
  }

  .connection-dot.connected {
    background: var(--color-success);
    animation: pulse 2s ease-in-out infinite;
  }

  .connection-dot.connecting,
  .connection-dot.joining,
  .connection-dot.reconnecting {
    background: var(--color-warning);
    animation: pulse 1s ease-in-out infinite;
  }

  .connection-dot.disconnected {
    background: var(--color-danger);
  }

  /* Responsive: larger dot on mobile */
  @media (max-width: 640px) {
    .connection-dot {
      width: 16px;
      height: 16px;
    }
  }

  /* Avatar dots for player count */
  .player-dots {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    margin-bottom: var(--space-4);
  }

  .player-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--color-neutral-300);
    transition: all var(--transition-fast);
  }

  .player-dot.filled {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
  }

  .player-dot.empty {
    background: transparent;
  }

  /* Header */
  .header {
    position: relative;
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
  }

  .header h1 {
    color: var(--primary);
  }

  .header-streak {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    position: relative;
  }

  .header-streak .streak-count {
    color: var(--color-primary);
  }

  .header p {
    color: var(--text-muted);
  }

  /* Divider */
  .divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
  }

  .divider::before,
  .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* Round type styling */
  .round-kind-calc {
    background: var(--color-round-calc);
  }

  .round-kind-word {
    background: var(--color-round-word);
    color: var(--color-text-inverse);
  }

  .round-kind-flag {
    background: var(--color-round-flag);
  }

  .round-kind-silhouette {
    background: var(--color-round-silhouette);
    color: var(--color-text-inverse);
  }

  .round-kind-capital {
    background: var(--color-round-capital);
    color: var(--color-text-inverse);
  }

  .round-kind-currency {
    background: var(--color-round-currency);
    color: var(--color-text-inverse);
  }

  /* Prompt styling by round type */
  .prompt-calc {
    font-size: 1.75rem;
    min-height: 2.5rem;
    font-family: 'Monaco', 'Consolas', monospace;
  }

  .prompt-word {
    font-size: 2.5rem;
    min-height: 3rem;
    font-family: 'Monaco', 'Consolas', monospace;
    letter-spacing: 0.15em;
    text-transform: lowercase;
  }

  .prompt-flag {
    font-size: 1.5rem;
    min-height: 2rem;
    font-weight: 500;
  }

  .prompt-silhouette {
    font-size: 1.5rem;
    min-height: 2rem;
    font-weight: 500;
  }

  .prompt-capital {
    font-size: 1.5rem;
    min-height: 2rem;
    font-weight: 500;
  }

  .prompt-currency {
    font-size: 1.5rem;
    min-height: 2rem;
    font-weight: 500;
  }

  /* Timer Ring - SVG circular countdown */
  .timer-ring-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
  }

  .timer-ring {
    /* SVG element - size set via HTML attributes */
  }

  .timer-ring-bg {
    stroke: var(--color-neutral-200);
    fill: none;
    stroke-width: 3;
  }

  .timer-ring-progress {
    stroke: var(--color-secondary);
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 106.81;
    stroke-dashoffset: 0;
    transition: stroke var(--transition-fast);
  }

  .timer-ring-container.timer-urgent .timer-ring-progress {
    stroke: var(--color-danger);
  }

  .timer-ring-value {
    position: absolute;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    color: var(--color-text);
  }

  .round-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .round-timer-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Choice feedback - vivid glow effects */
  .choice-correct {
    background: var(--color-success) !important;
    color: white !important;
    box-shadow: 0 0 0 4px rgba(88, 204, 2, 0.3), var(--shadow-button) !important;
    border-color: var(--color-success) !important;
  }

  .choice-wrong {
    background: var(--color-danger) !important;
    color: white !important;
    box-shadow: 0 0 0 4px rgba(255, 75, 75, 0.3), var(--shadow-button) !important;
    border-color: var(--color-danger) !important;
  }

  .choice-selected {
    background: var(--color-secondary) !important;
    color: white !important;
    border-color: var(--color-secondary) !important;
  }

  /* Timer urgency */
  .timer-urgent {
    color: var(--danger);
  }

  .timer-urgent #timerValue {
    font-weight: 700;
    font-size: 1.25em;
  }

  /* Timer frozen state */
  .timer-frozen {
    opacity: 0.7;
  }

  /* Score changed animation trigger */
  .score-changed {
  }

  /* Round result banners - colored cards for win/lose/miss/timeout */
  .round-result-win {
    background: rgba(88, 204, 2, 0.12);
    border: 2px solid var(--color-success);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
  }

  .round-result-win .result-message {
    color: var(--color-success);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    display: block;
    text-align: center;
  }

  .round-result-lose {
    background: rgba(255, 75, 75, 0.12);
    border: 2px solid var(--color-danger);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
  }

  .round-result-lose .result-message {
    color: var(--color-danger);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    display: block;
    text-align: center;
  }

  .round-result-miss {
    background: rgba(255, 150, 0, 0.12);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
  }

  .round-result-miss .miss-message {
    color: var(--color-accent);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    display: block;
    text-align: center;
  }

  .round-result-miss .correct-answer {
    color: var(--text-muted);
    font-size: var(--text-sm);
    display: block;
    text-align: center;
    margin-top: var(--space-2);
  }

  .round-result-timeout {
    background: var(--color-neutral-100);
    border: 2px solid var(--color-neutral-300);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
  }

  .round-result-timeout .result-message {
    color: var(--color-text-light);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    font-family: var(--font-display);
    display: block;
    text-align: center;
  }

  /* History link */
  .history-link {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s ease;
  }

  .history-link:hover {
    color: var(--primary);
  }

  /* Mode Badges */
  .mode-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
  }

  .mode-badge.practice {
    background: var(--danger);
    color: white;
  }

  .mode-badge.multiplayer {
    background: var(--success);
    color: white;
  }

  /* Round kind badges in table */
  .round-kind-badge {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    text-transform: capitalize;
    font-weight: var(--font-semibold);
    font-family: var(--font-body);
  }

  .round-kind-badge.calc { background: var(--color-round-calc); color: var(--color-text-inverse); }
  .round-kind-badge.word { background: var(--color-round-word); color: var(--color-text-inverse); }
  .round-kind-badge.flag { background: var(--color-round-flag); color: var(--color-text-inverse); }
  .round-kind-badge.silhouette { background: var(--color-round-silhouette); color: var(--color-text-inverse); }
  .round-kind-badge.capital { background: var(--color-round-capital); color: var(--color-text-inverse); }
  .round-kind-badge.currency { background: var(--color-round-currency); color: var(--color-text-inverse); }

  /* Settings components */
  .mode-cards {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }

  .mode-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 60px;
  }

  .mode-card:hover:not(.disabled) {
    border-color: var(--primary);
  }

  .mode-card.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
  }

  .mode-card.disabled {
    opacity: 0.6;
    cursor: default;
  }

  .mode-card-icon {
    font-size: 1.25rem;
  }

  .mode-card-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .difficulty-container {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .difficulty-selector {
    display: flex;
    gap: 0.5rem;
  }

  .difficulty-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md, 0.5rem);
    background: var(--color-surface, #fff);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
  }

  .difficulty-btn:hover {
    border-color: var(--primary);
    color: var(--color-text);
  }

  .difficulty-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
  }

  .calc-ops-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.3rem;
  }
  /* Toggles row: two toggles side by side */
  .settings-toggles-row {
    display: flex;
    gap: var(--space-6);
    margin-bottom: var(--space-5);
  }
  .settings-toggles-row .settings-group {
    flex: 1;
    margin-bottom: 0;
  }
  .toggle-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }
  .pacing-label {
    font-size: var(--text-base);
  }
  .pacing-slider {
    background-color: var(--color-primary) !important;
  }
  input:checked + .pacing-slider {
    background-color: var(--color-secondary) !important;
  }
  .calc-op-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--color-surface, #fff);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .calc-op-btn:hover {
    border-color: var(--primary);
    color: var(--color-text);
  }
  .calc-op-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    animation: calc-op-glow 2s ease-in-out infinite;
  }

  .settings-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }

  .settings-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
  }

  .settings-badge-icon {
    font-size: 0.9rem;
  }

  .settings-badge-label {
    font-weight: 500;
  }

  .settings-badge-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
  }

  /* Collapsible settings panel */
  .settings-summary-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    margin-bottom: var(--space-3);
  }

  .settings-summary-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
  }

  /* Row for label and edit button */
  .settings-label-edit-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
  }

  /* Pencil icon button for settings expand/collapse */
  .settings-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    background: var(--color-neutral-100);
    color: var(--color-neutral-600);
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .settings-edit-btn:hover {
    background: var(--color-neutral-200);
    color: var(--color-neutral-700);
  }

  .settings-edit-btn:active {
    transform: scale(0.95);
  }

  .settings-edit-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Rotate icon when expanded */
  .settings-edit-btn[aria-expanded="true"] svg {
    transform: rotate(45deg);
  }

  .settings-collapsible {
    overflow: hidden;
    transition: max-height var(--transition-normal), opacity var(--transition-fast);
    max-height: 800px;
    opacity: 1;
    margin-bottom: var(--space-4);
  }

  .settings-collapsible.collapsed {
    max-height: 0;
    opacity: 0;
  }

  .guest-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: var(--space-5);
  }

  .connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.5rem;
  }

  .connection-dot.connected {
    background: var(--color-success);
  }

  .connection-dot.connecting {
    background: var(--color-warning);
    animation: pulse 1s infinite;
  }

  .connection-dot.joining {
    background: var(--color-info);
  }

  .connection-dot.reconnecting {
    background: var(--color-warning);
    animation: pulse 1s infinite;
  }

  .connection-dot.disconnected {
    background: var(--color-danger);
  }

  .setting-changed {
  }

  /* Mascot */
  .mascot-area {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding: 0 var(--space-2);
  }

  .mascot-container {
    flex-shrink: 0;
    width: 100px;
  }

  .mascot-svg {
    width: 100%;
    height: auto;
    animation: mascot-float 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s ease;
  }

  .mascot-svg:hover {
    transform: scale(1.05);
  }

  .mascot-speech-bubble {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
  }

  .sp-lobby-mascot-row .mascot-speech-bubble {
    margin-top: -20px; /* Align with mascot mouth */
  }

  .mascot-speech-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 50%;
    transform: translateY(50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid var(--color-surface);
  }

  /* Mascot SVG internal styles */
  .mascot-body { fill: url(#bodyGradient); }
  .mascot-limb { fill: #FFCC80; stroke: #E6B06E; stroke-width: 2; stroke-linecap: round; }
  .mascot-eye { fill: #333333; }
  .mascot-eye-shine { fill: #FFFFFF; opacity: 0.8; }
  .mascot-blush { fill: #FFCDD2; opacity: 0.6; }
  .mascot-mouth { fill: none; stroke: #333333; stroke-width: 3; stroke-linecap: round; }
  .mascot-sprout { fill: #81C784; stroke: #66BB6A; stroke-width: 1; stroke-linejoin: round; }
  .mascot-shadow { fill: rgba(0,0,0,0.1); }

  /* Corner mascot for game screen */
  .mascot-corner {
    position: fixed;
    bottom: var(--space-4);
    left: var(--space-4);
    width: 60px;
    z-index: var(--z-sticky);
    cursor: pointer;
    transition: transform 0.3s ease;
  }

  .mascot-corner .mascot-svg {
    width: 60px;
    height: auto;
  }

  .mascot-corner .mascot-body {
    fill: url(#bodyGradientGame);
  }

  .mascot-corner .mascot-speech-bubble {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
    min-width: auto;
    white-space: nowrap;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: var(--space-2);
  }

  .mascot-corner .mascot-speech-bubble::before {
    left: -8px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  /* Reaction states */
  .mascot-happy .mascot-body {
    fill: #C8E6C9 !important;
  }
  .mascot-happy .mascot-mouth {
    stroke-width: 4;
  }

  .mascot-sad .mascot-body {
    fill: #FFCDD2 !important;
  }
  .mascot-sad .mascot-eye {
    transform: scaleY(0.6);
    animation: none;
  }

  /* Mobile media query for corner mascot */
  @media (max-width: 640px) {
    .mascot-corner {
      width: 40px;
      bottom: var(--space-3);
      left: var(--space-2);
    }
    .mascot-corner .mascot-svg {
      width: 40px;
    }
    .mascot-corner .mascot-speech-bubble {
      font-size: 0.65rem;
      padding: var(--space-1);
    }
  }

  /* Desktop mascot repositioning */
  @media (min-width: 1024px) {
    .mascot-area .mascot-container {
      width: 140px;
    }

    .mascot-corner {
      width: 100px;
      bottom: 50%;
      transform: translateY(50%);
      left: calc(50% - 360px);
    }

    .mascot-corner .mascot-svg {
      width: 100px;
    }

    .mascot-corner .mascot-speech-bubble {
      font-size: var(--text-sm);
      padding: var(--space-2) var(--space-3);
    }
  }

  .settings-section {
    margin-bottom: 1rem;
  }

  .settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
  }

  .settings-group {
    margin-bottom: var(--space-5);
  }

  .settings-group:last-child {
    margin-bottom: 0;
  }

  .settings-group-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
  }

  /* Settings panel specific styles */
  .settings-panel .settings-group-room-code {
    text-align: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-neutral-200);
  }

  .settings-panel .settings-group-players {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-neutral-200);
  }

  /* Round slider styles */
  .slider-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  .round-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-neutral-200);
    border-radius: 4px;
    cursor: pointer;
  }

  .round-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform 0.15s ease;
  }

  .round-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
  }

  .round-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
    transition: transform 0.15s ease;
  }

  .round-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
  }

  .slider-value-label {
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    min-width: 2.5rem;
    text-align: center;
    color: var(--color-primary);
  }


  /* Mode cards container disabled state for guests */
  .mode-cards.disabled {
    pointer-events: none;
    opacity: 0.6;
  }

  /* Match end celebration styles */
  .match-winner-banner {
    background: linear-gradient(135deg, #FFF8E1, #FFECB3);
    border: 2px solid #FFC800;
    text-align: center;
    padding: var(--space-8) var(--space-5);
    border-radius: var(--radius-xl);
    animation: winner-entrance 0.5s ease-out;
  }

  .winner-trophy {
    font-size: 3rem;
    margin-bottom: var(--space-2);
    display: block;
  }

  .winner-name {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    margin-bottom: var(--space-2);
  }

  .winner-subtitle {
    color: var(--color-text-light);
    font-size: var(--text-lg);
  }

  .match-gameover-banner {
    background: var(--color-neutral-100);
    border: 2px solid var(--color-neutral-300);
    text-align: center;
    padding: var(--space-8) var(--space-5);
    border-radius: var(--radius-xl);
  }

  .player-item-winner {
    background: linear-gradient(135deg, #FFF8E1, #FFFDE7);
    border: 2px solid var(--color-warning);
  }

  .player-badge-winner {
    background: var(--color-warning);
    color: var(--color-neutral-800);
    font-weight: var(--font-bold);
  }

  .match-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-5);
  }

  /* Index page folder-tab interface */
  .folder-tabs {
    display: flex;
    gap: 4px;
    align-items: flex-end;
  }

  .folder-tab {
    flex: 1;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: var(--color-neutral-100);
    border: 1px solid var(--color-neutral-200);
    border-bottom: none;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    cursor: pointer;
    margin-top: 3px;
    position: relative;
    z-index: 0;
  }

  .folder-tab:hover {
    background: var(--color-neutral-50);
    color: var(--color-text);
  }

  .folder-tab.active {
    background: #FFFEF8;
    border-color: var(--color-neutral-200);
    color: var(--color-text);
    font-weight: var(--font-bold);
    margin-top: 0;
    margin-bottom: -1px;
    z-index: 2;
  }

  .index-card {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding: var(--space-5);
    position: relative;
    z-index: 1;
  }

  .tab-panel.hidden {
    display: none;
  }

  .page-logo {
    display: flex;
    justify-content: center;
    margin-top: var(--space-6);
    margin-bottom: var(--space-4);
  }

  .page-logo img {
    width: 90px;
    height: auto;
    display: block;
  }

  /* Single Player Lobby */
  .sp-lobby {
    text-align: center;
  }

  .sp-lobby-greeting {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    margin-bottom: var(--space-1);
  }

  .sp-lobby-player-name {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    margin-bottom: var(--space-4);
    animation: sp-name-appear 0.8s ease-out both;
  }

  @keyframes sp-name-appear {
    0% {
      opacity: 0;
      transform: translateY(10px) scale(0.9);
      filter: blur(4px);
    }
    60% {
      opacity: 1;
      transform: translateY(-3px) scale(1.05);
      filter: blur(0);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1);
      filter: blur(0);
    }
  }

  .sp-lobby-mascot-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .sp-lobby-mascot {
    width: 120px;
    flex-shrink: 0;
  }

  .sp-lobby-mascot .mascot-svg {
    animation: sp-mascot-bob 2s ease-in-out infinite;
  }

  .sp-lobby-start-btn {
    font-size: var(--text-xl);
    padding: 1.25rem 2rem;
    animation: sp-btn-pulse 2s ease-in-out infinite;
    margin-top: var(--space-3);
  }

  .sp-options-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    white-space: nowrap;
    margin-right: var(--space-1);
  }

  .sp-toggle-group {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
  }

  .sp-toggle-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
  }

  .sp-toggle-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-text);
  }

  .sp-toggle-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
  }

  .sp-back-btn {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
  }

  /* Single Player Round Feedback Overlay */
  .sp-round-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-8);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    text-align: center;
    animation: sp-feedback-flash 0.3s ease-out;
  }

  .sp-round-feedback.hiding {
    animation: sp-feedback-hide 0.3s ease-out forwards;
  }

  .sp-feedback-icon {
    font-size: 3rem;
    margin-bottom: var(--space-2);
  }

  .sp-feedback-icon.correct {
    color: var(--color-success);
  }

  .sp-feedback-icon.wrong {
    color: var(--color-danger);
  }

  .sp-feedback-icon.timeout {
    color: var(--color-text-muted);
  }

  .sp-feedback-time {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
  }

  /* SP Loading overlay between rounds */
  .sp-inter-round-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-modal);
  }

  .sp-inter-round-loader .spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
  }

  /* Horizontal Scoreboard */
  .scoreboard-card {
    position: relative;
  }

  .scoreboard-row {
    position: relative;
    display: flex;
    flex-direction: row;
    gap: var(--space-2);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-2) var(--space-1);
    margin: 0 calc(-1 * var(--space-3));
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .player-card {
    flex: 0 0 auto;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 2px solid var(--color-neutral-200);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-1);
    scroll-snap-align: start;
    box-shadow: var(--shadow-sm);
  }

  .player-card-name {
    flex: 1 1 0;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .player-card-score {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    color: var(--color-text);
  }

  .player-card-current {
    border-color: var(--color-warning);
    background: rgba(255, 200, 0, 0.12);
    animation: current-player-pulse 2s ease-in-out infinite;
  }

  .score-increased {
    animation: score-flash 0.4s ease-out;
  }

  /* Edge fade gradients */
  .scoreboard-row::before,
  .scoreboard-row::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .scoreboard-row::before {
    left: 0;
    background: linear-gradient(to right, var(--color-surface), transparent);
  }

  .scoreboard-row::after {
    right: 0;
    background: linear-gradient(to left, var(--color-surface), transparent);
  }

  .scoreboard-row.scroll-left::before {
    opacity: 1;
  }

  .scoreboard-row.scroll-right::after {
    opacity: 1;
  }
}

/* Pages layer - page-specific styles */
@layer pages {
  /* Mobile-specific layout fixes */
  @media (max-width: 640px) {
    /* Add bottom padding to main to account for fixed mascot */
    main {
      padding-bottom: 80px;
    }

    /* Reduce card padding on mobile */
    .card {
      padding: var(--space-3);
    }

    /* Reduce gaps between elements */
    main {
      gap: var(--space-2);
    }

    /* Smaller round images on mobile */
    .round-image {
      max-width: 100%;
      max-height: 150px;
    }

    /* Flags and silhouettes need to be smaller on mobile to fit buttons on screen */
    .round-image.flag,
    .round-image.silhouette {
      max-height: 100px;
    }

    /* Smaller prompt text on mobile */
    .prompt-calc {
      font-size: 1.4rem;
    }

    .prompt-word {
      font-size: 2rem;
    }

    .prompt-flag,
    .prompt-silhouette {
      font-size: 1.25rem;
    }

    .prompt-capital,
    .prompt-currency {
      font-size: 1.2rem;
    }

    /* Smaller letter buttons on mobile */
    .btn-letter {
      width: 60px;
      height: 60px;
      font-size: 1.5rem;
    }
  }

  /* Lobby specific */
  .lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }

  .waiting-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 1rem;
  }

  .player-count {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1rem;
  }

  /* History page styles */
  .personal-bests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
  }

  @media (min-width: 768px) {
    .personal-bests-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  .best-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
  }

  .best-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
  }

  .best-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
  }

  .best-card.high-score .best-value { color: #ffd700; }
  .best-card.calc-time .best-value { color: var(--primary); }
  .best-card.word-time .best-value { color: var(--warning); }
  .best-card.flag-time .best-value { color: var(--secondary); }
  .best-card.silhouette-time .best-value { color: var(--success); }

  .best-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .history-header h2 {
    margin-bottom: 0;
  }

  .mode-filters {
    display: flex;
    gap: 0.25rem;
  }

  .filter-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .filter-btn:hover {
    border-color: var(--primary);
    color: var(--text);
  }

  .filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
  }

  /* Expandable Match Items */
  details.match-item {
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
  }

  details.match-item:last-child {
    margin-bottom: 0;
  }

  details.match-item summary {
    padding: 1rem;
    cursor: pointer;
    list-style: none;
  }

  details.match-item summary::-webkit-details-marker {
    display: none;
  }

  details.match-item summary::after {
    content: '\25BC';
    float: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
  }

  details.match-item[open] summary::after {
    transform: rotate(180deg);
  }

  .match-summary .match-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
  }

  .match-summary .match-header .match-date {
    flex-grow: 1;
  }

  /* Match Details (expanded) */
  .match-details {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid var(--border);
    margin-top: 0;
  }

  .match-summary-stats {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
  }

  /* Rounds Table */
  .rounds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
  }

  .rounds-table th,
  .rounds-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }

  .rounds-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
  }

  .rounds-table tr.round-correct {
    color: var(--success);
  }

  .rounds-table tr.round-wrong {
    color: var(--text-muted);
  }

  @keyframes current-player-pulse {
    0%, 100% {
      box-shadow: 0 0 0 0 rgba(255, 200, 0, 0.4);
    }
    50% {
      box-shadow: 0 0 8px 2px rgba(255, 200, 0, 0.2);
    }
  }

  @keyframes score-flash {
    0% {
      color: var(--color-warning);
      transform: scale(1.2);
    }
    100% {
      color: var(--color-text);
      transform: scale(1);
    }
  }
}

/* Utilities layer - utility classes */
@layer utilities {
  .text-center {
    text-align: center;
  }

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

  .mb-1 { margin-bottom: 0.5rem; }
  .mb-2 { margin-bottom: 1rem; }
  .mb-3 { margin-bottom: 1.5rem; }
  .mt-2 { margin-top: 1rem; }
  .mt-3 { margin-top: 1.5rem; }

  .flex {
    display: flex;
  }

  .flex-col {
    flex-direction: column;
  }

  .gap-1 { gap: 0.5rem; }
  .gap-2 { gap: 1rem; }

  .justify-center {
    justify-content: center;
  }

  .hidden {
    display: none !important;
  }

  .selected {
  }
}

/* Animations layer - @keyframes and animation-triggering classes */
@layer animations {
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }

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

  @keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
  }

  @keyframes score-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); color: var(--color-success); }
    100% { transform: scale(1); }
  }

  @keyframes result-slide-in {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
  }

  @keyframes setting-pulse {
    0% {
      box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    }
    70% {
      box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
  }

  /* Animation applications */
  .status.connecting .status-dot {
    animation: pulse 1s infinite;
  }

  .spinner {
    animation: spin 0.8s linear infinite;
  }

  .spinner-small {
    animation: spin 0.6s linear infinite;
  }

  .timer-urgent {
    animation: timer-pulse 0.5s ease-in-out infinite;
  }

  .score-changed {
    animation: score-pop 0.4s ease-out;
  }

  .setting-changed {
    animation: setting-pulse 0.5s ease-out;
  }

  /* Result card entry animation */
  .round-result-win,
  .round-result-lose,
  .round-result-miss,
  .round-result-timeout {
    animation: result-slide-in 0.3s ease-out;
  }

  @keyframes mascot-float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
  }

  @keyframes mascot-bounce {
    0% { transform: translateY(0) scale(1, 1); }
    10% { transform: translateY(-10px) scale(0.9, 1.1); }
    30% { transform: translateY(-30px) scale(1.1, 0.9); }
    50% { transform: translateY(0) scale(1.05, 0.95); }
    60% { transform: translateY(-10px) scale(1, 1); }
    80% { transform: translateY(0) scale(0.95, 1.05); }
    100% { transform: translateY(0) scale(1, 1); }
  }

  @keyframes mascot-blink {
    0%, 92%, 100% { transform: scaleY(1); }
    95%, 97% { transform: scaleY(0.05); }
  }

  @keyframes mascot-look-around {
    0%, 80%, 100% { transform: translateX(0); }
    40% { transform: translateX(-2px); }
    60% { transform: translateX(2px); }
  }

  /* Mascot eye idle animations - targets eye circles, not SVG body */
  .mascot-eye {
    transform-origin: center;
    animation: mascot-blink 4s ease-in-out infinite,
               mascot-look-around 8s ease-in-out infinite;
  }

  @keyframes winner-entrance {
    0% { opacity: 0; transform: scale(0.8); }
    50% { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
  }

  /* Single Player Lobby Animations */
  @keyframes sp-mascot-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
  }

  @keyframes sp-btn-pulse {
    0%, 100% { box-shadow: var(--shadow-button), 0 0 0 0 rgba(88, 204, 2, 0.4); }
    50% { box-shadow: var(--shadow-button), 0 0 0 8px rgba(88, 204, 2, 0); }
  }

  @keyframes start-match-glow {
    0%, 100% {
      box-shadow: var(--shadow-lg), 0 0 20px rgba(88, 204, 2, 0.6), 0 0 40px rgba(88, 204, 2, 0.4);
    }
    50% {
      box-shadow: var(--shadow-lg), 0 0 30px rgba(88, 204, 2, 0.8), 0 0 60px rgba(88, 204, 2, 0.5);
    }
  }

  @keyframes calc-op-glow {
    0%, 100% {
      box-shadow: 0 0 8px rgba(88, 204, 2, 0.5), 0 0 16px rgba(88, 204, 2, 0.3);
    }
    50% {
      box-shadow: 0 0 14px rgba(88, 204, 2, 0.7), 0 0 28px rgba(88, 204, 2, 0.4);
    }
  }

  @keyframes sp-mascot-excited {
    0% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-15px) scale(1.1); }
    50% { transform: translateY(-5px) scale(0.95); }
    75% { transform: translateY(-20px) scale(1.05); }
    100% { transform: translateY(0) scale(1); }
  }

  /* Single Player Stats Footer */
  @keyframes sp-stats-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
  }

  @keyframes sp-feedback-flash {
    0% { opacity: 0; transform: scale(0.8); }
    20% { opacity: 1; transform: scale(1.1); }
    40% { transform: scale(1); }
    100% { opacity: 1; }
  }

  @keyframes sp-feedback-hide {
    0% { opacity: 1; }
    100% { opacity: 0; }
  }

  .sp-stats-pop {
    animation: sp-stats-pop 0.3s ease-out;
  }

  /* Single Player End-of-Match Summary */
  .sp-end-match {
    padding-bottom: 100px;
  }

  .sp-summary-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-md);
  }

  .sp-summary-card h3 {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-3);
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .sp-summary-card h3 .card-icon {
    font-size: var(--text-lg);
  }

  .sp-match-header {
    text-align: center;
    padding: var(--space-4) 0;
  }

  .sp-match-header .big-score {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    margin: var(--space-2) 0;
  }

  .sp-match-header .accuracy-label {
    font-size: var(--text-lg);
    color: var(--color-text-light);
  }

  .sp-match-header .time-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
  }

  .sp-bests-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .sp-best-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-neutral-100);
  }

  .sp-best-item:last-child {
    border-bottom: none;
  }

  .sp-best-label {
    font-size: var(--text-sm);
    color: var(--color-text-light);
  }

  .sp-best-values {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .sp-best-current {
    font-weight: var(--font-bold);
    color: var(--color-text);
  }

  .sp-best-previous {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }

  .sp-best-item.new-best {
    background: rgba(88, 204, 2, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    margin: 0 calc(-1 * var(--space-2));
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  .sp-best-item.new-best .sp-best-current {
    color: var(--color-success);
  }

  .sp-new-best-badge {
    font-size: var(--text-xs);
    background: var(--color-success);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: var(--font-bold);
  }

  .sp-close-miss {
    font-size: var(--text-xs);
    color: var(--color-warning);
    font-weight: var(--font-medium);
  }

  .sp-rounds-list {
    max-height: 200px;
    overflow-y: auto;
  }

  .sp-round-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-neutral-100);
  }

  .sp-round-item:last-child {
    border-bottom: none;
  }

  .sp-round-num {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    min-width: 1.5rem;
  }

  .sp-round-badge {
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: var(--font-semibold);
    text-transform: capitalize;
  }

  .sp-round-result {
    margin-left: auto;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
  }

  .sp-round-result.correct {
    color: var(--color-success);
  }

  .sp-round-result.wrong {
    color: var(--color-danger);
  }

  .sp-round-time {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }

  .sp-insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .sp-insight-item {
    text-align: center;
    padding: var(--space-3);
    background: var(--color-neutral-50);
    border-radius: var(--radius-lg);
  }

  .sp-insight-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin-bottom: var(--space-1);
  }

  .sp-insight-value {
    font-weight: var(--font-bold);
    color: var(--color-text);
  }

  .sp-insight-value.strongest {
    color: var(--color-success);
  }

  .sp-insight-value.weakest {
    color: var(--color-danger);
  }

  .sp-tips-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
  }

  .sp-tip-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-light);
    padding: var(--space-2);
    background: var(--color-neutral-50);
    border-radius: var(--radius-md);
  }

  .sp-tip-icon {
    color: var(--color-info);
  }

  .sp-fixed-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) 0;
    margin-top: var(--space-4);
  }

  @media (min-width: 768px) {
    .sp-fixed-actions {
      flex-direction: row;
      justify-content: center;
      gap: var(--space-4);
    }
  }

  @keyframes sp-card-entrance {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
  }

  .sp-summary-card {
    animation: sp-card-entrance 0.4s ease-out backwards;
  }

  .sp-summary-card:nth-child(1) { animation-delay: 0.1s; }
  .sp-summary-card:nth-child(2) { animation-delay: 0.2s; }
  .sp-summary-card:nth-child(3) { animation-delay: 0.3s; }
  .sp-summary-card:nth-child(4) { animation-delay: 0.4s; }

  /* Streak Flame Animation */
  .streak-flame {
    display: none;
    inline-block: inline-block;
    width: 1.2em;
    height: 1.2em;
    background: radial-gradient(ellipse at bottom, #FF9600 0%, #FF4B4B 60%, transparent 80%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    filter: blur(1px);
    transform-origin: bottom center;
    vertical-align: middle;
    margin-right: 0.1em;
  }

  .streak-flame.flame--low {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    animation: flame-flicker 0.3s ease-in-out infinite alternate;
  }

  .streak-flame.flame--medium {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    background: radial-gradient(ellipse at bottom, #FF9600 0%, #FF4B4B 50%, transparent 75%);
    animation: flame-flicker 0.2s ease-in-out infinite alternate;
  }

  .streak-flame.flame--high {
    display: inline-block;
    width: 1.8em;
    height: 1.8em;
    background: radial-gradient(ellipse at bottom, #FF4B4B 0%, #CC0000 50%, transparent 70%);
    filter: blur(1px) drop-shadow(0 0 4px rgba(255, 75, 75, 0.6));
    animation: flame-flicker 0.15s ease-in-out infinite alternate;
  }

  @keyframes flame-flicker {
    0% { transform: scaleY(1) scaleX(1); opacity: 0.9; }
    50% { transform: scaleY(1.1) scaleX(0.95); opacity: 1; }
    100% { transform: scaleY(0.95) scaleX(1.05); opacity: 0.85; }
  }

  /* Streak Callout Animation */
  .streak-callout {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    color: var(--color-accent);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    pointer-events: none;
    animation: streak-callout-float 1.5s ease-out forwards;
    margin-bottom: var(--space-2);
  }

  @keyframes streak-callout-float {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.8); }
    30% { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1.1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(1); }
  }

  /* Share Toast */
  .share-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: shareToastFade 2s ease-in-out;
    z-index: var(--z-toast);
  }

  @keyframes shareToastFade {
    0%, 100% { opacity: 0; }
    15%, 85% { opacity: 1; }
  }

  /* Button Accent (for Share Results) */
  .btn-accent {
    background: var(--color-accent);
    color: white;
  }

  .btn-accent:hover:not(:disabled) {
    background: var(--color-accent-dark);
  }
}

/* Sprint Waiting Overlay */
.sprint-waiting {
  text-align: center;
  padding: 2rem;
}
.sprint-waiting-content h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.sprint-waiting-score {
  font-size: 1.2rem;
  font-weight: bold;
}
.sprint-waiting-msg {
  opacity: 0.7;
  animation: pulse-opacity 1.5s ease-in-out infinite;
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.3; }
}

/* Sprint progress on player cards */
.player-card-progress {
  font-size: 0.7em;
  opacity: 0.6;
  margin-left: 0.25rem;
}

/* Squad Waiting Dots */
.squad-waiting {
  text-align: center;
  padding: 1rem;
  font-size: 1.2rem;
}
.squad-dots {
  font-size: 1.5rem;
  letter-spacing: 0.3rem;
  display: block;
  margin-bottom: 0.5rem;
}
.squad-count {
  opacity: 0.7;
  font-size: 0.9rem;
}

/* Squad Results Card */
.squad-results-card {
  background: var(--card-bg, #fff);
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  cursor: pointer;
}
.squad-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}
.squad-result-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
}
.squad-result-row.correct {
  background: rgba(76, 175, 80, 0.1);
}
.squad-result-row.wrong {
  background: rgba(244, 67, 54, 0.1);
}
.result-icon {
  font-size: 1.2rem;
  width: 1.5rem;
}
.result-name {
  flex: 1;
}
.result-points {
  font-weight: bold;
}
.squad-correct-answer {
  text-align: center;
  margin-top: 0.5rem;
  opacity: 0.7;
  font-style: italic;
}

/* Mascot Encouraging Animation (for needs_practice tier) */
.mascot-encouraging .mascot-body {
  animation: mascot-encourage 1s ease-in-out infinite;
}

@keyframes mascot-encourage {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.mascot-encouraging .mascot-speech-bubble,
.mascot-encouraging #mascotBubble {
  background: #FFF3E0;
  border-color: #FFB74D;
}
