@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Mono:wght@400;700&display=swap');

:root {
    color-scheme: dark;
    --night: #001217;
    --navy: #001f28;
    --panel: #003a45;
    --teal: #23cabb;
    --mint: #91f5dd;
    --orange: #f06b19;
    --yellow: #ffd166;
    --paper: #fff1ce;
    --muted: #8ba8a7;
    --line: rgba(145, 245, 221, .2);
    --display: 'Archivo Black', Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
    --mono: 'Space Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; overflow-x: hidden; background: var(--night); }
body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--paper);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(115deg, transparent 0 48%, rgba(240, 107, 25, .035) 49% 51%, transparent 52%) 0 0 / 85px 85px,
        radial-gradient(circle at 14% 10%, rgba(35, 202, 187, .15), transparent 31rem),
        radial-gradient(circle at 92% 86%, rgba(255, 209, 102, .08), transparent 27rem),
        var(--night);
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.top-bar {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem clamp(.8rem, 4vw, 3rem);
    border-bottom: 1px solid var(--line);
    background: rgba(0, 25, 32, .91);
    backdrop-filter: blur(12px);
}

.brand { min-height: 44px; display: inline-flex; align-items: center; color: var(--mint); font-weight: 950; letter-spacing: -.04em; text-decoration: none; }
.brand span { color: var(--orange); }
.compliance-light { margin-left: auto; display: flex; align-items: center; gap: .45rem; color: var(--muted); font: 800 .62rem ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; }
.compliance-light i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); animation: wink 1.35s steps(2) infinite; }
.back-link { min-height: 44px; padding: .46rem .75rem; display: inline-flex; align-items: center; border: 1px solid rgba(255, 209, 102, .55); border-radius: 999px; color: var(--yellow); font-size: .72rem; font-weight: 900; letter-spacing: .04em; text-decoration: none; text-transform: uppercase; transition: .18s; }
.back-link:hover, .back-link:focus-visible { color: var(--night); background: var(--yellow); transform: rotate(1deg); }

main { width: min(980px, calc(100% - 1.5rem)); margin: 0 auto; padding: clamp(1.7rem, 5vw, 3.5rem) 0 3rem; }
.intro { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr); align-items: end; gap: 1.5rem; margin-bottom: 1.25rem; }
.eyebrow { margin: 0 0 .35rem; color: var(--yellow); font: 900 .7rem ui-monospace, monospace; letter-spacing: .16em; }
.intro h1 { margin: 0; font-size: clamp(3rem, 9vw, 5.7rem); line-height: .82; letter-spacing: -.08em; text-transform: uppercase; }
.intro h1 span { color: var(--teal); }
.intro h1 em { display: block; color: var(--orange); font-style: normal; }
.intro > p { margin: 0; padding-left: 1rem; border-left: 3px solid var(--teal); color: #b7ccca; font-size: .88rem; line-height: 1.55; }
.intro > p b { color: var(--yellow); }

.game-card { position: relative; padding: clamp(.65rem, 2.5vw, 1.25rem); border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, rgba(0, 58, 69, .82), rgba(0, 25, 32, .96)); box-shadow: 7px 7px 0 var(--teal), 10px 10px 0 #000, 0 30px 90px rgba(0, 0, 0, .45); rotate: .2deg; transform-origin: center; }
.game-card::after { content: "HUMAN ASSETS / INSERT LENGTHWISE"; position: absolute; right: 1.1rem; bottom: -.62rem; padding: .25rem .48rem; color: var(--night); background: var(--orange); font: 950 .54rem ui-monospace, monospace; letter-spacing: .08em; transform: rotate(-1deg); }

.score-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; margin-bottom: .65rem; }
.score-strip > div { min-width: 0; padding: .62rem .72rem; border: 1px solid rgba(145, 245, 221, .15); border-radius: 10px; background: rgba(0, 18, 23, .72); }
.score-strip span { display: block; overflow: hidden; color: var(--muted); font-size: .56rem; font-weight: 900; letter-spacing: .075em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.score-strip strong { display: block; margin-top: .12rem; color: var(--yellow); font: 900 clamp(.95rem, 3.8vw, 1.35rem) ui-monospace, monospace; }
.score-strip > div.bump strong { animation: number-bump .2s ease-out; }

.game-layout { display: grid; grid-template-columns: minmax(310px, 1fr) 280px; align-items: start; gap: .85rem; }
.play-column { min-width: 0; }
.board-shell { position: relative; width: min(100%, 350px); margin: 0 auto; overflow: hidden; border: 2px solid #37656a; border-radius: 14px; background: #001217; box-shadow: 0 0 0 4px #071d21, 0 18px 45px rgba(0, 0, 0, .45); isolation: isolate; }
.board-shell::before { content: "LIVE / UNLICENSED LOAD-BEARING ASSETS"; position: absolute; z-index: 3; top: .42rem; left: .45rem; padding: .24rem .36rem; color: rgba(255, 241, 206, .52); background: rgba(0, 18, 23, .7); font: 800 .46rem ui-monospace, monospace; letter-spacing: .04em; pointer-events: none; }
#board { display: block; width: 100%; height: auto; aspect-ratio: 1 / 2; touch-action: none; background: #001217; }

.overlay { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: .8rem; background: rgba(0, 18, 23, .82); backdrop-filter: blur(7px); transition: opacity .2s, visibility .2s; }
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay-card { position: relative; width: min(315px, 100%); padding: clamp(1rem, 4.5vw, 1.55rem); overflow: hidden; border: 1px solid var(--orange); border-radius: 16px; background: linear-gradient(150deg, #00404a, #001b22); box-shadow: 5px 5px 0 var(--orange), 8px 8px 0 #000, 0 24px 60px #000; rotate: -.28deg; text-align: center; }
.overlay-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(-12deg, transparent 0 18px, rgba(255, 209, 102, .028) 18px 20px); }
.stamp { position: relative; display: inline-grid; width: 62px; height: 62px; margin-bottom: .55rem; place-items: center; border: 3px double var(--orange); border-radius: 50%; color: var(--orange); font: 950 .65rem/1 ui-monospace, monospace; transform: rotate(-9deg); }
.overlay-kicker { position: relative; margin: 0 0 .28rem; color: var(--yellow); font: 900 .56rem ui-monospace, monospace; letter-spacing: .1em; }
.overlay-card h2 { position: relative; margin: .22rem 0 .62rem; font-size: clamp(1.25rem, 5vw, 1.72rem); line-height: 1; letter-spacing: -.045em; }
.overlay-card p:not(.overlay-kicker) { position: relative; margin: 0 auto .9rem; color: #b6cbca; font-size: .74rem; line-height: 1.43; }
.overlay-card b { color: var(--mint); }
#start { position: relative; width: 100%; min-height: 47px; border: 0; border-radius: 9px; color: #251302; background: linear-gradient(var(--yellow), #ffab2e); box-shadow: 0 6px 0 #9e410b; font-weight: 950; font-size: .7rem; letter-spacing: .055em; text-transform: uppercase; cursor: pointer; transition: .1s; }
#start:hover, #start:focus-visible { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 8px 0 #9e410b; }
#start:active { transform: translateY(5px); box-shadow: 0 1px 0 #9e410b; }
.overlay-card small { position: relative; display: block; margin-top: .7rem; color: #789493; font-size: .56rem; line-height: 1.7; }
kbd { display: inline-block; min-width: 1.5em; margin-inline: .05rem; padding: .08rem .23rem; border: 1px solid #607b7b; border-radius: 3px; color: var(--yellow); background: #001217; font: 800 .86em ui-monospace, monospace; text-align: center; }

.touch-controls { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .42rem; width: min(100%, 440px); margin: .78rem auto 0; user-select: none; }
.touch-controls button { grid-column: span 2; min-width: 0; min-height: 51px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .03rem; border: 1px solid rgba(145, 245, 221, .28); border-bottom: 4px solid #001217; border-radius: 9px; color: var(--mint); background: #053b43; cursor: pointer; touch-action: manipulation; transition: transform .07s, border-width .07s, background .07s; }
.touch-controls button.wide { grid-column: span 3; }
.touch-controls button span { color: var(--muted); font: 900 .43rem ui-monospace, monospace; letter-spacing: .08em; }
.touch-controls button b { font: 950 1.22rem/1 ui-monospace, monospace; }
.touch-controls button.slam { border-color: rgba(255, 209, 102, .5); color: var(--yellow); background: #4b3012; }
.touch-controls button.pressed, .touch-controls button:active { border-bottom-width: 1px; transform: translateY(3px); color: var(--night); background: var(--teal); }

.operations { position: sticky; top: .75rem; overflow: hidden; border: 1px solid rgba(145, 245, 221, .18); border-radius: 12px; background: rgba(0, 18, 23, .79); box-shadow: inset 0 0 40px rgba(35, 202, 187, .035); }
.operations-head { display: flex; align-items: center; justify-content: space-between; padding: .65rem .72rem; border-bottom: 1px solid rgba(145, 245, 221, .14); color: var(--mint); background: rgba(0, 58, 69, .7); font: 900 .56rem ui-monospace, monospace; letter-spacing: .07em; }
.operations-head i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 9px var(--orange); animation: wink .85s steps(2) infinite; }
.previews { display: grid; grid-template-columns: 1fr 1.12fr; border-bottom: 1px solid rgba(145, 245, 221, .12); }
.previews section { min-width: 0; padding: .65rem; }
.previews section + section { border-left: 1px solid rgba(145, 245, 221, .12); }
.previews h3 { margin: 0 0 .25rem; overflow: hidden; color: var(--muted); font: 850 .5rem ui-monospace, monospace; letter-spacing: .07em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.previews canvas { display: block; width: 100%; height: auto; }
#hold { aspect-ratio: 12 / 11; }
#next { aspect-ratio: 4 / 9; }
.previews small { display: block; overflow: hidden; color: #66807f; font: .46rem ui-monospace, monospace; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.level-panel, .memo { padding: .75rem; border-bottom: 1px solid rgba(145, 245, 221, .12); }
.level-panel > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.level-panel span, .memo > span { color: var(--muted); font: 850 .51rem ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.level-panel strong { color: var(--yellow); font: 900 .61rem ui-monospace, monospace; }
.level-track { height: 6px; margin-top: .48rem; overflow: hidden; border-radius: 99px; background: #001217; }
.level-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--yellow), var(--orange)); box-shadow: 0 0 9px var(--teal); transition: width .2s; }
#combo { min-height: 2.4em; margin: .62rem 0 0; color: #9bb3b1; font: .58rem/1.35 ui-monospace, monospace; }
.memo ul { display: grid; gap: .35rem; margin: .55rem 0 0; padding: 0; list-style: none; }
.memo li { color: #8ea7a5; font: .54rem ui-monospace, monospace; }
.console-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .43rem; padding: .68rem; }
.console-actions button { min-width: 0; min-height: 44px; border: 1px solid rgba(145, 245, 221, .2); border-radius: 7px; color: var(--mint); background: #05343c; font: 900 .52rem ui-monospace, monospace; letter-spacing: .035em; text-transform: uppercase; cursor: pointer; }
.console-actions button:last-child { grid-column: 1 / -1; }
.console-actions button:hover:not(:disabled), .console-actions button:focus-visible:not(:disabled) { border-color: var(--yellow); color: var(--yellow); }
.console-actions button:disabled { opacity: .35; cursor: not-allowed; }
.console-actions button[aria-pressed="true"] { color: var(--orange); }
.console-actions button span { margin-right: .2rem; font-size: .8rem; }

.status { min-height: 1.35em; margin: .82rem 0 0; color: var(--muted); font: 800 .68rem ui-monospace, monospace; text-align: center; }
.status::before { content: "> "; color: var(--teal); }
.disclaimer { margin: 1rem auto 0; color: #627e7d; font-size: .64rem; line-height: 1.5; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.board-shell.shake { animation: shake .14s linear 2; }
.board-shell.clear-flash { animation: clear-flash .26s ease-out; }

@keyframes wink { 50% { opacity: .25; } }
@keyframes shake { 25% { transform: translateX(-5px) rotate(-.3deg); } 75% { transform: translateX(5px) rotate(.3deg); } }
@keyframes clear-flash { 45% { box-shadow: 0 0 0 4px #071d21, 0 0 34px rgba(255, 209, 102, .7); } }
@keyframes number-bump { 50% { color: var(--mint); transform: scale(1.1); } }

@media (max-width: 760px) {
    .intro { grid-template-columns: 1fr; gap: .8rem; }
    .intro > p { max-width: 620px; }
    .compliance-light { display: none; }
    .back-link { margin-left: auto; }
    .game-layout { grid-template-columns: 1fr; }
    .board-shell { width: min(100%, 340px); }
    .operations { position: static; width: min(100%, 500px); margin: 0 auto; }
    .operations { display: grid; grid-template-columns: 1fr 1fr; }
    .operations-head, .previews, .console-actions { grid-column: 1 / -1; }
    .level-panel { border-right: 1px solid rgba(145, 245, 221, .12); }
    .memo { border-bottom: 1px solid rgba(145, 245, 221, .12); }
    .previews section { display: grid; grid-template-columns: 1fr minmax(70px, 110px); align-items: start; }
    .previews h3 { grid-column: 1; }
    .previews canvas { grid-column: 2; grid-row: 1 / span 3; }
    .previews small { grid-column: 1; text-align: left; }
    #next { max-height: 180px; justify-self: end; width: auto; }
    #hold { max-height: 100px; justify-self: end; width: auto; }
    .console-actions { grid-template-columns: repeat(3, 1fr); }
    .console-actions button:last-child { grid-column: auto; }
}

@media (max-width: 500px) {
    main { width: min(100% - .75rem, 980px); padding-top: 1.2rem; }
    .top-bar { padding-inline: .6rem; }
    .back-link { padding-inline: .55rem; font-size: .61rem; }
    .game-card { width: calc(100% - 1rem); margin-inline: auto; padding: .45rem; border-radius: 15px; box-shadow: 4px 4px 0 var(--teal), 7px 7px 0 #000, 0 22px 60px rgba(0, 0, 0, .45); }
    .score-strip { gap: .28rem; }
    .score-strip > div { padding: .44rem .34rem; }
    .score-strip span { font-size: .42rem; letter-spacing: .03em; }
    .score-strip strong { font-size: .86rem; }
    .board-shell { border-radius: 10px; }
    .overlay { padding: .45rem; }
    .overlay-card { padding: .9rem .72rem; }
    .stamp { width: 51px; height: 51px; margin-bottom: .35rem; font-size: .55rem; }
    .overlay-card h2 { font-size: clamp(1.08rem, 5.4vw, 1.45rem); }
    .overlay-card p:not(.overlay-kicker) { font-size: .67rem; }
    .touch-controls { gap: .3rem; }
    .touch-controls button { min-height: 48px; }
    .operations { grid-template-columns: 1fr; }
    .operations-head, .previews, .console-actions { grid-column: 1; }
    .level-panel { border-right: 0; }
    .previews section { padding: .55rem; }
    .previews section { display: block; }
    .previews canvas { width: 100%; }
    #next { max-height: none; width: 100%; }
    #hold { max-height: none; width: 100%; }
    .previews small { text-align: center; }
    .console-actions { grid-template-columns: repeat(3, 1fr); }
    .console-actions button { font-size: .46rem; }
}

@media (max-width: 350px) {
    .brand { font-size: .88rem; }
    .back-link { font-size: .53rem; }
    .touch-controls button span { font-size: .38rem; }
    .score-strip span { letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Deep Stack, now regrettably recognizable as a FartKnot product. */
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(rgba(35, 202, 187, .03) 1px, transparent 1px) 0 0 / 36px 36px,
        linear-gradient(90deg, rgba(35, 202, 187, .03) 1px, transparent 1px) 0 0 / 36px 36px,
        radial-gradient(circle at 14% 10%, rgba(35, 202, 187, .15), transparent 31rem),
        radial-gradient(circle at 92% 86%, rgba(255, 209, 102, .08), transparent 27rem),
        var(--night);
}

body::after {
    content: "";
    position: fixed;
    z-index: 999;
    inset: 0;
    opacity: .15;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
}

.top-bar {
    position: sticky;
    z-index: 40;
    top: 0;
    min-height: 76px;
    border-bottom: 2px solid var(--line);
    background: rgba(0, 18, 23, .9);
}

.brand { gap: .65rem; color: var(--paper); font-family: var(--display); }
.brand .brand-emblem {
    position: relative;
    width: 52px;
    height: 40px;
    flex: 0 0 auto;
    display: block;
    color: #020808;
    border: 2px solid #020808;
    border-radius: 48% 52% 44% 56% / 57% 43% 55% 45%;
    background: linear-gradient(135deg, var(--teal) 0 53%, var(--yellow) 54% 100%);
    box-shadow: 3px 3px 0 var(--orange), inset 0 0 0 2px rgba(255, 241, 206, .35);
    transform: rotate(-4deg);
}
.brand .brand-emblem::after { content: ""; position: absolute; inset: 4px; border: 1px dashed rgba(0, 18, 23, .5); border-radius: inherit; }
.brand .brand-emblem i { position: absolute; z-index: 1; top: 50%; font: normal 1.15rem/1 "Apple Color Emoji", "Segoe UI Emoji", sans-serif; transform: translateY(-50%); }
.brand .brand-emblem i:first-child { left: 5px; }
.brand .brand-emblem i:last-child { right: 4px; }
.brand .brand-copy { display: grid; gap: .05rem; color: var(--paper); line-height: 1; }
.brand .brand-copy b { color: var(--paper); font-size: .98rem; }
.brand .brand-copy small { color: var(--muted); font: 700 .47rem/1.2 var(--mono); letter-spacing: .035em; text-transform: uppercase; }

.back-link { border: 2px solid #020808; border-radius: 2px; box-shadow: 3px 3px 0 var(--orange); font-family: var(--mono); }
.eyebrow, .compliance-light, .score-strip span, .score-strip strong, .status, .operations { font-family: var(--mono); }
.intro h1, .overlay-card h2 { font-family: var(--display); font-weight: 400; }

.frame-tape {
    position: relative;
    z-index: 8;
    width: max-content;
    max-width: calc(100% - 2rem);
    margin: -1.95rem 0 .85rem .65rem;
    padding: .38rem .72rem;
    overflow-wrap: anywhere;
    color: #020808;
    background: var(--yellow);
    border: 2px solid #020808;
    box-shadow: 3px 3px 0 var(--orange);
    font: 700 .57rem/1.25 var(--mono);
    letter-spacing: .055em;
    transform: rotate(-1.35deg);
}

.game-card {
    border: 2px solid #020808;
    border-radius: 4px;
    outline: 1px solid var(--line);
    outline-offset: -5px;
    box-shadow: 7px 7px 0 var(--orange), 10px 10px 0 #000, 0 30px 90px rgba(0, 0, 0, .48);
}
.score-strip > div, .board-shell, .operations, .overlay-card, .touch-controls button, .console-actions button { border-radius: 3px; }
.score-strip > div { border: 2px solid #020808; box-shadow: 3px 3px 0 rgba(35, 202, 187, .32); }
.board-shell { border: 2px solid #020808; outline: 2px solid #37656a; outline-offset: -5px; }
.operations { border: 2px solid #020808; box-shadow: 4px 4px 0 var(--teal), 7px 7px 0 #000; transform: rotate(-.16deg); }
.overlay-card { border: 2px solid #020808; outline: 2px solid var(--orange); outline-offset: -5px; }

@media (max-width: 500px) {
    .top-bar { min-height: 62px; }
    .brand { gap: .45rem; }
    .brand .brand-emblem { width: 43px; height: 33px; }
    .brand .brand-emblem i { font-size: .94rem; }
    .brand .brand-copy b { font-size: .8rem; }
    .brand .brand-copy small { max-width: 92px; font-size: .36rem; }
    .back-link { font-size: .51rem; }
    .frame-tape { margin: -1.15rem 0 .65rem .45rem; padding: .3rem .46rem; font-size: .43rem; }
    .game-card { border-radius: 3px; box-shadow: 4px 4px 0 var(--orange), 7px 7px 0 #000, 0 22px 60px rgba(0, 0, 0, .48); }
}
