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

:root {
  --bg: #14102e;
  --panel: #221a4d;
  --cell: #2c2160;
  --text: #f4f1ff;
  --muted: #b9b0e6;
  --accent: #ffb340;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, #2a1e63 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 14px 40px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: .2px;
}
h1 span { color: var(--accent); }

.scores { display: flex; gap: 8px; }
.score-box {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 5px 14px;
  text-align: center;
  min-width: 74px;
}
.score-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.score-value { font-size: 20px; font-weight: 800; }

.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.btn {
  flex: 1;
  background: var(--panel);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(180deg, #ffc65c, #ff9a2e);
  color: #3a1e00;
  border: none;
  padding: 12px 28px;
  flex: none;
}

.board-shell {
  position: relative;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.cell {
  aspect-ratio: 1 / 1;
  background: var(--cell);
  border-radius: 18%;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.35);
  position: relative;
}
.cell.filled { box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), inset 0 3px 0 rgba(255,255,255,.35), 0 2px 4px rgba(0,0,0,.35); }
.cell.preview-ok::after,
.cell.preview-bad::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18%;
}
.cell.preview-ok::after { background: rgba(120,255,170,.45); }
.cell.preview-bad::after { background: rgba(255,90,90,.45); }
.cell.clearing { animation: clearPop .22s ease forwards; }
@keyframes clearPop {
  40% { transform: scale(1.18); filter: brightness(1.7); }
  100% { transform: scale(0); opacity: 0; }
}

/* Jewel colours */
.c0 { background: linear-gradient(145deg, #ff8fa3, #e63b5f 55%, #b81f45); }
.c1 { background: linear-gradient(145deg, #ffd98a, #ffab2e 55%, #e07f00); }
.c2 { background: linear-gradient(145deg, #a8f0b0, #3ecf5e 55%, #1d9e42); }
.c3 { background: linear-gradient(145deg, #9ad9ff, #2e9bff 55%, #1466d6); }
.c4 { background: linear-gradient(145deg, #d3a6ff, #9350e8 55%, #6a2fc0); }
.c5 { background: linear-gradient(145deg, #8ff2e4, #22c8b2 55%, #0e9484); }
.c6 { background: linear-gradient(145deg, #ffb3e2, #f45fb8 55%, #c92b8b); }

.tray {
  display: flex;
  justify-content: space-around;
  align-items: center;
  min-height: 118px;
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 12px 6px;
}
.piece-slot {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 92px;
}
.piece {
  display: grid;
  gap: 3px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  padding: 6px;
}
.piece:active { cursor: grabbing; }
.piece.dragging-source { opacity: .25; }
.piece-cell {
  width: 26px;
  height: 26px;
  border-radius: 22%;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), inset 0 3px 0 rgba(255,255,255,.35), 0 2px 4px rgba(0,0,0,.35);
}
.piece-cell.empty { background: transparent; box-shadow: none; }

.ghost {
  position: fixed;
  display: grid;
  gap: 4px;
  pointer-events: none;
  z-index: 50;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.5));
}
.ghost-cell { border-radius: 18%; box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), inset 0 3px 0 rgba(255,255,255,.35); }
.ghost-cell.empty { background: transparent; box-shadow: none; }

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.game-over {
  position: absolute;
  inset: 0;
  background: rgba(16,10,40,.78);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.hidden { display: none !important; }
.game-over-card {
  text-align: center;
  background: #2a1e63;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  padding: 26px 34px;
}
.game-over-card h2 { font-size: 30px; margin-bottom: 10px; }
.game-over-card p { font-size: 18px; margin-bottom: 6px; }
.game-over-card .best-line { color: var(--muted); margin-bottom: 18px; }

.combo-pop {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 3px 10px rgba(0,0,0,.6);
  pointer-events: none;
  z-index: 15;
  animation: comboZoom .8s ease forwards;
  white-space: nowrap;
}
@keyframes comboZoom {
  0% { transform: translate(-50%,-50%) scale(.5); opacity: 0; }
  30% { transform: translate(-50%,-50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%,-90%) scale(1); opacity: 0; }
}

.seo { margin-top: 28px; color: var(--muted); line-height: 1.65; font-size: 15px; }
.seo h2 { color: var(--text); font-size: 19px; margin: 18px 0 8px; }
.seo p { margin-bottom: 10px; }

@media (max-width: 390px) {
  h1 { font-size: 21px; }
  .piece-cell { width: 23px; height: 23px; }
  .tray { min-height: 104px; }
}

/* Competitive features */
.tabs { display:flex; gap:8px; margin-bottom:10px; }
.tab { flex:1; background:var(--panel); color:var(--muted); border:1px solid rgba(255,255,255,.16); border-radius:12px; padding:10px 0; font-size:15px; font-weight:800; cursor:pointer; }
.tab.active { background:linear-gradient(180deg,#ffc65c,#ff9a2e); color:#3a1e00; border:none; }
.mode-info { text-align:center; color:var(--muted); font-size:14px; margin-bottom:10px; min-height:20px; }
.mode-info strong { color:var(--text); }
.mini { background:var(--panel); color:var(--text); border:1px solid rgba(255,255,255,.2); border-radius:8px; width:28px; height:28px; font-size:16px; cursor:pointer; vertical-align:middle; }
.mini:disabled { opacity:.35; }
.powerups { display:flex; gap:8px; margin-top:12px; }
.power { font-size:14px; }
.power:disabled { opacity:.4; }
.power.armed { background:linear-gradient(180deg,#ffc65c,#ff9a2e); color:#3a1e00; }
.panel { margin-top:18px; background:var(--panel); border:1px solid rgba(255,255,255,.12); border-radius:18px; padding:14px; }
.panel h2 { font-size:16px; margin-bottom:10px; }
.themes { display:flex; flex-wrap:wrap; gap:8px; }
.theme-btn { flex:1 1 40%; background:rgba(255,255,255,.06); color:var(--text); border:1px solid rgba(255,255,255,.16); border-radius:12px; padding:10px 6px; font-weight:700; cursor:pointer; font-size:14px; }
.theme-btn.active { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
.theme-btn:disabled { opacity:.45; cursor:default; }
.stats { display:flex; text-align:center; }
.stats div { flex:1; }
.stats strong { display:block; font-size:22px; }
.stats span { font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); }
.game-over-card .btn { display:block; width:100%; margin-top:10px; }

/* Themes */
body[data-theme="ocean"] { --bg:#041e33; --panel:#0a3355; --cell:#0e4066; --text:#eaf6ff; --muted:#9fcbe8; --accent:#38e1ff; background:radial-gradient(120% 90% at 50% 0%, #0b4a73 0%, var(--bg) 60%); }
body[data-theme="ocean"] .c0 { background:linear-gradient(145deg,#7ee8fa,#1d9bf0 55%,#0b5fa5); }
body[data-theme="ocean"] .c1 { background:linear-gradient(145deg,#a8f0d1,#1fc8a9 55%,#0e7d6b); }
body[data-theme="ocean"] .c2 { background:linear-gradient(145deg,#c3b2ff,#6a5cff 55%,#3d2bb8); }
body[data-theme="ocean"] .c3 { background:linear-gradient(145deg,#ffe29a,#ffb340 55%,#d97c00); }
body[data-theme="ocean"] .c4 { background:linear-gradient(145deg,#ffb3d9,#f45fb8 55%,#b81f7d); }
body[data-theme="ocean"] .c5 { background:linear-gradient(145deg,#b8ffd9,#3ecf5e 55%,#1d7d38); }
body[data-theme="ocean"] .c6 { background:linear-gradient(145deg,#ffd0a8,#ff7a45 55%,#c94a1f); }

body[data-theme="sunset"] { --bg:#2e0f1e; --panel:#4d1a33; --cell:#5e2140; --text:#fff1e6; --muted:#e8b49f; --accent:#ffcf5c; background:radial-gradient(120% 90% at 50% 0%, #7a2340 0%, var(--bg) 60%); }
body[data-theme="sunset"] .c0 { background:linear-gradient(145deg,#ffd98a,#ffab2e 55%,#e07f00); }
body[data-theme="sunset"] .c1 { background:linear-gradient(145deg,#ffb3a8,#ff5f45 55%,#c92b1f); }
body[data-theme="sunset"] .c2 { background:linear-gradient(145deg,#ffb3e2,#f45fb8 55%,#c92b8b); }
body[data-theme="sunset"] .c3 { background:linear-gradient(145deg,#d3a6ff,#9350e8 55%,#6a2fc0); }
body[data-theme="sunset"] .c4 { background:linear-gradient(145deg,#ffe8a8,#ffcf3f 55%,#d99a00); }
body[data-theme="sunset"] .c5 { background:linear-gradient(145deg,#a8e8ff,#2e9bff 55%,#1466d6); }
body[data-theme="sunset"] .c6 { background:linear-gradient(145deg,#c8ffb3,#5ecf3e 55%,#2f9e1d); }

body[data-theme="emerald"] { --bg:#06231a; --panel:#0c3d2c; --cell:#10503a; --text:#eafff3; --muted:#9fe8c3; --accent:#ffe27a; background:radial-gradient(120% 90% at 50% 0%, #0f5c40 0%, var(--bg) 60%); }
body[data-theme="emerald"] .c0 { background:linear-gradient(145deg,#a8f0b0,#3ecf5e 55%,#147d38); }
body[data-theme="emerald"] .c1 { background:linear-gradient(145deg,#ffe29a,#ffcf3f 55%,#c99200); }
body[data-theme="emerald"] .c2 { background:linear-gradient(145deg,#8ff2e4,#22c8b2 55%,#0e7d6b); }
body[data-theme="emerald"] .c3 { background:linear-gradient(145deg,#c8ffb3,#7ed321 55%,#4a8f00); }
body[data-theme="emerald"] .c4 { background:linear-gradient(145deg,#ffb3d9,#e63b8f 55%,#a51f63); }
body[data-theme="emerald"] .c5 { background:linear-gradient(145deg,#a8d8ff,#2e7bff 55%,#1448c9); }
body[data-theme="emerald"] .c6 { background:linear-gradient(145deg,#e8ffb3,#b8e62e 55%,#7da50e); }

/* UI cleanup v2 — compact, clear hierarchy, mobile first */
.wrap { max-width: 460px; padding: 16px 14px 44px; }
.top { margin-bottom: 14px; }
h1 { font-size: 22px; white-space: nowrap; }
.scores { gap: 6px; }
.score-box { min-width: 62px; padding: 5px 10px; border-radius: 12px; }
.score-value { font-size: 18px; }

.toolbar { display: flex; align-items: stretch; gap: 8px; margin-bottom: 8px; }
.tabs {
  flex: 1; display: flex; gap: 4px; margin: 0;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 4px;
}
.tab {
  flex: 1; background: transparent; color: var(--muted); border: none;
  border-radius: 10px; padding: 9px 0; font-size: 14px; font-weight: 800; cursor: pointer;
}
.tab.active { background: linear-gradient(180deg,#ffc65c,#ff9a2e); color: #3a1e00; box-shadow: 0 3px 10px rgba(255,154,46,.35); }
.icon-btn {
  width: 44px; flex: none; background: var(--panel); color: var(--text);
  border: 1px solid rgba(255,255,255,.16); border-radius: 14px;
  font-size: 19px; font-weight: 800; cursor: pointer;
}
.icon-btn:active, .tab:active { transform: scale(.97); }
.mode-info { font-size: 13px; margin: 2px 0 12px; min-height: 18px; line-height: 1.5; }

.board-shell { padding: 10px; border-radius: 20px; }
.tray { margin-top: 12px; border-radius: 20px; min-height: 112px; }
.powerups { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.power { padding: 12px 0; font-size: 14px; border-radius: 14px; }
.power span { color: var(--accent); }
.power.armed span { color: inherit; }
.hint { margin-top: 12px; line-height: 1.5; padding: 0 8px; }

.panel { margin-top: 22px; padding: 16px; border-radius: 20px; }
.panel h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 12px; }
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 13px 14px; border-radius: 16px; text-align: left;
  background: rgba(255,255,255,.05);
}
.theme-btn.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.swatches { display: flex; gap: 5px; }
.swatches i { width: 20px; height: 20px; border-radius: 6px; display: block; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), inset 0 3px 0 rgba(255,255,255,.35); }
.theme-name { font-size: 16px; font-weight: 800; }
.theme-lock { font-size: 12px; font-weight: 600; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat-card {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px; padding: 14px 6px; text-align: center;
}
.stat-card strong { display: block; font-size: 24px; margin-bottom: 4px; }
.stat-card span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); line-height: 1.4; }
.seo { margin-top: 30px; }

@media (max-width: 390px) {
  .wrap { padding: 14px 12px 40px; }
  h1 { font-size: 19px; }
  .score-box { min-width: 54px; padding: 4px 8px; }
  .score-value { font-size: 16px; }
  .icon-btn { width: 40px; }
  .tab { font-size: 13px; }
  .piece-cell { width: 23px; height: 23px; }
  .tray { min-height: 102px; }
}

/* Cut-jewel blocks — faceted gems, pure CSS, no images.
   Each colour class only sets gem tones; one shared rule builds the facets
   for board cells, tray pieces and the drag ghost alike. */
.c0 { --gem-light:#ffb3c2; --gem-mid:#f43f63; --gem-dark:#a31235; }
.c1 { --gem-light:#ffe3a3; --gem-mid:#ffab2e; --gem-dark:#b85e00; }
.c2 { --gem-light:#b9ffc4; --gem-mid:#2fd35f; --gem-dark:#0f7a34; }
.c3 { --gem-light:#aee2ff; --gem-mid:#2e9bff; --gem-dark:#0d4fb8; }
.c4 { --gem-light:#e2c2ff; --gem-mid:#9350e8; --gem-dark:#55209e; }
.c5 { --gem-light:#b0fff2; --gem-mid:#18c8b2; --gem-dark:#077365; }
.c6 { --gem-light:#ffc7ec; --gem-mid:#f45fb8; --gem-dark:#a31c72; }

body[data-theme="ocean"] .c0 { --gem-light:#7ee8fa; --gem-mid:#1d9bf0; --gem-dark:#0b5fa5; }
body[data-theme="ocean"] .c1 { --gem-light:#a8f0d1; --gem-mid:#1fc8a9; --gem-dark:#0e7d6b; }
body[data-theme="ocean"] .c2 { --gem-light:#c3b2ff; --gem-mid:#6a5cff; --gem-dark:#3d2bb8; }
body[data-theme="ocean"] .c3 { --gem-light:#ffe29a; --gem-mid:#ffb340; --gem-dark:#d97c00; }
body[data-theme="ocean"] .c4 { --gem-light:#ffb3d9; --gem-mid:#f45fb8; --gem-dark:#b81f7d; }
body[data-theme="ocean"] .c5 { --gem-light:#b8ffd9; --gem-mid:#3ecf5e; --gem-dark:#1d7d38; }
body[data-theme="ocean"] .c6 { --gem-light:#ffd0a8; --gem-mid:#ff7a45; --gem-dark:#c94a1f; }

body[data-theme="sunset"] .c0 { --gem-light:#ffd98a; --gem-mid:#ffab2e; --gem-dark:#e07f00; }
body[data-theme="sunset"] .c1 { --gem-light:#ffb3a8; --gem-mid:#ff5f45; --gem-dark:#c92b1f; }
body[data-theme="sunset"] .c2 { --gem-light:#ffb3e2; --gem-mid:#f45fb8; --gem-dark:#c92b8b; }
body[data-theme="sunset"] .c3 { --gem-light:#d3a6ff; --gem-mid:#9350e8; --gem-dark:#6a2fc0; }
body[data-theme="sunset"] .c4 { --gem-light:#ffe8a8; --gem-mid:#ffcf3f; --gem-dark:#d99a00; }
body[data-theme="sunset"] .c5 { --gem-light:#a8e8ff; --gem-mid:#2e9bff; --gem-dark:#1466d6; }
body[data-theme="sunset"] .c6 { --gem-light:#c8ffb3; --gem-mid:#5ecf3e; --gem-dark:#2f9e1d; }

body[data-theme="emerald"] .c0 { --gem-light:#a8f0b0; --gem-mid:#3ecf5e; --gem-dark:#147d38; }
body[data-theme="emerald"] .c1 { --gem-light:#ffe29a; --gem-mid:#ffcf3f; --gem-dark:#c99200; }
body[data-theme="emerald"] .c2 { --gem-light:#8ff2e4; --gem-mid:#22c8b2; --gem-dark:#0e7d6b; }
body[data-theme="emerald"] .c3 { --gem-light:#c8ffb3; --gem-mid:#7ed321; --gem-dark:#4a8f00; }
body[data-theme="emerald"] .c4 { --gem-light:#ffb3d9; --gem-mid:#e63b8f; --gem-dark:#a51f63; }
body[data-theme="emerald"] .c5 { --gem-light:#a8d8ff; --gem-mid:#2e7bff; --gem-dark:#1448c9; }
body[data-theme="emerald"] .c6 { --gem-light:#e8ffb3; --gem-mid:#b8e62e; --gem-dark:#7da50e; }

.cell.filled,
.piece-cell:not(.empty),
.ghost-cell:not(.empty) {
  position: relative;
  border-radius: 0;
  /* Cut corners — the octagon silhouette of a faceted stone */
  clip-path: polygon(16% 0, 84% 0, 100% 16%, 100% 84%, 84% 100%, 16% 100%, 0 84%, 0 16%);
  background:
    /* inner table facet */
    linear-gradient(135deg, rgba(255,255,255,.65), rgba(255,255,255,.12) 45%, rgba(0,0,0,.22)) center / 60% 60% no-repeat,
    /* top-left crown facet catching the light */
    linear-gradient(135deg, rgba(255,255,255,.75) 0 26%, rgba(255,255,255,0) 42%),
    /* right pavilion facet */
    linear-gradient(225deg, rgba(255,255,255,.28) 0 20%, rgba(255,255,255,0) 38%),
    /* bottom facet in shade */
    linear-gradient(45deg, rgba(0,0,0,.38) 0 24%, rgba(0,0,0,0) 44%),
    /* diagonal facet split */
    linear-gradient(115deg, rgba(255,255,255,.18) 0 50%, rgba(0,0,0,.14) 50% 100%),
    /* stone body */
    linear-gradient(150deg, var(--gem-light) 0%, var(--gem-mid) 52%, var(--gem-dark) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.35),
    inset 0 3px 4px rgba(255,255,255,.55),
    inset 0 -4px 5px rgba(0,0,0,.4);
}
/* Sparkle glint */
.cell.filled::before,
.piece-cell:not(.empty)::before,
.ghost-cell:not(.empty)::before {
  content: "";
  position: absolute;
  top: 7%;
  left: 9%;
  width: 30%;
  height: 30%;
  background: radial-gradient(circle, #fff 0 18%, rgba(255,255,255,0) 70%);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: .95;
  pointer-events: none;
}
/* Preview tint must follow the cut silhouette */
.cell.preview-ok::after,
.cell.preview-bad::after {
  clip-path: polygon(16% 0, 84% 0, 100% 16%, 100% 84%, 84% 100%, 16% 100%, 0 84%, 0 16%);
}
/* Theme swatches read as little gems too */
.swatches i {
  border-radius: 0;
  clip-path: polygon(16% 0, 84% 0, 100% 16%, 100% 84%, 84% 100%, 16% 100%, 0 84%, 0 16%);
  box-shadow: inset 0 2px 3px rgba(255,255,255,.6), inset 0 -3px 4px rgba(0,0,0,.35);
}

/* Candy-jewel palette v4 — vivid, glossy, no muddy shading.
   8 hues: ruby, orange topaz, sunny yellow, emerald, cyan,
   sapphire, violet, pink. Dark tone stays saturated, never brown/grey. */
.c0 { --gem-light:#ff9db0; --gem-mid:#ff2e4d; --gem-dark:#d90429; }
.c1 { --gem-light:#ffc98a; --gem-mid:#ff7b00; --gem-dark:#f25c05; }
.c2 { --gem-light:#fff3a0; --gem-mid:#ffd60a; --gem-dark:#ffb703; }
.c3 { --gem-light:#9bf5b1; --gem-mid:#22c55e; --gem-dark:#16a34a; }
.c4 { --gem-light:#a5f3fc; --gem-mid:#06d6e0; --gem-dark:#0891b2; }
.c5 { --gem-light:#93c5fd; --gem-mid:#2563eb; --gem-dark:#1d4ed8; }
.c6 { --gem-light:#d8b4fe; --gem-mid:#9333ea; --gem-dark:#7e22ce; }
.c7 { --gem-light:#fbcfe8; --gem-mid:#ec4899; --gem-dark:#db2777; }

body[data-theme="ocean"] .c0 { --gem-light:#a5f3fc; --gem-mid:#06d6e0; --gem-dark:#0891b2; }
body[data-theme="ocean"] .c1 { --gem-light:#93c5fd; --gem-mid:#2f80ed; --gem-dark:#2563eb; }
body[data-theme="ocean"] .c2 { --gem-light:#99f6e4; --gem-mid:#14e0c8; --gem-dark:#0d9488; }
body[data-theme="ocean"] .c3 { --gem-light:#9bf5b1; --gem-mid:#22c55e; --gem-dark:#16a34a; }
body[data-theme="ocean"] .c4 { --gem-light:#d8b4fe; --gem-mid:#8b5cf6; --gem-dark:#7c3aed; }
body[data-theme="ocean"] .c5 { --gem-light:#fff3a0; --gem-mid:#ffd60a; --gem-dark:#ffb703; }
body[data-theme="ocean"] .c6 { --gem-light:#fbcfe8; --gem-mid:#ec4899; --gem-dark:#db2777; }
body[data-theme="ocean"] .c7 { --gem-light:#ffc98a; --gem-mid:#ff7b00; --gem-dark:#f25c05; }

body[data-theme="sunset"] .c0 { --gem-light:#ffb59d; --gem-mid:#ff4d2e; --gem-dark:#e63b1f; }
body[data-theme="sunset"] .c1 { --gem-light:#ffc98a; --gem-mid:#ff7b00; --gem-dark:#f25c05; }
body[data-theme="sunset"] .c2 { --gem-light:#fff3a0; --gem-mid:#ffd60a; --gem-dark:#ffb703; }
body[data-theme="sunset"] .c3 { --gem-light:#fbcfe8; --gem-mid:#ec4899; --gem-dark:#db2777; }
body[data-theme="sunset"] .c4 { --gem-light:#d8b4fe; --gem-mid:#9333ea; --gem-dark:#7e22ce; }
body[data-theme="sunset"] .c5 { --gem-light:#ff9db0; --gem-mid:#ff2e4d; --gem-dark:#d90429; }
body[data-theme="sunset"] .c6 { --gem-light:#a5f3fc; --gem-mid:#06d6e0; --gem-dark:#0891b2; }
body[data-theme="sunset"] .c7 { --gem-light:#9bf5b1; --gem-mid:#22c55e; --gem-dark:#16a34a; }

body[data-theme="emerald"] .c0 { --gem-light:#9bf5b1; --gem-mid:#22c55e; --gem-dark:#16a34a; }
body[data-theme="emerald"] .c1 { --gem-light:#d9f99d; --gem-mid:#a3e635; --gem-dark:#65a30d; }
body[data-theme="emerald"] .c2 { --gem-light:#fff3a0; --gem-mid:#ffd60a; --gem-dark:#ffb703; }
body[data-theme="emerald"] .c3 { --gem-light:#99f6e4; --gem-mid:#14e0c8; --gem-dark:#0d9488; }
body[data-theme="emerald"] .c4 { --gem-light:#a5f3fc; --gem-mid:#06d6e0; --gem-dark:#0891b2; }
body[data-theme="emerald"] .c5 { --gem-light:#93c5fd; --gem-mid:#2563eb; --gem-dark:#1d4ed8; }
body[data-theme="emerald"] .c6 { --gem-light:#fbcfe8; --gem-mid:#ec4899; --gem-dark:#db2777; }
body[data-theme="emerald"] .c7 { --gem-light:#ffc98a; --gem-mid:#ff7b00; --gem-dark:#f25c05; }

/* Cleaner facets: bright gloss, only a whisper of shade */
.cell.filled,
.piece-cell:not(.empty),
.ghost-cell:not(.empty) {
  background:
    linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.18) 45%, rgba(255,255,255,0)) center / 62% 62% no-repeat,
    linear-gradient(135deg, rgba(255,255,255,.9) 0 24%, rgba(255,255,255,0) 42%),
    linear-gradient(225deg, rgba(255,255,255,.4) 0 18%, rgba(255,255,255,0) 36%),
    linear-gradient(45deg, rgba(0,0,0,.16) 0 20%, rgba(0,0,0,0) 40%),
    linear-gradient(115deg, rgba(255,255,255,.22) 0 50%, rgba(0,0,0,.05) 50% 100%),
    linear-gradient(150deg, var(--gem-light) 0%, var(--gem-mid) 55%, var(--gem-dark) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.5),
    inset 0 3px 4px rgba(255,255,255,.7),
    inset 0 -4px 5px rgba(0,0,0,.18),
    0 2px 6px rgba(0,0,0,.35);
}

/* Performance pass — smooth drag on mobile, vivid jewels kept.
   Board gems keep facets; tray + drag ghost use a cheap 2-gradient gloss,
   no clip-path, no sparkle pseudo-element, no drop-shadow filter. */
.board-shell { contain: layout paint; box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.board { contain: layout paint; }
.cell.filled {
  background:
    linear-gradient(135deg, rgba(255,255,255,.8), rgba(255,255,255,.1) 45%, rgba(255,255,255,0)) center / 62% 62% no-repeat,
    linear-gradient(115deg, rgba(255,255,255,.2) 0 50%, rgba(0,0,0,.05) 50% 100%),
    linear-gradient(150deg, var(--gem-light) 0%, var(--gem-mid) 55%, var(--gem-dark) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45), inset 0 -3px 4px rgba(0,0,0,.16);
}
.cell.clearing { animation: clearPop .22s ease forwards; }
@keyframes clearPop {
  40% { transform: scale(1.15); opacity: .85; }
  100% { transform: scale(0); opacity: 0; }
}
.piece-cell:not(.empty),
.ghost-cell:not(.empty) {
  clip-path: none;
  border-radius: 22%;
  background:
    linear-gradient(135deg, rgba(255,255,255,.75), rgba(255,255,255,0) 55%),
    linear-gradient(150deg, var(--gem-light) 0%, var(--gem-mid) 55%, var(--gem-dark) 100%);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.4);
}
.piece-cell:not(.empty)::before,
.ghost-cell:not(.empty)::before { content: none; }
.ghost {
  left: 0;
  top: 0;
  filter: none;
  will-change: transform;
  transform: translate3d(-999px, -999px, 0);
}

/* Leaderboard */
.lb-tabs { display:flex; gap:8px; margin-bottom:12px; }
.lb-tab { flex:1; background:rgba(255,255,255,.06); color:var(--muted); border:1px solid rgba(255,255,255,.16); border-radius:12px; padding:9px 0; font-size:14px; font-weight:800; cursor:pointer; }
.lb-tab.active { background:var(--accent); color:#3a1e00; border-color:transparent; }
.lb-list { list-style:none; }
.lb-list li { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; font-size:15px; }
.lb-list li:nth-child(odd) { background:rgba(255,255,255,.05); }
.lb-list li.own { background:rgba(255,179,64,.22); outline:1px solid var(--accent); font-weight:800; }
.lb-rank { width:28px; text-align:center; font-weight:800; color:var(--muted); flex:none; }
.lb-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lb-mode { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); }
.lb-score { font-weight:800; }
.lb-empty { color:var(--muted); text-align:center; padding:10px 0; }
.submit-score { margin:12px 0 4px; text-align:left; }
.submit-score label { display:block; font-size:12px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:6px; }
.submit-row { display:flex; gap:8px; }
.submit-row input { flex:1; min-width:0; background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.25); border-radius:12px; padding:10px 12px; color:var(--text); font-size:16px; }
.submit-row .btn { flex:none; width:auto; margin-top:0; }
.submit-msg { font-size:13px; color:var(--muted); min-height:18px; margin-top:6px; }
