/* Shared amber-CRT-terminal theme, used by index.html and world_sandbox.html
   (and their shared auth-widget.js modal) so the two pages can't drift out
   of sync. Page-specific layout (landing page's hero copy, the sandbox's
   canvas/HUD) stays in each page's own <style> block -- this file only
   holds what's genuinely shared: palette, reset, overlays, and the common
   button/panel/input/modal building blocks. */

/* Theme system: --amber/--amber-dim/--amber-glow/--bg are the "primary
   chrome" variables regardless of which theme is active (names kept for
   minimal churn -- they mean "primary/dim/glow/background", not literally
   amber). --accent-green is the secondary "live input feedback" color,
   deliberately swapped per-theme so it never blends into the primary chrome:
   amber<->green as an inverted pair, mono gets a brightness-only contrast
   since it has no hue to spare. Selected via `data-theme` on <html>, set by
   theme.js (shared, reads localStorage / the logged-in user's saved
   preference -- see DESIGN.md "Theme system"). */
:root {
  --amber: #ffb000;
  --amber-dim: #b57a00;
  --amber-glow: rgba(255, 176, 0, 0.55);
  --bg: #070400;
  --accent-green: #5fd75f;
}
:root[data-theme="green"] {
  --amber: #39ff6a;
  --amber-dim: #1f8f3c;
  --amber-glow: rgba(57, 255, 106, 0.55);
  --bg: #020a03;
  --accent-green: #ffb000;
}
:root[data-theme="mono"] {
  --amber: #eaeaea;
  --amber-dim: #8a8a8a;
  --amber-glow: rgba(234, 234, 234, 0.4);
  --bg: #060606;
  --accent-green: #ffffff;
}

* { box-sizing: border-box; }
html, body {
  height: 100%; margin: 0; background: var(--bg); color: var(--amber);
  font-family: "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, Monaco,
    "Liberation Mono", "Courier New", monospace;
}

.scanlines {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  /* Reduced from 0.18 -- at that strength this read as a genuine
     interlacing/raster defect once real textured art (body SVGs, see
     DESIGN.md "Visual assets") was visible underneath it, rather than the
     intended subtle CRT touch. Flat single-color shapes hid the intensity
     before; detailed gradients don't. */
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 1px, rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 3px);
}
.vignette {
  position: fixed; inset: 0; z-index: 30; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.65) 100%);
}

.term-btn {
  font-family: inherit; font-size: 13px; letter-spacing: 0.04em;
  background: transparent; color: var(--amber); border: 1px solid var(--amber);
  padding: 0.6em 1em; cursor: pointer; text-shadow: 0 0 6px var(--amber-glow);
}
.term-btn:hover { background: var(--amber); color: #1a0d00; text-shadow: none; }
.term-btn.small { font-size: 12px; padding: 0.4em 0.7em; }
.term-btn:disabled { opacity: 0.5; cursor: default; }
.term-btn:disabled:hover { background: transparent; color: var(--amber); text-shadow: 0 0 6px var(--amber-glow); }

.term-panel {
  background: rgba(7, 4, 0, 0.88); border: 1px solid var(--amber-dim);
  box-shadow: 0 0 16px rgba(255, 176, 0, 0.1);
  color: var(--amber); font-size: 13px;
}
.term-panel h3 { margin-top: 0; letter-spacing: 0.05em; text-shadow: 0 0 6px var(--amber-glow); }

.term-input, .modal input {
  width: 100%; font-family: inherit; font-size: 13px; background: #000;
  border: 1px solid var(--amber-dim); color: var(--amber); padding: 0.5em 0.6em;
}
.term-input:focus, .modal input:focus { outline: none; border-color: var(--amber); }
select.term-input { appearance: auto; }
input[type="range"], input[type="checkbox"] { accent-color: var(--amber); }

/* -- Login/signup modal, injected by auth-widget.js -- */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.75); align-items: center; justify-content: center; padding: 1em;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 24em; background: #0a0500; border: 1px solid var(--amber);
  box-shadow: 0 0 30px rgba(255, 176, 0, 0.2); padding: 1.2em 1.4em 1.5em;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--amber-dim); padding-bottom: 0.5em; margin-bottom: 1em;
  font-size: 13px; letter-spacing: 0.05em;
}
.modal-header button {
  font-family: inherit; background: none; border: none; color: var(--amber);
  cursor: pointer; font-size: 13px;
}
.modal label { display: block; font-size: 12px; margin: 0.8em 0 0.3em; color: var(--amber-dim); }
.modal-error {
  display: none; font-size: 12px; color: #ff5a3c; margin-top: 0.8em;
  border: 1px solid #ff5a3c; padding: 0.5em 0.7em;
}
.modal-submit {
  margin-top: 1.2em; width: 100%; font-family: inherit; font-size: 13px;
  background: var(--amber); color: #1a0d00; border: none; padding: 0.6em; cursor: pointer;
  letter-spacing: 0.05em;
}
.modal-switch { margin-top: 0.9em; font-size: 12px; color: var(--amber-dim); }
.modal-switch button {
  font-family: inherit; background: none; border: none; color: var(--amber);
  text-decoration: underline; cursor: pointer; padding: 0; font-size: 12px;
}

/* Logged-in user menu (username toggle + dropdown) -- originally built for
   world_sandbox.html's topbar, moved here once the landing page's header
   needed the identical component, so both share one definition. */
.user-menu { position: relative; flex-shrink: 0; }
.user-menu-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 0.4em;
  min-width: 10em; padding: 0.4em; z-index: 46;
}
.user-menu-dropdown.open { display: flex; flex-direction: column; gap: 0.3em; }
.user-menu-dropdown .term-btn { text-align: left; }
.dropdown-label { font-size: 11px; color: var(--amber-dim); margin: 0.2em 0 0; }
.user-menu-dropdown select {
  width: 100%; background: #000; border: 1px solid var(--amber-dim); color: var(--amber);
  font-family: inherit; font-size: 12px; padding: 0.3em 0.4em;
}
