:root {
  --bg: #020403;
  --green: #40ff80;
  --dim: #2a9a50;
  --glow: rgba(40, 255, 110, 0.35);
  --mono: "Cascadia Mono", "Consolas", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--green); font-family: var(--mono); overflow: hidden; }
body { background: radial-gradient(ellipse at 40% 45%, #062a12 0%, #020904 45%, #000 80%); }

#app { display: flex; height: 100vh; width: 100vw; }
#viewport { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; position: relative; }
#screen { position: relative; border: 1px solid rgba(64, 255, 128, 0.45); box-shadow: 0 0 40px var(--glow), 0 0 120px rgba(20, 200, 90, 0.18); background: #000; }
#cv { display: block; width: 100%; height: 100%; image-rendering: auto; cursor: crosshair; }

#interface { flex: 0 0 390px; height: 100vh; overflow-y: auto; padding: 18px 16px 18px 6px; font-size: 11.5px; line-height: 1.28; scrollbar-width: thin; scrollbar-color: #1a5a2a #000; }
#interface pre { margin: 0 0 10px; white-space: pre; font-family: var(--mono); }
#interface .legend { color: var(--dim); margin-top: -6px; }
#ui-map { margin-bottom: 4px !important; }
.dim { color: var(--dim); }
#context-panel { margin-bottom: 12px; }
#context-panel pre.h { margin-bottom: 2px; }
#ui-context-label { color: #40e8ff; }
#ui-context-title { display: block; color: #d8ffe0; font-weight: normal; margin: 1px 0 1px 14px; }
#ui-context-copy { display: block; color: var(--dim); margin-left: 14px; white-space: pre-wrap; }
#ui-context-choices { margin: 4px 0 0 14px; }
.choice { color: #d8ffe0; cursor: pointer; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choice:hover { background: rgba(64, 255, 128, 0.15); }
.choice.off { color: var(--dim); cursor: default; }
details summary { cursor: pointer; color: var(--green); outline: none; margin-bottom: 4px; }
details pre { color: var(--dim); }

#prompt { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 11px; color: rgba(200, 255, 210, 0.75); text-shadow: 0 0 6px #000, 0 0 2px #000; pointer-events: none; letter-spacing: 0.5px; }
#toast { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); padding: 3px 10px; background: rgba(0, 12, 4, 0.72); border: 1px solid rgba(64, 255, 128, 0.4); color: #d8ffe0; font-size: 12px; white-space: nowrap; pointer-events: none; transition: opacity 0.3s; }
#toast:empty { display: none; }
#relay-transfer { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; pointer-events: none; }
#relay-transfer span { background: rgba(0, 20, 16, 0.8); border: 1px solid #40ffd0; color: #b0fff0; padding: 6px 14px; font-size: 13px; box-shadow: 0 0 20px rgba(64, 255, 208, 0.4); }

#prelude-text { position: absolute; left: 22px; top: 18px; display: none; pointer-events: none; font-size: 13px; color: #cfc6b4; text-shadow: 0 0 6px #000; }
#prelude-text .pre-h { color: #e8dcc0; letter-spacing: 1px; }
#prelude-text .pre-s { color: #8a8070; margin-bottom: 8px; }
#prelude-text .pre-l { color: #d8d0bc; margin: 2px 0; }
#prelude-text .pre-p { margin-top: 10px; color: #fff; animation: pulse 1.4s infinite; }
#prelude-text .pre-k { margin-top: 6px; color: #6a6250; font-size: 11px; }
@keyframes pulse { 50% { opacity: 0.35; } }
body.prelude #interface { opacity: 0; pointer-events: none; }
body.prelude #screen { border-color: rgba(120, 110, 90, 0.25); box-shadow: 0 0 30px rgba(0, 0, 0, 0.8); }
body.prelude { background: #050505; }
#interface { transition: opacity 1.2s; }

#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.82); z-index: 10; cursor: pointer; transition: opacity 0.6s; }
#overlay.hidden { opacity: 0; pointer-events: none; }
#overlay .box { text-align: center; }
#overlay .logo pre { color: var(--green); text-shadow: 0 0 12px var(--glow); font-size: 13px; line-height: 1.1; margin: 0 0 14px; text-align: left; display: inline-block; }
#overlay .sub { color: var(--dim); letter-spacing: 2px; font-size: 12px; margin-bottom: 26px; }
#overlay .go { font-size: 18px; color: #d8ffe0; animation: pulse 1.6s infinite; margin-bottom: 18px; }
#overlay .small { color: var(--dim); font-size: 12px; margin-top: 6px; }

#help { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.8); z-index: 20; }
#help.show { display: flex; }
#help .box { width: min(860px, 94vw); max-height: 90vh; overflow: auto; border: 1px solid rgba(64, 255, 128, 0.5); background: #010803; padding: 16px 20px; box-shadow: 0 0 40px var(--glow); font-size: 12.5px; }
#help .hh { display: flex; justify-content: space-between; color: #d8ffe0; margin-bottom: 10px; letter-spacing: 1px; }
#help button { background: none; border: none; color: var(--green); font-family: var(--mono); cursor: pointer; }
#help .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
#help b { color: #40e8ff; font-weight: normal; }
#help p { margin: 3px 0 12px; color: #a8e8b8; line-height: 1.45; }

@media (max-width: 1000px) {
  #app { flex-direction: column; }
  #viewport { flex: 0 0 62vh; }
  #interface { flex: 1 1 auto; height: auto; padding: 8px 16px; font-size: 10.5px; }
  #help .cols { grid-template-columns: 1fr; }
}
