/* ── RESET & ROOT ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:       #0a0a0c;
    --surface:  #111114;
    --surface2: #17171b;
    --border:   #222228;
    --tape:     #c8a830;
    --tape-dim: #7a6820;
    --text:     #ddd8cc;
    --muted:    #787470;
    --red:      #e05555;
    --green:    #7ad67a;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.65;
    min-height: 100vh;
}

/* ── NAV ── */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 10, 12, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
nav a { color: var(--muted); text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
nav a:hover { color: var(--tape); }
.nav-brand { color: var(--tape); font-weight: 600; font-size: 0.9rem; }
.nav-meta   { color: var(--muted); font-size: 0.73rem; font-family: 'Consolas', monospace; }

/* ── HERO ── */
.hero {
    padding: 6rem 2rem 5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(200,168,48,0.025) 0px,
        rgba(200,168,48,0.025) 3px,
        transparent 3px,
        transparent 28px
    );
    pointer-events: none;
}
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(200,168,48,0.07) 0%, transparent 70%);
    pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; }

.label {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--tape);
    margin-bottom: 1.2rem;
    font-family: 'Consolas', monospace;
}

h1 {
    font-size: clamp(2.4rem, 6vw, 3.8rem);
    font-weight: 700;
    line-height: 1.1;
    color: #fff;
    margin-bottom: 1.2rem;
}

.tagline {
    font-size: 1.05rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 2rem;
}
.tagline .hl { color: var(--red); font-weight: 600; font-style: italic; }

.pills { display: flex; gap: 0.55rem; justify-content: center; flex-wrap: wrap; }
.pill {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 0.28rem 0.85rem;
    border-radius: 20px;
    font-family: 'Consolas', monospace;
}

/* ── LAYOUT ── */
hr.divider { max-width: 940px; margin: 0 auto; border: none; border-top: 1px solid var(--border); }

.section { max-width: 940px; margin: 0 auto; padding: 4rem 2rem; }

.section-label {
    font-size: 0.68rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--tape);
    margin-bottom: 1.8rem;
    font-family: 'Consolas', monospace;
}

/* ── CHALLENGE ── */
.challenge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin-bottom: 2rem;
}
.challenge-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
}
.challenge-card h3 {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tape);
    margin-bottom: 0.9rem;
    font-family: 'Consolas', monospace;
}
.challenge-card p { font-size: 0.93rem; line-height: 1.75; }

pre {
    background: #0d0d0f;
    border: 1px solid var(--border);
    border-left: 3px solid var(--tape-dim);
    border-radius: 4px;
    padding: 1.1rem 1.3rem;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
    color: #b8d4b0;
    overflow-x: auto;
    line-height: 1.85;
}

.crashes-title {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tape);
    margin-bottom: 0.9rem;
    font-family: 'Consolas', monospace;
}
.crash-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.8rem; }
.crash-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem 1.2rem;
}
.crash-id {
    font-family: 'Consolas', monospace;
    font-size: 0.76rem;
    color: var(--tape);
    background: rgba(200,168,48,0.1);
    border: 1px solid rgba(200,168,48,0.22);
    padding: 0.18rem 0.5rem;
    border-radius: 3px;
    flex-shrink: 0;
}
.crash-item strong { font-size: 0.9rem; }
.crash-item code {
    font-family: 'Consolas', monospace;
    font-size: 0.82rem;
    background: rgba(255,255,255,0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    color: #b8d4b0;
}
.crash-max {
    margin-left: auto;
    font-size: 0.74rem;
    color: var(--muted);
    font-family: 'Consolas', monospace;
    flex-shrink: 0;
}
.crashes-note { font-size: 0.8rem; color: var(--muted); font-style: italic; }

/* ── LEADERBOARD ── */
.leaderboard-wrap {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }

thead tr {
    background: var(--surface2);
    border-bottom: 2px solid var(--tape-dim);
}
thead th {
    padding: 0.8rem 1rem;
    text-align: left;
    font-size: 0.67rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tape);
    white-space: nowrap;
    font-family: 'Consolas', monospace;
}
thead th.center { text-align: center; }

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }

td { padding: 0.7rem 1rem; color: var(--text); vertical-align: middle; }
td.center { text-align: center; }

/* Rank */
.rank-badge { font-size: 1.1rem; }
.rank-num   { font-size: 0.78rem; color: var(--muted); font-family: 'Consolas', monospace; }
.rank-dq-b  { font-size: 0.7rem; color: #3e3e48; font-family: 'Consolas', monospace; font-weight: 700; letter-spacing: 0.1em; }
.rank-skull { font-size: 0.95rem; }

/* Row tints */
.rank-1  { background: rgba(255,193,7,0.03); }
.rank-2  { background: rgba(150,160,170,0.025); }
.rank-3  { background: rgba(192,120,48,0.025); }
.row-dq  { opacity: 0.4; }

/* AI cell */
.ai-name  { font-weight: 500; display: block; }
.ai-badge { font-size: 0.71rem; color: var(--muted); display: block; margin-top: 0.1rem; }

/* Score cells */
.s3 { color: #7ad67a; font-weight: 600; font-family: 'Consolas', monospace; }
.s2 { color: #a8c870; font-family: 'Consolas', monospace; }
.s1 { color: var(--muted); font-family: 'Consolas', monospace; }
.s0 { color: #3e3e48; font-family: 'Consolas', monospace; }
.sn { color: #2a2a34; font-family: 'Consolas', monospace; }

/* Bonus / Malus */
.bn { color: #7ad67a; font-family: 'Consolas', monospace; font-weight: 600; }
.ml { color: var(--red); font-family: 'Consolas', monospace; font-weight: 600; }

/* Total */
.tot    { font-weight: 700; font-size: 0.95rem; font-family: 'Consolas', monospace; }
.t7     { color: #ffc107; }
.t6     { color: #98a4ae; }
.t5     { color: #c07830; }
.tpos   { color: var(--text); }
.tlow   { color: var(--muted); }
.tneg   { color: var(--red); }
.tdq    { color: #3a3a44; font-style: italic; }

/* ── SCORING CARDS ── */
.scoring-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
}
.scoring-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.3rem;
}
.scoring-card h3 {
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.9rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
    font-family: 'Consolas', monospace;
}
.sc-crash h3 { color: var(--tape); }
.sc-bonus h3 { color: var(--green); }
.sc-malus h3 { color: var(--red); }

.scoring-card table  { font-size: 0.82rem; }
.scoring-card tbody tr         { border-bottom: none; }
.scoring-card tbody tr:hover   { background: none; }
.scoring-card td { padding: 0.28rem 0; border: none; color: var(--text); vertical-align: top; }
.scoring-card td:first-child   { width: 2.4rem; font-weight: 700; font-family: 'Consolas', monospace; }
.sc-crash td:first-child { color: var(--tape); }
.sc-bonus td:first-child { color: var(--green); }
.sc-malus td:first-child { color: var(--red); }

/* ── NOTES ── */
.notes-list { display: flex; flex-direction: column; gap: 0.5rem; }

details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
}
details[open] { border-color: var(--tape-dim); }

summary {
    padding: 0.85rem 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    font-weight: 500;
    list-style: none;
    user-select: none;
    transition: background 0.12s;
}
summary::-webkit-details-marker { display: none; }
summary:hover { background: rgba(255,255,255,0.03); }
summary::after {
    content: '›';
    color: var(--muted);
    font-size: 1.15rem;
    transition: transform 0.2s;
    margin-left: 0;
    flex-shrink: 0;
}
details[open] summary::after { transform: rotate(90deg); }

.nscore {
    font-family: 'Consolas', monospace;
    font-size: 0.74rem;
    padding: 0.17rem 0.52rem;
    border-radius: 3px;
    border: 1px solid var(--border);
    margin-left: auto;
    margin-right: 0.5rem;
    flex-shrink: 0;
}
.ns7  { color: #ffc107; border-color: rgba(255,193,7,0.3); }
.ns6  { color: #98a4ae; border-color: rgba(152,164,174,0.3); }
.ns5  { color: #c07830; border-color: rgba(192,120,48,0.3); }
.nsp  { color: var(--green); border-color: rgba(122,214,122,0.25); }
.nsl  { color: var(--muted); }
.nsn  { color: var(--red); border-color: rgba(224,85,85,0.3); }
.nsdq { color: #3e3e48; }

.note-body {
    padding: 1rem 1.2rem 1.2rem;
    border-top: 1px solid var(--border);
    font-size: 0.87rem;
    line-height: 1.78;
}
.note-body code {
    background: rgba(255,255,255,0.07);
    padding: 0.1rem 0.38rem;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
    font-size: 0.81rem;
    color: #b8d4b0;
}

/* ── DOWNLOAD ── */
.download-box {
    background: var(--surface);
    border: 1px solid var(--tape-dim);
    border-radius: 8px;
    padding: 2.8rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.download-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(200,168,48,0.02) 0px,
        rgba(200,168,48,0.02) 3px,
        transparent 3px,
        transparent 28px
    );
    pointer-events: none;
}
.download-box h2 { font-size: 1.3rem; margin-bottom: 0.5rem; color: #fff; position: relative; }
.download-box p  { color: var(--muted); margin-bottom: 1.6rem; font-size: 0.9rem; position: relative; }
.btn-dl {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--tape);
    color: #0a0a0c;
    padding: 0.8rem 2rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}
.btn-dl:hover { background: #ddb838; transform: translateY(-1px); }

/* ── FOOTER ── */
footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--muted);
}
footer a   { color: var(--tape-dim); text-decoration: none; }
footer a:hover { color: var(--tape); }
footer em  { color: var(--tape); font-style: normal; }

/* ── RESPONSIVE ── */
@media (max-width: 740px) {
    .challenge-grid { grid-template-columns: 1fr; }
    .scoring-grid   { grid-template-columns: 1fr; }
    .ai-badge       { display: none; }
    thead th, td    { padding: 0.55rem 0.65rem; }
    h1              { font-size: 2.2rem; }
    .hero           { padding: 4rem 1.5rem 3.5rem; }
}
