/* 共用视觉：和省赛课件一致——浅蓝底 + 常州实景地图 + 绿色电量条 + 橙色旋转/拖动按钮 */
:root {
  --sky: #ccfaff;
  --sky-deep: #8fdde8;
  --ink: #23404a;
  --ink-soft: #5d7a83;
  --green: #2fb36f;
  --green-deep: #1d7a4a;
  --cell: #7ddca0;
  --cell-hi: #b9f3cf;
  --cell-line: #2d5a45;
  --orange: #e07a3f;
  --orange-deep: #b2561f;
  --red: #e5372d;
  --panel: rgba(244, 255, 250, .94);
  --panel-line: #9fdcb6;
  --gold: #f4b52c;
  --shadow: 0 10px 24px rgba(20, 70, 90, .18), 0 2px 4px rgba(20, 70, 90, .12);
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font); color: var(--ink);
  background: linear-gradient(160deg, #e3fbff 0%, #bfeff6 60%, #a9e3ee 100%);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
button { font-family: inherit; }

/* 1600×900 舞台，等比缩放铺满屏幕 */
.stage {
  position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px;
  transform-origin: 0 0; overflow: hidden; border-radius: 28px;
  background: var(--sky) url(../assets/img/bg-cz.jpg) center / cover no-repeat;
  box-shadow: 0 30px 80px rgba(20, 70, 90, .3), 0 0 0 1px rgba(20, 70, 90, .12);
}
.stage.capturing { border-radius: 0; }
.layer { position: absolute; inset: 0; }
.pe-none { pointer-events: none; }
.pe-none > * { pointer-events: auto; }

/* ---------- 面板（和老师课件的浅绿圆角框一致） ---------- */
.panel {
  position: absolute; border-radius: 22px; background: var(--panel);
  border: 3px solid var(--panel-line); box-shadow: var(--shadow);
}
.no-badge { position: absolute; left: -14px; top: -14px; width: 40px; height: 40px; border-radius: 50%; background: #1f6fe0; color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 900; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); z-index: 3; }

/* ---------- 电量格（竖条，和老师画的分合图一样） ---------- */
.cell {
  position: relative; width: 28px; height: 64px; border-radius: 7px;
  background: linear-gradient(90deg, var(--cell-hi) 0%, var(--cell) 50%, #5cc98a 100%);
  border: 3px solid var(--cell-line);
  transition: background .25s, border-color .25s, transform .25s;
}
.bolt {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 20px; transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 20'%3E%3Cpath d='M8.5 0 1 11.5h5L4.5 20 13 7.8H7.6z' fill='%23ffd23f' stroke='%233a2a10' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cell.empty { background: rgba(255, 255, 255, .7); border-style: dashed; border-color: #7aa395; }
.cell.empty .bolt { opacity: 0; }
.cell.pop { animation: cell-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
.cell.over { background: linear-gradient(90deg, #ffb3a8, #f0614f); border-color: #a3261a; }
@keyframes cell-pop { from { transform: scale(.4); } }
.cells { display: flex; gap: 6px; align-items: flex-end; }

/* ---------- 电量卡（1～5 格） ---------- */
.ecard {
  position: relative; display: flex; gap: 4px; align-items: center; justify-content: center;
  width: 118px; height: 112px; padding: 8px 8px 26px; border-radius: 18px; cursor: grab;
  background: linear-gradient(180deg, #f2fff7, #d6f5e2); border: 3px solid #7fd1a0;
  box-shadow: 0 5px 0 #8cc9a4, 0 8px 14px rgba(20, 90, 60, .18);
}
.ecard .cell { width: 15px; height: 58px; border-width: 2px; border-radius: 5px; }
.ecard .cell .bolt { width: 9px; height: 13px; }
.ecard .tag { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); width: 26px; height: 22px; border-radius: 8px; background: #fff; border: 2px solid #7fd1a0; font-size: 16px; font-weight: 900; display: grid; place-items: center; line-height: 1; }
.ecard:active { transform: translateY(3px); }
.ecard.used { opacity: .35; filter: grayscale(.6); }

/* ---------- 测量条 ---------- */
.ruler {
  position: absolute; height: 22px; border-radius: 8px;
  background: linear-gradient(180deg, var(--cell-hi), var(--cell) 50%, #4fc485);
  border: 3px solid var(--cell-line); box-shadow: 0 4px 10px rgba(30, 80, 60, .35);
}
.ruler .bolt { width: 12px; height: 17px; }
.fr { position: absolute; height: 22px; transform-origin: 50% 50%; z-index: 12; pointer-events: auto; }
.fr .ruler { position: absolute; inset: 0; width: 100%; cursor: grab; }
.fr.snapping { transition: left .22s ease, top .22s ease, transform .22s ease; }
.fr.dragging .ruler { box-shadow: 0 10px 22px rgba(30, 80, 60, .45); }
.fr.lit .ruler { background: linear-gradient(180deg, #fff3b0, var(--gold) 55%, #e09a12); border-color: #7a4b05; }
.fr .fr-rot, .fr .fr-move {
  position: absolute; left: 50%; width: 50px; height: 50px; margin-left: -25px; border-radius: 50%; border: 3px solid #fff;
  display: none; place-items: center; color: #fff; cursor: pointer; touch-action: none;
  background: var(--orange); box-shadow: 0 4px 10px rgba(160, 70, 20, .4);
}
.fr .fr-rot { top: -66px; }
.fr .fr-move { top: 38px; cursor: grab; }
.fr .fr-rot svg, .fr .fr-move svg { width: 28px; height: 28px; }
.fr.sel .fr-rot, .fr.sel .fr-move { display: grid; }
.fr.sel .ruler { outline: 3px dashed rgba(224, 122, 63, .85); outline-offset: 5px; }

/* 测量条来源（老师课件 ① 号：测量条 + 垃圾桶） */
.ruler-src {
  position: relative; width: 140px; height: 96px; border-radius: 20px; cursor: pointer;
  background: linear-gradient(180deg, #f2fff7, #d6f5e2); border: 3px solid #7fd1a0;
  box-shadow: 0 5px 0 #8cc9a4, 0 8px 14px rgba(20, 90, 60, .18);
}
.ruler-src .ruler { left: 18px; right: 18px; top: 40px; }
.ruler-src .plus { position: absolute; right: -10px; top: -10px; width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: #fff; font-size: 30px; font-weight: 900; line-height: 34px; text-align: center; border: 3px solid #fff; }
.ruler-src:active { transform: translateY(3px); }
.trash {
  width: 96px; height: 96px; border-radius: 22px; display: grid; place-items: center;
  background: #fffaf2; border: 3px solid #e4dccd; box-shadow: 0 6px 14px rgba(20, 70, 90, .15);
  transition: transform .2s, background .2s;
}
.trash svg { width: 54px; height: 54px; }
.trash.hot { transform: scale(1.12) rotate(-6deg); background: #ffe1d8; border-color: var(--red); }

/* 出发按钮（老师课件 ② 号：绿色播放键） */
.play-btn {
  width: 150px; height: 92px; border-radius: 26px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(180deg, #4fd394, var(--green) 60%, #24985c);
  box-shadow: 0 7px 0 var(--green-deep), 0 12px 20px rgba(29, 122, 74, .35);
}
.play-btn svg { width: 54px; height: 54px; color: #fff; }
.play-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--green-deep); }
.play-btn[disabled] { opacity: .45; pointer-events: none; filter: grayscale(.5); }

.icon-btn {
  width: 60px; height: 60px; border-radius: 18px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: 0 5px 0 #a9cfd6, 0 8px 16px rgba(20, 70, 90, .18);
}
.icon-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #a9cfd6; }
.icon-btn svg { width: 30px; height: 30px; }
.submit-btn {
  width: 110px; height: 92px; border-radius: 26px; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, #5b9df5, #2f74dc 60%, #255fba); box-shadow: 0 7px 0 #1b4690, 0 12px 20px rgba(27, 70, 144, .35);
}
.submit-btn svg { width: 54px; height: 54px; }
.submit-btn[disabled] { opacity: .35; pointer-events: none; filter: grayscale(.6); }
.submit-btn.saving { animation: spin-soft 1s linear infinite; }
@keyframes spin-soft { 50% { opacity: .5; } }

/* ---------- 景点图片 ---------- */
.spot-img { position: absolute; transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 10px 12px rgba(20, 60, 80, .28)); }
.spot-img img { width: 100%; display: block; }
.spot-img .name {
  position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); white-space: nowrap;
  padding: 3px 14px; border-radius: 14px; background: rgba(255, 255, 255, .92); border: 2px solid #9fd2dc; font-size: 20px; font-weight: 900; color: var(--ink);
}

/* ---------- 小车（敞篷车俯视图，车头朝下） ---------- */
.car { position: absolute; width: 74px; height: 112px; margin: -56px 0 0 -37px; z-index: 20; pointer-events: none; }
.car-body { width: 100%; height: 100%; transition: transform .18s; }
.car-body img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .3)); }
.car.shake { animation: shake .45s ease 2; }
@keyframes shake { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }

/* 小车电池仓 */
.hud { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.hud .batt-ico { width: 26px; height: 46px; border-radius: 6px; border: 3px solid var(--cell-line); position: relative; background: #fff; }
.hud .batt-ico::before { content: ""; position: absolute; left: 6px; top: -9px; width: 8px; height: 6px; border-radius: 2px 2px 0 0; background: var(--cell-line); }
.hud .batt-ico::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 60%; border-radius: 2px; background: var(--cell); }
.hud.alarm { animation: shake .4s ease 3; border-color: var(--red); }
.cell.drain { animation: drain .5s ease; }
@keyframes drain { 50% { transform: scale(1.15); background: #ffd3cc; } }

/* ---------- 数字键 ---------- */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.key {
  height: 64px; border: 0; border-radius: 18px; cursor: pointer; font: 800 32px var(--font); color: #fff;
  background: linear-gradient(180deg, #5b9df5, #3b78dc 60%, #2f63bd); box-shadow: 0 5px 0 #23498c, 0 8px 14px rgba(35, 73, 140, .3);
}
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 #23498c; }
.key.on { background: linear-gradient(180deg, #ffd56a, var(--gold) 60%, #dc9614); color: var(--ink); box-shadow: 0 5px 0 #9b6508; }
.key.fn { background: linear-gradient(180deg, #fff, #e7f4f6); color: var(--ink); box-shadow: 0 5px 0 #a9cfd6; font-size: 26px; }

/* ---------- 全屏遮罩、卡片 ---------- */
.overlay { position: absolute; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(15, 50, 65, .55); animation: fade-in .3s ease; }
.overlay[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } }
.card {
  position: relative; background: linear-gradient(180deg, #ffffff, #effcf6); border-radius: 36px;
  box-shadow: 0 30px 70px rgba(10, 40, 55, .45), inset 0 0 0 4px rgba(255, 255, 255, .7), inset 0 0 0 7px rgba(47, 179, 111, .25);
  animation: card-in .45s cubic-bezier(.25, 1.35, .5, 1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(40px) scale(.92); } }
.close-x {
  position: absolute; right: -20px; top: -20px; z-index: 2; width: 64px; height: 64px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--ink); background: #fff; border: 3px solid #cfe7ec; box-shadow: 0 8px 18px rgba(10, 40, 55, .3);
}
.close-x svg { width: 30px; height: 30px; }

/* 进入页：选景点 / 输编号 */
.entry { width: 1180px; padding: 48px 56px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 44px; align-items: center; }
.entry .idbox {
  height: 92px; border-radius: 26px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center;
  background: #fff; font-size: 52px; font-weight: 900; letter-spacing: .12em; box-shadow: inset 0 0 0 4px #cfe7ec, inset 0 6px 12px rgba(20, 70, 90, .08);
}
.entry .idbox .ph { color: #a8c3c9; }
.entry .keypad .key { height: 66px; }
.entry-who { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; color: var(--ink-soft); }
.entry-who svg { width: 44px; height: 44px; }
.entry-who b { font-size: 26px; }
.entry-go { width: 100%; margin-top: 18px; height: 84px; border: 0; border-radius: 26px; cursor: pointer; color: #fff; display: grid; place-items: center;
  background: linear-gradient(180deg, #4fd394, var(--green) 60%, #24985c); box-shadow: 0 7px 0 var(--green-deep); }
.entry-go svg { width: 46px; height: 46px; }
.entry-go[disabled] { opacity: .4; pointer-events: none; }
.spot-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.spot-pick button {
  position: relative; border: 4px solid transparent; border-radius: 28px; padding: 10px 10px 14px; cursor: pointer; background: #fff;
  box-shadow: 0 6px 16px rgba(20, 70, 90, .14); display: grid; justify-items: center; gap: 4px; transition: transform .15s, border-color .15s;
}
.spot-pick button img { width: 82%; height: 190px; object-fit: contain; }
.spot-pick button b { font-size: 26px; }
.spot-pick button.on { border-color: var(--green); transform: scale(1.03); box-shadow: 0 10px 24px rgba(47, 179, 111, .35); }
.spot-pick button.on::after { content: "✓"; position: absolute; right: 10px; top: 8px; width: 46px; height: 46px; border-radius: 50%; background: var(--green); color: #fff; font-size: 30px; font-weight: 900; display: grid; place-items: center; }
.spot-pick button[disabled] { opacity: .3; }

/* 完成卡片 */
.finish-card { width: 820px; padding: 40px 48px; display: grid; justify-items: center; gap: 18px; text-align: center; }
.finish-card .pic { width: 380px; }
.finish-card .pic img { width: 100%; }
.finish-card video { width: 720px; max-height: 420px; border-radius: 20px; background: #000; }
.finish-card .actions { display: flex; gap: 20px; }
.check-seal { width: 96px; height: 96px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px rgba(29, 122, 74, .4); animation: card-in .5s cubic-bezier(.2, 1.6, .4, 1); }
.check-seal svg { width: 60px; height: 60px; }

.rotate-hint { position: fixed; inset: 0; z-index: 5000; display: none; place-items: center; background: #1d4553; color: #fff; font-size: 120px; }
@media (orientation: portrait) and (max-width: 900px) { .is-stage .rotate-hint { display: grid; } }

.toast { position: absolute; left: 50%; top: 40px; z-index: 1200; transform: translateX(-50%); padding: 16px 30px; border-radius: 22px; background: rgba(15, 50, 65, .88); color: #fff; font-size: 24px; font-weight: 700; }
.fx-canvas { position: absolute; inset: 0; z-index: 950; pointer-events: none; }
.bubble { position: absolute; z-index: 600; padding: 12px 20px; border-radius: 20px; background: #fff; font-size: 22px; font-weight: 700; box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; }

/* 下一步该点这里（没有声音，全靠闪光提示） */
.hint-pulse { animation: hint-pulse 1s ease-in-out infinite !important; }
@keyframes hint-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 181, 44, 0), 0 0 0 0 rgba(244, 181, 44, .8); } 50% { box-shadow: 0 0 0 6px rgba(244, 181, 44, .95), 0 0 0 18px rgba(244, 181, 44, .25); } }

.gap-mark { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; border: 5px solid var(--red); z-index: 30; pointer-events: none; animation: gap .9s ease-out infinite; }
@keyframes gap { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

.drag-ghost { position: absolute; pointer-events: none; z-index: 900; }
.drag-ghost.back { transition: left .3s ease, top .3s ease, opacity .3s ease; opacity: 0; }

/* 编号小牌 */
.sid-chip { display: inline-flex; align-items: center; gap: 6px; height: 52px; padding: 0 18px 0 12px; border-radius: 26px; background: rgba(255, 255, 255, .95); border: 2px solid #cfe7ec; font-size: 26px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 10px rgba(20, 70, 90, .14); }
.sid-chip svg { width: 30px; height: 30px; }
.sid-chip.need-id { color: var(--red); }

.stage.settled * { animation: none !important; transition: none !important; }
