/* SCRYPT — Osaka Jade, for the browser. The same machine as the terminal
   game, wearing the same face: deep jade-black, mint that does the talking,
   coral for the wounds, gold for the things worth wanting. */

@import url('https://fonts.googleapis.com/css2?family=VT323&family=IBM+Plex+Mono:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --bg: #111c18;
  --bg-deep: #0b130f;
  --surface: #15241e;
  --panel: #1b2b24;
  --fg: #c1c497;
  --fg-dim: #8a9a86;
  --ink: #23372b;
  --jade: #549e6a;
  --jade-glow: #9eebb3;
  --mint: #2dd5b7;
  --mint-soft: #8cd3cb;
  --coral: #ff5345;
  --coral-soft: #db9f9c;
  --gold: #e5c736;

  --crt: 0 0 1px rgba(45, 213, 183, 0.4);
  --display: 'VT323', monospace;
  --body: 'IBM Plex Mono', ui-monospace, monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--fg);
  font-family: var(--body);
  overflow: hidden;
  cursor: default;
}

/* The room: a jade glow pooled in the center, dark at the edges. */
.room {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% 38%, #16271f 0%, var(--bg) 45%, var(--bg-deep) 100%);
  isolation: isolate;
}

/* Scanlines + flicker + grain, layered above everything, click-through. */
.room::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
  z-index: 50;
  animation: flicker 7s infinite steps(60);
}
.room::after {
  content: "";
  position: absolute;
  inset: -50%;
  pointer-events: none;
  opacity: 0.035;
  z-index: 51;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.1s steps(4) infinite;
}

@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: 0.82; }
  98% { opacity: 0.96; }
  99% { opacity: 0.78; }
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-2%, -2%); }
  100% { transform: translate(3%, 3%); }
}

/* ---------------------------------------------------------- landing page */

.stage {
  position: relative;
  z-index: 10;
  width: min(880px, 92vw);
  text-align: center;
  padding: 2rem;
}

.logo {
  font-family: var(--display);
  color: var(--jade-glow);
  font-size: clamp(8px, 1.55vw, 17px);
  line-height: 1.0;
  white-space: pre;
  letter-spacing: 0;
  text-shadow:
    -1px 0 rgba(255, 83, 69, 0.55),
    1px 0 rgba(45, 213, 183, 0.55),
    0 0 12px rgba(158, 235, 179, 0.45);
  animation: aberrate 5s ease-in-out infinite;
  user-select: none;
}
@keyframes aberrate {
  0%, 100% { text-shadow: -1px 0 rgba(255,83,69,.55), 1px 0 rgba(45,213,183,.55), 0 0 12px rgba(158,235,179,.45); }
  50% { text-shadow: -2px 0 rgba(255,83,69,.5), 2px 0 rgba(45,213,183,.6), 0 0 20px rgba(158,235,179,.6); }
}

.tagline {
  margin-top: 1.4rem;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.tagline b { color: var(--mint); font-weight: 600; }

/* The Warden, speaking before you enter — fed by the gradio backend. */
.whisper {
  margin: 2.2rem auto 0;
  min-height: 3.4em;
  max-width: 60ch;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--mint-soft);
  text-shadow: var(--crt);
}
.whisper .who {
  display: block;
  font-family: var(--body);
  font-size: 0.62rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--jade);
  margin-bottom: 0.55rem;
}
.cursor {
  display: inline-block;
  width: 0.5ch;
  background: var(--mint);
  color: var(--mint);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.enter {
  margin-top: 2.6rem;
  display: inline-block;
  position: relative;
  font-family: var(--display);
  font-size: 1.8rem;
  letter-spacing: 0.18em;
  color: var(--bg-deep);
  background: var(--jade-glow);
  border: none;
  padding: 0.5rem 2.6rem;
  cursor: pointer;
  text-decoration: none;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  box-shadow: 0 0 0 1px var(--jade), 0 0 24px rgba(158, 235, 179, 0.25);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.enter:hover {
  background: var(--mint);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--mint), 0 0 36px rgba(45, 213, 183, 0.45);
}
.enter:active { transform: translateY(1px); }

.specs {
  margin-top: 2.4rem;
  display: flex;
  gap: 1.6rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}
.specs span { white-space: nowrap; }
.specs b { color: var(--gold); font-weight: 600; }
.specs .sep { color: var(--ink); }

.footer {
  position: fixed;
  bottom: 0.8rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  color: var(--ink);
  z-index: 10;
}
.footer a { color: var(--jade); text-decoration: none; }
.footer a:hover { color: var(--mint); }

/* ---------------------------------------------------------- terminal page */

.term-frame {
  position: relative;
  z-index: 10;
  width: min(1280px, 96vw);
  height: min(1100px, 94vh);
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(45, 213, 183, 0.08), 0 24px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0.9rem;
  background: var(--panel);
  border-bottom: 1px solid var(--ink);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}
.term-bar .dot { width: 9px; height: 9px; border-radius: 50%; }
.term-bar .dot.r { background: var(--coral); }
.term-bar .dot.y { background: var(--gold); }
.term-bar .dot.g { background: var(--jade-glow); }
.term-bar .title { flex: 1; text-align: center; color: var(--mint-soft); }
.term-bar a { color: var(--jade); text-decoration: none; }
.term-bar a:hover { color: var(--mint); }
#terminal { flex: 1; min-height: 0; padding: 0.4rem 0.4rem 0 0.8rem; }
.term-status {
  padding: 0.35rem 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  border-top: 1px solid var(--ink);
  background: var(--bg-deep);
}
.term-status b { color: var(--mint); }
.term-status.dead b { color: var(--coral); }

@media (max-width: 560px) {
  .specs { font-size: 0.62rem; gap: 0.9rem; }
  .whisper { font-size: 1.25rem; }
}
