:root {
  --panel: #131d3a;
  --panel-2: #0d1530;
  --line: #2c3d6b;
  --ink: #eef2ff;
  --ink-dim: #9aa7cc;
  --gold: #ffd75e;
  --shadow: rgba(4, 8, 20, 0.75);
  --disp: "Fredoka", "Trebuchet MS", "Comic Sans MS", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a1128;
  font-family: var(--disp);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

#sky {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ---------------------------------------------------------- station panel */

.station {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 10;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 10px 14px 12px;
  user-select: none;
  min-width: 218px;
}

.station-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 2px dashed rgba(122, 140, 190, 0.35);
}

.logo { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.4)); }

.station-title h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.station-title p {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 3px;
}

.readouts {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 5px 14px;
  font-family: var(--mono);
}

.readouts > div { display: flex; flex-direction: column; gap: 1px; }
.readouts dt {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.readouts dd { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.readouts .wide { grid-column: span 2; }
.readouts .wide dd { color: var(--gold); }

.meter {
  width: 46px;
  height: 9px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 3px;
  background: rgba(0, 0, 0, 0.3);
}
.meter i {
  display: block;
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, #6fc3ff, #b48cff);
  transition: width 0.4s ease;
}

/* ---------------------------------------------------------- top right chips */

.top-right {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.chip {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 5px 0 var(--shadow);
  cursor: pointer;
  font-family: var(--disp);
  font-size: 19px;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.chip svg { width: 22px; height: 22px; }
.chip:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--shadow); }
.chip:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--shadow); }

/* ---------------------------------------------------------- hint + banner + toasts */

.hint {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: var(--gold);
  color: #241c04;
  font-weight: 600;
  font-size: 14.5px;
  padding: 9px 18px 10px;
  border-radius: 999px;
  border: 2px solid #1c1503;
  box-shadow: 0 5px 0 rgba(4, 8, 20, 0.6);
  animation: bob 2.4s ease-in-out infinite;
  transition: opacity 0.5s ease, transform 0.5s ease;
  max-width: min(88vw, 560px);
  text-align: center;
  pointer-events: none;
}
.hint .hand { display: inline-block; margin-right: 4px; }
.hint.gone { opacity: 0; transform: translateX(-50%) translateY(-14px); }

@keyframes bob {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -7px; }
}

.banner {
  position: fixed;
  top: 22%;
  left: 50%;
  z-index: 9;
  transform: translateX(-50%) rotate(-3deg);
  font-family: var(--disp);
  font-weight: 700;
  font-size: clamp(40px, 9vw, 92px);
  letter-spacing: 0.04em;
  color: #ff5a4f;
  text-shadow: 0 4px 0 #3a0d0a, 0 0 34px rgba(255, 90, 79, 0.5);
  pointer-events: none;
  animation: stamp 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes stamp {
  from { transform: translateX(-50%) rotate(-3deg) scale(2.4); opacity: 0; }
  to { transform: translateX(-50%) rotate(-3deg) scale(1); opacity: 1; }
}

.toasts {
  position: fixed;
  bottom: 128px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.toast {
  background: rgba(13, 21, 48, 0.94);
  border: 2px solid var(--line);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--shadow);
  animation: toast-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: opacity 0.45s ease, transform 0.45s ease;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in {
  from { transform: translateY(14px) scale(0.85); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------------------------------------------------------- dock */

.dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(19, 29, 58, 0.96), rgba(11, 17, 38, 0.96));
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 8px 0 var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  user-select: none;
  max-width: min(97vw, 1080px);
}

.sliders {
  display: flex;
  flex-direction: column;
  gap: 9px;
  justify-content: center;
  padding-right: 12px;
  border-right: 2px dashed rgba(122, 140, 190, 0.3);
}

.ctl {
  display: grid;
  grid-template-columns: 46px 1fr 86px;
  align-items: center;
  gap: 8px;
}

.ctl-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc, var(--ink-dim));
}

.ctl output {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.ctl input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 168px;
  height: 26px;
  background: transparent;
  cursor: ew-resize;
}
.ctl input[type="range"]::-webkit-slider-runnable-track {
  height: 11px;
  border-radius: 7px;
  border: 1.5px solid rgba(0, 0, 0, 0.5);
  background: var(--track, #22305a);
}
.ctl input[type="range"]::-moz-range-track {
  height: 11px;
  border-radius: 7px;
  border: 1.5px solid rgba(0, 0, 0, 0.5);
  background: var(--track, #22305a);
}
.ctl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--panel);
  border: 3px solid var(--acc, #6fc3ff);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
  transition: transform 0.1s ease;
}
.ctl input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.ctl input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel);
  border: 3px solid var(--acc, #6fc3ff);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
}

/* ---------------------------------------------------------- summon buttons */

.summons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-content: center;
}

.summons button {
  --acc: #8fd0ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 74px;
  padding: 8px 4px 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.18)), var(--panel-2);
  color: var(--acc);
  border: 2px solid var(--acc);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(4, 8, 20, 0.7);
  cursor: pointer;
  font-family: var(--disp);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
}
.summons button svg { width: 24px; height: 24px; }
.summons button span {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.85;
}
.summons button:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 rgba(4, 8, 20, 0.7), 0 0 18px -4px var(--acc);
}
.summons button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(4, 8, 20, 0.7);
}

/* ---------------------------------------------------------- time box */

.timebox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  justify-content: center;
  padding-left: 12px;
  border-left: 2px dashed rgba(122, 140, 190, 0.3);
}

#dial {
  width: 108px;
  height: 108px;
  cursor: grab;
  touch-action: none;
}
#dial:active { cursor: grabbing; }

.speeds { display: flex; gap: 5px; }
.speeds button {
  min-width: 34px;
  height: 28px;
  padding: 0 7px;
  background: var(--panel-2);
  color: var(--ink-dim);
  border: 2px solid var(--line);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(4, 8, 20, 0.6);
  transition: all 0.12s ease;
}
.speeds button:hover { color: var(--ink); transform: translateY(-1px); }
.speeds button.on {
  background: var(--gold);
  color: #241c04;
  border-color: #241c04;
}

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.noscript {
  position: fixed;
  inset: auto 0 40% 0;
  text-align: center;
  font-size: 18px;
  color: var(--ink);
}

/* ---------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .dock {
    left: 8px;
    right: 8px;
    transform: none;
    overflow-x: auto;
    gap: 10px;
    padding: 10px;
    scrollbar-width: none;
  }
  .dock::-webkit-scrollbar { display: none; }
  .sliders { flex: none; }
  .ctl { grid-template-columns: 40px 1fr 70px; }
  .ctl input[type="range"] { width: 120px; }
  .summons { grid-template-columns: repeat(5, 1fr); flex: none; }
  .summons button { width: 62px; padding: 6px 2px 5px; }
  .summons button svg { width: 20px; height: 20px; }
  .summons button span { font-size: 9px; }
  .timebox { flex: none; }
  #dial { width: 88px; height: 88px; }
  .station { transform: scale(0.86); transform-origin: top left; }
  .toasts { bottom: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint { animation: none; }
  .banner { animation: none; }
  .toast { animation: none; }
}
