/* ─────────────────────────────────────────
   Snaker – Global Styles  (Slither.io Dark)
   ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #131326;
    --glass-bg:    rgba(20, 20, 50, 0.82);
    --glass-border:rgba(255,255,255,0.10);
    --accent:      #4ade80;
    --accent2:     #3b82f6;
    --text:        #e2e8f0;
    --text-muted:  #94a3b8;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    user-select: none;
    -webkit-user-select: none;
}

#game-canvas {
    position: fixed; inset: 0;
    display: block;
    cursor: none;
}

#ui-layer {
    position: fixed; inset: 0;
    pointer-events: none;
}

/* ── Glass helpers ── */
.glass-panel,
.glass-panel-small {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* ═══════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════ */
#login-screen {
    position: fixed; inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: radial-gradient(ellipse at 50% 60%, rgba(59,130,246,.15) 0%, transparent 70%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 2rem 2.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.logo-wrap { text-align: center; }
.logo-text  { font-size: 2.6rem; font-weight: 800; letter-spacing: -1px; }
.logo-sub   { color: var(--text-muted); font-size: .95rem; margin-top: 2px; }

input[type="text"],
select {
    width: 100%;
    padding: .75rem 1rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: border-color .2s;
}
input[type="text"]:focus,
select:focus { border-color: var(--accent); }
select option { background: #1e1e3a; }

button#play-btn {
    padding: .85rem;
    background: linear-gradient(135deg, var(--accent), #22c55e);
    border: none; border-radius: 10px;
    color: #fff; font-size: 1.1rem; font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    pointer-events: auto;
}
button#play-btn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
button#play-btn:disabled             { opacity: .4; cursor: not-allowed; }

#error-msg { color: #f87171; font-size: .9rem; text-align: center; min-height: 1.2rem; }

/* ── Skin Selector ── */
.section-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.skin-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin-top: .4rem;
}
.skin-swatch {
    height: 38px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .15s, border-color .15s;
}
.skin-swatch:hover  { transform: scale(1.08); }
.skin-swatch.active { border-color: #fff; }

.color-row {
    display: flex; align-items: center; gap: .6rem;
    flex-wrap: wrap;
    font-size: .88rem;
    color: var(--text-muted);
}
input[type="color"] {
    width: 36px; height: 30px;
    border: none; border-radius: 6px;
    padding: 2px; cursor: pointer;
    background: transparent;
}

.pattern-row {
    display: flex; align-items: center; gap: .5rem;
    font-size: .88rem;
    color: var(--text-muted);
    margin-top: .4rem;
}
.pattern-btn {
    padding: .3rem .75rem;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: .82rem;
    cursor: pointer;
    transition: background .15s;
}
.pattern-btn.active { background: var(--accent); border-color: var(--accent); color: #000; }

#skin-preview {
    display: block;
    margin: .5rem auto 0;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.btn-secondary {
    padding: .45rem; width: 100%;
    border-radius: 8px; border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.07);
    color: #fff; cursor: pointer;
    font-size: .88rem;
    transition: background .15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.14); }

.btn-tiny {
    padding: .2rem .5rem;
    border-radius: 6px; border: 1px solid var(--glass-border);
    background: transparent; color: var(--text-muted);
    cursor: pointer; font-size: .78rem;
}

/* ═══════════════════════════════
   HUD
   ═══════════════════════════════ */
#leaderboard {
    position: absolute;
    top: 20px; right: 20px;
    min-width: 190px;
    padding: .9rem 1.1rem;
    pointer-events: none;
}
#leaderboard h3 {
    font-size: .9rem; font-weight: 700;
    margin-bottom: .6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}
#leaderboard-list { list-style: none; }
#leaderboard-list li {
    display: flex; justify-content: space-between;
    font-size: .88rem;
    padding: .18rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
#leaderboard-list li:last-child { border: none; }
.lb-me { color: var(--accent); font-weight: 700; }
.lb-score { color: var(--text-muted); }

/* Stats bar – bottom centre like Slither.io */
#stats-bar {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.4rem;
    pointer-events: none;
}
.stat-item {
    display: flex; flex-direction: column; align-items: center;
}
.stat-item span:first-child {
    font-size: 2rem; font-weight: 800;
    color: #fff;
    line-height: 1;
}
.stat-label {
    font-size: .75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .1em;
}
.stat-sep { color: rgba(255,255,255,0.2); font-size: 2rem; }

/* Zone timer */
#zone-timer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: .4rem 1rem;
    font-size: .85rem;
    color: #93c5fd;
    pointer-events: none;
    white-space: nowrap;
}

/* Minimap */
#minimap {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 150px; height: 150px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    pointer-events: none;
}

/* Chat */
#chat-container {
    position: absolute;
    bottom: 20px; left: 20px;
    width: 290px;
    padding: .7rem .8rem;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
#chat-messages {
    height: 120px;
    overflow-y: auto;
    display: flex; flex-direction: column;
    justify-content: flex-end;
    font-size: .85rem;
    line-height: 1.45;
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.chat-msg strong { color: var(--accent); }

#chat-input {
    border: none;
    border-top: 1px solid var(--glass-border);
    border-radius: 0;
    padding: .4rem 0;
    background: transparent;
    font-size: .85rem;
}
#chat-input:focus { border-color: var(--accent); }
