:root {
    --bg-color: #020617;
    --snake-white: #ffffff;
    --accent: #10b981;
    --danger: #f43f5e;
    --god-mode: #facc15;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    cursor: crosshair;
}

canvas {
    display: block;
}

.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px;
    box-sizing: border-box;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.ui-layer.hidden {
    opacity: 0;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.leaderboard {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-size: 0.75rem;
    min-width: 150px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard h3 {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    border-bottom: 1px solid rgba(16, 185, 129, 0.3);
    padding-bottom: 4px;
}

.leaderboard-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
    font-family: monospace;
}

.leaderboard-row.is-player {
    color: var(--accent);
    font-weight: bold;
}

#buffArea {
    margin-top: 8px;
    padding: 4px 10px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#buffArea.hidden {
    display: none;
}

.buff-icon {
    font-weight: bold;
    font-size: 0.8rem;
}

#speedBoostVal {
    font-weight: bold;
}

#godBadge {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--god-mode);
    color: black;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: none;
    box-shadow: 0 0 20px var(--god-mode);
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: auto;
    backdrop-filter: blur(12px);
    text-align: center;
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
}

.overlay.hidden {
    display: none !important;
}

.logo-main {
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 900;
    margin: 0 0 5px 0;
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #064e3b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -3px;
}

.version-label {
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 800px;
    margin-bottom: 20px;
}

.setting-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

.setting-box.full {
    grid-column: span 4;
}

.setting-box.half {
    grid-column: span 2;
}

.setting-box label {
    display: block;
    color: #64748b;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.setting-box .val {
    float: right;
    color: #cbd5e1;
    font-family: monospace;
    font-size: 0.75rem;
}

.select-input,
.text-input {
    width: 100%;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
}

.text-input {
    cursor: text;
}

input[type=range] {
    width: 100%;
    accent-color: #10b981;
    cursor: pointer;
    margin: 4px 0;
}

.btn-main {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    font-size: 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 8px;
}

.btn-main:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 6px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.shortcut-pill {
    background: rgba(255, 255, 255, 0.05);
    padding: 1px 4px;
    border-radius: 3px;
    color: #10b981;
    font-weight: bold;
}

.checkbox-container {
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    margin-top: 4px;
}

.checkbox-container input {
    cursor: pointer;
}

/* Pill Switch UI */
.pill-switch {
    position: relative;
    display: flex;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    padding: 2px;
    width: 120px;
    height: 28px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.pill-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 58px;
    height: 24px;
    background: var(--accent);
    border-radius: 18px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    z-index: 1;
}

.pill-option {
    flex: 1;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #64748b;
    transition: color 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none;
}

.pill-option.active {
    color: white;
}

/* Virtual Joystick */
#virtualJoystick {
    position: absolute;
    width: 240px;
    height: 240px;
    background: transparent;
    border: 2px solid black;
    border-radius: 50%;
    pointer-events: none;
    display: none;
    z-index: 100;
    transform: translate(-50%, -50%);
}

#joystickKnob {
    position: absolute;
    width: 80px;
    height: 80px;
    background: #10b981;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.start-setting {
    margin: 15px 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
}

.mobile-controls {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 12px;
    z-index: 150;
    pointer-events: auto;
}

.mobile-btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active {
    background: rgba(16, 185, 129, 0.4);
    transform: scale(0.9);
}

.hidden {
    display: none !important;
}

/* Simple Graphics / Performance Mode */
body.simple-graphics .overlay {
    backdrop-filter: none;
    background: rgba(2, 6, 23, 1.0);
}

body.simple-graphics .leaderboard,
body.simple-graphics .setting-box,
body.simple-graphics .select-input,
body.simple-graphics .text-input {
    backdrop-filter: none;
    background: #0f172a;
    border: 1px solid #1e293b;
}

body.simple-graphics #buffArea {
    background: #1e1b00;
    box-shadow: none;
}

.reset-trigger {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.reset-trigger:hover {
    color: #38bdf8;
}