:root {
  color-scheme: dark;
  --bg0: #05030d;
  --bg1: #0a061b;
  --panel: rgba(10, 7, 29, .92);
  --cyan: #48f7ff;
  --pink: #ff3cac;
  --violet: #9a5cff;
  --amber: #ffd166;
  --fg: #e8faff;
  --dim: #7e86a8;
  --line: rgba(72,247,255,.22);
  font-family: "IBM Plex Mono", "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--fg);
  background:
    linear-gradient(rgba(255,60,172,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72,247,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 72% 18%, rgba(255,60,172,.22), transparent 24rem),
    radial-gradient(circle at 21% 72%, rgba(72,247,255,.17), transparent 27rem),
    linear-gradient(145deg, var(--bg0), var(--bg1) 48%, #130623);
  background-size: 44px 44px, 44px 44px, auto, auto, auto;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.022) 0 1px, transparent 1px 4px);
  opacity: .55;
}

.terminal-shell {
  width: min(980px, 100%);
  min-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(430px, 1fr) auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 0 42px rgba(72,247,255,.08), 0 0 110px rgba(255,60,172,.08), inset 0 0 100px rgba(154,92,255,.035);
  position: relative;
  overflow: hidden;
}

.terminal-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255,60,172,.08);
  transform: translate(5px, -5px);
}

.topbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font-size: .76rem;
  letter-spacing: .15em;
}
.brand { color: var(--pink); text-shadow: 0 0 12px rgba(255,60,172,.5); }
.status { color: var(--dim); }
.status.online { color: var(--cyan); }

/* The full section is a positioning context and the inner picker is exactly centered. */
.picker {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 36px 24px;
}
.picker-inner {
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
  margin: auto;
}
.eyebrow { color: var(--violet); font-size: .74rem; letter-spacing: .22em; }

.result {
  width: min(30ch, calc(100vw - 96px));
  height: 1.35em;
  display: grid;
  grid-template-columns: repeat(30, 1ch);
  justify-content: center;
  align-items: center;
  justify-items: center;
  font-size: clamp(1rem, 3.4vw, 2.7rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(72,247,255,.8), 0 0 20px rgba(72,247,255,.25);
  margin-inline: auto;
}
.cell { width: 1ch; min-width: 1ch; max-width: 1ch; text-align: center; transform: translateZ(0); }
.cell.active { animation: jitter 90ms steps(2,end) infinite; }
.cell.locked { color: var(--fg); text-shadow: 1px 0 var(--pink), -1px 0 var(--cyan), 0 0 17px rgba(154,92,255,.7); animation: lockflash 180ms ease-out 1; }

.pick-button {
  border: 1px solid var(--pink);
  color: var(--pink);
  background: linear-gradient(90deg, rgba(255,60,172,.08), rgba(72,247,255,.04));
  padding: 11px 17px;
  font: inherit;
  letter-spacing: .12em;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255,60,172,.12), inset 0 0 18px rgba(72,247,255,.04);
}
.pick-button:hover, .pick-button:focus-visible { outline: 0; color: var(--fg); box-shadow: 0 0 24px rgba(255,60,172,.28), 0 0 16px rgba(72,247,255,.18); }
.pick-button:disabled { opacity: .4; cursor: wait; }
.cycle-info { min-height: 1em; color: var(--dim); font-size: .73rem; }

.console {
  border-top: 1px solid var(--line);
  padding: 12px 16px 14px;
  background: rgba(2,2,10,.32);
  min-height: 172px;
}
.log { height: 98px; overflow-y: auto; font-size: .78rem; line-height: 1.52; color: var(--dim); scrollbar-width: thin; }
.log .ok { color: var(--cyan); }
.log .error { color: var(--pink); }
.log .system { color: var(--violet); }
#command-form { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin-top: 8px; }
.prompt { color: var(--pink); text-shadow: 0 0 10px rgba(255,60,172,.5); }
.command-wrap { position: relative; min-width: 0; }
#command {
  position: relative;
  z-index: 2;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  caret-color: var(--cyan);
  font: inherit;
  padding: 0;
}
.completion {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  white-space: pre;
  overflow: hidden;
  color: rgba(126,134,168,.62);
  font: inherit;
}

@keyframes jitter { 0% { transform: translate(0,0) } 50% { transform: translate(1px,-1px) } 100% { transform: translate(-1px,1px) } }
@keyframes lockflash { from { filter: brightness(2.3); transform: scale(1.22) } to { filter: brightness(1); transform: scale(1) } }
@media (prefers-reduced-motion: reduce) { .cell.active { animation: none; } }
@media (max-width: 600px) { body { padding: 10px; } .terminal-shell { min-height: calc(100vh - 20px); } .picker { padding-inline: 10px; } .result { width: min(30ch, calc(100vw - 42px)); } }
