﻿:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --turn-active: #22c55e;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100svh;
    width: 100%;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', system-ui, sans-serif;
    overflow: hidden; /* Prevents bounce scrolling on iOS Safari */
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

.story-container {
    display: flex;
    flex-direction: column;
    height: 100svh;
    width: 100%;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background-color: var(--surface-color);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.brand {
    font-weight: 700;
    font-size: 1.2rem;
}

.btn-share, .btn-submit {
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 0 12px var(--accent-glow);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

    .btn-share:active, .btn-submit:active {
        transform: scale(0.95);
        box-shadow: 0 0 4px var(--accent-glow);
    }

    .btn-submit:disabled {
        background-color: var(--surface-hover);
        box-shadow: none;
        cursor: not-allowed;
        color: var(--text-sub);
        transform: none;
    }

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
    gap: 1rem;
}

.story-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    scroll-behavior: smooth;
}

.story-text {
    font-size: 1.5rem;
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
}

    .story-text.empty {
        color: var(--text-sub);
        font-style: italic;
    }

.turn-indicator {
    text-align: center;
    font-weight: 600;
    color: var(--text-sub);
    padding: 0.75rem;
    border-radius: 8px;
    background-color: var(--surface-color);
    transition: all 0.2s ease;
}

    .turn-indicator.my-turn {
        color: var(--text-main);
        background-color: rgba(34, 197, 94, 0.15);
        border: 1px solid var(--turn-active);
        box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
    }

.input-area {
    display: flex;
    gap: 0.5rem;
    background-color: var(--surface-color);
    padding: 0.5rem;
    border-radius: 12px;
}

#word-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    padding: 0.5rem;
    outline: none;
    font-family: inherit;
    transition: border-bottom 0.2s ease;
}

    #word-input:disabled {
        opacity: 0.5;
    }

.app-footer {
    background-color: var(--surface-color);
    padding: 2rem 1.5rem;
    position: sticky;
    bottom: 0;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.username-input {
    width: 100%;
    background-color: var(--bg-color);
    border: 1px solid var(--surface-hover);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    text-align: center;
    font-family: inherit;
    box-sizing: border-box;
}

    .username-input:focus {
        border-color: var(--accent);
    }

.players-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.player-badge {
    background-color: var(--bg-color);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: var(--text-sub);
    border: 1px solid var(--surface-hover);
    transition: all 0.2s ease;
}

    .player-badge.active-turn {
        border-color: var(--turn-active);
        color: var(--turn-active);
        font-weight: 600;
    }
