* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; touch-action: none;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; color: #17405e; }
body { background: linear-gradient(180deg, #bfe6ff 0%, #e8f7ff 55%, #ffffff 100%); }
#game { position: fixed; inset: 0; display: flex; align-items: center; gap: 2vmin; padding: 2vmin 3vmin; }
#side { width: 27%; max-width: 280px; display: flex; flex-direction: column; gap: 1.6vmin; }
.logo { font-size: clamp(20px, 5.4vmin, 34px); font-weight: 900; color: #FF8A3D; text-shadow: 0 2px 0 #fff, 0 4px 0 #ffd2b0; letter-spacing: 2px; }
.stat { display: flex; justify-content: space-between; align-items: center; padding: 1.4vmin 2vmin; border-radius: 14px;
  background: rgba(255,255,255,.85); box-shadow: 0 3px 0 #b9dcf2; font-size: clamp(13px, 3.4vmin, 20px); }
.stat b { font-size: clamp(18px, 4.6vmin, 28px); color: #FF8A3D; }
.bar { height: 1.8vmin; min-height: 8px; border-radius: 99px; background: rgba(255,255,255,.8); box-shadow: inset 0 1px 3px #9cc7e2; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ffb36b, #FF8A3D); transition: width .3s; }
.btn { border: 0; cursor: pointer; font-weight: 800; color: #fff; background: #FF8A3D; border-radius: 16px;
  padding: 2vmin 6vmin; font-size: clamp(16px, 4.4vmin, 24px); box-shadow: 0 5px 0 #d96a1f; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #d96a1f; }
.btn.small { padding: 1.4vmin 3vmin; font-size: clamp(13px, 3.4vmin, 18px); background: #4aa8e8; box-shadow: 0 4px 0 #2f84be; }
#stage { flex: 1; height: 100%; display: flex; align-items: center; justify-content: center; min-width: 0; }
#board { position: relative; aspect-ratio: 1 / 1; height: min(94vh, 100%); max-width: 100%; border-radius: 22px; padding: 1.2%;
  background: linear-gradient(160deg, #e9f8ff, #aee0fb); border: 4px solid #fff; box-shadow: 0 8px 0 #8ec4e3, 0 14px 30px rgba(60,120,170,.35); }
#board .cells { position: absolute; inset: 1.2%; overflow: hidden; border-radius: 14px; }
.p { position: absolute; width: 12.5%; height: 12.5%; transition: top .28s cubic-bezier(.4,.1,.6,1), left .2s ease; }
.p .g { position: absolute; inset: 9%; transition: transform .22s, opacity .22s; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14), inset 0 3px 0 rgba(255,255,255,.55); }
.p .g::after { content: ""; position: absolute; left: 22%; top: 16%; width: 22%; height: 14%; border-radius: 50%; background: rgba(255,255,255,.8); transform: rotate(-30deg); }
.p.sel .g { transform: scale(1.16); filter: drop-shadow(0 0 6px #fff); }
.p.clr .g { transform: scale(0); opacity: 0; }
.t0 .g { background: linear-gradient(145deg, #7fd4ff, #2b8fe0); border-radius: 50%; }
.t1 .g { background: linear-gradient(145deg, #ffffff, #bfe3f5); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.t2 .g { background: linear-gradient(145deg, #c9a6ff, #7a4fd6); clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.t3 .g { background: linear-gradient(145deg, #ffb3cf, #ee5f93); border-radius: 30%; }
.t4 .g { background: linear-gradient(145deg, #ffd27a, #ff9a2e); clip-path: polygon(50% 0, 100% 90%, 0 90%); }
.t5 .g { background: linear-gradient(145deg, #9af0c8, #2fbf86); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.t1 .g::after, .t4 .g::after, .t5 .g::after { display: none; }
#overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(20,60,100,.45); z-index: 9; }
#overlay.show { display: flex; }
.panel { text-align: center; padding: 4vmin 8vmin; border-radius: 26px; background: linear-gradient(180deg, #fff, #e6f6ff); border: 4px solid #fff; box-shadow: 0 8px 0 #8ec4e3, 0 20px 40px rgba(0,0,0,.25); }
.panel h1 { margin: 0 0 1vmin; font-size: clamp(28px, 9vmin, 56px); color: #FF8A3D; text-shadow: 0 3px 0 #ffd2b0; }
.panel p { margin: 0 0 3vmin; font-size: clamp(14px, 3.8vmin, 22px); }
