:root {
  --sky-top: #c8e9ff;
  --sky-mid: #eef8ff;
  --sand: #f3e2b8;
  --sand-deep: #e6cb86;
  --panel: #fffdf8;
  --ink: #1d2a24;
  --muted: #5d6f66;
  --line: rgba(29, 42, 36, 0.12);
  --lime: #8fd12a;
  --lime-deep: #6aa816;
  --crane: #5aa8e8;
  --dump: #d4a017;
  --danger: #d64545;
  --ok: #2f9e44;
  --shadow: 0 18px 40px rgba(40, 60, 50, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sand) 78%, var(--sand-deep) 100%);
}

body {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.65rem clamp(0.85rem, 2.5vw, 1.4rem) 1.25rem;
  position: relative;
  min-height: 100dvh;
}

.sky {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.85) 0 4%, transparent 5%),
    radial-gradient(circle at 18% 16%, rgba(255,255,255,0.7) 0 7%, transparent 8%),
    radial-gradient(circle at 78% 12%, rgba(255,255,255,0.8) 0 5%, transparent 6%),
    radial-gradient(circle at 86% 18%, rgba(255,255,255,0.55) 0 9%, transparent 10%);
  z-index: 0;
}

.topbar, main, section, .modal { position: relative; z-index: 1; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.brand {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  letter-spacing: 0.02em;
}
.brand span { color: var(--lime-deep); }

/* Landing fits one laptop viewport: brand + machines + register */
.landing {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: calc(100dvh - 3.2rem);
}

.landing .hero {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.landing .register {
  flex: 0 0 auto;
  margin-top: 0;
}

.badge {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
}
.badge.on { color: var(--ok); }
.badge.off { color: var(--danger); }

.hero {
  text-align: center;
  padding: 0.15rem 0 0.35rem;
}

.hero-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-title {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(255,255,255,0.6);
}

.hero-sub {
  margin: 0.4rem auto 0.7rem;
  max-width: 28rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.hero-machines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.55rem, 1.5vw, 1rem);
  align-items: stretch;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 640px) {
  .hero-machines { grid-template-columns: 1fr; }
  .landing { min-height: 0; }
}

.machine {
  appearance: none;
  border: 3px solid transparent;
  background: transparent;
  padding: 0;
  margin: 0;
  min-height: 0;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  transition: transform 0.25s ease, border-color 0.2s ease;
}

.machine-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: clamp(110px, 20vh, 200px);
  padding: 0.55rem;
  box-sizing: border-box;
  border-radius: 14px 14px 8px 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 70%, rgba(255, 255, 255, 0.4), transparent 60%),
    linear-gradient(180deg, #f0dcc0 0%, #e8cfa0 50%, #dbb87a 100%);
}

.machine img {
  /* scale down to the box — never use intrinsic image height */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  flex: 0 1 auto;
}

.machine:hover { transform: translateY(-2px); }
.machine.selected {
  border-color: var(--lime-deep);
  border-radius: 18px;
  padding: 0.2rem;
  background: rgba(255,255,255,0.45);
}
.machine.crane.selected { border-color: var(--crane); }
.machine.dump.selected { border-color: var(--dump); }

.machine-name {
  font-family: "Fredoka", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}
.machine-meta {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem 1rem 1rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.register {
  display: grid;
  gap: 0.35rem 1.25rem;
}

@media (min-width: 820px) {
  .register {
    grid-template-columns: minmax(12rem, 0.9fr) minmax(16rem, 1.2fr);
    align-items: end;
  }
  .register .lede { margin-bottom: 0; }
  .register .fineprint { margin-top: 0.45rem; }
}

.register h2, .wait-panel h2, .modal-card h2 {
  margin: 0 0 0.2rem;
  font-family: "Fredoka", sans-serif;
  font-size: 1.25rem;
}

.lede {
  margin: 0 0 0.65rem;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.92rem;
}

.field {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.picked {
  margin: 0 0 0.5rem;
  font-weight: 800;
  color: var(--ink);
  font-size: 0.92rem;
}

.cta, .ghost, .danger, button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  min-height: 3.1rem;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.cta {
  width: 100%;
  min-height: 2.75rem;
  color: #143016;
  background: linear-gradient(180deg, #b6ef4c, var(--lime));
  box-shadow: 0 6px 0 var(--lime-deep), 0 12px 20px rgba(80, 120, 40, 0.2);
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
}
.cta:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--lime-deep); }
.cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.ghost {
  background: rgba(255,255,255,0.75);
  border: 1.5px solid var(--line);
  color: var(--ink);
  padding: 0 1rem;
}
.ghost.danger-text { color: var(--danger); }

.fineprint, .hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

/* Taller laptops / desktops: give machines a bit more room but stay in-frame */
@media (min-height: 860px) and (min-width: 820px) {
  .machine-art { height: clamp(160px, 24vh, 240px); }
  .hero-title { font-size: clamp(2.4rem, 5vw, 3.4rem); }
}

@media (max-height: 780px) and (min-width: 700px) {
  .hero-kicker { display: none; }
  .hero-sub { margin-bottom: 0.35rem; font-size: 0.88rem; }
  .hero-title { font-size: clamp(1.7rem, 4vw, 2.3rem); }
  .machine-art { height: clamp(100px, 18vh, 150px); }
  .machine-name { font-size: 1rem; }
  .register { padding: 0.65rem 0.85rem 0.7rem; }
  .register .fineprint { display: none; }
  .landing { gap: 0.4rem; min-height: calc(100dvh - 2.8rem); }
}

.section-label {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
}

.wait-panel { text-align: center; }
.wait-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 1rem;
}
.wait-actions .cta { width: auto; min-width: 11rem; padding: 0 1.4rem; }

.queue-visual { margin: 1.1rem 0; }
.dots {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 1.2rem;
}
.dots span {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lime) 55%, white);
  border: 2px solid var(--lime-deep);
  opacity: 0.45;
}
.dots span.me {
  opacity: 1;
  background: var(--lime);
  transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(143, 209, 42, 0.28);
}

/* One-screen cockpit: cameras + compact controls */
.cockpit-view {
  min-height: calc(100dvh - 3rem);
}

.cockpit {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: calc(100dvh - 3.4rem);
  max-height: calc(100dvh - 3.4rem);
  margin-top: 0.35rem;
  padding: 0.7rem 0.85rem 0.75rem;
  overflow: hidden;
}

.cockpit-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: 0;
}

.cockpit-title-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.85rem;
  min-width: 0;
}

.cockpit-title-block strong {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.2rem;
}

.slot-timer {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 600;
  color: var(--lime-deep);
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-height: 0;
  align-content: stretch;
}

@media (max-width: 640px) {
  .video-grid { grid-template-columns: 1fr 1fr; gap: 0.35rem; }
}

.video-pane {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  min-height: 0;
}

.video-label {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
}

.cockpit .video {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  aspect-ratio: auto;
  max-height: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.5), transparent 40%),
    #e8f4ea;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  overflow: hidden;
}
.cockpit .video img,
.cockpit .video video,
.cockpit .video iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  background: #1a1a1a;
}

.telemetry {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.4;
  margin-bottom: 0;
}
.telemetry.inline {
  word-break: normal;
  opacity: 0.85;
}

.cockpit-controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 0;
}

.controls-legend {
  margin: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
}

.controls-toolbar {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.4fr) auto;
  gap: 0.45rem;
  align-items: stretch;
}

.controls-toolbar .row {
  margin-bottom: 0;
}

.controls-toolbar .row.three,
.controls-toolbar .extras-compact {
  grid-template-columns: repeat(auto-fit, minmax(3.2rem, 1fr));
}

.controls-toolbar #stopBtn {
  width: auto;
  min-width: 4.5rem;
  min-height: 2.6rem;
  margin: 0;
  padding: 0 0.75rem;
  font-size: 0.8rem;
}

.cockpit .pad-compact {
  margin-bottom: 0;
  gap: 0.35rem;
}

.cockpit .pad-compact button {
  min-height: clamp(2.4rem, 6.5vh, 3.4rem);
  font-size: 0.72rem;
  padding: 0.25rem 0.3rem;
}

.cockpit .pad-compact button kbd,
.controls-toolbar button kbd {
  font-size: 0.6rem;
  padding: 0.05rem 0.25rem;
}

@media (max-width: 820px) {
  .controls-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .controls-toolbar #stopBtn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-height: 720px) {
  .cockpit .pad-compact { display: none; }
  .controls-legend { font-size: 0.8rem; }
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.pad button, .row button, #stopBtn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.45rem 0.55rem;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f0f4ef);
  border: 1.5px solid var(--line);
  box-shadow: 0 6px 0 rgba(29, 42, 36, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 800;
}
.pad button { min-height: 4.1rem; }
.row button { min-height: 3rem; font-size: 0.85rem; }
#stopBtn {
  width: 100%;
  margin-bottom: 0.85rem;
  background: linear-gradient(180deg, #ff8f8f, var(--danger));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 0 #a52f2f;
}

button:active, button.held {
  transform: translateY(2px);
  background: linear-gradient(180deg, #c8f06a, var(--lime));
  border-color: transparent;
}

button .btn-label { line-height: 1.1; }
button kbd {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(29, 42, 36, 0.06);
  border: 1px solid rgba(29, 42, 36, 0.12);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.08rem 0.35rem;
  line-height: 1.2;
}
button.held kbd, button:active kbd { color: var(--ink); background: rgba(255,255,255,0.55); }

.row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.row.three { grid-template-columns: repeat(3, 1fr); }

.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(40, 55, 48, 0.35);
  display: grid;
  place-items: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 22px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
  text-align: center;
  animation: pop 0.35s ease;
}
@keyframes pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* gentle hover only — no bob animation (it was clipping the toys) */
