/* ── Wavelength Game Styles ─────────────────────────────── */

:root {
    --wv-primary: #ff9f43;
    --wv-accent: #ffc312;
    --wv-dark: #1a1a2e;
    --wv-surface: rgba(255, 255, 255, 0.07);
    --wv-border: rgba(255, 255, 255, 0.12);
    --wv-text: #f0f0f0;
    --wv-muted: rgba(255, 255, 255, 0.5);
}

/* Container */
.wv-container {
    min-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    max-width: 700px;
    margin: 0 auto;
    padding: 0.6rem 1rem 0.75rem;
    gap: 0.5rem;
    color: var(--wv-text);
    font-family: 'Quicksand', sans-serif;
}

/* Loading / Error */
.wv-loading, .wv-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 1rem;
    text-align: center;
}

.wv-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 159, 67, 0.3);
    border-top-color: var(--wv-primary);
    border-radius: 50%;
    animation: wv-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .wv-spinner {
        animation-duration: 0.001ms;
        animation-iteration-count: 1;
    }
}

/* Phase header */
.wv-phase-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.wv-phase-title {
    font-family: 'Cabin Sketch', cursive;
    font-size: 2rem;
    color: var(--wv-primary);
    margin: 0 0 0.3rem;
}

.wv-phase-desc {
    color: var(--wv-muted);
    margin: 0;
    font-size: 0.95rem;
}

/* Round header */
.wv-round-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.wv-round-badge {
    background: rgba(255, 159, 67, 0.15);
    border: 1px solid rgba(255, 159, 67, 0.3);
    color: var(--wv-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.wv-psychic-badge {
    background: rgba(162, 93, 220, 0.15);
    border: 1px solid rgba(162, 93, 220, 0.3);
    color: #c77dff;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Spectrum Component ─────────── */
.wv-spectrum {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.5rem 0;
}

.wv-concept {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: center;
    line-height: 1.2;
}

.wv-concept-left { color: #ff6b6b; }
.wv-concept-right { color: #4ecdc4; }

.wv-bar-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}

.wv-bar {
    height: 56px;
    border-radius: 28px;
    background: linear-gradient(to right,
        #ff4e50, #fc913a, #f9d62e, #a8e063, #4ecdc4, #6a82fb);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.wv-bar-zones {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
}

/* Scoring zones */
.wv-zone {
    position: absolute;
    top: 0;
    height: 100%;
    pointer-events: none;
}

.wv-zone-2pts { background: rgba(255, 255, 255, 0.12); }
.wv-zone-3pts { background: rgba(255, 220, 60, 0.20); }
.wv-zone-4pts { background: rgba(255, 220, 60, 0.45); }

/* Pins (pointers on spectrum) */
.wv-pin {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.wv-pin-line {
    flex: 1;
    width: 3px;
    border-radius: 2px;
}

.wv-pin-head {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-top: 4px;
    border: 3px solid rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.wv-pin-head-target {
    background: #ff4757;
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.8);
}

.wv-pin-head-guess {
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.wv-pin-target .wv-pin-line { background: rgba(255, 71, 87, 0.7); }
.wv-pin-guess .wv-pin-line { background: rgba(255, 255, 255, 0.7); }

.wv-pin-target { z-index: 3; }
.wv-pin-guess { z-index: 2; }

/* ── Player pins (individual guesses on reveal) ── */
.wv-pin-player {
    z-index: 1;
    pointer-events: auto;
    cursor: default;
}

.wv-pin-player .wv-pin-head {
    width: 14px;
    height: 14px;
    margin-top: 6px;
    border-width: 2px;
}

.wv-pin-player .wv-pin-line { width: 2px; }

.wv-pin-tooltip {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translate(-50%, -100%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.wv-pin-player:hover .wv-pin-tooltip { opacity: 1; }

/* ── Player guess legend (reveal) ── */
.wv-player-legend {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.78rem;
    margin-top: 0.3rem;
}

.wv-player-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--wv-muted);
}

.wv-player-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wv-player-legend-score {
    font-size: 0.7rem;
    color: #4ecdc4;
    font-weight: 600;
}

/* ── Custom Spectrum Inputs ── */
.wv-custom-spectrum-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.wv-spectrum-label-row {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
}

.wv-spectrum-label-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.wv-input-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wv-muted);
}

.wv-spectrum-arrow {
    color: var(--wv-muted);
    font-size: 0.9rem;
    padding-bottom: 0.6rem;
    flex-shrink: 0;
}

.wv-spectrum-placeholder {
    width: 100%;
    margin: 1.5rem 0;
}

/* ── Lobby ─────────────────────── */
.wv-lobby {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.wv-room-code-block {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wv-room-label { color: var(--wv-muted); font-size: 0.85rem; }
.wv-room-code {
    font-family: 'Cabin Sketch', cursive;
    font-size: 2rem;
    color: var(--wv-accent);
    letter-spacing: 0.2em;
}

.wv-copy-btn {
    background: none;
    border: 1px solid var(--wv-border);
    color: var(--wv-muted);
    border-radius: 20px;
    padding: 0.25rem 0.8rem;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    margin-left: auto;
    transition: color 0.2s, border-color 0.2s;
}

.wv-copy-btn:hover {
    color: var(--wv-text);
    border-color: var(--wv-primary);
}

.wv-section-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--wv-muted);
    margin: 0 0 0.6rem;
}

.wv-player-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.wv-player-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: rgba(42, 26, 74, 0.55);
    border-radius: 12px;
    border: 1px solid var(--gn-border-glass);
}

/* ── GP-03: Pulsing glow for psychic (active player) ── */
.wv-player-item.wv-is-psychic {
    --tile-glow-color: rgba(255, 159, 67, 0.6);
    border-color: rgba(255, 159, 67, 0.7);
    animation: gn-tile-glow-pulse 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .wv-player-item.wv-is-psychic {
        animation: none;
        box-shadow: 0 0 0 2px rgba(255, 159, 67, 0.6);
    }
}

.wv-player-name { flex: 1; }

.wv-btn-kick {
    background: none;
    border: 1px solid rgba(255, 100, 100, 0.35);
    color: rgba(255, 100, 100, 0.7);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.wv-btn-kick:hover {
    background: rgba(255, 80, 80, 0.2);
    border-color: #ff5050;
    color: #ff5050;
}

.wv-badge-host, .wv-badge-you {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 700;
    margin-left: 0.3rem;
}

.wv-badge-host { background: rgba(255, 159, 67, 0.2); color: var(--wv-primary); }
.wv-badge-you { background: rgba(78, 205, 196, 0.2); color: #4ecdc4; }

.wv-rounds-info {
    text-align: center;
    color: var(--wv-muted);
    font-size: 0.85rem;
}

/* ── Clue View ─────────────────── */
.wv-clue-view { display: flex; flex-direction: column; gap: 1rem; }

.wv-clue-panel {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.wv-clue-instructions {
    margin: 0;
    color: var(--wv-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.wv-clue-input-row {
    display: flex;
    gap: 0.6rem;
}

.wv-clue-input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--wv-border);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    color: var(--wv-text);
    font-size: 1rem;
    font-family: 'Quicksand', sans-serif;
}

.wv-clue-input:focus {
    outline: none;
    border-color: var(--wv-primary);
}

.wv-waiting-panel {
    text-align: center;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.wv-pulse-icon {
    font-size: 2.5rem;
    animation: wv-pulse 1.5s ease-in-out infinite;
}

@keyframes wv-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
    .wv-pulse-icon {
        animation: none;
        opacity: 1;
    }
}

.wv-waiting-text { font-size: 1.05rem; margin: 0; }
.wv-waiting-sub { color: var(--wv-muted); font-size: 0.9rem; margin: 0; }
.wv-waiting-msg { text-align: center; color: var(--wv-muted); font-size: 0.9rem; }

/* ── Guess View ────────────────── */
.wv-guess-view { display: flex; flex-direction: column; gap: 1rem; }

.wv-clue-display {
    text-align: center;
    padding: 0.8rem;
    background: rgba(255, 159, 67, 0.08);
    border: 1px solid rgba(255, 159, 67, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.wv-clue-label { color: var(--wv-muted); font-size: 0.85rem; }

.wv-clue-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wv-accent);
    font-style: italic;
}

.wv-dial-panel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: 12px;
    padding: 1.2rem;
}

.wv-dial-slider {
    width: 100%;
    accent-color: var(--wv-primary);
    cursor: pointer;
    height: 6px;
}

.wv-dial-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    font-size: 0.85rem;
}

.wv-concept-small { color: var(--wv-muted); font-size: 0.8rem; }
.wv-dial-pos { font-weight: 700; font-size: 1rem; color: var(--wv-accent); }

.wv-btn-lockin { margin-top: 0.4rem; }

.wv-psychic-watch {
    text-align: center;
    padding: 1.2rem;
    background: rgba(162, 93, 220, 0.08);
    border: 1px solid rgba(162, 93, 220, 0.2);
    border-radius: 12px;
    color: var(--wv-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.wv-dial-pos-display { font-size: 1rem; color: var(--wv-text); }

.wv-player-list-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.wv-player-chip {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: 20px;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
}

.wv-chip-psychic {
    border-color: rgba(162, 93, 220, 0.4);
    color: #c77dff;
}

.wv-chip-guessed {
    border-color: rgba(78, 205, 196, 0.4);
    color: #4ecdc4;
}

/* ── Reveal View ───────────────── */
.wv-reveal-view { display: flex; flex-direction: column; gap: 1rem; }

.wv-zone-legend {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.78rem;
}

.wv-legend-item {
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-weight: 600;
}

.wv-legend-4 { background: rgba(255, 220, 60, 0.35); color: #ffd93d; }
.wv-legend-3 { background: rgba(255, 220, 60, 0.20); color: #ffc312; }
.wv-legend-2 { background: rgba(255, 255, 255, 0.12); color: var(--wv-muted); }
.wv-legend-0 { color: rgba(255,255,255,0.3); }

.wv-score-banner {
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

.wv-score-value {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Cabin Sketch', cursive;
}

.wv-score-label { font-size: 1.1rem; font-weight: 600; }

.wv-banner-4 { background: rgba(255, 215, 0, 0.2); border: 1px solid rgba(255, 215, 0, 0.4); color: #ffd700; }
.wv-banner-3 { background: rgba(255, 159, 67, 0.15); border: 1px solid rgba(255, 159, 67, 0.3); color: var(--wv-primary); }
.wv-banner-2 { background: rgba(78, 205, 196, 0.1); border: 1px solid rgba(78, 205, 196, 0.2); color: #4ecdc4; }
.wv-banner-0 { background: rgba(255,255,255,0.05); border: 1px solid var(--wv-border); color: var(--wv-muted); }

.wv-scores-table {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: 12px;
    padding: 1rem;
}

.wv-score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.wv-score-row:last-child { border-bottom: none; }
.wv-score-name { display: flex; align-items: center; gap: 0.4rem; }
.wv-score-pts { font-weight: 700; color: var(--wv-accent); }
.wv-round-delta { font-size: 0.75rem; color: #4ecdc4; font-weight: 600; opacity: 0.8; }

/* ── Game Over ─────────────────── */
.wv-gameover {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    text-align: center;
}

.wv-gameover-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.wv-gameover-icon { font-size: 3rem; }

.wv-gameover-title h2 {
    font-family: 'Cabin Sketch', cursive;
    font-size: 2.2rem;
    margin: 0;
    color: var(--wv-primary);
}

.wv-winner-msg { font-size: 1.05rem; }

.wv-final-scores {
    width: 100%;
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.wv-final-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
}

.wv-final-row-you { background: rgba(255, 159, 67, 0.1); }
.wv-final-medal { font-size: 1.2rem; min-width: 28px; }
.wv-final-name { flex: 1; text-align: left; }
.wv-final-pts { font-weight: 700; color: var(--wv-accent); }

.wv-gameover-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── Buttons ───────────────────── */
.wv-btn-primary {
    background: linear-gradient(135deg, var(--wv-primary), var(--wv-accent));
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

.wv-btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.wv-btn-primary:active { transform: translateY(0); }
.wv-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.wv-btn-secondary {
    background: var(--wv-surface);
    color: var(--wv-text);
    border: 1px solid var(--wv-border);
    border-radius: 10px;
    padding: 0.7rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    display: inline-block;
}

.wv-btn-secondary:hover { background: rgba(255,255,255,0.12); }

/* ── Timer settings (lobby) ── */
.wv-timer-settings {
    background: var(--wv-surface);
    border: 1px solid var(--wv-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.wv-timer-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--wv-text);
}

.wv-timer-duration {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--wv-muted);
}

.wv-timer-duration select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--wv-border);
    border-radius: 8px;
    color: var(--wv-text);
    padding: 0.3rem 0.5rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
}

.wv-timer-duration select:focus {
    outline: none;
    border-color: var(--wv-primary);
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
    .wv-container {
        padding: 0.4rem 0.5rem 0.5rem;
        gap: 0.4rem;
    }

    .wv-spectrum {
        margin: 0.5rem 0;
    }
}

@media (max-width: 600px) {
    /* GP-06: Compact pill chips */
    .wv-player-item,
    .wv-player-chip {
        padding: 0.35rem 0.55rem;
        border-radius: 20px;
        font-size: 0.78rem;
        gap: 0.3rem;
    }

    .wv-badge-host, .wv-badge-you { display: none; }

    /* Container */
    .wv-container {
        padding: 0.5rem 0.75rem 0.6rem;
    }

    /* Phase title */
    .wv-phase-title {
        font-size: 1.5rem;
    }

    /* Round header */
    .wv-round-header {
        gap: 0.5rem;
    }

    /* Spectrum bar — prevent horizontal overflow */
    .wv-spectrum {
        gap: 0.4rem;
        margin: 0.5rem 0;
    }

    .wv-bar-wrap {
        max-width: 100%;
        min-width: 0;
        height: 44px;
        flex: 1;
    }

    .wv-bar {
        width: 100%;
        height: 44px;
        border-radius: 22px;
    }

    /* Concept labels — prevent overflow */
    .wv-concept {
        font-size: 0.75rem;
        min-width: 44px;
        max-width: 60px;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-word;
    }

    /* Slider — touch-action: none prevents page scroll while dragging */
    .wv-dial-slider,
    .wv-dial-slider input[type="range"] {
        touch-action: none;
        height: 44px;
        min-height: 44px;
    }

    /* Clue input — full width */
    .wv-clue-input-row {
        flex-direction: column;
    }

    .wv-clue-input {
        width: 100%;
        box-sizing: border-box;
    }

    /* Clue text size */
    .wv-clue-text {
        font-size: 1.2rem;
    }

    /* Score banner */
    .wv-score-value {
        font-size: 2rem;
    }

    /* Game over title */
    .wv-gameover-title h2 {
        font-size: 1.7rem;
    }

    /* Game over actions — stack vertically */
    .wv-gameover-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    /* Buttons — minimum 44px touch target */
    .wv-btn-primary,
    .wv-btn-secondary {
        min-height: 44px;
        min-width: 44px;
        width: 100%;
    }

    /* Kick button */
    .wv-btn-kick {
        min-width: 44px;
        min-height: 44px;
        width: 36px;
        height: 36px;
    }

    /* Room code block */
    .wv-room-code-block {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.75rem 1rem;
    }

    .wv-room-code {
        font-size: 1.7rem;
        letter-spacing: 0.12em;
    }

    /* Score/reveal table rows */
    .wv-score-row {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    /* Zone legend — wrap on narrow screens */
    .wv-zone-legend {
        gap: 0.3rem;
    }

    /* Custom spectrum inputs — stack */
    .wv-spectrum-label-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .wv-spectrum-arrow {
        display: none;
    }
}
