/* ==========================================================================
   GAME 03: STORY CHAOS PREMIUM STYLESHEET
   ========================================================================== */

.story-chaos-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 14px;
}

/* -------------------------------------------------------------
   Top HUD (Genre, Title, Word Count, Turn, Authoritative Timer)
   ------------------------------------------------------------- */
.sc-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-surface, #10131B);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    gap: 10px;
    flex-wrap: wrap;
}

.sc-hud-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 130px;
}

.sc-badge-genre {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--orange, #FF8A3D);
    letter-spacing: 0.8px;
}

.sc-story-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}

.sc-hud-center {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sc-hud-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sc-hud-right {
    display: flex;
    align-items: center;
}

.sc-timer-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 138, 61, 0.12);
    border: 1.5px solid var(--orange, #FF8A3D);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--orange, #FF8A3D);
    transition: all 0.2s ease;
}

.sc-timer-unit {
    font-size: 0.8rem;
    font-weight: 600;
}

.sc-timer-pill.timer-warning {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
    animation: scPulse 1s infinite alternate;
}

.sc-timer-pill.timer-expired {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    font-size: 0.95rem;
}

@keyframes scPulse {
    from {
        transform: scale(1);
        box-shadow: 0 0 4px rgba(239, 68, 68, 0.3);
    }
    to {
        transform: scale(1.06);
        box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
    }
}

/* -------------------------------------------------------------
   Shared Story Panel - Large, Legible & Real-time
   ------------------------------------------------------------- */
.sc-story-panel {
    background: var(--bg-surface, #10131B);
    border: 2px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    min-height: 180px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sc-story-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
}

.sc-story-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--orange, #FF8A3D);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sc-starter-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 8px;
}

.sc-story-content {
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-weight: 400;
    white-space: pre-wrap;
    word-break: break-word;
}

/* -------------------------------------------------------------
   Play & Turn Grid
   ------------------------------------------------------------- */
.sc-play-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 14px;
    width: 100%;
}

.sc-input-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-surface, #10131B);
    border-radius: var(--border-radius);
    padding: 18px;
    border: 1px solid var(--border-subtle);
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.sc-turn-status-msg {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.sc-turn-status-msg.active-turn {
    color: var(--orange, #FF8A3D);
}

.sc-turn-status-msg.waiting-turn {
    color: var(--text-muted);
}

/* Article Bonus Banner */
.sc-bonus-banner {
    background: linear-gradient(90deg, var(--orange) 0%, var(--gold-primary) 100%);
    color: #08090D;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: scPulse 1.5s infinite alternate;
    box-shadow: 0 4px 15px rgba(255, 138, 61, 0.3);
}

/* Punctuation Row */
.sc-punct-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sc-punct-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sc-punct-buttons {
    display: flex;
    gap: 6px;
}

.sc-punct-btn {
    width: 34px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.sc-punct-btn.sc-punct-clear {
    width: auto;
    padding: 0 10px;
    font-size: 0.75rem;
}

.sc-punct-btn:hover {
    border-color: var(--orange);
    background: rgba(255, 138, 61, 0.12);
}

.sc-punct-btn.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #08090D;
    box-shadow: 0 0 8px rgba(255, 138, 61, 0.4);
}

.sc-input-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.sc-word-input {
    flex: 1;
    background: var(--bg-card, #181C27);
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: var(--font-main);
    color: var(--text-primary);
    font-size: 1.1rem;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.sc-word-input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 12px rgba(255, 138, 61, 0.3);
}

.sc-word-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-surface);
}

.btn-sc-submit {
    margin: 0;
    width: auto;
    min-height: unset;
    padding: 12px 22px;
    font-weight: 700;
}

/* -------------------------------------------------------------
   Sidebar Turn Order & Live Scores
   ------------------------------------------------------------- */
.sc-turn-sidebar {
    background: var(--bg-surface, #10131B);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.sc-sidebar-title {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 800;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 6px;
}

.sc-player-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sc-player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 79, 112, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.sc-player-card-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sc-player-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.sc-player-indicator {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
}

.sc-player-score {
    font-weight: 800;
    color: var(--primary);
    font-size: 0.9rem;
}

.sc-player-card.active {
    background: var(--bg-card, #181C27);
    border-color: var(--orange, #FF8A3D);
    box-shadow: 0 4px 14px rgba(255, 138, 61, 0.25);
}

/* -------------------------------------------------------------
   Host Controls & Final Results View
   ------------------------------------------------------------- */
.sc-host-actions {
    display: flex;
    justify-content: flex-end;
}

.sc-results-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 26px 16px;
    width: 100%;
    background: var(--bg-surface, #10131B);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 20px;
    max-width: 800px;
    margin: 0 auto;
    gap: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.sc-results-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.sc-results-genre-badge {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 1px;
}

.sc-results-complete-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-color);
    margin: 0;
}

.sc-results-story-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0;
}

.sc-results-twist-card {
    background: rgba(245, 158, 11, 0.1);
    border: 1.5px dashed #f59e0b;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 0.95rem;
    color: var(--text-color);
    display: flex;
    gap: 8px;
    align-items: center;
    max-width: 680px;
    width: 100%;
}

.sc-twist-tag {
    font-weight: 800;
    color: #f59e0b;
}

.sc-final-story-container {
    width: 100%;
    max-width: 680px;
    text-align: left;
}

.sc-final-story-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 800;
}

.sc-final-story-card {
    background: rgba(0, 0, 0, 0.03);
    border: 1.5px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-height: 360px;
    overflow-y: auto;
    font-size: 1.25rem;
    line-height: 1.9;
    color: var(--text-color);
    word-break: break-word;
}

.sc-story-word {
    display: inline-block;
    margin-right: 2px;
}

.sc-word-author {
    font-size: 0.65rem;
    color: var(--primary);
    background: rgba(255, 79, 112, 0.08);
    border-radius: 4px;
    padding: 1px 4px;
    margin-left: 2px;
    vertical-align: super;
    font-weight: 600;
    white-space: nowrap;
}

.sc-word-author.prompt-tag {
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.06);
}

.sc-final-scores-section {
    width: 100%;
    max-width: 680px;
}

.sc-scores-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.sc-scores-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.sc-scores-table th, .sc-scores-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.sc-scores-table th {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
}

.sc-read-aloud-widget {
    background: rgba(255, 79, 112, 0.03);
    border: 1px dashed var(--card-border);
    border-radius: 12px;
    padding: 16px;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sc-read-aloud-widget h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.sc-read-aloud-hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sc-final-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
}

/* -------------------------------------------------------------
   Responsive Breakpoints (Tablet & 390px Mobile)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
    .story-chaos-container,
    .sc-hud,
    .sc-play-grid,
    .sc-story-panel,
    .sc-story-content,
    .sc-input-panel,
    .sc-punct-row,
    .sc-final-story-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .sc-input-row {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .sc-word-input {
        width: 100%;
        max-width: 100%;
        flex: none;
        min-height: 52px;
        box-sizing: border-box;
    }

    .btn-sc-submit {
        width: 100%;
        max-width: 100%;
        flex: none;
        min-height: 52px;
        box-sizing: border-box;
    }

    .sc-hud-left,
    .sc-story-title {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .sc-play-grid {
        grid-template-columns: 1fr;
    }

    .sc-story-panel {
        min-height: 140px;
        max-height: 220px;
    }

    .sc-punct-row {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sc-hud {
        padding: 8px 10px;
        gap: 6px;
    }

    .sc-hud-left {
        min-width: 0;
    }

    .sc-badge-genre {
        font-size: 0.65rem;
    }

    .sc-story-title {
        font-size: 0.95rem;
    }

    .sc-hud-center {
        display: none;
    }

    .sc-timer-pill {
        padding: 4px 10px;
        font-size: 0.95rem;
    }

    .sc-story-content {
        font-size: 1.1rem;
        line-height: 1.6;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .sc-input-panel {
        padding: 14px;
        gap: 10px;
        margin-bottom: 20px;
    }

    .sc-punct-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 0.9rem;
    }

    .sc-word-input {
        padding: 10px 12px;
        font-size: 0.95rem;
        width: 100%;
        max-width: 100%;
        flex: none;
        min-height: 52px;
        box-sizing: border-box;
    }

    .btn-sc-submit {
        padding: 10px 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        flex: none;
        min-height: 52px;
        box-sizing: border-box;
    }

    .sc-final-story-card {
        font-size: 1.05rem;
        padding: 14px;
        overflow-wrap: break-word;
        word-break: break-word;
    }
}
