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

:root {
    /* macOS Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-header: linear-gradient(180deg, #e8e8e8 0%, #d1d1d1 100%);
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-dim: #666666;
    --text-error: #c41a16;
    --text-warning: #826b28;
    --text-info: #0451a5;
    --text-success: #127f12;
    --text-muted: #888888;
    --accent: #007aff;
    --border-color: #c8c8c8;
    --selection: rgba(0, 122, 255, 0.2);
    --red: #ff5f56;
    --yellow: #ffbd2e;
    --green: #27c93f;
    --dot-border: rgba(0,0,0,0.12);
}

[data-theme="dark"] {
    /* macOS Dark Theme */
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d2d;
    --bg-header: linear-gradient(180deg, #3a3a3a 0%, #2d2d2d 100%);
    --text-primary: #cccccc;
    --text-secondary: #aaaaaa;
    --text-dim: #666666;
    --text-error: #f48771;
    --text-warning: #cca700;
    --text-info: #6cb6ff;
    --text-success: #89d185;
    --text-muted: #666666;
    --accent: #0a84ff;
    --border-color: #404040;
    --selection: rgba(10, 132, 255, 0.3);
    --dot-border: rgba(255,255,255,0.12);
}

[data-theme="zen"] {
    /* Zen Mode - Warm, easy on eyes */
    --bg-primary: #faf8f5;
    --bg-secondary: #f0ede8;
    --bg-header: linear-gradient(180deg, #e8e4dd 0%, #ddd9d2 100%);
    --text-primary: #4a4543;
    --text-secondary: #5c5856;
    --text-dim: #8a8582;
    --text-error: #b35c4a;
    --text-warning: #8a7340;
    --text-info: #4a6fa5;
    --text-success: #5a8a5a;
    --text-muted: #9a9590;
    --accent: #7a9ec2;
    --border-color: #d5d0c8;
    --selection: rgba(122, 158, 194, 0.2);
    --red: #e07a6a;
    --yellow: #e0c078;
    --green: #7ab87a;
    --dot-border: rgba(0,0,0,0.08);
}

[data-theme="zen-dark"] {
    /* Zen Dark - Warm dark theme */
    --bg-primary: #282420;
    --bg-secondary: #332e2a;
    --bg-header: linear-gradient(180deg, #3d3632 0%, #332e2a 100%);
    --text-primary: #d4cfc8;
    --text-secondary: #b8b2aa;
    --text-dim: #6a645e;
    --text-error: #d4a090;
    --text-warning: #d4bc8a;
    --text-info: #8ab4d4;
    --text-success: #a4c8a4;
    --text-muted: #7a746e;
    --accent: #a0c4e4;
    --border-color: #4a4440;
    --selection: rgba(160, 196, 228, 0.2);
    --red: #d49080;
    --yellow: #d4c498;
    --green: #98c898;
    --dot-border: rgba(255,255,255,0.08);
}

body {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Boot Screen */
#boot-screen {
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
    padding: 2rem;
}

.boot-text {
    max-width: 800px;
    width: 100%;
}

#boot-sequence {
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--text-primary);
}

#start-btn {
    margin-top: 1.5rem;
    padding: 0;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    white-space: pre;
}

#start-btn::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--text-primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#start-btn:hover {
    color: var(--accent);
}

#start-btn:hover::after {
    background: var(--accent);
}

#start-btn.hidden {
    display: none;
}

/* Terminal Screen */
#terminal-screen {
    background: var(--bg-primary);
}

#terminal-header {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 38px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
    -webkit-app-region: drag;
}

.terminal-dots {
    display: flex;
    gap: 8px;
    padding: 0 4px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--dot-border);
}

.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }

#terminal-title {
    flex: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

#stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}

#stats span {
    padding: 3px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    color: var(--text-secondary);
}

#level-display { color: var(--text-info); }
#souls-display { color: var(--accent); }
#deaths-display { color: var(--text-error); }

#theme-toggle {
    padding: 4px 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    font-size: 11px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

#theme-toggle:hover {
    background: var(--border-color);
}

#terminal-body {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
}

#output {
    font-size: 13px;
    line-height: 1.5;
}

#output .line {
    margin-bottom: 2px;
    word-wrap: break-word;
}

#output .system {
    color: var(--text-info);
    font-weight: 600;
}

#output .error {
    color: var(--text-error);
}

#output .warning {
    color: var(--text-warning);
}

#output .success {
    color: var(--text-success);
}

#output .hint {
    color: var(--text-muted);
    font-style: italic;
}

#output .narrator {
    color: var(--accent);
    font-style: italic;
}

#output .command {
    color: var(--text-secondary);
}

#output .file {
    color: var(--text-primary);
}

#output .directory {
    color: var(--text-info);
    font-weight: 600;
}

#output .ascii-art {
    color: var(--text-dim);
    line-height: 1.2;
}

#input-line {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 2px 0;
    margin-top: 2px;
}

#prompt {
    color: var(--text-secondary);
    white-space: nowrap;
    margin-right: 8px;
}

#command-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    caret-color: var(--text-primary);
}

#command-input::selection {
    background: var(--selection);
}

#cursor {
    display: none;
}

/* Death Screen */
#death-screen {
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
}

.death-content {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
}

.death-content h1 {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 24px;
    font-weight: 400;
    color: var(--text-error);
    margin-bottom: 1.5rem;
}

#death-message {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.death-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

#respawn-btn, #restart-btn {
    padding: 0;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

#respawn-btn:hover, #restart-btn:hover {
    color: var(--accent);
}

/* Victory Screen */
#victory-screen {
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
}

.victory-content {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
}

.victory-content h1 {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 24px;
    font-weight: 400;
    color: var(--text-success);
    margin-bottom: 1.5rem;
}

#victory-stats {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.victory-message {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Scrollbar - macOS style */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
    opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Remove CRT effect for clean look */
#game-container::before {
    display: none;
}


/* Selection color */
::selection {
    background: var(--selection);
}

/* Focus styles */
#command-input:focus {
    outline: none;
}

/* Smooth theme transitions */
#terminal-body,
#output .line,
#prompt,
#stats span {
    transition: color 0.3s ease, background 0.3s ease;
}
