/* ================================================================
   Мастер Нарезки 3D — UI
   Chunky toy-like design system: cream & ink palette, solid offset
   shadows, squash-on-press buttons, tilted stickers.
   ================================================================ */

@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('baloo2-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('baloo2-800.woff2') format('woff2');
}

:root {
  /* Neon dusk palette. The legacy variable names are kept so every rule that
     already referenced them re-themes for free; the values are what moved. */
  --ink: #f3ecff;
  --ink-2: #a99bc8;
  --paper: rgba(22, 13, 40, 0.9);
  --cream: rgba(164, 101, 255, 0.16);
  --coral: #ff2f9e;
  --coral-deep: #a8106a;
  --sun: #ffb02e;
  --sun-deep: #c47400;
  --mint: #3df2b6;
  --mint-deep: #16a37a;
  --sky-1: #22e8ff;
  --sky-2: #0a8fb5;
  --gold: #ffd23f;
  --shadow: rgba(0, 0, 0, 0.5);

  --panel-2: rgba(32, 19, 56, 0.92);
  --cyan: #22e8ff;
  --pink: #ff2f9e;
  --violet: #a465ff;
  --violet-deep: #5f2ab5;
  --night: #0a0616;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  background: #150d28;
  font-family: 'Baloo 2', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
}

img, svg, canvas { -webkit-user-drag: none; user-select: none; }
button, [role="button"] { touch-action: manipulation; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* soft photographic vignette over the 3D scene */
#vignette {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 6, 22, 0.62) 0%, rgba(10, 6, 22, 0.16) 30%, rgba(10, 6, 22, 0) 48%),
    linear-gradient(0deg, rgba(10, 6, 22, 0.6) 0%, rgba(10, 6, 22, 0) 28%);
}

/* ------------------------------ layers ------------------------------ */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l));
  z-index: 10;
}

.overlay { background: rgba(8, 4, 18, 0.62); align-items: center; justify-content: center; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(12px + var(--safe-t))
    calc(14px + var(--safe-r))
    calc(12px + var(--safe-b))
    calc(14px + var(--safe-l));
  background: rgba(8, 4, 18, 0.7);
  animation: fadeIn 0.18s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } }

/* ------------------------------ topbar ------------------------------ */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 4px 15px 4px 10px;
  background: var(--paper);
  border: 1.5px solid rgba(164, 101, 255, 0.5);
  border-radius: 999px;
  font-weight: 800;
  font-size: 19px;
  color: var(--ink);
  box-shadow: 0 0 18px rgba(164, 101, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chip .ic { width: 24px; height: 24px; flex: none; }

.coin-chip.bump { animation: bump 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.18) rotate(-2deg); }
  100% { transform: scale(1); }
}

.coin-chip {
  border-color: rgba(255, 176, 46, 0.55);
  box-shadow: 0 0 18px rgba(255, 176, 46, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.coin-chip .coinCount { text-shadow: 0 0 12px rgba(255, 176, 46, 0.7); }

.lvl-chip {
  color: var(--ink-2);
  letter-spacing: 0.06em;
  border-color: rgba(34, 232, 255, 0.5);
  box-shadow: 0 0 18px rgba(34, 232, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.lvl-chip span { color: var(--cyan); margin-left: 5px; text-shadow: 0 0 12px rgba(34, 232, 255, 0.8); }

/* -------------------------- icon buttons ---------------------------- */

.icon-btn {
  width: 48px;
  height: 48px;
  border: 1.5px solid rgba(255, 47, 158, 0.55);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--shadow), 0 0 18px rgba(255, 47, 158, 0.3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s;
  flex: none;
}
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn:hover { background: #2b1a4b; transform: translateY(-1px); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.icon-btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.leaderboard-open {
  color: #fff;
  border-color: rgba(164, 101, 255, 0.75);
  background: linear-gradient(180deg, rgba(122, 60, 255, 0.55), rgba(164, 101, 255, 0.25));
  box-shadow: 0 4px 0 var(--shadow), 0 0 22px rgba(164, 101, 255, 0.5);
}
.leaderboard-open:hover { background: linear-gradient(180deg, rgba(146, 88, 255, 0.7), rgba(164, 101, 255, 0.35)); }

/* ------------------------------ buttons ----------------------------- */

.btn {
  position: relative;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px) scale(0.99); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn:disabled { filter: saturate(0.2) brightness(0.65); cursor: default; }

.play-btn {
  flex-direction: column;
  gap: 0;
  width: min(78vw, 330px);
  min-height: 84px;
  padding: 10px 20px 14px;
  border-radius: 24px;
  background: linear-gradient(135deg, #ff2f9e 0%, #ff5c6e 48%, #ffb02e 100%);
  box-shadow:
    0 7px 0 var(--coral-deep),
    0 0 34px rgba(255, 47, 158, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: breathe 2.4s ease-in-out infinite;
}
.play-btn:active { box-shadow: 0 2px 0 var(--coral-deep), 0 0 22px rgba(255, 47, 158, 0.5); animation: none; }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
.play-main {
  font-size: clamp(26px, 7.5vw, 34px);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(60, 4, 34, 0.5);
}
.play-sub {
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 800;
  letter-spacing: 0.14em;
  opacity: 0.92;
}
.play-btn.slim { min-height: 64px; width: min(70vw, 280px); animation: none; }

.shop-btn {
  gap: 10px;
  width: min(78vw, 330px);
  min-height: 58px;
  border-radius: 20px;
  background: linear-gradient(135deg, #7a3cff 0%, #a465ff 55%, #22e8ff 130%);
  box-shadow:
    0 6px 0 var(--violet-deep),
    0 0 26px rgba(164, 101, 255, 0.45),
    inset 0 2px 0 rgba(255, 255, 255, 0.22);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.shop-btn:active { box-shadow: 0 2px 0 var(--violet-deep), 0 0 18px rgba(164, 101, 255, 0.4); }
.shop-btn .ic { width: 24px; height: 24px; }

/* ---- rewarded: giant blade ---- */

.giant-btn {
  gap: 0;
  width: min(78vw, 330px);
  min-height: 74px;
  padding: 10px 16px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(10, 143, 181, 0.55) 0%, rgba(34, 232, 255, 0.22) 100%);
  border: 2px solid var(--cyan);
  box-shadow: 0 5px 0 rgba(6, 60, 78, 0.9), 0 0 24px rgba(34, 232, 255, 0.4), inset 0 0 18px rgba(34, 232, 255, 0.2);
  color: var(--ink);
  text-align: center;
  overflow: hidden;
  transform: none;
}
.giant-btn:active { box-shadow: 0 1px 0 rgba(6, 60, 78, 0.9), 0 0 18px rgba(34, 232, 255, 0.4); }
.giant-btn.armed {
  background: linear-gradient(135deg, rgba(22, 163, 122, 0.55) 0%, rgba(61, 242, 182, 0.25) 100%);
  border-color: var(--mint);
  box-shadow: 0 5px 0 rgba(8, 74, 55, 0.9), 0 0 26px rgba(61, 242, 182, 0.5), inset 0 0 18px rgba(61, 242, 182, 0.2);
  color: var(--ink);
}
.giant-text {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
}
.giant-text span,
.giant-text small {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.giant-text span { font-size: clamp(15px, 3.2vw, 20px); font-weight: 800; line-height: 1.05; letter-spacing: 0.03em; }
.giant-text small { margin-top: 4px; font-size: clamp(10px, 2vw, 13px); font-weight: 600; line-height: 1.12; letter-spacing: 0.02em; opacity: 0.8; }

.ad-tag {
  flex: none;
  min-width: 34px;
  padding: 3px 7px;
  border-radius: 9px;
  background: var(--cyan);
  color: #06212b;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  box-shadow: 0 0 14px rgba(34, 232, 255, 0.8);
}

/* ------------------------------- menu ------------------------------- */

#menu { justify-content: space-between; }

.menu-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: max(4vh, 12px);
}

.logo { display: flex; flex-direction: column; align-items: center; transform: rotate(-2.5deg); }
.logo-top {
  font-size: clamp(15px, 4.4vw, 24px);
  font-weight: 800;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(34, 232, 255, 0.95), 0 0 30px rgba(34, 232, 255, 0.55);
}
.logo-top em {
  font-style: normal;
  color: var(--cyan);
}
.logo-main {
  font-size: clamp(34px, 14.5vw, 66px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 0.98;
  background: linear-gradient(180deg, #fff 0%, #ffd8f0 34%, #ff2f9e 72%, #ffb02e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 47, 158, 0.75)) drop-shadow(0 4px 0 rgba(60, 4, 34, 0.75));
}
.logo-ribbon {
  margin-top: 5px;
  padding: 3px 22px 5px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--pink) 100%);
  color: #fff;
  font-size: clamp(14px, 4vw, 20px);
  font-weight: 800;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  border-radius: 6px;
  transform: skewX(-9deg) rotate(-1deg);
  box-shadow: 0 0 22px rgba(255, 47, 158, 0.6);
}
.logo-ribbon em { color: #fff; font-style: normal; }

.best-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 16px;
  background: var(--paper);
  border: 1.5px solid rgba(255, 210, 63, 0.5);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  box-shadow: 0 0 18px rgba(255, 210, 63, 0.22);
  transform: rotate(1.5deg);
}
.best-pill .ic { width: 20px; height: 20px; }
.best-pill span { color: var(--gold); text-shadow: 0 0 10px rgba(255, 210, 63, 0.8); }

.menu-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: max(3vh, 14px);
}

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

#hud { z-index: 5; }

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px auto 0;
  width: min(74vw, 420px);
}
.progress-track {
  position: relative;
  flex: 1;
  height: 12px;
  background: rgba(12, 7, 26, 0.75);
  border: 1.5px solid rgba(164, 101, 255, 0.45);
  border-radius: 999px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
}
#progressFill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--violet) 55%, var(--pink) 100%);
  box-shadow: 0 0 14px rgba(255, 47, 158, 0.75);
  transition: width 0.15s linear;
}
#progressMark {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 34px;
  height: 17px;
  transform: translate(-50%, -58%) rotate(-8deg);
  transition: left 0.15s linear;
  filter: drop-shadow(0 0 6px rgba(34, 232, 255, 0.95));
}
.flag { width: 26px; height: 26px; flex: none; filter: drop-shadow(0 0 6px rgba(255, 47, 158, 0.8)); }

#combo {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(30px, 9vw, 46px);
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #ffffff 0%, #ffe14d 45%, #ff7a29 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 176, 46, 0.9)) drop-shadow(0 3px 0 rgba(40, 10, 4, 0.6));
  pointer-events: none;
}
#combo.pop { animation: comboPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes comboPop {
  0% { transform: translateX(-50%) scale(0.3) rotate(-8deg); opacity: 0; }
  25% { transform: translateX(-50%) scale(1.15) rotate(2deg); opacity: 1; }
  55% { transform: translateX(-50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translateX(-50%) scale(0.9) translateY(-26px); opacity: 0; }
}

#tapHint {
  position: absolute;
  bottom: calc(16% + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  background: var(--paper);
  border: 1.5px solid rgba(34, 232, 255, 0.6);
  border-radius: 999px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ink);
  box-shadow: 0 0 24px rgba(34, 232, 255, 0.35);
  animation: hintFloat 1.4s ease-in-out infinite;
  pointer-events: none;
  max-width: calc(100vw - 28px - var(--safe-l) - var(--safe-r));
  justify-content: center;
  text-align: center;
  white-space: normal;
}
@keyframes hintFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}
.tap-ring {
  flex: none;
  width: 18px;
  height: 18px;
  border: 4px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(34, 232, 255, 0.9);
  animation: ringPulse 1.4s ease-out infinite;
}
@keyframes ringPulse {
  0% { transform: scale(0.7); opacity: 1; }
  70% { transform: scale(1.25); opacity: 0.4; }
  100% { transform: scale(0.7); opacity: 1; }
}

/* ------------------------------ cards ------------------------------- */

.card {
  position: relative;
  width: min(88vw, 380px);
  max-width: 100%;
  min-width: 0;
  max-height: calc(100vh - 24px - var(--safe-t) - var(--safe-b));
  max-height: calc(100dvh - 24px - var(--safe-t) - var(--safe-b));
  background: linear-gradient(180deg, rgba(38, 22, 66, 0.96) 0%, rgba(18, 10, 34, 0.96) 100%);
  border: 2px solid rgba(164, 101, 255, 0.6);
  border-radius: 26px;
  padding: 26px 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 44px rgba(164, 101, 255, 0.35), 0 18px 40px rgba(0, 0, 0, 0.6);
  animation: cardPop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  text-align: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(164, 101, 255, 0.5) transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
}
@keyframes cardPop {
  0% { transform: scale(0.7) rotate(-2deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.card h2 { font-size: 27px; font-weight: 800; letter-spacing: 0.07em; color: #fff; text-shadow: 0 0 16px rgba(164, 101, 255, 0.8); }
.res-complete {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--mint);
  text-shadow: 0 0 12px rgba(61, 242, 182, 0.8);
}

.mult-stamp {
  margin: 10px 0 6px;
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  padding: 8px 26px 12px;
  border-radius: 20px;
  transform: rotate(-3deg);
  text-shadow: 0 2px 0 rgba(50, 4, 30, 0.5);
  box-shadow: 0 0 34px rgba(255, 47, 158, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: stampIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}
@keyframes stampIn {
  0% { transform: scale(2.4) rotate(12deg); opacity: 0; }
  100% { transform: scale(1) rotate(-3deg); opacity: 1; }
}

.best-badge {
  position: static;
  inset: auto;
  align-self: center;
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 4px;
  padding: 6px 14px 8px;
  background: linear-gradient(135deg, var(--sun), var(--gold));
  color: #3a2200;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.1em;
  white-space: nowrap;
  border-radius: 999px;
  transform: none;
  box-shadow: 0 0 22px rgba(255, 210, 63, 0.8);
  animation: bump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.res-rows { width: 100%; margin: 8px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.res-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 14px;
  background: rgba(10, 6, 22, 0.6);
  border: 1px solid rgba(164, 101, 255, 0.22);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-2);
}
.res-row b { font-size: 20px; font-weight: 800; color: #fff; }
.res-row .gold { color: var(--gold); text-shadow: 0 0 12px rgba(255, 210, 63, 0.7); }
.res-row.total { background: rgba(164, 101, 255, 0.18); border-color: rgba(164, 101, 255, 0.55); }
.res-row.total b { font-size: 24px; color: var(--cyan); text-shadow: 0 0 14px rgba(34, 232, 255, 0.8); }

.trophy { width: 74px; height: 74px; margin-bottom: 4px; filter: drop-shadow(0 0 14px rgba(255, 210, 63, 0.8)); }
.finale-text { font-size: 16px; font-weight: 600; color: var(--ink-2); line-height: 1.45; margin: 6px 0 14px; }

/* ------------------------------- shop ------------------------------- */

.sheet {
  width: min(100%, 430px);
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 40px - var(--safe-t) - var(--safe-b));
  max-height: calc(100dvh - 24px - var(--safe-t) - var(--safe-b));
  background: linear-gradient(180deg, rgba(34, 20, 60, 0.97) 0%, rgba(16, 9, 30, 0.97) 100%);
  border: 2px solid rgba(164, 101, 255, 0.55);
  border-radius: 26px;
  padding: 16px 14px calc(16px + var(--safe-b) / 2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 46px rgba(164, 101, 255, 0.3), 0 18px 40px rgba(0, 0, 0, 0.6);
  animation: cardPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  overflow: hidden;
}

#shop .sheet {
  width: min(100%, 680px);
  container-type: inline-size;
}

.sheet-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sheet-head h2 {
  flex: 1;
  min-width: 0;
  font-size: clamp(19px, 5vw, 24px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
  padding-left: 4px;
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 47, 158, 0.7);
}
.sheet-head .chip { min-height: 36px; font-size: 16px; }

.coins-ad-btn {
  gap: 10px;
  min-width: 0;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ff8a1e 0%, var(--gold) 100%);
  box-shadow: 0 5px 0 var(--sun-deep), 0 0 26px rgba(255, 176, 46, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  color: #3a2200;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transform: rotate(-0.6deg);
}
.coins-ad-btn:active { box-shadow: 0 1px 0 var(--sun-deep), 0 0 18px rgba(255, 176, 46, 0.45); }
.coins-ad-btn .ad-tag { background: #3a2200; color: var(--gold); box-shadow: none; }
/* the gold coin needs a dark rim to survive the gold button behind it */
.coins-ad-btn .ic circle:first-child { fill: #3a2200; }
.coins-ad-label { min-width: 0; line-height: 1.05; }
.coins-amount { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 20px; }
.coins-amount .ic { width: 22px; height: 22px; }

.skin-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 2px 6px;
  overscroll-behavior: contain;
  scrollbar-color: rgba(164, 101, 255, 0.5) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.skin-grid::-webkit-scrollbar,
.leaderboard-list::-webkit-scrollbar,
.card::-webkit-scrollbar { width: 6px; height: 0; }
.skin-grid::-webkit-scrollbar-track,
.leaderboard-list::-webkit-scrollbar-track,
.card::-webkit-scrollbar-track { background: transparent; }
.skin-grid::-webkit-scrollbar-thumb,
.leaderboard-list::-webkit-scrollbar-thumb,
.card::-webkit-scrollbar-thumb { background: rgba(164, 101, 255, 0.5); border-radius: 999px; }
.skin-grid::-webkit-scrollbar-button,
.leaderboard-list::-webkit-scrollbar-button,
.card::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

@container (max-width: 380px) {
  .skin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

@container (min-width: 560px) {
  .skin-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.skin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  gap: 6px;
  width: 100%;
  height: auto;
  min-width: 0;
  max-width: 100%;
  padding: 8px 6px 10px;
  border: 2px solid rgba(164, 101, 255, 0.25);
  border-radius: 18px;
  background: rgba(10, 6, 22, 0.75);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--shadow);
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s;
}
.skin-card > * { flex: 0 0 auto; }
.skin-card:hover { transform: translateY(-2px); border-color: rgba(164, 101, 255, 0.7); }
.skin-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.skin-card:focus-visible { outline: 3px solid var(--cyan); outline-offset: 1px; }
.skin-card.equipped { border-color: var(--mint); box-shadow: 0 3px 0 var(--shadow), 0 0 22px rgba(61, 242, 182, 0.45); }
.skin-card.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-2deg); }
  40% { transform: translateX(6px) rotate(2deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.skin-thumb {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 34%, rgba(164, 101, 255, 0.4) 0%, rgba(12, 7, 26, 0.9) 74%);
  object-fit: cover;
}
.skin-name {
  width: 100%;
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.skin-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(255, 176, 46, 0.16);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
  max-width: 100%;
}
.skin-price .ic { width: 16px; height: 16px; }

.skin-state {
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(164, 101, 255, 0.2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  max-width: 100%;
}
.skin-state.on { background: var(--mint); color: #04291d; box-shadow: 0 0 14px rgba(61, 242, 182, 0.75); }

/* --------------------------- leaderboard ---------------------------- */

.leaderboard-sheet { width: min(100%, 480px); min-width: 0; }
.leaderboard-note { margin-top: -8px; color: var(--ink-2); font-size: 15px; font-weight: 700; }
.leaderboard-status {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}
.leaderboard-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  max-height: min(52vh, 430px);
  overflow-y: auto;
  padding: 2px 4px 8px;
  list-style: none;
  counter-reset: none;
  overscroll-behavior: contain;
  scrollbar-color: rgba(164, 101, 255, 0.5) transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 12px;
  border-radius: 14px;
  background: rgba(10, 6, 22, 0.72);
  border: 1px solid rgba(164, 101, 255, 0.3);
  box-shadow: 0 3px 0 var(--shadow);
}
.leaderboard-row.is-player {
  background: rgba(255, 176, 46, 0.16);
  border-color: var(--sun);
  box-shadow: 0 3px 0 var(--shadow), 0 0 20px rgba(255, 176, 46, 0.45);
}
.leaderboard-rank { font-size: 18px; font-weight: 800; color: var(--ink-2); text-align: center; }
.leaderboard-player { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 800; }
.leaderboard-score { color: var(--cyan); font-size: 18px; font-weight: 800; text-shadow: 0 0 12px rgba(34, 232, 255, 0.7); }
.auth-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(164, 101, 255, 0.14);
  border: 1px solid rgba(164, 101, 255, 0.35);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.auth-btn {
  min-height: 50px;
  padding: 8px 16px;
  border-radius: 15px;
  background: linear-gradient(135deg, #ff8a1e, var(--gold));
  box-shadow: 0 5px 0 var(--sun-deep), 0 0 24px rgba(255, 176, 46, 0.45);
  color: #3a2200;
  font-size: 16px;
  font-weight: 800;
}

/* ----------------------------- settings ----------------------------- */

.small-sheet { width: min(90vw, 340px); }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: 0 3px 0 var(--shadow);
}
.set-label { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
.set-label .ic { width: 24px; height: 24px; color: var(--ink-2); }

.toggle {
  position: relative;
  width: 62px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: #cdd3de;
  cursor: pointer;
  transition: background 0.18s;
  flex: none;
}
.toggle i {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(38, 49, 74, 0.3);
  transition: left 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toggle.on { background: var(--mint); }
.toggle.on i { left: 32px; }
.toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------------------------- test-ad sim --------------------------- */

.ad-sheet { align-items: center; text-align: center; gap: 8px; padding: 24px 20px; }
.ad-sheet p { font-size: 15px; font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.ad-count {
  width: 74px;
  height: 74px;
  margin-top: 8px;
  border-radius: 50%;
  background: rgba(10, 6, 22, 0.8);
  border: 2px solid var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 26px rgba(34, 232, 255, 0.5);
  text-shadow: 0 0 14px rgba(34, 232, 255, 0.9);
  font-size: 40px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ------------------------------ pause ------------------------------- */

#pauseOverlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 4, 18, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pause-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-shadow: 0 0 20px rgba(34, 232, 255, 0.85);
}
.pause-card svg { width: 62px; height: 62px; filter: drop-shadow(0 0 14px rgba(34, 232, 255, 0.8)); }

/* ------------------------------ toast ------------------------------- */

#toast {
  position: fixed;
  bottom: calc(9% + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  max-width: 86vw;
  padding: 11px 22px;
  background: var(--panel-2);
  border: 1.5px solid rgba(34, 232, 255, 0.6);
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border-radius: 999px;
  box-shadow: 0 0 28px rgba(34, 232, 255, 0.35), 0 10px 24px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  text-align: center;
  pointer-events: none;
}
@keyframes toastIn {
  0% { transform: translateX(-50%) translateY(24px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}
#toast.out { transition: opacity 0.3s, transform 0.3s; opacity: 0; transform: translateX(-50%) translateY(12px); }

/* ----------------------------- loading ------------------------------ */

#loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background:
    radial-gradient(120% 62% at 62% 68%, rgba(255, 154, 77, 0.55) 0%, rgba(255, 47, 126, 0.28) 28%, rgba(0, 0, 0, 0) 62%),
    linear-gradient(180deg, #090620 0%, #2c1668 44%, #7a2585 72%, #e8446f 88%, #ff9a4d 100%);
  transition: opacity 0.4s ease;
  overflow: hidden;
}
#loading.done { opacity: 0; pointer-events: none; }

/* a neon grid running to the horizon, drawn purely with gradients */
#loading::after {
  content: '';
  position: absolute;
  left: -25%;
  right: -25%;
  bottom: 0;
  height: 34%;
  background:
    repeating-linear-gradient(90deg, rgba(34, 232, 255, 0.5) 0 2px, rgba(0, 0, 0, 0) 2px 42px),
    repeating-linear-gradient(0deg, rgba(255, 47, 158, 0.45) 0 2px, rgba(0, 0, 0, 0) 2px 30px);
  transform: perspective(220px) rotateX(72deg);
  transform-origin: bottom center;
  opacity: 0.75;
  pointer-events: none;
}

.load-logo { display: flex; flex-direction: column; align-items: center; transform: rotate(-2deg); z-index: 1; }

.load-knife { width: 88px; height: 40px; z-index: 1; animation: knifeFlip 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite; }
.load-knife svg { width: 100%; height: 100%; filter: drop-shadow(0 0 10px rgba(34, 232, 255, 0.9)); }
@keyframes knifeFlip {
  0% { transform: rotate(0deg) translateY(0); }
  35% { transform: rotate(-180deg) translateY(-16px); }
  70% { transform: rotate(-360deg) translateY(0); }
  100% { transform: rotate(-360deg) translateY(0); }
}

.load-bar {
  width: min(60vw, 260px);
  height: 14px;
  border-radius: 999px;
  background: rgba(10, 6, 22, 0.6);
  border: 1.5px solid rgba(34, 232, 255, 0.45);
  overflow: hidden;
  z-index: 1;
}
.load-bar i {
  display: block;
  height: 100%;
  width: 45%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  box-shadow: 0 0 16px rgba(255, 47, 158, 0.8);
  animation: barSlide 1.15s ease-in-out infinite alternate;
}
@keyframes barSlide {
  0% { transform: translateX(-30%); }
  100% { transform: translateX(160%); }
}

.load-text {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
  color: rgba(243, 236, 255, 0.85);
  z-index: 1;
}

/* --------------------------- wide screens --------------------------- */

@media (min-aspect-ratio: 7/5) {
  .menu-center { margin-top: 2vh; }
  .menu-bottom {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
  }
  .menu-bottom .btn { width: clamp(168px, 27vw, 230px); min-width: 0; }
  .play-btn { order: 2; }
  .giant-btn { order: 1; }
  .shop-btn { order: 3; }
}

@media (pointer: coarse) {
  .btn, .icon-btn, .skin-card { min-height: 48px; }
  #tapHint { min-height: 56px; }
}

@media (max-height: 540px) and (min-aspect-ratio: 7/5) {
  .screen { padding-top: calc(6px + var(--safe-t)); padding-bottom: calc(8px + var(--safe-b)); }
  .modal {
    padding:
      calc(6px + var(--safe-t))
      calc(8px + var(--safe-r))
      calc(6px + var(--safe-b))
      calc(8px + var(--safe-l));
  }
  .chip { min-height: 34px; font-size: 16px; }
  .icon-btn { width: 42px; height: 42px; border-radius: 13px; }
  .menu-center { gap: 8px; margin-top: 0; }
  .logo-top { font-size: clamp(13px, 2.6vw, 18px); }
  .logo-main { font-size: clamp(28px, 7.6vw, 50px); }
  .logo-ribbon { font-size: clamp(13px, 2.8vw, 18px); }
  .best-pill { padding: 3px 12px; font-size: 14px; }
  .menu-bottom { gap: 8px; padding-bottom: 0; }
  .menu-bottom .btn { width: clamp(144px, 27vw, 205px); }
  #menu .menu-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    width: min(100%, 720px);
    align-self: center;
    align-items: center;
    gap: 8px;
  }
  #menu .menu-bottom .btn { width: 100%; min-width: 0; }
  .play-btn { min-height: 62px; padding: 7px 16px 10px; border-radius: 19px; }
  .play-main { font-size: clamp(21px, 4.6vw, 28px); }
  .giant-btn, .shop-btn { min-height: 54px; border-radius: 17px; }
  #menu .giant-btn {
    align-self: center;
    min-height: 58px;
    height: auto;
    gap: 0;
    padding: 6px 10px;
    overflow: hidden;
    transform: none;
  }
  #menu .giant-text {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    align-items: center;
    text-align: center;
    line-height: 1;
  }
  #menu .giant-text > span,
  #menu .giant-text > small {
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }
  #menu .giant-text > span { font-size: clamp(12px, 2.5vw, 14px); letter-spacing: 0.02em; }
  #menu .giant-text > small { font-size: clamp(8px, 1.65vw, 10px); line-height: 1.05; }
  #menu .shop-btn { gap: 5px; padding-inline: 6px; font-size: clamp(12px, 2.5vw, 16px); }
  #menu .shop-btn .ic { width: 20px; height: 20px; }
  #menu .shop-btn span { min-width: 0; overflow-wrap: anywhere; }
  .sheet {
    max-height: calc(100dvh - 12px - var(--safe-t) - var(--safe-b));
    padding: 10px 12px;
    gap: 8px;
    border-radius: 20px;
  }
  #shop .sheet { width: min(100%, 760px); }
  #shop .sheet-head h2 { font-size: 20px; }
  #shop .coins-ad-btn { min-height: 46px; padding-block: 6px; font-size: 15px; }
  #shop .skin-grid { gap: 8px; }
  #shop .skin-card { gap: 4px; padding: 6px 4px 8px; }
  #shop .skin-thumb {
    height: clamp(58px, 20vh, 84px);
    aspect-ratio: auto;
    object-fit: contain;
  }
  #shop .skin-name,
  #shop .skin-price,
  #shop .skin-state { font-size: 12px; }

  .card {
    width: min(86vw, 520px);
    max-height: calc(100dvh - 14px - var(--safe-t) - var(--safe-b));
    padding: 12px 16px;
    gap: 3px;
    border-radius: 20px;
  }
  .card h2 { font-size: 21px; }
  .res-complete { font-size: 12px; }
  .mult-stamp { margin: 3px 0; padding: 4px 18px 7px; border-radius: 15px; font-size: 36px; }
  .res-rows {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 4px 0 7px;
  }
  .res-row {
    min-width: 0;
    min-height: 48px;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 5px 7px;
    font-size: 13px;
  }
  .res-row b,
  .res-row.total b { font-size: 19px; }
  .results-card .best-badge {
    margin-bottom: 1px;
    padding: 3px 10px 5px;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.06em;
    box-shadow: 0 3px 0 var(--sun-deep);
  }
  .results-card .play-btn.slim { width: min(60vw, 240px); min-height: 50px; padding: 6px 14px 9px; }
  .trophy { width: 48px; height: 48px; }
  .finale-text { margin: 3px 0 7px; font-size: 13px; line-height: 1.28; }

  .leaderboard-sheet { width: min(100%, 680px); }
  .leaderboard-note { display: none; }
  .leaderboard-status { flex: 1 1 auto; min-height: 60px; padding: 8px; font-size: 14px; }
  .leaderboard-list { max-height: none; gap: 5px; }
  .leaderboard-row { min-height: 42px; padding: 5px 9px; }
  .auth-block {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    font-size: 12px;
    text-align: left;
  }
  .auth-btn { min-height: 42px; padding: 6px 12px; font-size: 14px; }
}

@media (max-width: 380px) {
  .screen { padding-left: calc(10px + var(--safe-l)); padding-right: calc(10px + var(--safe-r)); }
  .menu-center { gap: 12px; }
  .menu-bottom { gap: 10px; }
  .giant-btn, .play-btn, .shop-btn { width: min(88vw, 330px); }
  .giant-btn { padding-left: 12px; padding-right: 12px; }
  .giant-text span { font-size: 17px; }
  .giant-text small { font-size: 11px; }
  #tapHint { max-width: calc(100vw - 24px); padding: 9px 14px; font-size: 15px; }
  #shop .sheet {
    padding: 12px 10px calc(12px + var(--safe-b) / 2);
    gap: 10px;
  }
  #shop .sheet-head { gap: 6px; }
  #shop .sheet-head h2 {
    font-size: clamp(18px, 6vw, 22px);
    line-height: 1;
    letter-spacing: 0.03em;
    padding-left: 2px;
  }
  #shop .sheet-head .chip { gap: 4px; padding-inline: 8px; font-size: 14px; }
  #shop .sheet-head .chip .ic { width: 20px; height: 20px; }
  #shop .sheet-head .icon-btn { width: 42px; height: 42px; }
  #shop .coins-ad-btn {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    padding-inline: 8px;
    font-size: 15px;
    letter-spacing: 0.02em;
  }
  #shop .coins-ad-btn .ad-tag { padding-inline: 5px; font-size: 11px; letter-spacing: 0.08em; }
  #shop .coins-ad-label { overflow-wrap: anywhere; }
  #shop .coins-amount { gap: 3px; font-size: 16px; }
  #shop .coins-amount .ic { width: 18px; height: 18px; }
}

/* Desktop/tablet shop gets a definite flex height. Mobile and compact
   landscape override it below with their own layouts. */
@media (min-width: 481px) and (min-height: 541px) {
  #shop .sheet {
    height: min(88vh, 820px);
    height: min(calc(100dvh - 24px - var(--safe-t) - var(--safe-b)), 820px);
  }

  #shop .skin-grid { flex: 1 1 0; }
}

/* Stable iOS/WebKit shop: definite thumbnail sizes prevent grid rows from
   collapsing while the list is the only vertically scrolling element. */
@media (max-width: 480px) {
  #shop .sheet {
    height: calc(100vh - 24px - var(--safe-t) - var(--safe-b));
    height: calc(100dvh - 24px - var(--safe-t) - var(--safe-b));
    max-height: calc(100dvh - 24px - var(--safe-t) - var(--safe-b));
  }

  #shop .sheet-head,
  #shop .coins-ad-btn { flex: 0 0 auto; }

  #shop .skin-grid {
    flex: 1 1 0;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: row;
    grid-auto-rows: max-content;
    align-content: start;
    align-items: start;
    gap: 10px;
  }

  #shop .skin-card {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 4px;
    align-items: center;
    align-self: start;
    width: 100%;
    height: auto;
    min-height: 108px;
    padding: 8px 10px;
    -webkit-appearance: none;
    appearance: none;
  }

  #shop .skin-thumb {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: block;
    width: 84px;
    height: 84px;
    min-width: 84px;
    max-width: none;
    aspect-ratio: auto;
    object-fit: contain;
    align-self: center;
  }

  #shop .skin-name {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    text-align: left;
    font-size: 15px;
    line-height: 1.08;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }

  #shop .skin-price,
  #shop .skin-state {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    align-self: start;
    max-width: 100%;
  }
}

@media (max-height: 540px) and (min-aspect-ratio: 7/5) {
  #shop .sheet {
    height: calc(100vh - 12px - var(--safe-t) - var(--safe-b));
    height: calc(100dvh - 12px - var(--safe-t) - var(--safe-b));
  }

  #shop .skin-grid {
    flex: 1 1 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-rows: max-content;
    align-content: start;
    align-items: start;
    gap: 8px;
  }

  #shop .skin-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 9px;
    row-gap: 2px;
    align-items: center;
    align-self: start;
    width: 100%;
    height: auto;
    min-height: 82px;
    padding: 6px 8px;
    -webkit-appearance: none;
    appearance: none;
  }

  #shop .skin-thumb {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: block;
    width: 64px;
    height: 64px;
    min-width: 64px;
    max-width: none;
    aspect-ratio: auto;
    object-fit: contain;
  }

  #shop .skin-name {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    text-align: left;
    font-size: 12px;
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }

  #shop .skin-price,
  #shop .skin-state {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    align-self: start;
    max-width: 100%;
    font-size: 11px;
  }
}

@media (max-height: 540px) and (min-aspect-ratio: 7/5) and (min-width: 720px) {
  #shop .skin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
