/* ============================================================
   SnakeM Retro-Web — Retro-Futuristic Design System
   Palette derived from the SnakeM logo:
     void / hull  (deep navy-black)
     emerald      (primary, live)
     gold         (accent, talisman)
     violet       (secondary, tail)
     cream        (aged print / readouts)
   ============================================================ */

:root {
  --void: #05060a;
  --hull: #0a1020;
  --hull-2: #101a30;
  --hull-3: #16223d;
  --emerald: #22c55e;
  --emerald-hot: #3bff9e;
  --gold: #f5c542;
  --gold-deep: #b8860b;
  --violet: #8b5cf6;
  --cream: #f3ead6;
  --danger: #ff4d4d;
  --cyan: #38bdf8;
  --muted: #7c8aa5;
  --line: rgba(120, 150, 200, 0.18);
  --line-hot: rgba(59, 255, 158, 0.45);

  --font-display: "Orbitron", "Chakra Petch", sans-serif;
  --font-ui: "Chakra Petch", system-ui, sans-serif;
  --font-mono: "Share Tech Mono", "Courier New", monospace;

  --glow-emerald: 0 0 8px rgba(59, 255, 158, 0.55), 0 0 24px rgba(34, 197, 94, 0.25);
  --glow-gold: 0 0 8px rgba(245, 197, 66, 0.5), 0 0 22px rgba(245, 197, 66, 0.2);
  --glow-violet: 0 0 10px rgba(139, 92, 246, 0.5);

  --radius: 10px;
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(34, 197, 94, 0.10), transparent 60%),
    radial-gradient(800px 460px at 100% 0%, rgba(139, 92, 246, 0.12), transparent 62%),
    radial-gradient(700px 600px at 50% 120%, rgba(245, 197, 66, 0.06), transparent 60%),
    var(--void);
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

/* Grid + CRT overlays */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9990;
  background-image:
    linear-gradient(rgba(59, 255, 158, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 255, 158, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 85%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9991;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.16) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 9992;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(3) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1%); }
  66% { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

::selection { background: var(--emerald); color: #04110a; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--hull-3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--hull-3), var(--hull-2));
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* ============================ Typography ============================ */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 800; letter-spacing: 0.08em; margin: 0; }
.mono { font-family: var(--font-mono); }
.hud-label {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}
.text-emerald { color: var(--emerald-hot); }
.text-gold { color: var(--gold); }
.text-violet { color: #b795ff; }
.text-danger { color: var(--danger); }
.text-cyan { color: var(--cyan); }
.dim { color: var(--muted); }
.tiny { font-size: 11px; }

/* ============================ Layout ============================ */
.app { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(16, 26, 48, 0.95), rgba(10, 16, 32, 0.85));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5), var(--shadow-inset);
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.45)); }
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 900; letter-spacing: 0.14em; }
.brand-name span { color: var(--emerald-hot); text-shadow: var(--glow-emerald); }
.brand-sub { font-size: 9px; letter-spacing: 0.34em; color: var(--gold); text-transform: uppercase; }

.ticker {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(5, 6, 10, 0.6);
  padding: 4px 0;
  position: relative;
}
.ticker__track { display: inline-flex; gap: 34px; white-space: nowrap; animation: ticker-roll 38s linear infinite; }
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__item { font-family: var(--font-mono); font-size: 12px; color: var(--cream); }
.ticker__item b { color: var(--emerald-hot); font-weight: 400; }
.ticker__item i { color: var(--danger); font-style: normal; }
@keyframes ticker-roll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.topbar__actions { display: flex; align-items: center; gap: 10px; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 20px 40px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

.rack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.viewport { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ============================ Panels ============================ */
.panel {
  position: relative;
  background: linear-gradient(160deg, rgba(22, 34, 61, 0.85), rgba(10, 16, 32, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), var(--shadow-inset);
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
}
.panel::before { top: -1px; left: -1px; border-top: 2px solid var(--emerald); border-left: 2px solid var(--emerald); border-top-left-radius: var(--radius); }
.panel::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--gold); border-right: 2px solid var(--gold); border-bottom-right-radius: var(--radius); }

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(59, 255, 158, 0.04), transparent);
}
.panel__title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cream); }
.panel__title .glyph { color: var(--emerald-hot); text-shadow: var(--glow-emerald); }
.panel__body { padding: 14px; }
.panel--gold .panel__title .glyph { color: var(--gold); text-shadow: var(--glow-gold); }
.panel--violet .panel__title .glyph { color: #b795ff; text-shadow: var(--glow-violet); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 6, 10, 0.45); }
.row + .row { margin-top: 9px; }
.row__name { font-size: 12px; font-weight: 600; color: var(--cream); }
.row__sub { font-size: 10px; color: var(--muted); }

/* Readouts / LEDs / badges */
.readout { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 6, 10, 0.6); }
.readout .hud-label { display: block; margin-bottom: 4px; }
.readout__value { font-family: var(--font-mono); font-size: 16px; color: var(--emerald-hot); text-shadow: var(--glow-emerald); }
.readout--gold .readout__value { color: var(--gold); text-shadow: var(--glow-gold); }

.led { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #2a3550; border: 1px solid rgba(0,0,0,0.6); box-shadow: inset 0 0 3px rgba(0,0,0,0.7); }
.led--on { background: var(--emerald-hot); box-shadow: var(--glow-emerald); animation: pulse 1.6s ease-in-out infinite; }
.led--warn { background: var(--gold); box-shadow: var(--glow-gold); }
.led--off { background: #3a2030; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; border: 1px solid var(--line); }
.badge--on { color: var(--emerald-hot); background: rgba(34, 197, 94, 0.12); border-color: var(--line-hot); }
.badge--off { color: var(--gold); background: rgba(245, 197, 66, 0.1); border-color: rgba(245, 197, 66, 0.35); }
.badge--danger { color: var(--danger); background: rgba(255, 77, 77, 0.1); border-color: rgba(255, 77, 77, 0.35); }
.badge--violet { color: #b795ff; background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.4); }

/* Buttons */
.btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  background: linear-gradient(180deg, var(--hull-3), var(--hull-2));
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-inset), 0 3px 0 rgba(0, 0, 0, 0.5);
  transition: transform 0.06s ease, box-shadow 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn:hover { color: #fff; border-color: var(--line-hot); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.05); }
.btn--primary { background: linear-gradient(180deg, #2ee07a, #169c4e); color: #04180c; border-color: rgba(59, 255, 158, 0.6); text-shadow: 0 0 6px rgba(255,255,255,0.35); }
.btn--primary:hover { color: #04180c; box-shadow: var(--glow-emerald), var(--shadow-inset); }
.btn--gold { background: linear-gradient(180deg, #ffd76b, #b8860b); color: #241a00; border-color: rgba(245, 197, 66, 0.6); }
.btn--gold:hover { box-shadow: var(--glow-gold); color: #241a00; }
.btn--danger { background: linear-gradient(180deg, #6b1f1f, #3a1010); color: #ffb3b3; border-color: rgba(255, 77, 77, 0.4); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 6px 10px; font-size: 10px; }
.btn--block { width: 100%; justify-content: center; }

/* Gauge */
.gauge { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gauge__dial {
  position: relative;
  width: 132px; height: 66px;
  overflow: hidden;
}
.gauge__dial::before {
  content: "";
  position: absolute;
  inset: 0 0 -66px 0;
  border-radius: 132px 132px 0 0;
  background: conic-gradient(from 270deg at 50% 100%,
      var(--danger) 0deg 28deg, var(--gold) 30deg 70deg, var(--emerald) 74deg 178deg, #1c2c4a 180deg 360deg);
  border: 2px solid var(--line);
  filter: saturate(0.9) brightness(0.95);
}
.gauge__hub {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cream); box-shadow: 0 0 8px rgba(255,255,255,0.4);
}
.gauge__needle {
  position: absolute; bottom: 0; left: 50%;
  width: 3px; height: 58px;
  background: linear-gradient(180deg, var(--cream), var(--emerald-hot));
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--angle, -90deg));
  border-radius: 2px;
  box-shadow: var(--glow-emerald);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.gauge__scale { display: flex; justify-content: space-between; width: 132px; font-family: var(--font-mono); font-size: 9px; color: var(--muted); }

/* Switch (decorative control) */
.switch { position: relative; width: 44px; height: 22px; border-radius: 999px; background: var(--hull-2); border: 1px solid var(--line); cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: 0.2s; }
.switch.is-on { border-color: var(--line-hot); }
.switch.is-on::after { left: 24px; background: var(--emerald-hot); box-shadow: var(--glow-emerald); }

/* Slots */
.slot { border: 1px solid var(--line); border-radius: 8px; padding: 11px; background: rgba(5, 6, 10, 0.45); }
.slot + .slot { margin-top: 10px; }
.slot--active { border-color: var(--line-hot); box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.08); }
.slot--empty { border-style: dashed; }
.slot__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.slot__sym { font-family: var(--font-mono); font-size: 15px; color: var(--emerald-hot); letter-spacing: 0.06em; }
.slot__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.slot__grid b { color: var(--cream); font-weight: 400; }

/* Tabs + terminal panes */
.tabs { display: flex; gap: 6px; }
.tab {
  font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); background: transparent; border: 1px solid transparent; border-bottom: 2px solid transparent;
  padding: 7px 12px; cursor: pointer;
}
.tab.is-active { color: var(--emerald-hot); border-bottom-color: var(--emerald-hot); text-shadow: var(--glow-emerald); }
.tab:hover { color: var(--cream); }

.terminal {
  display: flex; flex-direction: column;
  height: 640px;
  overflow: hidden;
}
.terminal .panel__body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; }
.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg--user { align-self: flex-end; align-items: flex-end; }
.msg--agent, .msg--system { align-self: flex-start; align-items: flex-start; }
.msg__who { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.08em; }
.msg__bubble {
  padding: 9px 13px; border-radius: 8px; font-size: 13px; white-space: pre-wrap; word-break: break-word;
}
.msg--user .msg__bubble { background: linear-gradient(180deg, #1f7a46, #145c33); color: #eafff2; border: 1px solid rgba(59,255,158,0.4); }
.msg--agent .msg__bubble, .msg--system .msg__bubble { background: rgba(16, 26, 48, 0.9); border: 1px solid var(--line); color: var(--cream); }
.msg--system .msg__bubble { border-color: rgba(245,197,66,0.35); color: #ffe9a8; }

.compose { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: rgba(5, 6, 10, 0.6); }
.input, .textarea, select.input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--cream);
  background: rgba(5, 6, 10, 0.85);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  outline: none;
}
.input:focus, .textarea:focus { border-color: var(--line-hot); box-shadow: var(--glow-emerald); }
.textarea { resize: none; line-height: 1.5; }
.compose .input { flex: 1; }

.logline { border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 6, 10, 0.55); padding: 9px 11px; margin-bottom: 8px; }
.logline__top { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; margin-bottom: 3px; }
.logline__role { color: var(--emerald-hot); }
.logline__time { color: var(--muted); }
.logline__body { font-size: 12px; color: #cbd6e8; white-space: pre-wrap; }

/* Instruments */
.instruments__tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.instrument-body { margin-top: 12px; min-height: 150px; }
table.data { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
table.data th { text-align: left; padding: 6px 8px; color: var(--gold); border-bottom: 1px solid var(--line); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; font-size: 10px; }
table.data td { padding: 6px 8px; border-bottom: 1px dashed rgba(120,150,200,0.12); color: var(--cream); }
table.data tr:hover td { background: rgba(59,255,158,0.04); }

/* Modals */
.modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(3, 4, 8, 0.82); backdrop-filter: blur(4px); }
.modal.is-open { display: flex; }
.modal__card { width: 100%; max-width: 860px; max-height: 88vh; display: flex; flex-direction: column; background: linear-gradient(160deg, var(--hull-2), var(--hull)); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,0.7), var(--shadow-inset); }
.modal__card--narrow { max-width: 560px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal__title { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; }
.modal__body { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.modal__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.close-x { background: transparent; border: 1px solid var(--line); color: var(--muted); width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 15px; }
.close-x:hover { color: var(--cream); border-color: var(--line-hot); }

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 4px; }

.footer-note { text-align: center; padding: 8px 16px 26px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; }

/* Status strip */
.status-strip { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,6,10,0.5); font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.status-strip b { color: var(--cream); font-weight: 400; }
.clock { font-family: var(--font-mono); font-size: 12px; color: var(--gold); letter-spacing: 0.1em; }

/* ============================ Login ============================ */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px; position: relative; z-index: 1; }
.auth__card { width: 100%; max-width: 430px; position: relative; background: linear-gradient(160deg, rgba(22,34,61,0.95), rgba(6,9,18,0.97)); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 90px rgba(0,0,0,0.7), var(--shadow-inset); overflow: hidden; }
.auth__card::before { content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none; box-shadow: inset 0 0 60px rgba(34,197,94,0.08); }
.auth__head { text-align: center; padding: 26px 24px 18px; border-bottom: 1px solid var(--line); }
.auth__head img { width: 128px; height: 128px; object-fit: contain; filter: drop-shadow(0 0 18px rgba(34,197,94,0.4)); }
.auth__badges { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.talisman { font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.14em; padding: 5px 9px; border-radius: 5px; text-transform: uppercase; }
.talisman--emerald { color: #04180c; background: linear-gradient(180deg, #2ee07a, #169c4e); border: 1px solid rgba(59,255,158,0.6); box-shadow: var(--glow-emerald); }
.talisman--gold { color: #241a00; background: linear-gradient(180deg, #ffd76b, #d4a017); border: 1px solid rgba(245,197,66,0.6); box-shadow: var(--glow-gold); }
.talisman--violet { color: #f0eaff; background: linear-gradient(180deg, #a583ff, #6d3ff0); border: 1px solid rgba(139,92,246,0.6); box-shadow: var(--glow-violet); }
.auth__body { padding: 22px 24px 26px; }
.auth__title { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.1em; margin-bottom: 4px; }
.auth__hint { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.alert { border: 1px solid rgba(255,77,77,0.4); background: rgba(255,77,77,0.08); color: #ffbcbc; border-radius: 8px; padding: 10px 12px; font-size: 12px; margin-bottom: 16px; }
.auth__foot { text-align: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.24em; color: var(--muted); padding: 14px; border-top: 1px solid var(--line); }

.horizon { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.horizon::after {
  content: ""; position: absolute; left: -20%; right: -20%; bottom: -35%; height: 80%;
  background:
    repeating-linear-gradient(90deg, rgba(59,255,158,0.18) 0 1px, transparent 1px 62px),
    repeating-linear-gradient(0deg, rgba(139,92,246,0.20) 0 1px, transparent 1px 46px);
  transform: perspective(420px) rotateX(62deg);
  mask-image: linear-gradient(to top, #000 0%, transparent 78%);
}

/* Responsive */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .terminal { height: 560px; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .ticker { order: 3; width: 100%; flex-basis: 100%; }
  .brand-name { font-size: 17px; }
  .grid5 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================ Side Talisman Rails ============================ */
.rail {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: none;
  pointer-events: none;
}
.rail--left { left: 16px; }
.rail--right { right: 16px; }
.rail__seal {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(48px, 7.4vh, 104px);
  line-height: 1;
  letter-spacing: 0.32em;
  color: #7a1414;
  background: linear-gradient(180deg, #ffe89a, #f6c945 45%, #d9a417);
  border: 6px solid #b91c1c;
  border-radius: 20px;
  padding: 36px 22px;
  box-shadow:
    0 0 60px rgba(245, 197, 66, 0.45),
    0 0 140px rgba(245, 197, 66, 0.18),
    inset 0 0 40px rgba(185, 28, 28, 0.30),
    inset 0 0 0 3px rgba(255, 245, 200, 0.55);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5), 0 0 18px rgba(185, 28, 28, 0.25);
}
.rail--right .rail__seal {
  font-size: clamp(30px, 4.6vh, 62px);
  letter-spacing: 0.22em;
  padding: 36px 18px;
}

@media (min-width: 1500px) {
  .rail { display: block; }
  .layout { padding-left: 178px; padding-right: 178px; }
}

