:root {
    --bg-dark: #08100A;
    --bg-card: rgba(14, 26, 17, 0.92);
    --bg-surface: rgba(20, 36, 24, 0.7);
    --emerald-primary: #10B981;
    --emerald-light: #34D399;
    --emerald-dark: #059669;
    --emerald-glow: rgba(16, 185, 129, 0.35);
    --coral-primary: #EF4444;
    --coral-light: #F87171;
    --coral-dark: #DC2626;
    --coral-glow: rgba(239, 68, 68, 0.35);
    --gold-primary: #F59E0B;
    --gold-light: #FCD34D;
    --gold-glow: rgba(245, 158, 11, 0.35);
    --border-glass: rgba(16, 185, 129, 0.25);
    --text-main: #FFFFFF;
    --text-muted: #9CA3AF;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { background: var(--bg-dark); color: var(--text-main); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }

/* Header */
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: rgba(8, 16, 10, 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-glass); position: sticky; top: 0; z-index: 100; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.35rem; font-weight: 900; letter-spacing: 1px; color: var(--emerald-light); cursor: pointer; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.select-input { background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-glass); border-radius: var(--radius-sm); padding: 6px 10px; font-weight: 700; outline: none; cursor: pointer; }
.icon-btn { background: var(--bg-surface); border: 1px solid var(--border-glass); border-radius: var(--radius-sm); color: var(--text-main); padding: 6px 12px; font-size: 1.1rem; cursor: pointer; transition: all 0.2s; }
.icon-btn:hover { border-color: var(--emerald-primary); }

/* Main Container */
.main-content { flex: 1; max-width: 680px; width: 100%; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 20px; }

/* 3D Tactile Cards */
.card { background: var(--bg-card); border: 1.5px solid var(--border-glass); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); backdrop-filter: blur(12px); }
.card-title { font-size: 1.4rem; font-weight: 900; margin-bottom: 8px; color: var(--text-main); }
.card-subtitle { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 18px; }

/* 3D Tactile Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: var(--radius-md); font-weight: 800; font-size: 1rem; cursor: pointer; border: none; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.12s ease-in-out; text-decoration: none; user-select: none; }
.btn-primary { background: linear-gradient(180deg, var(--emerald-light) 0%, var(--emerald-primary) 100%); color: #042111; box-shadow: 0 4px 0 var(--emerald-dark), 0 8px 16px var(--emerald-glow); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--emerald-dark); }
.btn-coral { background: linear-gradient(180deg, var(--coral-light) 0%, var(--coral-primary) 100%); color: #FFFFFF; box-shadow: 0 4px 0 var(--coral-dark), 0 8px 16px var(--coral-glow); }
.btn-coral:active { transform: translateY(4px); box-shadow: 0 0 0 var(--coral-dark); }
.btn-gold { background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-primary) 100%); color: #351C03; box-shadow: 0 4px 0 #D97706, 0 8px 16px var(--gold-glow); }
.btn-gold:active { transform: translateY(4px); box-shadow: 0 0 0 #D97706; }
.btn-subtle { background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-glass); }
.btn-subtle:hover { border-color: var(--emerald-primary); }
.btn-block { width: 100%; }

/* Form Fields */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.text-input { background: rgba(5, 12, 7, 0.85); border: 1.5px solid var(--border-glass); border-radius: var(--radius-sm); color: #FFFFFF; font-size: 1.1rem; font-weight: 700; padding: 12px 16px; outline: none; transition: border-color 0.2s; }
.text-input:focus { border-color: var(--emerald-light); box-shadow: 0 0 0 3px var(--emerald-glow); }

/* Game Modes Grid */
.modes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.mode-card { background: var(--bg-surface); border: 2px solid transparent; border-radius: var(--radius-md); padding: 14px; text-align: center; cursor: pointer; transition: all 0.2s; }
.mode-card:hover { transform: translateY(-2px); border-color: var(--border-glass); }
.mode-card.selected { border-color: var(--emerald-primary); background: rgba(16, 185, 129, 0.12); box-shadow: 0 0 20px var(--emerald-glow); }
.mode-icon { font-size: 2rem; margin-bottom: 6px; }
.mode-title { font-size: 1rem; font-weight: 800; }
.mode-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* 3D Tactile Letter Pair Tiles (Cross-Platform Olive & Clay Tokens) */
.pair-display { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 14px; background: rgba(0, 0, 0, 0.3); border: 1.5px solid var(--border-glass); border-radius: var(--radius-lg); margin-bottom: 20px; }
.pair-tiles { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 440px; }
.letter-tile { flex: 1; min-width: 120px; padding: 12px 14px 16px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; border: 2px solid rgba(255, 255, 255, 0.25); }
.letter-tile.tile-start { background: linear-gradient(180deg, #285C3A 0%, #1B4028 100%); box-shadow: 0 6px 0 #132E1D, 0 10px 20px rgba(40, 92, 58, 0.4); }
.letter-tile.tile-end { background: linear-gradient(180deg, #DE4E33 0%, #B8371F 100%); box-shadow: 0 6px 0 #85220F, 0 10px 20px rgba(222, 78, 51, 0.4); }
.tile-badge { background: rgba(0, 0, 0, 0.22); border-radius: var(--radius-pill); padding: 3px 12px; font-size: 0.72rem; font-weight: 800; letter-spacing: 1px; color: #FFFFFF; margin-bottom: 6px; text-transform: uppercase; }
.tile-char { font-family: serif, 'Times New Roman'; font-size: 4.2rem; font-weight: 900; line-height: 1; color: #FFFFFF; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.tile-dash { font-size: 2rem; font-weight: 900; color: var(--text-muted); letter-spacing: 4px; }
.pair-instruction { font-size: 0.9rem; font-weight: 800; color: var(--emerald-light); margin-top: 12px; letter-spacing: 1px; text-transform: uppercase; text-align: center; }

/* Word Input Bar */
.input-bar { display: flex; gap: 10px; margin-bottom: 12px; }
.word-field { flex: 1; background: rgba(5, 12, 7, 0.95); border: 2px solid var(--border-glass); border-radius: var(--radius-md); color: #FFFFFF; font-size: 1.3rem; font-weight: 900; letter-spacing: 2px; padding: 14px 18px; outline: none; text-transform: uppercase; transition: all 0.2s; }
.word-field:focus { border-color: var(--emerald-light); box-shadow: 0 0 0 4px var(--emerald-glow); }
.btn-mic { font-size: 1.4rem; padding: 12px 18px; border-radius: var(--radius-md); }
.btn-mic.listening { background: var(--coral-primary); border-color: var(--coral-light); animation: pulseCoral 1s infinite alternate; }
@keyframes pulseCoral { from { box-shadow: 0 0 8px var(--coral-glow); } to { box-shadow: 0 0 24px var(--coral-primary); } }

/* Arena Stats Bar */
.stats-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: var(--bg-surface); border: 1px solid var(--border-glass); border-radius: var(--radius-md); margin-bottom: 16px; }
.player-score { display: flex; flex-direction: column; }
.player-name { font-size: 0.85rem; font-weight: 800; color: var(--text-muted); }
.score-num { font-size: 1.6rem; font-weight: 900; color: var(--emerald-light); }
.timer-badge { display: flex; align-items: center; gap: 6px; font-size: 1.25rem; font-weight: 900; padding: 4px 12px; border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border-glass); }
.timer-badge.urgent { color: var(--coral-light); border-color: var(--coral-primary); animation: pulseCoral 0.5s infinite alternate; }

/* Bomb Canvas & Word Rally Hot Potato */
.bomb-container { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; margin: 12px 0; background: rgba(239, 68, 68, 0.08); border: 1.5px solid var(--coral-primary); border-radius: var(--radius-lg); box-shadow: 0 0 24px var(--coral-glow); }
.bomb-icon { font-size: 3.4rem; animation: bombPulse 0.7s infinite alternate ease-in-out; }
@keyframes bombPulse { from { transform: scale(1); } to { transform: scale(1.15); } }
.bomb-fuse-text { font-size: 1.1rem; font-weight: 800; color: var(--coral-light); margin-top: 6px; }
.rally-feed { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.rally-tag { background: rgba(239, 68, 68, 0.18); border: 1px solid var(--coral-primary); color: var(--coral-light); font-size: 0.85rem; font-weight: 800; padding: 3px 10px; border-radius: var(--radius-pill); }

/* Solo Blitz Rush Arcade */
.rush-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: rgba(35, 30, 15, 0.8); border: 1.5px solid var(--gold-primary); border-radius: var(--radius-md); margin-bottom: 16px; }
.rush-timer { font-size: 1.8rem; font-weight: 900; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.rush-multiplier { font-size: 1.3rem; font-weight: 900; color: var(--gold-light); background: rgba(245, 158, 11, 0.2); padding: 4px 12px; border-radius: var(--radius-pill); border: 1px solid var(--gold-primary); }
.rush-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.rush-tag { background: rgba(16, 185, 129, 0.18); border: 1px solid var(--emerald-primary); color: var(--emerald-light); font-size: 0.85rem; font-weight: 800; padding: 4px 10px; border-radius: var(--radius-pill); }

/* Toast Notifications */
.toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 2000; pointer-events: none; }
.toast { background: rgba(14, 26, 17, 0.95); border: 1.5px solid var(--emerald-light); color: #FFFFFF; padding: 12px 24px; border-radius: var(--radius-pill); font-size: 0.92rem; font-weight: 800; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 20px var(--emerald-glow); }
.toast.toast-error { border-color: var(--coral-primary); box-shadow: 0 0 20px var(--coral-glow); color: var(--coral-light); }

/* Utility */
.validation-msg { font-size: 0.92rem; font-weight: 800; color: var(--coral-light); text-align: center; min-height: 22px; margin-bottom: 8px; }
.validation-msg.success { color: var(--emerald-light); }
.hidden { display: none !important; }

.solo-explainer {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-glass);
}

/* Visible Version Badges & Footer (Matching Android and iOS Design) */
.brand-version-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--border-glass);
    color: var(--emerald-light);
    letter-spacing: 0.5px;
}

.version-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0 16px;
    width: 100%;
}

.version-capsule {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    font-size: 0.75rem;
    font-weight: 600;
}

.ver-client {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
}

.ver-dot {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.65rem;
}

.ver-api {
    color: var(--emerald-light);
    font-weight: 700;
}

.ver-server {
    color: var(--coral-light);
    font-weight: 600;
}
