/* Experimental Design Variable Dash (folder: quiz-dash) — game-specific styles (shared look comes from ../../assets/site.css).
   Every class here starts with "qd-" so it can't clash with the site's own classes. */

.qd-page .wrap {
  max-width: 880px;
}

/* stop double-tap zoom on the whole page (iPad / phones) */
.qd-page {
  touch-action: manipulation;
}

.qd-main {
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.qd-title {
  margin: 4px 0 12px;
  font-size: clamp(1.7rem, 1.4rem + 1.6vw, 2.3rem);
}

/* ---------- Score bar ---------- */

.qd-hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.qd-stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 5px 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--glass);
}

.qd-stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

/* fixed-width digits + fixed grid columns: a changing number never moves anything */
.qd-stat-value {
  font-size: 1.125rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

.qd-stat-value small {
  margin-left: 1px;
  font-size: 0.75em;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Power-up chips ---------- */

.qd-fx {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  min-height: 30px;          /* room for one row of chips, so the game never jumps */
  margin: 2px 0 6px;
}

.qd-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.qd-chip-t {
  font-variant-numeric: tabular-nums;
}

/* same colours as the power-up orbs in the game */
.qd-chip-shield { background: #2f80ed; }
.qd-chip-slow { background: #8e44ad; }
.qd-chip-x2 { background: #e0a800; color: #06080a; }
.qd-chip-moon { background: #2e9e6b; }

/* ---------- Stage: canvas + overlays share one grid cell ----------
   If a card is taller than the canvas (small phones, long questions), the cell grows
   to fit it instead of cutting the top off. */

.qd-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.qd-canvas,
.qd-overlay {
  grid-area: 1 / 1;
}

.qd-canvas {
  align-self: start;
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  background: #7fc4ec;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.qd-overlay {
  display: flex;
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 9, 11, 0.72);
  overflow: auto;
}

.qd-overlay-tap {
  cursor: pointer;
}

/* margin:auto centres the card but, unlike align-items:center, never pushes its top out of reach */
.qd-card {
  margin: auto;
  width: 100%;
  max-width: 540px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)), var(--bg-raised);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
  cursor: auto;
}

.qd-card h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.qd-card h2:focus {
  outline: none;
}

.qd-card p {
  margin: 6px 0 10px;
  line-height: 1.45;
}

.qd-wide {
  display: flex;
  width: 100%;
  margin-top: 10px;
}

/* ---------- Intro slides ---------- */

.qd-slides {
  min-height: 170px;
  text-align: left;
}

.qd-slide h2 {
  text-align: center;
}

.qd-slide ul {
  margin: 0;
  padding-left: 18px;
}

.qd-slide li {
  margin: 6px 0;
  line-height: 1.4;
}

.qd-sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: middle;
}

.qd-sw-block { background: #8a5530; }
.qd-sw-gate { background: #d63a2f; }
.qd-sw-wall { background: #5b4b8a; }
.qd-sw-shield { background: #2f80ed; }
.qd-sw-slow { background: #8e44ad; }
.qd-sw-x2 { background: #e0a800; }
.qd-sw-moon { background: #2e9e6b; }

.qd-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 10px 0;
}

.qd-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.35;
}

.qd-dots i.on {
  background: var(--teal);
  opacity: 1;
}

.qd-nav {
  display: flex;
  gap: 8px;
}

.qd-nav .btn {
  flex: 1 1 0;
  min-width: 0;
  padding-left: 10px;
  padding-right: 10px;
}

.is-invisible {
  visibility: hidden;
}

.qd-custom {
  margin-top: 12px;
  text-align: left;
  font-size: 0.9rem;
}

/* 44px tall so it is easy to tap. It keeps its normal display so the ▸/▾ marker
   still shows in every browser (display: flex would hide it in Chrome). */
.qd-custom summary {
  min-height: 44px;
  padding: 10px 0;
  line-height: 24px;
  color: var(--teal);
  cursor: pointer;
}

.qd-custom textarea {
  display: block;
  width: 100%;
  height: 120px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.qd-custom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.qd-qmsg {
  min-height: 1.4em;
  color: var(--muted);
}

/* ---------- Checkpoint question ---------- */

.qd-question {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.qd-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}

.qd-opt {
  position: relative;
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  color: var(--text);
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.qd-opt:hover:not(:disabled) {
  border-color: var(--teal);
}

.qd-opt:disabled {
  cursor: default;
}

.qd-opt-key {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.qd-opt.right {
  border-color: var(--good);
  background: var(--good-soft);
}

.qd-opt.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.qd-opt:disabled:not(.right):not(.wrong) {
  opacity: 0.5;
}

.qd-result {
  min-height: 1.45em;
  font-weight: 700;
}

.qd-result.is-right { color: var(--good); }
.qd-result.is-wrong { color: var(--bad); }

/* ---------- On-screen pad ---------- */

.qd-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.qd-pad button {
  min-height: 56px;
  padding: 12px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--glass);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.qd-pad button:active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--on-accent);
}

/* Number hints are for keyboards; hide them on touch-only devices */
@media (hover: none) and (pointer: coarse) {
  .qd-opt {
    padding-left: 14px;
  }

  .qd-opt-key {
    display: none;
  }
}

/* Small phones: two rows of chips fit without moving the game */
@media (max-width: 479px) {
  .qd-fx {
    min-height: 54px;
  }

  .qd-stat {
    padding: 4px 6px 5px;
  }

  .qd-stat-label {
    font-size: 0.625rem;
    letter-spacing: 0.02em;
  }

  .qd-stat-value {
    font-size: 1rem;
  }

  .qd-card {
    padding: 14px;
  }
}
