/* ==========================================================================
   Get Ready Drawer - Compact Preparation & Calibration UI (Light Brand Theme)
   ========================================================================== */

.get-ready-drawer {
    background: #ffffff;
    border: 1px solid #c0c6cb;
    border-radius: 16px;
    padding: 16px 20px;
    margin-top: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

/* Drawer Header */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid #e4e8eb;
    margin-bottom: 16px;
}

.drawer-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-badge {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.drawer-heading {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111315;
    margin: 0;
}

/* ==========================================================================
   Step Progress Tracker (1 Camera → 2 Face → 3 Calibration → 4 Ready)
   ========================================================================== */

.setup-steps-tracker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tracker-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #515960;
    transition: all 0.2s ease;
}

.tracker-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #111315;
    font-size: 0.7rem;
    font-weight: 700;
}

.tracker-check {
    display: none;
    font-size: 0.8rem;
    font-weight: 800;
    color: #15803d;
}

.tracker-label {
    white-space: nowrap;
}

.tracker-divider {
    width: 12px;
    height: 1px;
    background: #cbd5e1;
}

/* Step 1 Complete (Camera On) */
#duel-media:has(#camera-video:not([hidden])) #tracker-camera {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}
#duel-media:has(#camera-video:not([hidden])) #tracker-camera .tracker-num {
    display: none;
}
#duel-media:has(#camera-video:not([hidden])) #tracker-camera .tracker-check {
    display: inline-block;
}

/* Step 2 Complete (Face Ok / Ready) */
#duel-media:has(#readiness-panel[data-state="READY"]) #tracker-face,
#duel-media:has(#readiness-panel[data-state="FACE_OK"]) #tracker-face {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}
#duel-media:has(#readiness-panel[data-state="READY"]) #tracker-face .tracker-num,
#duel-media:has(#readiness-panel[data-state="FACE_OK"]) #tracker-face .tracker-num {
    display: none;
}
#duel-media:has(#readiness-panel[data-state="READY"]) #tracker-face .tracker-check,
#duel-media:has(#readiness-panel[data-state="FACE_OK"]) #tracker-face .tracker-check {
    display: inline-block;
}

/* Step 3 Complete (Calibration Complete) */
#duel-media:has(#preparation-calibration[data-status="complete"]) #tracker-calibration {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}
#duel-media:has(#preparation-calibration[data-status="complete"]) #tracker-calibration .tracker-num {
    display: none;
}
#duel-media:has(#preparation-calibration[data-status="complete"]) #tracker-calibration .tracker-check {
    display: inline-block;
}

/* Step 4 Active / Complete (Ready button enabled / ready state) */
#duel-media:has(#ready-player:not(:disabled)) #tracker-ready {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.2);
}

#duel-media:has(#ready-player[data-ready="true"]) #tracker-ready {
    background: #dcfce7;
    border-color: #15803d;
    color: #15803d;
}
#duel-media:has(#ready-player[data-ready="true"]) #tracker-ready .tracker-num {
    display: none;
}
#duel-media:has(#ready-player[data-ready="true"]) #tracker-ready .tracker-check {
    display: inline-block;
}

/* ==========================================================================
   Drawer Cards
   ========================================================================== */

.drawer-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.drawer-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.drawer-card:hover {
    border-color: #cbd5e1;
}

.step-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #111315;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Details Summaries */
.drawer-card summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111315;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.drawer-card summary::-webkit-details-marker {
    display: none;
}

.drawer-card-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* Step 1: Camera Consent */
.consent-notice {
    font-size: 0.85rem;
    color: #515960;
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.camera-privacy {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0 0 10px 0;
}

.form-check-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

#duel-media .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin: 0;
    padding: 0;
}

#duel-media .form-check-input {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: #15803d;
    cursor: pointer;
}

#duel-media .form-check-label { min-height: 44px; flex: 1; display: flex; align-items: center; font-size: 0.85rem; color: #111315; cursor: pointer; line-height: 1.3; }

.camera-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#duel-media .btn {
    min-height: 44px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 8px;
    transition: all 0.15s ease;
}

#duel-media .btn:disabled {
    opacity: 1;
    background: #222628;
    color: #bac1c7;
    border-color: #899198;
    border-style: dashed;
}

#start-camera {
    background: #c8fa46;
    border-color: #111315;
    color: #111315;
}

#start-camera:hover:not(:disabled) {
    background: #b5e834;
}

#stop-camera {
    border-color: #c0c6cb;
    color: #111315;
    background: #ffffff;
}

#stop-camera:hover:not(:disabled) {
    background: #f1f5f9;
}

#apply-standard-calibration {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

#apply-standard-calibration:hover:not(:disabled) {
    background: #bbf7d0;
}

#camera-indicator {
    font-size: 0.8rem;
    font-weight: 600;
    color: #15803d;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#camera-indicator::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #15803d;
    box-shadow: 0 0 6px #15803d;
}

#camera-message {
    font-size: 0.8rem;
    color: #515960;
    margin: 8px 0 0 0;
    min-height: 20px;
}

/* Step 2: Face Check */
.calibration-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.heading-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calibration-heading h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: #111315;
}

#readiness-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.readiness-panel[data-state="READY"] #readiness-status,
.readiness-panel[data-state="FACE_OK"] #readiness-status {
    color: #15803d;
    background: #dcfce7;
    border-color: #86efac;
}

.readiness-panel:is([data-state="MULTIPLE_FACES"], [data-state="NO_FACE"], [data-state="EYES_NOT_VISIBLE"]) #readiness-status {
    color: #dc2626;
    background: #fee2e2;
    border-color: #fca5a5;
}

#readiness-message {
    font-size: 0.85rem;
    color: #515960;
    margin: 10px 0 0 0;
    min-height: 24px;
}

/* Step 3: Personal Calibration */
#calibration-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.calibration-panel[data-status="complete"] #calibration-status {
    color: #15803d;
    background: #dcfce7;
    border-color: #86efac;
}

.calibration-counter {
    font-size: 0.85rem;
    color: #515960;
}

.calibration-counter strong {
    color: #111315;
}

#calibration-message {
    font-size: 0.85rem;
    color: #515960;
    margin: 8px 0 6px 0;
    min-height: 20px;
}

#calibration-progress {
    width: 100%;
    height: 8px;
    accent-color: #15803d;
    border-radius: 4px;
    overflow: hidden;
}

.calibration-options {
    margin-top: 8px;
}

.calibration-options summary {
    font-size: 0.8rem;
    color: #515960;
    min-height: auto;
}

.calibration-options p {
    font-size: 0.75rem;
    color: #64748b;
    margin: 6px 0 0 0;
}

/* Step 4: Ready Player */
.ready-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    background: #f0fdf4;
    border-color: #86efac;
}

.ready-action-btn {
    width: 100%;
    min-height: 46px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border-radius: 10px;
    background: #c8fa46;
    border-color: #111315;
    color: #111315;
    box-shadow: 0 4px 14px rgba(200, 250, 70, 0.4);
    transition: all 0.2s ease;
}

.ready-action-btn:hover:not(:disabled) {
    background: #b5e834;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(200, 250, 70, 0.55);
}

.ready-action-btn:disabled {
    background: #222628;
    color: #bac1c7;
    box-shadow: none;
    border: 1px dashed #899198;
    opacity: 1;
}

.ready-action-btn[data-ready="true"] {
    background: #dcfce7;
    color: #15803d;
    border: 2px solid #15803d;
    box-shadow: 0 0 16px rgba(21, 128, 61, 0.25);
}

#ready-explanation {
    font-size: 0.8rem;
    color: #515960;
    margin: 8px 0 0 0;
    text-align: center;
    line-height: 1.3;
}

/* Status Bar Pills */
.drawer-status-bar {
    display: flex;
    gap: 16px;
    margin: 14px 0 0 0;
    padding-top: 12px;
    border-top: 1px solid #e4e8eb;
    flex-wrap: wrap;
}

.drawer-status-bar .status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.drawer-status-bar dt {
    color: #64748b;
    font-weight: 500;
}

.drawer-status-bar dd {
    margin: 0;
    font-weight: 600;
    color: #0369a1;
}

.debug-controls {
    margin-top: 12px;
}

@media (max-width: 768px) {
    .drawer-body {
        grid-template-columns: 1fr;
    }
    .setup-steps-tracker {
        width: 100%;
        justify-content: space-between;
    }
    .tracker-label {
        font-size: 0.75rem;
    }
}

/* Pre-duel Calibration Gate & Alerts */
.calibration-gate-card {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
}

.gate-state {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
}

.gate-ready {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.gate-ready .gate-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #22c55e;
    color: #ffffff;
    border-radius: 50%;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.gate-needed {
    background: #fefce8;
    border: 1px solid #fef08a;
    color: #854d0e;
}

.gate-needed .gate-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #eab308;
    color: #ffffff;
    border-radius: 50%;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.gate-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gate-details strong {
    font-size: 15px;
    color: #111315;
}

.gate-details span {
    font-size: 13px;
    color: #515960;
}

.gate-details a {
    font-weight: 700;
    color: #111315;
}

.gate-details .btn {
    align-self: flex-start;
    margin-top: 6px;
}

/* Calibration Success Card (Camera Test page) */
.calibration-success-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    margin-block: 20px;
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 12px;
    flex-wrap: wrap;
}

.calibration-success-card .success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #22c55e;
    color: #ffffff;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 900;
    flex-shrink: 0;
}

.calibration-success-card .success-details {
    flex: 1 1 240px;
}

.calibration-success-card h2 {
    font-size: 20px;
    font-weight: 800;
    color: #15803d;
    margin: 0 0 4px 0;
}

.calibration-success-card p {
    font-size: 14px;
    color: #166534;
    margin: 0;
}

.calibration-success-card .btn {
    padding: 12px 24px;
    font-weight: 800;
}

/* Fallback Alert in Duel Room */
.calibration-alert {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 14px 18px;
    margin-block: 10px;
}

.calibration-alert-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calibration-alert-content strong {
    color: #92400e;
    font-size: 15px;
}

.calibration-alert-content p {
    color: #78350f;
    font-size: 13px;
    margin: 0;
}

.calibration-alert-content a {
    align-self: flex-start;
    margin-top: 4px;
}

/* ==========================================================================
   Prominent Hero Ready Bar (Top of interface)
   ========================================================================== */

.arena-ready-bar {
    background: #ffffff;
    border: 1px solid #c0c6cb;
    border-radius: 16px;
    padding: 14px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ready-hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.ready-hero-action {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 280px;
}

.ready-hero-action .ready-action-btn {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 12px 32px;
    border-radius: 12px;
    min-height: 48px;
    min-width: 140px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.2);
}

.ready-hero-action .ready-action-btn:not(:disabled) {
    background: #15803d;
    border-color: #15803d;
    color: #ffffff;
    cursor: pointer;
}

.ready-hero-action .ready-action-btn:not(:disabled):hover {
    background: #166534;
    border-color: #166534;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(21, 128, 61, 0.3);
}

/* Pulse / glow when all prerequisites are met and user needs to ready up */
.ready-hero-action .ready-action-btn.ready-pulse {
    animation: readyGlowPulse 1.8s infinite ease-in-out;
    background: #15803d;
    border-color: #c8fa46;
}

@keyframes readyGlowPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(200, 250, 70, 0.6), 0 4px 12px rgba(21, 128, 61, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(200, 250, 70, 0), 0 6px 20px rgba(200, 250, 70, 0.6);
        transform: scale(1.02);
    }
}

.ready-hero-action #ready-explanation {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #515960;
    line-height: 1.35;
}

/* ==========================================================================
   Setup Checklist Strip (Compact status bar)
   ========================================================================== */

.setup-checklist-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.checklist-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 36px;
    font-family: inherit;
}

.checklist-chip .chip-icon {
    font-size: 0.85rem;
    font-weight: 900;
    color: #94a3b8;
}

.checklist-chip:hover {
    border-color: #94a3b8;
    background: #e2e8f0;
}

/* Chip complete state */
.checklist-chip[data-complete="true"] {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

.checklist-chip[data-complete="true"] .chip-icon {
    color: #15803d;
}

/* Chip incomplete state / prompt */
.checklist-chip[data-complete="false"] {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.checklist-chip[data-complete="false"] .chip-icon {
    color: #d97706;
}

.chip-recalibrate-btn {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0284c7;
    text-decoration: underline;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s ease;
}

.chip-recalibrate-btn:hover {
    color: #0369a1;
}

/* Drawer summary toggle styling */
details.get-ready-drawer > summary.drawer-header {
    cursor: pointer;
    user-select: none;
    list-style: none;
}

details.get-ready-drawer > summary.drawer-header::-webkit-details-marker {
    display: none;
}

details.get-ready-drawer[open] > summary.drawer-header {
    margin-bottom: 16px;
}

details.get-ready-drawer:not([open]) {
    padding-bottom: 14px;
}

details.get-ready-drawer:not([open]) > summary.drawer-header {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.ready-card-summary {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
}

.summary-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111315;
    display: block;
    margin-bottom: 4px;
}

.summary-text {
    font-size: 0.85rem;
    color: #515960;
    margin: 0;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .arena-ready-bar {
        padding: 10px 14px;
        border-radius: 12px;
        gap: 8px;
    }
    .ready-hero-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .ready-hero-action {
        flex-direction: column;
        align-items: stretch;
        min-width: 0;
        gap: 8px;
    }
    .ready-hero-action .ready-action-btn {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }
    .setup-checklist-strip {
        justify-content: flex-start;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    .checklist-chip {
        font-size: 0.75rem;
        padding: 4px 10px;
        min-height: 32px;
        white-space: nowrap;
    }
}
