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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    linear-gradient(rgba(8, 5, 20, 0.75), rgba(8, 5, 20, 0.88)),
    url("assets/mj-background.png") center center / cover no-repeat fixed;
  color: #e2e8f0;
  padding: 16px;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 640px;
  width: 100%;
}

.play-area {
  display: flex;
  gap: 12px;
  width: 100%;
  align-items: flex-start;
}

.game-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.move-controls {
  flex-shrink: 0;
  width: 118px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #475569;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.move-controls-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: #fbbf24;
}

.dpad {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.dpad-row {
  display: grid;
  grid-template-columns: 1fr 28px 1fr;
  gap: 6px;
  align-items: center;
}

.dpad-center {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #475569, #1e293b);
  border: 2px solid #64748b;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ctrl-btn--dir {
  padding: 12px 4px;
  font-size: 0.78rem;
  line-height: 1.2;
}

.clip-btn--sidebar {
  width: 100%;
  font-size: 0.95rem;
  padding: 14px 6px;
}

header {
  text-align: center;
  width: 100%;
}

header h1 {
  font-size: 1.75rem;
  margin-bottom: 6px;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.welcome-banner {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fde68a;
  background: linear-gradient(90deg, #7c2d12, #b45309, #7c2d12);
  border: 2px solid #fbbf24;
  border-radius: 999px;
  padding: 8px 14px;
  margin: 0 auto 10px;
  max-width: 480px;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.25);
  animation: welcome-pulse 2s ease-in-out infinite;
}

@keyframes welcome-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(251, 191, 36, 0.2); }
  50% { box-shadow: 0 0 24px rgba(251, 191, 36, 0.45); }
}

.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 1, 8, 0.88);
  backdrop-filter: blur(6px);
}

.welcome-modal.hidden {
  display: none;
}

.welcome-panel {
  width: 100%;
  max-width: 400px;
  padding: 28px 22px;
  border-radius: 16px;
  text-align: center;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 3px solid #fbbf24;
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.35);
}

.welcome-tag {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #c084fc;
  margin-bottom: 10px;
}

.welcome-title {
  font-size: 1.6rem;
  color: #fbbf24;
  margin-bottom: 8px;
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.4);
}

.welcome-message {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fde68a;
  margin-bottom: 12px;
  line-height: 1.35;
}

.welcome-sub {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 20px;
  line-height: 1.4;
}

.welcome-play-btn {
  padding: 14px 32px;
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #14532d;
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%);
  box-shadow: 0 4px 0 #16a34a, 0 0 20px rgba(74, 222, 128, 0.4);
}

.welcome-play-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #16a34a;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.stat-box--score {
  border-color: #4ade80;
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.stat-box--score .stat-label {
  color: #86efac;
}

.stat-value {
  font-size: 1.05rem;
  color: #f8fafc;
}

.stats strong {
  color: #f472b6;
}

.stat-box--score strong {
  color: #4ade80;
  font-size: 1.25rem;
  font-family: "Courier New", Courier, monospace;
}

.stat-box--coins {
  border-color: #fbbf24;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.stat-box--coins .stat-label {
  color: #fcd34d;
}

.stat-box--coins strong {
  color: #fbbf24;
  font-size: 1.15rem;
  font-family: "Courier New", Courier, monospace;
}

.stat-box--collection {
  border-color: #c084fc;
  box-shadow: 0 0 14px rgba(192, 132, 252, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.stat-box--collection .stat-label {
  color: #d8b4fe;
}

.stat-box--collection strong {
  color: #e9d5ff;
}

.level-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #312e81 0%, #1e1b4b 100%);
  border: 2px solid #fbbf24;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.25);
  width: 100%;
  max-width: 480px;
}

.level-banner-tag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #fcd34d;
}

.level-banner-num {
  font-size: 1.5rem;
  font-family: "Courier New", Courier, monospace;
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
  min-width: 1.5ch;
  text-align: center;
}

.level-banner-sep {
  color: #64748b;
}

.level-banner-name {
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

#game {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: 12px;
  background: #0f0a1e;
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.3), 0 12px 40px rgba(0, 0, 0, 0.5);
  touch-action: none;
}

.canvas-wrap {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.canvas-stage {
  position: relative;
  width: 100%;
  line-height: 0;
}

.claw-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: visible;
  border-radius: 12px;
}

.claw-pointer-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fbbf24;
  text-align: center;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
  animation: label-blink 1.2s ease-in-out infinite;
}

@keyframes label-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.claw-overlay.hidden {
  display: none;
}

.claw-rail {
  position: absolute;
  left: 6%;
  right: 6%;
  height: 8px;
  background: linear-gradient(180deg, #fde68a, #b45309);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.5);
}

.claw-marker {
  position: absolute;
  transform: translate(-50%, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

@keyframes claw-glow {
  0%, 100% { filter: drop-shadow(0 0 12px #eab308) drop-shadow(0 0 4px #dc2626); }
  50% { filter: drop-shadow(0 0 22px #fbbf24) drop-shadow(0 0 10px #dc2626); }
}

.claw-glow-ring {
  position: absolute;
  width: 56px;
  height: 56px;
  border: 3px solid #fbbf24;
  border-radius: 50%;
  top: calc(100% - 8px);
  left: 50%;
  transform: translate(-50%, -50%);
  animation: ring-pulse 1s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ring-pulse {
  0%, 100% { opacity: 0.9; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.45; transform: translate(-50%, -50%) scale(1.25); }
}

.claw-cable {
  width: 7px;
  background: linear-gradient(180deg, #0f172a, #cbd5e1);
  border-radius: 4px;
  min-height: 10px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.claw-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2px;
}

.claw-head-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #fff;
  background: linear-gradient(180deg, #dc2626, #991b1b);
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 3px;
  border: 2px solid #fbbf24;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.6);
}

.mech-claw {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 2px;
}

.mech-claw-hub {
  width: 38px;
  height: 14px;
  background: linear-gradient(180deg, #64748b, #1e293b);
  border: 2px solid var(--claw-trim, #fbbf24);
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.mech-claw-prongs {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  justify-content: center;
  height: 38px;
  margin-top: 2px;
}

.mech-prong {
  display: block;
  width: 9px;
  height: 32px;
  background: linear-gradient(180deg, var(--claw-prong-top, #94a3b8), var(--claw-prong-bottom, #f43f5e));
  border-radius: 0 0 7px 7px;
  border: 2px solid var(--claw-trim, #fbbf24);
  box-shadow: 0 0 8px var(--claw-prong-glow, rgba(244, 63, 94, 0.5));
}

.mech-prong--mid {
  height: 36px;
}

.mech-prong--left {
  transform: rotate(-14deg);
  transform-origin: top center;
}

.mech-prong--right {
  transform: rotate(14deg);
  transform-origin: top center;
}

.mech-claw--thriller {
  --claw-trim: #4ade80;
  --claw-prong-top: #c4b5fd;
  --claw-prong-bottom: #4ade80;
  --claw-prong-glow: rgba(74, 222, 128, 0.55);
}

.mech-claw--smooth {
  --claw-trim: #dc2626;
  --claw-prong-top: #f1f5f9;
  --claw-prong-bottom: #94a3b8;
  --claw-prong-glow: rgba(220, 38, 38, 0.45);
}

.mech-claw--billie {
  --claw-trim: #22d3ee;
  --claw-prong-top: #fbcfe8;
  --claw-prong-bottom: #ec4899;
  --claw-prong-glow: rgba(34, 211, 238, 0.55);
}

.mech-claw--bad {
  --claw-trim: #facc15;
  --claw-prong-top: #a3a3a3;
  --claw-prong-bottom: #525252;
  --claw-prong-glow: rgba(250, 204, 21, 0.5);
}

.mech-claw--moonwalker {
  --claw-trim: #c084fc;
  --claw-prong-top: #bfdbfe;
  --claw-prong-bottom: #60a5fa;
  --claw-prong-glow: rgba(192, 132, 252, 0.55);
}

.mj-claw-figure {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  padding-bottom: 4px;
}

.mj-claw-hat {
  display: none;
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%) rotate(-12deg);
  width: 40px;
  height: 18px;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border-radius: 8px 8px 4px 4px;
  z-index: 3;
  box-shadow: 0 3px 0 #020617;
}

.mj-claw-hat::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  width: 46px;
  height: 8px;
  background: #0f172a;
  border-radius: 50%;
}

.mj-claw-hat::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 7px;
  height: 4px;
  background: #dc2626;
  border-radius: 2px;
}

.mj-claw-afro {
  width: 38px;
  height: 32px;
  background: #0f0a05;
  border-radius: 50%;
  margin-bottom: -18px;
  z-index: 1;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.mj-claw-face {
  width: 34px;
  height: 30px;
  background: linear-gradient(180deg, #d4a574, #c4a574);
  border-radius: 50%;
  z-index: 2;
  position: relative;
  border: 2px solid var(--claw-trim, #fbbf24);
}

.mj-claw-shades {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 8px;
  background: #0f172a;
  border-radius: 2px;
}

.mj-claw-shades::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 1px;
  width: 3px;
  height: 6px;
  background: #334155;
  transform: translateX(-50%);
}

.mj-claw-jacket {
  width: 44px;
  height: 28px;
  margin-top: -4px;
  background: linear-gradient(180deg, var(--claw-jacket-top, #ef4444), var(--claw-jacket-bottom, #b91c1c));
  border-radius: 6px 6px 10px 10px;
  border: 2px solid var(--claw-trim, #fbbf24);
  z-index: 1;
  box-shadow: 0 4px 10px var(--claw-jacket-glow, rgba(220, 38, 38, 0.5));
}

.mj-claw-grip {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  justify-content: center;
  margin-top: 2px;
  height: 36px;
}

.mj-finger {
  display: block;
  width: 8px;
  height: 28px;
  background: linear-gradient(180deg, var(--claw-finger-top, #d4a574), var(--claw-finger-bottom, #c4a574));
  border-radius: 0 0 6px 6px;
  border: 2px solid var(--claw-trim, #fbbf24);
}

.mj-finger--mid {
  height: 34px;
}

.mj-finger--glove {
  height: 32px;
  background: linear-gradient(180deg, #fff, #e2e8f0);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  border-color: #fff;
}

.mj-claw-figure--thriller {
  --claw-trim: #4ade80;
  --claw-jacket-top: #7c3aed;
  --claw-jacket-bottom: #4c1d95;
  --claw-jacket-glow: rgba(74, 222, 128, 0.45);
  --claw-finger-top: #bbf7d0;
  --claw-finger-bottom: #4ade80;
}

.mj-claw-figure--thriller .mj-claw-afro {
  background: #1a0a2e;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.55);
}

.mj-claw-figure--thriller .mj-finger--glove {
  border-color: #4ade80;
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.95);
}

.mj-claw-figure--smooth {
  --claw-trim: #dc2626;
  --claw-jacket-top: #f8fafc;
  --claw-jacket-bottom: #94a3b8;
  --claw-jacket-glow: rgba(220, 38, 38, 0.35);
  --claw-finger-top: #e2e8f0;
  --claw-finger-bottom: #94a3b8;
}

.mj-claw-figure--smooth .mj-claw-afro,
.mj-claw-figure--billie .mj-claw-afro,
.mj-claw-figure--moonwalker .mj-claw-afro {
  display: none;
}

.mj-claw-figure--smooth .mj-claw-hat,
.mj-claw-figure--moonwalker .mj-claw-hat {
  display: block;
}

.mj-claw-figure--smooth .mj-claw-hat::after {
  background: #dc2626;
}

.mj-claw-figure--smooth .mj-finger--glove {
  border-color: #fff;
  box-shadow: 0 0 12px rgba(248, 250, 252, 0.9);
}

.mj-claw-figure--billie {
  --claw-trim: #22d3ee;
  --claw-jacket-top: #831843;
  --claw-jacket-bottom: #0f172a;
  --claw-jacket-glow: rgba(34, 211, 238, 0.45);
  --claw-finger-top: #fbcfe8;
  --claw-finger-bottom: #f472b6;
}

.mj-claw-figure--billie .mj-finger--mid {
  background: linear-gradient(180deg, #fff, #e2e8f0);
  border-color: #22d3ee;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.95);
}

.mj-claw-figure--billie .mj-finger:not(.mj-finger--mid) {
  opacity: 0.55;
  height: 24px;
}

.mj-claw-figure--bad {
  --claw-trim: #facc15;
  --claw-jacket-top: #404040;
  --claw-jacket-bottom: #0a0a0a;
  --claw-jacket-glow: rgba(250, 204, 21, 0.35);
  --claw-finger-top: #d4d4d4;
  --claw-finger-bottom: #737373;
}

.mj-claw-figure--bad .mj-claw-afro {
  width: 32px;
  height: 26px;
  background: #171717;
}

.mj-claw-figure--bad .mj-finger--glove {
  border-color: #facc15;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.9);
}

.mj-claw-figure--moonwalker {
  --claw-trim: #c084fc;
  --claw-jacket-top: #e2e8f0;
  --claw-jacket-bottom: #475569;
  --claw-jacket-glow: rgba(192, 132, 252, 0.45);
  --claw-finger-top: #bfdbfe;
  --claw-finger-bottom: #60a5fa;
}

.mj-claw-figure--moonwalker .mj-claw-hat {
  background: linear-gradient(180deg, #475569, #1e293b);
}

.mj-claw-figure--moonwalker .mj-claw-hat::after {
  background: #60a5fa;
}

.mj-claw-figure--moonwalker .mj-finger--glove {
  box-shadow: 0 0 14px rgba(192, 132, 252, 0.95);
  border-color: #c084fc;
}

.claw-theme-thriller .claw-rail {
  background: linear-gradient(180deg, #c4b5fd, #16a34a);
  box-shadow: 0 2px 10px rgba(74, 222, 128, 0.55);
}

.claw-theme-thriller .claw-glow-ring {
  border-color: #4ade80;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.55);
}

.claw-theme-smooth .claw-rail {
  background: linear-gradient(180deg, #f1f5f9, #64748b);
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.45);
}

.claw-theme-smooth .claw-glow-ring {
  border-color: #f8fafc;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.5);
}

.claw-theme-billie .claw-rail {
  background: linear-gradient(180deg, #fbcfe8, #0891b2);
  box-shadow: 0 2px 10px rgba(34, 211, 238, 0.55);
}

.claw-theme-billie .claw-glow-ring {
  border-color: #f472b6;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.55);
}

.claw-theme-bad .claw-rail {
  background: linear-gradient(180deg, #fde047, #ca8a04);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.5);
}

.claw-theme-bad .claw-glow-ring {
  border-color: #facc15;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.claw-theme-moonwalker .claw-rail {
  background: linear-gradient(180deg, #bfdbfe, #6366f1);
  box-shadow: 0 2px 10px rgba(192, 132, 252, 0.55);
}

.claw-theme-moonwalker .claw-glow-ring {
  border-color: #60a5fa;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.55);
}

.claw-theme-thriller.claw-track {
  border-color: #4ade80;
  background: linear-gradient(180deg, #312e81, #14532d);
}

.claw-theme-smooth.claw-track {
  border-color: #f8fafc;
  background: linear-gradient(180deg, #0f172a, #334155);
}

.claw-theme-billie.claw-track {
  border-color: #22d3ee;
  background: linear-gradient(180deg, #831843, #0f172a);
}

.claw-theme-bad.claw-track {
  border-color: #facc15;
  background: linear-gradient(180deg, #171717, #422006);
}

.claw-theme-moonwalker.claw-track {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #1e3a8a, #312e81);
}

.claw-prongs {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  justify-content: center;
  height: 42px;
  background: #1e293b;
  padding: 4px 8px 0;
  border-radius: 8px 8px 12px 12px;
  border: 2px solid #fbbf24;
}

.claw-prongs span {
  display: block;
  width: 10px;
  height: 34px;
  background: linear-gradient(180deg, #fb7185, #be123c);
  border-radius: 0 0 8px 8px;
  border: 2px solid #fff;
  box-shadow: 0 0 10px #f43f5e;
}

.claw-prongs span:nth-child(2) {
  height: 40px;
}

.claw-track {
  position: relative;
  width: 100%;
  height: 28px;
  background: #1e293b;
  border-radius: 14px;
  border: 2px solid #fbbf24;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
  margin-top: 4px;
}

.claw-track-label {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 800;
  color: #fbbf24;
  white-space: nowrap;
}

.claw-track-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px #f43f5e);
  transition: left 0.05s linear;
}

.claw-track.hidden {
  display: none;
}

.hint {
  text-align: center;
  font-size: 0.9rem;
  color: #94a3b8;
  min-height: 1.4em;
  width: 100%;
}

@media (max-width: 520px) {
  .play-area {
    gap: 8px;
  }

  .move-controls {
    width: 100px;
    padding: 8px 6px;
  }

  .ctrl-btn--dir {
    padding: 10px 2px;
    font-size: 0.68rem;
  }

  .clip-btn--sidebar {
    font-size: 0.82rem;
    padding: 12px 4px;
  }

  .dpad-row {
    grid-template-columns: 1fr 22px 1fr;
  }

  .dpad-center {
    width: 22px;
    height: 22px;
  }
}

.ctrl-btn {
  padding: 16px 8px;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  color: #f1f5f9;
  box-shadow: 0 4px 0 #1e293b, 0 0 12px rgba(100, 116, 139, 0.4);
  transition: transform 0.08s, box-shadow 0.08s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:active,
.ctrl-btn.pressed {
  transform: translateY(4px);
  box-shadow: 0 0 0 #1e293b, 0 0 8px rgba(100, 116, 139, 0.3);
}

.clip-btn {
  background: linear-gradient(180deg, #f43f5e 0%, #be123c 100%);
  box-shadow: 0 4px 0 #881337, 0 0 16px rgba(244, 63, 94, 0.5);
  font-size: 1.15rem;
}

.clip-btn:active,
.clip-btn.pressed {
  box-shadow: 0 0 0 #881337, 0 0 10px rgba(244, 63, 94, 0.4);
}

.clip-btn--disabled,
.clip-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.restart-btn {
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%);
  color: #14532d;
  box-shadow: 0 4px 0 #16a34a;
}

.restart-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #16a34a;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
  max-width: 480px;
}

.music-btn {
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #a855f7 0%, #7c3aed 100%);
  box-shadow: 0 4px 0 #5b21b6, 0 0 16px rgba(168, 85, 247, 0.4);
  max-width: 100%;
}

.music-btn--off {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  box-shadow: 0 4px 0 #1e293b;
  color: #cbd5e1;
  animation: music-pulse 1.2s ease-in-out infinite;
}

@keyframes music-pulse {
  0%, 100% { box-shadow: 0 4px 0 #1e293b, 0 0 0 rgba(168, 85, 247, 0); }
  50% { box-shadow: 0 4px 0 #1e293b, 0 0 18px rgba(168, 85, 247, 0.65); }
}

.music-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #5b21b6;
}

.mj-music-panel {
  width: 100%;
  max-width: 480px;
  margin: 0 0 10px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #1e1033 0%, #0f172a 100%);
  border: 2px solid #fde047;
  box-shadow: 0 0 20px rgba(253, 224, 71, 0.3);
  opacity: 1;
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.mj-music-panel--active {
  border-color: #fde047;
}

.mj-music-note {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: #c4b5fd;
  line-height: 1.35;
  text-align: center;
}

.mj-music-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.open-yt-btn,
.open-bili-btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
}

.open-yt-btn {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 4px 0 #7f1d1d;
}

.open-bili-btn {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  box-shadow: 0 4px 0 #075985;
}

.open-yt-btn:active,
.open-bili-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.load-music-btn--panel {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.95rem;
}

.mj-music-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.mj-music-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #c4b5fd;
}

.mj-now-playing {
  font-size: 0.85rem;
  color: #fde047;
}

.load-music-btn {
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #1a0f02;
  background: linear-gradient(180deg, #fde047 0%, #eab308 100%);
  box-shadow: 0 4px 0 #a16207, 0 0 14px rgba(234, 179, 8, 0.45);
  max-width: 100%;
}

.load-music-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #a16207;
}

#yt-music-player {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  bottom: 0;
  left: 0;
  overflow: hidden;
}

.music-hint {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.78rem;
  text-align: center;
  color: #c4b5fd;
  max-width: 480px;
  line-height: 1.35;
}

.music-hint--alert {
  color: #fde047;
  animation: music-pulse 1.4s ease-in-out infinite;
  border-radius: 8px;
  background: rgba(234, 179, 8, 0.12);
}

.welcome-music-btn {
  margin-top: 10px;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  border: 2px solid #fde047;
  border-radius: 999px;
  cursor: pointer;
  color: #fde047;
  background: transparent;
  width: 100%;
}

.welcome-music-btn:hover {
  background: rgba(253, 224, 71, 0.12);
}

.shop-btn {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #1a0f02;
  box-shadow: 0 4px 0 #92400e, 0 0 16px rgba(251, 191, 36, 0.35);
}

.shop-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #92400e;
}

.shop-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 1, 8, 0.85);
  backdrop-filter: blur(4px);
}

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

.shop-panel {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #fbbf24;
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.25);
}

.shop-header {
  text-align: center;
  margin-bottom: 8px;
}

.shop-header h2 {
  font-size: 1.5rem;
  color: #fbbf24;
  margin-bottom: 6px;
}

.shop-balance {
  color: #94a3b8;
  font-size: 1rem;
}

.shop-balance strong {
  color: #fbbf24;
  font-size: 1.2rem;
}

.shop-note {
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 12px;
}

.shop-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.shop-tab {
  flex: 1;
  padding: 8px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  color: #94a3b8;
  cursor: pointer;
}

.shop-tab.active {
  background: #334155;
  color: #fbbf24;
  border-color: #fbbf24;
}

.collection-header {
  text-align: center;
  color: #c084fc;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.collection-card {
  padding: 8px 6px 10px;
  border-radius: 10px;
  text-align: center;
  background: #0f172a;
  border: 1px dashed #334155;
  opacity: 0.75;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.collection-card-preview {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.collection-card--owned {
  opacity: 1;
  border-style: solid;
  border-color: #a855f7;
  background: #1e1033;
}

.collection-card--secret {
  border-color: #7c3aed;
  background: #1a0f2e;
}

.collection-card--secret.collection-card--owned {
  border-color: #fde047;
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.35);
}

.collection-secret-header {
  grid-column: 1 / -1;
  margin: 8px 0 2px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  color: #fde047;
  background: rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  border: 1px dashed #a855f7;
}

.collection-card-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 2px;
}

.collection-card-rarity {
  font-size: 0.6rem;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 4px;
}

.collection-card-count {
  font-size: 0.85rem;
  color: #c084fc;
  font-weight: 700;
}

.shop-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.shop-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid #334155;
}

.shop-item--maxed {
  opacity: 0.55;
}

.shop-item-icon {
  font-size: 1.75rem;
  text-align: center;
}

.shop-item-info h3 {
  font-size: 0.95rem;
  color: #f8fafc;
  margin-bottom: 2px;
}

.shop-item-info p {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
}

.shop-item-level {
  font-size: 0.7rem;
  color: #f472b6;
  margin-top: 3px;
}

.shop-buy-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  color: #052e16;
  white-space: nowrap;
}

.shop-buy-btn:disabled {
  background: #334155;
  color: #64748b;
  cursor: not-allowed;
}

.shop-close-btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(180deg, #64748b 0%, #475569 100%);
  color: #f8fafc;
}
