:root {
  --hud: #00ff66;
  --hud-dim: rgba(0, 255, 102, 0.72);
  --amber: #ffb000;
  --red: #ff7a64;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Share Tech Mono", ui-monospace, Consolas, monospace;
}

/* Everything is sized in container units, so the page and an iframe on
   bitcoinity.org/markets look the same at any size. */
#stage {
  position: fixed;
  inset: 0;
  container-type: size;
  font-size: clamp(10px, min(1.1cqw, 2.1cqh), 24px);
  color: var(--hud);
  text-shadow: 0 0 6px rgba(0, 255, 102, 0.5);
  user-select: none;
  -webkit-user-select: none;
}

#cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}

.hidden { display: none !important; }

button {
  font: inherit;
  color: var(--hud);
  background: rgba(0, 20, 8, 0.7);
  border: 1px solid var(--hud-dim);
  padding: 0.3em 0.8em;
  cursor: pointer;
  text-shadow: inherit;
}
button:hover { background: rgba(0, 60, 24, 0.8); }
button:focus-visible { outline: 2px solid #eaffee; outline-offset: 2px; }

.label { display: block; opacity: 0.8; letter-spacing: 0.18em; font-size: 0.85em; }
.sub { display: block; opacity: 0.92; white-space: nowrap; }
.figure { display: block; font-size: 2.5em; line-height: 1.05; font-weight: 400; white-space: nowrap; }

/* The numbers live on the instrument panel so the windscreen stays clear. */
#panel-left, #panel-right {
  position: absolute;
  top: 72.5cqh;
  width: 27cqw;
  display: flex;
  flex-direction: column;
}
#panel-left { left: 3.5cqw; }
#panel-right { right: 3.5cqw; gap: 0.5em; }

#state { margin-top: 0.6em; display: grid; gap: 0.1em; }
#side { font-size: 1.05em; letter-spacing: 0.08em; }
#elev { font-size: 1.4em; line-height: 1.15; }
#nose { opacity: 0.9; }
body.above #side, body.above #nose { color: #b6ff9a; }
body.below #side, body.below #nose { color: var(--red); }

#answers { display: grid; gap: 0.5em; }
.qa {
  background: rgba(0, 18, 7, 0.78);
  border: 1px solid var(--hud-dim);
  padding: 0.35em 0.8em;
}
.qa span { display: block; font-size: 0.74em; opacity: 0.85; letter-spacing: 0.14em; }
.qa b { display: block; font-size: 1.45em; font-weight: 400; letter-spacing: 0.06em; line-height: 1.15; }

#path, #block { font-size: 0.85em; display: flex; gap: 0.7em; flex-wrap: wrap; opacity: 0.92; }
#path-crab { color: var(--amber); }

#radio {
  display: flex;
  align-items: center;
  gap: 0.8em;
  font-size: 0.82em;
  background: rgba(0, 18, 7, 0.78);
  border: 1px solid var(--hud-dim);
  padding: 0.25em 0.6em;
}
#track-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#radio button { padding: 0.15em 0.6em; }

#fs-btn {
  position: absolute;
  top: 1.2cqh;
  left: 2cqw;
  font-size: 0.85em;
  padding: 0.25em 0.6em;
  z-index: 2;
}

/* The big sun/moon switch. One tap flips it; the lit half is the current sky. */
#theme-btn {
  position: absolute;
  top: 1.2cqh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  padding: 0;
  font-size: 1.45em;
  letter-spacing: 0.08em;
  border: 2px solid var(--hud);
  border-radius: 999px;
  overflow: hidden;
  min-height: 44px;
  z-index: 3;
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.35);
}
#theme-btn .opt { padding: 0.4em 1.2em; white-space: nowrap; opacity: 0.6; transition: background 0.2s, color 0.2s; }
#theme-btn .opt.on { background: var(--hud); color: #02140a; text-shadow: none; opacity: 1; }

/* Flight hint under the sun/moon switch. */
#hint {
  position: absolute;
  top: 8.6cqh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 0.95em;
  letter-spacing: 0.22em;
  white-space: nowrap;
  pointer-events: none;
  animation: hintpulse 1.8s ease-in-out infinite;
}
#hint.live { animation: none; color: #eaffee; }
@keyframes hintpulse { 50% { opacity: 0.35; } }
body.embed #hint { display: none; }
/* With the full instrument cluster the readouts live on the dials. */
body.dials #panel-left, body.dials #panel-right { display: none; }

/* Ad + live screen count: top-right corner of the cockpit rail. */
#corner {
  position: absolute;
  top: 1.2cqh;
  right: 2cqw;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1em;
  font-size: max(10px, 0.82em);
  line-height: 1.25;
  text-align: right;
}
#corner .adline { color: var(--amber); font-weight: 400; letter-spacing: 0.16em; text-shadow: 0 0 6px rgba(255, 176, 0, 0.45); }
#corner a { color: var(--hud); text-decoration: underline dotted; text-underline-offset: 0.2em; }
#corner a:hover { color: #eaffee; }
#screens { opacity: 0.85; }
body.noad #ad-mail, body.noad .adline { display: none; }

#status {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0.7cqh;
  font-size: 0.7em;
  opacity: 0.55;
  pointer-events: none;
  white-space: nowrap;
}

/* Small caution strip under the heading tape, clear of the gunsight. */
#warn {
  position: absolute;
  left: 50%;
  top: 20cqh;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.9em;
  max-width: 62cqw;
  background: rgba(30, 18, 0, 0.92);
  border: 1px solid var(--amber);
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255, 176, 0, 0.5);
  padding: 0.35em 0.8em;
  font-size: 0.9em;
  z-index: 5;
}
#warn b { font-weight: 400; letter-spacing: 0.12em; white-space: nowrap; }
#warn button { color: var(--amber); border-color: var(--amber); white-space: nowrap; }

/* Tall/narrow screens: no dial row, so the two columns share the panel. */
@container (max-aspect-ratio: 23/20) {
  #panel-left, #panel-right { width: 45cqw; top: 71.5cqh; }
  #panel-left { left: 3cqw; }
  #panel-right { right: 3cqw; }
  .figure { font-size: 1.9em; }
  #theme-btn { left: 3cqw; transform: none; font-size: 1.15em; }
  #fs-btn { display: none; }
}

/* Embedded on another page (bitcoinity.org/markets etc.) */
body.embed #radio, body.embed #fs-btn { display: none; }

@media (prefers-reduced-motion: reduce) {
  #cv { cursor: default; }
}
