@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap');
:root{font-family:'Noto Sans TC',sans-serif;color:#183f40;background:#cee5d7;font-synthesis:none}*{box-sizing:border-box}body{margin:0}button,input{font:inherit}button{cursor:pointer;border:0;color:inherit}button:focus-visible,input:focus-visible{outline:3px solid #ec7139;outline-offset:4px}#game{height:100dvh;min-height:650px;position:relative;overflow:hidden}canvas,.vignette{position:absolute;width:100%;height:100%;inset:0}.vignette{pointer-events:none;background:linear-gradient(#eaf1decc,transparent 35%,transparent 65%,#173a3940)}header{position:absolute;top:30px;left:38px;right:38px;display:flex;justify-content:space-between;align-items:flex-start}.eyebrow{font-size:12px;font-weight:700;letter-spacing:2px}h1{font-size:30px;letter-spacing:-1px;margin:6px 0;font-weight:900}h1 em{font-style:normal;color:#f07740}.top-actions{display:flex;gap:8px}.top-actions button{background:#f7f6e9de;padding:11px 16px;border:1px solid #183f4020;border-radius:30px;font-size:14px}.scoreboard{position:absolute;top:126px;left:38px;display:flex;gap:28px}.scoreboard div{display:flex;flex-direction:column}.scoreboard span{font-size:12px;font-weight:700;letter-spacing:1px}.scoreboard strong{font-size:34px;line-height:1.5;font-variant-numeric:tabular-nums}.scoreboard strong span{font-size:14px;margin-left:4px}.route{position:absolute;right:38px;top:116px;width:240px;text-align:right;font-weight:700;font-size:14px}.route div{height:5px;background:#183f4020;border-radius:10px;margin:12px 0}.route i{display:block;height:100%;width:0;background:#ed763c}.route small{font-size:13px;font-weight:400}#bubble{position:absolute;left:50%;top:24%;transform:translateX(-50%);padding:13px 24px;background:#fffdf0;box-shadow:0 5px 0 #183f4020;border-radius:16px;font-weight:700;font-size:16px;max-width:80%;text-align:center;transition:opacity .2s}#targetLabel{position:absolute;padding:5px 10px;border-radius:6px;background:#193f40;color:#fff8df;font-size:12px;pointer-events:none}.instructions{position:absolute;top:30%;left:7%;width:365px;padding:28px;background:#f9f7eafa;border:1px solid #ffffff;border-radius:22px;box-shadow:0 18px 50px #183f4026}.stamp{font-size:12px;letter-spacing:2px;color:#c66337;font-weight:900}h2{font-size:34px;font-weight:900;line-height:1.3;margin:13px 0}.instructions p{font-size:15px;line-height:1.8}.primary{background:#183f40;color:#fffbe8;border-radius:12px;padding:16px 18px;width:100%;display:flex;justify-content:space-between;align-items:center;font-weight:700}.primary span{font-size:12px;color:#f4cf56}.instructions small{display:block;margin-top:15px;font-size:12px;line-height:1.8;color:#677a74}.controls{position:absolute;bottom:36px;left:38px;right:38px;display:flex;align-items:center;gap:28px;background:#f9f8edee;border:1px solid #fff;padding:20px 24px;border-radius:20px;box-shadow:0 10px 35px #183f401a}.bag-info{width:240px;display:flex;flex-direction:column;gap:4px}.bag-info strong{font-size:20px}.bag-info small{font-size:12px;color:#64776b}#sort{background:none;text-align:left;padding:7px 0 0;font-weight:700;font-size:13px;text-decoration:underline;text-underline-offset:4px}#sort span{font-weight:400;margin-left:8px}.aim-control{flex:1}label{display:flex;justify-content:space-between;font-size:14px;font-weight:700}label span{font-size:12px;font-weight:400}input{width:100%;accent-color:#183f40;margin:14px 0 18px;touch-action:none}.power{height:24px;background:#dfe7da;border-radius:6px;position:relative;overflow:hidden}.power i{display:block;width:0;height:100%;background:#f7bc42}.power b{position:absolute;inset:0;text-align:center;font-size:12px;line-height:24px}.play-buttons{display:flex;gap:12px}#run,#throw{height:96px;border-radius:14px;display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:25px;font-weight:900;touch-action:none;user-select:none;-webkit-user-select:none}#run{width:104px;background:#dfe8dc}#throw{width:175px;background:#f5bd45;box-shadow:0 5px 0 #c68b22}#throw:active,#run:active{transform:translateY(3px)}.play-buttons span{font-size:12px;font-weight:500;margin-top:5px}.bottom-note{position:absolute;bottom:9px;left:0;right:0;text-align:center;font-size:11px;color:#294e43}.hidden{display:none!important}#result{left:50%;transform:translateX(-50%);top:27%;z-index:5;text-align:center}#error{position:absolute;inset:30%;background:#fff;padding:30px;z-index:20}button:disabled{opacity:.55;cursor:default}
@media(min-width:1500px){.controls{max-width:1180px;left:50%;transform:translateX(-50%);width:calc(100% - 76px)}}@media(max-width:700px){#game{min-height:720px}header{top:20px;left:20px;right:20px}h1{font-size:23px}.eyebrow{font-size:10px}.top-actions{gap:5px}.top-actions button{font-size:12px;padding:9px 10px}.scoreboard{top:100px;left:20px;gap:22px}.scoreboard strong{font-size:28px}.route{right:20px;top:108px;width:135px;font-size:12px}.route small{font-size:11px}#bubble{top:23%;font-size:14px;padding:10px 15px;width:max-content;max-width:90%}.instructions{top:30%;left:20px;width:290px;padding:22px}h2{font-size:29px}.instructions p{font-size:14px}.instructions small{font-size:11px}.controls{left:12px;right:12px;bottom:30px;padding:14px;gap:12px;flex-wrap:wrap;border-radius:17px}.bag-info{width:calc(50% - 6px)}.bag-info strong{font-size:16px}.bag-info small{font-size:11px}.aim-control{width:calc(50% - 6px);flex:auto}.play-buttons{width:100%}#run{width:33%}#throw{flex:1}#run,#throw{height:65px;font-size:22px}input{margin:14px 0}.bottom-note{font-size:10px}#sort{font-size:12px}.bag-info .eyebrow{display:none}#result{width:310px;top:28%}}

.bag-info{width:290px;flex-shrink:0;padding:13px 15px;border:2px solid #91b1a0;border-radius:12px;background:#edf4ec;gap:6px}
.bag-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:13px}
.bag-heading b{padding:3px 7px;background:#285748;color:white;border-radius:5px;font-size:13px}
.bag-info strong{font-size:20px;line-height:1.4}.bag-info small{font-size:14px;line-height:1.5;color:#304b42}
.bag-info[data-status="warning"]{border-color:#c47b15;background:#fff0c7}.bag-info[data-status="warning"] .bag-heading b{background:#92540d}
.bag-info[data-status="danger"]{border-color:#bc4336;background:#ffe4de}.bag-info[data-status="danger"] .bag-heading b{background:#a83227}
#sort{background:#244c42;color:white;text-align:center;padding:10px;border-radius:7px;font-size:14px;text-decoration:none;min-height:42px}#sort[hidden]{display:none}
#sort:disabled{opacity:.65}.controls{gap:20px}.aim-control{min-width:0}
@media(max-width:700px){.bag-info{width:100%;padding:10px 12px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 10px}.bag-heading{grid-column:1/-1}.bag-info strong{font-size:18px}.bag-info small{font-size:13px;grid-column:1/-1}.bag-info #sort{grid-column:1/-1;font-size:14px;padding:8px;min-height:40px}.aim-control{width:100%}.controls{gap:9px;padding:11px}.aim-control input{margin:7px 0}.power{height:20px}.power b{line-height:20px}#run,#throw{height:56px}.instructions{top:24%;z-index:4}.bag-heading b{font-size:12px}}

#oopsNotice{position:absolute;top:32%;left:50%;transform:translateX(-50%);max-width:90%;width:max-content;padding:12px 18px;border:2px solid #a4442f;background:#fff1d5;color:#843521;border-radius:12px;box-shadow:0 5px 0 #58382422;font-size:17px;font-weight:900;text-align:center;pointer-events:none;z-index:3}@media(max-width:700px){#oopsNotice{top:29%;font-size:15px;padding:10px 12px}}

#targetLabel.hit{background:#1d7747;color:white;font-size:20px;font-weight:900;padding:10px 18px;box-shadow:0 0 0 4px #bdf2bf80}

/* Compact mobile bag notice: one row, with a full-size touch target. */
@media(max-width:700px){
  .bag-info{display:flex;flex-direction:row;align-items:center;gap:8px;padding:5px 9px;min-height:46px;border-width:1px;border-left-width:4px;border-radius:9px}
  .bag-info .bag-heading,.bag-info #bagHint{display:none}
  .bag-info strong{flex:1;min-width:0;font-size:16px;line-height:1.35}
  .bag-info #sort{flex:0 0 auto;width:auto;min-height:44px;padding:6px 10px;font-size:0;margin:0;white-space:nowrap}
  .bag-info #sort::after{content:attr(data-mobile-label);font-size:14px;font-weight:700}
}

/* 依可視高度配置操作區；短螢幕只讓說明面板內部捲動。 */
:root{--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
#game{height:100vh;height:100dvh;min-height:0}
header{top:calc(30px + var(--safe-top));left:calc(38px + var(--safe-left));right:calc(38px + var(--safe-right))}
.controls{bottom:calc(36px + var(--safe-bottom));left:calc(38px + var(--safe-left));right:calc(38px + var(--safe-right))}
.bottom-note{bottom:calc(9px + var(--safe-bottom))}
.instructions{max-height:calc(100% - 48px - var(--safe-top) - var(--safe-bottom));overflow-y:auto;overscroll-behavior:contain}
.route i,.power i{width:100%;transform:scaleX(0);transform-origin:left center}
#targetLabel{top:0;left:0}
@media(min-width:1500px){.controls{left:50%;right:auto}}
@media(max-width:700px){
  header{top:calc(12px + var(--safe-top));left:calc(14px + var(--safe-left));right:calc(14px + var(--safe-right))}
  .scoreboard{top:calc(88px + var(--safe-top));left:calc(14px + var(--safe-left));gap:16px}
  .route{top:calc(96px + var(--safe-top));right:calc(14px + var(--safe-right));width:120px}
  .controls{left:calc(10px + var(--safe-left));right:calc(10px + var(--safe-right));bottom:calc(26px + var(--safe-bottom))}
  .instructions{top:calc(50% + (var(--safe-top) - var(--safe-bottom))/2);left:20px;width:calc(100% - 40px);max-width:365px;transform:translateY(-50%);padding:20px}
  #result{top:calc(50% + (var(--safe-top) - var(--safe-bottom))/2);left:50%;width:calc(100% - 40px);transform:translate(-50%,-50%)}
  #bubble{top:calc(164px + var(--safe-top))}
  #oopsNotice{top:calc(218px + var(--safe-top))}
}
@media(max-width:380px){
  h1{font-size:20px}.eyebrow{font-size:8px;letter-spacing:1px}
  .top-actions button{padding:9px 8px}
  .scoreboard{gap:12px}.scoreboard strong{font-size:25px}.scoreboard span{font-size:11px}
  .route{width:105px;font-size:11px}.route small{font-size:10px}
  .instructions h2{font-size:27px}.instructions p{font-size:13px}
}
@media(max-height:600px) and (orientation:portrait){
  header{top:calc(6px + var(--safe-top))}.scoreboard{top:calc(69px + var(--safe-top))}.route{top:calc(77px + var(--safe-top))}
  .controls{padding:8px;gap:6px}.bag-info{padding:3px 7px}.aim-control label{font-size:12px}
  #bubble{top:calc(133px + var(--safe-top));padding:7px 12px;font-size:12px}
  #oopsNotice{top:calc(179px + var(--safe-top));padding:7px 10px;font-size:12px}
}
@media(max-height:500px) and (orientation:landscape){
  header{top:calc(6px + var(--safe-top));left:calc(14px + var(--safe-left));right:calc(14px + var(--safe-right))}
  h1{font-size:20px;margin:2px 0}.eyebrow{font-size:8px}.top-actions button{padding:8px 12px}
  .scoreboard{top:calc(53px + var(--safe-top));left:calc(14px + var(--safe-left));gap:16px}.scoreboard strong{font-size:24px}
  .route{top:calc(52px + var(--safe-top));right:calc(14px + var(--safe-right));width:180px;font-size:12px}.route div{margin:6px 0}
  .controls{left:calc(8px + var(--safe-left));right:calc(8px + var(--safe-right));bottom:calc(23px + var(--safe-bottom));padding:8px;gap:8px;display:grid;grid-template-columns:140px minmax(100px,1fr) 170px}
  .bag-info{width:100%;padding:5px 7px;display:flex;flex-direction:column;gap:4px;align-items:stretch}.bag-info .bag-heading,.bag-info #bagHint{display:none}.bag-info strong{font-size:14px}
  .bag-info #sort{font-size:0;min-height:44px;padding:6px}.bag-info #sort::after{content:attr(data-mobile-label);font-size:13px}
  .aim-control{width:100%}.aim-control label{font-size:12px}.aim-control label span{font-size:10px}.aim-control input{margin:8px 0}
  .play-buttons{width:100%;gap:8px}#run,#throw{height:56px;font-size:20px}#run{width:60px}#throw{width:102px}.play-buttons span{font-size:9px}
  .instructions,#result{top:calc(50% + (var(--safe-top) - var(--safe-bottom))/2);left:50%;width:min(400px,calc(100% - 40px));transform:translate(-50%,-50%);padding:16px;z-index:5}
  .instructions h2{font-size:24px}.instructions p{font-size:13px}.instructions small{font-size:11px}
  #bubble{top:calc(104px + var(--safe-top));padding:6px 12px;font-size:12px}#oopsNotice{top:calc(149px + var(--safe-top));padding:6px 10px;font-size:12px}
}
@media(min-width:701px) and (max-width:1000px) and (min-height:501px){
  .controls{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;padding:14px}
  .bag-info{width:100%;grid-row:1/3}.aim-control{width:100%}.play-buttons{grid-column:2;width:100%}
  #run,#throw{height:56px;font-size:22px}#run{width:33%}#throw{width:auto;flex:1}.play-buttons span{font-size:10px}
}
