:root{
  --bg:#2a120c;
  --panel:#4a2418;
  --text:#fff6e8;
  --muted:#e8c9a0;
  --warn:#fbbf24;
  --accent:#ffb38a;
  --touch:64px;
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  min-height:100dvh;
  font-family:"PingFang TC","Noto Sans TC",system-ui,sans-serif;
  background:
    radial-gradient(ellipse at 50% 0%,#6b2d16 0%,transparent 52%),
    radial-gradient(ellipse at 80% 100%,#3d1c10 0%,transparent 46%),
    var(--bg);
  color:var(--text);
  padding:max(.5rem,env(safe-area-inset-top)) .7rem max(.5rem,env(safe-area-inset-bottom));
  user-select:none;
  overflow-x:hidden;
}
button{font:inherit;border:none;cursor:pointer;color:inherit}
button:active{transform:scale(.98)}
#family-tb-voice[data-sound-locked="1"]{
  opacity:.95;
  cursor:default;
  pointer-events:none;
}
.app{max-width:560px;margin:0 auto;min-height:calc(100dvh - 1rem);display:flex;flex-direction:column}
.screen{display:flex;flex-direction:column;gap:.5rem;flex:1;min-height:0}
.hidden{display:none!important}
h1{text-align:center;font-size:clamp(1rem,3.5vw,1.3rem);color:#ffd7a8;font-weight:900}
.gentle{text-align:center;color:var(--muted);font-weight:600}
.guide-row{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:.25rem;
  margin:.15rem 0 .55rem;
}
.guide-item{
  flex:1;
  min-width:0;
  text-align:center;
}
.guide-dot{
  display:block;
  margin:0 auto .2rem;
  border-radius:50%;
  background:radial-gradient(circle at 30% 28%,#fff7ed,#fb7185 55%,#be123c);
  border:2px solid rgba(255,255,255,.75);
  box-shadow:0 2px 6px rgba(0,0,0,.3);
}
.guide-lab{
  display:block;
  font-size:.68rem;
  font-weight:800;
  color:#fde68a;
  line-height:1.2;
}
html.elder-mode .guide-lab{font-size:.78rem}
.guide-row.compact{
  margin:0 0 .15rem;
  background:rgba(0,0,0,.22);
  border-radius:12px;
  padding:.28rem .25rem .2rem;
}
.guide-row.compact .guide-lab{font-size:.62rem}
html.elder-mode .guide-row.compact .guide-lab{font-size:.72rem}
.pts-tag{
  position:absolute;
  left:50%;
  bottom:8%;
  transform:translateX(-50%);
  z-index:2;
  min-width:1.35rem;
  padding:0 .22rem;
  border-radius:8px;
  background:rgba(20,8,4,.62);
  color:#fde047;
  font-weight:900;
  font-size:.72rem;
  line-height:1.25;
  text-align:center;
}
html.elder-mode .pts-tag{font-size:.82rem;min-width:1.5rem}
.panel{
  background:var(--panel);
  border-radius:16px;
  padding:.9rem;
  border:1px solid rgba(255,183,138,.28);
}
.label{color:var(--warn);font-weight:800;margin:.35rem 0}
.chips{display:flex;flex-wrap:wrap;gap:.4rem}
.chip,.chips button{
  min-height:var(--touch);
  padding:.45rem .75rem;
  border-radius:14px;
  background:rgba(0,0,0,.28);
  border:2px solid rgba(232,201,160,.28);
  font-weight:800;
}
.chip.active,.chips button.active{
  border-color:var(--warn);
  background:rgba(251,191,36,.2);
  color:var(--warn);
}
.cur{font-weight:800;margin:.4rem 0}
.cur span{color:var(--warn)}
.btn-go{
  width:100%;
  min-height:68px;
  margin-top:.6rem;
  border-radius:16px;
  font-weight:900;
  font-size:1.15rem;
  background:linear-gradient(180deg,#ffc078,#e8590c);
  color:#3d1608;
}
.btn{
  min-height:52px;
  border-radius:14px;
  font-weight:800;
  padding:0 .8rem;
  background:rgba(255,255,255,.1);
  flex:1;
}
.btn.ghost{background:rgba(0,0,0,.22)}
.bar{
  flex-shrink:0;
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  justify-content:space-between;
  font-weight:800;
  background:var(--panel);
  padding:.55rem .7rem;
  border-radius:14px;
}
.bar b{color:var(--warn)}
html.elder-mode #time-wrap{display:none}
html.elder-mode .advanced{display:none}
html.elder-mode .weapon-row{display:none}
.prizes{
  display:flex;
  gap:.35rem;
  justify-content:space-between;
  flex-shrink:0;
}
.prize{
  flex:1;
  min-width:0;
  text-align:center;
  background:rgba(0,0,0,.28);
  border:2px solid rgba(232,201,160,.22);
  border-radius:12px;
  padding:.28rem .1rem .2rem;
  opacity:.42;
  font-weight:800;
}
.prize img.ico{
  display:block;
  width:40px;
  height:40px;
  object-fit:cover;
  border-radius:9px;
  margin:0 auto .12rem;
  background:#fff6e8;
  filter:contrast(1.08) saturate(1.1) brightness(1.03);
  box-shadow:0 2px 6px rgba(0,0,0,.25);
}
.prize .nm{display:block;font-size:.68rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.prize.on{
  opacity:1;
  border-color:var(--warn);
  background:rgba(251,191,36,.18);
}
.prize.just{animation:prizeDrop .8s cubic-bezier(.2,1.2,.3,1) both}
@keyframes prizeDrop{
  0%{transform:translateY(-28px) scale(.6);opacity:0}
  45%{transform:translateY(6px) scale(1.12);opacity:1}
  70%{transform:translateY(-4px) scale(1.04)}
  100%{transform:translateY(0) scale(1);opacity:1}
}
html.elder-mode .prize img.ico{width:52px;height:52px}
html.elder-mode .prize .nm{font-size:.78rem}
.elder-hint{
  display:block;
  text-align:center;
  font-weight:800;
  color:var(--warn);
  font-size:.95rem;
}
.stage{
  position:relative;
  flex:1 1 auto;
  min-height:220px;
  height:min(54dvh,460px);
  border-radius:18px;
  overflow:hidden;
  touch-action:none;
  cursor:crosshair;
  border:3px solid rgba(255,200,150,.5);
  background:
    linear-gradient(180deg,rgba(20,8,4,.12) 0%,transparent 22%,rgba(20,8,4,.05) 58%,rgba(20,8,4,.28) 100%),
    url("../media/stall-bg.jpg") center 55% / cover no-repeat,
    #2b120c;
  box-shadow:inset 0 0 0 2px rgba(0,0,0,.28),0 10px 28px rgba(0,0,0,.35);
  image-rendering:-webkit-optimize-contrast;
}
html.elder-mode .stage{
  border-color:rgba(255,215,160,.65);
  filter:contrast(1.06) saturate(1.08) brightness(1.03);
}
.counter{
  position:absolute;
  left:0;right:0;bottom:0;
  height:8px;
  background:linear-gradient(180deg,transparent,#6b1d12);
  pointer-events:none;
  z-index:4;
}
.traj{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:7}
#balloons{position:absolute;inset:0;pointer-events:none;z-index:3;overflow:visible}
.balloon{
  position:absolute;
  border-radius:50% 50% 48% 48% / 56% 56% 44% 44%;
  border:4px solid rgba(255,255,255,.78);
  background:#fb7185 center/cover no-repeat;
  box-shadow:inset -8px -10px 16px rgba(0,0,0,.22),inset 6px 8px 12px rgba(255,255,255,.28),0 6px 14px rgba(0,0,0,.35);
  pointer-events:none;
}
.balloon::before{
  content:"";
  position:absolute;
  top:14%;
  left:18%;
  width:28%;
  height:20%;
  border-radius:50%;
  background:rgba(255,255,255,.42);
  pointer-events:none;
}
.balloon::after{
  content:"";
  position:absolute;
  left:50%;
  top:100%;
  width:2px;
  height:20px;
  margin-left:-1px;
  background:linear-gradient(#e8c9a0,#e8c9a0 70%,transparent);
  pointer-events:none;
}
.balloon.xs{
  border-width:3px;
  border-color:#fde047;
  box-shadow:
    0 0 0 3px rgba(253,224,71,.45),
    inset -6px -8px 12px rgba(0,0,0,.22),
    inset 4px 6px 10px rgba(255,255,255,.28),
    0 4px 10px rgba(0,0,0,.35);
}
.balloon.xs .pts-tag{
  background:#facc15;
  color:#422006;
  font-weight:900;
}
.balloon.tutor{
  box-shadow:
    0 0 0 6px rgba(251,191,36,.5),
    inset -8px -10px 16px rgba(0,0,0,.22),
    inset 6px 8px 12px rgba(255,255,255,.28);
  animation:tutorPulse 1.4s ease-in-out infinite;
}
@keyframes tutorPulse{
  0%,100%{box-shadow:0 0 0 5px rgba(251,191,36,.4),0 6px 14px rgba(0,0,0,.35)}
  50%{box-shadow:0 0 0 10px rgba(251,191,36,.18),0 6px 14px rgba(0,0,0,.35)}
}
.balloon.pop,.balloon.pop-slow{pointer-events:none;z-index:6}
.balloon.pop{animation:popNice .4s ease-in forwards}
.balloon.pop-slow{animation:popNice .54s ease-in forwards}
@keyframes popNice{
  0%{transform:scale(1);opacity:1}
  30%{transform:scale(1.32);opacity:1}
  100%{transform:scale(.12);opacity:0}
}
.pop-bit{
  position:absolute;
  z-index:7;
  pointer-events:none;
  font-size:1.1rem;
  animation:flybit .55s ease-out forwards;
}
@keyframes flybit{
  to{transform:translate(var(--dx),var(--dy)) scale(.4);opacity:0}
}
.shard{
  position:absolute;
  z-index:8;
  margin-left:-6px;
  margin-top:-6px;
  border-radius:4px 10px 5px 8px;
  pointer-events:none;
  box-shadow:0 2px 4px rgba(0,0,0,.25);
  background-repeat:no-repeat;
  animation:shardfly var(--dur,520ms) ease-out forwards;
}
.shard.fancy{border-radius:6px 12px 7px 11px}
@keyframes shardfly{
  0%{transform:translate(0,0) rotate(0) scale(1);opacity:1}
  70%{opacity:1}
  100%{transform:translate(var(--dx),var(--dy)) rotate(var(--rot)) scale(.35);opacity:0}
}
.pts-pop{
  position:absolute;
  z-index:9;
  margin-left:-1.2rem;
  font-weight:900;
  font-size:1.25rem;
  color:#fde047;
  text-shadow:0 2px 0 #7c2d12,0 3px 8px rgba(0,0,0,.55);
  pointer-events:none;
  animation:ptsup .8s ease-out forwards;
}
.pts-pop.fancy{font-size:1.55rem;animation-duration:1.05s}
html.elder-mode .pts-pop{font-size:1.45rem}
html.elder-mode .pts-pop.fancy{font-size:1.7rem}
@keyframes ptsup{
  0%{transform:translateY(0) scale(.85);opacity:0}
  18%{transform:translateY(-8px) scale(1.08);opacity:1}
  100%{transform:translateY(-48px) scale(1);opacity:0}
}
.shot{
  position:absolute;
  width:16px;height:32px;
  margin-left:-8px;margin-top:-16px;
  border-radius:0;
  background:url("../media/shot-cork.png") center / contain no-repeat;
  border:none;
  box-shadow:none;
  pointer-events:none;
  z-index:6;
  filter:drop-shadow(0 1px 2px rgba(0,0,0,.45));
}
.shot.bow{
  width:14px;height:36px;
  margin-left:-7px;margin-top:-18px;
  background:url("../media/shot-cork.png") center / contain no-repeat;
}
html.elder-mode .shot{width:20px;height:40px;margin-left:-10px;margin-top:-20px}
html.elder-mode .shot.bow{width:18px;height:44px;margin-left:-9px;margin-top:-22px}
.weapon{
  position:absolute;
  left:50%;
  bottom:10px;
  width:62px;
  height:140px;
  margin-left:-31px;
  pointer-events:none;
  z-index:5;
  filter:drop-shadow(0 3px 4px rgba(0,0,0,.55));
}
.weapon.bow{
  width:170px;
  height:166px;
  margin-left:-85px;
  bottom:2px;
}
html.elder-mode .weapon{width:72px;height:162px;margin-left:-36px}
html.elder-mode .weapon.bow{width:186px;height:182px;margin-left:-93px}
.weapon-rot{
  position:absolute;
  inset:0;
  transform-origin:50% 76%;
}
.weapon.bow .weapon-rot{transform-origin:50% 27%}
.weapon img{
  image-rendering:-webkit-optimize-contrast;
  filter:contrast(1.08) saturate(1.06) brightness(1.02);
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:fill;
  display:none;
  pointer-events:none;
  user-select:none;
}
.weapon.gun .w-gun{display:block}
.weapon.bow .w-bow{display:block}
.muzzle-pin{
  position:absolute;
  left:50%;
  top:1.2%;
  width:8px;height:8px;
  margin:-4px 0 0 -4px;
  pointer-events:none;
  opacity:0;
}
.weapon.bow .muzzle-pin{top:1.5%}
.pivot-pin{
  position:absolute;
  left:50%;
  top:76%;
  width:4px;height:4px;
  margin:-2px 0 0 -2px;
  pointer-events:none;
  opacity:0;
}
.weapon.bow .pivot-pin{top:27%}
.sight-cross{
  position:absolute;
  left:50%;
  top:1.2%;
  width:10px;
  height:10px;
  margin:-5px 0 0 -5px;
  pointer-events:none;
  z-index:6;
}
.sight-cross::before,.sight-cross::after{
  content:"";
  position:absolute;
  background:#fff7ed;
  box-shadow:0 0 0 1px #7c2d12,0 0 4px #fbbf24;
}
.sight-cross::before{
  left:3px;top:0;
  width:2px;height:8px;
}
.sight-cross::after{
  left:0;top:3px;
  width:8px;height:2px;
}
.weapon.bow .sight-cross{top:1.5%}
.muzzle-flash{
  position:absolute;
  left:50%;
  top:2.4%;
  width:46px;
  height:70px;
  margin-left:-23px;
  margin-top:-68px;
  pointer-events:none;
  z-index:8;
  transform-origin:50% 100%;
}
.weapon.gun .muzzle-flash{top:1.2%}
.weapon.bow .muzzle-flash{top:1.5%}
.flash-flame{
  display:block;
  width:100%;
  height:100%;
  opacity:0;
  background:
    radial-gradient(circle at 50% 92%, #fff 0 16%, #fde047 26%, transparent 40%),
    linear-gradient(to top, #fff7ed 0%, #facc15 18%, #fb923c 42%, #ea580c 62%, #ef4444 82%, transparent 100%);
  clip-path: polygon(50% 0, 78% 38%, 64% 38%, 88% 70%, 62% 62%, 70% 100%, 30% 100%, 38% 62%, 12% 70%, 36% 38%, 22% 38%);
  filter:drop-shadow(0 0 10px #fb923c) drop-shadow(0 0 18px #ea580c);
  transform-origin:50% 100%;
}
.muzzle-flash.bang .flash-flame{animation:muzzleBang .32s ease-out}
@keyframes muzzleBang{
  0%{opacity:1;transform:scale(.55)}
  20%{opacity:1;transform:scale(1.45)}
  100%{opacity:0;transform:scale(1.85)}
}
.spark{
  position:absolute;
  width:5px;height:9px;
  margin:-4px 0 0 -2px;
  border-radius:1px;
  pointer-events:none;
  z-index:8;
  animation:sparkfly .22s ease-out forwards;
}
@keyframes sparkfly{
  to{transform:translate(var(--sx),var(--sy)) rotate(var(--rot)) scale(.15);opacity:0}
}
.weapon-row{justify-content:center;flex-shrink:0}
.row{display:flex;gap:.4rem;flex-shrink:0}
.overlay{
  position:fixed;inset:0;
  background:rgba(20,8,4,.78);
  display:flex;align-items:center;justify-content:center;
  padding:1rem;z-index:20;
}
.card{
  background:var(--panel);
  border-radius:18px;
  padding:1rem;
  width:min(420px,100%);
  border:1px solid rgba(255,183,138,.35);
}
.card h2{text-align:center;color:var(--warn);margin-bottom:.5rem}
.card p{text-align:center;font-weight:700;margin-bottom:.7rem}
.win-prizes{margin-bottom:.8rem}
#lb-table table{width:100%;border-collapse:collapse;font-size:.9rem}
#lb-table th,#lb-table td{padding:.4rem;border-bottom:1px solid rgba(255,255,255,.08);font-weight:700}
#lb-table tr.me td{color:var(--warn)}
html.elder-mode .chip,html.elder-mode .chips button{min-height:72px;font-size:1.05rem}
html.elder-mode .btn-go{min-height:76px;font-size:1.25rem}
