*{box-sizing:border-box;margin:0;padding:0}
html,body{width:100%;height:100%;overflow:hidden;background:#2b1a0e;color:#3a2414;
  font-family:"Segoe UI",system-ui,-apple-system,Helvetica,Arial,sans-serif;
  -webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;overscroll-behavior:none}
canvas{position:fixed;left:0;top:0;width:100%;height:100%;display:block;touch-action:none}
.hidden{display:none!important}
button{font:inherit;cursor:pointer;border:0}
#hud{position:fixed;inset:0;pointer-events:none;padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 10px max(10px,env(safe-area-inset-left))}
.hud-left{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.pill{background:rgba(43,26,14,.78);color:#fff3e4;border:2px solid rgba(233,169,107,.7);border-radius:999px;padding:4px 14px;
  display:flex;align-items:center;gap:8px;font-weight:800;box-shadow:0 3px 10px rgba(0,0,0,.25)}
.pill.score{font-size:24px;min-width:120px}
.pill .lbl{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:#e9a96b;font-weight:700}
.pill.small{font-size:16px;padding:2px 12px}
.pill.best{opacity:.85}
.pill .ico{font-size:16px}
.hud-right{position:absolute;top:max(10px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right));display:flex;gap:8px;pointer-events:auto}
.round{width:44px;height:44px;border-radius:50%;background:rgba(43,26,14,.78);color:#fff3e4;border:2px solid rgba(233,169,107,.7);
  font-size:17px;display:flex;align-items:center;justify-content:center;box-shadow:0 3px 10px rgba(0,0,0,.25)}
.round:active{transform:scale(.92)}
.power{position:absolute;left:50%;transform:translateX(-50%);top:max(12px,env(safe-area-inset-top));background:rgba(255,248,238,.92);
  border-radius:16px;padding:6px 14px;text-align:center;font-weight:800;color:#2b1a0e;min-width:140px;box-shadow:0 4px 12px rgba(0,0,0,.25)}
.power .bar{height:7px;background:#ead6bf;border-radius:4px;margin-top:4px;overflow:hidden}
#powerFill{height:100%;width:100%;background:linear-gradient(90deg,#e9a96b,#f2a541);border-radius:4px}
.warn{position:absolute;left:50%;bottom:18%;transform:translateX(-50%);background:#5a8f2e;color:#fff;font-weight:800;
  padding:6px 16px;border-radius:999px;border:2px solid #c9f29b;animation:pulse .5s infinite alternate;white-space:nowrap}
@keyframes pulse{to{transform:translateX(-50%) scale(1.08)}}
.screen{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:16px;
  background:radial-gradient(ellipse at center,rgba(43,26,14,.2),rgba(43,26,14,.6));overflow-y:auto}
.card{background:#fff8ee;border-radius:26px;padding:22px 24px 18px;max-width:420px;width:100%;text-align:center;
  box-shadow:0 18px 50px rgba(0,0,0,.45);border:3px solid #e9a96b;margin:auto}
.card.slim{max-width:360px}
.photo{width:118px;height:118px;margin:-70px auto 6px;border-radius:50%;padding:5px;background:linear-gradient(135deg,#f2a541,#a85a26);
  box-shadow:0 8px 20px rgba(0,0,0,.35)}
.photo img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block;border:3px solid #fff8ee}
#start .card{margin-top:70px}
h1{font-family:Georgia,"Times New Roman",serif;font-size:44px;line-height:1.05;color:#a85a26;letter-spacing:.01em;
  text-shadow:2px 2px 0 #ffd9b3}
h2{font-family:Georgia,"Times New Roman",serif;font-size:30px;color:#a85a26;line-height:1.1}
.tag{margin:8px 0 12px;font-size:15px;color:#6b4a32;line-height:1.4}
.how{list-style:none;text-align:left;background:#f7e6d4;border-radius:16px;padding:8px 12px;margin-bottom:10px}
.how li{display:flex;align-items:center;gap:8px;padding:4px 0;font-size:14px;color:#3a2414;flex-wrap:wrap}
.how b{background:#2b1a0e;color:#ffe3c6;border-radius:8px;padding:2px 8px;font-size:13px;white-space:nowrap;min-width:46px;text-align:center}
.how span{color:#3a2414}
.how li.via{justify-content:center;font-size:12px;color:#9a7a62;padding-top:4px}
.tips{font-size:13px;color:#6b4a32;line-height:1.4;margin-bottom:12px}
.play{display:block;width:100%;background:linear-gradient(180deg,#f2a541,#d9822b);color:#2b1a0e;font-size:24px;font-weight:900;
  padding:12px;border-radius:999px;box-shadow:0 5px 0 #a85a26,0 8px 16px rgba(0,0,0,.25);letter-spacing:.03em}
.play:active{transform:translateY(3px);box-shadow:0 2px 0 #a85a26}
.ghost{display:block;width:100%;margin-top:12px;background:transparent;color:#a85a26;font-weight:700;font-size:15px;padding:8px;
  border:2px solid #e9a96b;border-radius:999px}
.bestline{margin-top:12px;font-weight:800;color:#a85a26}
.hint{font-size:12px;color:#9a7a62;margin-top:4px}
.back{position:fixed;top:max(12px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));color:#fff3e4;text-decoration:none;font-weight:700;
  background:rgba(43,26,14,.8);border:2px solid rgba(233,169,107,.7);padding:6px 14px;border-radius:999px;font-size:14px;z-index:2}
.backlink{display:inline-block;margin-top:14px;color:#a85a26;font-weight:700;font-size:14px}
.stats{display:flex;gap:8px;justify-content:center;margin:6px 0 10px}
.stats div{flex:1;background:#f7e6d4;border-radius:14px;padding:8px 4px}
.stats .lbl{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#9a7a62;font-weight:700}
.stats b{font-size:24px;color:#2b1a0e}
.newbest{font-weight:800;color:#d9822b;margin-bottom:10px;animation:pulse2 .6s infinite alternate}
@keyframes pulse2{to{transform:scale(1.06)}}
.stink{position:relative;width:120px;height:80px;margin:-6px auto 4px}
.stink i{position:absolute;border-radius:50%;background:#9fd46a;opacity:.85;animation:puff 1.6s ease-in-out infinite alternate}
.stink i:nth-child(1){width:54px;height:54px;left:8px;top:18px;background:#8cc858}
.stink i:nth-child(2){width:62px;height:62px;left:36px;top:4px;animation-delay:.3s}
.stink i:nth-child(3){width:48px;height:48px;left:66px;top:24px;background:#b5e07f;animation-delay:.6s}
.stink i:nth-child(4){width:40px;height:40px;left:30px;top:36px;background:#a6d873;animation-delay:.9s}
.stink span{position:absolute;left:0;right:0;top:20px;font-size:34px}
@keyframes puff{to{transform:scale(1.12) translateY(-4px)}}
@media (max-height:640px){
  .card{padding:14px 18px 12px}
  h1{font-size:34px}
  .photo{width:88px;height:88px;margin-top:-50px}
  #start .card{margin-top:50px}
  .tips{display:none}
  .tag{margin:4px 0 8px;font-size:14px}
  .play{font-size:20px;padding:9px}
  .how li{padding:2px 0}
}
@media (max-height:440px){ .how{display:none} .hint{display:none} }

#over{align-items:flex-start;background:radial-gradient(ellipse at center,rgba(43,26,14,0),rgba(43,26,14,.5))}
#over .card{margin:64px auto auto}
@media (min-aspect-ratio:5/4) and (min-width:720px){
  #over{justify-content:flex-start;align-items:center;padding-left:5vw}
  #over .card{margin:auto 0}
}
@media (max-height:500px){
  .pill.score{font-size:18px;min-width:96px;padding:2px 12px}
  .pill.small{font-size:13px}
  .round{width:38px;height:38px;font-size:15px}
  .hud-left{gap:4px}
}
.btnrow{display:flex;gap:8px}
.btnrow .ghost{flex:1}
.submit{background:#f7e6d4;border-radius:16px;padding:10px 12px;margin:0 0 12px;text-align:left}
.submit label{display:block;font-size:13px;font-weight:800;color:#a85a26;margin-bottom:6px}
.submit .row{display:flex;gap:6px}
.submit input{flex:1;min-width:0;font:inherit;font-size:16px;color:#2b1a0e;background:#fff;border:2px solid #e9c9a6;border-radius:999px;padding:7px 12px;outline:none;-webkit-user-select:text;user-select:text}
.submit input:focus{border-color:#d9822b}
.submit button{background:#2b1a0e;color:#ffe3c6;font-weight:800;font-size:14px;border-radius:999px;padding:7px 14px;white-space:nowrap}
.submit button:disabled{opacity:.6;cursor:wait}
.hp{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}
.smsg{font-size:13px;color:#6b4a32;margin-top:6px;min-height:0}
.smsg:empty{display:none}
.smsg.err{color:#b23a1e;font-weight:700}
.smsg.ok{color:#4f7d27;font-weight:700}
.board{list-style:none;text-align:left;background:#f7e6d4;border-radius:16px;padding:6px 8px;margin:4px 0 8px;counter-reset:r}
.board li{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:10px;font-size:15px;color:#3a2414}
.board li+li{border-top:1px dashed #e6cbad}
.board .rk{width:28px;height:28px;flex:none;border-radius:50%;background:#2b1a0e;color:#ffe3c6;font-weight:900;font-size:13px;display:flex;align-items:center;justify-content:center}
.board li:nth-child(1) .rk{background:#f2b320;color:#2b1a0e}
.board li:nth-child(2) .rk{background:#c9ccd3;color:#2b1a0e}
.board li:nth-child(3) .rk{background:#d08a4e;color:#2b1a0e}
.board .nm{flex:1;min-width:0;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.board .ty{font-size:12px;color:#9a7a62;white-space:nowrap}
.board .sc{font-weight:900;color:#a85a26;min-width:56px;text-align:right}
.board li.me{background:#ffe2b8;border-top-color:transparent}
.board li.empty{justify-content:center;color:#9a7a62;font-style:italic}
#board .card{max-height:calc(100% - 8px);overflow-y:auto}
@media (max-height:640px){.board li{padding:3px 8px;font-size:14px}.board .rk{width:24px;height:24px}.submit{padding:8px 10px;margin-bottom:8px}}
