/**
 * Improv Olympics - Main Stylesheet (LiveKit Version)
 * WCAG 2.1 AA Compliant
 */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */

:root {
    /* Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Text */
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-light: #6b7280;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Focus */
    --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.4);

    /* Mood visualization */
    --mood-bg-color: rgb(230, 230, 250);
    --mood-transition: background-color 1500ms ease-in-out;
}

/* ============================================
   Base Styles
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
}

p {
    margin: 0 0 var(--space-md);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    cursor: pointer;
    font-family: inherit;
}

/* Focus styles for accessibility */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

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

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: var(--space-sm) var(--space-md);
    z-index: 100;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   Layout
   ============================================ */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ============================================
   Navigation
   ============================================ */

.nav-container {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-md) 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.logo-link {
    text-decoration: none;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

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

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

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

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

.btn-large {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
}

.btn-small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    padding: var(--space-2xl) 0;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--gray-50) 100%);
}

.hero-title {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-lg);
}

.hero-highlight {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(99, 102, 241, 0.1);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-lg);
}

.hero-actions {
    margin-top: var(--space-lg);
}

/* ============================================
   Announcement Banner
   ============================================ */

.announcement-banner {
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: var(--space-sm) 0;
}

.announcement-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
}

.announcement-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

/* ============================================
   Features Section
   ============================================ */

.features {
    padding: var(--space-2xl) 0;
}

.section-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: var(--space-xl);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
}

.feature-card {
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-card-highlight {
    border-color: var(--primary);
    position: relative;
}

.feature-badge {
    position: absolute;
    top: -10px;
    right: var(--space-md);
    background: var(--primary);
    color: white;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: 700;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
}

.feature-title {
    font-size: 1.125rem;
    margin-bottom: var(--space-sm);
}

.feature-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================
   About Section
   ============================================ */

.about {
    padding: var(--space-2xl) 0;
    background: var(--bg-tertiary);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.about-benefits {
    margin-top: var(--space-xl);
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
}

.benefits-title {
    font-size: 1.125rem;
    margin-bottom: var(--space-md);
}

.benefits-list {
    margin: 0;
    padding-left: var(--space-lg);
}

.benefits-list li {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

/* ============================================
   Footer
   ============================================ */

.footer {
    padding: var(--space-xl) 0;
    text-align: center;
    background: var(--gray-800);
    color: white;
}

.footer-text {
    margin: 0;
    font-size: 0.875rem;
}

.footer-secondary {
    color: var(--gray-400);
    margin-top: var(--space-sm);
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content-wide {
    max-width: 700px;
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.modal-actions,
.form-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    margin-top: var(--space-lg);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.form-input[aria-invalid="true"] {
    border-color: var(--danger);
}

.form-input[aria-invalid="true"]:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

.form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
    min-height: 1.25rem;
}

.form-error:empty {
    display: none;
}

.form-hint {
    color: var(--text-light);
    font-size: 0.75rem;
    margin-top: var(--space-xs);
}

/* ============================================
   Auth Modal
   ============================================ */

.auth-modal-content {
    max-width: 400px;
}

.auth-tabs {
    display: flex;
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
}

.auth-tab {
    flex: 1;
    padding: var(--space-md);
    background: none;
    border: none;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-tab-active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.875rem;
    text-align: left;
    padding: 0;
    margin-bottom: var(--space-md);
    cursor: pointer;
}

.auth-link-btn:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--space-md) 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

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

.auth-divider span {
    padding: 0 var(--space-md);
}

.google-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.google-icon {
    width: 20px;
    height: 20px;
}

.auth-terms {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    margin-top: var(--space-md);
}

.auth-notice {
    text-align: center;
    padding: var(--space-lg);
}

.notice-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
}

/* ============================================
   Mode Selection
   ============================================ */

.mode-selection-container {
    margin-bottom: var(--space-lg);
}

.mode-selection-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.mode-selector {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mode-btn:hover {
    background: var(--gray-200);
}

.mode-btn-active {
    background: var(--bg-primary);
    border-color: var(--primary);
}

.mode-icon {
    font-size: 1.5rem;
}

.mode-label {
    font-weight: 600;
}

.mode-description {
    font-size: 0.75rem;
    color: var(--text-light);
}

.mode-helper-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.mic-permission-warning {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    margin-top: var(--space-sm);
}

.warning-icon {
    font-size: 1.25rem;
}

.warning-text {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* ============================================
   Game Selection Grid
   ============================================ */

.game-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.game-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    background: var(--bg-primary);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.game-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.game-card:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.game-card-selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.game-card-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.game-card-difficulty {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: capitalize;
}

.game-card-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

.difficulty-beginner .game-card-difficulty {
    color: var(--success);
}

.difficulty-intermediate .game-card-difficulty {
    color: var(--warning);
}

.difficulty-advanced .game-card-difficulty {
    color: var(--danger);
}

.selected-game-info {
    background: var(--gray-100);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.selected-game-header {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.selected-label {
    color: var(--text-light);
}

.selected-game-name {
    font-weight: 600;
}

.selected-game-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.games-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-light);
}

.games-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-xl);
    color: var(--danger);
}

.modal-instruction {
    font-size: 0.875rem;
    color: var(--text-light);
    text-align: center;
}

/* ============================================
   Chat Page Layout
   ============================================ */

.chat-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    background: var(--mood-bg-color);
    transition: var(--mood-transition);
}

@media (min-width: 768px) {
    .chat-container {
        flex-direction: row;
    }
}

/* ============================================
   Session Info Panel
   ============================================ */

.session-info {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-md);
}

@media (min-width: 768px) {
    .session-info {
        width: 280px;
        border-bottom: none;
        border-right: 1px solid var(--gray-200);
    }
}

.session-info-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.session-info-summary::-webkit-details-marker {
    display: none;
}

.info-title {
    font-size: 1rem;
    margin: 0;
}

.session-info-toggle::after {
    content: '▼';
    font-size: 0.75rem;
    color: var(--text-light);
}

details[open] .session-info-toggle::after {
    content: '▲';
}

@media (min-width: 768px) {
    .session-info-toggle {
        display: none;
    }
}

.session-info-body {
    padding-top: var(--space-md);
}

.info-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.info-item {
    display: flex;
    justify-content: space-between;
}

.info-label {
    color: var(--text-light);
    font-size: 0.875rem;
}

.info-value {
    font-weight: 500;
    font-size: 0.875rem;
}

.status-active {
    color: var(--success);
}

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

.status-recording {
    color: var(--danger);
}

.status-processing {
    color: var(--warning);
}

.status-playing {
    color: var(--info);
}

.status-disconnected,
.status-error {
    color: var(--danger);
}

.help-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-200);
}

.help-title {
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.help-list {
    margin: var(--space-sm) 0 0;
    padding-left: var(--space-md);
    font-size: 0.75rem;
    color: var(--text-light);
}

.help-list li {
    margin-bottom: var(--space-xs);
}

/* ============================================
   Chat Section
   ============================================ */

.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* ============================================
   Messages
   ============================================ */

.message {
    max-width: 80%;
}

.message-user {
    align-self: flex-end;
}

.message-partner,
.message-mc,
.message-coach,
.message-room,
.message-agent,
.message-system {
    align-self: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.message-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.message-time {
    font-size: 0.625rem;
    color: var(--text-light);
}

.message-bubble {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.message-user .message-bubble {
    background: var(--primary);
    color: white;
}

.message-mc .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-mc .message-role {
    color: var(--primary);
}

.message-partner .message-bubble {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(139, 92, 246, 0.02));
    border-left: 3px solid var(--secondary);
}

.message-partner .message-role {
    color: var(--secondary);
}

.message-room .message-bubble {
    background: rgba(16, 185, 129, 0.08);
    border-left: 3px solid var(--success);
}

.message-room .message-role {
    color: var(--success);
}

.message-coach .message-bubble {
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--info);
}

.message-coach .message-role {
    color: var(--info);
}

.message-system .message-bubble {
    background: var(--gray-100);
    text-align: center;
    font-style: italic;
    color: var(--text-secondary);
}

.message-text {
    margin: 0;
    word-wrap: break-word;
}

/* ============================================
   Live Transcription (typing indicator)
   ============================================ */

.live-transcription {
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    border-left: 3px solid var(--primary-light);
    animation: fadeIn 0.2s ease-out;
}

.live-transcription-content {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.live-transcription-content.live-user {
    border-left-color: var(--primary);
}

.live-transcription-content.live-agent {
    border-left-color: var(--secondary);
}

.live-speaker {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.live-user .live-speaker {
    color: var(--primary-dark);
}

.live-agent .live-speaker {
    color: var(--secondary);
}

.live-text {
    color: var(--text-primary);
    font-style: italic;
    opacity: 0.9;
}

.live-indicator {
    animation: blink 1s infinite;
    color: var(--text-light);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

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

/* ============================================
   Chat Input
   ============================================ */

.chat-input-form {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-primary);
    border-top: 1px solid var(--gray-200);
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-input {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    resize: none;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.input-meta {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-xs);
}

.char-count,
.input-help {
    font-size: 0.75rem;
    color: var(--text-light);
}

.btn-send {
    align-self: flex-end;
}

/* ============================================
   Typing Indicator
   ============================================ */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    margin: var(--space-md);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-text {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
}

/* ============================================
   Loading Overlay
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

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

.loading-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: var(--space-md);
    background: var(--gray-800);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
    color: var(--gray-900);
}

.toast-message {
    font-size: 0.875rem;
}

/* ============================================
   Session Counter
   ============================================ */

.session-counter {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.session-icon {
    font-size: 1rem;
}

.btn-upgrade {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

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

/* ============================================
   Game Options (In Chat)
   ============================================ */

.game-options {
    background: var(--gray-100);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin: var(--space-md) 0;
}

.game-options-header {
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.game-options-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.game-option-btn {
    display: flex;
    flex-direction: column;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.game-option-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.game-option-btn .game-name {
    font-weight: 500;
}

.game-option-btn .game-difficulty {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 640px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: var(--space-md);
        margin: var(--space-md);
    }

    .game-selection-grid {
        grid-template-columns: 1fr 1fr;
    }

    .message {
        max-width: 90%;
    }

    .nav-actions {
        gap: var(--space-sm);
    }

    .btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.75rem;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
