/* ステージ画面 — Gummin の test-ser.html（ステージ選択）と同じ形 */

body.stage-page{height:100vh; height:100svh; min-height:0; overflow:hidden; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; counter-reset:card}
body.stage-page > *{position:relative; z-index:2}
body.stage-page > #fallBg{position:fixed; z-index:1}
body.stage-page > .start-btn-area{position:relative; z-index:50; flex:none}
body.stage-page > .mode-select-overlay{position:fixed; z-index:200}
body.stage-page > .overlay{position:fixed; z-index:500}
body.stage-page > .toast{position:fixed; z-index:900}

/* 大きなタブ */
.big-tab-bar{
  display:flex; gap:4px; width:calc(100% - 32px); max-width:400px; padding:4px;
  margin-top:calc(env(safe-area-inset-top) + 20px); margin-bottom:14px;
  background:var(--panel-bg);
  border:2px solid var(--border); border-radius:999px;
  box-shadow:0 5px 0 var(--shadow-strong), 0 8px 20px var(--shadow), inset 0 1px 0 rgba(255,255,255,.7);
}
.big-tab{flex:1; padding:11px 16px; border-radius:999px; border:none; background:none; cursor:pointer; color:var(--text-sub);
  font-weight:800; font-size:calc(clamp(14px,3.8vw,17px) * var(--fs)); line-height:1.2; transition:all .15s}
.big-tab.active{background:var(--accent); color:#fff; box-shadow:0 2px 8px var(--accent-shadow)}
.big-tab:not(.active):active{transform:scale(.95)}

/* チップの帯 */
.chip-wrap{width:100%; max-width:500px; margin-bottom:12px; padding:0 16px}
.chip-wrap[hidden]{display:none}
.chip-bar{
  display:flex; gap:8px; overflow-x:auto; padding:8px 12px; scrollbar-width:none;
  background:var(--panel-bg);
  border-radius:999px; border:2px solid var(--border);
  box-shadow:0 5px 0 var(--shadow-strong), 0 8px 18px var(--shadow), inset 0 1px 0 rgba(255,255,255,.7);
}
.chip-bar::-webkit-scrollbar{display:none}
.chip{flex:1 0 auto; padding:6px 16px; border-radius:999px; border:none; background:none; cursor:pointer; white-space:nowrap;
  color:var(--text-sub); font-weight:800; font-size:calc(13px * var(--fs)); transition:all .1s}
.chip.active{background:var(--accent); color:#fff; box-shadow:0 2px 6px var(--accent-shadow)}
.chip:active{transform:scale(.94)}

/* 見出し */
.stage-title{margin-bottom:12px; min-height:46px; display:flex; align-items:center; justify-content:center; overflow:hidden; padding:0 16px;
  font-size:calc(clamp(18px,5vw,24px) * var(--fs)); font-weight:900; text-align:center; color:var(--title)}
html[data-bg="faveweather"] .stage-title{color:#10294f}
.stage-title-message.enter{animation:titleIn .35s ease both}
@keyframes titleIn{from{opacity:0; transform:translateY(8px)}to{opacity:1; transform:none}}

/* カードの一覧 */
.stage-scroll{
  width:100%; max-width:1100px; padding:6px 22px 22px;
  flex:1 1 0; min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  scrollbar-width:thin; scrollbar-color:var(--accent-shadow) transparent;
}
.stage-scroll::-webkit-scrollbar{width:4px}
.stage-scroll::-webkit-scrollbar-thumb{background:var(--accent-shadow); border-radius:999px}
.stage-list{display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr)); gap:12px; width:100%}

.stage-btn{
  position:relative; padding:14px 18px; border-radius:18px; border:2px solid var(--border); text-align:left; cursor:pointer;
  background:rgba(255,255,255,.97); color:var(--text); overflow:hidden; counter-increment:card;
  box-shadow:0 6px 0 var(--shadow-strong), 0 8px 20px var(--shadow), inset 0 1px 0 rgba(255,255,255,.7);
  transition:transform .12s, box-shadow .12s; animation:cardIn .4s ease both; animation-delay:calc(var(--i, 0) * 50ms);
}
@keyframes cardIn{from{opacity:0; transform:translateY(10px)}to{opacity:1; transform:none}}
.stage-btn:hover{transform:translateY(-2px)}
.stage-btn:active{transform:translateY(5px); box-shadow:0 1px 0 rgba(0,0,0,.16), 0 3px 8px rgba(0,0,0,.1)}
.stage-fill{position:absolute; inset:0; z-index:0; pointer-events:none; opacity:.72; background:linear-gradient(135deg, var(--g-light), var(--g-base)); clip-path:circle(0 at var(--px,50%) var(--py,50%)); transition:clip-path .7s cubic-bezier(.2,.7,.2,1)}
.stage-btn.dyed .stage-fill{clip-path:circle(150% at var(--px,50%) var(--py,50%))}
.stage-name,.stage-desc{position:relative; z-index:1; display:block}
.stage-text{position:relative; z-index:1; display:block; min-width:0}
.stage-btn.has-icon{display:flex; align-items:center; gap:14px}
.stage-icon{position:relative; z-index:1; flex:none; width:56px; height:56px; border-radius:15px; object-fit:cover; background:#fff; box-shadow:0 3px 8px rgba(0,0,0,.18)}
.stage-name{font-weight:900; font-size:calc(17px * var(--fs)); color:#2a2440; padding-right:78px; line-height:1.35; overflow-wrap:anywhere}
.stage-desc{font-size:calc(12px * var(--fs)); margin-top:3px; color:#2a2440; opacity:.78; line-height:1.55}
.stage-mark{
  position:absolute; right:10px; top:8px; z-index:2; padding:4px 8px; border-radius:999px; max-width:46%;
  background:var(--accent); color:#fff; font-size:calc(10px * var(--fs)); font-weight:900; letter-spacing:.04em;
  box-shadow:0 2px 6px var(--accent-shadow); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* 下のボタン */
.start-btn-area{width:100%; padding:6px 12px calc(max(env(safe-area-inset-bottom),14px) + 6px); display:flex; flex-direction:row; justify-content:center; align-items:center; gap:10px}
.start-btn-row{display:flex; justify-content:center; align-items:center}
.gummy-btn{display:inline-flex; align-items:center; justify-content:center; padding:0; background:transparent; border:none; cursor:pointer; transition:transform .12s; -webkit-user-drag:none; text-decoration:none}
.gummy-btn img{width:clamp(120px,42vw,190px); height:auto; filter:drop-shadow(0 6px 14px rgba(0,0,0,.2))}
.gummy-btn:active{transform:translateY(4px)}

/* ポップアップ（Gummin の「どれに挑戦しますか？」と同じ形）*/
.mode-select-overlay{display:none; align-items:center; justify-content:center; padding:20px; inset:0; background:rgba(0,0,0,.35)}
.mode-select-overlay.show{display:flex}
@keyframes popBounce{0%{transform:scale(.7); opacity:0}70%{transform:scale(1.06); opacity:1}100%{transform:scale(1); opacity:1}}
.mode-select-popup{
  width:min(440px,100%); max-height:92vh; max-height:92svh; overflow-y:auto; padding:26px 22px 14px; text-align:center;
  background:var(--panel-shine);
  border:2px solid var(--border-strong); border-radius:32px; box-shadow:0 18px 55px rgba(0,0,0,.25); animation:popBounce .32s ease both;
}
.pop-icon{width:84px; height:84px; margin:0 auto 12px; border-radius:24px; overflow:hidden; display:grid; place-items:center; background:var(--glow3); font-size:44px; box-shadow:0 7px 18px var(--accent-shadow)}
.pop-icon img{width:100%; height:100%; object-fit:cover}
.pop-name{font-size:calc(22px * var(--fs)); font-weight:900; color:var(--title); line-height:1.35}
.pop-chip{display:inline-block; margin-top:6px; padding:2px 12px; border-radius:999px; font-size:calc(12px * var(--fs)); font-weight:900; color:var(--accent-dark); background:var(--glow1)}
.pop-desc{margin-top:12px; font-size:calc(14px * var(--fs)); font-weight:700; color:var(--text-sub); line-height:1.75}
.pop-actions{display:flex; flex-direction:column; gap:10px; margin-top:16px}
.pop-link{display:block; padding:13px; border-radius:14px; text-decoration:none; font-weight:900; font-size:calc(15px * var(--fs))}
.pop-link.primary{color:#fff; background:var(--accent); box-shadow:0 4px 0 var(--accent-dark)}
.pop-link.sub{color:var(--accent-dark); background:var(--panel-bg); border:2px solid var(--accent-border); box-shadow:0 3px 0 var(--shadow-strong)}
.pop-link:active{transform:translateY(3px)}
.pop-actions .note{padding:13px; border-radius:14px; background:var(--border); color:var(--text-sub); font-weight:700; font-size:calc(13px * var(--fs))}
.pop-divider{height:2px; margin:14px 0 4px; border-radius:2px; background:var(--border)}
.pop-back{margin:0 auto}
.pop-back img{width:clamp(120px,30vw,160px)}
.pop-back .gbtn{width:clamp(120px,30vw,160px); height:60px; font-size:24px}

@media (max-height:640px){
  .stage-title{min-height:36px; margin-bottom:6px}
}

/* ── タブレット・パソコン：ボタンを大きく（スマホは今のまま）── */
@media (min-width:768px){
  .big-tab-bar{max-width:600px; padding:6px; margin-top:30px; margin-bottom:18px}
  .big-tab{padding:16px 20px; font-size:calc(21px * var(--fs))}
  .chip-wrap{max-width:640px} .chip-bar{padding:10px 14px} .chip{padding:10px 22px; font-size:calc(17px * var(--fs))}
  .stage-title{font-size:calc(30px * var(--fs)); min-height:58px}
  .stage-list{gap:18px; grid-template-columns:repeat(auto-fit,minmax(min(100%,330px),1fr))}
  .stage-btn{padding:22px 26px; border-radius:22px} .stage-name{font-size:calc(22px * var(--fs)); padding-right:96px} .stage-desc{font-size:calc(15px * var(--fs)); margin-top:5px}
  .stage-mark{font-size:calc(12px * var(--fs)); padding:5px 12px; right:14px; top:12px}
  .start-btn-area{gap:28px; padding-bottom:max(env(safe-area-inset-bottom),28px)}
  .gummy-btn img{width:min(250px,26vw,24vh)}
  .mode-select-popup{width:min(560px,100%); padding:34px 32px 20px; border-radius:38px}
  .pop-icon{width:104px; height:104px; border-radius:30px} .pop-name{font-size:calc(28px * var(--fs))} .pop-desc{font-size:calc(17px * var(--fs))}
  .pop-link{padding:18px; font-size:calc(19px * var(--fs)); border-radius:18px} .pop-back img{width:200px} .pop-back .gbtn{width:200px; height:76px}
}

/* ── 色覚サポート：色だけに頼らず、記号と枠線でも見分けられるようにする ── */
html[data-cvd="1"] .stage-btn{border-width:3px; border-color:#1d1b30}
html[data-cvd="1"] .stage-fill{background:repeating-linear-gradient(135deg,rgba(255,255,255,.9) 0 9px,rgba(160,170,200,.55) 9px 12px); opacity:.9}
html[data-cvd="1"] .stage-name::before{content:counter(card, upper-alpha) '  '; display:inline-block; min-width:1.6em; margin-right:.2em; padding:0 .3em; border-radius:6px; background:#1d1b30; color:#fff; text-align:center}
html[data-cvd="1"] .stage-name,html[data-cvd="1"] .stage-desc{color:#0d0c1a; opacity:1}
html[data-cvd="1"] .stage-mark{background:#1d1b30}
html[data-cvd="1"] .big-tab.active::before,html[data-cvd="1"] .chip.active::before{content:'✓ '}
html[data-cvd="1"] .big-tab-bar,html[data-cvd="1"] .chip-bar{border-color:#1d1b30}

@media (prefers-reduced-motion: reduce){ .stage-btn,.mode-select-popup,.stage-title-message.enter{animation:none} }
.copy-mark{cursor:pointer}
