html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(#7ec0ee, #a0d6ff);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 12px;
  color: #023047;
}

h1 { margin: 0 0 8px; }
#hud { margin: 8px 0; font-size: 18px; display: flex; align-items: center; gap: 10px; }

#music-toggle {
  border: 1px solid #045;
  background: #d9f2ff;
  color: #003040;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
}

#music-toggle:hover {
  background: #c6ebff;
}

canvas {
  background: radial-gradient(circle at 50% 25%, #9fe0ff, #2b86b5);
  border: 4px solid #045;
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
  border-radius: 8px;
  max-width: 100%;
  max-height: 100%;
}

p { max-width: 800px; text-align: center; }

@media (max-height: 720px), (max-width: 900px){
  body { padding: 8px; }
  h1 { font-size: 20px; margin: 0 0 4px; }
  #hud { font-size: 16px; margin: 4px 0; }
  #music-toggle { font-size: 13px; padding: 3px 8px; }
  p { font-size: 13px; margin: 6px 0; }
}

.score-popup{
  position: fixed;
  left: 50%;
  top: 24%;
  transform: translateX(-50%) translateY(-8px);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,250,230,0.98));
  color: #0b3b4a;
  border: 2px solid rgba(4,80,100,0.12);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 22px;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  opacity: 0; transition: transform 260ms ease, opacity 260ms ease;
  z-index: 9999;
}
.score-popup.pop-out{ transform: translateX(-50%) translateY(-40px); opacity: 1; }

/* Shop overlay */
.shop-overlay{
  position: fixed;
  left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: linear-gradient(180deg,#f8fbff,#ffffff);
  border-radius: 10px; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.28);
  z-index: 10000; color:#023047; width:640px; max-width:95%;
}
.shop-overlay h2{ margin: 4px 0 12px; }
.shop-items{ display:flex; gap:12px; justify-content:space-between; }
.shop-item{ width:30%; background:#f0f7f9; border-radius:8px; padding:8px; text-align:center; }
.shop-item .preview{ height:56px; border-radius:6px; margin-bottom:8px; }
.color-red{ background: linear-gradient(90deg,#ff6b6b,#ff3b3b); }
.color-bw{ background: repeating-linear-gradient(90deg,#ffffff 0 8px,#000000 8px 16px); }
.color-green{ background: linear-gradient(90deg,#6fe27e,#2e8f4a); }

.color-pink{ background: linear-gradient(90deg,#ffc0dd,#ff9fc9); }
.color-purple{ background: linear-gradient(90deg,#a178ff,#6b3be6); }
.color-purple-polka{ background: linear-gradient(90deg,#7f4fbf,#6a38b0); background-image: radial-gradient(circle at 20% 30%, rgba(255,159,201,0.9) 0 6px, transparent 6px), radial-gradient(circle at 60% 60%, rgba(255,159,201,0.9) 0 6px, transparent 6px); }
.color-blue-red-diag{ background: linear-gradient(135deg,#2b6cff 0%, #ff4d4d 50%); background-size: 60px 60px; }
.color-yellow-glitter{ background: radial-gradient(circle at 30% 30%, #fff8c2, #ffd94d); box-shadow: inset 0 8px 20px rgba(255,240,180,0.25); }
.color-rainbow{ background: linear-gradient(90deg, #ff5a5f, #ffa600, #ffe156, #06d6a0, #4cc9f0, #9b5de5); }
.color-butterfly{ background: linear-gradient(90deg, #ff9edb, #8bd0ff); }
.color-superhero{ background: linear-gradient(90deg, #2b6cff, #ff3b3b); }
.shop-item .desc{ font-size:13px; margin-bottom:8px; }
.shop-item .control{ height:32px; }
.shop-item button{ background:#007496; color:#fff; border:none; padding:6px 10px; border-radius:6px; cursor:pointer; }
.shop-note{ margin-top:12px; font-size:13px; color:#345; }

/* carousel preview */
.shop-preview-wrap{ display:flex; align-items:center; gap:8px; justify-content:center; margin-bottom:12px; }
.shop-nav{ background:transparent; border:0; font-size:20px; cursor:pointer; padding:8px 10px; }
.shop-preview{ width:320px; height:160px; border-radius:8px; border:2px solid rgba(0,0,0,0.06); box-shadow: inset 0 6px 18px rgba(0,0,0,0.06); }
.shop-preview img{ width:100%; height:100%; object-fit:cover; border-radius:6px; display:block; }
.shop-info{ text-align:center; margin-bottom:12px; }
.shop-action button{ padding:8px 14px; border-radius:8px; background:#0077a9; color:#fff; border:0; cursor:pointer; }
.shop-thumbs{ display:flex; gap:8px; justify-content:center; align-items:center; overflow-x:auto; padding:6px 4px; }
.shop-thumb{ width:72px; height:44px; border-radius:6px; border:2px solid rgba(0,0,0,0.06); cursor:pointer; flex:0 0 auto; }
.shop-thumb.unlocked{ outline: 3px solid rgba(50,180,120,0.12); }
.shop-thumb.active{ box-shadow: 0 6px 18px rgba(0,0,0,0.12); transform: translateY(-4px); }

/* other item preview styles */
.other-coral{ background: linear-gradient(135deg,#ffd7b8,#ff8f3a); }
.other-moray{ background: linear-gradient(90deg,#7f7f7f,#4f4f4f); background-image: linear-gradient(90deg, rgba(255,255,255,0.06) 0 10%, transparent 10% 20%); }
.other-triangle{ background: linear-gradient(90deg,#cfeeff,#8fd7ff); position:relative; }
.other-triangle::after{ content:''; position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:0; height:0; border-left:22px solid transparent; border-right:22px solid transparent; border-bottom:36px solid rgba(255,255,255,0.85); }
.other-square{ background: linear-gradient(90deg,#eaf7ff,#cfeeff); position:relative; }
.other-square::after{ content:''; position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:36px; height:36px; background:rgba(255,255,255,0.85); border-radius:4px; }
.other-shimmer{ background: repeating-linear-gradient(45deg, #ffd8ff 0 12px, #ffeaff 12px 24px); }
.shop-thumb.consumable{ outline: 2px dashed rgba(120,120,255,0.12); }

/* tabs */
.shop-tabs{ display:flex; gap:8px; justify-content:center; margin-bottom:8px; }
.shop-tab{ background:#e9f5fb; border:0; padding:6px 10px; border-radius:8px; cursor:pointer; }
.shop-tab.active{ background:#0077a9; color:#fff; }

/* background preview swatches */
.bg-default{ background: linear-gradient(0deg,#a6e0ff,#1f6f9b); }
.bg-sunset{ background: linear-gradient(0deg,#ffd3a5,#ff6e7f); }
.bg-deep{ background: linear-gradient(0deg,#001f3f,#063a5d); }

/* new background preview swatches */
.bg-dots{ background: radial-gradient(circle at 20% 20%, #ffd3a5 0 6px, transparent 6px), radial-gradient(circle at 70% 40%, #ff9ec2 0 6px, transparent 6px), linear-gradient(0deg,#f6fff3,#dfffe8); background-size: 40px 40px, 60px 60px; }
.bg-jungle{ background: linear-gradient(180deg,#e9ffd8,#a6f2a0); background-image: radial-gradient(circle at 10% 20%, rgba(255,255,255,0.12) 0 6px, transparent 6px), linear-gradient(0deg, rgba(0,0,0,0.02), rgba(0,0,0,0.01)); }
.bg-sunbeams{ background: linear-gradient(0deg,#fff6d9,#ffedb3); background-image: linear-gradient(120deg, rgba(255,255,255,0.18) 0 20%, rgba(255,255,255,0) 20% 40%); background-blend-mode: screen; }
.bg-fish{ background: linear-gradient(0deg,#b8f2ff,#5aaed6); }
.bg-splatter{ background: radial-gradient(circle at 20% 30%, #ff9aa2 0 10px, transparent 12px), radial-gradient(circle at 60% 40%, #caffbf 0 10px, transparent 12px), radial-gradient(circle at 30% 70%, #9bf6ff 0 10px, transparent 12px), linear-gradient(0deg,#e8f8ff,#8fd7ff); }

.shop-overlay{
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(255,255,255,0.98);
  color:#023047;
  padding: 18px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 10000; min-width: 420px;
}
.shop-overlay h2{ margin: 0 0 10px; }
.shop-items{ display:flex; gap:10px; }
.shop-item{ display:flex; align-items:center; gap:8px; padding:8px; border-radius:8px; border:1px solid rgba(0,0,0,0.06); background:#fff; flex:1; }
.shop-item .preview{ width:56px; height:42px; border-radius:6px; border:1px solid rgba(0,0,0,0.06); }
.preview.color-red{ background:#ff4d4d }
.preview.color-bw{ background:linear-gradient(90deg,#000 40%, #fff 40% 60%, #000 60%); }
.preview.color-green{ background:linear-gradient(180deg,#4caf50,#2e8b3a); }
.shop-item .desc{ flex:1; font-weight:600; }
.shop-item button.buy{ padding:6px 10px; border-radius:8px; border:0; background:#0077a9; color:#fff; cursor:pointer; }
.shop-note{ margin-top:10px; font-size:13px; opacity:0.85 }
