/* Still There? — dumbshit.app */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #09090b;
    --bg-2: #18181b;
    --bg-3: #27272a;
    --border: #3f3f46;
    --text: #fafafa;
    --text-dim: #a1a1aa;
    --text-mute: #71717a;
    --accent: #10b981;
    --accent-hov: #34d399;
    --danger: #ef4444;
    --warn: #fbbf24;
    --mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ===== background layers ===== */
.bg-gradient, .bg-particles {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
}
.bg-gradient {
    background: linear-gradient(135deg, #0c1530, #1a0c30, #300c1f, #0c1530);
    background-size: 400% 400%;
    animation: bgShift 60s ease-in-out infinite;
    opacity: 0.7;
}
.bg-gradient.intense {
    animation: bgShift 18s ease-in-out infinite;
    opacity: 1;
}
@keyframes bgShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
.bg-particles { width: 100%; height: 100%; opacity: 0.45; }

/* ===== topbar ===== */
.topbar {
    padding: 24px 24px 8px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.back {
    color: var(--text-mute);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 12px;
}
.back:hover { color: var(--text); }
.topbar h1 {
    margin: 12px 0 4px;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.topbar h1 .qmark { color: var(--accent); }
.topbar .sub { margin: 0; color: var(--text-dim); font-size: 15px; }

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 60px;
    position: relative;
    z-index: 1;
}

/* ===== cards ===== */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 560px;
    margin: 0 auto;
}
.card-title {
    margin: 0 0 16px;
    font-size: 16px;
    font-family: var(--mono);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.field { display: block; margin-bottom: 14px; }
input[type=text] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 15px;
    padding: 13px 14px;
    width: 100%;
    transition: border-color 0.15s;
}
input[type=text]:focus { outline: none; border-color: var(--accent); }

.rules-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); margin: 16px 0 8px; }
.rules { padding-left: 18px; margin: 0 0 18px; color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.rules li { margin-bottom: 6px; }
.rules strong { color: var(--text); }
.rules em { color: var(--accent); font-style: normal; font-family: var(--mono); }

.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-3);
    color: var(--text);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 11px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}
.btn:hover:not(:disabled) { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); width: 100%; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hov); border-color: var(--accent-hov); }
.btn.big { padding: 14px 18px; font-size: 16px; }

.error { margin: 10px 0 0; padding: 10px 12px; background: rgba(239,68,68,0.08); border: 1px solid var(--danger); border-radius: 8px; color: #fecaca; font-size: 13px; }

/* ===== game layout ===== */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    align-items: start;
}
@media (max-width: 800px) {
    .game-grid { grid-template-columns: 1fr; }
}

.court {
    background: rgba(24, 24, 27, 0.6);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 16px;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}
.timer {
    font-family: var(--mono);
    font-size: clamp(36px, 8vw, 72px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 24px rgba(16, 185, 129, 0.2);
}
.status-pill {
    margin-top: 28px;
    padding: 7px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-mute);
    letter-spacing: 0.04em;
}

/* ===== leaderboard ===== */
.leaderboard {
    background: rgba(24, 24, 27, 0.7);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
}
.lb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lb-title { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); }
.lb-tabs { display: flex; gap: 2px; background: var(--bg); border-radius: 6px; padding: 2px; }
.lb-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-mute);
    font-family: var(--mono);
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.lb-tab:hover { color: var(--text); }
.lb-tab.is-active { background: var(--accent); color: var(--bg); }

.lb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.lb-row {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    background: var(--bg);
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 12px;
}
.lb-row.empty { color: var(--text-mute); font-style: italic; justify-content: center; display: flex; }
.lb-rank   { color: var(--text-mute); font-weight: 700; }
.lb-alias  { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-time   { color: var(--accent); font-variant-numeric: tabular-nums; }
.lb-row.is-me { background: rgba(16, 185, 129, 0.10); border: 1px solid rgba(16, 185, 129, 0.3); }
.lb-row.is-me .lb-rank, .lb-row.is-me .lb-alias { color: var(--accent); }

/* ===== modal ===== */
.modal {
    position: fixed;
    width: 300px;
    z-index: 50;
    animation: modalPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes modalPop {
    0%   { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}
.modal-card {
    background: var(--bg-2);
    border: 2px solid var(--accent);
    border-radius: 14px;
    padding: 20px 18px 14px;
    box-shadow: 0 24px 60px -10px rgba(0,0,0,0.7), 0 0 0 1px rgba(16,185,129,0.2);
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; text-align: center; }
.modal-card .yes-btn {
    width: 100%;
    background: var(--accent);
    color: var(--bg);
    border: 0;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    padding: 11px;
    border-radius: 8px;
    cursor: pointer;
}
.modal-card .yes-btn:hover { background: var(--accent-hov); }
.modal-card .color-row { display: flex; gap: 8px; }
.modal-card .color-btn {
    flex: 1;
    border: 2px solid transparent;
    border-radius: 8px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.08s, border-color 0.12s;
}
.modal-card .color-btn:hover { transform: scale(1.04); border-color: rgba(255,255,255,0.4); }
.modal-card .color-btn[data-color="red"]    { background: #ef4444; }
.modal-card .color-btn[data-color="blue"]   { background: #3b82f6; }
.modal-card .color-btn[data-color="green"]  { background: #22c55e; }
.modal-card .color-btn[data-color="yellow"] { background: #fbbf24; }
.modal-card .color-btn[data-color="purple"] { background: #a855f7; }
.modal-card .color-btn[data-color="orange"] { background: #f97316; }
.modal-card .word-target {
    text-align: center;
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    margin: 4px 0 10px;
    letter-spacing: 0.04em;
}
.modal-card .typed-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 15px;
    padding: 10px;
    text-align: center;
}
.modal-card .typed-input:focus { outline: none; border-color: var(--accent); }
.modal-card .math-expr {
    text-align: center;
    font-family: var(--mono);
    font-size: 26px;
    color: var(--accent);
    margin: 4px 0 10px;
    letter-spacing: 0.04em;
}
.modal-bar {
    margin-top: 12px;
    height: 4px;
    background: var(--bg-3);
    border-radius: 999px;
    overflow: hidden;
}
.modal-bar-fill {
    height: 100%;
    background: var(--accent);
    width: 100%;
    transition: background 0.2s;
}
.modal-bar-fill.urgent { background: var(--danger); }

/* ===== achievement toast ===== */
.achievement {
    position: fixed;
    z-index: 60;
    padding: 10px 16px;
    background: var(--bg-2);
    border: 1px solid var(--accent);
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    letter-spacing: 0.04em;
    animation: achPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    box-shadow: 0 8px 20px -6px rgba(16, 185, 129, 0.4);
}
@keyframes achPop {
    0%   { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}

/* ===== dead screen ===== */
.duration-big {
    text-align: center;
    font-family: var(--mono);
    font-size: clamp(42px, 9vw, 84px);
    font-weight: 700;
    color: var(--accent);
    margin: 16px 0;
    letter-spacing: -0.02em;
}
.cause { text-align: center; color: var(--text-dim); margin: 0 0 6px; font-size: 14px; }
.rank  { text-align: center; color: var(--text-mute); margin: 0 0 20px; font-family: var(--mono); font-size: 13px; }
.share-block {
    margin-bottom: 18px;
}
.share-label {
    text-align: center;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-mute);
    text-transform: uppercase;
    margin-bottom: 10px;
}
.dead-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.dead-actions .btn { width: 100%; }

/* ===== big 1h flash overlay ===== */
.hour-flash {
    position: fixed; inset: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 200;
    animation: hourFlash 0.6s ease-out both;
    pointer-events: none;
}
@keyframes hourFlash {
    0%   { opacity: 0; }
    20%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== foot ===== */
.foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    color: var(--text-mute);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    position: relative;
    z-index: 1;
}
.bmc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-mute);
    text-decoration: none;
    transition: color 0.15s;
}
.bmc-link:hover { color: #FFDD00; }
