:root {
  color-scheme: dark;
  --ink: #eef7ff;
  --muted: #92a9bd;
  --panel: #0c151f;
  --line: #263c50;
  --cyan: #5ce6ff;
  --green: #60ee9d;
  --amber: #ffc85c;
  --red: #ff6676;
  --purple: #b28cff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #05080d; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, Segoe UI, sans-serif; }
body { padding: 22px; background: radial-gradient(circle at 30% -10%, #163348 0, transparent 35%), #05080d; }
.page-head { max-width: 1500px; margin: 0 auto 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.kicker, .hud-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); }
h1 { margin: 4px 0 5px; font-size: 34px; }
.page-head p { margin: 0; color: var(--muted); }
.head-actions { display: flex; align-items: flex-end; flex-direction: column; gap: 8px; }
.safe-note { color: var(--muted); font-size: 11px; }
main { max-width: 1500px; margin: auto; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #375671; border-radius: 18px; background: #08121a; box-shadow: 0 25px 80px #0009; }
canvas { display: block; width: 100%; height: 100%; }
.stage-top { position: absolute; z-index: 2; inset: 18px 18px auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; pointer-events: none; }
.brand-small { font-size: 12px; color: #a8d7ec; letter-spacing: .2em; }
.brand-line { font-size: 26px; font-weight: 950; letter-spacing: .06em; text-shadow: 0 2px 20px #39bfe055; }
.cycle-card { min-width: 220px; padding: 10px 18px; text-align: center; border: 1px solid #3a596f; background: #07121de8; border-radius: 12px; backdrop-filter: blur(7px); }
.cycle-time { font: 900 32px/1 ui-monospace, SFMono-Regular, Consolas, monospace; margin: 5px 0; color: #fff; }
.cycle-sub { font-size: 10px; color: var(--muted); }
.cycle-vault { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 38px; margin-top: 8px; padding-top: 7px; border-top: 1px solid #294357; }
.cycle-vault-icon { width: 48px; height: 34px; object-fit: contain; filter: drop-shadow(0 0 7px #7cff8d88); animation: vault-float 2.2s ease-in-out infinite; }
.cycle-vault-icon.is-empty { opacity: .55; filter: grayscale(.3) drop-shadow(0 0 5px #ffc85c55); }
.cycle-vault strong { color: #fff2c8; font: 900 14px ui-monospace, SFMono-Regular, Consolas, monospace; }
@keyframes vault-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-3px) rotate(2deg); } }
.mode-card { justify-self: end; text-align: right; background: #18220ddd; border: 1px solid #70833a; border-radius: 10px; padding: 9px 11px; }
.mode-card strong { display: block; color: #d9ff68; font-size: 12px; letter-spacing: .12em; }
.mode-card span { display: block; color: #c7d79b; font-size: 9px; margin-top: 3px; }
.event-ticker { position: absolute; z-index: 2; left: 18px; bottom: 16px; max-width: 650px; display: flex; gap: 10px; align-items: center; border: 1px solid #2c4458; background: #07111ddd; border-radius: 10px; padding: 9px 12px; font-size: 11px; backdrop-filter: blur(7px); pointer-events: none; }
.event-ticker b { color: var(--cyan); letter-spacing: .08em; }
.event-ticker span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boss-overlay { position: absolute; z-index: 3; left: 50%; bottom: 66px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 36px); padding: 11px 20px; border: 1px solid currentColor; border-radius: 999px; background: #071019e8; box-shadow: 0 8px 28px #000b; text-align: center; pointer-events: none; font-size: 23px; font-weight: 950; letter-spacing: .07em; text-shadow: 0 2px 16px #000; }
.boss-overlay:empty { display: none; }
.boss-overlay small { display: inline; font-size: 11px; letter-spacing: .08em; margin-left: 10px; color: #fff; }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.control-panel { background: linear-gradient(140deg, #0d1823, #09111a); border: 1px solid var(--line); border-radius: 14px; padding: 15px; }
.learn-panel { grid-column: 1 / -1; border-color: #315c72; }
.learn-panel > p { font-size: 17px; margin: 9px 0 13px; color: #d9f3ff; }
.panel-title span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.panel-title strong { display: block; margin-top: 2px; font-size: 16px; }
.truth-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.truth-grid div { border: 1px solid #294358; background: #08121b; border-radius: 9px; padding: 9px; }
.truth-grid b, .truth-grid span { display: block; }
.truth-grid b { font-size: 12px; color: var(--cyan); }
.truth-grid span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.button-row { display: flex; gap: 7px; margin-top: 11px; align-items: center; }
.button-row.wrap { flex-wrap: wrap; }
.button { appearance: none; border: 1px solid #36526a; border-radius: 9px; background: #152434; color: var(--ink); padding: 9px 12px; font-weight: 800; font-size: 12px; cursor: pointer; text-decoration: none; }
.button:hover { filter: brightness(1.18); }
.button.buy, .button.success { border-color: #317657; background: #153c2c; color: #caffdf; }
.button.sell, .button.danger { border-color: #873d49; background: #421d25; color: #ffd0d4; }
.button.warning { border-color: #856829; background: #3a2d13; color: #ffe2a3; }
.button.secondary { background: #101a25; }
.check { font-size: 11px; color: var(--muted); margin-left: auto; }
.holder-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 11px 0; }
.holder-inputs label, .select-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.holder-inputs input, select { display: block; width: 100%; margin-top: 5px; border: 1px solid #31495d; border-radius: 8px; background: #071018; color: var(--ink); padding: 9px; }
.select-label { display: block; margin-top: 12px; }
.select-label select { max-width: 220px; }
.debug-panel { grid-column: 1 / -1; }
.debug-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-top: 10px; }
.debug-item { border: 1px solid #263a4d; border-radius: 8px; padding: 8px; background: #071019; }
.debug-item b, .debug-item span { display: block; }
.debug-item b { font: 800 16px ui-monospace, monospace; }
.debug-item span { font-size: 9px; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

body.obs-mode { padding: 0; background: #000; overflow: hidden; display: grid; place-items: center; }
body.obs-mode main { max-width: none; width: 100vw; height: 100vh; display: grid; place-items: center; }
body.obs-mode .stage { width: min(100vw, calc(100vh * 16 / 9)); height: min(100vh, calc(100vw * 9 / 16)); aspect-ratio: 16 / 9; border: 0; border-radius: 0; box-shadow: none; }
body.obs-mode .no-obs { display: none !important; }

@media (max-width: 900px) {
  body { padding: 9px; }
  .page-head { align-items: flex-start; }
  .head-actions { align-items: flex-start; }
  .stage-top { inset: 8px; }
  .brand-line { font-size: 15px; }
  .cycle-card { min-width: 150px; padding: 7px; }
  .cycle-time { font-size: 22px; }
  .cycle-vault { min-height: 30px; margin-top: 5px; padding-top: 4px; }
  .cycle-vault-icon { width: 38px; height: 27px; }
  .cycle-vault strong { font-size: 11px; }
  .mode-card { display: none; }
  .event-ticker { left: 8px; bottom: 7px; }
  .boss-overlay { bottom: 48px; font-size: 17px; }
  .control-grid { grid-template-columns: 1fr; }
  .learn-panel, .debug-panel { grid-column: auto; }
  .truth-grid { grid-template-columns: repeat(2, 1fr); }
  .debug-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .page-head { flex-direction: column; }
  .stage-top { grid-template-columns: 1fr auto; }
  .brand-lockup { display: none; }
  .cycle-card { grid-column: 2; }
  .control-grid { grid-template-columns: 1fr; }
  .holder-inputs { grid-template-columns: 1fr; }
  .button-row { flex-wrap: wrap; }
  .check { margin-left: 0; }
  .event-ticker { right: 8px; max-width: none; }
  .boss-overlay small { display: block; margin: 4px 0 0; }
  .truth-grid { grid-template-columns: 1fr; }
}
