/* ============================================================
   宝宝的小镇 · 马里奥式厚描边卡通 UI
   ============================================================ */
:root{
  --ink:#4a3527;
  --ink-2:#6b5342;
  --cream:#fff8ea;
  --cream-2:#ffedcd;
  --paper:#fffdf6;
  --gold:#ffc94a;
  --gold-deep:#e8a219;
  --pink:#ff8fb1;
  --green:#7ed957;
  --shadow-hard:0 6px 0 rgba(74,53,39,.85);
  --shadow-soft:0 10px 30px rgba(74,53,39,.22);
  --font:"Nunito","PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,-apple-system,sans-serif;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{
  margin:0;padding:0;width:100%;height:100%;overflow:hidden;
  font-family:var(--font);color:var(--ink);
  background:linear-gradient(180deg,#c8ecff 0%,#eaf9ff 60%,#fff8ea 100%);
  -webkit-font-smoothing:antialiased;
  user-select:none;
}
canvas{display:block}
#gameCanvas{position:fixed;inset:0;touch-action:none}

/* ==================== 通用面板 ==================== */
.hud-card,.minimap,.start-card,.helper,.room,.mini-card,.end-card{
  background:var(--cream);
  border:3px solid var(--ink);
  border-radius:20px;
  box-shadow:var(--shadow-hard), var(--shadow-soft);
}
.primary-btn{
  border:3px solid var(--ink);
  border-radius:16px;
  padding:13px 30px;
  font-family:var(--font);
  font-size:18px;
  font-weight:900;
  letter-spacing:1px;
  color:#5a3200;
  background:linear-gradient(180deg,#ffdc6b,#ffbd2e);
  box-shadow:0 6px 0 var(--gold-deep), 0 9px 16px rgba(74,53,39,.22);
  cursor:pointer;
  transition:transform .09s ease, box-shadow .09s ease, filter .15s;
}
.primary-btn:hover{filter:brightness(1.06)}
.primary-btn:active{transform:translateY(5px);box-shadow:0 1px 0 var(--gold-deep)}
.primary-btn.small{padding:10px 22px;font-size:15px;border-radius:13px}
.ghost-btn{
  border:3px solid var(--ink);
  border-radius:13px;
  padding:9px 18px;
  font-family:var(--font);
  font-size:14px;
  font-weight:800;
  color:var(--ink);
  background:#fff;
  box-shadow:0 4px 0 rgba(74,53,39,.8);
  cursor:pointer;
  transition:transform .09s, box-shadow .09s;
}
.ghost-btn:active{transform:translateY(4px);box-shadow:0 0 0 rgba(0,0,0,0)}
.icon-btn{
  width:44px;height:44px;
  border:3px solid var(--ink);
  border-radius:14px;
  background:var(--cream);
  box-shadow:0 4px 0 rgba(74,53,39,.8);
  font-size:18px;line-height:1;
  cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:transform .09s, box-shadow .09s, background .15s;
}
.icon-btn:active{transform:translateY(4px);box-shadow:0 0 0 rgba(0,0,0,0)}
.icon-btn.off{opacity:.45;filter:grayscale(1)}

/* ==================== HUD ==================== */
.hud{position:fixed;inset:0;pointer-events:none;z-index:12}
.hud-card{
  position:absolute;top:16px;left:16px;
  display:flex;align-items:center;gap:12px;
  padding:9px 16px 9px 10px;
  border-radius:22px;
  pointer-events:auto;
}
.avatar-frame{
  width:52px;height:60px;
  border:3px solid var(--ink);
  border-radius:14px;
  background:linear-gradient(180deg,#cdefff,#eafaff);
  overflow:hidden;
  display:flex;align-items:flex-end;justify-content:center;
}
.avatar-frame canvas{width:52px;height:60px}
.hud-info{display:flex;flex-direction:column;gap:5px}
.hud-name{font-size:16px;font-weight:900;letter-spacing:.5px;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.key-pips{display:flex;gap:5px}
.pip{
  width:22px;height:22px;
  display:flex;align-items:center;justify-content:center;
  border-radius:8px;
  background:#e9ded0;
  border:2px solid var(--ink);
  transition:.25s;
}
.pip svg{width:14px;height:14px;color:#a89a8c}
.pip.on{box-shadow:0 0 0 2px rgba(255,255,255,.9) inset, 0 0 10px currentColor}
.pip.on svg{color:currentColor}

.hud-actions{
  position:absolute;top:16px;right:16px;
  display:flex;gap:9px;
  pointer-events:auto;
}
.minimap{
  position:absolute;right:16px;bottom:16px;
  padding:7px 7px 4px;
  border-radius:18px;
  pointer-events:none;
  background:rgba(255,248,234,.86);
}
#minimap{width:180px;height:123px;border-radius:12px}
.minimap-label{
  text-align:center;font-size:12px;font-weight:800;
  letter-spacing:.5px;padding:2px 0 2px;color:var(--ink-2);
}

/* ==================== toast ==================== */
.toast{
  position:fixed;left:50%;top:96px;
  transform:translate(-50%,-16px);
  padding:11px 24px;
  background:var(--cream);
  border:3px solid var(--ink);
  border-radius:16px;
  box-shadow:0 5px 0 rgba(74,53,39,.8);
  font-size:15px;font-weight:800;
  opacity:0;pointer-events:none;
  transition:opacity .25s, transform .25s;
  z-index:60;white-space:nowrap;
}
.toast.show{opacity:1;transform:translate(-50%,0)}

/* ==================== 开场 / 弹层 ==================== */
.screen{
  position:fixed;inset:0;z-index:40;
  display:none;align-items:center;justify-content:center;
  padding:18px;
  background:rgba(120,190,230,.42);
  backdrop-filter:blur(7px) saturate(1.1);
  -webkit-backdrop-filter:blur(7px) saturate(1.1);
}
.screen.show{display:flex;animation:fadeIn .28s ease}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

.start-card{
  position:relative;
  width:min(560px,100%);
  max-height:calc(100vh - 36px);
  overflow-y:auto;
  padding:26px 28px 22px;
  text-align:center;
  border-radius:28px;
  animation:popIn .45s cubic-bezier(.2,1.5,.5,1);
}
@keyframes popIn{from{transform:scale(.9) translateY(14px);opacity:0}to{transform:scale(1) translateY(0);opacity:1}}
.start-card::before{
  content:"";
  position:absolute;inset:8px;
  border:2px dashed rgba(74,53,39,.16);
  border-radius:22px;pointer-events:none;
}
.tag{
  display:inline-block;
  font-size:11px;font-weight:900;letter-spacing:3px;
  color:#8a6a4c;
  background:#ffe9c2;
  border:2px solid var(--ink);
  border-radius:99px;
  padding:3px 12px;
}
.start-card h1{
  margin:12px 0 6px;
  font-size:clamp(32px,7vw,46px);
  font-weight:900;letter-spacing:5px;
  color:#5a3a24;
  text-shadow:0 2px 0 #fff, 0 5px 0 rgba(255,201,74,.55), 0 8px 12px rgba(74,53,39,.2);
}
.start-sub{margin:0 0 18px;font-size:13.5px;color:var(--ink-2);font-weight:700;line-height:1.6}
.field{display:block;text-align:left;margin:0 4px 16px}
.field-label{display:block;font-size:13px;font-weight:800;color:var(--ink-2);margin:0 0 7px 4px}
.name-input{
  width:100%;
  padding:13px 16px;
  font-family:var(--font);
  font-size:17px;font-weight:800;
  text-align:center;
  color:var(--ink);
  background:var(--paper);
  border:3px solid var(--ink);
  border-radius:14px;
  box-shadow:inset 0 3px 0 rgba(74,53,39,.09);
  outline:none;
}
.name-input:focus{border-color:#ff9f43;box-shadow:0 0 0 4px rgba(255,201,74,.35), inset 0 3px 0 rgba(74,53,39,.09)}

.avatar-pick{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:0 4px 18px}
.avatar-card{
  position:relative;
  display:flex;flex-direction:column;align-items:center;gap:4px;
  padding:8px 8px 10px;
  background:#fff6e2;
  border:3px solid rgba(74,53,39,.35);
  border-radius:18px;
  cursor:pointer;
  transition:transform .12s, border-color .15s, background .15s, box-shadow .15s;
}
.avatar-card .avatar-preview{width:84px;height:104px}
.avatar-card .avatar-name{font-size:12.5px;font-weight:800;color:var(--ink-2)}
.avatar-card.active{
  border-color:var(--ink);
  background:#fff1cf;
  box-shadow:0 4px 0 rgba(74,53,39,.75);
  transform:translateY(-2px);
}
.avatar-card.active::after{
  content:"✓";
  position:absolute;top:-9px;right:-9px;
  width:26px;height:26px;border-radius:50%;
  background:var(--green);
  border:3px solid var(--ink);
  color:#fff;font-size:13px;font-weight:900;
  display:flex;align-items:center;justify-content:center;
}
.start-hint{margin:14px 0 0;font-size:12px;color:#8a7561;font-weight:700;line-height:1.7}

/* ==================== 玩法说明 ==================== */
.helper{
  width:min(560px,100%);
  max-height:calc(100vh - 36px);
  overflow-y:auto;
  padding:24px 26px 20px;
  border-radius:26px;
  animation:popIn .35s cubic-bezier(.2,1.5,.5,1);
}
.helper h2{margin:0 0 14px;font-size:24px;font-weight:900;letter-spacing:2px;text-align:center}
.help-list{margin:0 0 16px;padding:0;list-style:none}
.help-list li{
  font-size:14.5px;line-height:1.55;font-weight:600;
  padding:9px 12px 9px 14px;
  margin-bottom:7px;
  background:#fffdf4;
  border:2px solid rgba(74,53,39,.16);
  border-radius:12px;
}
.help-list b{display:inline-block;min-width:56px;color:#b06a1c}
kbd{
  display:inline-block;padding:1px 7px;margin:0 1px;
  border:2px solid var(--ink);border-radius:7px;
  background:#fff;box-shadow:0 2px 0 rgba(74,53,39,.6);
  font-family:var(--font);font-size:12px;font-weight:900;
}
.help-legend{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-bottom:16px}
.legend-item{
  display:flex;align-items:center;gap:5px;
  font-size:11.5px;font-weight:800;
  padding:4px 9px;border-radius:99px;
  background:#fff;border:2px solid var(--ink);
}
.legend-dot{width:11px;height:11px;border-radius:50%;border:2px solid var(--ink);display:inline-block}
.helper-actions{display:flex;gap:10px;justify-content:space-between;align-items:center;flex-wrap:wrap}

/* ==================== 房间弹窗 ==================== */
.room{
  width:min(760px,100%);
  max-height:calc(100vh - 36px);
  overflow-y:auto;
  padding:22px 24px 20px;
  border-radius:26px;
  animation:popIn .38s cubic-bezier(.2,1.5,.5,1);
}
.room-head{display:flex;align-items:center;gap:13px;margin-bottom:16px}
.room-badge{
  width:52px;height:52px;flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;
  border:3px solid var(--ink);border-radius:16px;
  background:var(--accent,#ffd24a);
  box-shadow:0 4px 0 rgba(74,53,39,.7);
  font-size:24px;
}
.room-head h2{margin:0;font-size:22px;font-weight:900;letter-spacing:1.5px}
.room-sub{margin:3px 0 0;font-size:12.5px;font-weight:700;color:var(--ink-2)}
.room-close{
  margin-left:auto;
  width:38px;height:38px;
  border:3px solid var(--ink);border-radius:12px;
  background:#fff;box-shadow:0 3px 0 rgba(74,53,39,.7);
  font-size:15px;font-weight:900;cursor:pointer;
}
.room-close:active{transform:translateY(3px);box-shadow:none}

/* 情书 */
.letter{
  background:var(--paper);
  border:2px solid rgba(74,53,39,.2);
  border-radius:16px;
  padding:20px 22px;
  box-shadow:inset 0 0 0 1px #fff, 0 4px 0 rgba(74,53,39,.08);
  background-image:repeating-linear-gradient(180deg,transparent 0 30px,rgba(120,150,190,.13) 30px 31px);
}
.letter p{margin:0 0 18px;font-size:15px;line-height:2;font-weight:600;color:#463322;opacity:0;animation:lineIn .5s ease forwards}
.letter p:nth-child(1){animation-delay:.05s}
.letter p:nth-child(2){animation-delay:.2s}
.letter p:nth-child(3){animation-delay:.35s}
.letter p:nth-child(4){animation-delay:.5s}
.letter p:nth-child(5){animation-delay:.65s}
.letter p:nth-child(6){animation-delay:.8s}
@keyframes lineIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.letter .sign{
  text-align:right;font-style:italic;font-weight:900;
  color:#a2601f;margin-bottom:0;
}
.letter .heart-line{text-align:center;letter-spacing:6px;color:#e8859f;font-size:13px;margin-top:-6px}

/* 相册 */
.album-stage{
  position:relative;
  width:100%;
  height:min(54vh,430px);
  border:3px solid var(--ink);
  border-radius:18px;
  overflow:hidden;
  background:radial-gradient(circle at 50% 40%, #4a4038, #2b2520);
  box-shadow:inset 0 0 0 3px rgba(255,255,255,.12);
  touch-action:pan-y;
  cursor:grab;
}
.album-stage:active{cursor:grabbing}
.album-track{
  display:flex;
  height:100%;
  will-change:transform;
  transition:transform .62s cubic-bezier(.22,.9,.28,1);
}
.album-cell{
  min-width:100%;
  height:100%;
  display:flex;align-items:center;justify-content:center;
  padding:12px;
}
.album-cell img{
  max-width:100%;max-height:100%;
  width:auto;height:auto;
  object-fit:contain;
  border-radius:10px;
  background:#201c18;
  box-shadow:0 10px 26px rgba(0,0,0,.45);
  pointer-events:none;
}
/* 文字放在照片下面，永远不会被照片压住 */
.album-cap{
  margin:12px 4px 0;
  min-height:44px;
  display:flex;align-items:center;justify-content:center;
  padding:6px 14px;
  font-size:14px;font-weight:800;color:#5a3a24;
  text-align:center;line-height:1.55;
  background:#fffdf4;
  border:2px dashed rgba(74,53,39,.22);
  border-radius:12px;
}
.album-count{
  position:absolute;top:12px;right:12px;
  padding:3px 10px;border-radius:99px;
  background:rgba(0,0,0,.45);
  color:#fff;font-size:11.5px;font-weight:800;
  border:2px solid rgba(255,255,255,.5);
}
.nav{
  position:absolute;top:50%;transform:translateY(-50%);
  width:42px;height:42px;border-radius:50%;
  border:3px solid var(--ink);
  background:rgba(255,248,234,.92);
  color:var(--ink);font-size:22px;font-weight:900;line-height:1;
  cursor:pointer;box-shadow:0 3px 0 rgba(0,0,0,.35);
  display:flex;align-items:center;justify-content:center;
  padding-bottom:5px;
}
.nav:active{transform:translateY(calc(-50% + 3px));box-shadow:none}
.nav.prev{left:10px}
.nav.next{right:10px}
.album-thumbs{display:flex;gap:7px;margin-top:11px;justify-content:center;flex-wrap:wrap}
.album-thumbs button{
  width:54px;height:54px;padding:0;
  border:3px solid rgba(74,53,39,.3);
  border-radius:11px;overflow:hidden;cursor:pointer;
  background:#ddd;opacity:.6;transition:.2s;
}
.album-thumbs button.active{border-color:var(--ink);opacity:1;transform:translateY(-2px)}
.album-thumbs img{width:100%;height:100%;object-fit:cover;display:block}
.album-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px;flex-wrap:wrap}
.chip-btn{
  border:3px solid var(--ink);border-radius:99px;
  padding:6px 14px;font-family:var(--font);font-size:12.5px;font-weight:800;
  background:#fff;box-shadow:0 3px 0 rgba(74,53,39,.7);cursor:pointer;
}
.chip-btn:active{transform:translateY(3px);box-shadow:none}
.album-tip{font-size:11.5px;font-weight:700;color:#8a7561}

/* 计时 */
.timer-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:6px 0 18px}
.timer-box{
  text-align:center;
  padding:10px 4px 8px;
  background:#fffdf4;
  border:3px solid var(--ink);
  border-radius:16px;
  box-shadow:0 4px 0 rgba(74,53,39,.7);
}
.timer-box b{
  display:block;font-size:clamp(21px,5vw,32px);font-weight:900;
  font-variant-numeric:tabular-nums;letter-spacing:0;color:#3f6fd8;
  text-shadow:0 2px 0 rgba(63,111,216,.18);
}
.timer-box span{font-size:11.5px;font-weight:800;color:var(--ink-2);letter-spacing:2px}

/* 表白小屋 · 门锁问答 */
.quiz-progress{display:flex;align-items:center;gap:10px;margin:2px 0 16px;font-size:12px;font-weight:800;color:#8a7561}
#quizStep{flex:0 0 auto}
.quiz-bar{flex:1;height:10px;border:2.5px solid var(--ink);border-radius:99px;background:#eee1cb;overflow:hidden}
.quiz-bar i{display:block;height:100%;background:linear-gradient(90deg,#ffd24a,#ff9f43);transition:width .4s}
.quiz-q{font-size:17px;font-weight:800;line-height:1.75;margin:2px 0 16px;color:#463322}
.quiz-row{display:flex;gap:8px}
.quiz-input{flex:1;min-width:0;text-align:left;padding:12px 14px;font-size:15px}
.quiz-feedback{min-height:22px;margin:10px 2px 0;font-size:13.5px;font-weight:800;color:#c0392b}
.quiz-feedback.ok{color:#2e9e5b}
.quiz-tip{margin:4px 2px 0;font-size:11.5px;font-weight:700;color:#a3927f;line-height:1.6}
.quiz.shake{animation:shakeX .34s}
@keyframes shakeX{
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-9px)}
  50%{transform:translateX(9px)}
  80%{transform:translateX(-5px)}
}
.quiz-done{text-align:center;padding:26px 10px 18px}
.quiz-done-badge{font-size:52px;line-height:1;animation:popIn .5s cubic-bezier(.2,1.5,.5,1)}
.quiz-done h2{margin:10px 0 8px;font-size:23px;font-weight:900;letter-spacing:2px}
.quiz-done p{margin:0;font-size:13.5px;font-weight:700;color:#8a7561}
.timer-since{
  text-align:center;margin:0 0 8px;
  font-size:12.5px;font-weight:800;color:#4a6fbf;
  letter-spacing:.3px;line-height:1.6;
}
.timer-since b{color:#2f55ac;font-weight:900}
.whisper{text-align:center;font-size:13px;font-weight:700;color:#8a7561;font-style:italic;margin:0}

/* 音乐 */
.tracks{display:grid;gap:10px;margin-bottom:14px}
.track{
  display:flex;align-items:center;gap:12px;
  padding:11px 13px;
  background:#fffdf4;
  border:3px solid rgba(74,53,39,.24);
  border-radius:16px;
  transition:.2s;
}
.track.playing{border-color:var(--ink);box-shadow:0 4px 0 rgba(74,53,39,.7);background:#fff6e0}
.track-art{
  width:48px;height:48px;flex:0 0 auto;
  border:3px solid var(--ink);border-radius:13px;
  display:flex;align-items:center;justify-content:center;
  font-size:22px;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.3);
}
.track-meta{flex:1;min-width:0}
.track-title{font-size:15px;font-weight:900;letter-spacing:.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.track-sub{font-size:11.5px;font-weight:700;color:#8a7561;margin-top:2px}
.track-play{
  width:42px;height:42px;flex:0 0 auto;
  border:3px solid var(--ink);border-radius:50%;
  background:var(--gold);color:var(--ink);
  font-size:15px;font-weight:900;cursor:pointer;
  box-shadow:0 3px 0 rgba(74,53,39,.7);
  display:flex;align-items:center;justify-content:center;
}
.track-play:active{transform:translateY(3px);box-shadow:none}
.track-progress{
  position:relative;
  height:12px;border-radius:99px;
  background:#e8dcc7;
  border:2px solid rgba(74,53,39,.35);
  overflow:hidden;margin-top:7px;
  cursor:pointer;
  transition:background .15s;
}
.track-progress:hover{background:#e0d0b4}
.track-progress i{display:block;height:100%;width:0;background:linear-gradient(90deg,#ffd24a,#ff9f43);transition:width .12s linear}
.music-note{
  font-size:11.5px;font-weight:700;color:#8a7561;line-height:1.7;margin:0;
}
.music-note code{
  background:#fff;border:2px solid rgba(74,53,39,.25);border-radius:6px;
  padding:1px 5px;font-size:11px;
}
.music-fallback{margin-top:12px;display:none}
.music-fallback.show{display:block}
.music-fallback .fb-title{font-size:12.5px;font-weight:800;color:#a2601f;margin-bottom:8px}
.music-fallback iframe{width:100%;border:0;border-radius:10px;background:#fff}
.netease-link{
  display:inline-flex;align-items:center;gap:6px;
  font-size:12.5px;font-weight:800;color:#c0392b;
  text-decoration:none;border-bottom:2px dashed rgba(192,57,43,.4);
  padding-bottom:1px;
}

/* 心愿清单 */
.wish-add{display:flex;gap:8px;margin:2px 0 14px}
.wish-input{
  flex:1;min-width:0;
  padding:11px 15px;
  font-family:var(--font);font-size:14px;font-weight:700;
  color:var(--ink);
  background:#fffdf4;
  border:3px solid var(--ink);border-radius:13px;
  box-shadow:inset 0 2px 0 rgba(74,53,39,.08);
  outline:none;
}
.wish-input:focus{border-color:#ff9f43;box-shadow:0 0 0 4px rgba(255,201,74,.3), inset 0 2px 0 rgba(74,53,39,.08)}
.wish-input::placeholder{color:#b3a291;font-weight:600;font-size:13px}
.wish-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-bottom:14px}
.wish-item{
  display:flex;align-items:center;gap:8px;
  font-size:12.8px;font-weight:700;
  padding:7px 10px;
  background:#fffdf4;
  border:2px solid rgba(74,53,39,.16);
  border-radius:11px;
  cursor:pointer;
  transition:.15s;
}
.wish-item:hover{border-color:rgba(74,53,39,.35)}
.wish-item.custom{background:#fff6ec;border-color:rgba(255,143,177,.55)}
.wish-item .txt{flex:1;min-width:0;word-break:break-word}
.wish-del{
  flex:0 0 auto;
  width:20px;height:20px;
  padding:0;border:none;border-radius:50%;
  background:rgba(74,53,39,.1);
  color:#8a7561;font-size:13px;font-weight:900;line-height:1;
  cursor:pointer;
  display:flex;align-items:center;justify-content:center;
}
.wish-del:hover{background:#ff8fb1;color:#fff}
.wish-item .box{
  width:19px;height:19px;flex:0 0 auto;
  border:2.5px solid var(--ink);border-radius:5px;
  background:#fff;position:relative;
}
.wish-item.done{color:#9a8b7c}
.wish-item.done .box{background:var(--green)}
.wish-item.done .box::after{
  content:"✓";position:absolute;inset:0;
  color:#fff;font-size:13px;font-weight:900;
  display:flex;align-items:center;justify-content:center;
}
.wish-item.done .txt{text-decoration:line-through}
.wish-progress{display:flex;align-items:center;gap:10px;font-size:12.5px;font-weight:800;color:var(--ink-2)}
.wish-bar{flex:1;height:12px;border:2.5px solid var(--ink);border-radius:99px;background:#eee1cb;overflow:hidden}
.wish-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#7ed957,#4fc3a1);transition:width .4s}

/* ==================== 改名 ==================== */
.mini-card{
  width:min(360px,100%);
  padding:22px;
  border-radius:22px;
  text-align:center;
  animation:popIn .3s cubic-bezier(.2,1.5,.5,1);
}
.mini-card h3{margin:0 0 14px;font-size:19px;font-weight:900;letter-spacing:1px}
.mini-actions{display:flex;gap:9px;justify-content:center;margin-top:14px}

/* ==================== 结局 ==================== */
.end-screen{background:rgba(38,26,42,.66);z-index:70}
#fireworks{position:absolute;inset:0;width:100%;height:100%}
.end-card{
  position:relative;z-index:2;
  width:min(560px,100%);
  max-height:calc(100vh - 40px);
  overflow-y:auto;
  padding:26px 28px;
  text-align:center;
  border-radius:26px;
  animation:popIn .5s cubic-bezier(.2,1.5,.5,1);
}
.end-card h2{margin:12px 0 14px;font-size:26px;font-weight:900;letter-spacing:2px}
.end-letter{
  margin:0 0 18px;
  font-size:14.5px;line-height:2;font-weight:600;color:#463322;
  text-align:left;
  background:#fffdf4;border:2px solid rgba(74,53,39,.15);
  border-radius:14px;padding:16px 18px;
  white-space:pre-wrap;
}
.end-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}

/* ==================== 手机操作 ==================== */
.touch-ui{display:none}
body.touch .touch-ui{display:block}
.joystick{
  position:fixed;left:22px;bottom:26px;
  width:124px;height:124px;border-radius:50%;
  background:rgba(255,248,234,.55);
  border:3px solid rgba(74,53,39,.35);
  backdrop-filter:blur(4px);
  z-index:20;touch-action:none;
}
.joystick-stick{
  position:absolute;left:50%;top:50%;
  width:56px;height:56px;border-radius:50%;
  background:var(--cream);
  border:3px solid var(--ink);
  box-shadow:0 4px 0 rgba(74,53,39,.5);
  transform:translate(-50%,-50%);
  pointer-events:none;
}
.action-btn{
  position:fixed;right:24px;bottom:38px;
  width:92px;height:92px;border-radius:50%;
  border:4px solid var(--ink);
  background:linear-gradient(180deg,#ffdc6b,#ffbd2e);
  color:#5a3200;font-size:17px;font-weight:900;
  font-family:var(--font);
  box-shadow:0 6px 0 var(--gold-deep);
  z-index:20;
}
.action-btn:active{transform:translateY(5px);box-shadow:0 1px 0 var(--gold-deep)}

/* ==================== 花瓣 ==================== */
.petals{position:fixed;inset:0;pointer-events:none;z-index:3;overflow:hidden}
.petal{
  position:absolute;top:-30px;
  width:9px;height:9px;
  background:#ffc4d6;
  border-radius:50% 0 50% 50%;
  opacity:.75;
  animation:petalFall linear infinite;
}
@keyframes petalFall{
  0%{transform:translate3d(0,0,0) rotate(0deg);opacity:0}
  8%{opacity:.8}
  100%{transform:translate3d(var(--dx,40px),105vh,0) rotate(560deg);opacity:0}
}

/* ==================== 响应式 ==================== */
@media (max-width:720px){
  .hud-card{top:10px;left:10px;padding:7px 12px 7px 8px;gap:9px;border-radius:18px}
  .avatar-frame{width:42px;height:48px;border-radius:11px}
  .avatar-frame canvas{width:42px;height:48px}
  .hud-name{font-size:14px;max-width:130px}
  .pip{width:17px;height:17px;border-radius:6px}
  .pip svg{width:11px;height:11px}
  .hud-actions{top:10px;right:10px;gap:6px;display:grid;grid-template-columns:repeat(2,38px);justify-items:end}
  .icon-btn{width:38px;height:38px;border-radius:11px;font-size:15px}
  .minimap{right:10px;bottom:10px;padding:5px 5px 2px;border-radius:14px}
  #minimap{width:120px;height:82px}
  .minimap-label{font-size:10px}
  .toast{top:74px;font-size:13px;padding:9px 16px;white-space:normal;max-width:88vw;text-align:center}
  .start-card{padding:20px 18px;border-radius:22px}
  .start-card h1{letter-spacing:3px}
  .avatar-card .avatar-preview{width:70px;height:88px}
  .room{padding:16px 14px;border-radius:20px}
  .room-head h2{font-size:18px}
  .room-badge{width:42px;height:42px;border-radius:13px;font-size:19px}
  .album-stage{height:min(44vh,340px)}
  .album-thumbs button{width:42px;height:42px}
  .timer-grid{gap:7px}
  .timer-box{padding:7px 2px 6px;border-radius:12px}
  .timer-box b{font-size:19px}
  .wish-grid{grid-template-columns:1fr}
  .help-list li{font-size:13.5px}
  .letter{padding:16px}
  .letter p{font-size:14px;line-height:1.95}
  .minimap{display:none}
  .end-card{padding:20px 18px}
  .end-letter{font-size:13.5px}
}
@media (max-width:400px){
  .hud-name{max-width:92px}
  .avatar-pick{gap:8px}
  .avatar-card .avatar-preview{width:60px;height:76px}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important}
}
