:root {
  --sky-top: #1e81e8;
  --sky-bot: #4ea5ff;
  --board-bg: #f5effa;
  --board-check: #ebe1f4;
  --deck-bg: #bfa8de;
  --deck-border: #ffffff;
}
* { box-sizing: border-box; user-select: none; -webkit-user-select: none; margin: 0; padding: 0; }
body {
  background: radial-gradient(circle at center, #251d38 0%, #0f0b17 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, sans-serif;
  display: flex; justify-content: center; align-items: center; height: 100vh; overflow: hidden; position: relative;
}
.ambient-orb { position: fixed; border-radius: 50%; filter: blur(85px); opacity: 0.35; pointer-events: none; z-index: 0; }
.orb-1 { width: 360px; height: 360px; background: #ff4b72; top: -80px; left: calc(50% - 380px); }
.orb-2 { width: 380px; height: 380px; background: #00d2ff; bottom: -90px; right: calc(50% - 380px); }
#game-shell {
  width: 100%; max-width: 440px; height: 100vh; max-height: 930px;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 44%, var(--board-bg) 44%, var(--board-bg) 100%);
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; z-index: 1;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.12);
}
@media (min-width: 480px) {
  #game-shell { height: 95vh; border-radius: 32px; border: 4px solid rgba(255, 255, 255, 0.18); }
}
.sky-clouds { position: absolute; top: 0; left: 0; right: 0; height: 220px; overflow: hidden; pointer-events: none; z-index: 2; }
.cloud { position: absolute; background: rgba(255, 255, 255, 0.22); border-radius: 40px; animation: floatCloud 28s linear infinite; }
.cloud::before { content: ''; position: absolute; background: inherit; border-radius: 50%; }
.c1 { width: 90px; height: 28px; top: 52px; left: -100px; animation-duration: 32s; }
.c1::before { width: 42px; height: 42px; top: -20px; left: 14px; }
.c2 { width: 120px; height: 34px; top: 105px; left: -140px; animation-duration: 42s; animation-delay: -15s; }
.c2::before { width: 54px; height: 54px; top: -26px; left: 24px; }
.c3 { width: 75px; height: 24px; top: 28px; left: -90px; animation-duration: 25s; animation-delay: -8s; }
@keyframes floatCloud { from { transform: translateX(0); } to { transform: translateX(580px); } }
.top-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 4px; z-index: 30; position: relative; }
.nav-group { display: flex; gap: 5px; align-items: center; }
.btn-icon {
  width: 36px; height: 36px; border-radius: 50%; border: 2.2px solid #ffffff; color: #fff; font-size: 16px;
  display: flex; justify-content: center; align-items: center; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 55, 120, 0.35), 0 4px 8px rgba(0,0,0,0.25); transition: transform 0.1s;
}
.btn-icon:active, .btn-pill:active { transform: translateY(2px) scale(0.95); }
.blue-gloss { background: linear-gradient(180deg, #56ccf2 0%, #1e88e5 100%); }
.purple-gloss { background: linear-gradient(180deg, #b388ff 0%, #7c4dff 100%); }
.btn-pill {
  padding: 5px 9px; border-radius: 16px; border: 2px solid #ffffff; font-size: 11px; font-weight: 900; color: #fff;
  cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,0.22), 0 4px 8px rgba(0,0,0,0.2); transition: transform 0.1s;
}
.gold-gloss { background: linear-gradient(180deg, #ffe066 0%, #ff9f1c 100%); color: #4a2300; }
.pink-gloss { background: linear-gradient(180deg, #ff85a1 0%, #ff477e 100%); }
.ai-gloss { background: linear-gradient(180deg, #7efce0 0%, #00b894 100%); color: #00382b; }
.ai-gloss.active { background: linear-gradient(180deg, #ff5e7e 0%, #ff0844 100%); color: #fff; animation: pulse 1.1s infinite; }
.level-plank {
  background: linear-gradient(180deg, #ffffff 0%, #ffe3f1 100%); border: 2.5px solid #ff75a0; border-radius: 18px;
  padding: 3px 14px 5px; text-align: center; box-shadow: 0 4px 0 #d94b78, 0 6px 12px rgba(0,0,0,0.25); cursor: pointer; min-width: 142px;
}
.plank-title { font-size: 14px; font-weight: 900; color: #d62259; letter-spacing: 0.5px; text-shadow: 0 1px 0 #ffffff; }
.plank-progress-box {
  width: 122px; height: 14px; background: #543846; border-radius: 9px; overflow: hidden; position: relative;
  margin: 2px auto 0; border: 1.2px solid #ffffff; box-shadow: inset 0 2px 3px rgba(0,0,0,0.4);
}
.plank-progress-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #2ed573, #7bed9f); transition: width 0.15s ease; }
.plank-progress-txt { position: absolute; inset: 0; font-size: 9.5px; font-weight: 900; color: #ffffff; line-height: 12px; text-shadow: 0 1px 2px #000000; }
.floating-drawer {
  position: absolute; top: 58px; left: 12px; right: 12px; background: rgba(24, 18, 38, 0.96); color: #fff;
  border: 2px solid #ffd166; border-radius: 18px; padding: 12px 14px; z-index: 90; display: none;
  box-shadow: 0 14px 35px rgba(0,0,0,0.7); backdrop-filter: blur(8px);
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 900; color: #ffd166;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.15);
}
.drawer-close { background: none; border: none; color: #fff; font-size: 15px; cursor: pointer; }
.param-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; font-size: 11px; font-weight: bold; }
.param-item input[type="range"] { width: 145px; accent-color: #2ed573; cursor: pointer; }
.val-tag { color: #7efce0; font-family: monospace; min-width: 58px; text-align: right; }
.preset-row { display: flex; gap: 6px; margin-top: 8px; }
.chip-btn {
  flex: 1; padding: 5px 0; border-radius: 8px; border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1); color: #fff; font-size: 11px; font-weight: bold; cursor: pointer;
}
.chip-btn.active { background: #2ed573; color: #083b1a; border-color: #fff; }
.chip-btn.skin-switch { background: linear-gradient(135deg, #ff758c, #ff7eb3); border-color: #fff; }
#stage-wrap { position: relative; flex: 1; width: 100%; min-height: 410px; z-index: 10; }
canvas#gameCanvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.queue-deck {
  background: linear-gradient(180deg, #cbb5e8 0%, #b399d9 100%); border-top: 3.5px solid var(--deck-border);
  padding: 12px 10px 8px; height: 184px; overflow: hidden; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; z-index: 20;
  box-shadow: inset 0 6px 12px rgba(65, 35, 105, 0.18);
}
.queue-col { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.q-block {
  width: 100%; max-width: 64px; height: 49px; border-radius: 12px; display: flex; justify-content: center; align-items: center;
  font-size: 20px; font-weight: 900; color: #ffffff; text-shadow: 0 2px 2px rgba(0, 0, 0, 0.45); position: relative;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1); opacity: 0.8; transform: scale(0.92);
}
.q-block.top-clickable { opacity: 1; transform: scale(1); border: 2.5px solid #ffffff; cursor: pointer; }
.q-block.top-clickable:hover { transform: scale(1.04) translateY(-1px); }
.q-block.top-clickable:active { transform: scale(0.92) translateY(3px); }
.q-block.pick-mode { opacity: 1; transform: scale(0.98); border: 2.5px dashed #fff200; cursor: pointer; animation: pulse 0.8s infinite; }
.ai-best-glow { box-shadow: 0 0 15px 4px #00e676 !important; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.bottom-dock {
  background: linear-gradient(180deg, #ffe4b5 0%, #48b8f7 32%, #1988dc 100%); padding: 6px 12px 10px;
  display: flex; justify-content: space-around; align-items: center; z-index: 20; border-top: 2.5px solid #ffffff;
}
.dock-item { display: flex; flex-direction: column; align-items: center; cursor: pointer; position: relative; }
.dock-orb {
  width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #5b7894, #253747);
  border: 3px solid #a3bcd4; box-shadow: 0 4px 0 rgba(12, 28, 46, 0.45), 0 5px 8px rgba(0,0,0,0.3);
  display: flex; justify-content: center; align-items: center; transition: transform 0.12s;
}
.dock-item:active .dock-orb { transform: scale(0.9) translateY(2px); }
.dock-orb.active-3x { background: radial-gradient(circle at 30% 30%, #4facfe, #00f2fe); border-color: #ffffff; animation: pulse 0.9s infinite; }
.orb-ico { font-size: 16px; font-weight: 900; color: #fff; }
.dock-txt { margin-top: 3px; font-size: 10.5px; font-weight: 900; color: #ffffff; text-shadow: 0 1px 3px rgba(0, 30, 65, 0.85); }
.dock-badge {
  position: absolute; top: -2px; right: -2px; background: linear-gradient(180deg, #ff5e62, #ff2a2a);
  color: #fff; font-size: 10px; font-weight: 900; width: 18px; height: 18px; border-radius: 50%;
  display: flex; justify-content: center; align-items: center; border: 1.5px solid #ffffff; box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.modal-mask {
  position: absolute; inset: 0; background: rgba(16, 10, 28, 0.78); display: none;
  justify-content: center; align-items: center; z-index: 100; backdrop-filter: blur(5px);
}
.modal-dialog {
  background: #ffffff; width: 92%; max-width: 390px; max-height: 88vh; border-radius: 24px;
  padding: 20px 16px; text-align: center; box-shadow: 0 18px 45px rgba(0,0,0,0.55); overflow-y: auto;
}
.modal-title { font-size: 20px; font-weight: 900; color: #2c2238; margin-bottom: 6px; }
.modal-desc { font-size: 12.5px; color: #5a5266; margin-bottom: 14px; line-height: 1.5; }
.modal-btn {
  background: linear-gradient(180deg, #ff758c 0%, #ff4b72 100%); color: #fff; border: 2px solid #fff;
  padding: 9px 22px; border-radius: 20px; font-size: 13.5px; font-weight: 900; cursor: pointer; margin: 4px;
  box-shadow: 0 4px 0 #c92a4e, 0 5px 12px rgba(255,75,114,0.4);
}
.modal-btn.secondary { background: linear-gradient(180deg, #8e78ff 0%, #6c5ce7 100%); box-shadow: 0 4px 0 #4834d4, 0 5px 12px rgba(108,92,231,0.35); }
.modal-btn.green { background: linear-gradient(180deg, #2ed573 0%, #10ac84 100%); box-shadow: 0 4px 0 #077558, 0 5px 12px rgba(16,172,132,0.35); }
.lvl-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 220px; overflow-y: auto; margin-bottom: 12px; padding: 4px; }
.lvl-cell { padding: 7px 0; background: #f2ecf9; border-radius: 9px; font-size: 12px; font-weight: 800; color: #4a3f59; cursor: pointer; }
.lvl-cell.active { background: #ff4b72; color: #fff; }
.editor-box { background: #f8f5fc; border-radius: 14px; padding: 10px; margin-bottom: 10px; text-align: left; border: 1px solid #e5dcf0; }
.ed-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; font-weight: bold; color: #444; }
.ed-row input[type="text"] { padding: 4px 8px; border-radius: 6px; border: 1px solid #ccc; width: 140px; font-size: 12px; }
#editorCanvasWrap { width: 100%; background: #26222e; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; }
canvas#editorCanvas { background-color: #302b3a; border: 1px solid #555; border-radius: 4px; max-width: 100%; }
.upload-label { display: inline-block; padding: 6px 12px; background: #6c5ce7; color: #fff; border-radius: 14px; font-size: 12px; font-weight: bold; cursor: pointer; }