/* ===== CSS Custom Properties & Theming ===== */
:root {
    /* Light theme (default) */
    --bg-primary: #f0f4ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8888aa;
    --accent: #6c5ce7;
    --accent-hover: #5a4bd1;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --border: #e0e0f0;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.12);
    --toggle-bg: #ddd;
    --toggle-active: #6c5ce7;
    --kbd-bg: #e8e8f0;
    --kbd-border: #ccc;
    --game-bg: #0a0a2e;
}

[data-theme="dark"] {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a35;
    --bg-card: #1e1e3a;
    --text-primary: #e8e8ff;
    --text-secondary: #b0b0d0;
    --text-muted: #6a6a8a;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-glow: rgba(167, 139, 250, 0.3);
    --border: #2a2a4a;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --toggle-bg: #333;
    --toggle-active: #a78bfa;
    --kbd-bg: #2a2a4a;
    --kbd-border: #444;
    --game-bg: #050510;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

/* ===== Screen Management ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 1;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-bg);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--toggle-active);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* ===== Keyboard Keys ===== */
kbd {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.85em;
    font-family: inherit;
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--kbd-border);
}
