/* ============================================
   KASINA θ PRO - MAIN STYLESHEET
   ============================================ */

:root {
    --bg-deep: #0a0a0f;
    --bg-card: #12121a;
    --bg-hover: #1a1a25;
    --accent-delta: #6a7aef;
    --accent-theta: #7c6aef;
    --accent-alpha: #6aefc4;
    --accent-beta: #efb86a;
    --accent-gamma: #ef6a9d;
    --accent-glow: #9d8df7;
    --accent-warm: #e8b4a0;
    --accent-light: #00d4ff;
    --accent-as: #00ff88;
    --accent-ss: #ff00aa;
    --text-primary: #e8e6f0;
    --text-muted: #8a8697;
    --text-dim: #5a5766;
    --border-subtle: rgba(124, 106, 239, 0.15);
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
    font-family: 'Jost', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* ============================================
   SPLASH SCREEN
   ============================================ */
.splash-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-deep);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content { text-align: center; }

.splash-mandala {
    width: 120px; height: 120px;
    margin: 0 auto 20px;
    border: 2px solid var(--accent-theta);
    border-radius: 50%;
    animation: mandala-pulse 2s ease-in-out infinite, mandala-rotate 20s linear infinite;
    position: relative;
}

.splash-mandala::before,
.splash-mandala::after {
    content: '';
    position: absolute;
    border: 1px solid var(--accent-theta);
    border-radius: 50%;
}

.splash-mandala::before {
    top: 15%; left: 15%; right: 15%; bottom: 15%;
    animation: mandala-rotate 15s linear infinite reverse;
}

.splash-mandala::after {
    top: 30%; left: 30%; right: 30%; bottom: 30%;
    animation: mandala-rotate 10s linear infinite;
}

@keyframes mandala-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

@keyframes mandala-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.splash-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

.splash-title span {
    font-size: 0.5em;
    vertical-align: super;
    color: var(--accent-theta);
}

.splash-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 5px;
}

.splash-loader {
    width: 40px; height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    margin: 30px auto 0;
    overflow: hidden;
}

.splash-loader::after {
    content: '';
    display: block;
    width: 50%;
    height: 100%;
    background: var(--accent-theta);
    animation: loader-slide 1s ease-in-out infinite;
}

@keyframes loader-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Safety Modal */
.safety-modal .safety-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 16px;
}

.safety-modal h2 {
    font-family: 'Cormorant Garamond', serif;
    text-align: center;
    margin-bottom: 20px;
}

.safety-content { margin-bottom: 20px; }

.safety-item {
    background: var(--bg-deep);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.safety-item.critical {
    border-left: 3px solid #ff4444;
}

.safety-item strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.safety-item p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.safety-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
}

.safety-checkbox input { width: 18px; height: 18px; }

/* Ritual Modal */
.ritual-modal .ritual-mandala-small {
    width: 60px; height: 60px;
    margin: 0 auto 16px;
    border: 1px solid var(--accent-theta);
    border-radius: 50%;
    animation: mandala-rotate 10s linear infinite;
}

.ritual-modal h2 { text-align: center; margin-bottom: 10px; }

.ritual-intro {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.ritual-modal textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-family: 'Jost', sans-serif;
    resize: vertical;
    margin-bottom: 16px;
}

.ritual-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.ritual-preset {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ritual-preset:hover {
    border-color: var(--accent-theta);
    color: var(--text-primary);
}

.ritual-actions, .closing-actions {
    display: flex;
    gap: 10px;
}

.ritual-actions button, .closing-actions button { flex: 1; }

/* Closing Modal */
.closing-modal .closing-mandala {
    width: 80px; height: 80px;
    margin: 0 auto 16px;
    border: 2px solid var(--accent-alpha);
    border-radius: 50%;
    animation: mandala-pulse 3s ease-in-out infinite;
}

.closing-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.closing-stat { text-align: center; }

.closing-stat .stat-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.closing-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.closing-intention {
    text-align: center;
    font-style: italic;
    color: var(--accent-glow);
    margin: 16px 0;
    padding: 12px;
    background: rgba(124, 106, 239, 0.1);
    border-radius: 8px;
}

.closing-modal textarea {
    width: 100%;
    min-height: 60px;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-family: 'Jost', sans-serif;
    resize: vertical;
    margin-bottom: 16px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-area-top));
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-center { text-align: center; }

.logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.1em;
}

.logo span {
    font-size: 0.5em;
    vertical-align: super;
    color: var(--accent-theta);
}

.subtitle {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 8px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-icon:hover { color: var(--text-primary); }

/* ============================================
   SIDE MENU
   ============================================ */
.side-menu {
    position: fixed;
    top: 0; left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    border-right: 1px solid var(--border-subtle);
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.side-menu.open { left: 0; }

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.menu-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.menu-list li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
}

.menu-list li a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 16px;
}

.menu-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.offline-indicator { color: #ff6b6b; }
.offline-indicator.online { color: #6bff6b; }

/* ============================================
   CONFIG PANEL
   ============================================ */
.config-panel {
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: calc(20px + var(--safe-area-bottom));
    transition: opacity 0.5s ease;
}

.config-panel.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 4px;
    margin: 12px 16px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    flex: 1;
    min-width: 70px;
    white-space: nowrap;
    background: transparent;
    border: none;
    padding: 10px 12px;
    color: var(--text-muted);
    font-family: 'Jost', sans-serif;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--accent-theta); color: white; }

.tab-content {
    display: none;
    padding: 0 16px;
}

.tab-content.active { display: block; }

/* ============================================
   CARDS
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
}

.card.full-width { grid-column: 1 / -1; }
.card.span-2 { grid-column: span 2; }

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background: var(--accent-theta);
}

/* ============================================
   PROFILES
   ============================================ */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 700px) {
    .profiles-grid { grid-template-columns: repeat(3, 1fr); }
}

.profile-card {
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.profile-card:hover { transform: translateY(-2px); }

.profile-card.active {
    border-color: var(--profile-color);
    box-shadow: 0 0 20px rgba(var(--profile-rgb), 0.2);
}

.profile-delta { --profile-color: var(--accent-delta); --profile-rgb: 106, 122, 239; }
.profile-theta { --profile-color: var(--accent-theta); --profile-rgb: 124, 106, 239; }
.profile-alpha { --profile-color: var(--accent-alpha); --profile-rgb: 106, 239, 196; }
.profile-beta { --profile-color: var(--accent-beta); --profile-rgb: 239, 184, 106; }
.profile-gamma { --profile-color: var(--accent-gamma); --profile-rgb: 239, 106, 157; }

.profile-wave {
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--profile-color);
}

.profile-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-top: 2px;
}

.profile-freq {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.subprofiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.subprofile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subprofile-card:hover { border-color: var(--accent-theta); }
.subprofile-card.active {
    border-color: var(--accent-theta);
    background: rgba(124, 106, 239, 0.1);
}

.subprofile-icon { font-size: 1.2rem; }
.subprofile-name { font-size: 0.85rem; }
.subprofile-details { font-size: 0.65rem; color: var(--text-dim); }

/* ============================================
   SWEEP PROFILES
   ============================================ */
.sweep-card { margin-top: 16px; }

.sweep-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.sweep-btn {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 8px 14px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sweep-btn:hover { border-color: var(--accent-theta); color: var(--text-primary); }
.sweep-btn.active { background: var(--accent-theta); color: white; border-color: var(--accent-theta); }

.sweep-visualizer {
    height: 60px;
    background: var(--bg-deep);
    border-radius: 8px;
    overflow: hidden;
}

.sweep-visualizer canvas { width: 100%; height: 100%; }

/* ============================================
   CONTROLS
   ============================================ */
.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group.full { grid-column: 1 / -1; }

label {
    font-size: 0.65rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

input[type="number"], select, textarea {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: 'Jost', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-theta);
}

textarea { min-height: 50px; resize: vertical; }

input[type="range"] {
    -webkit-appearance: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    height: 4px;
    background: var(--bg-deep);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-theta);
    border-radius: 50%;
    margin-top: -6px;
}

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

.slider-row input[type="range"] { flex: 1; }

.value-display {
    font-size: 0.75rem;
    color: var(--accent-glow);
    min-width: 50px;
    text-align: right;
}

/* ============================================
   FREQUENCY DISPLAY
   ============================================ */
.freq-display {
    background: linear-gradient(135deg, rgba(124, 106, 239, 0.1) 0%, rgba(232, 180, 160, 0.05) 100%);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 12px;
}

.freq-item { text-align: center; }

.freq-item .value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: var(--text-primary);
}

.freq-item .label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.freq-diff {
    background: var(--accent-theta);
    color: var(--bg-deep);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ============================================
   WAVEFORM SELECTOR
   ============================================ */
.waveform-selector {
    display: flex;
    gap: 4px;
}

.waveform-btn {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 6px;
    color: var(--text-muted);
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.waveform-btn:hover { border-color: var(--accent-theta); }
.waveform-btn.active { background: var(--accent-theta); color: white; }
.waveform-btn .wf-icon { font-size: 1.2rem; display: block; margin-bottom: 2px; }

/* ============================================
   ENCODING SELECTOR
   ============================================ */
.encoding-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.encoding-btn {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.encoding-btn:hover { border-color: var(--accent-theta); }
.encoding-btn.active.none { border-color: var(--text-muted); background: rgba(255,255,255,0.05); }
.encoding-btn.active.as { border-color: var(--accent-as); background: rgba(0, 255, 136, 0.1); color: var(--accent-as); }
.encoding-btn.active.ss { border-color: var(--accent-ss); background: rgba(255, 0, 170, 0.1); color: var(--accent-ss); }

/* ============================================
   MANDALA PREVIEW
   ============================================ */
.mandala-preview {
    width: 100%;
    aspect-ratio: 1;
    max-width: 300px;
    margin: 0 auto 16px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.mandala-preview canvas { width: 100%; height: 100%; }

.mandala-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* ============================================
   GANZFRAME PREVIEW
   ============================================ */
.ganzframe-preview {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 16px;
    background: #000;
    border-radius: 10px;
    margin-bottom: 12px;
}

.eye-preview {
    width: 60px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-theta);
    transition: all 0.15s ease;
    box-shadow: 0 0 20px currentColor;
}

/* ============================================
   RGB SLIDERS
   ============================================ */
.rgb-sliders { display: flex; flex-direction: column; gap: 10px; }

.rgb-slider {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rgb-slider label {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 30px;
}

.rgb-slider .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.rgb-slider.red .color-dot { background: #ff4444; }
.rgb-slider.green .color-dot { background: #44ff44; }
.rgb-slider.blue .color-dot { background: #4444ff; }

.rgb-slider input { flex: 1; }

input[type="range"].red::-webkit-slider-thumb { background: #ff4444; }
input[type="range"].green::-webkit-slider-thumb { background: #44ff44; }
input[type="range"].blue::-webkit-slider-thumb { background: #4444ff; }

.color-presets {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.color-preset {
    flex: 1;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.6rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ============================================
   BREATH & SYNC
   ============================================ */
.breath-pattern-visual {
    background: var(--bg-deep);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
}

.breath-pattern-visual svg { width: 100%; height: 60px; }

.breath-presets, .walk-tempo-presets, .duration-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.breath-preset, .tempo-preset, .duration-preset {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.breath-preset:hover, .tempo-preset:hover, .duration-preset:hover {
    border-color: var(--accent-theta);
    color: var(--text-primary);
}

.sync-modes {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.sync-mode-btn {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.sync-mode-btn:hover { border-color: var(--accent-theta); }
.sync-mode-btn.active { background: var(--accent-theta); color: white; }

/* ============================================
   BREATH DETECTION
   ============================================ */
.breath-detection {
    text-align: center;
    padding: 16px;
    margin-bottom: 12px;
}

.mic-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mic-icon { font-size: 2rem; }

.mic-level {
    width: 100px;
    height: 8px;
    background: var(--bg-deep);
    border-radius: 4px;
    overflow: hidden;
}

.mic-level::after {
    content: '';
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent-alpha);
    transition: width 0.1s ease;
}

.breath-status {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 8px;
}

/* ============================================
   IMU / SENSORS
   ============================================ */
.imu-display {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.imu-3d {
    width: 150px;
    height: 150px;
    background: var(--bg-deep);
    border-radius: 10px;
    overflow: hidden;
}

.imu-3d canvas { width: 100%; height: 100%; }

.imu-data { flex: 1; }

.imu-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.8rem;
}

.imu-label { color: var(--text-muted); }
.imu-value { color: var(--text-primary); font-family: monospace; }

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

/* ============================================
   FATIGUE DETECTION
   ============================================ */
.fatigue-display {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}

.fatigue-gauge {
    width: 100px;
    height: 100px;
}

.fatigue-gauge svg { width: 100%; height: 100%; }

.gauge-bg {
    fill: none;
    stroke: var(--bg-deep);
    stroke-width: 8;
}

.gauge-fill {
    fill: none;
    stroke: var(--accent-alpha);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 251;
    stroke-dashoffset: 251;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.5s ease;
}

.gauge-text {
    fill: var(--text-primary);
    font-size: 1.2rem;
    text-anchor: middle;
}

.fatigue-info { flex: 1; font-size: 0.8rem; }
.fatigue-info p { margin-bottom: 6px; }

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
}

.toggle-label input { width: 18px; height: 18px; }

/* ============================================
   REALTIME STATS
   ============================================ */
.realtime-stats {
    display: flex;
    justify-content: space-around;
}

.stat-box {
    text-align: center;
    padding: 12px;
    background: var(--bg-deep);
    border-radius: 10px;
    min-width: 80px;
}

.stat-box .stat-icon { font-size: 1.5rem; display: block; margin-bottom: 4px; }
.stat-box .stat-value { font-size: 1.3rem; color: var(--text-primary); display: block; }
.stat-box .stat-label { font-size: 0.6rem; color: var(--text-dim); text-transform: uppercase; }

/* ============================================
   EXPORT OPTIONS
   ============================================ */
.export-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.export-btn {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover { border-color: var(--accent-theta); color: var(--text-primary); }

.info-box {
    background: rgba(124, 106, 239, 0.08);
    border-left: 2px solid var(--accent-theta);
    border-radius: 0 6px 6px 0;
    padding: 10px 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-theta) 0%, #9d7aef 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 24px;
    font-family: 'Jost', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 106, 239, 0.4);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Jost', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover { color: var(--text-primary); border-color: var(--accent-theta); }

.action-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.action-row .btn-secondary { flex: 1; min-width: 100px; }

/* ============================================
   PROGRESS
   ============================================ */
.progress-container { margin-top: 12px; display: none; }
.progress-container.active { display: block; }

.progress-bar {
    height: 4px;
    background: var(--bg-deep);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-theta), var(--accent-alpha));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================
   PLAYER INTERFACE
   ============================================ */
.player-interface {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-deep);
    z-index: 500;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.player-interface.active { opacity: 1; pointer-events: all; }

.visual-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.visual-area canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

.profile-indicator {
    position: absolute;
    top: 16px; left: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    border-radius: 12px;
    z-index: 10;
}

.profile-indicator .profile-wave {
    font-size: 1.8rem;
    font-weight: 300;
}

.profile-indicator .profile-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
}

.profile-indicator .profile-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.encoding-badge {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    z-index: 10;
}

.encoding-badge.as { color: var(--accent-as); border: 1px solid var(--accent-as); }
.encoding-badge.ss { color: var(--accent-ss); border: 1px solid var(--accent-ss); }

.ganzframe-visual {
    position: absolute;
    top: 70px; right: 16px;
    display: flex;
    gap: 10px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    padding: 10px 14px;
    border-radius: 10px;
    z-index: 10;
}

.ganz-eye {
    width: 40px;
    height: 25px;
    border-radius: 50%;
    transition: all 0.1s ease;
}

.breath-guide {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.breath-circle {
    width: 200px; height: 200px;
    border-radius: 50%;
    border: 2px solid rgba(106, 239, 196, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease-out;
}

.breath-circle.inhale {
    transform: scale(1.5);
    border-color: rgba(106, 239, 196, 0.6);
    background: radial-gradient(circle, rgba(106, 239, 196, 0.15) 0%, transparent 70%);
}

.breath-circle.hold {
    border-color: rgba(157, 141, 247, 0.6);
    background: radial-gradient(circle, rgba(157, 141, 247, 0.12) 0%, transparent 70%);
}

.breath-circle.exhale {
    transform: scale(0.7);
    border-color: rgba(232, 180, 160, 0.5);
    background: radial-gradient(circle, rgba(232, 180, 160, 0.1) 0%, transparent 70%);
}

.breath-circle.pause {
    transform: scale(0.75);
    border-color: rgba(124, 106, 239, 0.4);
}

.breath-inner { text-align: center; }
.breath-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    letter-spacing: 0.1em;
    display: block;
}

.breath-timer {
    font-size: 2rem;
    font-weight: 200;
    color: var(--text-muted);
}

.whisper-indicator {
    position: absolute;
    top: 100px; left: 50%;
    transform: translateX(-50%);
    background: rgba(124, 106, 239, 0.15);
    border: 1px solid rgba(124, 106, 239, 0.3);
    border-radius: 20px;
    padding: 10px 24px;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 10;
}

.whisper-indicator.active { opacity: 1; }

.whisper-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: var(--accent-glow);
    font-style: italic;
}

.walk-indicator {
    position: absolute;
    bottom: 120px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 10;
}

.footstep {
    width: 24px; height: 40px;
    opacity: 0.2;
    transition: opacity 0.15s ease;
    background-size: contain;
    background-repeat: no-repeat;
}

.footstep.left {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 40'%3E%3Cpath fill='%23efb86a' d='M12 0C7 0 4 5 4 11c0 4 1 6 3 9l2 10c1 2 2 3 3 3s2-1 3-3l2-10c2-3 3-5 3-9 0-6-3-11-8-11zm-3 34c-1 0-2 1-2 3s1 3 2 3h6c1 0 2-1 2-3s-1-3-2-3h-6z'/%3E%3C/svg%3E");
}

.footstep.right {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 40'%3E%3Cpath fill='%23efb86a' d='M12 0c5 0 8 5 8 11 0 4-1 6-3 9l-2 10c-1 2-2 3-3 3s-2-1-3-3l-2-10c-2-3-3-5-3-9 0-6 3-11 8-11zm3 34c1 0 2 1 2 3s-1 3-2 3H9c-1 0-2-1-2-3s1-3 2-3h6z'/%3E%3C/svg%3E");
}

.footstep.active { opacity: 1; }

.intention-display {
    position: absolute;
    bottom: 180px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 10px;
    max-width: 80%;
    text-align: center;
    z-index: 10;
}

.intention-display span {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    color: var(--accent-warm);
    font-style: italic;
}

/* ============================================
   PLAYER CONTROLS
   ============================================ */
.player-controls {
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-area-bottom));
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.player-btn {
    background: var(--accent-theta);
    border: none;
    border-radius: 50%;
    width: 44px; height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.player-btn:hover { transform: scale(1.1); }
.player-btn svg { width: 18px; height: 18px; fill: white; }

.time-display {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 85px;
}

.time-display .current { color: var(--text-primary); }

.player-progress {
    flex: 1;
    min-width: 100px;
    height: 6px;
    background: var(--bg-deep);
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
}

.player-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-theta), var(--accent-alpha));
    border-radius: 3px;
}

.stats-row {
    display: flex;
    gap: 14px;
}

.stats-row .stat-item { text-align: center; }
.stats-row .stat-item .value { font-size: 1rem; color: var(--text-primary); display: block; }
.stats-row .stat-item .label { font-size: 0.55rem; color: var(--text-dim); text-transform: uppercase; }

.btn-close-player {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Jost', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: auto;
}

.btn-close-player:hover { border-color: var(--accent-warm); color: var(--accent-warm); }

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 100px; left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: var(--bg-card);
    border: 1px solid var(--accent-theta);
    border-radius: 10px;
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 0.85rem;
    z-index: 2000;
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .cards-grid { grid-template-columns: 1fr; }
    .card.span-2 { grid-column: 1; }
    .stats-row { display: none; }
    .mandala-controls { grid-template-columns: 1fr; }
    .imu-display { flex-direction: column; }
    .imu-3d { width: 100%; height: 120px; }
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */
:fullscreen .config-panel,
:-webkit-full-screen .config-panel {
    display: none;
}

:fullscreen .player-interface,
:-webkit-full-screen .player-interface {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: all !important;
}

/* ============================================
   PWA STANDALONE
   ============================================ */
@media (display-mode: standalone) {
    .header { padding-top: calc(20px + var(--safe-area-top)); }
}
