/* QuizBattle — стили */

:root {
    --qb-accent: var(--accent-dim);
    --qb-accent-light: var(--accent);
    --qb-accent-hover: #6d28d9;
    --qb-teal: var(--teal);
    --qb-green: #22c55e;
    --qb-red: #ef4444;
    --qb-yellow: #f59e0b;
    --qb-bg-card: var(--surface);
    --qb-bg-section: var(--surface2);
    --qb-border: var(--border);
    --qb-muted: var(--text2);
    --qb-radius: 20px;
}

/* ===== HOME PAGE ===== */

.qb-home-page { padding-bottom: 100px; }

.qb-home-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4.5rem 1.5rem;
    background:
        radial-gradient(ellipse at 60% 0%, rgba(200,245,61,0.14) 0%, transparent 60%),
        radial-gradient(ellipse at 10% 80%, rgba(13,148,136,0.1) 0%, transparent 50%);
}

.qb-home-inner { max-width: 560px; text-align: center; }

.qb-home-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(200,245,61,0.12);
    border: 1px solid rgba(200,245,61,0.35);
    color: var(--qb-accent-light);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.qb-home-title {
    font-size: clamp(2.2rem, 6vw, 3.4rem);
    font-weight: 800;
    line-height: 1.12;
    margin-bottom: 1rem;
}

.qb-home-title span { color: var(--qb-accent-light); }

.qb-home-subtitle {
    font-size: 1.05rem;
    color: var(--qb-muted);
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

.qb-btn-start {
    display: inline-block;
    padding: 1rem 2.75rem;
    background: var(--qb-accent);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    letter-spacing: 0.01em;
    font-family: inherit;
    text-decoration: none;
}

.qb-btn-start:hover {
    background: var(--qb-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(200,245,61,0.4);
}

.qb-home-features {
    list-style: none;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    color: var(--qb-muted);
    font-size: 0.95rem;
}

.qb-home-how {
    padding: 4rem 1.5rem;
    border-top: 1px solid var(--qb-border);
}

.qb-home-how-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 3rem;
}

.qb-home-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    max-width: 900px;
    margin: 0 auto;
}

.qb-home-step {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    text-align: center;
    padding: 0 1rem;
}

.qb-home-step-num {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(200,245,61,0.15);
    border: 1px solid rgba(200,245,61,0.35);
    color: var(--qb-accent-light);
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.qb-home-step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.qb-home-step p { font-size: 0.88rem; color: var(--qb-muted); line-height: 1.5; }

.qb-home-step-arrow {
    color: var(--qb-muted);
    font-size: 1.5rem;
    padding: 0 0.25rem;
    margin-top: 0.75rem;
    align-self: flex-start;
}

/* ===== ROOM PAGE ===== */

.qb-room-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.25rem 120px;
    min-height: calc(100vh - 60px);
}

/* Screens */
.qb-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 640px;
    animation: qbFadeIn 0.3s ease;
}

.qb-screen.active { display: flex; }

@keyframes qbFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Waiting screen ---- */

.qb-waiting-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.qb-waiting-icon {
    font-size: 4rem;
    margin-bottom: 1.25rem;
    animation: qbPulse 2s ease-in-out infinite;
}

@keyframes qbPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.08); }
}

.qb-waiting-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.qb-waiting-sub {
    color: var(--qb-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.qb-room-code-box {
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: var(--qb-radius);
    padding: 1.5rem 2rem;
    text-align: center;
    width: 100%;
    margin-bottom: 1.5rem;
}

.qb-room-code-label {
    font-size: 0.8rem;
    color: var(--qb-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.qb-room-code-value {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    color: var(--qb-accent-light);
    font-variant-numeric: tabular-nums;
}

.qb-share-box {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 2rem;
}

.qb-share-input {
    flex: 1;
    background: var(--qb-bg-section);
    border: 1px solid var(--qb-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--qb-muted);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
}

.qb-copy-btn {
    padding: 0.75rem 1.25rem;
    background: rgba(200,245,61,0.15);
    border: 1px solid rgba(200,245,61,0.3);
    border-radius: 12px;
    color: var(--qb-accent-light);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.qb-copy-btn:hover, .qb-copy-btn.copied {
    background: var(--qb-accent);
    color: #fff;
    border-color: var(--qb-accent);
}

.qb-waiting-dots {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1rem;
}

.qb-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(200,245,61,0.4);
    animation: qbDot 1.4s ease-in-out infinite;
}

.qb-dot:nth-child(2) { animation-delay: 0.2s; }
.qb-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes qbDot {
    0%, 80%, 100% { transform: scale(1); opacity: 0.4; }
    40%            { transform: scale(1.4); opacity: 1; background: var(--qb-accent-light); }
}

/* ---- Setup screen ---- */

.qb-setup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    gap: 1rem;
}

.qb-setup-code {
    font-size: 0.88rem;
    color: var(--qb-muted);
}

.qb-setup-code strong {
    color: var(--qb-accent-light);
    letter-spacing: 0.08em;
}

.qb-player-ready {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--qb-green);
}

.qb-player-ready::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--qb-green);
    animation: qbBlink 1.5s ease infinite;
}

@keyframes qbBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.qb-setup-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
}

.qb-form { width: 100%; display: flex; flex-direction: column; gap: 1.75rem; }

.qb-form-group { display: flex; flex-direction: column; gap: 0.6rem; }

.qb-form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--qb-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.qb-select {
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    color: inherit;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.qb-select:focus {
    border-color: rgba(200,245,61,0.5);
    box-shadow: 0 0 0 3px rgba(200,245,61,0.15);
}

.qb-btn-group {
    display: flex;
    gap: 0.75rem;
}

.qb-btn-option {
    flex: 1;
    padding: 0.7rem;
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: 12px;
    color: var(--qb-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    font-family: inherit;
    text-align: center;
}

.qb-btn-option:hover {
    border-color: rgba(200,245,61,0.4);
    color: var(--qb-accent-light);
}

.qb-btn-option.active {
    background: rgba(200,245,61,0.15);
    border-color: rgba(200,245,61,0.5);
    color: var(--qb-accent-light);
}

.qb-btn-submit {
    margin-top: 0.5rem;
    padding: 1rem;
    background: var(--qb-accent);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}

.qb-btn-submit:hover {
    background: var(--qb-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(200,245,61,0.4);
}

.qb-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---- Guest wait screen ---- */

.qb-guest-wait {
    text-align: center;
    padding: 3rem 0;
}

.qb-guest-icon {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    animation: qbSpin 3s linear infinite;
}

@keyframes qbSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ---- Countdown screen ---- */

.qb-countdown {
    text-align: center;
    padding: 4rem 0;
}

.qb-countdown-category {
    font-size: 0.9rem;
    color: var(--qb-muted);
    margin-bottom: 3rem;
    line-height: 1.5;
}

.qb-countdown-number {
    font-size: clamp(6rem, 20vw, 10rem);
    font-weight: 900;
    line-height: 1;
    color: var(--qb-accent-light);
    transition: transform 0.15s;
}

.qb-countdown-number.pop {
    animation: qbCountPop 0.5s ease;
}

@keyframes qbCountPop {
    0%   { transform: scale(1.5); opacity: 0.5; }
    50%  { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.qb-countdown-label {
    font-size: 1.1rem;
    color: var(--qb-muted);
    margin-top: 0.75rem;
    font-weight: 600;
}

/* ---- Question screen ---- */

.qb-question-screen {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.qb-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: 16px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1rem;
}

.qb-score-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    min-width: 70px;
}

.qb-score-label {
    font-size: 0.72rem;
    color: var(--qb-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
}

.qb-score-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s;
}

.qb-score-block--you .qb-score-value { color: var(--qb-accent-light); }
.qb-score-block--partner .qb-score-value { color: var(--qb-teal); }

.qb-progress-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.qb-progress-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.qb-progress-sub {
    font-size: 0.7rem;
    color: var(--qb-muted);
}

/* Timer */
.qb-timer-wrap {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.qb-timer-bar {
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--qb-accent), var(--qb-accent-light));
    transition: width 0.2s linear, background-color 0.5s;
}

.qb-timer-bar.warning {
    background: linear-gradient(90deg, var(--qb-yellow), #fbbf24);
}

.qb-timer-bar.danger {
    background: linear-gradient(90deg, var(--qb-red), #f87171);
    animation: qbTimerPulse 0.4s ease infinite;
}

@keyframes qbTimerPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* Partner status */
.qb-partner-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--qb-muted);
    margin-bottom: 0.75rem;
    min-height: 1.5rem;
}

.qb-partner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
    transition: 0.3s;
}

.qb-partner-dot.thinking {
    background: var(--qb-muted);
    animation: qbBlink 1.2s ease infinite;
}

.qb-partner-dot.answered {
    background: var(--qb-green);
    animation: none;
}

/* Question box */
.qb-question-box {
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: var(--qb-radius);
    padding: 1.75rem 2rem;
    margin-bottom: 1.25rem;
}

.qb-question-text {
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    font-weight: 600;
    line-height: 1.6;
    text-align: center;
}

/* Options */
.qb-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.qb-option {
    padding: 1rem 1.25rem;
    background: var(--qb-bg-card);
    border: 2px solid var(--qb-border);
    border-radius: 14px;
    color: inherit;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    line-height: 1.4;
    min-height: 64px;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    word-break: break-word;
}

.qb-option:hover:not(:disabled) {
    background: rgba(200,245,61,0.12);
    border-color: rgba(200,245,61,0.45);
    transform: translateY(-1px);
}

.qb-option:active:not(:disabled) {
    transform: translateY(0);
}

.qb-option.selected {
    background: rgba(200,245,61,0.2);
    border-color: var(--qb-accent);
    color: #c4b5fd;
}

.qb-option.correct {
    background: rgba(34,197,94,0.18);
    border-color: var(--qb-green);
    color: #4ade80;
}

.qb-option.wrong {
    background: rgba(239,68,68,0.15);
    border-color: var(--qb-red);
    color: #f87171;
}

.qb-option.partner-wrong {
    border-color: rgba(251,191,36,0.5);
}

.qb-option:disabled { cursor: default; }

/* Points popup */
.qb-points-popup {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--qb-green);
    text-shadow: 0 0 30px rgba(34,197,94,0.6);
    animation: qbPointsFloat 1.5s ease-out forwards;
    pointer-events: none;
    z-index: 200;
}

@keyframes qbPointsFloat {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    60%  { opacity: 1; transform: translate(-50%, -100%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -160%) scale(0.8); }
}

/* ---- Game Over screen ---- */

.qb-gameover {
    text-align: center;
    padding: 3rem 0;
    width: 100%;
}

.qb-gameover-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: qbBounce 0.6s ease;
}

@keyframes qbBounce {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.qb-gameover-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.qb-gameover-sub {
    color: var(--qb-muted);
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
}

.qb-final-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: var(--qb-radius);
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.qb-final-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.qb-final-score-label {
    font-size: 0.8rem;
    color: var(--qb-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.qb-final-score-value {
    font-size: 2.8rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.qb-final-score--you .qb-final-score-value { color: var(--qb-accent-light); }
.qb-final-score--partner .qb-final-score-value { color: var(--qb-teal); }

.qb-final-vs {
    font-size: 1.1rem;
    color: var(--qb-muted);
    font-weight: 700;
}

.qb-gameover-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.qb-btn-again {
    padding: 0.85rem 2rem;
    background: var(--qb-accent);
    color: #fff;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.qb-btn-again:hover {
    background: var(--qb-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200,245,61,0.4);
}

.qb-btn-back {
    padding: 0.85rem 2rem;
    background: transparent;
    color: var(--qb-muted);
    border: 1px solid var(--qb-border);
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
}

.qb-btn-back:hover {
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}

/* ---- Disconnected overlay ---- */

.qb-disconnected {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.qb-disconnected:not([hidden]) {
    display: flex;
}

.qb-disconnected-box {
    background: var(--qb-bg-card);
    border: 1px solid var(--qb-border);
    border-radius: 24px;
    padding: 2.5rem 3rem;
    text-align: center;
    max-width: 360px;
    width: 90%;
}

.qb-disconnected-box .qb-dc-icon { font-size: 3.5rem; margin-bottom: 1rem; }

.qb-disconnected-box h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.qb-disconnected-box p {
    color: var(--qb-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* ---- Error message ---- */

.qb-error-msg {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: #f87171;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    animation: qbFadeIn 0.2s ease;
}

/* ---- Result hint ---- */

.qb-result-hint {
    border-radius: 12px;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    animation: qbFadeIn 0.25s ease;
}

.qb-result-hint--correct {
    background: rgba(34,197,94,0.12);
    border: 1px solid rgba(34,197,94,0.3);
    color: #4ade80;
}

.qb-result-hint--wrong {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
}

.qb-result-hint--timeout {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    color: #fcd34d;
}

/* Responsive */
@media (max-width: 480px) {
    .qb-options {
        grid-template-columns: 1fr;
    }

    .qb-question-box {
        padding: 1.25rem;
    }

    .qb-home-hero {
        padding: 3rem 1.25rem;
    }

    .qb-btn-group {
        flex-wrap: wrap;
    }
}
