/* Wash the car: the game fills the whole screen and never scrolls. */

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

.game {
  position: fixed; inset: 0;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overflow: hidden;
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
}
.chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(20, 20, 21, .6); color: var(--snow-2); font: 500 .8125rem/1 var(--text); cursor: pointer; touch-action: manipulation;
}
.chip[aria-pressed="true"] { color: var(--brass); border-color: rgba(207, 174, 116, .5); }

/* Steps: three thin bars with names under them. */
.hud {
  position: absolute; z-index: 3; left: 0; right: 0;
  top: calc(64px + env(safe-area-inset-top));
  padding: 0 18px; pointer-events: none;
  transition: opacity .4s var(--ease);
}
.steps { list-style: none; margin: 0 auto; padding: 0; max-width: 520px; display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 8px; }
.step { display: flex; flex-direction: column-reverse; gap: 8px; color: #98989d; font: 500 .8125rem/1.1 var(--text); letter-spacing: .01em; transition: color .3s var(--ease); }
.step__bar { display: block; height: 3px; border-radius: 3px; background: rgba(245, 245, 247, .14); overflow: hidden; }
.step__bar i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: var(--snow); border-radius: 3px; transition: transform .18s linear, background .3s; }
.step.is-on { color: var(--snow); }
.step.is-done { color: var(--brass); }
.step.is-done .step__bar i { background: var(--brass); transform: scaleX(1); }
/* a step just finished: its bar and name give a short pop (no vibration) */
.step.just-done { animation: stepdone .7s var(--ease); }
.step.just-done .step__bar { animation: stepglow .7s var(--ease); }
@keyframes stepdone { 30% { transform: translateY(-3px) scale(1.06); } }
@keyframes stepglow { 30% { box-shadow: 0 0 14px 2px rgba(207, 174, 116, .8); } }

/* The big word that flashes when a step starts. */
.banner {
  position: absolute; z-index: 2; left: 0; right: 0; top: 24%;
  text-align: center; pointer-events: none;
  font: 700 clamp(2.6rem, 11vw, 5.5rem)/1 var(--display); letter-spacing: -0.035em;
  color: var(--snow); opacity: 0; transform: translateY(10px);
}
.banner.is-show { animation: banner 1.5s var(--ease) both; }
@keyframes banner { 0% { opacity: 0; transform: translateY(14px); } 18% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }

.foot {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-left)) calc(18px + env(safe-area-inset-bottom));
  pointer-events: none; transition: opacity .4s var(--ease);
}
.foot__mid { flex: 1; text-align: center; padding-bottom: 2px; }
.time { font: 700 2.25rem/1 var(--display); letter-spacing: -0.03em; }
.hint { margin-top: 8px; color: #c4c4c9; font-size: 1rem; line-height: 1.35; text-wrap: balance; min-height: 2.7em; }
.turn {
  pointer-events: auto; flex: none; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(245, 245, 247, .3);
  background: rgba(28, 28, 30, .78); color: var(--snow); cursor: pointer; touch-action: none;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.turn:active { background: rgba(60, 60, 62, .8); }
.turn.is-nudge { animation: nudge 1s var(--ease) 3; border-color: var(--brass); color: var(--brass); }
@keyframes nudge { 50% { transform: scale(1.14); } }

/* Start and end cards sit at the bottom so the car stays in view. */
.card {
  position: absolute; z-index: 4; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 28px)); transform: translateX(-50%);
  padding: 24px 22px 20px; border-radius: 26px; text-align: center;
  background: linear-gradient(165deg, rgba(34, 33, 31, .92) 0%, rgba(16, 16, 16, .94) 70%);
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.card[hidden] { display: none; }
.card h1, .card h2 { font-size: clamp(2rem, 8vw, 2.75rem); }
.card__sub { color: var(--snow-2); font-size: 1rem; line-height: 1.45; max-width: 30ch; }
.card .btn { margin-top: 6px; width: 100%; max-width: 300px; min-height: 52px; }
.card .btn:disabled { background: rgba(245, 245, 247, .16); color: var(--snow-2); cursor: default; }
.card .linkish { min-height: 44px; }
.card--done { animation: rise .6s var(--ease) both; }
.card--done h2 strong { color: var(--brass); }
.card--done .card__sub { color: var(--snow); font-size: 1.125rem; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 24px); } to { opacity: 1; transform: translate(-50%, 0); } }

.is-intro .hud, .is-intro .foot, .is-done .hud, .is-done .foot { opacity: 0; pointer-events: none; }
.is-intro .turn, .is-done .turn { pointer-events: none; }

/* The ring that follows the mouse or finger. */
.brush {
  position: absolute; z-index: 2; left: 0; top: 0; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  border: 1.5px solid rgba(245, 245, 247, .75); background: rgba(245, 245, 247, .07);
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.brush.is-on { opacity: 1; }
.is-intro .brush, .is-done .brush { display: none; }

.nojs { position: absolute; inset: auto 0 40% 0; text-align: center; }
.nojs a { color: var(--brass); }

@media (min-width: 800px) {
  .top { padding: 22px 32px 0; }
  .hud { top: 26px; }
  .steps { max-width: 560px; }
  .foot { padding: 0 32px 28px; }
  .card { bottom: 40px; }
}
/* A phone on its side: the cards move to the right so the car stays in view. */
@media (orientation: landscape) and (max-height: 500px) {
  .card { left: auto; right: max(16px, env(safe-area-inset-right)); transform: none; width: min(300px, 42%); }
  .card--done { animation: none; }
  .card__sub { font-size: .9375rem; }
  .foot { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .top { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
}
/* Short screens (a phone on its side). */
@media (max-height: 480px) {
  .hud { top: calc(12px + env(safe-area-inset-top)); padding: 0 150px; }
  .time { font-size: 1.5rem; }
  .hint { margin-top: 2px; min-height: 0; }
  .card { padding: 14px 18px; gap: 6px; bottom: 10px; }
  .card h1, .card h2 { font-size: 1.6rem; }
  .banner { top: 30%; font-size: 2.4rem; }
}
