* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Phone-shaped column; fills the screen on mobile, centred on desktop */
#stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #f3a21f;
}

@media (min-width: 481px) {
  #stage { box-shadow: 0 0 80px rgba(0, 0, 0, 0.6); }
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 0;
  pointer-events: none;
}

.chip {
  display: flex;
  flex-direction: column;
  min-height: 46px;
  padding: 6px 12px 7px;
  border-radius: 12px;
  background: rgba(45, 16, 2, 0.55);
  line-height: 1;
}

.chip.right {
  margin-left: auto;
  align-items: flex-end;
}

.label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffd98a;
}

.value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.value.small {
  margin-top: 8px;
  font-size: 15px;
}

.pill {
  position: relative;
  overflow: hidden;
  padding: 4px 11px 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #e3141b;
  font-size: 16px;
  font-weight: 900;
  font-style: italic;
}

.pill.bump { animation: bump 0.35s ease-out; }

@keyframes bump {
  from { transform: scale(1.45); }
  to { transform: scale(1); }
}

/* Drains while the grit holds its size; empty means it sheds a level */
#multBar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #ffd54a;
  transform-origin: left center;
  visibility: hidden;
}

.icon-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: rgba(45, 16, 2, 0.55);
  cursor: pointer;
}

.icon-btn span {
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: #fff;
}

/* ---------- Layer banner ---------- */

.banner {
  position: absolute;
  left: 50%;
  top: 17%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.banner small {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #fff3d6;
  text-shadow: 0 1px 2px rgba(80, 30, 0, 0.7);
}

.banner span {
  display: block;
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  white-space: nowrap;
  text-shadow: 0 3px 0 #9b1b1e;
}

.banner.show { animation: banner 2s ease-out forwards; }

@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.9); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -80%); }
}

/* ---------- Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 26px) 22px calc(env(safe-area-inset-bottom) + 26px);
  text-align: center;
}

.screen.dim { background: rgba(30, 10, 0, 0.6); }

.spacer {
  flex: 1;
  min-height: 12px;
}

.title-screen {
  background: linear-gradient(rgba(70, 22, 0, 0.5), rgba(70, 22, 0, 0) 42%, rgba(70, 22, 0, 0) 58%, rgba(70, 22, 0, 0.6));
}

/* Stand-in wordmark until we get the real logo files */
.osk {
  font-size: 32px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #e3141b;
  text-shadow:
    -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff,
    0 -2px 0 #fff, 0 2px 0 #fff, -2px 0 0 #fff, 2px 0 0 #fff,
    3px 4px 0 #1a1a1a;
}

.osk.small {
  font-size: 18px;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 2px 2px 0 #1a1a1a;
}

h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 14px;
  line-height: 1;
}

.title-small {
  margin-right: -0.32em;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #8a2c00;
}

.title-big {
  font-size: 104px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow: 0 6px 0 #9b1b1e, 0 12px 24px rgba(0, 0, 0, 0.3);
}

.tagline {
  max-width: 290px;
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff6e0;
  text-shadow: 0 1px 2px rgba(80, 30, 0, 0.6);
}

.howto {
  list-style: none;
  display: grid;
  gap: 9px;
  width: 100%;
  max-width: 330px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(40, 14, 2, 0.6);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.howto li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ico {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  font-size: 20px;
  font-style: normal;
  font-weight: 900;
  color: #ffd54a;
}

.ico-speck::before,
.ico-big::before {
  content: "";
  display: block;
  border-radius: 50%;
  background: #5e3f28;
  border: 2px solid #fff;
}

.ico-speck::before { width: 10px; height: 10px; }
.ico-big::before { width: 22px; height: 22px; border-color: #e3141b; }

.btn {
  appearance: none;
  padding: 14px 44px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #e3141b;
  color: #fff;
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 5px 0 #8a1014, 0 10px 24px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #8a1014, 0 6px 14px rgba(0, 0, 0, 0.3);
}

.best {
  min-height: 16px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffe4ad;
}

/* ---------- Game over ---------- */

.card {
  width: 100%;
  max-width: 320px;
  margin-bottom: 22px;
  padding: 22px 20px 18px;
  border-top: 8px solid #e3141b;
  border-radius: 22px;
  background: #fff8ec;
  color: #2b1406;
  box-shadow: 0 6px 0 #c9781b, 0 18px 40px rgba(0, 0, 0, 0.35);
}

.caught {
  font-size: 44px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
  color: #e3141b;
}

.quip {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #6b4a33;
}

.final-label,
.final-row span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a0714a;
}

.final-label { margin-top: 16px; }

.final-score {
  font-size: 54px;
  font-weight: 900;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.new-best {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #ffd54a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.final-row {
  display: flex;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f0dcc0;
}

.final-row div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.final-row b {
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 12px;
  font-weight: 700;
  color: #6b4a33;
}

.paused-title {
  margin-bottom: 22px;
  font-size: 44px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  text-shadow: 0 4px 0 #9b1b1e;
}

/* Shorter phones */
@media (max-height: 700px) {
  .title-big { font-size: 80px; }
  .tagline { font-size: 14px; }
  .howto { gap: 7px; margin-bottom: 14px; padding: 11px 14px; font-size: 13px; }
  .card { padding: 18px 18px 14px; }
  .final-score { font-size: 44px; }
}
