/* ============================================
   THRESHOLD — State Transition Training | PNEUOMA
   Master the art of intentional change
   ============================================ */

:root {
    /* Dark Ambient Theme */
    --bg-deep: #0a0a0f;
    --bg-surface: #12121a;
    --bg-elevated: #1a1a25;
    
    /* Portal Colors */
    --portal-core: #6366f1;
    --portal-mid: #8b5cf6;
    --portal-outer: #a78bfa;
    --portal-glow: rgba(139, 92, 246, 0.3);
    
    /* State Colors */
    --state-stressed: #ef4444;
    --state-tired: #6366f1;
    --state-anxious: #f59e0b;
    --state-scattered: #ec4899;
    --state-wired: #f97316;
    --state-neutral: #6b7280;
    
    --state-calm: #06b6d4;
    --state-focused: #8b5cf6;
    --state-energized: #fbbf24;
    --state-grounded: #22c55e;
    --state-sleepy: #6366f1;
    --state-confident: #f472b6;
    
    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents */
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.4);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Game Container */
.game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Navigation */
.game-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.9) 0%, transparent 100%);
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--text-primary);
}

.session-info {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.transitions-count {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
}

.transitions-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* ========== TITLE SCREEN ========== */
.title-screen {
    background: radial-gradient(ellipse at center, var(--bg-surface) 0%, var(--bg-deep) 100%);
}

.title-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(139, 92, 246, 0.3) 50%, transparent 50%),
        radial-gradient(2px 2px at 40% 70%, rgba(99, 102, 241, 0.2) 50%, transparent 50%),
        radial-gradient(1px 1px at 60% 20%, rgba(167, 139, 250, 0.3) 50%, transparent 50%),
        radial-gradient(2px 2px at 80% 50%, rgba(139, 92, 246, 0.2) 50%, transparent 50%);
    animation: float-particles 20s linear infinite;
}

@keyframes float-particles {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100px); }
}

.threshold-portal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
}

.portal-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid;
    opacity: 0.6;
}

.ring-1 {
    width: 280px;
    height: 280px;
    border-color: var(--portal-outer);
    animation: rotate-ring 20s linear infinite;
}

.ring-2 {
    width: 220px;
    height: 220px;
    border-color: var(--portal-mid);
    animation: rotate-ring 15s linear infinite reverse;
}

.ring-3 {
    width: 160px;
    height: 160px;
    border-color: var(--portal-core);
    animation: rotate-ring 10s linear infinite;
}

@keyframes rotate-ring {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.portal-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--portal-core) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-core 3s ease-in-out infinite;
}

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

.title-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    margin-top: 150px;
}

.title-eyebrow {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--accent);
    margin-bottom: 12px;
}

.game-title {
    font-size: 4rem;
    font-weight: 200;
    letter-spacing: 8px;
    text-transform: uppercase;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.title-description {
    max-width: 400px;
    margin-bottom: 40px;
}

.title-description p {
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--portal-core) 0%, var(--portal-mid) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px var(--accent-glow);
}

.btn-secondary {
    display: inline-block;
    padding: 14px 28px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-muted);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

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

.title-meta {
    display: flex;
    gap: 20px;
    margin-top: 40px;
}

.meta-item {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 6px 12px;
    border: 1px solid var(--bg-elevated);
    border-radius: 20px;
}

/* ========== STATE SELECTION ========== */
.state-screen,
.target-screen {
    background: var(--bg-deep);
    padding: 80px 20px 20px;
}

.state-content {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.state-title {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 8px;
}

.state-subtitle {
    color: var(--text-muted);
    margin-bottom: 40px;
}

.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--bg-elevated);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.state-card:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    transform: translateY(-4px);
}

.state-card.selected {
    background: var(--bg-elevated);
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

.state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.state-name {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.state-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========== TRANSITION SCREEN ========== */
.transition-screen {
    background: var(--bg-deep);
}

#thresholdCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.transition-header {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 50;
}

.from-state,
.to-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-surface);
    border-radius: 8px;
}

.state-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.state-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.transition-arrow {
    font-size: 1.5rem;
    color: var(--accent);
}

/* Breathing Guide */
.breath-guide {
    position: relative;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.breath-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 4s ease-in-out;
}

.breath-circle.inhale {
    transform: scale(1.3);
}

.breath-circle.exhale {
    transform: scale(1);
}

.breath-circle.hold {
    transform: scale(1.3);
}

.breath-progress {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--portal-mid);
    animation: none;
}

.breath-text {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-primary);
}

.breath-instruction {
    margin-top: 30px;
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Progress */
.transition-progress {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 50;
}

.progress-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

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

.progress-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    min-width: 40px;
}

/* ========== COMPLETE SCREEN ========== */
.complete-screen {
    background: radial-gradient(ellipse at center, var(--bg-surface) 0%, var(--bg-deep) 100%);
}

.complete-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.complete-portal {
    width: 150px;
    height: 150px;
    margin-bottom: 30px;
    position: relative;
}

.portal-success {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--state-calm) 0%, transparent 70%);
    border-radius: 50%;
    animation: success-pulse 2s ease-in-out infinite;
}

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

.complete-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 10px;
}

.complete-message {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.complete-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.new-state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 48px;
    background: var(--bg-surface);
    border: 2px solid var(--accent);
    border-radius: 16px;
    margin-bottom: 40px;
    box-shadow: 0 0 40px var(--accent-glow);
}

.new-state-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.new-state-name {
    font-size: 1.5rem;
    font-weight: 500;
}

.complete-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .game-title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .threshold-portal {
        width: 200px;
        height: 200px;
    }

    .ring-1 { width: 180px; height: 180px; }
    .ring-2 { width: 140px; height: 140px; }
    .ring-3 { width: 100px; height: 100px; }

    .state-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .breath-circle {
        width: 150px;
        height: 150px;
    }

    .transition-header {
        flex-wrap: wrap;
        justify-content: center;
    }
}

