.drift.cabinet {
  width: 100%;
  max-width: 772px;
  margin-inline: auto;
  padding: clamp(12px, 4.4svh, 44px) clamp(9px, 2.8vw, 24px) 18px;
}
.drift .stage {
  aspect-ratio: 1.17 / 1;
  max-height: 82svh;
  border-radius: 18px;
  border-color: #99b098;
}
.drift-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: end;
  padding: clamp(20px, 6vw, 54px);
  background: linear-gradient(0deg, #0e3027 0%, #13372dec 22%, #133c2b76 62%, #1a462b00 100%);
  z-index: 3;
}
.drift-cover h1 {
  font-size: clamp(52px, 12.6vw, 112px);
  line-height: .87;
  letter-spacing: -.087em;
  white-space: nowrap;
}
.drift-cover h1 span {
  color: #f8db7d;
  font-size: .30em;
  margin-left: .19em;
  vertical-align: top;
}
.drift-cover p {
  font-size: clamp(14px, 2.15vw, 18px);
  line-height: 1.36;
  max-width: 32ch;
  margin: 16px 0 19px;
  color: #ecf1d8;
}
.drift-cover button {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  min-height: 49px;
  border-radius: 9px;
  box-shadow: 0 3px #a87842;
}
.drift-cover button:hover { background: #ffe29d }
/* The dock ceremony: one readable score, with the scene still visible above it. */
.finish {
  align-items: end;
  justify-content: center;
  padding: clamp(12px, 3vw, 30px);
  background: linear-gradient(0deg,#0c271ef2 1%,#113328ab 55%,#12372b39 100%);
}
.dock-report {
  width: min(100%, 486px);
  min-width: 0;
  padding: clamp(15px, 3.2vw, 24px);
  border: 1px solid #90af8d;
  border-radius: 15px;
  background: linear-gradient(151deg,#214839,#17382c 60%,#16332a);
  box-shadow: 0 12px 28px #071c17aa,inset 0 0 0 3px #17382c;
  animation: dock-arrival .38s cubic-bezier(.22,.7,.4,1) both;
}
.dock-head .dock-kicker {
  margin: 0 0 6px;
  color: #f1d58a;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .17em;
}
.dock-head h2 {
  font-size: clamp(39px, 10.8vw, 67px);
  line-height: .88;
  letter-spacing: -.07em;
  white-space: nowrap;
}
.dock-head h2:focus { outline: none }
.dock-ducks {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 0 8px;
  margin-top: 5px;
  border-bottom: 1px solid #a4c39c4f;
}
.duck-pips { display: flex; gap: 1px; align-items: center; flex: 0 0 auto }
.duck-pip {
  width: clamp(23px, 6.4vw, 32px);
  height: auto;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(0 0 4px #efd1764a);
  animation: dock-duck .36s cubic-bezier(.17,.65,.4,1.29) calc(.27s + var(--pip) * .083s) both;
}
.dock-ducks p {
  margin: 0;
  font-size: clamp(11px, 3vw, 14px);
  color: #f1f3d9;
  white-space: nowrap;
}
.dock-ducks strong { color: #f9dc8e; font-weight: 870 }
.dock-stats {
  display: grid;
  grid-template-columns: .86fr 1.28fr .86fr;
  gap: 6px;
  margin: 10px 0 12px;
}
.dock-stats > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  min-width: 0;
  padding: 6px 5px;
  background: #102c27;
  border-top: 2px solid #88a775;
  border-radius: 5px;
  text-align: center;
  animation: dock-stat .33s ease-out calc(.23s + var(--beat) * .105s) both;
}
.dock-stats dt {
  font-size: clamp(9px, 2.9vw, 12px);
  white-space: nowrap;
  color: #d9e7c9;
  line-height: 1.1;
}
.dock-stats dd {
  margin: 0;
  font: 700 clamp(24px, 6.6vw, 38px)/1 Georgia,serif;
  font-variant-numeric: tabular-nums;
  color: #ffe4a5;
}
.dock-report .dock-replay {
  width: 100%;
  min-height: 46px;
  display: flex;
  justify-content: space-between;
  padding-inline: 13px;
  font-size: 15px;
}
@keyframes dock-arrival {
  from { opacity: 0; transform: translateY(14px) }
  to { opacity: 1; transform: translateY(0) }
}
@keyframes dock-duck {
  from { opacity: 0; transform: scale(.62) translateY(7px) }
  to { opacity: 1; transform: scale(1) translateY(0) }
}
@keyframes dock-stat {
  from { opacity: 0; transform: translateY(6px) }
  to { opacity: 1; transform: translateY(0) }
}
@media(prefers-reduced-motion: reduce) {
  .dock-report,.duck-pip,.dock-stats > div { animation: none }
}
.drift .hud #drift-count { color: #fade9c }
/* One physical, illustrated button on the thumb deck. Its bitmap cannot be selected or dragged. */
.hop-deck {
  display: flex;
  justify-content: center;
  padding: 12px 2px env(safe-area-inset-bottom, 0px);
}
.drift .hop-button {
  display: block;
  width: min(100%, 374px);
  min-height: 84px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  line-height: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.hop-button img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.drift .hop-button:active img { filter: brightness(.84); transform: translateY(2px) }
.drift .hop-button:focus-visible { outline-offset: 3px }
.motion-gate {
  z-index: 5;
  align-items: center;
  background: linear-gradient(95deg, #11352beb, #153b31d9);
}
.motion-gate h2 {
  font-size: clamp(40px, 10vw, 79px);
  max-width: 12ch;
  line-height: .91;
  letter-spacing: -.07em;
}
.motion-gate .motion-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .18em;
  color: #f6d681;
}
.motion-gate .motion-back {
  display: block;
  min-height: 39px;
  margin-top: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ebefbd;
  text-decoration: underline;
  font-size: 13px;
  box-shadow: none;
}
.motion-gate .motion-back:hover { background: transparent; color: #fff3c7 }

@media (max-width: 700px) and (orientation: portrait) {
  .drift.cabinet { padding-top: 9px }
  .drift .stage {
    aspect-ratio: auto;
    height: clamp(286px, 60svh, 560px);
    max-height: none;
    border-radius: 14px;
  }
  .drift-cover { padding: 20px }
  .drift-cover h1 { font-size: clamp(51px, 15.8vw, 99px) }
  .drift-cover p { margin: 11px 0 15px }
}
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .drift.cabinet { max-width: min(100%, calc((100svh - 91px) * 1.65)); padding-block: 4px }
  .drift .stage { aspect-ratio: 1.65 / 1; border-radius: 11px }
  .drift-cover { padding: 10px 16px }
  .drift-cover h1 { font-size: clamp(38px, 16svh, 66px) }
  .drift-cover p { font-size: 13px; margin: 6px 0 8px }
  .drift-cover button { min-height: 44px }
  .finish { padding: 7px }
  .dock-report { padding: 9px 12px }
  .dock-head .dock-kicker { margin-bottom: 3px }
  .dock-head h2 { font-size: clamp(32px, 11svh, 49px) }
  .dock-ducks { padding-block: 4px; margin-top: 3px }
  .duck-pip { width: 21px }
  .dock-stats { margin: 6px 0 7px }
  .dock-stats > div { padding: 3px 4px }
  .dock-stats dd { font-size: 23px }
  .dock-report .dock-replay { min-height: 44px }
  .hop-deck { padding-top: 5px }
  .drift .hop-button { width: min(100%, 270px); min-height: 66px }
}

/* This path appears only when a browser shell cannot reliably expose motion. */
.drift .browser-open {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  min-height: 47px;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1px solid #efdf9f;
  background: #f9d276;
  color: #132f22;
  text-decoration: none;
  font-weight: 850;
}
.drift .browser-open:hover { background: #ffe29d }
.drift .start-help { margin: 8px 0 3px; font-size: 12px; max-width: 43ch }
.motion-gate button:not([hidden]) + .browser-open { margin-left: 8px }
.tilt-meter {
  position: absolute;
  left: 50%;
  top: 13px;
  width: 58px;
  height: 13px;
  border-radius: 20px;
  border: 1px solid #e6f2d294;
  background: #15372cc7;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}
.tilt-meter i {
  position: absolute;
  left: 24px;
  top: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f9d276;
  transform: translateX(calc(var(--roll, 0) * 21px));
}

#drift-level { text-transform: uppercase }
#drift-dock { text-transform: uppercase }
.drift .hud { gap: 3px; justify-content: space-between }
.drift .hud span { font-size: clamp(8px, 2.55vw, 12px) }
.drift [data-level="2"] .dock-report { border-color: #f8ae82 }
.drift [data-level="2"] .dock-kicker { color: #ffd7a7 }
.drift [data-level="3"] .dock-report { border-color: #aaa7ea; background: linear-gradient(150deg,#354665,#203249 65%,#243249) }
.drift [data-level="3"] .dock-stats > div { border-color: #aaa7ea; background: #1a2942 }

/* Let the final number land before offering the next course. */
.dock-report .dock-replay { animation: dock-continue .3s .9s both }
.dock-report .dock-replay span:first-child { line-height: 1.13; text-align: left }
@keyframes dock-continue {
  from { opacity: 0; visibility: hidden; transform: translateY(3px) }
  to { opacity: 1; visibility: visible; transform: translateY(0) }
}
.drift-secret {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 34px;
  margin: 0;
  padding: 5px 9px;
  transform: translateX(-50%);
  color: #fff6dc;
  background: #1e3a45ee;
  border: 1px solid #d8c6e0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  pointer-events: none;
}
@media(prefers-reduced-motion: reduce) {
  .dock-report .dock-replay { animation: none }
}
