:root {
  color-scheme: dark;
  --ink: #1b0f0a;
  --paper: #fff7e8;
  --bun: #f3a72f;
  --tomato: #d82919;
  --pickle: #63b341;
  --sky: #67d7ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 12%, #6b2a14 0, #28140c 38%, #090504 100%);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", Arial, sans-serif;
  letter-spacing: 0;
  touch-action: none;
  user-select: none;
}

button {
  font: inherit;
}

.game-shell {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: clamp(8px, 2vw, 18px);
}

.stage {
  position: relative;
  width: min(100vw, 520px);
  height: min(100svh, 860px);
  overflow: hidden;
  border: 1px solid rgba(255, 247, 232, 0.25);
  border-radius: 8px;
  background: #1b0f0a;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.58), 0 0 42px rgba(243, 167, 47, 0.22);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 44px 44px;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.hud > div,
.icon-button {
  min-height: 44px;
  border: 1px solid rgba(255, 247, 232, 0.28);
  border-radius: 6px;
  background: rgba(27, 15, 10, 0.72);
  color: var(--paper);
  text-shadow: 0 2px 0 #000;
  backdrop-filter: blur(8px);
}

.hud > div {
  display: grid;
  align-content: center;
  padding: 6px 10px;
}

.hud-label {
  color: #ffd36b;
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.hud strong {
  font-size: clamp(19px, 4vw, 25px);
  line-height: 1;
}

.icon-button {
  pointer-events: auto;
  cursor: pointer;
  font-size: 20px;
}

.menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 18px 30px;
  color: var(--paper);
  background:
    linear-gradient(180deg, rgba(27, 15, 10, 0.05), rgba(27, 15, 10, 0.62) 44%, rgba(27, 15, 10, 0.96)),
    repeating-linear-gradient(-18deg, rgba(243, 167, 47, 0.08) 0 2px, transparent 2px 13px);
  text-shadow: 0 3px 0 #000, 0 0 20px rgba(216, 41, 25, 0.48);
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.hidden {
  display: none;
}

.kicker {
  width: fit-content;
  margin: 0;
  padding: 5px 9px;
  border: 2px solid var(--bun);
  border-radius: 999px;
  color: #ffd36b;
  font-size: 15px;
  transform: rotate(-4deg);
}

h1,
h2 {
  max-width: 12ch;
  margin: 0;
  color: #ffd36b;
  font-size: clamp(50px, 15vw, 86px);
  line-height: 0.86;
  text-transform: uppercase;
  transform: skew(-8deg) rotate(-2deg);
}

h2 {
  max-width: 11ch;
  color: var(--paper);
  font-size: clamp(44px, 13vw, 72px);
}

.subtitle,
.hint {
  max-width: 35rem;
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
  text-shadow: 0 2px 0 #000;
}

.hint {
  color: rgba(255, 247, 232, 0.72);
  font-size: 12px;
}

.primary-button {
  width: min(100%, 280px);
  min-height: 54px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, #d82919, #ffd36b 54%, #63b341);
  color: #1b0f0a;
  cursor: pointer;
  font-size: 26px;
  text-transform: uppercase;
  box-shadow: 0 8px 0 #7d170f, 0 0 26px rgba(243, 167, 47, 0.52);
}

.primary-button:disabled {
  cursor: wait;
  filter: grayscale(0.45) brightness(0.82);
  opacity: 0.78;
  box-shadow: 0 5px 0 #5b3521;
}

.primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 #7d170f, 0 0 20px rgba(243, 167, 47, 0.48);
}

.secondary-button {
  width: min(100%, 280px);
  min-height: 46px;
  border: 1px solid rgba(255, 247, 232, 0.36);
  border-radius: 6px;
  background: rgba(27, 15, 10, 0.76);
  color: var(--paper);
  cursor: pointer;
  font-size: 22px;
  text-transform: uppercase;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.42);
}

.secondary-button:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.42);
}

.shop-open-button,
.progress-open-button,
.multiplayer-button,
.online-button {
  min-height: 44px;
  color: #ffd36b;
  font-size: 18px;
  font-family: Arial, sans-serif;
  font-weight: 900;
  text-shadow: none;
}

.progress-open-button {
  color: #fff7e8;
}

.multiplayer-button {
  color: #67d7ff;
}

.online-button {
  color: #63ff9c;
}

.shop-menu,
.progress-menu,
.online-menu {
  align-items: center;
}

.shop-menu h2,
.progress-menu h2,
.online-menu h2 {
  max-width: min(100%, 430px);
  font-size: clamp(40px, 11vw, 68px);
  text-align: center;
}

.online-panel {
  width: min(100%, 360px);
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 247, 232, 0.28);
  border-radius: 8px;
  background: rgba(27, 15, 10, 0.8);
  font-family: Arial, sans-serif;
  text-shadow: none;
  backdrop-filter: blur(8px);
}

.online-code-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 247, 232, 0.76);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.online-code-line strong {
  color: #63ff9c;
  font-size: 34px;
  letter-spacing: 2px;
}

.online-input {
  width: 100%;
  height: 52px;
  border: 2px solid rgba(255, 211, 107, 0.58);
  border-radius: 6px;
  background: rgba(255, 247, 232, 0.96);
  color: #1b0f0a;
  font: 900 26px Arial, sans-serif;
  text-align: center;
  text-transform: uppercase;
}

.online-action {
  width: 100%;
}

.preload-panel {
  width: min(100%, 280px);
  font-family: Arial, sans-serif;
  text-shadow: none;
}

.preload-bar {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 247, 232, 0.34);
  border-radius: 999px;
  background: rgba(27, 15, 10, 0.72);
}

.preload-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d82919, #ffd36b, #63b341);
  transition: width 180ms ease;
}

.preload-panel p {
  margin: 6px 0 0;
  color: rgba(255, 247, 232, 0.78);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.shop-panel {
  width: min(100%, 390px);
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(255, 247, 232, 0.28);
  border-radius: 8px;
  background: rgba(27, 15, 10, 0.78);
  color: var(--paper);
  font-family: Arial, sans-serif;
  text-shadow: none;
  backdrop-filter: blur(8px);
}

.shop-panel-full {
  width: min(100%, 440px);
}

.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #ffd36b;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.shop-head strong {
  color: var(--paper);
  white-space: nowrap;
}

.shop-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.shop-tab {
  min-height: 32px;
  border: 1px solid rgba(255, 247, 232, 0.22);
  border-radius: 6px;
  background: rgba(255, 247, 232, 0.08);
  color: rgba(255, 247, 232, 0.78);
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.shop-tab.active {
  border-color: #ffd36b;
  background: rgba(255, 211, 107, 0.2);
  color: #ffd36b;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(360px, 42svh);
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.shop-grid.hidden {
  display: none;
}

.shop-panel-full .shop-grid {
  max-height: min(560px, 58svh);
}

.shop-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 82px;
  padding: 7px;
  border: 1px solid rgba(255, 247, 232, 0.2);
  border-radius: 8px;
  background: rgba(255, 247, 232, 0.07);
}

.shop-card.selected {
  border-color: #ffd36b;
  background: rgba(255, 211, 107, 0.16);
}

.shop-card.locked {
  opacity: 0.92;
}

.shop-card.premium {
  border-color: rgba(103, 215, 255, 0.54);
  background: linear-gradient(135deg, rgba(103, 215, 255, 0.12), rgba(255, 211, 107, 0.1));
}

.shop-preview {
  width: 62px;
  height: 62px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.skin-preview {
  width: 62px;
  height: 62px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.upgrade-card {
  grid-template-columns: 54px minmax(0, 1fr);
}

.upgrade-icon {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.shop-title {
  overflow-wrap: anywhere;
  color: var(--paper);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.shop-price {
  margin-top: 3px;
  color: rgba(255, 247, 232, 0.74);
  font-size: 11px;
  font-weight: 800;
}

.shop-button {
  width: 100%;
  min-height: 30px;
  margin-top: 6px;
  border: 1px solid rgba(255, 247, 232, 0.32);
  border-radius: 6px;
  background: rgba(255, 211, 107, 0.18);
  color: var(--paper);
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.shop-button:disabled {
  cursor: default;
  opacity: 0.66;
}

.progress-panel {
  width: min(100%, 440px);
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(255, 247, 232, 0.28);
  border-radius: 8px;
  background: rgba(27, 15, 10, 0.78);
  color: var(--paper);
  font-family: Arial, sans-serif;
  text-shadow: none;
  backdrop-filter: blur(8px);
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #ffd36b;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.progress-list {
  display: grid;
  gap: 8px;
}

.progress-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 247, 232, 0.2);
  border-radius: 8px;
  background: rgba(255, 247, 232, 0.07);
}

.progress-card.done {
  border-color: #ffd36b;
  background: rgba(255, 211, 107, 0.16);
}

.achievement-card {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
}

.daily-card {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
}

.daily-icon {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.daily-info {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.achievement-icon {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.achievement-info {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.progress-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--paper);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.progress-meta {
  color: rgba(255, 247, 232, 0.74);
  font-size: 11px;
  font-weight: 800;
}

.achievement-rarity {
  color: #67d7ff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d82919, #ffd36b, #63b341);
}

.leaderboard-panel {
  width: min(100%, 360px);
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(255, 247, 232, 0.28);
  border-radius: 8px;
  background: rgba(27, 15, 10, 0.74);
  color: var(--paper);
  font-family: Arial, sans-serif;
  text-shadow: none;
  backdrop-filter: blur(8px);
}

.leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: #ffd36b;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.leaderboard-subhead {
  margin: 7px 0 4px;
  color: rgba(255, 211, 107, 0.92);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-button {
  min-height: 28px;
  border: 1px solid rgba(255, 247, 232, 0.35);
  border-radius: 6px;
  background: rgba(255, 211, 107, 0.16);
  color: var(--paper);
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.leaderboard-list {
  display: grid;
  gap: 4px;
  max-height: min(150px, 22svh);
  margin: 0;
  padding-left: 22px;
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.leaderboard-list li {
  padding-right: 4px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.leaderboard-row em {
  display: inline-block;
  margin-left: 3px;
  color: #ffd36b;
  font-style: normal;
}

.leaderboard-score {
  color: #ffd36b;
}

.leaderboard-note {
  margin: 8px 0 0;
  color: rgba(255, 247, 232, 0.74);
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 420px) {
  .hud {
    grid-template-columns: 1fr 1fr 44px 44px;
  }

  .hud > div:nth-child(3) {
    display: none;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }
}
