@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-dark: #080d1a;
    --panel-bg: rgba(15, 23, 42, 0.94);
    --panel-border: rgba(148, 163, 184, 0.22);
    --panel-specular: rgba(255, 255, 255, 0.08);
    --cyan: #38bdf8;
    --blue-power: #3b82f6;
    --amber: #f59e0b;
    --amber-power: #eab308;
    --violet: #a855f7;
    --green: #10b981;
    --red: #ef4444;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --accent-metal: #cbd5e1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI Overlays */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.interactive {
    pointer-events: auto;
}

/* Objective Card (Realistic Instrument Matter) */
#objective-card {
    position: absolute;
    top: 24px;
    left: 24px;
    background: linear-gradient(145deg, rgba(20, 27, 45, 0.95) 0%, rgba(13, 19, 33, 0.98) 100%);
    border: 1px solid rgba(148, 163, 184, 0.22);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 36px rgba(0, 0, 0, 0.65);
    width: 320px;
    z-index: 20;
}

.chapter-tag {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.district-title {
    font-size: 17px;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.objective-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.guide-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
    border-radius: 6px;
    font-size: 11px;
    padding: 3px 9px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.guide-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
}

/* Tutorial Action Banner in Objective Card */
#tutorial-action-banner {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(10, 15, 28, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.banner-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.action-banner-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(96, 165, 250, 0.4);
    color: #93c5fd;
    text-transform: uppercase;
}

.step-indicator {
    font-size: 11px;
    font-weight: 600;
    color: var(--amber);
}

.action-banner-text {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.4;
    margin-bottom: 0;
}

.action-banner-hint {
    display: none !important;
}

/* Guide Grid for How to Play Modal */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 14px;
}

.guide-step-card {
    display: flex;
    gap: 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 14px 16px;
    align-items: flex-start;
}

.guide-step-card .step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.45);
    color: #93c5fd;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.guide-step-card .step-content h4 {
    margin: 0 0 6px 0;
    font-size: 15px;
    color: #ffffff;
}

.guide-step-card .step-content p {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.4;
}

.guide-tip {
    font-size: 12px;
    color: #93c5fd !important;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.25);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* Lantern Qubit HUD (Realistic Instrument Console) */
#lantern-hud {
    position: absolute;
    top: 24px;
    right: 24px;
    background: linear-gradient(145deg, rgba(20, 27, 45, 0.95) 0%, rgba(13, 19, 33, 0.98) 100%);
    border: 1px solid rgba(148, 163, 184, 0.22);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 36px rgba(0, 0, 0, 0.65);
    width: 320px;
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.hud-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.state-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
}

.hud-metric {
    margin-bottom: 10px;
}

.metric-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.meter-track {
    width: 100%;
    height: 7px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    display: flex;
}

.meter-fill-0 {
    height: 100%;
    background: linear-gradient(90deg, #1d4ed8 0%, #3b82f6 100%);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
    border-radius: 3px;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.meter-fill-1 {
    height: 100%;
    background: linear-gradient(90deg, #b45309 0%, #eab308 100%);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.35);
    border-radius: 3px;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.phase-text {
    font-size: 12px;
    color: var(--violet);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

/* Center Crosshair & Prompt */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

#interact-prompt {
    position: absolute;
    top: calc(50% + 32px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(20, 27, 45, 0.96), rgba(13, 19, 33, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #f8fafc;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 28px rgba(0, 0, 0, 0.6);
    display: none;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
    z-index: 20;
    text-align: center;
}

#interact-prompt:hover {
    transform: translateX(-50%) scale(1.06);
    background: rgba(34, 211, 238, 0.2);
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.6);
}

/* Dialogue Subtitle Box */
#dialogue-box {
    position: absolute;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 16px 20px;
    width: min(620px, 86vw);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 25;
}

.dialogue-speaker {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.speaker-mira { color: var(--cyan); }
.speaker-lumi { color: var(--amber); }
.speaker-ishan { color: var(--green); }
.speaker-auditor { color: var(--red); }

.dialogue-text {
    font-size: 15px;
    line-height: 1.5;
    color: #f8fafc;
    margin-bottom: 12px;
}

.dialogue-btn {
    float: right;
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.dialogue-btn:hover {
    background: var(--cyan);
    color: #000;
}

/* Modals (Console, Journal, Experiment Lab, Pause) */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 8, 16, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    display: none;
}

.modal-window {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: var(--red);
    color: var(--red);
}

/* Quantum Console Layout */
#console-modal .modal-window {
    width: min(1040px, 94vw);
    height: min(720px, 90vh);
}

.console-body {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.console-left, .console-right {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 6px;
}

.card {
    background: rgba(15, 25, 45, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 14px;
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.state-formula {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: #f1f5f9;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.gate-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #fff;
    padding: 12px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease-out;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.gate-btn span {
    font-size: 18px;
    color: #f8fafc;
}

.gate-btn small {
    font-size: 10px;
    color: var(--text-muted);
}

.gate-btn:hover {
    background: rgba(51, 65, 85, 0.85);
    border-color: rgba(148, 163, 184, 0.5);
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.submit-btn {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--green);
    color: var(--green);
    font-size: 15px;
    padding: 14px;
}

.submit-btn:hover:not(:disabled) {
    background: var(--green);
    color: #000;
}

/* Bloch Sphere Canvas */
#bloch-container {
    width: 100%;
    height: 220px;
    background: radial-gradient(circle at center, rgba(30, 50, 85, 0.4) 0%, rgba(10, 16, 30, 0.8) 100%);
    border-radius: 8px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#bloch-canvas {
    width: 100%;
    height: 100%;
}

/* Banner Notification */
#banner-toast {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 28, 52, 0.95);
    border: 1px solid var(--amber);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 50;
}

/* Controls Helper Bar */
#controls-helper-bar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(11, 18, 33, 0.92);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 12px;
    color: #cbd5e1;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    z-index: 10;
    white-space: nowrap;
}

#controls-helper-bar b {
    color: var(--cyan);
}

/* On-Screen Virtual Controls */
#virtual-dpad {
    position: absolute;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 15;
}

.dpad-row {
    display: flex;
    gap: 6px;
}

.key-btn {
    width: 52px;
    height: 52px;
    background: rgba(15, 25, 45, 0.85);
    border: 1px solid rgba(45, 85, 145, 0.5);
    border-radius: 10px;
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.1s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    touch-action: manipulation;
}

.key-btn small {
    font-size: 10px;
    color: #94a3b8;
    margin-top: -2px;
}

.key-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.key-btn.active, .key-btn:active {
    background: #2563eb;
    color: #fff;
    border-color: #93c5fd;
    transform: translateY(2px) scale(0.96);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.6);
}

.key-btn.active small, .key-btn:active small {
    color: #cbd5e1;
}

/* Virtual Actions in Bottom Right */
#virtual-actions {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 15;
}

.action-key-btn {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: all 0.15s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 18px rgba(0, 0, 0, 0.5);
    touch-action: manipulation;
}

.action-key-btn .key-icon {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 14px;
}

.action-key-btn.highlight {
    background: rgba(30, 58, 138, 0.45);
    border: 1.5px solid rgba(96, 165, 250, 0.6);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.action-key-btn.highlight .key-icon {
    background: #2563eb;
    color: #fff;
    border: none;
}

.action-key-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.action-key-btn:active, .action-key-btn.active {
    transform: translateY(2px) scale(0.96);
}

.primary-actions {
    display: flex;
    gap: 10px;
}

.secondary-actions {
    display: flex;
    gap: 8px;
}

.action-key-btn.jump-btn {
    background: rgba(168, 85, 247, 0.2);
    border: 2px solid #a855f7;
    color: #fff;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.action-key-btn.jump-btn .key-icon {
    background: #a855f7;
    color: #fff;
    border: none;
}

.action-key-btn.jump-btn:hover {
    box-shadow: 0 0 28px rgba(168, 85, 247, 0.7);
}

.action-key-btn.small {
    padding: 8px 12px;
    font-size: 12px;
}

.action-key-btn.small .key-icon {
    padding: 2px 6px;
    font-size: 11px;
}

/* Fall / Death & Respawn Overlay (Friendly Layman Level) */
.death-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.4) 0%, rgba(6, 11, 23, 0.96) 80%);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
}

.death-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.death-card {
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #ef4444;
    border-radius: 18px;
    padding: 28px 36px;
    text-align: center;
    max-width: 460px;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.6);
    transform: scale(0.95);
    transition: transform 0.25s ease-out;
}

.death-overlay.active .death-card {
    transform: scale(1);
}

.death-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: bounce 0.6s infinite alternate;
}

.death-title {
    font-size: 22px;
    font-weight: 800;
    color: #ef4444;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.death-desc {
    font-size: 15px;
    color: #f1f5f9;
    line-height: 1.5;
    margin-bottom: 14px;
}

.death-tip {
    font-size: 13px;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--cyan);
    text-align: left;
}

/* ==========================================================================
   Layman-Level Console & City Machine Integration
   ========================================================================== */

/* City Machine Banner linking quantum console directly to the 3D world */
.city-machine-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, rgba(30, 58, 138, 0.5) 0%, rgba(15, 23, 42, 0.85) 100%);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 12px;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

.machine-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.machine-banner-icon {
    font-size: 26px;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}

.machine-banner-title {
    font-size: 13px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.machine-banner-desc {
    font-size: 12px;
    color: #cbd5e1;
    margin-top: 2px;
}

.machine-banner-status {
    font-size: 11px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.machine-banner-status.unlocked {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    color: #4ade80;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

/* -------------------------------------------------------------
   Layman Real Gate Mechanical Visualizer Widget
   ------------------------------------------------------------- */
.layman-gate-widget {
    background: rgba(10, 16, 30, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.gate-anim-frame {
    width: 100%;
    max-width: 440px;
    height: 72px;
    background: #070d1a;
    border: 2px solid #334155;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.gate-anim-doors-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
}

.gate-anim-door {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-top: 3px solid #64748b;
    border-bottom: 3px solid #334155;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    z-index: 2;
}

.gate-anim-door.left {
    left: 0;
    border-right: 2px solid #475569;
    transform: translateX(0);
}

.gate-anim-door.right {
    right: 0;
    border-left: 2px solid #475569;
    transform: translateX(0);
}

/* Door sliding open state */
.layman-gate-widget.gate-open .gate-anim-door.left {
    transform: translateX(-88%);
}

.layman-gate-widget.gate-open .gate-anim-door.right {
    transform: translateX(88%);
}

.gate-bar {
    width: 4px;
    height: 82%;
    background: linear-gradient(180deg, #94a3b8 0%, #475569 100%);
    border-radius: 2px;
    box-shadow: 1px 0 2px rgba(0, 0, 0, 0.5);
}

.gate-brace {
    position: absolute;
    width: 90%;
    height: 3px;
    background: #475569;
}

.gate-anim-lock-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    font-size: 20px;
    width: 34px;
    height: 34px;
    background: #0f172a;
    border: 2px solid #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    transition: all 0.4s ease;
}

.layman-gate-widget.gate-open .gate-anim-lock-center {
    border-color: #22c55e;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.8);
    background: rgba(34, 197, 94, 0.2);
}

.gate-anim-caption {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f87171;
    transition: color 0.3s ease;
}

.gate-caption-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.layman-gate-widget.gate-open .gate-anim-caption {
    color: #4ade80;
}

.layman-gate-widget.gate-open .gate-caption-dot {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

/* Layman State Badges */
.layman-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.badge-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    animation: pulseGlow 1.4s infinite alternate;
}

.badge-blue {
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.6);
    color: #38bdf8;
}
.badge-blue .badge-dot { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }

.badge-amber {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.6);
    color: #fbbf24;
}
.badge-amber .badge-dot { background: #fbbf24; box-shadow: 0 0 8px #fbbf24; }

.badge-blend {
    background: rgba(168, 85, 247, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.65);
    color: #c084fc;
}
.badge-blend .badge-dot { background: #c084fc; box-shadow: 0 0 8px #c084fc; }

.badge-custom {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: #e2e8f0;
}
.badge-custom .badge-dot { background: #e2e8f0; }

.layman-desc-text {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.45;
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #38bdf8;
}

.phase-info-box {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 6px;
    font-size: 12px;
    color: #e9d5ff;
}

/* Preparation Buttons */
.prep-btn-0 {
    background: rgba(14, 116, 144, 0.4);
    border: 1px solid rgba(34, 211, 238, 0.5);
    color: #38bdf8;
    font-weight: 700;
}
.prep-btn-0:hover {
    background: rgba(34, 211, 238, 0.25);
}

.prep-btn-1 {
    background: rgba(180, 83, 9, 0.4);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fbbf24;
    font-weight: 700;
}
.prep-btn-1:hover {
    background: rgba(245, 158, 11, 0.25);
}

/* Gate Buttons with Clear Layman Labels */
.gate-btn.gate-x {
    border-color: rgba(56, 189, 248, 0.5);
}
.gate-btn.gate-x:hover {
    border-color: #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.gate-btn.gate-h {
    border-color: rgba(168, 85, 247, 0.5);
}
.gate-btn.gate-h:hover {
    border-color: #c084fc;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.gate-btn.gate-z {
    border-color: rgba(244, 63, 94, 0.5);
}
.gate-btn.gate-z:hover {
    border-color: #fb7185;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.3);
}

.gate-symbol {
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.gate-name {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}


