/* ---- Uzi's Tel Aviv Run ------------------------------------------------- */

:root{
  --paper:    #fff7ec;
  --ink:      #2b1b12;
  --ink-soft: #8a705a;
  --sun:      #ffc44d;
  --amber:    #ff9a2e;
  --coral:    #ff6b4a;
  --berry:    #e0457b;
  --stroke:   rgba(120, 80, 40, .16);
}

@media (prefers-color-scheme: dark){
  :root{
    --paper:    #191013;
    --ink:      #fdf3e7;
    --ink-soft: #b79a83;
    --stroke:   rgba(255, 210, 160, .16);
  }
}

*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }

body{
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Avenir Next",
               system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;                 /* the game owns the screen */
  overscroll-behavior: none;
}

.wrap{
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px calc(8px + env(safe-area-inset-bottom));
}

/* ---- top bar ------------------------------------------------------------ */

.bar{
  width: min(430px, 100%);
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.name{
  margin: 0;
  text-align: center;
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 800;
  letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--amber), var(--coral), var(--berry));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.back, .snd{
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 154, 46, .14);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.back{ justify-self: start; }
.snd{ justify-self: end; font-size: 15px; padding: 6px 11px; }
.snd.off{ opacity: .45; }

.back:focus-visible, .snd:focus-visible, .go:focus-visible{
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

/* ---- stage -------------------------------------------------------------- */

.stage{
  position: relative;
  width: min(430px, 100%);
  flex: 1 1 auto;
  min-height: 0;                    /* lets it actually shrink inside the flex column */
  border-radius: 24px;
  overflow: hidden;
  background: #ffd8a8;
  box-shadow: 0 0 0 1px var(--stroke), 0 22px 50px -22px rgba(120, 66, 20, .5);
}

canvas{
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;               /* no scroll/zoom hijacking the flaps */
  user-select: none;
}

/* ---- hud ---------------------------------------------------------------- */

.hud{
  position: absolute;
  inset: 10px 12px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.score{
  font-size: clamp(38px, 11vw, 52px);
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 3px 0 rgba(120, 50, 10, .32), 0 0 18px rgba(255, 160, 60, .5);
  font-variant-numeric: tabular-nums;
}

.tallies{ display: flex; gap: 8px; }

.tally{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: #6b3f1a;
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ico{ font-size: 12px; }

/* ---- panels -------------------------------------------------------------- */

.panel{
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px;
  text-align: center;
  background: rgba(28, 14, 6, .48);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  color: #fff;
}

.panel.hidden{ display: none; }

.kicker{
  margin: 0;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .8;
}

.panel h2{
  margin: 0;
  font-size: clamp(22px, 6.5vw, 30px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  max-width: 15ch;
}

#finalScore{ font-size: clamp(52px, 16vw, 72px); line-height: 1; }

.how{
  margin: 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  opacity: .92;
  max-width: 30ch;
}

.breakdown{
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  opacity: .92;
}

.go{
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  margin-top: 6px;
  padding: 15px 42px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--sun) -10%, var(--amber) 50%, var(--coral) 108%);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.01em;
  text-shadow: 0 1.5px 0 rgba(150, 55, 20, .32);
  box-shadow: 0 14px 26px -12px rgba(255, 107, 74, .95);
  touch-action: manipulation;
}

.go:active{ transform: translateY(2px); }

.best{
  margin: 4px 0 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .05em;
  opacity: .78;
}

/* ---- footer -------------------------------------------------------------- */

.foot-note{
  flex: 0 0 auto;
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  opacity: .85;
}

.foot-note a{ color: inherit; }

.academy-line{ display: block; margin-top: 3px; }

.academy-line a{
  color: var(--berry);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1.5px solid rgba(224, 69, 123, .4);
}

/* On a short landscape phone the chrome eats the playfield — hide the extras. */
@media (max-height: 460px){
  .bar, .foot-note{ display: none; }
  .wrap{ padding: 4px; gap: 0; }
  .stage{ width: min(760px, 100%); border-radius: 16px; }
}
