/* void.exe - green phosphor, chunky pixels, a little bit of glow. The accent shifts as the void grows. */
:root {
  --bg: #050805;
  --panel: #081008;
  --fg: #33ff66;
  --dim: #1f9a40;
  --faint: #0e3d1a;
  --hi: #c8ffd6;
  --accent: #33ff66;
  --warn: #ffb000;
  --bad: #ff5a5a;
  --glow: 0 0 6px rgba(51, 255, 102, .45);
  --font: 'VT323', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
body.p1 { --fg: #ffb000; --dim: #a36f00; --faint: #3d2a00; --hi: #fff0c0; --accent: #ffb000; --glow: 0 0 6px rgba(255, 176, 0, .45); }
body.p2 { --fg: #ff6be0; --dim: #a53d96; --faint: #3a0f35; --hi: #ffd0f6; --accent: #b77bff; --glow: 0 0 6px rgba(255, 107, 224, .45); }
body.p3 { --fg: #e8f6ff; --dim: #7fa6c2; --faint: #1c2a36; --hi: #ffffff; --accent: #9fd7ff; --glow: 0 0 8px rgba(200, 235, 255, .6); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 20px; line-height: 1.15;
  text-shadow: var(--glow); overflow-x: hidden; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; min-height: 100vh;
  transition: color .6s;
}
a { color: var(--hi); }
button { font: inherit; color: inherit; text-shadow: inherit; }
.hidden { display: none !important; }
.dim { color: var(--dim); }

/* CRT: scanlines + vignette, never intercepts clicks */
.crt {
  pointer-events: none; position: fixed; inset: 0; z-index: 50;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.22) 3px),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,.55) 100%);
  animation: flicker 6s infinite steps(1);
}
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .93; } 48% { opacity: 1; } 81% { opacity: .96; } }

/* ------------------------------------------------------------ top bar */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 2px solid var(--faint);
}
.logo { font-size: 30px; letter-spacing: 2px; color: var(--hi); }
.ver { margin-left: 10px; color: var(--dim); }
.status { font-size: 22px; letter-spacing: 1px; }
.status .sep { color: var(--dim); margin: 0 8px; }
#moodText { color: var(--dim); }
.topbtns { display: flex; flex-wrap: wrap; gap: 8px; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }

.btn {
  background: transparent; border: 2px solid var(--fg); padding: 4px 12px; cursor: pointer; text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--faint);
}
.btn:hover:not(:disabled) { background: var(--fg); color: var(--bg); text-shadow: none; }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--faint); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.small { padding: 2px 8px; font-size: 18px; }
.btn.big { font-size: 26px; padding: 8px 18px; }
.btn.warn { border-color: var(--warn); color: var(--warn); }
.btn.warn:hover:not(:disabled) { background: var(--warn); color: var(--bg); }
:focus-visible { outline: 2px dashed var(--hi); outline-offset: 2px; }

/* ------------------------------------------------------------ layout */
.layout {
  flex: 1; display: grid; gap: 12px; padding: 12px 16px;
  grid-template-columns: minmax(300px, 1fr) minmax(260px, 1fr) minmax(340px, 1.15fr);
  grid-template-areas: "void term shop";
  min-height: 0;
}
.pane { border: 2px solid var(--faint); background: var(--panel); min-width: 0; position: relative; }
.voidpane { grid-area: void; display: flex; flex-direction: column; align-items: center; padding: 12px; }
.termpane { grid-area: term; display: flex; flex-direction: column; min-height: 0; }
.shoppane { grid-area: shop; display: flex; flex-direction: column; min-height: 0; }
.panehead { padding: 6px 10px; border-bottom: 2px solid var(--faint); color: var(--hi); letter-spacing: 1px; }

@media (min-width: 1000px) {
  .layout { height: calc(100vh - 120px); min-height: 560px; }
  .termpane, .shoppane { max-height: 100%; }
}
@media (max-width: 999px) {
  body { font-size: 19px; }
  .layout { grid-template-columns: 1fr; grid-template-areas: "void" "shop" "term"; }
  .termpane { height: 340px; }
  .shoppane { height: 72vh; min-height: 420px; }
  .voidwrap { width: min(100%, 360px); }
  .ver { display: none; }
}

/* ------------------------------------------------------------ the void */
.counter { font-size: clamp(36px, 5vw, 56px); color: var(--hi); text-align: center; line-height: 1; word-break: break-all; }
.counter .unit { color: var(--dim); font-size: .6em; }
.equiv { color: var(--dim); text-align: center; margin-top: 4px; min-height: 1.2em; }
.rates { margin-top: 4px; text-align: center; }
.voidwrap { position: relative; width: min(100%, 420px); aspect-ratio: 1; margin: 8px auto 4px; }
#void {
  width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
#floats { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.float {
  position: absolute; color: var(--hi); font-size: 24px; white-space: nowrap; transform: translate(-50%, -50%);
  animation: floatup 1s ease-out forwards; pointer-events: none;
}
@keyframes floatup { to { transform: translate(-50%, -260%); opacity: 0; } }

.transmission {
  background: transparent; border: 2px solid var(--warn); color: var(--warn); padding: 6px 12px; cursor: pointer;
  animation: blink 1s infinite steps(2); margin: 4px 0; font-size: 22px;
}
@keyframes blink { 50% { border-color: transparent; } }
.buffs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.buff { border: 1px solid var(--dim); padding: 1px 6px; color: var(--hi); font-size: 18px; }

/* ------------------------------------------------------------ terminal */
.log { flex: 1; overflow-y: auto; padding: 8px 10px; min-height: 0; overflow-wrap: anywhere; scrollbar-color: var(--dim) transparent; }
.line { margin: 0 0 6px; white-space: pre-wrap; }
.line.void::before { content: 'void> '; color: var(--hi); }
.line.void { color: var(--fg); }
.line.you { color: var(--dim); }
.line.you::before { content: 'you> '; }
.line.sys { color: var(--dim); }
.line.sys::before { content: '# '; }
.line.event { color: var(--warn); }
.line.event::before { content: '!! '; }
.line.art { color: var(--hi); white-space: pre; overflow-x: auto; line-height: 1; }
.line.mellow { color: var(--hi); font-style: italic; }
.cursor::after { content: '_'; animation: blink 1s infinite steps(2); }
.cmdline { display: flex; align-items: center; border-top: 2px solid var(--faint); padding: 6px 10px; gap: 6px; }
.prompt { color: var(--hi); }
#cmd {
  flex: 1; background: transparent; border: 0; outline: none; color: var(--hi); font: inherit; text-shadow: inherit;
  caret-color: var(--hi); min-width: 0;
}
#cmd::placeholder { color: var(--faint); }

/* ------------------------------------------------------------ shop */
.tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; border-bottom: 2px solid var(--faint); scrollbar-width: none; }
.tab {
  flex: 1 0 auto; background: transparent; border: 0; border-right: 2px solid var(--faint); padding: 6px 7px; cursor: pointer; font-size: 18px;
  color: var(--dim); letter-spacing: 1px;
}
.tab:last-child { border-right: 0; }
.tab.active { background: var(--fg); color: var(--bg); text-shadow: none; }
.tab .badge { color: var(--warn); }
.tab.active .badge { color: var(--bg); }
.panel { flex: 1; overflow-y: auto; padding: 8px 10px; min-height: 0; scrollbar-color: var(--dim) transparent; }
.buyamt { margin-bottom: 8px; color: var(--dim); }
.amt { background: transparent; border: 1px solid var(--faint); padding: 0 8px; margin-left: 4px; cursor: pointer; color: var(--dim); }
.amt.active { border-color: var(--fg); color: var(--hi); }

.gen {
  display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 6px 8px; margin-bottom: 6px;
  border: 2px solid var(--faint); cursor: pointer; user-select: none; position: relative;
}
.gen:hover { border-color: var(--dim); }
.gen.can { border-color: var(--fg); }
.gen.can:active { transform: translate(2px, 2px); }
.gen.cant { opacity: .55; }
.gen.locked { opacity: .35; cursor: default; }
.gen .name { color: var(--hi); font-size: 22px; }
.gen .owned { font-size: 30px; grid-row: span 3; align-self: center; color: var(--hi); text-align: right; }
.gen .cost { color: var(--fg); }
.gen.cant .cost { color: var(--bad); }
.gen .desc { color: var(--dim); font-size: 17px; }
.gen .each { color: var(--dim); font-size: 17px; }
.gen .kind { color: var(--dim); font-size: 15px; letter-spacing: 1px; }

.ups { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.up {
  border: 2px solid var(--faint); padding: 6px 8px; cursor: pointer; text-align: left; background: transparent; display: flex; flex-direction: column; gap: 2px;
}
.up.can { border-color: var(--fg); }
.up.can:hover { background: var(--faint); }
.up.cant { opacity: .55; cursor: not-allowed; }
.up .name { color: var(--hi); }
.up .cost { color: var(--fg); }
.up.cant .cost { color: var(--bad); }
.up .desc { color: var(--dim); font-size: 16px; }
.empty { color: var(--dim); padding: 12px 4px; }

.section { border: 2px solid var(--faint); padding: 10px; margin-bottom: 10px; }
.section h3 { margin: 0 0 6px; font-weight: normal; color: var(--hi); font-size: 24px; letter-spacing: 1px; }
.section p { margin: 4px 0; }
.perk { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--faint); }
.perk .name { color: var(--hi); }
.perk .desc { color: var(--dim); font-size: 17px; }
.perk.owned .name::after { content: '  [OWNED]'; color: var(--fg); }

.chapter { margin-bottom: 14px; }
.chapter h4 { margin: 0 0 4px; font-weight: normal; color: var(--hi); font-size: 22px; }
.chapter p { margin: 0; line-height: 1.3; }
.chapter.locked p { color: var(--faint); letter-spacing: 2px; }

.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.ach { border: 2px solid var(--faint); padding: 6px; }
.ach.got { border-color: var(--fg); }
.ach .name { color: var(--hi); }
.ach .desc { color: var(--dim); font-size: 16px; }
.ach.locked { opacity: .45; }

.ranks table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.ranks th, .ranks td { text-align: left; padding: 2px 6px; border-bottom: 1px dashed var(--faint); font-weight: normal; }
.ranks th { color: var(--hi); }
.ranks tr.me td { color: var(--hi); background: var(--faint); }
.ranks .num { text-align: right; }
.namebox { display: flex; gap: 6px; margin: 6px 0 12px; }
.namebox input {
  flex: 1; min-width: 0; background: transparent; border: 2px solid var(--dim); color: var(--hi); font: inherit; padding: 2px 8px; text-shadow: inherit;
}

/* ------------------------------------------------------------ footer */
.foot { padding: 8px 16px 14px; color: var(--dim); font-size: 17px; text-align: center; border-top: 2px solid var(--faint); }
.foot b { color: var(--fg); font-weight: normal; }

/* ------------------------------------------------------------ overlays */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.box { background: var(--bg); border: 2px solid var(--fg); box-shadow: 6px 6px 0 var(--faint), 0 0 30px rgba(0,0,0,.8); max-width: 560px; width: 100%; max-height: 92vh; overflow-y: auto; }
.boxtitle { background: var(--fg); color: var(--bg); text-shadow: none; padding: 4px 12px; letter-spacing: 2px; font-size: 22px; }
.boxbody { padding: 14px 16px; line-height: 1.3; font-size: 21px; }
.boxbody p { margin: 0 0 10px; }
.boxbody .big { font-size: 32px; color: var(--hi); }
.boxbtns { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.boxbtns .btn { text-align: left; }

.snack {
  position: fixed; z-index: 30; width: 48px; height: 48px; cursor: pointer; image-rendering: pixelated;
  background:
    radial-gradient(circle at 50% 50%, var(--hi) 0 5px, var(--fg) 6px 9px, transparent 10px);
  filter: drop-shadow(0 0 6px var(--fg));
}
.snack::after {
  content: ''; position: absolute; right: 30px; top: 21px; width: 40px; height: 6px;
  background: repeating-linear-gradient(90deg, transparent 0 4px, var(--dim) 4px 8px);
}
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 45; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--bg); border: 2px solid var(--fg); padding: 6px 10px; box-shadow: 4px 4px 0 var(--faint); animation: toastin .25s ease-out; }
.toast .t { color: var(--warn); font-size: 16px; letter-spacing: 1px; }
.toast .n { color: var(--hi); }
@keyframes toastin { from { transform: translateX(30px); opacity: 0; } }
.flash { position: fixed; inset: 0; z-index: 35; background: #fff; pointer-events: none; animation: flash 1.2s ease-out forwards; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }
.noscript { padding: 40px; text-align: center; }

/* the finale: pieces of the interface getting eaten */
.eaten { transition: transform 1s cubic-bezier(.6, 0, .9, .4), opacity 1s ease-in, filter 1s; pointer-events: none !important; }
.gone { visibility: hidden; }
body.finale .shoppane .panel, body.finale .tabs { pointer-events: none; }
body.alone .gone { display: none !important; }
body.alone .layout { grid-template-columns: 1fr; grid-template-areas: "void"; align-items: center; height: 100vh; }
body.alone .voidpane { border-color: transparent; background: transparent; justify-content: center; }
body.alone .voidwrap { width: min(78vmin, 600px); }
body.bigbang { --bg: #000; }
.endstars { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .crt { animation: none; }
  .transmission, .cursor::after { animation: none; }
  .float { animation-duration: .01s; }
}

/* after the terminal has been eaten, the void talks in subtitles */
.subtitle {
  position: fixed; left: 50%; bottom: 10vh; transform: translateX(-50%); z-index: 36; width: min(760px, calc(100vw - 32px));
  text-align: center; font-size: 28px; color: var(--hi); line-height: 1.25;
}
.subtitle.mellow { font-style: italic; }
