/* Court Vision — shared drill chrome.
   Everything a drill page needs that is not the cue itself: the full-bleed dark
   stage, the start/result sheets, the control bar, and the two stepper flavours
   (light on a sheet, dark over a running drill). Each drill adds only the layout
   of its own cue on top of this.

   Orientation-aware: landscape is primary (typical court setup), portrait works
   without reflow. Sizes adapt to viewport dimensions, not device category. */

html.drill {
  height: 100dvh;
  width: 100dvw;
  position: fixed;
}

body.drill {
  height: 100dvh;
  width: 100dvw;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background: var(--paint);
  color: var(--floor);
  font-family: var(--body);
  margin: 0;
  padding: 0;
}

.stage {
  position: fixed;
  inset: 0;
  padding-bottom: 60px;
  z-index: 1;
}

.cap {
  font-family: var(--data);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ---- sheets: the start gate and the result screen ---- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--floor);
  color: var(--paint);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  overflow-y: auto;
  overflow-x: hidden;
}

.sheet.gone { display: none; }

.sheet h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(36px, 12vw, 92px);
  line-height: 0.82;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0;
  max-width: 90vw;
}

.sheet p {
  font-family: var(--data);
  font-size: clamp(11px, 2.2vw, 14px);
  line-height: 1.6;
  letter-spacing: 0.04em;
  max-width: 32ch;
  margin: 0;
  opacity: 0.7;
}

.sheet .cap { color: var(--paint); opacity: 0.55; }

.sheet a.link {
  font-family: var(--data);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paint);
  opacity: 0.55;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

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

.btn {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(28px, 6vw, 40px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--paint);
  color: var(--floor);
  border: none;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  padding: clamp(14px, 3vw, 20px) clamp(40px, 8vw, 60px);
  min-height: 44px;
  cursor: pointer;
  box-shadow: 7px 7px 0 rgba(23, 20, 15, 0.2);
  white-space: nowrap;
}

.btn-quiet {
  font-family: var(--data);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  color: var(--paint);
  border: 2px solid var(--paint);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  padding: 12px 20px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn:focus-visible,
.btn-quiet:focus-visible,
.dial button:focus-visible,
.tally button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* ---- steppers ---- */

.field { display: grid; justify-items: center; gap: 6px; }

.dial {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--paint);
}

.dial button {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(22px, 4vw, 28px);
  line-height: 1;
  background: transparent;
  color: var(--paint);
  border: none;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  width: clamp(48px, 10vw, 60px);
  min-height: 48px;
  cursor: pointer;
  padding: 0;
}

.dial button:hover { background: var(--paint); color: var(--floor); }
.dial button:disabled { opacity: 0.28; cursor: default; }
.dial button:disabled:hover { background: transparent; color: var(--paint); }

.dial span {
  font-family: var(--data);
  font-size: clamp(13px, 2.2vw, 18px);
  letter-spacing: 0.06em;
  min-width: clamp(80px, 14vw, 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 2px solid var(--paint);
  border-right: 2px solid var(--paint);
  white-space: nowrap;
}

.tally {
  display: flex;
  align-items: stretch;
  border: 2px solid rgba(231, 208, 164, 0.4);
}

.tally button {
  font-family: var(--data);
  font-size: clamp(13px, 2.2vw, 16px);
  background: transparent;
  color: var(--floor);
  border: none;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  min-width: clamp(48px, 9vw, 60px);
  min-height: 54px;
  cursor: pointer;
  padding: 0;
}

.tally button:active { background: rgba(231, 208, 164, 0.2); }

.tally span {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(36px, 10vw, 52px);
  line-height: 1;
  min-width: clamp(80px, 16vw, 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 2px solid rgba(231, 208, 164, 0.4);
  border-right: 2px solid rgba(231, 208, 164, 0.4);
}

/* ---- progress track ---- */

.track {
  width: 100%;
  height: clamp(12px, 2vh, 18px);
  border: 2px solid rgba(231, 208, 164, 0.35);
  background: transparent;
}

.track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--yellow);
}

/* ---- control bar ---- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: clamp(8px, 1.5vh, 12px) clamp(8px, 1.5vw, 12px);
  background: rgba(17, 15, 11, 0.92);
  transform: translateY(115%);
  transition: transform 0.18s ease;
  min-height: 44px;
}

.bar.show { transform: translateY(0); }

.bar button,
.bar a {
  font-family: var(--data);
  font-size: clamp(10px, 1.8vw, 13px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #F4F4F0;
  background: rgba(244, 244, 240, 0.1);
  border: 1px solid rgba(244, 244, 240, 0.25);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  padding: 9px 12px;
  min-width: 40px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.bar button[aria-pressed="true"] { background: #F4F4F0; color: var(--paint); }

.bar button:focus-visible,
.bar a:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.bar .readout {
  font-family: var(--data);
  font-size: clamp(11px, 1.8vw, 14px);
  color: #F4F4F0;
  min-width: 38px;
  text-align: center;
  padding: 0 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bar { transition: none; }
}

@media (orientation: landscape) and (max-height: 600px) {
  .sheet h1 { font-size: clamp(28px, 8vh, 56px); }
  .sheet p { font-size: clamp(10px, 1.6vh, 12px); }
  .btn { font-size: clamp(22px, 4vh, 32px); }
}

@media (orientation: portrait) {
  .stage { padding-bottom: 70px; }
  .sheet { gap: 12px; }
}
