/* ============================================================
   Silicon Pulse — Google Material Design System (v2)
   Clean, flat, elevation-based. No gradients/neon.
   ============================================================ */

/* ─── Fonts ──────────────────────────────────────────── */
:root {
    /* Google Material colors */
    --md-surface: #ffffff;
    --md-surface-variant: #f8f9fa;
    --md-on-surface: #202124;
    --md-on-surface-var: #5f6368;
    --md-outline: #dadce0;
    --md-primary: #1a73e8;
    --md-primary-light: #e8f0fe;
    --md-on-primary: #ffffff;
    --md-secondary: #ea4335;
    --md-tertiary: #fbbc04;
    --md-success: #34a853;

    /* Elevation shadows (Material) */
    --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-2: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    --shadow-3: 0 4px 6px rgba(60, 64, 67, 0.3), 0 8px 16px 6px rgba(60, 64, 67, 0.15);

    --radius-s: 8px;
    --radius-m: 12px;
    --radius-l: 16px;
    --radius-xl: 28px;

    --font: 'Inter', 'Google Sans', -apple-system, Roboto, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, serif;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--md-surface-variant);
    color: var(--md-on-surface);
    -webkit-font-smoothing: antialiased;
}

/* ─── Header ─────────────────────────────────────────── */
#app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 100;
    background: var(--md-surface);
    border-bottom: 1px solid var(--md-outline);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 24px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--md-primary);
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--md-on-surface);
    letter-spacing: -0.3px;
}

/* Stage nav */
.stage-nav {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    justify-content: center;
}

.stage-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 8px 12px;
    font: 500 13px var(--font);
    color: var(--md-on-surface-var);
    cursor: pointer;
    border-radius: var(--radius-xl);
    transition: all 0.2s;
    white-space: nowrap;
}

.stage-tab:hover:not(.locked) {
    background: var(--md-primary-light);
}

.stage-tab.active {
    background: var(--md-primary-light);
    color: var(--md-primary);
    font-weight: 600;
}

.stage-tab.completed {
    color: var(--md-success);
}

.stage-tab.locked {
    color: #bdc1c6;
    cursor: default;
}

.stage-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--md-outline);
    font-size: 11px;
    font-weight: 600;
    color: var(--md-on-surface-var);
}

.stage-tab.active .stage-num {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

.stage-tab.completed .stage-num {
    background: var(--md-success);
    color: white;
}

.stage-label {
    font-size: 13px;
}

.stage-connector {
    width: 32px;
    height: 2px;
    background: var(--md-outline);
    position: relative;
    overflow: hidden;
}

.connector-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--md-primary);
    transition: width 0.5s ease;
}

.header-meta {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.meta-chip {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    background: var(--md-surface-variant);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-xl);
    color: var(--md-on-surface-var);
}

/* ─── Main Layout ────────────────────────────────────── */
#app-main {
    display: flex;
    height: calc(100vh - 56px);
    margin-top: 56px;
}

/* Sidebar */
.sidebar {
    width: 400px;
    background: var(--md-surface);
    border-right: 1px solid var(--md-outline);
    overflow-y: auto;
    padding: 24px;
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--md-outline);
    border-radius: 2px;
}

/* Viewport */
#viewport-container {
    flex: 1;
    position: relative;
    background: var(--md-surface-variant);
}

#three-canvas-container {
    width: 100%;
    height: 100%;
}

#three-canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ─── Theory Cards ───────────────────────────────────── */
.theory-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.theory-card h2 {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 600;
    color: var(--md-on-surface);
    letter-spacing: -0.5px;
}

.theory-lead {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--md-on-surface-var);
    font-size: 15px;
    line-height: 1.5;
}

.theory-card p {
    font-size: 14px;
    line-height: 1.65;
    color: #3c4043;
}

.theory-instruction {
    padding: 12px 16px;
    background: var(--md-surface-variant);
    border-left: 3px solid var(--md-primary);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
    font-size: 13px;
    color: var(--md-on-surface-var);
}

/* ─── Detail Toggles (Theory ⓘ) ─────────────────────── */
.theory-detail {
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-m);
    overflow: hidden;
}

.detail-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: none;
    border: none;
    font: 500 13px var(--font);
    color: var(--md-on-surface-var);
    cursor: pointer;
    transition: background 0.15s;
}

.detail-toggle:hover {
    background: var(--md-surface-variant);
}

.detail-icon {
    color: var(--md-primary);
    font-size: 14px;
}

.detail-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 14px;
}

.detail-panel.open {
    max-height: 400px;
    padding: 0 14px 14px;
}

.detail-panel p {
    font-size: 13px;
    color: #5f6368;
    line-height: 1.6;
    margin-bottom: 10px;
}

.detail-stat {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-s);
    margin-right: 8px;
    margin-top: 4px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--md-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--md-on-surface-var);
}

/* ─── Controls ───────────────────────────────────────── */
.control-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--md-on-surface-var);
    margin-bottom: 12px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-row label {
    width: 60px;
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-surface);
    flex-shrink: 0;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--md-outline);
    border-radius: 2px;
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--md-primary);
    border: 2px solid var(--md-surface);
    box-shadow: var(--shadow-1);
    cursor: pointer;
}

.slider-row input.slider-accent::-webkit-slider-thumb {
    background: var(--md-secondary);
}

.slider-val {
    min-width: 70px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: var(--md-on-surface);
    font-variant-numeric: tabular-nums;
}

.slider-val small {
    font-weight: 400;
    color: var(--md-on-surface-var);
}

/* ─── Graph ──────────────────────────────────────────── */
.graph-card {
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-m);
    padding: 12px;
    background: var(--md-surface-variant);
}

.graph-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-on-surface-var);
    font-weight: 600;
}

#potential-canvas {
    width: 100%;
    height: 140px;
    margin-top: 8px;
    border-radius: var(--radius-s);
}

/* ─── Status Card ────────────────────────────────────── */
.status-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-m);
    border: 1px solid var(--md-outline);
    transition: all 0.3s;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--md-outline);
    transition: background 0.3s;
}

.status-card.trapped {
    border-color: var(--md-success);
    background: #e6f4ea;
}

.status-card.trapped .status-dot {
    background: var(--md-success);
}

.status-label {
    font-size: 14px;
    font-weight: 500;
}

/* ─── Readouts ───────────────────────────────────────── */
.readout-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.readout-row.four-col {
    grid-template-columns: repeat(4, 1fr);
}

.readout {
    padding: 8px 12px;
    background: var(--md-surface-variant);
    border-radius: var(--radius-s);
    border: 1px solid var(--md-outline);
}

.readout-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-on-surface-var);
    margin-bottom: 2px;
}

.readout-val {
    font-size: 15px;
    font-weight: 600;
    color: var(--md-on-surface);
    font-variant-numeric: tabular-nums;
}

/* ─── Spin Display ───────────────────────────────────── */
.spin-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spin-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ket-label {
    font-size: 13px;
    font-weight: 600;
    width: 28px;
    color: var(--md-on-surface);
}

.prob-track {
    flex: 1;
    height: 6px;
    background: var(--md-outline);
    border-radius: 3px;
    overflow: hidden;
}

.prob-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.15s;
}

.prob-0 {
    background: var(--md-primary);
    width: 100%;
}

.prob-1 {
    background: var(--md-secondary);
    width: 0%;
}

.prob-text {
    font-size: 12px;
    font-weight: 600;
    width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ─── Pulse Button ───────────────────────────────────── */
.pulse-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
}

.pulse-btn {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: none;
    background: var(--md-surface-variant);
    border: 2px solid var(--md-outline);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-1);
}

.pulse-btn:hover:not(:disabled) {
    box-shadow: var(--shadow-2);
    border-color: var(--md-primary);
}

.pulse-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.pulse-btn.pulsing {
    background: var(--md-primary-light);
    border-color: var(--md-primary);
    box-shadow: var(--shadow-3);
}

.pulse-btn-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--md-on-surface-var);
    z-index: 1;
}

.pulse-ring-svg {
    position: absolute;
    top: -4px;
    left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
}

.ring-bg {
    fill: none;
    stroke: var(--md-outline);
    stroke-width: 3;
}

.ring-fg {
    fill: none;
    stroke: var(--md-primary);
    stroke-width: 3;
    stroke-dasharray: 339.3;
    stroke-dashoffset: 339.3;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.1s linear;
}

.pulse-legend {
    display: flex;
    justify-content: space-between;
    width: 80px;
    font-size: 10px;
    color: var(--md-on-surface-var);
}

/* ─── Formula ────────────────────────────────────────── */
.formula {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 8px 12px;
    background: var(--md-surface-variant);
    border-radius: var(--radius-s);
    color: var(--md-on-surface);
    border: 1px solid var(--md-outline);
}

.state-formula {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    padding: 12px;
    background: var(--md-surface-variant);
    border-radius: var(--radius-m);
    color: var(--md-on-surface);
}

/* ─── Buttons ────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    border-radius: var(--radius-xl);
    font: 600 14px var(--font);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-1);
    text-align: center;
}

.btn-primary:hover {
    box-shadow: var(--shadow-2);
    filter: brightness(1.05);
}

.btn-primary.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ─── Toggle ─────────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-surface-var);
}

.toggle-btn {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--md-outline);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.toggle-btn.active {
    background: var(--md-primary);
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    box-shadow: var(--shadow-1);
    transition: left 0.2s;
}

.toggle-btn.active .toggle-knob {
    left: 20px;
}

/* ─── HUD ────────────────────────────────────────────── */
#viewport-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    padding: 16px;
}

.hud-tl {
    position: absolute;
    top: 16px;
    left: 16px;
}

.hud-tr {
    position: absolute;
    top: 16px;
    right: 16px;
}

.hud-bl {
    position: absolute;
    bottom: 16px;
    left: 16px;
}

.hud-br {
    position: absolute;
    bottom: 16px;
    right: 16px;
}

.hud-tag {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-xl);
    color: var(--md-on-surface-var);
}

.zoom-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.zoom-hint span {
    padding: 6px 14px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-xl);
    color: var(--md-on-surface-var);
}

/* ─── Stage visibility ──────────────────────────────── */
.stage-content.hidden {
    display: none;
}

/* ─── Cursor Glow ────────────────────────────────────── */
.cursor-glow {
    position: fixed;
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 999;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(26, 115, 232, 0.06) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.cursor-glow.active {
    opacity: 1;
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
    #app-main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 45vh;
    }

    .stage-label {
        display: none;
    }
}

/* ─── Quantum Computing I/O ─────────────────────────── */
.qc-section {
    margin-top: 8px;
    padding: 16px;
    background: var(--md-surface-variant);
    border-radius: var(--radius-m);
    border: 1px solid var(--md-outline);
}

.qc-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--md-on-surface-var);
    margin-bottom: 12px;
}

.qc-gate-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.qc-gate-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-s);
    background: var(--md-surface);
    font: 600 13px 'JetBrains Mono', monospace;
    color: var(--md-primary);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.qc-gate-btn:hover {
    background: var(--md-primary-light);
    border-color: var(--md-primary);
    box-shadow: var(--shadow-1);
}

.qc-gate-btn:active {
    transform: scale(0.95);
}

.qc-gate-btn.qc-rot {
    font-size: 11px;
    min-width: auto;
}

.qc-gate-btn sub {
    font-size: 9px;
}

.qc-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.qc-action-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-s);
    background: var(--md-surface);
    font: 500 12px var(--font);
    cursor: pointer;
    transition: all 0.15s;
}

.qc-action-btn.qc-measure {
    color: var(--md-secondary);
}

.qc-action-btn.qc-measure:hover {
    background: #fce8e6;
    border-color: var(--md-secondary);
}

.qc-action-btn.qc-reset {
    color: var(--md-on-surface-var);
}

.qc-action-btn.qc-reset:hover {
    background: var(--md-surface-variant);
}

/* Circuit input */
.qc-circuit-input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.qc-input {
    flex: 1;
    padding: 6px 10px;
    font: 400 12px 'JetBrains Mono', monospace;
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-s);
    background: var(--md-surface);
    color: var(--md-on-surface);
    outline: none;
    transition: border-color 0.2s;
}

.qc-input:focus {
    border-color: var(--md-primary);
}

.qc-run-btn {
    padding: 6px 14px;
    background: var(--md-primary);
    color: white;
    border: none;
    border-radius: var(--radius-s);
    font: 600 11px var(--font);
    cursor: pointer;
    transition: all 0.15s;
}

.qc-run-btn:hover {
    box-shadow: var(--shadow-1);
    filter: brightness(1.05);
}

/* Circuit display */
.qc-circuit-display {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 10px;
    background: var(--md-surface);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-s);
    font: 500 12px 'JetBrains Mono', monospace;
    color: var(--md-on-surface-var);
    margin-bottom: 8px;
    min-height: 36px;
    overflow-x: auto;
}

.qc-wire-label {
    color: var(--md-on-surface);
    font-weight: 600;
}

.qc-gate-block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    background: var(--md-primary-light);
    border: 1px solid var(--md-primary);
    border-radius: 4px;
    color: var(--md-primary);
    font-weight: 600;
    font-size: 11px;
}

.qc-wire {
    color: var(--md-on-surface-var);
    font-size: 11px;
}

/* State output */
.qc-state-output {
    padding: 8px 10px;
    background: var(--md-surface);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-s);
    margin-bottom: 8px;
}

.qc-sv-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font: 400 12px 'JetBrains Mono', monospace;
    color: var(--md-on-surface);
}

.qc-sv-label {
    color: var(--md-on-surface-var);
    font-weight: 500;
}

.qc-sv-val {
    font-variant-numeric: tabular-nums;
}

/* Operation history */
.qc-history {
    max-height: 120px;
    overflow-y: auto;
}

.qc-log-entry {
    padding: 3px 0;
    font: 400 11px 'JetBrains Mono', monospace;
    color: var(--md-on-surface-var);
    border-bottom: 1px solid var(--md-outline);
}

.qc-log-entry:last-child {
    border-bottom: none;
}

.qc-history::-webkit-scrollbar {
    width: 3px;
}

.qc-history::-webkit-scrollbar-thumb {
    background: var(--md-outline);
    border-radius: 2px;
}

/* ─── Qubit Toolbar ──────────────────────────────────── */
.qubit-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
    z-index: 50;
}

.qubit-tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-xl);
    background: var(--md-surface);
    font: 500 13px var(--font);
    color: var(--md-primary);
    cursor: pointer;
    transition: all 0.15s;
}

.qubit-tool-btn:hover {
    background: var(--md-primary-light);
    border-color: var(--md-primary);
    box-shadow: var(--shadow-1);
}

.qubit-tool-btn:active {
    transform: scale(0.96);
}

.qubit-tool-btn.qubit-tool-delete {
    color: var(--md-secondary);
}

.qubit-tool-btn.qubit-tool-delete:hover {
    background: #fce8e6;
    border-color: var(--md-secondary);
}

.tool-icon {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.tool-label {
    font-size: 12px;
    font-weight: 500;
}

.qubit-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 12px;
    min-width: 56px;
}

.count-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--md-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.count-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--md-on-surface-var);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Hand Tracking Overlay ──────────────────────────── */
.hand-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-2);
    z-index: 100;
    pointer-events: none;
    animation: slideInRight 0.3s ease-out;
}

#hand-canvas {
    width: 100%;
    height: auto;
    border-radius: var(--radius-s);
    background: #000;
    display: block;
}

.gesture-status {
    padding: 6px 12px;
    background: var(--md-primary-light);
    color: var(--md-primary);
    border-radius: var(--radius-xl);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.gesture-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-s);
}

.gesture-legend span {
    font-size: 11px;
    color: var(--md-on-surface-var);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-divider {
    width: 1px;
    height: 32px;
    background: var(--md-outline);
    margin: 0 4px;
}

.qubit-tool-btn.active {
    background: var(--md-primary);
    color: white;
    border-color: var(--md-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}