:root {
  --theme-bg: linear-gradient(180deg, #e7f6ff 0%, #f4fbff 100%);
  --theme-accent: #2b9cd8;
  --shelf-bg: rgba(255, 255, 255, 0.78);
  --shelf-border: #b7dff5;
  --ledge-bg: linear-gradient(180deg, #cfeafa 0%, #9acde9 100%);
  --ink: #2c2a32;
  --muted: #6e6a77;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at top, #dce7f3 0%, #c8d6e5 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  max-height: 860px;
  display: flex;
  flex-direction: column;
  background: var(--theme-bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 22px 50px rgba(25, 39, 58, 0.22);
}

@media (min-width: 500px) {
  .app-shell {
    height: min(94dvh, 840px);
    border-radius: 28px;
    border: 4px solid rgba(255, 255, 255, 0.72);
  }
}

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 22px;
  text-align: center;
  background: linear-gradient(180deg, #fff7eb 0%, #eaf6ff 55%, #f7f0ff 100%);
  animation: popIn 220ms ease;
}

.start-badge {
  background: rgba(255, 255, 255, 0.88);
  border: 1.5px solid rgba(43, 156, 216, 0.25);
  color: #1971c2;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(25, 113, 194, 0.1);
  margin-bottom: 18px;
}

.start-showcase {
  display: flex;
  gap: 10px;
  padding: 12px 16px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid #d5e7f7;
  box-shadow: 0 10px 24px rgba(34, 48, 66, 0.08), inset 0 -8px 0 #cfe4f5;
  margin-bottom: 20px;
}

.showcase-tile {
  width: 54px;
  height: 54px;
  border-radius: 13px;
  background: #fff;
  border: 1.5px solid #e6edf5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.06);
  animation: floatBob 2.4s ease-in-out var(--d, 0s) infinite;
}

.start-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--ink);
}

.start-subtitle {
  margin: 8px 0 22px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}

.start-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.start-stat {
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  padding: 10px 6px;
  box-shadow: 0 4px 12px rgba(25, 39, 58, 0.06);
}

.start-stat span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.start-stat strong {
  font-size: 14px;
  color: var(--ink);
}

.start-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.start-play-btn {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  background: linear-gradient(135deg, #2b9cd8 0%, #1c7ed6 100%);
  box-shadow: 0 10px 22px rgba(28, 126, 214, 0.3);
}

.start-sub-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.start-sub-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.86);
  border: 1.5px solid rgba(0, 0, 0, 0.07);
}

.start-footnote {
  margin: 16px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.win-stars {
  font-size: 28px;
  letter-spacing: 6px;
  margin-bottom: 6px;
  line-height: 1.1;
}

.level-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.level-stars {
  font-size: 12px;
  letter-spacing: 1px;
  color: #f59f00;
}

@keyframes floatBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
  gap: 8px;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-btn,
.pill-badge,
.icon-btn {
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(34, 48, 66, 0.08);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pill-badge {
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.pill-btn:active,
.icon-btn:active,
.booster-btn:active {
  transform: scale(0.95);
}

.elite-tag {
  background: #ffece6;
  color: #d9480f;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
}

.hardcore-btn {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.hardcore-btn--active {
  background: linear-gradient(135deg, #e03131 0%, #c92a2a 100%);
  border-color: #ffa8a8;
  color: #fff;
  box-shadow: 0 3px 10px rgba(201, 42, 42, 0.35);
}

.hud-sub {
  padding: 2px 16px 8px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.progress-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.combo-pill {
  background: linear-gradient(135deg, #ff922b 0%, #e8590c 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(232, 89, 12, 0.28);
  animation: popIn 180ms ease;
}

.combo-pill--fever {
  background: linear-gradient(135deg, #f03e3e 0%, #ae3ec9 100%);
  box-shadow: 0 0 12px rgba(240, 62, 62, 0.45);
  animation: hintPulse 0.6s infinite alternate;
}

.theme-label {
  font-weight: 700;
  color: var(--theme-accent);
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--theme-accent);
  transition: width 260ms ease;
}

.live-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 11.5px;
  color: var(--muted);
}

.live-hud-bar strong {
  color: var(--ink);
  font-weight: 800;
}

.live-hud-bar em {
  font-style: normal;
  font-size: 10.5px;
  color: #d9480f;
}

.rush-order-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff4e6 0%, #fff9db 100%);
  border: 1.5px solid #ffd8a8;
  font-size: 11.5px;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(245, 159, 0, 0.12);
  animation: popIn 180ms ease;
}

.rush-order-bar--urgent {
  border-color: #ff8787;
  background: linear-gradient(135deg, #fff5f5 0%, #ffe3e3 100%);
  animation: hintPulse 0.65s infinite alternate;
}

.rush-order-tag {
  background: #f76707;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.rush-order-target {
  font-weight: 800;
  color: #d9480f;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rush-order-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.rush-order-meta em {
  font-style: normal;
  font-weight: 700;
  color: #e8590c;
}

.rush-order-meta strong {
  color: #e67700;
  font-weight: 900;
}

.item-tile--rush::after {
  content: '🛵';
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 10px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.fever-magnet-btn {
  width: 100%;
  margin-top: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1.5px solid #f06595;
  background: linear-gradient(135deg, #f03e3e 0%, #ae3ec9 100%);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(174, 62, 201, 0.35);
  animation: hintPulse 0.55s infinite alternate;
}

.app-shell--fever {
  box-shadow: 0 22px 50px rgba(174, 62, 201, 0.35), inset 0 0 0 2.5px rgba(240, 62, 62, 0.55);
}

.level-tip {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  padding: 5px 10px;
  border-radius: 10px;
}

.board-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.toast-slot {
  min-height: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast-slot:not(:empty) {
  margin-top: 6px;
}

.toast-pill {
  background: rgba(34, 34, 42, 0.92);
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
  animation: popIn 180ms ease;
}

.toast-pill--combo {
  background: linear-gradient(135deg, #f59f00 0%, #e8590c 100%);
}

.shelves-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 10px;
}

.shelf-card {
  position: relative;
  border-radius: 14px;
  background: var(--shelf-bg);
  border: 1.5px solid var(--shelf-border);
  padding: 8px 7px 14px;
  box-shadow: inset 0 6px 12px rgba(28, 42, 58, 0.06), 0 4px 10px rgba(28, 42, 58, 0.05);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  user-select: none;
}

.shelf-card::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 0;
  height: 9px;
  border-radius: 0 0 11px 11px;
  background: var(--ledge-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.shelf-card--valid {
  border-color: #2fb344;
  box-shadow: 0 0 0 2px rgba(47, 179, 68, 0.28), inset 0 6px 12px rgba(47, 179, 68, 0.08);
}

.shelf-card--pack-ready {
  border-color: #f59f00;
  background: linear-gradient(180deg, rgba(255, 249, 219, 0.96) 0%, rgba(255, 243, 191, 0.88) 100%);
  box-shadow: 0 0 0 3px rgba(245, 159, 0, 0.45), 0 8px 18px rgba(245, 159, 0, 0.22);
  animation: hintPulse 0.75s infinite alternate;
}

.pack-ready-tag {
  position: absolute;
  top: -8px;
  left: 8px;
  z-index: 5;
  background: linear-gradient(135deg, #fcc419 0%, #f08c00 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(240, 140, 0, 0.35);
}

.pack-burst {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pack-float {
  background: linear-gradient(135deg, #fcc419 0%, #e8590c 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 18px rgba(232, 89, 12, 0.38);
  animation: floatUpFade 860ms cubic-bezier(0.18, 0.88, 0.22, 1) forwards;
  white-space: nowrap;
}

.pack-float--combo {
  background: linear-gradient(135deg, #ff922b 0%, #d9480f 100%);
  font-size: 14px;
  box-shadow: 0 8px 22px rgba(217, 72, 15, 0.45);
}

.pack-float--fever {
  background: linear-gradient(135deg, #f03e3e 0%, #ae3ec9 100%);
  font-size: 14.5px;
  box-shadow: 0 0 20px rgba(240, 62, 62, 0.65);
}

.pack-shockwave {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #fcc419;
  animation: shockwaveRing 540ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pack-spark {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--spark-color, #fcc419);
  box-shadow: 0 0 6px var(--spark-color, #fcc419);
  animation: sparkBurst 620ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes shockwaveRing {
  0% { opacity: 0.95; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(3.4); }
}

.app-shell--bump {
  animation: boardBump 240ms ease;
}

.shelf-card--hint-dst {
  border-color: #f59f00;
  box-shadow: 0 0 0 3px rgba(245, 159, 0, 0.4);
  animation: hintPulse 1s infinite alternate;
}

.shelf-card--shake {
  animation: shelfShake 260ms ease;
}

.shelf-card--packed {
  animation: packFlash 380ms ease;
}

.shelf-card--revealed .front-row {
  animation: slideForward 260ms ease;
}

.shelf-card--locked {
  border-color: rgba(110, 106, 119, 0.45);
  background: rgba(226, 232, 240, 0.65);
}

.shelf-card--locked .front-row,
.shelf-card--locked .back-peek-row {
  filter: grayscale(0.65) brightness(0.88);
  opacity: 0.55;
  pointer-events: none;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lock-pill {
  background: rgba(38, 38, 48, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.depth-badge {
  position: absolute;
  top: -7px;
  right: 8px;
  z-index: 4;
  background: #3d3948;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.shelf-card--chute {
  border-color: #74c0fc;
  background: linear-gradient(90deg, rgba(227, 242, 253, 0.72) 0%, var(--shelf-bg) 55%);
}

.shelf-card--strict {
  border-color: #f783ac;
}

.shelf-rule-badges {
  position: absolute;
  top: -8px;
  left: 8px;
  z-index: 4;
  display: inline-flex;
  gap: 4px;
}

.rule-badge {
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.rule-badge--chute {
  background: linear-gradient(135deg, #1c7ed6 0%, #1864ab 100%);
}

.rule-badge--strict {
  background: linear-gradient(135deg, #d6336c 0%, #a61e4d 100%);
}

.item-tile--blocked {
  opacity: 1;
  background: linear-gradient(180deg, #f1f3f5 0%, #e9ecef 100%);
  border-color: #ced4da;
  cursor: not-allowed;
}

.item-tile--blocked .item-emoji,
.item-tile--blocked .item-name {
  opacity: 0.58;
  filter: grayscale(0.35);
}

.item-tile--blocked::before {
  content: '🔒';
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 9.5px;
  line-height: 1;
  opacity: 0.9;
}

.shelf-stage {
  position: relative;
  min-height: 62px;
}

.back-peek-row {
  position: absolute;
  inset: 0 0 auto 0;
  height: 54px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  transform: translateY(-5px) scale(0.95);
  opacity: 0.34;
  filter: brightness(0.46) saturate(0.7);
  pointer-events: none;
  z-index: 1;
}

.front-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  min-height: 60px;
}

.item-tile {
  border-radius: 9px;
  border: 1.5px solid var(--item-border);
  background: var(--item-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  min-height: 60px;
  position: relative;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
  transition: transform 140ms ease, box-shadow 140ms ease;
  cursor: pointer;
}

.item-tile--wide {
  grid-column: span 2;
}

.item-tile--mystery {
  background: linear-gradient(135deg, #4c465f 0%, #2f2b3d 100%);
  border-color: #706889;
  color: #f3f0ff;
}

.item-tile--selected {
  transform: translateY(-7px) scale(1.05);
  box-shadow: 0 0 0 2.5px #f59f00, 0 10px 16px rgba(245, 159, 0, 0.28);
  z-index: 5;
}

.item-tile--match {
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px rgba(245, 159, 0, 0.55), 0 4px 10px rgba(245, 159, 0, 0.16);
}

.item-tile--landed {
  animation: tileLand 240ms cubic-bezier(0.22, 1.35, 0.36, 1);
}

.item-tile--hint-src {
  box-shadow: 0 0 0 2.5px #f59f00;
  animation: hintPulse 0.9s infinite alternate;
}

.item-emoji {
  font-size: 21px;
  line-height: 1.05;
}

.item-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--item-accent);
  line-height: 1.15;
  margin-top: 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.wide-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 9px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--item-accent);
}

.empty-slot {
  min-height: 60px;
  border-radius: 9px;
  border: 1.5px dashed rgba(95, 110, 130, 0.26);
  background: rgba(255, 255, 255, 0.28);
}

.empty-slot--locked {
  border-style: solid;
  border-color: rgba(120, 120, 135, 0.2);
  background: rgba(120, 120, 135, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  opacity: 0.65;
}

.temp-tray-wrap {
  background: rgba(255, 255, 255, 0.68);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 8px 10px 10px;
  animation: popIn 200ms ease;
}

.temp-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--muted);
}

.temp-cap-badge {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.auto-complete-btn {
  margin: 0 12px 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #fcc419 0%, #f08c00 100%);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(240, 140, 0, 0.32);
  animation: hintPulse 0.8s infinite alternate;
}

.deadlock-banner {
  margin: 0 12px 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff3bf;
  border: 1.5px solid #ffd43b;
  color: #7c4d00;
  font-size: 12px;
  text-align: center;
  animation: popIn 200ms ease;
}

.booster-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
}

.booster-btn {
  position: relative;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  border-radius: 14px;
  padding: 8px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 3px 8px rgba(34, 48, 66, 0.07);
}

.booster-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.booster-btn--pulse {
  border-color: #f59f00;
  animation: hintPulse 0.85s infinite alternate;
}

.booster-icon {
  font-size: 18px;
  line-height: 1.1;
}

.booster-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}

.booster-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--theme-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.booster-badge--ad {
  background: #e8590c;
}

.booster-badge--coin {
  background: linear-gradient(135deg, #f59f00 0%, #d9480f 100%);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(22, 26, 36, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  backdrop-filter: blur(3px);
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.24);
  animation: popIn 180ms ease;
}

.modal-center {
  text-align: center;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal-head h2,
.modal-center h2 {
  margin: 0;
  font-size: 18px;
}

.modal-desc {
  margin: 6px 0 14px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.level-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.level-item {
  width: 100%;
  border: 1.5px solid #e7e9ef;
  background: #f9fafc;
  border-radius: 13px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.level-item--active {
  border-color: var(--theme-accent);
  background: #f0f8ff;
}

.level-item-title {
  font-size: 13.5px;
  font-weight: 700;
}

.level-item-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.win-emoji {
  font-size: 46px;
  margin-bottom: 4px;
}

.win-records {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.win-record-pill {
  background: linear-gradient(135deg, #fff3bf 0%, #ffe066 100%);
  border: 1.5px solid #fcc419;
  color: #ad5700;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  animation: popIn 200ms ease;
}

.win-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.win-stats--four {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.rank-summary-banner {
  background: linear-gradient(135deg, #fff8e6 0%, #eef7ff 100%);
  border: 1.5px solid #dbe9f6;
  border-radius: 13px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--ink);
  margin: 6px 0 10px;
  line-height: 1.45;
}

.rank-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.rank-tab {
  border: 1.5px solid #e7e9ef;
  background: #f6f7fb;
  border-radius: 10px;
  padding: 7px 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.rank-tab--active {
  border-color: var(--theme-accent);
  background: #eaf6ff;
  color: var(--ink);
}

.rank-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 330px;
  overflow-y: auto;
}

.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  background: #f9fafc;
  border: 1.5px solid #e7e9ef;
  font-size: 12.5px;
}

.rank-row--player {
  border-color: #f59f00;
  background: #fff9db;
}

.rank-row--unlocked {
  border-color: #40c057;
  background: #ebfbee;
}

.rank-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rank-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e9ecef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  flex-shrink: 0;
}

.rank-row-title {
  font-weight: 700;
  color: var(--ink);
}

.rank-row-sub {
  font-size: 11px;
  color: var(--muted);
}

.rank-row-score {
  font-weight: 800;
  color: var(--theme-accent);
  white-space: nowrap;
}

.stat-box {
  background: #f6f7fb;
  border-radius: 12px;
  padding: 8px 6px;
}

.stat-box span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.stat-box strong {
  font-size: 16px;
  color: var(--ink);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 10px;
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 13px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--theme-accent);
  color: #fff;
}

.btn-secondary {
  background: #eef1f6;
  color: var(--ink);
}

.ad-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e7f5ff;
  color: #1971c2;
  margin-bottom: 8px;
}

.ad-timer-ring {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 4px solid #1971c2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #1971c2;
}

.ad-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e7f0fa;
  overflow: hidden;
  margin: 0 12px 16px;
}

.ad-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #339af0 0%, #1971c2 100%);
  transition: width 260ms linear;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shelfShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@keyframes packFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 159, 0, 0.7); }
  50% { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(245, 159, 0, 0); }
  100% { transform: scale(1); }
}

@keyframes slideForward {
  from { opacity: 0.3; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hintPulse {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

@keyframes tileLand {
  0% { transform: translateY(-10px) scale(1.12, 0.9); }
  55% { transform: translateY(2px) scale(0.95, 1.05); }
  100% { transform: translateY(0) scale(1, 1); }
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translateY(8px) scale(0.8); }
  25% { opacity: 1; transform: translateY(-6px) scale(1.08); }
  100% { opacity: 0; transform: translateY(-34px) scale(0.98); }
}

@keyframes sparkBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.2); }
}

@keyframes boardBump {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.012); }
}
