@font-face {
  font-family: 'Fredoka';
  src: url('../assets/fonts/fredoka-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('../assets/fonts/fredoka-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --blue: #2f4ec4;
  --blue-dark: #1f2f7a;
  --red: #d23a3a;
  --purple: #6f36bd;
  --pink: #f28bb3;
  --gold: #f6cf5c;
  --ink: #1f2547;
  --card: rgba(255, 251, 245, 0.94);
  --shadow: 0 10px 30px rgba(31, 37, 71, 0.25);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  background: #f2e2d2;
  color: var(--ink);
  font-family: 'Fredoka', 'Arial Rounded MT Bold', Arial, sans-serif;
  font-weight: 500;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- screens */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 5vw;
  pointer-events: none;
}
.screen .card { pointer-events: auto; }
#boot, #pause { justify-content: center; background: rgba(31, 37, 71, 0.25); }
#gameover { background: linear-gradient(90deg, rgba(31, 37, 71, 0.22), rgba(31, 37, 71, 0) 60%); }
.card {
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 26px 32px;
  max-width: 470px;
  width: 100%;
  border: 4px solid #fff;
}
.card.center { text-align: center; }
.col { display: flex; flex-direction: column; gap: 14px; max-width: 520px; width: 100%; }
.col .card { max-width: none; }
.btnbar { display: flex; flex-wrap: wrap; gap: 10px; pointer-events: auto; }
.btnbar.center { justify-content: center; margin-top: 14px; }
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  color: var(--blue-dark);
  background: var(--card);
  border: 3px solid #fff;
  border-radius: 99px;
  padding: 10px 18px;
  box-shadow: 0 4px 14px rgba(31, 37, 71, 0.2);
  cursor: pointer;
  touch-action: manipulation;
}
.btn.big { background: var(--purple); color: #fff; font-size: 22px; padding: 11px 32px; }
.btn:active { transform: scale(0.95); }
.logo {
  font-weight: 700;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 0.95;
  color: var(--blue);
  text-shadow: 3px 3px 0 #fff, 6px 6px 0 rgba(111, 54, 189, 0.25);
}
.logo small {
  display: block;
  font-size: 0.5em;
  color: var(--red);
  transform: rotate(-4deg);
  transform-origin: left;
  margin-bottom: 4px;
}
.center .logo small { transform-origin: center; }
.tagline { font-size: 18px; margin: 12px 0 6px; }
.pulse { font-weight: 700; color: var(--purple); animation: pulse 1.2s ease-in-out infinite; }
.start { font-size: 20px; margin: 10px 0; }
.hint { font-size: 14px; opacity: 0.7; margin: 4px 0 0; }
@keyframes pulse { 50% { opacity: 0.45; transform: scale(0.98); } }
.best { font-size: 18px; margin-bottom: 8px; }
.best b { color: var(--red); }
h2 { margin: 0 0 6px; font-size: 42px; color: var(--blue); }
h3 { margin: 12px 0 6px; font-size: 16px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.6; }
.controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: 15px;
  text-align: left;
}
.controls dt {
  font-weight: 700;
  color: var(--blue-dark);
  background: #e9edfb;
  border-radius: 8px;
  padding: 1px 8px;
  white-space: nowrap;
}
.controls dd { margin: 0; align-self: center; }

.polaroid {
  position: fixed;
  right: 4vw;
  bottom: 5vh;
  width: clamp(120px, 14vw, 190px);
  margin: 0;
  background: #fff;
  padding: 10px 10px 8px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  transform: rotate(4deg);
  pointer-events: none;
}
.polaroid img { display: block; width: 100%; aspect-ratio: 435 / 1000; object-fit: cover; border-radius: 2px; }
.polaroid figcaption { text-align: center; font-size: 13px; margin-top: 6px; opacity: 0.75; }
.polaroid.small { position: static; transform: rotate(-3deg); width: clamp(110px, 12vw, 160px); }

#intro { justify-content: center; background: #10121c; padding: 0; }
#intro video { height: 100%; max-width: 100%; object-fit: contain; }
#intro .skip {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 15px;
}

.over-card { text-align: center; max-width: 430px; }
.over-card .sub { margin: 0 0 10px; }
.newbest {
  display: inline-block;
  background: var(--gold);
  color: #6a4a00;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 99px;
  margin-bottom: 10px;
  animation: pop 0.6s ease-out;
}
@keyframes pop { 0% { transform: scale(0.3); } 70% { transform: scale(1.15); } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.stats div { background: #eef1fb; border-radius: 14px; padding: 8px; }
.stats span { display: block; font-size: 13px; opacity: 0.65; }
.stats b { font-size: 26px; color: var(--blue); }
.rank { font-size: 20px; margin-bottom: 8px; }
.rank b { color: var(--purple); }

/* ---------------------------------------------------------------- shop */
svg.bi { width: 1.6em; height: 0.8em; vertical-align: -0.05em; margin-right: 3px; color: #c9a86a; }
svg.ei { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
.wallet-line { margin-left: 14px; white-space: nowrap; }
.wallet-line b { color: var(--blue); }
.wallet-line.big { display: block; margin: 8px 0 4px; font-size: 18px; }
.wallet-line .plus { color: #3f9a4f; font-weight: 700; margin-left: 4px; }
.nextrun { font-size: 14px; color: var(--purple); min-height: 0; }
.nextrun:empty { display: none; }
.btn.shopbtn { background: var(--gold); color: #5a3f00; }

#shop { justify-content: flex-start; }
.shop-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  padding: 18px 20px;
}
.shop-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shop-top h2 { margin: 0; font-size: 32px; }
.wallet {
  font-weight: 700;
  font-size: 22px;
  color: var(--blue);
  background: #fff6e2;
  border-radius: 99px;
  padding: 4px 14px;
  white-space: nowrap;
}
.tabs { display: flex; gap: 8px; margin: 12px 0 8px; }
.tab {
  flex: 1;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 3px solid #fff;
  background: #e9edfb;
  color: var(--blue-dark);
  cursor: pointer;
  touch-action: manipulation;
}
.tab.on { background: var(--blue); color: #fff; }
.shop-list {
  flex: 1;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 2px 4px 6px 0;
  min-height: 120px;
}
.shop-list .note { font-size: 13px; opacity: 0.7; margin: 2px 0 8px; }
.shop-list h4 { margin: 10px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.65; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(31, 37, 71, 0.08);
}
.item .ico { font-size: 30px; width: 40px; text-align: center; flex: none; }
.item .info { flex: 1; min-width: 0; }
.item .info b { display: block; font-size: 16px; }
.item .info small { display: block; font-size: 13px; opacity: 0.75; line-height: 1.25; }
.item .have { font-size: 13px; color: var(--purple); font-weight: 700; margin-top: 2px; }
.dots { display: flex; gap: 4px; margin-top: 5px; }
.dots i { width: 14px; height: 6px; border-radius: 3px; background: #dfe3ee; }
.dots i.on { background: var(--purple); }
.tag { font-weight: 700; color: #3f9a4f; padding: 0 8px; }
.btn.buy { background: #fff6e2; color: var(--blue-dark); padding: 8px 12px; font-size: 16px; white-space: nowrap; }
.btn.buy.small { padding: 4px 9px; font-size: 13px; border-width: 2px; }
.btn.buy.poor { opacity: 0.45; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: #fff;
  border: 3px solid #fff;
  border-radius: 16px;
  padding: 8px 4px 7px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(31, 37, 71, 0.08);
  touch-action: manipulation;
}
.tile .ico { font-size: 28px; line-height: 34px; height: 34px; }
.tile .ico.none { font-size: 20px; opacity: 0.5; }
.tile .ico.sw { display: flex; gap: 2px; align-items: center; }
.tile .ico.sw i { width: 14px; height: 26px; border-radius: 7px; display: block; }
.tile .nm { font-size: 13px; font-weight: 700; line-height: 1.15; }
.tile .st { font-size: 12px; opacity: 0.6; }
.tile .st.on { opacity: 1; color: #3f9a4f; font-weight: 700; }
.tile.on { border-color: #8fd18b; background: #f2fbf1; }
.tile.pv { border-color: var(--purple); background: #f4effd; }

/* ---------------------------------------------------------------- maps */
.dock { display: flex; flex-direction: column; gap: 12px; }
/* Character switch (Silvie / Max) on the title card. */
.herosel {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  pointer-events: auto;
  background: var(--card);
  border: 4px solid #fff;
  border-radius: 99px;
  padding: 5px 6px 5px 14px;
  box-shadow: var(--shadow);
}
.herosel .lbl { font-size: 14px; font-weight: 700; opacity: 0.6; margin-right: 2px; white-space: nowrap; }
.herosel .hero {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  color: var(--blue-dark);
  background: #e9edfb;
  border: 3px solid #fff;
  border-radius: 99px;
  padding: 4px 14px 4px 5px;
  cursor: pointer;
  touch-action: manipulation;
}
.herosel .hero.on { background: var(--purple); color: #fff; }
.herosel .hero:active { transform: scale(0.95); }
.herosel .av { width: 24px; height: 24px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 2px #fff; }
.note b { color: var(--purple); }
.mapsel {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  background: var(--card);
  border: 4px solid #fff;
  border-radius: 22px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  max-width: 470px;
}
.mapsel .arrow {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #e9edfb;
  color: var(--blue);
  font: 700 16px/1 Arial, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 3px 10px rgba(31, 37, 71, 0.15);
}
.mapsel .arrow:active { transform: scale(0.92); }
.mapinfo { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mapinfo .sw { display: flex; gap: 2px; flex: none; }
.mapinfo .sw i { width: 11px; height: 32px; border-radius: 6px; display: block; box-shadow: inset 0 0 0 1px rgba(31, 37, 71, 0.12); }
.mapinfo b { display: block; font-size: 20px; color: var(--blue-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapinfo small { display: block; font-size: 14px; opacity: 0.75; white-space: nowrap; }
#title.locked .mapinfo b { color: #8a7a5a; }
.btn.big.unlock { background: var(--gold); color: #5a3f00; font-size: 19px; padding: 11px 20px; }
.btn.big.poor { opacity: 0.6; }
.mapline { margin: -4px 0 10px; font-size: 15px; color: var(--purple); font-weight: 700; }
.mapline:empty { display: none; }
.item .ico.sw { display: flex; gap: 2px; justify-content: center; align-items: center; }
.item .ico.sw i { width: 10px; height: 30px; border-radius: 5px; display: block; box-shadow: inset 0 0 0 1px rgba(31, 37, 71, 0.12); }
.item.map.on { box-shadow: 0 0 0 3px #8fd18b, 0 2px 8px rgba(31, 37, 71, 0.08); }

.chance-card { max-width: 400px; }
.chance-card .price { color: var(--blue); white-space: nowrap; }
.countdown { height: 10px; background: #e2e5ee; border-radius: 5px; overflow: hidden; margin: 12px 0 4px; }
.countdown i { display: block; height: 100%; background: var(--purple); width: 100%; }
#chance { justify-content: center; background: rgba(31, 37, 71, 0.3); }
.power-bubble i { display: none; }

/* ---------------------------------------------------------------- HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  pointer-events: none;
}
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 8px; }
.hud-right { align-items: flex-end; }
.hud-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.powers { display: flex; gap: 8px; }
.hud-btn {
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--card);
  color: var(--blue);
  font: 700 15px/1 Arial, sans-serif;
  letter-spacing: -2px;
  box-shadow: 0 4px 14px rgba(31, 37, 71, 0.18);
  cursor: pointer;
  touch-action: manipulation;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 3px solid #fff;
  border-radius: 99px;
  padding: 4px 16px;
  box-shadow: 0 4px 14px rgba(31, 37, 71, 0.18);
  font-weight: 700;
  font-size: 20px;
}
.pill.score { font-size: 30px; color: var(--blue); }
.pill.bones svg { width: 30px; height: 15px; color: #c9b48a; }
.pill.hearts { padding: 4px 10px; gap: 4px; }
.pill.hearts svg { width: 24px; height: 22px; display: block; }
.pill.hearts .on { color: #f0567a; }
.pill.hearts .off { color: #d7d2dc; }
.pill.dist { font-size: 16px; }
.power {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 3px solid #fff;
  border-radius: 16px;
  padding: 4px 10px 8px;
  position: relative;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(31, 37, 71, 0.18);
}
.power svg { width: 22px; height: 22px; }
.power-magnet svg { color: #2b2733; }
.power-boots svg { color: #9aa3b5; }
.power-star svg { color: #e9b521; }
.power i { position: absolute; left: 10px; right: 10px; bottom: 4px; height: 4px; background: #e2e5ee; border-radius: 2px; }
.power i b { display: block; height: 100%; background: var(--purple); border-radius: 2px; }
#hud.hurt { animation: hurt 0.5s; }
@keyframes hurt { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

#toast {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translate(-50%, -10px);
  opacity: 0;
  background: var(--card);
  border: 3px solid #fff;
  border-radius: 99px;
  padding: 6px 20px;
  font-weight: 700;
  font-size: 20px;
  color: var(--purple);
  box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { color: var(--red); }
#bigText {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  font-weight: 700;
  font-size: clamp(60px, 11vw, 130px);
  color: var(--gold);
  -webkit-text-stroke: 4px var(--blue);
  text-shadow: 6px 6px 0 rgba(31, 37, 71, 0.25);
  pointer-events: none;
}
#bigText.show { animation: big 0.75s ease-out forwards; }
@keyframes big {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
}
#debug {
  position: fixed;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #9ff;
  font: 12px/1.4 Consolas, monospace;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
}

@media (max-width: 760px) {
  .screen { justify-content: center; }
  .polaroid { display: none; }
  .card { padding: 18px 20px; }
  .controls { font-size: 13px; }
}

/* Phones held upright: card at the top, Silvie in the middle, buttons at the bottom. */
@media (max-aspect-ratio: 4/5) {
  .screen {
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));
    align-items: stretch;
    justify-content: center;
  }
  #boot, #pause, #chance { align-items: center; }
  #title .col, #gameover .col { justify-content: space-between; max-width: none; }
  #gameover { background: linear-gradient(180deg, rgba(31, 37, 71, 0.22), rgba(31, 37, 71, 0) 55%); }
  .card { padding: 14px 18px; border-radius: 22px; border-width: 3px; }
  .logo { font-size: clamp(32px, 10.5vw, 50px); }
  .tagline { font-size: 15px; margin: 6px 0 2px; }
  .start { font-size: 16px; margin: 6px 0; }
  .best { font-size: 16px; margin-bottom: 2px; }
  h2 { font-size: 34px; }
  h3 { margin: 6px 0 4px; font-size: 13px; }
  .controls { font-size: 13px; gap: 3px 10px; }
  .btnbar { justify-content: center; }
  .btn { font-size: 15px; padding: 9px 15px; }
  .btn.big { font-size: 20px; padding: 11px 30px; }
  .over-card { text-align: center; }
  .stats { gap: 8px; }
  .stats b { font-size: 22px; }
  .rank { font-size: 17px; margin-bottom: 0; }
  .polaroid {
    display: block;
    width: 78px;
    right: 12px;
    bottom: calc(132px + env(safe-area-inset-bottom));
  }
  #title .polaroid { bottom: calc(206px + env(safe-area-inset-bottom));
    padding: 5px 5px 3px;
  }
  .polaroid figcaption { font-size: 8px; margin-top: 3px; }
  #hud { padding: calc(10px + env(safe-area-inset-top)) 10px 0; }
  .pill { font-size: 15px; padding: 3px 12px; border-width: 2px; }
  .pill.score { font-size: 22px; }
  .pill.hearts svg { width: 20px; height: 18px; }
  .hud-btn { width: 40px; height: 40px; font-size: 13px; }
  .power { padding: 3px 8px 7px; font-size: 13px; }
  .power svg { width: 18px; height: 18px; }
  #toast { top: calc(110px + env(safe-area-inset-top)); font-size: 17px; }
  /* Shop panel in the lower part, Silvie visible above it. */
  #shop { align-items: flex-end; }
  .shop-card { max-width: none; height: 60vh; max-height: none; padding: 12px 12px 10px; }
  .shop-top h2 { font-size: 24px; }
  .wallet { font-size: 18px; }
  .tabs { margin: 8px 0 6px; gap: 5px; }
  .tab { font-size: 13px; padding: 6px 2px; }
  .dock { gap: 10px; }
  .mapsel { max-width: none; padding: 6px 8px; border-width: 3px; border-radius: 20px; }
  /* Left, so the polaroid on the right does not cover it. */
  .herosel { align-self: flex-start; border-width: 3px; padding: 3px 4px; }
  .herosel .lbl { display: none; }
  .herosel .hero { font-size: 15px; padding: 3px 12px 3px 4px; }
  .herosel .av { width: 20px; height: 20px; }
  .mapsel .arrow { width: 40px; height: 40px; }
  .mapinfo b { font-size: 17px; }
  .mapinfo small { font-size: 13px; }
  .item { padding: 8px 10px; gap: 10px; }
  .item .ico { font-size: 26px; width: 32px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .wallet-line { display: block; margin: 2px 0 0; }
}

/* Phones held sideways (an iPhone home-screen app cannot lock the rotation): everything
   has to fit into ~330-430 px of height, and the notch sits on the left or right side. */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .screen {
    padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  #title, #gameover { justify-content: flex-start; }
  #title .col, #gameover .col { max-width: 430px; gap: 8px; }
  .card { padding: 10px 16px; border-radius: 18px; border-width: 3px; }
  .logo { font-size: 30px; }
  .tagline { font-size: 13px; margin: 4px 0 2px; }
  .start { font-size: 15px; margin: 4px 0; }
  .best { font-size: 14px; margin-bottom: 0; }
  .hint { font-size: 12px; }
  #title h3, #title .controls { display: none; }
  h2 { font-size: 28px; margin-bottom: 2px; }
  .controls { font-size: 13px; gap: 3px 10px; }
  .dock { gap: 8px; }
  .mapsel { padding: 4px 8px; border-width: 3px; border-radius: 18px; }
  .herosel { border-width: 3px; padding: 2px 3px 2px 10px; }
  .herosel .hero { font-size: 14px; padding: 2px 10px 2px 3px; }
  .herosel .av { width: 18px; height: 18px; }
  .mapsel .arrow { width: 34px; height: 34px; font-size: 13px; }
  .mapinfo .sw i { height: 24px; width: 9px; }
  .mapinfo b { font-size: 16px; }
  .mapinfo small { font-size: 12px; }
  .btnbar { gap: 6px; }
  .btnbar.center { margin-top: 8px; }
  .btn { font-size: 14px; padding: 7px 13px; border-width: 2px; }
  .btn.big, .btn.big.unlock { font-size: 17px; padding: 8px 22px; }
  .over-card .sub { margin-bottom: 4px; font-size: 14px; }
  .newbest { margin-bottom: 4px; padding: 2px 12px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 6px; }
  .stats div { padding: 4px; border-radius: 10px; }
  .stats span { font-size: 11px; }
  .stats b { font-size: 18px; }
  .rank { font-size: 15px; margin-bottom: 0; }
  .wallet-line.big { font-size: 15px; margin: 4px 0 0; }
  .polaroid {
    width: 74px;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    padding: 5px 5px 3px;
  }
  .polaroid figcaption { font-size: 8px; margin-top: 3px; }
  .shop-card { max-height: calc(100dvh - 16px); padding: 10px 14px; }
  .shop-top h2 { font-size: 24px; }
  .wallet { font-size: 17px; }
  .tabs { margin: 6px 0 4px; gap: 5px; }
  .tab { font-size: 13px; padding: 5px 4px; }
  .shop-list { min-height: 60px; }
  .item { padding: 6px 10px; margin-bottom: 6px; }
  #hud {
    padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0
      max(14px, env(safe-area-inset-left));
  }
  .pill { font-size: 15px; padding: 3px 12px; border-width: 2px; }
  .pill.score { font-size: 22px; }
  .pill.hearts svg { width: 20px; height: 18px; }
  .hud-btn { width: 40px; height: 40px; font-size: 13px; }
  .power { padding: 3px 8px 7px; font-size: 13px; }
  .power svg { width: 18px; height: 18px; }
  #toast { top: 64px; font-size: 16px; }
}
