/* High Score - A Free Design by Bryant Smith (bryantsmith.com)

   The whole page is an arcade cabinet: a dark screen with glowing neon
   type, a ranked table of projects, and a blinking "INSERT COIN" prompt.
   Every colour, size and shape is gathered in the section below, so you
   can change the mood of the cabinet from one place. Look for the
   section headings to find what you want to edit. */


/* ---- COLOURS: change these and the whole cabinet follows ---- */

:root {
    --cabinet: #070512;   /* the dark room behind the cabinet      */
    --screen:  #050410;   /* the glass of the screen itself        */
    --panel:   #100b22;   /* side panels and note boxes            */
    --line:    #2a2352;   /* thin purple borders and rules         */
    --text:    #d8d3f5;   /* main readable writing                 */
    --muted:   #8f88c4;   /* quieter labels and captions           */
    --cyan:    #3df2ff;   /* the main neon accent                  */
    --pink:    #ff2f92;   /* the second neon accent                */
    --gold:    #ffd23f;   /* used only for first place and coins   */

    /* the stepped "pixel" corner reused on every frame */
    --notch: 8px;
    --pixel: polygon(
        0 var(--notch), var(--notch) var(--notch), var(--notch) 0,
        calc(100% - var(--notch)) 0, calc(100% - var(--notch)) var(--notch), 100% var(--notch),
        100% calc(100% - var(--notch)), calc(100% - var(--notch)) calc(100% - var(--notch)), calc(100% - var(--notch)) 100%,
        var(--notch) 100%, var(--notch) calc(100% - var(--notch)), 0 calc(100% - var(--notch))
    );
}


/* ---- RESET + BASE ---- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--cabinet);
    background-image:
        radial-gradient(760px 420px at 72% -5%, rgba(255, 47, 146, 0.12), transparent 70%),
        radial-gradient(680px 460px at 15% 105%, rgba(61, 242, 255, 0.09), transparent 70%);
    color: var(--text);
    font-family: "Courier New", Courier, monospace;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--pink);
    color: #12021a;
}

a {
    color: var(--cyan);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    color: #a9f8ff;
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}


/* ---- PAGE: the cabinet, held to a comfortable width ---- */

#page {
    margin: 0 auto;
    max-width: 940px;
    padding: 44px 20px 0 20px;
}


/* ---- CABINET: a narrow lit rail beside the wide playfield.
       The grid is the layout: 280px of sign, then the screen. ---- */

.cabinet {
    align-items: start;
    display: grid;
    gap: 30px;
    grid-template-columns: 280px minmax(0, 1fr);
}


/* ---- PIXEL FRAMES: the stepped neon border around panels.
       The soft glow sits on the outer .frame-glow because clip-path
       would otherwise cut a box-shadow clean off. ---- */

.frame-glow {
    filter: drop-shadow(0 0 14px rgba(61, 242, 255, 0.35));
}

.frame-glow.pink {
    filter: drop-shadow(0 0 16px rgba(255, 47, 146, 0.42));
}

.pixel-frame {
    background: var(--cyan);
    clip-path: var(--pixel);
    padding: 3px;
}

.pixel-frame.pink {
    background: var(--pink);
}

.pixel-frame > .inner {
    background: var(--screen);
    display: block;
}


/* ---- RAIL: the lit marquee sign down the left ---- */

.rail {
    position: sticky;
    top: 24px;
}

.marquee .inner {
    background:
        repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 0, rgba(255, 255, 255, 0.02) 1px, transparent 1px, transparent 4px),
        var(--panel);
    padding: 16px 18px 20px 18px;
    position: relative;
}

/* a chasing row of bulbs across the top of the sign */
.marquee .inner::before {
    animation: chase 1.2s steps(3) infinite;
    background-image: radial-gradient(circle, var(--gold) 0, var(--gold) 2px, transparent 2.5px);
    background-repeat: repeat-x;
    background-size: 18px 6px;
    content: "";
    height: 6px;
    left: 14px;
    position: absolute;
    right: 14px;
    top: 8px;
}

.cabinet-label {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 3px;
    margin-top: 12px;
    text-transform: uppercase;
}

h1 {
    color: #ffffff;
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 3px;
    line-height: 1.05;
    margin-top: 6px;
    text-shadow:
        0 0 5px #ffffff,
        0 0 14px var(--pink),
        0 0 30px rgba(255, 47, 146, 0.7);
    text-transform: uppercase;
}

.tagline {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 2px;
    margin-top: 12px;
    text-transform: uppercase;
}


/* ---- MENU: the vertical row of cabinet controls ---- */

#menu {
    margin-top: 22px;
}

#menu a {
    border-left: 3px solid var(--line);
    color: var(--muted);
    display: block;
    font-size: 12px;
    letter-spacing: 2px;
    padding: 9px 12px;
    text-transform: uppercase;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#menu a::before {
    color: var(--line);
    content: "\203A  ";
}

#menu a:hover,
#menu a:focus-visible {
    background: rgba(61, 242, 255, 0.07);
    border-left-color: var(--cyan);
    color: var(--cyan);
    text-decoration: none;
    text-shadow: 0 0 10px rgba(61, 242, 255, 0.6);
}

#menu a:hover::before,
#menu a:focus-visible::before {
    color: var(--cyan);
}


/* ---- CREDITS: a small key / value score box in the rail ---- */

.credits {
    border: 1px dashed var(--line);
    margin-top: 22px;
    padding: 14px 16px;
}

.credits h2 {
    color: var(--cyan);
    font-size: 11px;
    letter-spacing: 3px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.stats {
    list-style: none;
}

.stats li {
    border-bottom: 1px dotted var(--line);
    color: var(--muted);
    display: flex;
    font-size: 12px;
    justify-content: space-between;
    letter-spacing: 1px;
    padding: 6px 0;
    text-transform: uppercase;
}

.stats li:last-child {
    border-bottom: none;
}

.stats .value {
    color: var(--gold);
}


/* ---- SCREEN: the glass that shows the high-score table ---- */

.screen {
    background: var(--screen);
    overflow: hidden;
    padding: 22px 26px 26px 26px;
    position: relative;
}

/* faint horizontal scanlines over the whole screen */
.screen::before {
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px,
        transparent 1px, transparent 3px
    );
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

/* a pale band that drifts slowly down the glass */
.screen::after {
    animation: sweep 6s linear infinite;
    background: linear-gradient(to bottom, transparent, rgba(61, 242, 255, 0.08), transparent);
    content: "";
    height: 90px;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: -90px;
}

.screen-bar {
    border-bottom: 1px dashed var(--line);
    color: var(--muted);
    display: flex;
    font-size: 10px;
    justify-content: space-between;
    letter-spacing: 2px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    position: relative;
    text-transform: uppercase;
}

.screen-bar .blink-slow {
    animation: blink 1.4s steps(1) infinite;
    color: var(--cyan);
}


/* ---- SCORE TABLE: the ranked list of projects ---- */

.scores {
    border-collapse: collapse;
    position: relative;
    width: 100%;
}

.scores th {
    border-bottom: 2px solid var(--line);
    color: var(--cyan);
    font-size: 11px;
    letter-spacing: 2px;
    padding: 8px 6px;
    text-align: left;
    text-transform: uppercase;
}

.scores th:first-child {
    width: 56px;
}

.scores th:last-child,
.scores td.score {
    text-align: right;
}

.scores td {
    border-bottom: 1px solid rgba(42, 35, 82, 0.7);
    color: var(--text);
    font-size: 15px;
    letter-spacing: 1px;
    padding: 10px 6px;
}

.scores .rank {
    color: var(--muted);
}

.scores .name {
    color: #efecff;
    text-transform: uppercase;
}

/* first place glows gold */
.scores tr.first .rank,
.scores tr.first .name,
.scores tr.first .score {
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 210, 63, 0.55);
}

.scores tr.first .new {
    animation: blink 1s steps(1) infinite;
    background: var(--pink);
    color: #12021a;
    font-size: 9px;
    letter-spacing: 1px;
    margin-left: 8px;
    padding: 1px 5px;
    vertical-align: middle;
}

/* hovering a row lights it up */
.scores tbody tr:hover td {
    background: rgba(61, 242, 255, 0.06);
}

/* the empty slot waiting for your name */
.scores tr.you td {
    border-bottom: none;
    color: var(--muted);
}


/* ---- INSERT COIN: the blinking prompt under the table ---- */

.insert-coin {
    color: var(--gold);
    font-size: 14px;
    letter-spacing: 5px;
    margin-top: 20px;
    position: relative;
    text-align: center;
    text-shadow: 0 0 12px rgba(255, 210, 63, 0.6);
    text-transform: uppercase;
}

.caret {
    animation: blink 1s steps(1) infinite;
    background: var(--gold);
    display: inline-block;
    height: 0.9em;
    margin-left: 8px;
    vertical-align: -0.1em;
    width: 0.55em;
}


/* ---- NOTES: the "how to use" boxes below the screen ---- */

.note {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--pink);
    margin-top: 24px;
    padding: 24px 26px;
}

.note h2 {
    color: var(--cyan);
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.note h2::before {
    color: var(--pink);
    content: "// ";
}

.note p {
    margin-bottom: 14px;
}

.note p:last-child {
    margin-bottom: 0;
}

.note strong {
    color: #ffffff;
}


/* ---- ROUNDS: the numbered list of things to try ---- */

.rounds {
    counter-reset: round;
    list-style: none;
}

.rounds li {
    border-bottom: 1px solid rgba(42, 35, 82, 0.7);
    color: var(--muted);
    padding: 12px 0 12px 42px;
    position: relative;
}

.rounds li:last-child {
    border-bottom: none;
}

.rounds li::before {
    color: var(--gold);
    content: counter(round, decimal-leading-zero);
    counter-increment: round;
    left: 0;
    letter-spacing: 1px;
    position: absolute;
    top: 12px;
}

.rounds strong {
    color: #efecff;
}


/* ---- FOOTER: the required credit link ---- */

#footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 2px;
    margin-top: 40px;
    padding: 26px 20px 40px 20px;
    text-align: center;
    text-transform: uppercase;
}

#footer a,
#footer a:visited {
    color: var(--muted);
}

#footer a:hover {
    color: var(--cyan);
}


/* ---- ANIMATION: the only movement on the page ---- */

@keyframes blink {
    50% { opacity: 0; }
}

@keyframes sweep {
    from { top: -90px; }
    to   { top: 110%; }
}

@keyframes chase {
    to { background-position-x: 18px; }
}


/* ---- MEDIUM SCREENS: the rail moves above the screen ---- */

@media (max-width: 780px) {
    .cabinet {
        gap: 24px;
        grid-template-columns: minmax(0, 1fr);
    }

    .rail {
        position: static;
    }

    #menu {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 8px;
    }

    #menu a {
        border-bottom: 3px solid var(--line);
        border-left: none;
    }

    #menu a:hover,
    #menu a:focus-visible {
        border-bottom-color: var(--cyan);
    }
}


/* ---- SMALL SCREENS: tighten padding and type ---- */

@media (max-width: 640px) {
    #page {
        padding: 24px 14px 0 14px;
    }

    h1 {
        font-size: 28px;
        letter-spacing: 2px;
    }

    .screen {
        padding: 16px 14px 20px 14px;
    }

    .screen-bar {
        font-size: 9px;
        letter-spacing: 1px;
    }

    .scores th {
        font-size: 10px;
    }

    .scores th:first-child {
        width: 34px;
    }

    .scores td {
        font-size: 13px;
        letter-spacing: 0;
        padding: 9px 4px;
    }

    .insert-coin {
        font-size: 12px;
        letter-spacing: 3px;
    }

    .note {
        padding: 20px 18px;
    }

    #footer {
        letter-spacing: 1px;
    }
}


/* ---- REDUCED MOTION: stop the blinking and drifting ---- */

@media (prefers-reduced-motion: reduce) {
    .marquee .inner::before,
    .screen::after,
    .screen-bar .blink-slow,
    .scores tr.first .new,
    .caret {
        animation: none;
    }
}


/* ---- PRINT: plain black ink on white paper ---- */

@media print {
    body {
        background: #ffffff;
        background-image: none;
        color: #000000;
    }

    .pixel-frame,
    .frame-glow {
        background: none;
        clip-path: none;
        filter: none;
        padding: 0;
    }

    .marquee .inner::before,
    .screen::before,
    .screen::after,
    .caret {
        display: none;
    }

    #menu,
    .credits {
        display: none;
    }

    h1,
    .scores tr.first .rank,
    .scores tr.first .name,
    .scores tr.first .score,
    .insert-coin {
        color: #000000;
        text-shadow: none;
    }

    .note {
        border-color: #999999;
    }

    #footer {
        color: #555555;
    }
}
