:root {
    --past-color: #f39c12;
    --past-glow: rgba(243, 156, 18, 0.4);
    --past-bg: #2d1e15;
    
    --future-color: #00d2ff;
    --future-glow: rgba(0, 210, 255, 0.4);
    --future-bg: #0a0e17;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --ui-bg: rgba(10, 10, 15, 0.6);
    --ui-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Inter', sans-serif;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.5s ease;
}

/* Cinematic Overlays */
#cinematic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 40%, rgba(0,0,0,0.8) 100%);
    z-index: 5;
    mix-blend-mode: multiply;
}

#glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0,0,0,0.15) 0px,
        rgba(0,0,0,0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    opacity: 0.3;
    z-index: 6;
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: auto;
}

.level-indicator {
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.level-indicator .label {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

#level-text {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    color: var(--text-primary);
}

.timeline-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.5s ease;
}

.timeline-indicator.past {
    border-color: var(--past-color);
    box-shadow: 0 0 15px var(--past-glow);
}

.timeline-indicator.future {
    border-color: var(--future-color);
    box-shadow: 0 0 15px var(--future-glow);
}

.indicator-ring {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.5s ease;
}

.timeline-indicator.past .indicator-ring {
    background: var(--past-color);
    box-shadow: 0 0 10px var(--past-color);
}

.timeline-indicator.future .indicator-ring {
    background: var(--future-color);
    box-shadow: 0 0 10px var(--future-color);
}

#timeline-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 14px;
}

.right-controls {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

#hint-panel {
    background: var(--ui-bg);
    border-left: 4px solid var(--past-color);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 4px 8px 8px 4px;
    align-self: center;
    max-width: 400px;
    text-align: center;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    transition: opacity 0.3s;
}

.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: auto;
}

#start-screen {
    background: radial-gradient(circle at center, rgba(45, 30, 21, 0.9) 0%, rgba(10, 14, 23, 0.95) 100%);
}

.logo-container {
    text-align: center;
    margin-bottom: 50px;
}

.game-title {
    font-family: 'Cinzel', serif;
    font-size: 64px;
    color: #fff;
    line-height: 1.1;
    text-shadow: 0 0 30px rgba(255,255,255,0.5);
    margin-bottom: 10px;
}

.title-sub {
    color: var(--future-color);
    text-shadow: 0 0 20px var(--future-glow);
}

.tagline {
    font-size: 16px;
    letter-spacing: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.primary-btn {
    background: linear-gradient(135deg, var(--past-color), #d35400);
    color: white;
    border: none;
    padding: 15px 40px;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 10px 30px var(--past-glow);
    transition: all 0.3s;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.primary-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px var(--past-glow);
}

.primary-btn:hover::before {
    left: 100%;
}

.secondary-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--ui-border);
    padding: 12px 30px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    letter-spacing: 1px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 40px 0;
    background: rgba(0,0,0,0.5);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.step {
    display: flex;
    align-items: center;
    gap: 20px;
}

.step-icon {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 10px 15px;
    border-radius: 6px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    min-width: 80px;
    text-align: center;
}

.step-icon.highlight {
    background: rgba(0, 210, 255, 0.2);
    border-color: var(--future-color);
    color: var(--future-color);
}

.tutorial-note {
    color: var(--past-color);
    font-style: italic;
    font-size: 18px;
    text-align: center;
    width: 100%;
}

h2 {
    font-family: 'Cinzel', serif;
    font-size: 48px;
    color: white;
    margin-bottom: 30px;
}

.success-text {
    color: #2ecc71;
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
}

.stats {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 15;
}

.dpad, .action-pad {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.action {
    background: rgba(0, 210, 255, 0.2);
    border-color: var(--future-color);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

.time-btn {
    background: rgba(243, 156, 18, 0.2);
    border-color: var(--past-color);
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
}

@media (min-width: 1024px) {
    #mobile-controls {
        display: none;
    }
}
