/**
 * Wordonor - Neobrutalism + Sci-Fi Theme
 * Supports Light/Dark Mode Toggle
 */

/* ============================================
   LOCAL FONTS
   ============================================ */
@font-face {
    font-family: 'Orbitron';
    src: url('../fonts/orbitron-400.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Orbitron';
    src: url('../fonts/orbitron-700.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Orbitron';
    src: url('../fonts/orbitron-900.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/space-grotesk-400.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/space-grotesk-500.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/space-grotesk-700.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   CSS VARIABLES - THEMING
   ============================================ */
:root {
    /* Neobrutalism Core */
    --border-thick: 4px solid #000;
    --border-radius: 0;
    --shadow-brutal: 6px 6px 0 #000;
    --shadow-brutal-hover: 8px 8px 0 #000;

    /* Typography */
    --font-main: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-display: 'Orbitron', 'Space Grotesk', sans-serif;

    /* Transition */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Dark Mode (Default - Sci-Fi Neobrutalism) */
[data-theme="dark"] {
    --color-bg: #0d0d12;
    --color-bg-secondary: #16161f;
    --color-surface: #1e1e2a;
    --color-text: #ffffff;
    --color-text-muted: #a0a0c0;

    /* Vibrant Neon Accent Colors */
    --color-primary: #00ffc8;
    --color-secondary: #ff2d95;
    --color-accent: #ffe600;
    --color-danger: #ff4757;
    --color-success: #00ff7f;
    --color-info: #00d4ff;

    /* Sci-Fi Glow */
    --glow-primary: 0 0 25px rgba(0, 255, 200, 0.5);
    --glow-secondary: 0 0 25px rgba(255, 45, 149, 0.5);
    --glow-accent: 0 0 20px rgba(255, 230, 0, 0.4);

    /* Border for dark mode */
    --border-color: #00ffc8;
    --border-thick: 4px solid var(--border-color);
    --shadow-brutal: 6px 6px 0 var(--color-primary);
}

/* Light Mode (Bold Neobrutalism) */
[data-theme="light"] {
    --color-bg: #fffbe6;
    --color-bg-secondary: #fff8d6;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #4a4a4a;

    /* Vibrant Bold Colors */
    --color-primary: #00c896;
    --color-secondary: #ff0066;
    --color-accent: #ffcc00;
    --color-danger: #ff3838;
    --color-success: #00b85c;
    --color-info: #0099ff;

    /* Subtle shadows in light mode */
    --glow-primary: 0 4px 12px rgba(0, 200, 150, 0.15);
    --glow-secondary: 0 4px 12px rgba(255, 0, 102, 0.15);
    --glow-accent: 0 4px 12px rgba(255, 204, 0, 0.15);

    /* Black borders in light mode */
    --border-color: #1a1a1a;
    --border-thick: 4px solid #1a1a1a;
    --shadow-brutal: 6px 6px 0 #1a1a1a;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* Sci-Fi Background Pattern (Dark Mode Only) */
[data-theme="dark"] body {
    background-image:
        radial-gradient(circle at 20% 80%, rgba(0, 255, 204, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 0, 170, 0.03) 0%, transparent 50%),
        linear-gradient(180deg, #0a0a0f 0%, #12121a 100%);
    background-attachment: fixed;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2 {
    text-shadow: var(--glow-primary);
}

/* ============================================
   BUTTONS - NEOBRUTALISM STYLE
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    border: var(--border-thick);
    background-color: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-brutal);
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-brutal-hover);
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--border-color);
}

.btn-primary {
    background-color: var(--color-primary);
    color: #000;
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: #fff;
}

.btn-accent {
    background-color: var(--color-accent);
    color: #000;
}

.btn-danger {
    background-color: var(--color-danger);
    color: #fff;
}

/* ============================================
   INPUTS - NEOBRUTALISM STYLE
   ============================================ */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.input-group label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.input {
    padding: 0.875rem 1rem;
    font-family: var(--font-main);
    font-size: 1rem;
    border: var(--border-thick);
    background-color: var(--color-surface);
    color: var(--color-text);
    transition: box-shadow var(--transition-fast);
}

.input:focus {
    outline: none;
    box-shadow: var(--shadow-brutal);
}

[data-theme="dark"] .input:focus {
    box-shadow: var(--glow-primary);
}

.input::placeholder {
    color: var(--color-text-muted);
}

/* ============================================
   CARDS - NEOBRUTALISM STYLE
   ============================================ */
.card {
    background-color: var(--color-surface);
    border: var(--border-thick);
    padding: 1.25rem;
    box-shadow: var(--shadow-brutal);
}

[data-theme="dark"] .card {
    box-shadow: var(--shadow-brutal), var(--glow-primary);
}

.card-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-sm {
    max-width: 600px;
    margin: 0 auto;
}

.container-md {
    max-width: 900px;
    margin: 0 auto;
}

/* ============================================
   HEADER / NAVIGATION
   ============================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--color-bg-secondary);
    border-bottom: var(--border-thick);
    position: relative;
    z-index: 100;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--color-primary);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    flex-shrink: 0;
}

[data-theme="dark"] .logo {
    text-shadow: var(--glow-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nav-auth {
    display: flex;
    gap: 0.75rem;
}

.nav-link {
    font-weight: 700;
    text-decoration: none;
    color: var(--color-text);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-text-muted);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--color-surface);
    border: 3px solid var(--color-text);
    padding: 0.5rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: 3px 3px 0 var(--color-text);
}

.theme-toggle:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--color-text);
}

.theme-toggle:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--color-text);
}

.theme-icon {
    width: 22px;
    height: 22px;
    stroke: var(--color-text);
    fill: none;
}

/* Hamburger Button */
.hamburger-btn {
    background: var(--color-surface);
    border: 3px solid var(--color-text);
    padding: 0.6rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all var(--transition-fast);
    box-shadow: 3px 3px 0 var(--color-text);
}

.hamburger-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--color-text);
}

.hamburger-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--color-text);
}

.hamburger-line {
    width: 20px;
    height: 3px;
    background-color: var(--color-text);
    transition: all var(--transition-fast);
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Hamburger Dropdown Menu */
.hamburger-menu {
    position: fixed;
    top: 70px;
    right: 2rem;
    background-color: var(--color-surface);
    border: var(--border-thick);
    box-shadow: var(--shadow-brutal);
    min-width: 200px;
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.menu-item svg {
    stroke: var(--color-text);
}

.menu-item:hover {
    background-color: var(--color-primary);
    color: #000;
}

.menu-item:hover svg {
    stroke: #000;
}

.menu-item-danger:hover {
    background-color: var(--color-danger);
    color: #fff;
}

.menu-item-danger:hover svg {
    stroke: #fff;
}

.menu-divider {
    height: 2px;
    background-color: var(--border-color);
    margin: 0.25rem 0;
}

/* ============================================
   GAME-SPECIFIC STYLES
   ============================================ */

/* Game Stats Bar */
.game-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.stat-box {
    background-color: var(--color-surface);
    border: var(--border-thick);
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.stat-box .stat-value {
    color: var(--color-primary);
    margin-left: 0.25rem;
}

[data-theme="dark"] .stat-box {
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
}

/* Reactor Visual */
.reactor-container {
    width: 180px;
    height: 180px;
    margin: 2rem auto;
    position: relative;
}

.reactor-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-primary) 0%, var(--color-bg-secondary) 70%);
    border: var(--border-thick);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    animation: reactorPulse 2s ease-in-out infinite;
}

[data-theme="dark"] .reactor-core {
    box-shadow: var(--glow-primary),
        inset 0 0 30px rgba(0, 255, 204, 0.3);
}

.reactor-core:hover {
    transform: scale(1.05);
}

.reactor-core:active {
    transform: scale(0.95);
}

.reactor-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    text-align: center;
    color: var(--color-text);
}

@keyframes reactorPulse {

    0%,
    100% {
        box-shadow: var(--glow-primary);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 255, 204, 0.6),
            inset 0 0 40px rgba(0, 255, 204, 0.4);
    }
}

/* Letter Grid */
.letter-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.letter-box {
    aspect-ratio: 1;
    background-color: var(--color-surface);
    border: var(--border-thick);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.letter-box:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-brutal);
}

.letter-box:active {
    transform: scale(0.9);
}

.letter-box.selected {
    background-color: var(--color-primary);
    color: var(--color-bg);
    transform: scale(0.95);
    animation: letterPop 0.3s ease;
}

[data-theme="dark"] .letter-box.selected {
    box-shadow: var(--glow-primary);
}

/* Letter pop animation on select */
@keyframes letterPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(0.95);
    }
}

/* Ripple effect for letter clicks */
.letter-box::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 255, 204, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
}

.letter-box.ripple::after {
    animation: rippleEffect 0.4s ease-out;
}

@keyframes rippleEffect {
    0% {
        width: 0;
        height: 0;
        opacity: 0.5;
    }

    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

.letter-box .energy-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
}

.letter-box .letter-char {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    transition: transform 0.1s ease;
}

.letter-box:hover .letter-char {
    transform: scale(1.1);
}

.letter-box .letter-energy {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.9rem;
    /* Increased from 0.7rem */
    font-weight: 700;
    color: var(--color-accent);
}

/* ============================================
   TEMPERATURE-BASED REACTOR COLORS
   ============================================ */

/* Temperature levels - applied via JS */
.reactor-container[data-temp-level="cool"] .reactor-core {
    background: radial-gradient(circle, #00ffcc 0%, var(--color-bg-secondary) 70%);
}

[data-theme="dark"] .reactor-container[data-temp-level="cool"] .reactor-core {
    box-shadow: 0 0 30px rgba(0, 255, 204, 0.5), inset 0 0 30px rgba(0, 255, 204, 0.3);
    animation: reactorPulseCool 2s ease-in-out infinite;
}

.reactor-container[data-temp-level="warm"] .reactor-core {
    background: radial-gradient(circle, #ffcc00 0%, var(--color-bg-secondary) 70%);
}

[data-theme="dark"] .reactor-container[data-temp-level="warm"] .reactor-core {
    box-shadow: 0 0 30px rgba(255, 204, 0, 0.5), inset 0 0 30px rgba(255, 204, 0, 0.3);
    animation: reactorPulseWarm 1.5s ease-in-out infinite;
}

.reactor-container[data-temp-level="hot"] .reactor-core {
    background: radial-gradient(circle, #ff6600 0%, var(--color-bg-secondary) 70%);
}

[data-theme="dark"] .reactor-container[data-temp-level="hot"] .reactor-core {
    box-shadow: 0 0 35px rgba(255, 102, 0, 0.6), inset 0 0 35px rgba(255, 102, 0, 0.4);
    animation: reactorPulseHot 1s ease-in-out infinite;
}

.reactor-container[data-temp-level="critical"] .reactor-core {
    background: radial-gradient(circle, #ff3333 0%, #660000 70%);
}

[data-theme="dark"] .reactor-container[data-temp-level="critical"] .reactor-core {
    box-shadow: 0 0 40px rgba(255, 51, 51, 0.7), inset 0 0 40px rgba(255, 51, 51, 0.5);
    animation: reactorPulseCritical 0.5s ease-in-out infinite;
}

@keyframes reactorPulseCool {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 255, 204, 0.4);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 255, 204, 0.7), inset 0 0 30px rgba(0, 255, 204, 0.4);
    }
}

@keyframes reactorPulseWarm {

    0%,
    100% {
        box-shadow: 0 0 25px rgba(255, 204, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 45px rgba(255, 204, 0, 0.8), inset 0 0 35px rgba(255, 204, 0, 0.4);
    }
}

@keyframes reactorPulseHot {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(255, 102, 0, 0.6);
    }

    50% {
        box-shadow: 0 0 50px rgba(255, 102, 0, 0.9), inset 0 0 40px rgba(255, 102, 0, 0.5);
    }
}

@keyframes reactorPulseCritical {

    0%,
    100% {
        box-shadow: 0 0 35px rgba(255, 51, 51, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 60px rgba(255, 51, 51, 1), inset 0 0 50px rgba(255, 51, 51, 0.6);
        transform: scale(1.02);
    }
}

/* Temperature stat box color changes */
.stat-box.temp-display[data-temp-level="cool"] .stat-value {
    color: #00ffcc;
}

.stat-box.temp-display[data-temp-level="warm"] .stat-value {
    color: #ffcc00;
}

.stat-box.temp-display[data-temp-level="hot"] .stat-value {
    color: #ff6600;
}

.stat-box.temp-display[data-temp-level="critical"] .stat-value {
    color: #ff3333;
}

/* Word Display */
.word-display {
    width: 100%;
    max-width: 400px;
    margin: 1.5rem auto;
    padding: 1rem;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    background-color: var(--color-surface);
    border: var(--border-thick);
}

[data-theme="dark"] .word-display {
    box-shadow: var(--glow-primary);
}

/* Notifications */
.notification {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    border: var(--border-thick);
    background-color: var(--color-accent);
    color: #000;
    z-index: 20000;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* XP & Leveling */
.xp-bar-container {
    width: 100%;
    height: 10px;
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-surface);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    width: 0%;
    transition: width 1s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    box-shadow: 0 0 10px var(--color-primary);
}

.levelup-badge {
    margin-top: 0.5rem;
    background-color: var(--color-accent);
    color: #000;
    font-family: var(--font-display);
    font-weight: 900;
    padding: 0.25rem 1rem;
    display: inline-block;
    animation: pulse 1s infinite alternate, popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge {
    background-color: var(--color-surface);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-display);
    border-radius: 4px;
}

@keyframes pulse {
    from {
        transform: scale(1);
        box-shadow: 0 0 5px var(--color-accent);
    }

    to {
        transform: scale(1.05);
        box-shadow: 0 0 15px var(--color-accent);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Tab System */
.tab-container,
.sub-tab-container {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn,
.sub-tab-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover,
.sub-tab-btn:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-text);
}

.tab-btn.active {
    background-color: var(--color-primary);
    color: #000;
    border-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary);
}

.sub-tab-btn.active {
    background-color: var(--color-accent);
    color: #000;
    border-color: var(--color-accent);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal {
    background-color: var(--color-surface);
    border: var(--border-thick);
    box-shadow: var(--shadow-brutal);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ============================================
   SELECT DROPDOWN
   ============================================ */
.select {
    padding: 0.875rem 1rem;
    font-family: var(--font-main);
    font-size: 1rem;
    border: var(--border-thick);
    background-color: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23333' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* ============================================
   LEADERBOARD
   ============================================ */
.leaderboard {
    width: 100%;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: var(--border-thick);
    margin-bottom: -4px;
    background-color: var(--color-surface);
}

.leaderboard-row:first-child {
    background-color: var(--color-accent);
    color: #000;
}

.leaderboard-rank {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.25rem;
    width: 50px;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
}

.leaderboard-score {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-primary);
}

/* ============================================
   SOCIAL LOGIN BUTTONS
   ============================================ */
.btn-google {
    background-color: #fff;
    color: #333;
}


.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background-color: var(--border-color);
}

.divider span {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 14px;
        /* Removed global overflow:hidden to allow scrolling on other pages */
    }

    body {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    /* Lock scroll ONLY when game is active */
    body.game-active {
        height: 100vh;
        overflow: hidden;
    }

    .header {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.25rem 0.5rem;
        height: 52px;
        overflow: hidden;
    }

    .header-right {
        gap: 0.5rem;
    }

    .welcome-text {
        display: none;
        /* Hide on mobile to prevent overflow */
    }

    .nav-auth {
        gap: 0.4rem;
    }

    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .theme-toggle,
    .hamburger-btn {
        width: 40px !important;
        /* Shrunk from 44px */
        height: 40px !important;
        padding: 0.4rem !important;
    }

    .input {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .card {
        padding: 0.75rem;
    }

    .input-group {
        margin-bottom: 0.35rem;
        gap: 0.25rem;
    }

    .input-group label {
        font-size: 0.75rem;
    }

    .divider {
        margin: 0.4rem 0;
    }

    .divider span {
        font-size: 0.75rem;
    }

    #landing-screen.mt-2 {
        margin-top: 0.5rem !important;
    }

    #landing-screen h1 {
        font-size: 1.3rem !important;
        margin-bottom: 0.25rem !important;
    }

    #landing-screen p {
        font-size: 0.85rem !important;
        margin-bottom: 0.5rem !important;
    }

    .logo {
        font-size: 1.1rem;
    }

    /* Main Content Area */
    .container {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 0 0.5rem;
        width: 100%;
        max-width: 100%;
    }

    /* Game Screen: Force fit to viewport height when active */
    #game-screen {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px);
        /* Subtract header with safe margin */
        overflow: hidden;
        padding-bottom: env(safe-area-inset-bottom, 15px);
        justify-content: space-between;
        /* Push elements apart, button to bottom */
    }

    /* Compact Stats Grid - Minimal Margins */
    .game-stats {
        flex: 0 0 auto;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.1rem;
        margin: 0.1rem 0;
        /* Minimal margin */
        width: 100%;
    }

    .stat-box {
        padding: 0.1rem 0.2rem;
        font-size: 0.6rem;
    }

    .stat-box h3 {
        font-size: 0.5rem;
        margin-bottom: 0;
    }

    /* Reactor - Minimal Margins */
    .reactor-container {
        flex: 0 0 auto;
        width: 80px;
        /* Increased from 70px */
        height: 80px;
        margin: 0 auto;
        /* No vertical margin */
    }

    .reactor-label {
        font-size: 0.65rem;
        /* Increased size significantly */
        font-weight: 800;
        letter-spacing: 0.05em;
        line-height: 1;
    }

    /* Active Word Display - Minimal Margins */
    .word-display {
        flex: 0 0 auto;
        font-size: 0.9rem;
        padding: 0.1rem 0.5rem;
        margin: 0.1rem auto;
        min-height: 1.4rem;
        width: 95%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* FLUID LETTER GRID - CONSTRAINED TO LEAVE ROOM FOR BUTTON */
    .letter-grid {
        flex: 0 0 auto !important;
        /* NEVER STRETCH */
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.15rem;
        margin: 0 auto;
        /* No vertical margin */
        width: 85% !important;
        max-width: 270px !important;
        /* Smaller to leave vertical space */
        max-height: 270px !important;
        /* Fixed max height */
    }

    .letter-box {
        aspect-ratio: 1 / 1;
        /* FORCE SQUARE */
        background-color: var(--color-surface);
        border: 2px solid var(--color-border);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: relative;
        /* Critical for ::after layer */
    }

    /* Dynamic font size for massive letters */
    .letter-box .letter-char {
        font-size: 11vmin;
        /* Massive but avoids overlap */
        line-height: 1;
    }

    .letter-box .letter-energy {
        font-size: 4vmin;
        bottom: 1px;
        right: 2px;
        background: none;
        color: var(--color-accent);
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        padding: 0;
        border-radius: 0;
    }

    /* Action area for End Game button */
    #game-screen>div:last-child {
        flex: 0 0 auto;
        margin-top: 0.25rem;
        padding-bottom: env(safe-area-inset-bottom, 10px);
    }

    /* Modal Fixes for Mobile */
    .modal {
        max-width: 95vw;
        max-height: 90vh;
        /* Prevent overflowing screen height */
        display: flex;
        flex-direction: column;
        margin: 20px auto;
    }

    .modal-body {
        overflow-y: auto;
        /* Scrollable content */
        flex: 1;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
        flex-shrink: 0;
    }

    /* Fix Profile Country Select on Mobile */
    #country-select {
        pointer-events: auto;
        /* Ensure clickable */
    }

    /* Horizontal Scrolling for Tabs and Buttons on Mobile */
    .tab-container,
    .sub-tab-container,
    .buddy-tabs,
    .social-sharing-container {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
        justify-content: flex-start !important;
    }

    .tab-container::-webkit-scrollbar,
    .sub-tab-container::-webkit-scrollbar,
    .buddy-tabs::-webkit-scrollbar {
        height: 4px;
    }

    .tab-container::-webkit-scrollbar-thumb,
    .sub-tab-container::-webkit-scrollbar-thumb,
    .buddy-tabs::-webkit-scrollbar-thumb {
        background: var(--color-primary);
    }

    .tab-btn,
    .sub-tab-btn,
    .btn-tab,
    .social-btn {
        flex: 0 0 auto !important;
        min-width: fit-content;
        white-space: nowrap;
    }

    /* Fix Stats Grid for small screens */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .letter-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.25rem;
    }

    .letter-box .letter-char {
        font-size: 11vmin;
    }

    .letter-box .letter-energy {
        font-size: 4vmin;
    }

    .word-display {
        font-size: 0.9rem;
    }

    .container {
        padding: 0 0.35rem;
    }

    .game-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .reactor-container {
        width: 80px;
        height: 80px;
    }

    .reactor-label {
        font-size: 0.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Height-based query for short screens */
@media (max-height: 700px) {
    .reactor-container {
        width: 70px;
        height: 70px;
        margin: 0.25rem auto;
    }

    .reactor-label {
        font-size: 0.55rem;
    }

    .game-stats {
        margin-bottom: 0.25rem;
    }

    .stat-box {
        padding: 0.15rem 0.3rem;
        font-size: 0.65rem;
    }

    .word-display {
        padding: 0.3rem;
        margin: 0.25rem auto;
        font-size: 0.85rem;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================
   PHASE 2 - PROFILE, BUDDIES, STATS, SETTINGS
   ============================================ */

/* Avatar Display */
.avatar-display {
    width: 80px;
    height: 80px;
    border: var(--border-thick);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-display svg {
    width: 60px;
    height: 60px;
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--color-bg);
    border: 2px solid var(--border-color);
}

.avatar-item {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    background: var(--color-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.avatar-item:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.avatar-item.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary);
}

.avatar-item.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.avatar-item.locked::after {
    content: '🔒';
    position: absolute;
    font-size: 0.8rem;
    bottom: 2px;
    right: 2px;
}

.avatar-item svg {
    width: 48px;
    height: 48px;
}

/* Buddy Tabs */
.btn-tab {
    background: var(--color-surface);
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    box-shadow: none;
}

.btn-tab.active {
    background: var(--color-primary);
    color: #000;
    border-color: var(--color-primary);
}

.badge {
    background: var(--color-danger);
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 50%;
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

/* Buddy List */
.buddy-list {
    max-height: 350px;
    overflow-y: auto;
}

.buddy-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    margin-bottom: 0.5rem;
    background: var(--color-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.buddy-item:hover {
    border-color: var(--color-primary);
}

.buddy-item .buddy-avatar {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.buddy-item .buddy-avatar svg {
    width: 100%;
    height: 100%;
}

.buddy-item .buddy-info {
    flex: 1;
}

.buddy-item .buddy-name {
    font-weight: 700;
    font-size: 1rem;
}

.buddy-item .buddy-stats {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.buddy-item .buddy-actions {
    display: flex;
    gap: 0.5rem;
}

.buddy-item.is-rival {
    border-left: 4px solid var(--color-danger);
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 0.5rem;
}

.search-bar .input {
    flex: 1;
}

/* Groups List */
.group-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    margin-bottom: 0.5rem;
    background: var(--color-surface);
}

.group-color {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--color-surface);
    border: var(--border-thick);
    padding: 1rem;
}

.stat-card h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--color-primary);
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Theme Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.theme-card {
    border: 3px solid var(--border-color);
    padding: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.theme-card:hover {
    transform: translateY(-2px);
}

.theme-card.selected {
    border-color: var(--color-primary);
    box-shadow: var(--glow-primary);
}

.theme-preview {
    display: flex;
    gap: 4px;
    margin-bottom: 0.5rem;
    justify-content: center;
}

.theme-preview span {
    width: 20px;
    height: 20px;
}

.theme-name {
    font-size: 0.8rem;
    font-weight: 600;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-text-muted);
    border: 2px solid var(--border-color);
    transition: var(--transition-fast);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: var(--transition-fast);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--color-primary);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(24px);
    background-color: var(--color-bg);
}

/* Setting Row */
.setting-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-row:last-child {
    border-bottom: none;
}

/* Align center utility */
.align-center {
    align-items: center;
}

/* Justify between utility */
.justify-between {
    justify-content: space-between;
}

/* ============================================
   SOCIAL SHARING & SCORE CARDS
   ============================================ */
.social-sharing-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--color-text-muted);
}

.social-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-text);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 3px 3px 0 var(--color-text);
}

.social-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--color-text);
}

.social-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Brand Colors */
.btn-x:hover {
    background-color: #000;
    color: #fff;
}


.btn-linkedin:hover {
    background-color: #0A66C2;
    color: #fff;
}

.btn-reddit:hover {
    background-color: #FF4500;
    color: #fff;
}

.btn-pinterest:hover {
    background-color: #BD081C;
    color: #fff;
}

.btn-threads:hover {
    background-color: #000;
    color: #fff;
}

.btn-whatsapp:hover {
    background-color: #25D366;
    color: #fff;
}

.btn-telegram:hover {
    background-color: #0088CC;
    color: #fff;
}

.btn-instagram:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
}

/* Score Card Preview */
.score-card-preview {
    max-width: 100%;
    border: var(--border-thick);
    box-shadow: var(--shadow-brutal);
    margin: 1rem 0;
}

#score-card-canvas {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
}

.score-card-preview-mini {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    border: 3px solid var(--color-text);
    box-shadow: 6px 6px 0 var(--color-text);
    background: var(--color-bg-secondary);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.score-card-preview-mini img {
    width: 100%;
    height: auto;
    display: block;
}

.menu-item.no-hover {
    cursor: default;
    background: transparent !important;
}

.menu-item.no-hover:hover {
    transform: none !important;
    box-shadow: none !important;
}

.share-action-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: 2rem 1rem;
    background-color: var(--color-bg);
    border-top: var(--border-thick);
    text-align: center;
}

/* Desktop: Push footer to bottom of viewport */
@media (min-width: 769px) {
    body {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    main.container {
        flex: 1;
    }

    .footer {
        margin-top: auto;
    }
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.social-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: var(--color-surface);
    border: var(--border-thick);
    color: var(--color-text);
    box-shadow: var(--shadow-brutal);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 0;
    /* Neobrutalism */
    text-decoration: none;
    /* Ensure no underline */
}

.social-icon-link:hover {
    transform: translate(-4px, -4px);
    box-shadow: 8px 8px 0 var(--color-text);
    color: var(--color-primary);
}

.social-icon-link svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   PERFORMANCE & VALIDATION STATES
   ============================================ */

.letter-grid.grid-locked {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait;
    filter: grayscale(0.2) blur(0.5px);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.pulsate {
    animation: pulsate-text 1s ease-in-out infinite;
    display: inline-block;
}

@keyframes pulsate-text {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

#reactor-button:disabled {
    cursor: not-allowed;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-muted);
    border-color: var(--color-text-muted);
    box-shadow: none;
    transform: none;
}

/* ============================================
   HOLOGRAPHIC & SCANNER EFFECTS
   ============================================ */
@keyframes scanner {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(400%);
    }
}

@keyframes holographic {
    0% {
        opacity: 0.8;
        filter: brightness(1);
    }

    50% {
        opacity: 1;
        filter: brightness(1.2);
    }

    100% {
        opacity: 0.8;
        filter: brightness(1);
    }
}

.rival-scanner {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--color-primary);
    box-shadow: inset 0 0 15px rgba(0, 255, 200, 0.2);
    animation: holographic 2s ease-in-out infinite;
}

.rival-scanner::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(180deg, transparent, var(--color-primary), transparent);
    animation: scanner 3s linear infinite;
    opacity: 0.2;
    pointer-events: none;
}

.btn-icon-sm {
    padding: 2px 8px;
    font-size: 0.75rem;
    border-width: 2px;
    box-shadow: 2px 2px 0 var(--border-color);
}

.btn-icon-sm:hover {
    box-shadow: 3px 3px 0 var(--border-color);
}

.text-glow {
    text-shadow: 0 0 10px var(--color-primary);
}

/* ============================================
   TABS SYSTEM
   ============================================ */
.tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text);
    opacity: 0.5;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.6rem 0.5rem;
    transition: all 0.2s;
    letter-spacing: 1px;
    border-radius: 4px;
}

.tab-btn.active {
    background: var(--color-primary);
    color: #000;
    opacity: 1;
    box-shadow: 0 0 15px rgba(0, 255, 200, 0.4);
}

.tab-btn:hover:not(.active) {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.05);
}

/* Hint and Bubble Styles */
.highlight-hint {
    background-color: var(--color-accent) !important;
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--color-accent);
    transition: all 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    90% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* Gameplay Buttons (Hint/Shuffle) */
.word-display-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.game-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #444;
    background: #222;
    color: #666;
    font-weight: bold;
    font-size: 20px;
    cursor: not-allowed;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.game-btn.inactive {
    opacity: 0.5;
    box-shadow: none;
}

.game-btn.active {
    cursor: pointer;
    color: #fff;
    border-color: #fff;
    animation: pulseGlow 1.5s infinite alternate;
}

#hint-btn.active {
    background: var(--color-accent, #00ffc8);
    color: #000;
    box-shadow: 0 0 15px var(--color-accent);
    border-color: #000;
}

#shuffle-btn.active {
    background: #ff4757;
    color: #fff;
    box-shadow: 0 0 15px #ff4757;
    border-color: #fff;
}

@keyframes pulseGlow {
    from {
        transform: scale(1);
        box-shadow: 0 0 10px currentColor;
    }

    to {
        transform: scale(1.05);
        box-shadow: 0 0 20px currentColor;
    }
}

/* Mobile Positioning */
@media (max-width: 600px) {
    .word-display-container {
        margin-top: 15px;
        /* Space for buttons */
    }

    .game-btn {
        position: absolute;
        top: -25px;
        /* Half overlapping or just above */
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    #hint-btn {
        left: 0;
    }

    #shuffle-btn {
        right: 0;
    }
}


/* Hint Order Badge */
.hint-order-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--color-accent, #00ffc8);
    color: #000;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: popIn 0.3s ease;
}

.word-display.hint-active {
    background: rgba(0, 255, 200, 0.2);
    border-color: var(--color-accent, #00ffc8);
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 5px var(--color-accent);
    }

    50% {
        box-shadow: 0 0 20px var(--color-accent);
    }
}


.footer-link {
    color: inherit;
    text-decoration: none;
    margin: 0 10px;
    white-space: nowrap;
}

/* Smartphone Specific Adjustments */
@media screen and (max-width: 480px) {
    .footer-links {
        font-size: 0.75rem !important;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 3px;
    }

    .footer-link {
        margin: 0 2px !important;
    }

    .stat-box {
        border-width: 2px !important;
        font-size: 1.15rem !important;
        padding: 0.4rem 0.6rem !important;
        flex: 1 1 40%;
        min-width: 140px;
    }
}

/* ============================================
   PWA INSTALL BUTTON & TOOLTIP
   ============================================ */
#pwa-install-btn {
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

#pwa-install-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -100%;
        top: -100%;
    }

    20% {
        left: 100%;
        top: 100%;
    }

    100% {
        left: 100%;
        top: 100%;
    }
}

.ios-pwa-tooltip {
    background: var(--color-surface);
    color: var(--color-text);
    border: var(--border-thick);
    box-shadow: var(--shadow-brutal);
    animation: slideUp 0.3s ease-out;
    max-width: 280px;
    line-height: 1.4;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

[data-theme="dark"] .ios-pwa-tooltip {
    box-shadow: var(--glow-primary);
}

/* ============================================
   SCROLL HINT (Mobile Game Over Modal)
   ============================================ */
.scroll-hint {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px;
    background: linear-gradient(transparent, var(--color-surface) 40%);
    color: var(--color-accent);
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: scrollBounce 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.scroll-hint.fade-out {
    opacity: 0;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}