:root {
  --bg: #050706;
  --panel: #0b100c;
  --panel2: #0f1610;
  --line: rgba(110, 255, 80, .14);
  --line2: rgba(255, 255, 255, .08);
  --accent: #5bf03d;
  --accent-dim: rgba(91, 240, 61, .14);
  --text: #f4f8f3;
  --mute: #93a394;
  --red: #ff5a5a;
  --r: 16px;
  --display: "Bungee", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* pixel floor + glow behind everything */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 45% at 75% 10%, rgba(91, 240, 61, .13), transparent 70%),
    radial-gradient(40% 30% at 10% 60%, rgba(91, 240, 61, .05), transparent 70%),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 28px 28px;
}
/* faint CRT scanlines */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
}
a { color: inherit; }
img { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .8em 1.3em; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-accent { background: var(--accent); color: #041004; box-shadow: 0 0 0 0 rgba(91,240,61,.5), inset 0 -3px 0 rgba(0,0,0,.2); }
.btn-accent:hover { box-shadow: 0 0 28px rgba(91,240,61,.45), inset 0 -3px 0 rgba(0,0,0,.2); transform: translateY(-1px); }
.btn-ghost { background: rgba(255,255,255,.04); border-color: var(--line2); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-dim); }
.btn-sm { padding: .5em .95em; font-size: .86rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .75rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(5, 7, 6, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; min-width: 0; }
.brand-dot { width: 12px; height: 12px; background: var(--accent); box-shadow: 0 0 12px var(--accent); border-radius: 2px; flex: none; }
.brand-name { font-family: var(--display); font-size: 1rem; letter-spacing: .02em; white-space: nowrap; }
.brand-tick { font: 600 .75rem var(--mono); color: var(--accent); }
.nav-links { display: flex; gap: 1.4rem; margin-left: auto; }
.nav-links a { text-decoration: none; color: var(--mute); font-size: .92rem; transition: color .2s; }
.nav-links a:hover { color: var(--text); }

/* hero */
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(1rem, 4vw, 3rem); align-items: center;
  max-width: 1240px; margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 2rem;
}
.hero-copy { container-type: inline-size; min-width: 0; }
.eyebrow { font: 600 .78rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 1rem; }
.blink { animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.title {
  font-family: var(--display); font-weight: 400; line-height: .92; margin: 0;
  font-size: min(11.5cqi, 112px); letter-spacing: -.01em;
}
.title span { display: block; }
.title .accent { color: var(--accent); text-shadow: 0 0 34px rgba(91,240,61,.35), 4px 4px 0 #134d0c; }
.hook { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: #d6e0d6; max-width: 34rem; margin: 1.2rem 0 1.6rem; }

.prompt {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 1rem; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.prompt-label { display: block; font: 600 .74rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); margin-bottom: .55rem; }
.prompt-row { display: flex; gap: .6rem; }
.prompt-row input, .tweak input, .lform input, .lform textarea {
  flex: 1; min-width: 0;
  background: #030503; border: 1px solid var(--line2); border-radius: 12px;
  padding: .85em 1em; outline: none; transition: border-color .2s, box-shadow .2s;
}
.prompt-row input:focus, .tweak input:focus, .lform input:focus, .lform textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.chip {
  background: transparent; border: 1px dashed rgba(91,240,61,.35); color: #cfe6cb;
  border-radius: 999px; padding: .35em .8em; font-size: .82rem; cursor: pointer; transition: all .2s; text-align: left;
}
.chip:hover { border-style: solid; border-color: var(--accent); color: var(--text); background: var(--accent-dim); }
.prompt-note { margin: .75rem 0 0; font-size: .78rem; color: var(--mute); }
.prompt-note.off { color: var(--red); }

.hero-art { position: relative; display: grid; place-items: center; min-width: 0; }
.hero-glow {
  position: absolute; width: 80%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,240,61,.28), transparent 65%); filter: blur(10px);
}
.hero-mascot { position: relative; width: min(100%, 470px); }
.insert { position: relative; margin: .2rem 0 0; font: 400 .9rem var(--display); letter-spacing: .3em; color: var(--accent); animation: blink 1.6s steps(2) infinite; }

/* sections */
.block { max-width: 1240px; margin: 0 auto; padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem); }
.sec-head { margin-bottom: 1.6rem; max-width: 46rem; }
.label { font: 600 .74rem var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin: 0 0 .5rem; }
h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.7rem, 4vw, 2.8rem); line-height: 1.05; margin: 0; }
.sub { color: var(--mute); margin: .6rem 0 0; font-size: 1.05rem; }

/* arcade app */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; }
.screen-col { min-width: 0; }
.screen-bar {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  background: var(--panel2); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0; padding: .6rem .8rem;
}
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: none; }
.led.busy { background: #ffc93c; box-shadow: 0 0 10px #ffc93c; animation: blink .6s steps(2) infinite; }
.now { font-size: .9rem; color: var(--mute); min-width: 0; overflow-wrap: anywhere; }
.now b { color: var(--text); }
.tag { font: 600 .66rem var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: .15em .5em; border-radius: 6px; background: var(--accent-dim); color: var(--accent); }
.tabs { margin-left: auto; display: flex; background: #030503; border: 1px solid var(--line2); border-radius: 999px; padding: 3px; }
.tab { background: none; border: 0; padding: .3em .9em; border-radius: 999px; cursor: pointer; font-size: .82rem; color: var(--mute); }
.tab.on { background: var(--accent); color: #041004; font-weight: 700; }

.cabinet {
  position: relative; aspect-ratio: 16 / 10; background: #000;
  border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); overflow: hidden;
  box-shadow: inset 0 0 0 6px #070b07, inset 0 0 60px rgba(91,240,61,.08), 0 30px 80px rgba(0,0,0,.45);
}
.cabinet::after { /* soft CRT vignette, never blocks clicks */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(0,0,0,.35));
}
.cabinet iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #0b0f0c; }
.code {
  position: absolute; inset: 0; margin: 0; overflow: auto; padding: 1rem 1.2rem;
  font: 12.5px/1.6 var(--mono); color: #b9f5ac; background: #020402; white-space: pre-wrap; overflow-wrap: anywhere;
}
.building {
  position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: .7rem; padding: .55rem 1rem; border-radius: 999px;
  background: rgba(3,5,3,.9); border: 1px solid var(--line); font: .85rem var(--mono); white-space: nowrap; max-width: 92%;
}
.building p { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--accent-dim); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.cabinet.big { position: fixed; inset: 0; z-index: 200; aspect-ratio: auto; border-radius: 0; }
.exit-big { position: absolute; top: .7rem; right: .7rem; z-index: 3; background: rgba(0,0,0,.75); color: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .4em .9em; cursor: pointer; }

.screen-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.tweak { display: flex; align-items: center; gap: .6rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .6rem .6rem 1rem; }
.tweak label { font: 600 .74rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); white-space: nowrap; }

.side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; min-width: 0; }
.t-label { display: block; font: 600 .66rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); }
.tile b { display: block; font: 600 1.25rem var(--mono); margin-top: .2rem; color: var(--text); overflow-wrap: anywhere; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem; min-width: 0; }
.panel-title { margin: 0 0 .6rem; font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--mute); }
.log { list-style: none; margin: 0; padding: 0; font: .76rem/1.5 var(--mono); color: #a9b8aa; max-height: 190px; overflow: auto; }
.log li { padding: .15rem 0; overflow-wrap: anywhere; }
.log li::before { content: "› "; color: var(--accent); }
.log li.ok { color: #c8f7bd; }
.log li.err { color: var(--red); }
.log li.err::before { color: var(--red); }
.log a { color: var(--accent); }
.shelf { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; max-height: 260px; overflow: auto; }
.shelf li { display: flex; align-items: center; gap: .4rem; }
.shelf .play {
  flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: .5rem; text-align: left;
  background: #030503; border: 1px solid var(--line2); border-radius: 10px; padding: .5rem .7rem; cursor: pointer; transition: border-color .2s, background .2s;
}
.shelf .play:hover { border-color: var(--accent); }
.shelf .play.on { border-color: var(--accent); background: var(--accent-dim); }
.shelf .play b { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf .play span { font: .7rem var(--mono); color: var(--mute); white-space: nowrap; }
.shelf .del { background: none; border: 1px solid var(--line2); border-radius: 8px; color: var(--mute); cursor: pointer; width: 30px; height: 30px; flex: none; }
.shelf .del:hover { color: var(--red); border-color: var(--red); }
.shelf-note { margin: .6rem 0 0; font-size: .74rem; color: var(--mute); }

/* flow */
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.4rem; counter-reset: s; }
.node {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1rem; min-width: 0; transition: border-color .25s, transform .25s;
}
.node:hover { border-color: var(--accent); transform: translateY(-3px); }
.node:not(:last-child)::after { /* moving pixels between steps */
  content: ""; position: absolute; top: 1.6rem; right: -1.4rem; width: 1.4rem; height: 2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 8px); background-size: 16px 2px;
  animation: march .6s linear infinite;
}
@keyframes march { to { background-position: 16px 0; } }
.n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: #041004; font: 400 .9rem var(--display); }
.node h3 { font-size: 1rem; margin: .7rem 0 .4rem; line-height: 1.25; }
.live { margin: 0; font: .76rem/1.45 var(--mono); color: #b9d6b4; overflow-wrap: anywhere; }

/* launch */
.launch { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 1rem; }
.lform, .preview { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; min-width: 0; }
.lform { display: grid; gap: .8rem; }
.lform label { display: grid; gap: .35rem; font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--mute); min-width: 0; }
.lform input, .lform textarea { width: 100%; font: 400 .95rem var(--body); text-transform: none; letter-spacing: 0; color: var(--text); resize: vertical; }
.lform input[type=file] { padding: .55em; font-size: .82rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.lbtns { display: flex; flex-wrap: wrap; gap: .6rem; }
.hint { margin: 0; font-size: .8rem; color: var(--mute); overflow-wrap: anywhere; }
.hint.warn { color: #ffc93c; }
.coincard { display: flex; gap: 1rem; align-items: flex-start; background: #030503; border: 1px solid var(--line2); border-radius: 14px; padding: .9rem; }
.coincard img { width: 110px; height: 110px; border-radius: 10px; object-fit: cover; flex: none; background: #000; }
.cc-body { min-width: 0; }
.cc-name { margin: 0; overflow-wrap: anywhere; }
.cc-name span { font: 600 .82rem var(--mono); color: var(--accent); }
.cc-desc { margin: .35rem 0; font-size: .86rem; color: #c3cfc4; overflow-wrap: anywhere; }
.cc-site { margin: 0; font: .72rem var(--mono); color: var(--mute); min-width: 0; overflow-wrap: anywhere; word-break: break-all; }
.manual { margin-top: 1rem; padding: .9rem; border: 1px dashed #ffc93c; border-radius: 12px; font-size: .88rem; }
.manual p { margin: 0 0 .7rem; }

/* coin */
.coin {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 2rem; align-items: center;
  background: linear-gradient(135deg, var(--panel2), var(--panel)); border: 1px solid var(--line);
  border-radius: 24px; padding: clamp(1.2rem, 4vw, 2.5rem); overflow: hidden;
}
.coin-copy { min-width: 0; }
.lore { margin: 1rem 0 1.4rem; font-size: 1.08rem; color: #d6e0d6; max-width: 34rem; }
.lore p { margin: 0 0 .6rem; }
.cabox {
  display: flex; align-items: center; gap: .7rem; background: #030503; border: 1px solid var(--line);
  border-radius: 12px; padding: .55rem .6rem .55rem .9rem; margin-bottom: 1rem;
}
.ca-label { font: 400 .8rem var(--display); color: var(--accent); }
.cabox code { flex: 1; min-width: 0; font: .86rem var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: .5rem; }
.tiles-4 .tile b { font-size: 1rem; }
.coin .hint { margin-bottom: 1.2rem; }
.up { color: var(--accent) !important; }
.down { color: var(--red) !important; }
.coin-art { display: grid; place-items: center; min-width: 0; }
.coin-mascot { width: min(100%, 400px); }

.foot { text-align: center; padding: 2rem 1rem 3rem; color: var(--mute); font-size: .8rem; border-top: 1px solid var(--line); }
.foot p { margin: .2rem 0; }

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 300;
  background: var(--accent); color: #041004; font-weight: 700; padding: .6rem 1.1rem; border-radius: 999px; transition: all .25s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* entrance: only hidden when JS runs, and script.js shows everything after 1.5 s regardless */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; animation: reveal-safety 0s 1.5s forwards; }
.js .reveal.in { opacity: 1; transform: none; }
@keyframes reveal-safety { to { opacity: 1; transform: none; } }

@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .side { display: grid; grid-template-columns: 1fr 1fr; }
  .side .tiles { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .node:nth-child(3)::after { display: none; }
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav .buy-link { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .hero-mascot { width: min(52vw, 230px); }
  .insert { display: none; }
  .launch, .coin { grid-template-columns: 1fr; }
  .coin-art { order: -1; }
  .coin-mascot { width: min(60vw, 260px); }
}
@media (max-width: 640px) {
  .brand-tick { display: none; }
  .brand-name { font-size: .85rem; }
  .prompt-row { flex-direction: column; }
  .cabinet { aspect-ratio: 4 / 5; }
  .side { grid-template-columns: 1fr; }
  .side .tiles, .tiles-4 { grid-template-columns: 1fr 1fr; }
  .flow { grid-template-columns: 1fr 1fr; gap: .8rem; }
  .node::after { display: none; }
  .tweak { flex-wrap: wrap; padding: .8rem; }
  .tweak label { width: 100%; }
  .row2 { grid-template-columns: 1fr; }
  .coincard img { width: 84px; height: 84px; }
  .tabs { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
