:root{
  --ink:#1c1c1c; --paper:#f3efe4; --night:#20263f; --night2:#2e3558;
  --me:#d8402c; --cord:#e9e3d2;
  --pop:'Rampart One','Hiragino Sans',sans-serif;
  --sans:'Zen Kaku Gothic New','Hiragino Sans','Yu Gothic',sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
[hidden],.hidden{display:none!important}
html,body{height:100%;overflow:hidden;background:#6f7f99;color:var(--ink);font-family:var(--sans);touch-action:manipulation;-webkit-text-size-adjust:100%;text-size-adjust:100%;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
button,a{font:inherit;color:inherit;background:none;border:0;cursor:pointer;touch-action:manipulation;text-decoration:none}
#view{position:fixed;inset:0}
#view canvas{display:block;width:100%;height:100%;touch-action:none}
.screen{position:fixed;inset:0;z-index:10}
#boot{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:var(--night);color:var(--paper);font-size:18px;font-weight:700}
#boot-err{position:fixed;inset:auto 8px 8px 8px;z-index:99;background:#fff;color:#b00;font:12px/1.4 monospace;white-space:pre-wrap;padding:10px;border-radius:6px}

/* ---------- タイトル（後ろで CPU が飛んでいる） ---------- */
#title{display:flex;flex-direction:column;align-items:flex-start;padding:max(28px,env(safe-area-inset-top)) 22px max(14px,env(safe-area-inset-bottom));background:linear-gradient(180deg,rgba(14,18,34,.62) 0%,rgba(14,18,34,0) 42%,rgba(14,18,34,0) 66%,rgba(14,18,34,.7) 100%)}
.title-text{color:#fff;max-width:520px}
.logo{font-family:var(--pop);font-weight:400;font-size:min(10.6vw,64px);white-space:nowrap;line-height:1.08;letter-spacing:.02em;text-shadow:0 3px 0 rgba(0,0,0,.25)}
.logo span{display:inline-block;transform:rotate(-2.5deg);transform-origin:0 100%}
.sub{margin-top:10px;font-size:15px;font-weight:700;line-height:1.5;max-width:20em;text-shadow:0 1px 8px rgba(0,0,0,.7)}
/* 強さ: 物干しの洗濯ばさみに手ぬぐいが下がる見た目。選んだものだけ手ぬぐいの色がつく */
.mode-sel{margin-top:auto;padding-top:10px}
.mode-sel + .level{margin-top:6px}
.level{margin-top:auto;display:flex;align-items:flex-end;gap:10px;padding-top:14px;border-top:2px solid rgba(255,255,255,.55);width:max-content;max-width:100%}
.level .lv-h{font-size:13px;font-weight:700;color:#fff;align-self:center;margin-right:2px;text-shadow:0 1px 6px rgba(0,0,0,.6)}
.level button{position:relative;font-weight:900;font-size:15px;color:#fff;padding:14px 10px 6px;text-shadow:0 1px 6px rgba(0,0,0,.6)}
.level button::before{content:'';position:absolute;left:50%;top:-6px;width:4px;height:12px;margin-left:-2px;background:#c9b27a;border-radius:1px}
.level button[aria-checked=true]{background:var(--me);text-shadow:none;clip-path:polygon(0 0,100% 0,100% 88%,92% 100%,80% 90%,66% 100%,50% 90%,34% 100%,20% 90%,8% 100%,0 88%)}
.title-actions{margin-top:14px;display:flex;align-items:center;gap:18px;width:100%}
/* 押してほしいボタンはこれ1つだけ厚みをつける */
.go{min-width:min(220px,58vw);padding:14px 26px;font-weight:900;font-size:24px;letter-spacing:.08em;color:#fff;background:var(--me);border-radius:999px 999px 999px 4px;box-shadow:0 5px 0 #7c2014,0 10px 22px rgba(0,0,0,.3);transition:transform .08s}
.go:active{transform:translateY(4px);box-shadow:0 1px 0 #7c2014}
.go.small{font-size:19px;min-width:170px;padding:11px 22px}
.text-btn{font-weight:700;font-size:16px;color:#fff;padding:8px 4px;border-bottom:2px solid rgba(255,255,255,.7);text-shadow:0 1px 6px rgba(0,0,0,.6)}
.text-btn.dark{color:var(--ink);text-shadow:none;border-color:var(--ink)}
.foot{display:flex;gap:14px;margin-top:16px}
.mini{display:inline-flex;align-items:center;min-height:34px;padding:0 4px;font-size:13px;font-weight:700;color:rgba(255,255,255,.88);white-space:nowrap;text-shadow:0 1px 4px rgba(0,0,0,.7)}
.mini::before{content:'';width:6px;height:6px;margin-right:6px;background:currentColor;border-radius:1px;transform:rotate(45deg);opacity:.7}

/* ---------- 遊び方・休憩 ---------- */
#how,#pause{display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(14,18,34,.6)}
.sheet{width:min(430px,100%);max-height:calc(100svh - 32px);overflow:hidden;background:var(--paper);padding:20px 22px 16px;border-radius:4px;display:flex;flex-direction:column;align-items:center}
.sheet.narrow{width:min(300px,100%)}
.sheet h2{font-family:var(--pop);font-weight:400;font-size:28px;margin-bottom:12px}
.sheet ol{list-style:none;font-size:15px;line-height:1.6;display:flex;flex-direction:column;gap:12px;width:100%}
.sheet li{word-break:auto-phrase;display:grid;grid-template-columns:28px 1fr;gap:8px;align-items:start}
.sheet li i{font-style:normal;font-family:var(--pop);font-size:22px;line-height:1.1;color:var(--me)}
.sheet .keys{font-size:12px;color:#5a5245;margin:12px 0;text-align:center;line-height:1.5}
.sheet .keys:empty{margin:6px 0}
.sheet .credit{font-size:10px;color:#7a7264;margin-top:10px;text-align:center;line-height:1.4}
#pause .sheet button+button{margin-top:14px}

/* ---------- 遊び中 ---------- */
#hud{position:fixed;inset:0;z-index:5;pointer-events:none}
/* 速さの線と、取った瞬間の光（2026-11-02 本人「爽快感・迫力が欲しい」） */
#speedfx{position:fixed;inset:0;width:100%;height:100%;z-index:4;pointer-events:none}
#hitflash{position:fixed;inset:0;z-index:4;pointer-events:none;background:radial-gradient(ellipse at center,rgba(255,255,255,0) 35%,rgba(255,244,214,.55) 100%);opacity:0}
/* 物干しロープ: 4人の手ぬぐいの本数がそのまま点数 */
.rope-bar{position:absolute;left:max(8px,env(safe-area-inset-left));right:max(60px,calc(env(safe-area-inset-right) + 54px));top:max(6px,env(safe-area-inset-top));display:flex;align-items:flex-start;gap:8px}
.line{position:relative;flex:1;display:flex;justify-content:space-around;padding-top:9px;min-width:0}
.line::before{content:'';position:absolute;left:-4px;right:-4px;top:6px;height:12px;border-top:2px solid var(--cord);border-radius:50%/100% 100% 0 0;transform:scaleY(-1);filter:drop-shadow(0 1px 1px rgba(0,0,0,.5))}
.peg{position:relative;display:flex;flex-direction:column;align-items:center;min-width:0}
.peg .towels{display:flex;gap:3px;height:34px;align-items:flex-start}
.peg .towels i{display:block;width:11px;height:30px;background:var(--c);border-top:3px solid #c9b48a;box-shadow:inset 0 5px 0 -3px rgba(255,255,255,.85),inset 0 -6px 0 -4px rgba(255,255,255,.85),0 2px 3px rgba(0,0,0,.35);transform-origin:50% 0;animation:flap 1.6s ease-in-out infinite}
.peg .towels i:nth-child(2){animation-delay:-.4s}.peg .towels i:nth-child(3){animation-delay:-.9s}.peg .towels i:nth-child(4){animation-delay:-1.2s}
.peg .towels span{font-weight:900;font-size:13px;color:#fff;text-shadow:0 1px 3px #000;align-self:center}
.peg .towels em{display:block;width:12px;height:12px;margin-top:2px;border:2px dashed rgba(255,255,255,.6);border-radius:2px}
.peg b{font-size:11px;font-weight:900;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.9);white-space:nowrap}
.peg[data-i="0"] b{color:#ffd9cf}
.peg.glow .towels i{box-shadow:0 0 10px 3px var(--c),inset 0 5px 0 -3px rgba(255,255,255,.85)}
.peg.bump{animation:bump .45s ease-out}
@keyframes flap{0%,100%{transform:rotate(-4deg)}50%{transform:rotate(5deg)}}
@keyframes bump{0%{transform:scale(1)}35%{transform:scale(1.35)}100%{transform:scale(1)}}
.clock{display:flex;flex-direction:column;align-items:center;flex:none}
.clock svg{width:38px;height:38px;filter:drop-shadow(0 2px 3px rgba(0,0,0,.4))}
.clock b{font-size:12px;font-weight:900;color:#fff;text-shadow:0 1px 3px #000;margin-top:-1px}
.glow-warn{position:absolute;left:50%;bottom:max(160px,calc(env(safe-area-inset-bottom) + 150px));transform:translateX(-50%);font-weight:900;font-size:17px;color:#fff;background:rgba(200,50,30,.85);padding:6px 14px;border-radius:3px;animation:pulse .7s ease-in-out infinite alternate;white-space:nowrap}
@keyframes pulse{from{opacity:.75}to{opacity:1}}
.say{position:absolute;left:50%;top:22%;transform:translateX(-50%);width:max-content;max-width:min(520px,calc(100% - 32px));font-weight:900;font-size:19px;line-height:1.35;color:#fff;text-align:center;text-shadow:0 2px 6px rgba(0,0,0,.85)}
.say small{display:block;font-size:12px;color:#ffe2a6;font-weight:700}
.say.good{font-size:24px;color:#fff3c2}
.say.bad{font-size:22px;color:#ffc2b5}
.say.small{font-size:14px;top:28%;opacity:.9}
.say.big{font-family:var(--pop);font-weight:400;font-size:34px;top:30%}
.edge-arrow{position:absolute;left:0;top:0;width:54px;height:54px;margin:-27px 0 0 -27px;display:flex;flex-direction:column;align-items:center;justify-content:center}
.edge-arrow svg{width:28px;height:28px;fill:var(--c,#fff);stroke:#1c1c1c;stroke-width:1.4}
.edge-arrow span{font-size:12px;font-weight:900;color:#fff;text-shadow:0 1px 3px #000}
.miss{position:absolute;left:0;top:0;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;color:#fff;text-shadow:0 1px 4px #000;animation:fadeUp .8s ease-out forwards}
.miss span{font-size:40px;line-height:1;color:var(--me);-webkit-text-stroke:1.5px #fff}
.miss small{font-size:13px;font-weight:700}
@keyframes fadeUp{0%{opacity:1}100%{opacity:0;transform:translate(-50%,-80%)}}
.corner-btn{position:absolute;right:max(10px,env(safe-area-inset-right));top:max(10px,env(safe-area-inset-top));pointer-events:auto;width:40px;height:40px;display:flex;align-items:center;justify-content:center}
.corner-btn svg{width:22px;height:22px;fill:#fff;filter:drop-shadow(0 1px 2px rgba(0,0,0,.8))}
/* スマホ操作: 左のスティックと、右の跳ぶだけ */
.touch{position:absolute;inset:0;pointer-events:none}
/* 左スティックは左下に固定（2026-11-03 本人「左スティックは固定で」）。触る所はスティックの円の少し外まで */
.stickzone{position:absolute;left:0;bottom:0;width:calc(max(16px,env(safe-area-inset-left)) + 62px + 88px);height:calc(max(16px,env(safe-area-inset-bottom)) + 62px + 88px);pointer-events:auto;touch-action:none}
.stick{position:absolute;left:calc(max(16px,env(safe-area-inset-left)) + 62px);top:calc(100% - max(16px,env(safe-area-inset-bottom)) - 62px);width:124px;height:124px;margin:-62px 0 0 -62px;border-radius:50%;border:2px solid rgba(255,255,255,.45);background:rgba(14,18,34,.22);opacity:.65;pointer-events:none}
.stick.held{opacity:1}
.stick .knob{position:absolute;left:50%;top:50%;width:54px;height:54px;margin:-27px 0 0 -27px;border-radius:50%;background:rgba(243,239,228,.85)}
.tbtn{position:absolute;right:max(16px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));pointer-events:auto;width:104px;height:104px;border-radius:50%;background:rgba(243,239,228,.2);border:2px solid rgba(255,255,255,.7);color:#fff;font-weight:900;font-size:15px;touch-action:none;display:flex;align-items:center;justify-content:center;text-shadow:0 1px 3px rgba(0,0,0,.8)}
.tbtn svg{width:52px;height:52px}
.tbtn:active{transform:scale(.94);background:rgba(243,239,228,.4)}

/* ---------- 結果: 表彰台 ---------- */
#result{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:max(10px,env(safe-area-inset-top)) 14px max(12px,env(safe-area-inset-bottom));background:rgba(10,12,24,.82)}
.res-wrap{position:relative;flex:1;min-height:0;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px}
#podium{max-width:100%;min-height:0;flex:0 1 auto;max-height:calc(100% - 92px);aspect-ratio:720/560;object-fit:contain;border-radius:4px}
.rank-big{font-family:var(--pop);font-size:min(16vw,72px);line-height:1;color:#fff;text-shadow:0 4px 0 rgba(0,0,0,.35)}
.rank-big.r1{color:#ffd76a}
#result.play .rank-big{animation:slam .6s cubic-bezier(.2,1.4,.4,1) both}
#result.play #podium{animation:rise .7s .15s ease-out both}
@keyframes slam{0%{transform:scale(2.4) rotate(-8deg);opacity:0}100%{transform:scale(1) rotate(-3deg);opacity:1}}
@keyframes rise{0%{transform:translateY(30px);opacity:0}100%{transform:none;opacity:1}}
.res-line{display:flex;flex-direction:column;align-items:center;gap:2px;color:#fff}
.verdict{font-weight:900;font-size:18px}
.stats{display:flex;gap:14px;font-size:13px;color:rgba(255,255,255,.8)}
.stats b{font-size:17px;color:#fff;margin-left:2px}
.result-actions{display:flex;flex-direction:column;gap:6px;align-items:center;color:#fff}
.result-actions .row{display:flex;gap:16px}

@media (orientation:landscape) and (max-height:500px){
  #title{padding-top:max(14px,env(safe-area-inset-top))}
  .logo{font-size:min(10vh,44px)}.sub{font-size:13px;margin-top:4px}
  .go{padding:10px 22px;font-size:20px}
  .foot{margin-top:6px}
  .sheet ol{font-size:13px;gap:4px}.sheet h2{font-size:22px;margin-bottom:4px}.sheet{padding:12px 18px 10px}
  .stick{width:108px;height:108px;margin:-54px 0 0 -54px}
  .tbtn{width:88px;height:88px}
  .glow-warn{bottom:max(130px,calc(env(safe-area-inset-bottom) + 120px))}
  #result{flex-direction:row}
  .res-wrap{height:100%}
  #podium{max-height:calc(100% - 110px)}
  .rank-big{font-size:40px}
  .result-actions{width:200px}
  .result-actions .row{flex-direction:column;gap:2px;align-items:center}
}

/* 方角だけの矢印（画面の上の真ん中に固定。2026-11-03） */
#arrow{left:50%;top:max(118px,calc(env(safe-area-inset-top) + 110px))}
@media (orientation:landscape) and (max-height:500px){#arrow{top:max(70px,calc(env(safe-area-inset-top) + 62px))}}

/* ロード画面（ゲームの雰囲気。2026-11-03 本人「読み込みが遅い。いい感じのロード中の画面を」） */
#boot{flex-direction:column;gap:14px;background:radial-gradient(ellipse at 50% 30%,#2b3358,#141a30 70%);transition:opacity .35s}
#boot.out{opacity:0}
.bt-scene{width:min(78vw,340px)}
.bt-line{width:100%;height:auto;overflow:visible}
.bt-tw{transform-box:fill-box;transform-origin:50% 0;opacity:.12;transition:opacity .3s}
.bt-tw:nth-child(2){opacity:calc(.12 + .88 * min(1, max(0, var(--p) * 4 - 0)))}
.bt-tw:nth-child(3){opacity:calc(.12 + .88 * min(1, max(0, var(--p) * 4 - 1)))}
.bt-tw:nth-child(4){opacity:calc(.12 + .88 * min(1, max(0, var(--p) * 4 - 2)))}
.bt-tw:nth-child(5){opacity:calc(.12 + .88 * min(1, max(0, var(--p) * 4 - 3)))}
.bt-tw{animation:btflap 1.4s ease-in-out infinite}.bt-tw:nth-child(3){animation-delay:-.35s}.bt-tw:nth-child(4){animation-delay:-.7s}.bt-tw:nth-child(5){animation-delay:-1s}
@keyframes btflap{0%,100%{transform:rotate(-5deg) skewY(2deg)}50%{transform:rotate(6deg) skewY(-3deg)}}
.bt-msg{margin:0;font-weight:900;font-size:17px;letter-spacing:.06em;color:#f3efe4}
.bt-bar{width:min(60vw,220px);height:4px;background:rgba(255,255,255,.18);border-radius:2px;overflow:hidden}
.bt-bar i{display:block;height:100%;width:calc(var(--p) * 100%);background:#e8e2d2;transition:width .25s}
#boot.out{pointer-events:none}
