/* 旅のモードの画面 (スマホの横画面。CSS の px は、そのままスマホの pt)。
   ゲームらしい見た目: ななめに切った角・ネオンのふち・太い文字。絵文字や記号の文字は使わず、形は CSS で描く */
.story {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  --safe-l: max(14px, env(safe-area-inset-left));
  --safe-r: max(14px, env(safe-area-inset-right));
  --safe-b: max(8px, env(safe-area-inset-bottom));
}
.story > * { pointer-events: auto; }

/* 旅のモードとタイトルでは、配信版のタイトル・ランキング・結果を出さない */
body:not([data-mode="free"]) #lobby,
body:not([data-mode="free"]) #board,
body:not([data-mode="free"]) #results,
body:not([data-mode="free"]) #howto { display: none !important; }
/* 試合のとき以外は、右下の歯車と上の帯を出さない (画面の上の帯に、歯車がある) */
body:not([data-screen="battle"]):not([data-screen="free"]) #gear,
body[data-screen="title"] #hud,
body[data-screen="map"] #hud,
body[data-screen="garage"] #hud,
body[data-screen="naming"] #hud,
body[data-screen="ceremony"] #hud { display: none !important; }

/* ---- 部品 ---- */
.st-btn {
  position: relative;
  min-height: 40px;
  padding: 0 20px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: rgba(14, 10, 38, 0.88);
  color: var(--text);
  font: 900 15px var(--font);
  letter-spacing: 0.04em;
  transform: skewX(-12deg);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s, filter 0.15s;
}
.st-btn > span { display: inline-block; transform: skewX(12deg); }
.st-btn:active { transform: skewX(-12deg) scale(0.95); filter: brightness(1.3); }
.st-btn.primary { border-color: transparent; background: linear-gradient(180deg, #ffe78c, var(--yellow)); color: #1a0a2a; box-shadow: 0 0 18px rgba(255, 210, 61, 0.35); }
.st-btn.cyan { border-color: var(--cyan); color: #dffcff; box-shadow: inset 0 0 12px rgba(63, 240, 255, 0.25); }
.st-btn.pink { border-color: var(--pink); color: #ffe3f3; box-shadow: inset 0 0 12px rgba(255, 79, 184, 0.3); }
.st-btn.big { min-height: 50px; padding: 0 30px; font-size: 19px; }
.st-btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; }
.st-btn.off { filter: grayscale(0.9) brightness(0.6); }

.st-panel {
  position: absolute;
  background:
    linear-gradient(rgba(12, 8, 34, 0.9), rgba(12, 8, 34, 0.9)) padding-box,
    linear-gradient(135deg, var(--cyan), var(--pink) 60%, var(--yellow)) border-box;
  border: 2px solid transparent;
  --cut: 16px;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

.st-head {
  position: absolute;
  top: 8px;
  left: var(--safe-l);
  right: var(--safe-r);
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.st-spacer { flex: 1; }
.st-screen-title { font: 400 22px var(--display); transform: skewX(-8deg); text-shadow: -2px 0 0 var(--pink), 2px 0 0 var(--cyan); }
.st-gear {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(7, 5, 26, 0.7);
  color: rgba(255, 255, 255, 0.8);
}
.st-gear svg { width: 24px; height: 24px; fill: currentColor; display: block; margin: auto; }

/* 素材: 色のついたひし形 + 数 */
.st-mats { display: flex; gap: 6px; }
.st-mat { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 8px; background: rgba(7, 5, 26, 0.75); border: 1px solid rgba(255, 255, 255, 0.14); font: 900 14px var(--font); }
.st-mat i, .st-reward i { width: 12px; height: 12px; transform: rotate(45deg); background: var(--mat); box-shadow: 0 0 8px var(--mat); border: 1px solid rgba(255, 255, 255, 0.7); }
.mat-iron { --mat: #c9cbe0; }
.mat-silver { --mat: #9fe6ff; }
.mat-gold { --mat: #ffd23d; }
.st-mat.short b { color: var(--red); }

.st-kicker { font: 900 12px var(--font); letter-spacing: 0.3em; color: var(--cyan); }
.st-h { margin: 2px 0 4px; font: 400 20px var(--display); line-height: 1.25; }
.st-p { margin: 0 0 8px; font: 700 13px/1.55 var(--font); color: var(--muted); }
.st-label, .st-row-label { margin: 8px 0 4px; font: 900 11px var(--font); letter-spacing: 0.12em; color: var(--dim); }

@keyframes st-shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake { animation: st-shake 0.32s; }

/* ---- タイトル ---- */
.st-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: radial-gradient(ellipse at center, rgba(7, 5, 26, 0.35), rgba(7, 5, 26, 0.75));
  cursor: pointer;
}
.st-logo { display: flex; flex-direction: column; align-items: center; line-height: 0.95; transform: skewX(-10deg) rotate(-4deg); animation: st-logo-in 0.7s cubic-bezier(0.2, 1.5, 0.4, 1); }
.st-logo .a { font: 400 clamp(36px, 9vh, 52px) var(--display); color: #fff; text-shadow: -4px 0 0 var(--pink), 4px 0 0 var(--cyan), 0 6px 0 rgba(0, 0, 0, 0.5); }
.st-logo .b { font: 400 clamp(52px, 15vh, 84px) var(--display); color: var(--yellow); text-shadow: -5px 0 0 var(--pink), 5px 0 0 var(--cyan), 0 8px 0 rgba(0, 0, 0, 0.5); }
.st-title-sub { margin-top: 6px; padding: 4px 18px; font: 900 16px var(--font); letter-spacing: 0.5em; background: var(--pink); transform: skewX(-12deg); }
.st-tap { margin-top: 18px; font: 900 15px var(--font); letter-spacing: 0.2em; color: #fff; animation: st-blink 1.3s ease-in-out infinite; }
@keyframes st-blink { 50% { opacity: 0.25; } }
@keyframes st-logo-in { from { transform: skewX(-10deg) rotate(-4deg) scale(2.4); opacity: 0; } }

/* ---- 名前をつける ---- */
.st-naming {
  top: 10px;
  right: var(--safe-r);
  width: min(50vw, 420px);
  padding: 14px 20px 16px;
}
.st-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 2px solid var(--cyan);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font: 900 20px var(--font);
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
}
.st-input:focus { box-shadow: 0 0 16px rgba(63, 240, 255, 0.5); }
.st-swatches { display: flex; gap: 8px; margin-bottom: 12px; }
.st-swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, hsl(var(--h) 100% 80%), hsl(var(--h) 95% 52%) 60%, hsl(var(--h) 80% 28%));
}
.st-swatch.on { border-color: #fff; box-shadow: 0 0 0 3px hsl(var(--h) 100% 60% / 0.6), 0 0 14px hsl(var(--h) 100% 60%); transform: scale(1.12); }

/* ---- 魂が宿る ---- */
.st-ceremony { position: absolute; inset: 0; pointer-events: none !important; overflow: hidden; }
.st-cer-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60vh;
  height: 60vh;
  margin: -30vh 0 0 -30vh;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 79, 184, 0.25) 35%, transparent 68%);
  animation: st-glow-in 1.6s ease-in forwards;
}
@keyframes st-glow-in { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.st-mote {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px;
  border-radius: 50%;
  background: hsl(var(--h) 100% 75%);
  box-shadow: 0 0 10px 3px hsl(var(--h) 100% 60%);
  opacity: 0;
  animation: st-mote 0.9s var(--d) cubic-bezier(0.5, 0, 0.9, 0.4) forwards;
}
@keyframes st-mote {
  from { transform: translate(var(--x), var(--y)) scale(1.6); opacity: 0; }
  20% { opacity: 1; }
  to { transform: translate(0, 0) scale(0.3); opacity: 1; }
}
.st-ceremony.burst .st-mote { display: none; }
.st-ceremony.burst .st-cer-glow { animation: st-glow-burst 0.9s ease-out forwards; }
@keyframes st-glow-burst { from { transform: scale(1); opacity: 1; } to { transform: scale(3.2); opacity: 0; } }
.st-born {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 74px);
  text-align: center;
  animation: st-slam 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.st-born-name {
  display: inline-block;
  font: 400 clamp(40px, 13vh, 64px) var(--display);
  color: hsl(var(--h) 100% 82%);
  transform: skewX(-8deg);
  text-shadow: -4px 0 0 var(--pink), 4px 0 0 var(--cyan), 0 0 24px hsl(var(--h) 100% 60%), 0 6px 0 rgba(0, 0, 0, 0.55);
}
.st-born-sub { font: 900 20px var(--font); color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9); }
@keyframes st-slam { from { transform: scale(2.6); opacity: 0; } }
.st-born-go { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 14px); margin-left: -80px; width: 160px; pointer-events: auto; animation: st-fade-up 0.4s ease-out; }
@keyframes st-fade-up { from { opacity: 0; transform: skewX(-12deg) translateY(12px); } }

/* ---- 旅の地図 ---- */
.st-dim { position: absolute; inset: 0; pointer-events: none !important; background: linear-gradient(180deg, rgba(7, 5, 26, 0.55), rgba(7, 5, 26, 0.25) 45%, rgba(7, 5, 26, 0.6)); }
.st-world { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 16px 0 0; background: rgba(7, 5, 26, 0.8); border-left: 4px solid var(--pink); transform: skewX(-12deg); }
.st-world b { padding: 0 10px; height: 100%; display: grid; place-items: center; background: var(--pink); font: 400 15px var(--display); }
.st-world span { font: 900 15px var(--font); }
.st-path {
  position: absolute;
  top: 56px;
  left: calc(var(--safe-l) + 10px);
  right: calc(var(--safe-r) + 10px);
  height: calc(100% - 56px - 150px - var(--safe-b));
}
.st-path svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.st-path polyline { fill: none; stroke: rgba(63, 240, 255, 0.6); stroke-width: 3; stroke-dasharray: 2 6; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px rgba(63, 240, 255, 0.8)); }
.st-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
}
.st-node-badge {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #2a1b6e, #120a36);
  border: 3px solid var(--cyan);
  box-shadow: 0 0 14px rgba(63, 240, 255, 0.5);
}
.st-node-badge b { transform: rotate(-45deg); font: 400 15px var(--display); }
.st-node-name { font: 900 12px var(--font); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95); white-space: nowrap; }
.st-node-tag { position: absolute; top: -14px; padding: 1px 8px; font: 900 11px var(--font); font-style: normal; background: var(--orange); color: #2a1200; transform: skewX(-12deg); z-index: 1; }
.st-node.boss .st-node-badge { width: 62px; height: 62px; border-color: var(--red); background: linear-gradient(135deg, #6e1030, #250412); box-shadow: 0 0 20px rgba(255, 74, 106, 0.7); }
.st-node.boss .st-node-tag { background: var(--red); color: #fff; top: -18px; }
.st-node.midboss .st-node-badge { border-color: var(--orange); box-shadow: 0 0 16px rgba(255, 179, 71, 0.6); }
.st-node.done .st-node-badge { border-color: var(--yellow); }
.st-node-clear { position: absolute; top: 20px; padding: 0 6px; font: 400 11px var(--display); font-style: normal; color: #1a0a2a; background: var(--yellow); transform: rotate(-12deg); }
.st-node.on .st-node-badge { animation: st-pulse 1.1s ease-in-out infinite; background: linear-gradient(135deg, #ff4fb8, #7a1a8f); }
.st-node.locked { opacity: 0.45; filter: grayscale(1); }
@keyframes st-pulse { 50% { box-shadow: 0 0 26px 6px rgba(255, 79, 184, 0.75); } }

.st-map-bottom {
  position: absolute;
  left: var(--safe-l);
  right: var(--safe-r);
  bottom: var(--safe-b);
  height: 140px;
  display: flex;
  gap: 12px;
}
.st-map-side { display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 0 4px 6px; }
.st-stage { position: relative; flex: 1; display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 18px; }
.st-stage-info { flex: 1; min-width: 0; }
.st-stage-title { display: flex; align-items: center; gap: 10px; }
.st-stage-title b { font: 400 20px var(--display); color: var(--yellow); }
.st-stage-title span { font: 900 17px var(--font); }
.st-stage-title em, .st-intro-kind { font-style: normal; }
.st-stage-title em { padding: 1px 8px; font: 900 11px var(--font); transform: skewX(-12deg); }
.st-stage-title em.boss { background: var(--red); }
.st-stage-title em.mid { background: var(--orange); color: #2a1200; }
.st-foes, .st-rewards { display: flex; flex-wrap: wrap; gap: 6px; }
.st-foe { padding: 2px 10px; font: 800 12px var(--font); background: rgba(255, 255, 255, 0.08); border-left: 3px solid hsl(var(--h) 90% 60%); }
.st-foe.boss { background: rgba(255, 74, 106, 0.25); border-left-color: var(--red); font-weight: 900; }
.st-foe.midboss { background: rgba(255, 179, 71, 0.22); border-left-color: var(--orange); font-weight: 900; }
.st-reward { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; font: 800 12px var(--font); background: rgba(255, 255, 255, 0.08); }
.st-reward.part { background: rgba(255, 79, 184, 0.22); }
.st-reward.part b { padding: 0 5px; font: 400 10px var(--display); background: var(--pink); }
.st-first { padding: 2px 8px; font: 900 11px var(--font); color: #1a0a2a; background: var(--mint); }
.st-stage .st-row-label { margin: 6px 0 3px; }

/* ---- ガレージ ---- */
.st-stats {
  left: var(--safe-l);
  bottom: var(--safe-b);
  width: min(31vw, 260px);
  padding: 10px 16px 12px;
}
.st-stats-name { margin-bottom: 6px; font: 400 18px var(--display); color: var(--pink); }
.st-stat { display: grid; grid-template-columns: 30px 1fr 36px; align-items: center; gap: 8px; height: 20px; }
.st-stat-label { font: 900 12px var(--font); color: var(--muted); }
.st-stat b { font: 400 13px var(--display); text-align: right; }
.st-stat-bar { height: 8px; background: rgba(255, 255, 255, 0.1); transform: skewX(-20deg); overflow: hidden; }
.st-stat-bar i { display: block; height: 100%; transition: width 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); }
.st-stat.atk i { background: linear-gradient(90deg, #ff2a5a, #ff8a9e); }
.st-stat.hp i { background: linear-gradient(90deg, #2a6fff, #8ac0ff); }
.st-stat.spd i { background: linear-gradient(90deg, #1fc77a, #8affc4); }
.st-stat.wt i { background: linear-gradient(90deg, #8a8fbd, #e8ecff); }
.st-garage {
  top: 58px;
  right: var(--safe-r);
  bottom: var(--safe-b);
  width: min(52vw, 450px);
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st-tabs { display: flex; gap: 6px; }
.st-tab { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 5px 10px; border: 0; border-bottom: 3px solid transparent; background: rgba(255, 255, 255, 0.06); color: var(--muted); text-align: left; }
.st-tab b { font: 900 13px var(--font); }
.st-tab small { font: 700 10px var(--font); color: var(--dim); }
.st-tab.on { background: rgba(255, 210, 61, 0.16); border-bottom-color: var(--yellow); color: #fff; }
.st-parts { flex: 1; min-height: 44px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.st-part { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 12px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.05); color: var(--text); text-align: left; }
.st-part b { flex: 1; font: 900 14px var(--font); }
.st-part .st-lv { font: 400 13px var(--display); color: var(--yellow); }
.st-part em { font: 900 10px var(--font); font-style: normal; padding: 1px 6px; background: var(--mint); color: #08281e; }
.st-part.on { border-color: var(--cyan); background: rgba(63, 240, 255, 0.1); }
.st-type { width: 20px; height: 20px; display: grid; place-items: center; font: 900 11px var(--font); font-style: normal; color: #14082a; transform: skewX(-12deg); }
.st-detail { border-top: 1px solid var(--line); padding-top: 8px; }
.st-desc { margin: 0 0 6px; font: 700 12px/1.5 var(--font); color: var(--muted); }
.st-nums { display: flex; gap: 6px; margin-bottom: 8px; }
.st-num { display: flex; align-items: baseline; gap: 4px; padding: 2px 8px; background: rgba(255, 255, 255, 0.06); }
.st-num small { font: 800 10px var(--font); color: var(--dim); }
.st-num b { font: 400 14px var(--display); color: var(--mint); }
.st-num.minus b { color: var(--red); }
.st-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-up { display: flex; align-items: center; gap: 8px; }
.st-cost { display: flex; gap: 4px; }
.st-max { font: 900 12px var(--font); color: var(--yellow); }

/* ---- ボスの登場 ---- */
.st-intro {
  position: absolute;
  left: var(--safe-l);
  right: var(--safe-r);
  bottom: calc(var(--safe-b) + 10px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none !important;
}
.st-intro-kind { padding: 0 18px; font: 400 32px var(--display); color: #fff; background: var(--red); transform: skewX(-12deg); animation: st-slide 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.st-intro.midboss .st-intro-kind { background: var(--orange); color: #2a1200; }
.st-intro-name { font: 400 clamp(44px, 14vh, 70px) var(--display); line-height: 1.05; color: #fff; transform: skewX(-8deg); text-shadow: -4px 0 0 var(--red), 4px 0 0 var(--yellow), 0 6px 0 rgba(0, 0, 0, 0.6); animation: st-slam 0.4s 0.15s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.st-intro-title { font: 900 16px var(--font); color: var(--yellow); letter-spacing: 0.3em; text-shadow: 0 2px 6px #000; animation: st-fade-up 0.4s 0.4s both; }
@keyframes st-slide { from { transform: skewX(-12deg) translateX(-120%); } }

/* ---- 旅の結果 ---- */
.st-result {
  left: 50%;
  bottom: var(--safe-b);
  width: min(64vw, 560px);
  margin-left: calc(min(64vw, 560px) / -2);
  padding: 12px 20px 14px;
  animation: st-fade-up 0.35s ease-out;
}
.st-result-title { font: 400 34px var(--display); line-height: 1.1; transform: skewX(-8deg); margin-bottom: 6px; }
.st-result.win .st-result-title { color: var(--yellow); text-shadow: -3px 0 0 var(--pink), 3px 0 0 var(--cyan); }
.st-result.lose .st-result-title { color: #9fc4ff; text-shadow: -3px 0 0 #2a3a8f, 3px 0 0 #000; }
.st-result .st-rewards { margin-bottom: 8px; }
.st-result .st-actions { margin-top: 4px; }

/* 小さい画面 (iPhone SE など) */
@media (max-height: 380px) {
  .st-map-bottom { height: 128px; }
  .st-path { height: calc(100% - 56px - 136px - var(--safe-b)); }
  .st-node-badge { width: 44px; height: 44px; }
  .st-node.boss .st-node-badge { width: 52px; height: 52px; }
}

/* ---- 試合中の操作 (自分のコマ) ---- */
body[data-mode="story"] #gear { display: none !important; }
.st-control {
  position: absolute;
  inset: 0;
  touch-action: none;
  -webkit-user-select: none;
}

.st-hud {
  position: absolute;
  left: var(--safe-l);
  bottom: var(--safe-b);
  width: min(34vw, 260px);
  padding: 6px 12px 8px;
  background: rgba(7, 5, 26, 0.72);
  border-left: 4px solid var(--pink);
  transform: skewX(-8deg);
  pointer-events: none;
}
.st-hud > * { transform: skewX(8deg); }
.st-hud-name { display: inline-block; font: 400 14px var(--display); color: var(--pink); margin-bottom: 3px; }
.st-hud-charge { display: none; margin-left: 8px; padding: 0 6px; font: 900 10px var(--font); font-style: normal; color: #1a0a2a; background: var(--yellow); animation: st-blink 0.5s infinite; }
.st-hud.charging .st-hud-charge { display: inline-block; }
.st-hud.charging .st-pip:not(.full) u { opacity: 0.85; box-shadow: 0 0 10px var(--c); }
.st-hp, .st-gauge { display: flex; align-items: center; gap: 8px; height: 18px; }
.st-hp > span, .st-gauge > span { width: 22px; font: 400 12px var(--display); color: var(--muted); }
.st-hp-bar { flex: 1; height: 10px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.st-hp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3ff0a0, #b8f27a); transition: width 0.15s; }
.st-hp-bar i.mid { background: linear-gradient(90deg, #ffb347, #ffd23d); }
.st-hp-bar i.low { background: linear-gradient(90deg, #ff2a5a, #ff7a8e); animation: st-blink 0.6s infinite; }
.st-hp b { width: 34px; text-align: right; font: 400 13px var(--display); }
.st-gauge { margin-top: 3px; gap: 5px; }
.st-pip { position: relative; flex: 1; height: 12px; background: rgba(255, 255, 255, 0.1); transform: skewX(-20deg); overflow: hidden; }
.st-pip u { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c); opacity: 0.55; text-decoration: none; }
.st-pip.full u { opacity: 1; box-shadow: 0 0 10px var(--c); }

.st-hints {
  position: absolute;
  right: calc(var(--safe-r) + 54px);
  bottom: var(--safe-b);
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.st-hint { display: flex; flex-direction: column; align-items: center; padding: 3px 7px; background: rgba(7, 5, 26, 0.65); border-bottom: 2px solid var(--cyan); transition: opacity 0.2s; }
.st-hint small { font: 700 8.5px var(--font); color: var(--muted); white-space: nowrap; }
.st-hint b { font: 900 11.5px var(--font); white-space: nowrap; }
.st-hint.h-jump { border-bottom-color: var(--lime); }
.st-hint.h-charge { border-bottom-color: var(--pink); }
.st-hint.h-counter { border-bottom-color: var(--mint); }
.st-hint.h-dash { border-bottom-color: var(--yellow); }
.st-hint.wait { opacity: 0.35; }
.st-control.countdown .st-hints { opacity: 0.3; }

.st-pause {
  position: absolute;
  right: var(--safe-r);
  bottom: var(--safe-b);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(7, 5, 26, 0.7);
}
.st-pause i { width: 5px; height: 16px; background: rgba(255, 255, 255, 0.85); }

.st-launch-prompt {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%) skewX(-10deg);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  background: rgba(255, 79, 184, 0.85);
  font: 900 15px var(--font);
  white-space: nowrap;
  pointer-events: none;
  animation: st-blink 1s ease-in-out infinite;
}
.st-control.countdown .st-launch-prompt { display: flex; }
/* 引っぱる指の形 (下へ引く矢印) */
.st-drag-icon { position: relative; width: 14px; height: 18px; }
.st-drag-icon::before { content: ""; position: absolute; left: 5px; top: 0; width: 4px; height: 12px; background: #fff; }
.st-drag-icon::after { content: ""; position: absolute; left: 0; top: 9px; border: 7px solid transparent; border-top: 9px solid #fff; }

.st-grade {
  position: absolute;
  left: 0;
  right: 0;
  top: 30%;
  text-align: center;
  font: 400 54px var(--display);
  opacity: 0;
  pointer-events: none;
}
.st-grade.show { animation: st-grade 1.2s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
.st-grade.perfect { color: var(--yellow); text-shadow: -4px 0 0 var(--pink), 4px 0 0 var(--cyan), 0 0 30px rgba(255, 210, 61, 0.9); }
.st-grade.good { color: #9ff8ff; font-size: 44px; text-shadow: -3px 0 0 #2a6fff, 3px 0 0 #000; }
.st-grade.miss { color: #c9c3ff; font-size: 36px; text-shadow: 0 3px 0 #000; }
@keyframes st-grade {
  0% { transform: scale(2.4) skewX(-10deg); opacity: 0; }
  15% { transform: scale(1) skewX(-10deg); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: scale(1.1) skewX(-10deg) translateY(-20px); opacity: 0; }
}

/* ---- 1 対 1 の試し場 (タップの操作) ---- */
.st-control.duel .st-hints { display: none; }
.dl-hints { position: absolute; right: calc(var(--safe-r) + 54px + 96px); bottom: var(--safe-b); display: flex; gap: 6px; pointer-events: none; transition: opacity 0.2s; }
.dl-hint { display: flex; flex-direction: column; align-items: center; padding: 3px 9px; background: rgba(7, 5, 26, 0.65); border-bottom: 2px solid var(--cyan); }
.dl-hint.timing { border-bottom-color: var(--yellow); }
.dl-hint small { font: 700 8.5px var(--font); color: var(--muted); white-space: nowrap; }
.dl-hint b { font: 900 11.5px var(--font); white-space: nowrap; }
.st-control.countdown .dl-hints, .st-control.countdown .dl-special { opacity: 0.3; }
/* 必殺: 技ゲージ満タンで光る */
.dl-special { position: absolute; right: calc(var(--safe-r) + 54px); bottom: var(--safe-b); width: 88px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; border: 2px solid rgba(255, 255, 255, 0.2); background: rgba(7, 5, 26, 0.7); color: rgba(255, 255, 255, 0.35); transform: skewX(-10deg); }
.dl-special b { font: 400 16px var(--display); }
.dl-special small { font: 700 8px var(--font); }
.dl-special.ready { border-color: var(--yellow); background: linear-gradient(180deg, #ffe78c, var(--yellow)); color: #1a0a2a; box-shadow: 0 0 22px rgba(255, 210, 61, 0.7); animation: st-blink 0.6s ease-in-out infinite; }
.dl-special.ready small { display: none; }
/* コンボの数は、自分の耐久の上 (コマとかさならないように) */
.dl-combo { position: absolute; left: calc(var(--safe-l) + 12px); bottom: calc(var(--safe-b) + 74px); transform: skewX(-10deg); font: 400 26px var(--display); color: var(--yellow); text-shadow: -3px 0 0 var(--pink), 3px 0 0 var(--cyan); opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.dl-combo.on { opacity: 0.9; }
.dl-rival { position: absolute; right: var(--safe-r); top: max(8px, env(safe-area-inset-top)); width: min(30vw, 220px); padding: 5px 12px 7px; background: rgba(7, 5, 26, 0.72); border-right: 4px solid var(--cyan); transform: skewX(8deg); pointer-events: none; }
.dl-rival > * { transform: skewX(-8deg); }
.dl-rival-name { display: block; margin-bottom: 3px; text-align: right; font: 400 13px var(--display); color: var(--cyan); }
.dl-score { position: absolute; left: var(--safe-l); top: max(8px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; padding: 4px 14px; background: rgba(7, 5, 26, 0.72); transform: skewX(-8deg); pointer-events: none; }
.dl-score span { font: 900 16px var(--font); letter-spacing: 2px; }
.dl-score span.me { color: var(--pink); }
.dl-score span.rival { color: var(--cyan); }
.dl-score em { font: 400 13px var(--display); font-style: normal; color: var(--muted); }
.dl-clash-hint { position: absolute; left: 50%; top: 21%; display: none; padding: 6px 18px; background: rgba(255, 210, 61, 0.92); color: #1a0a2a; font: 900 16px var(--font); white-space: nowrap; transform: translateX(-50%) skewX(-10deg); pointer-events: none; }
.st-control.clash .dl-clash-hint { display: block; animation: st-blink 0.3s infinite; }
.dl-final { margin: 2px 0 6px; text-align: center; font: 400 40px var(--display); }

/* ---- 操作の説明 ---- */
.st-howto {
  left: 50%;
  top: 50%;
  width: min(80vw, 620px);
  transform: translate(-50%, -50%);
  padding: 12px 22px 14px;
}
.st-howto-list { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 8px; }
.st-howto-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; }
.st-howto-row b { padding: 2px 10px; font: 900 13px var(--font); background: rgba(255, 79, 184, 0.3); border-left: 3px solid var(--pink); }
.st-howto-row span { font: 700 12px/1.45 var(--font); color: var(--text); }
