@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho+B1:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Zen+Antique+Soft&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== Reset & Variables ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a12;
  --primary: #00f2ff;
  --error: #ff0055;
  --warning: #ffaa00;
  --success: #00f2ff;
  --text: #ffffff;
  --text-dim: #888888;
  --border: rgba(255, 255, 255, 0.1);
  --panel-bg: rgba(255, 255, 255, 0.04);

  --glow-primary: 0 0 16px rgba(0, 242, 255, 0.55);
  --glow-error: 0 0 16px rgba(255, 0, 85, 0.55);
  --glow-warning: 0 0 16px rgba(255, 170, 0, 0.55);

  /* 和風セリフ・数字フォント */
  --font-serif: "Shippori Mincho B1", serif;
  --font-num: "Zen Antique Soft", serif;
  --font-sans: "Inter", "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;

  /* 新デザイン共通カラー */
  --peach: #e2c0aa;
  --peach-bright: #f3ddcc;
  --peach-warm: #ffc7a2;
  --panel-glass: rgba(42, 34, 53, 0.82);
  --panel-glass-2: rgba(33, 26, 44, 0.62);
  --title-footer-bg: #141d2b;

  /* バトル画面アクセント（ルール解説等でも使用） */
  --combo: #ffab36;
  --monotony: #f4662e;
  --c-buff: #c9a8ff;
  --c-debuff: #f0b6c4;
  --c-correct: #b36fff;

  /* グレード配色 */
  --grade-s: #e8c98a;
  --grade-a: #c9a8ff;
  --grade-b: #f3ddcc;
  --grade-c: #aedbff;
  --grade-d: rgba(255, 255, 255, 0.5);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

.hidden {
  display: none !important;
}

/* ===== Title Screen（新デザイン） ===== */
/* スクロールはドキュメント（body）側で行う。
   #screen-title を内部スクロールにすると、固定背景がビューポート全幅で
   描画される一方フッターはスクロールバー分狭くなり、右端に背景が覗くため。 */
#screen-title {
  position: relative;
  align-self: flex-start;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  z-index: 100;
  font-family: var(--font-serif);
}

/* 背景画像（固定・cover） */
.title-bg {
  position: fixed;
  inset: 0;
  background: url('../img/bg01.jpg') center center / cover no-repeat;
  z-index: 0;
}

/* メインビューポート（100vh） */
.title-viewport {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 56px 64px;
}

/* ===== 共通ナビ（タイトル／キャラクター等で共有） ===== */
.site-nav {
  display: flex;
  align-items: center;
  gap: 40px;
  justify-content: center;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #16131f;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(20, 18, 30, 0.4);
  transition: color 0.2s, border-color 0.2s, text-shadow 0.2s;
}

.return {
  position: absolute;
  left: clamp(40px, 5vw, 72px);
}

.site-nav-link .nav-kira {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: filter 0.2s;
}

.site-nav-link:hover,
.site-nav-link.is-current {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.6);
}

/* hover/該当ページ時はきらめきアイコンも白く光らせる */
.site-nav-link:hover .nav-kira,
.site-nav-link.is-current .nav-kira {
  filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}

/* タイトル画面のナビ配置 */
.title-nav {
  margin-bottom: auto;
}

/* メインコンテンツ：左タイトル＋右ランキング */
.title-content {
  width: 100%;
  max-width: 1180px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.title-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.title-logo {
  width: clamp(360px, 38vw, 520px);
  height: auto;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.45));
}

/* モードボタン */
.title-modes {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: clamp(320px, 30vw, 400px);
}

.mode-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  border: 1px solid #e2c0aa;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-serif);
  color: #fff;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.mode-btn-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
}

.mode-btn-label {
  height: 42px;
  width: auto;
}

.mode-btn--1v1 {
  background: linear-gradient(120deg, rgba(86, 44, 140, 0.92), rgba(58, 32, 96, 0.92));
  box-shadow: 0 0 18px rgba(120, 60, 200, 0.3);
}

.mode-btn--1v1:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 26px rgba(150, 90, 240, 0.55);
  border-color: #f3ddcc;
}

.mode-btn--gauntlet {
  background: linear-gradient(120deg, rgba(38, 36, 52, 0.9), rgba(26, 24, 38, 0.9));
}

.mode-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mode-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* フッター */
.title-footer {
  position: relative;
  z-index: 1;
  background: var(--title-footer-bg);
  width: 100%;
  text-align: center;
  padding: 36px 16px 44px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-serif);
}

.title-footer-name {
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.title-footer-sub {
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  opacity: 0.65;
  margin-bottom: 16px;
}

.title-footer-env {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  opacity: 0.55;
}

/* ===== 共通 四隅装飾フレーム（固定・最前面・クリック不可）
   画面端から余白を取り、内包divに白borderを付ける。
   四隅の装飾SVGはこのフレームの各コーナーに重ねる。 ===== */
.corner-frame {
  position: fixed;
  inset: clamp(14px, .6vw, 30px);
  z-index: 50;
  pointer-events: none;
  border: 2px solid var(--frame-color, #fff);
}

/* グローバル単一フレーム：全画面の上・主要モーダルの下 */
#app-frame {
  z-index: 150;
}

/* 四隅装飾：SVGを mask（型抜き）に使い、色は --frame-color で着色 */
.corner-frame .corner {
  position: absolute;
  width: clamp(70px, 4vw, 100px);
  aspect-ratio: 109 / 83;
  background-color: var(--frame-color, #fff);
  -webkit-mask: var(--corner-src) no-repeat center / contain;
  mask: var(--corner-src) no-repeat center / contain;
}

.corner-frame .corner-lt {
  --corner-src: url(../img/kazariW_LT.svg);
  top: -1px;
  left: -1px;
}

.corner-frame .corner-rt {
  --corner-src: url(../img/kazariW_RT.svg);
  top: -1px;
  right: -1px;
}

.corner-frame .corner-lb {
  --corner-src: url(../img/kazariW_LB.svg);
  bottom: -1px;
  left: -1px;
}

.corner-frame .corner-rb {
  --corner-src: url(../img/kazariW_RB.svg);
  bottom: -1px;
  right: -1px;
}

/* 黒フレーム（明るい背景の characters 画面向け） */
.corner-frame.is-dark {
  --frame-color: #000;
}

/* ===== 共通 ガラスパネル（暗い半透明＋blur） ===== */
.glass-panel {
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}

/* ===== Game Screen（新デザイン） ===== */
#screen-game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-serif);
  background: #19151f;
}

/* 背景画像（固定） */
.g-bg {
  position: fixed;
  inset: 0;
  background: url('../img/bg01.jpg') center center / cover no-repeat;
  z-index: 0;
}

#game-container {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Shake animation */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-14px);
  }

  40% {
    transform: translateX(14px);
  }

  60% {
    transform: translateX(-9px);
  }

  80% {
    transform: translateX(9px);
  }
}

.shake {
  animation: shake 0.32s ease-in-out;
}

/* ===== 上段バンド：背景ブラーはこの1枚にだけ適用（継ぎ目防止） ===== */
.g-top-band {
  padding-top: 30px;
  flex-shrink: 0;
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ===== 上段：SCORE（リタイアと同じ高さ） ===== */
.g-topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: -12px;
}

.g-retire {
  position: absolute;
  left: clamp(30px, 3vw, 48px);
  top: clamp(22px, 3vh, 38px);
  z-index: 60;
  /* 飾り枠(z-index:50)より前面 */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(25, 21, 31, 0.7);
  border: 1px solid var(--peach);
  color: var(--peach);
  border-radius: 22px;
  padding: 6px 16px;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s, box-shadow 0.2s;
}

.g-retire-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  filter: brightness(0) saturate(100%) invert(76%) sepia(22%) saturate(472%) hue-rotate(340deg) brightness(104%) contrast(90%);
}

.g-retire:hover {
  background: rgba(226, 192, 170, 0.12);
  box-shadow: 0 0 10px rgba(226, 192, 170, 0.3);
}

/* VS：HP行の中央カラム。HPバーと平行になるよう縦中央寄せ */
.g-vs-col {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

.g-score-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.g-score-label {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--peach);
}

.g-score-num {
  font-family: var(--font-num);
  font-size: 1.7rem;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.g-score-kazari {
  display: block;
  width: clamp(120px, 11vw, 168px);
  height: auto;
  margin: 3px auto 1px;
  transform: none;
  /* 左右反転しない */
}

.g-vs {
  font-family: var(--font-num);
  font-size: 2.6rem;
  color: #fff;
  letter-spacing: 0.12em;
  margin-top: 0;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
}

/* ===== HP行（左：プレイヤー / 右：CPU） ===== */
.status-area {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 0 8vw 16px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: clamp(260px, 34vw, 450px);
}

/* PLAYER側・CPU側は左右反転せず、同じ向きで配置 */

.hp-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.hp-name {
  font-family: var(--font-sans);
  /* PLAYER / CPU ラベルは Inter */
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.55);
}

.hp-char-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.player-name,
.enemy-name {
  color: var(--peach);
}

.hp-val {
  font-family: var(--font-num);
  font-size: 1.2rem;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.hp-max {
  font-size: 0.82rem;
  color: var(--peach);
}

.hp-bar-wrap {
  width: 100%;
}

.hp-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
  background: linear-gradient(90deg, #9160c5, #f7a3a6);
}

.hp-fill.low {
  background: linear-gradient(90deg, #c5603a, var(--warning)) !important;
}

/* HPバー下：スキル回数（左）・コンボ/単調バッジ（右） */
.hp-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
}

#player-skill-uses,
#cpu-skill-uses {
  display: flex;
  gap: 8px;
}

/* スキル残回数 ✦（キャラ紹介ページの .cp-use と同じ表現） */
.use-spark {
  color: #ffc7a2;
  font-size: 1rem;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 199, 162, 0.5);
}

.use-spark.spent {
  color: rgba(255, 255, 255, 0.2);
  text-shadow: none;
}

/* ブースト時バッジ（COMBO）：1行・Inter・#FFAB36 */
#combo-badge {
  white-space: nowrap;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffab36;
  border: 1px solid #ffab36;
  border-radius: 4px;
  background: rgba(255, 171, 54, 0.16);
  animation: combo-pulse 1s ease-in-out infinite alternate;
}

@keyframes combo-pulse {
  from {
    opacity: 0.82;
    box-shadow: 0 0 4px rgba(255, 171, 54, 0.25);
  }

  to {
    opacity: 1;
    box-shadow: 0 0 12px rgba(255, 171, 54, 0.6);
  }
}

/* ペナルティ時バッジ（単調な詠唱）：1行・Inter・#F4662E */
#monotony-badge {
  white-space: nowrap;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f4662e;
  border: 1px solid #f4662e;
  border-radius: 4px;
  background: rgba(244, 102, 46, 0.16);
}

/* ===== キャラクターバンド ===== */
.g-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  align-items: center;
  padding: 0 8vw;
  /* status-area と同じ左右パディング */
  background: transparent;
}

/* 立ち絵カラム：HPゲージ（.side-panel）と同じ幅・位置。中で立ち絵を中央寄せ。
   下部バンド(game-content z-index:2)より前面に置き、立ち絵・スキル表示をバンドの上に出す。 */
.g-char-col {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  width: clamp(260px, 34vw, 450px);
  display: flex;
  justify-content: center;
  /* HPゲージの中心線に立ち絵を合わせる */
  align-items: flex-end;
  /* 足元を下端に */
}

.char-wrap {
  --char-size: clamp(240px, 44vh, 500px);
  position: relative;
  width: var(--char-size);
  height: var(--char-size);
  font-size: calc(var(--char-size) * 0.3);
  flex-shrink: 0;
}

.char-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.08s ease;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.45));
}

/* ダメージ数値ポップアップ */
@keyframes damage-float {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  15% {
    opacity: 1;
    transform: translate(-50%, -65%) scale(1.3);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -120%) scale(0.9);
  }
}

.damage-num {
  position: absolute;
  top: 50%;
  left: 50%;
  font-family: var(--font-num);
  font-size: 1em;
  pointer-events: none;
  animation: damage-float 0.9s ease-out forwards;
  z-index: 20;
  white-space: nowrap;
}

.damage-num.player {
  color: #ff6b8a;
  text-shadow: 0 0 12px rgba(255, 0, 85, 0.6);
}

.damage-num.cpu {
  color: var(--peach);
  text-shadow: 0 0 12px rgba(226, 192, 170, 0.6);
}

/* ターン菱形 */
/* 菱形＝回転した正方形。内側ラッパーをまとめて逆回転して中身を正立・中央に */
.turn-diamond {
  position: relative;
  z-index: 4;
  /* キャラ(.g-char-col z-index:3)より前面 */
  flex-shrink: 0;
  margin-top: -10vh;
  align-self: center;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(29, 26, 40, 0.88) 42%, rgba(68, 66, 74, 0.88) 100%);
  border: 1.4px solid var(--peach);
  transform: rotate(45deg);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}

.turn-inner {
  transform: rotate(-45deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  margin-left: -20px;
  margin-top: -20px;
}

.turn-spark {
  width: 24px;
  height: auto;
  margin-bottom: 3px;
}

.turn-label {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--peach);
  margin-bottom: 2px;
}

.turn-num {
  font-family: var(--font-num);
  font-size: 2.3rem;
  color: #fff;
  line-height: 1;
}

/* スキル情報ボックス（立ち絵の足元） */
/* #skill-area / #skill-area-cpu の配置は下方「Skill Button Area」で定義 */

/* ===== 下段ゲームコンテンツ ===== */
/* 下段バンド背景：キャラより背後（z-index:2）。ガラス背景はここだけ */
.game-bg-band {
  flex-shrink: 0;
  width: 100%;
  min-height: 45vh;
  margin-top: -10vh;
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  z-index: 2;
}

/* 下段コンテンツ：キャラより前面（z-index:5）。背景なし・同サイズで重ねる */
.game-content {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  width: 100%;
  min-height: 45vh;
  margin-top: -45vh;
  /* game-bg-band と同じ高さ分だけ戻って重ねる */
  padding: 40px 20px 14px;
  text-align: center;
  background: transparent;
  /* 背景なし */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-content>* {
  width: 100%;
  max-width: 900px;
}

#message {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  font-weight: 600;
  color: var(--peach);
  text-shadow: 0 0 16px rgba(226, 192, 170, 0.4);
  min-height: 2.4rem;
  line-height: 1.35;
  margin-bottom: 6px;
  transition: color 0.2s, text-shadow 0.2s;
}

#constraint-msg {
  font-size: 1rem;
  font-family: var(--font-sans);
  margin: 0;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.15s;
}

/* 制約メッセージが表示されている時だけ余白を確保 */
#constraint-msg.visible {
  margin: 4px 0 2px;
}

#constraint-msg.visible {
  opacity: 1;
}

#constraint-msg.error {
  color: var(--error);
}

/* タイマー */
/* メッセージとタイマートラックの間の区切り線（常時表示）。
   #E2C0AA の線形グラデで中央が最も濃く両端は透明にフェード。長さは控えめ。 */
.g-divider {
  width: min(620px, 78%);
  height: 1px;
  margin: 2px auto 12px;
  background: linear-gradient(90deg,
      rgba(226, 192, 170, 0) 0%,
      rgba(226, 192, 170, 1) 50%,
      rgba(226, 192, 170, 0) 100%);
}

/* タイマートラック：記憶フェーズのみ表示（JS が visibility 制御）。詠唱フェーズはコマンド内で時間表示。 */
.timer-wrap {
  width: min(500px, 94%);
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto 18px;
  visibility: hidden;
}

#timer-bar {
  height: 100%;
  width: 100%;
  border-radius: 3px;
}

#timer-bar {
  height: 100%;
  width: 100%;
  border-radius: 4px;
}

#timer-bar.memorize {
  background: var(--peach);
}

#timer-bar.input {
  background: var(--peach);
}

/* コマンド表示 */
#display-area {
  min-height: clamp(56px, 9vh, 84px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.arrow {
  width: clamp(36px, 5vw, 52px);
  height: clamp(36px, 5vw, 52px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(20, 16, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.1s ease, border-color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}

/* 正解（入力済み）：紫の枠＋紫の矢印 */
.arrow.success {
  color: #c9a8ff;
  border-color: #b36fff;
  background: rgba(179, 111, 255, 0.16);
  box-shadow: 0 0 10px rgba(179, 111, 255, 0.4);
}

.arrow.miss {
  color: #ff6b8a;
  border-color: #ff6b8a;
  background: rgba(255, 0, 85, 0.14);
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
}

/* 現在入力中：オレンジの枠（背景は updateCurrentBox が毎フレーム制御） */
.arrow.current {
  border-color: #eaa24f;
  box-shadow: 0 0 12px rgba(234, 162, 79, 0.45);
  transform: scale(1.12);
}

/* 新規付与：オレンジの枠＋矢印 */
.arrow.new-key {
  color: #f3b878;
  border-color: #eaa24f;
  background: rgba(234, 162, 79, 0.16);
  box-shadow: 0 0 12px rgba(234, 162, 79, 0.45);
}

/* フッター */
#footer {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--peach);
  padding: 10px 0 0;
  line-height: 1.8;
}

#footer .hl {
  color: #ffffff;
  font-weight: 600;
}

/* ===== リタイア確認ダイアログ ===== */
#retire-confirm {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 14, 0.6);
}

.retire-box {
  padding: 32px 40px;
  text-align: center;
  font-family: var(--font-serif);
}

.retire-msg {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #fff;
  margin-bottom: 24px;
}

.retire-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.retire-btn {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  padding: 10px 24px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.retire-btn.yes {
  background: transparent;
  border: 1px solid var(--peach);
  color: var(--peach);
}

.retire-btn.yes:hover {
  background: rgba(226, 192, 170, 0.15);
  box-shadow: 0 0 12px rgba(226, 192, 170, 0.4);
}

.retire-btn.no {
  background: var(--peach);
  border: 1px solid var(--peach);
  color: #1a1622;
  font-weight: 700;
}

.retire-btn.no:hover {
  background: #f3ddcc;
}

/* ===== Result Overlay ===== */
#overlay-result {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 16, 0.93);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

#result-box {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 32px;
  max-height: 90vh;
  overflow: visible;
}

#result-left {
  flex: 0 0 auto;
  min-width: 300px;
  text-align: center;
}

#result-right {
  flex: 1;
  position: relative;
  min-width: 260px;
}

/* 勝利スチル画像：エリアを埋める */
#result-char-img {
  display: block;
  width: 100%;
  max-width: 340px;
  object-fit: contain;
  border-radius: 12px;
  filter: drop-shadow(0 0 18px rgba(0, 242, 255, 0.25));
}

/* 吹き出し：画像の右上に絶対配置で重ねる */
#result-char-comment {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 68%;
  background-image: url('../img/fukidashi.svg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 22px 28px;
  font-size: 0.88rem;
  font-weight: bold;
  color: #1a1a2e;
  text-align: center;
  line-height: 1.5;
  z-index: 5;
}

#result-title {
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.r-WIN {
  color: var(--warning);
  text-shadow: var(--glow-warning);
}

.r-LOSE {
  color: var(--error);
  text-shadow: var(--glow-error);
}

.r-draw {
  color: var(--text-dim);
}

#result-detail {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 2.4rem;
  letter-spacing: 0.05em;
}

#btn-retry {
  background: var(--primary);
  color: var(--bg);
  border: none;
  padding: 14px 44px;
  font-size: 1.05rem;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: transform 0.12s, box-shadow 0.2s;
}

#btn-retry:hover {
  transform: scale(1.06);
  box-shadow: var(--glow-primary);
}


.cs-panels {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.cs-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cs-panel.active {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
}

.cs-side-label {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cs-portrait-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-portrait-wrap {
  width: clamp(90px, 25vw, 150px);
  height: clamp(90px, 25vw, 150px);
}

.cs-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cs-arrow {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.cs-arrow:hover:not(:disabled) {
  color: var(--primary);
  border-color: var(--primary);
}

.cs-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.cs-char-name {
  font-size: clamp(0.9rem, 2.5vw, 1.25rem);
  font-weight: 900;
  color: var(--text);
  letter-spacing: 0.06em;
}

.cs-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cs-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-stat-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  width: 28px;
}

.cs-stat-val {
  font-size: 0.62rem;
  color: var(--text-dim);
  min-width: 36px;
  text-align: right;
  white-space: nowrap;
}

.cs-stat-bar {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.cs-stat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.35s ease;
}

.cs-hp {
  background: var(--primary);
  box-shadow: 0 0 6px rgba(0, 242, 255, 0.5);
}

.cs-uses-row .cs-stat-label {
  width: auto;
  white-space: nowrap;
  margin-right: 8px;
}

.cs-uses-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.uses-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a78bfa;
  box-shadow: 0 0 5px rgba(167, 139, 250, 0.6);
  flex-shrink: 0;
}

.cs-atk {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(255, 170, 0, 0.5);
}

.cs-skill-box {
  width: 100%;
  padding: 8px 10px;
  min-height: 64px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.68rem;
  line-height: 1.5;
}

.cs-skill-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-right: 5px;
  vertical-align: middle;
}

.cs-skill-type.buff {
  background: rgba(0, 242, 255, 0.15);
  color: var(--primary);
}

.cs-skill-type.debuff {
  background: rgba(255, 170, 0, 0.15);
  color: var(--warning);
}

.cs-skill-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cs-skill-name {
  color: var(--text);
  font-weight: 700;
}

.cs-skill-duration {
  color: var(--text);
  font-weight: 700;
}

.cs-skill-desc {
  margin-top: 4px;
  color: var(--text-dim);
}

.cs-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  font-weight: 900;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  padding-top: clamp(40px, 10vw, 80px);
  min-width: clamp(20px, 4vw, 36px);
}

.cs-hint {
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.cs-start-btn {
  padding: 11px 44px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  background: none;
  border: 2px solid var(--primary);
  color: var(--primary);
  text-shadow: var(--glow-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.cs-start-btn:hover {
  background: rgba(0, 242, 255, 0.1);
  box-shadow: 0 0 22px rgba(0, 242, 255, 0.3);
}

/* ---- ロスター ---- */
#cs-roster {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.cs-roster-item {
  position: relative;
  width: 74px;
  height: 74px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.cs-roster-item:hover:not(.locked) {
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.06);
}

.cs-roster-item.locked {
  cursor: default;
  opacity: 0.3;
}

.cs-roster-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cs-roster-lock {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-dim);
}

.cs-roster-item.sel-player {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 242, 255, 0.45);
}

.cs-roster-item.sel-cpu {
  border-color: var(--warning);
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.45);
}

.cs-roster-item.sel-both {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 242, 255, 0.35), 0 0 10px rgba(255, 170, 0, 0.35);
}

.cs-roster-badge {
  position: absolute;
  bottom: 3px;
  font-size: 0.52rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 2px;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.cs-roster-badge.player {
  left: 3px;
  background: var(--primary);
  color: var(--bg);
}

.cs-roster-badge.cpu {
  right: 3px;
  background: var(--warning);
  color: var(--bg);
}

#btn-retry:active {
  transform: scale(0.98);
}

/* ===== Grade Colors ===== */
.grade-s {
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.grade-a {
  color: var(--primary);
  text-shadow: var(--glow-primary);
}

.grade-b {
  color: #ffffff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.grade-c {
  color: var(--text-dim);
}

.grade-d {
  color: var(--error);
  text-shadow: var(--glow-error);
}

/* ===== Result Score Layout ===== */
#result-grade-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 20px;
  margin-bottom: 0.6rem;
}

#result-grade-letter {
  font-size: clamp(3.2rem, 6vw, 6rem);
  font-weight: 900;
  line-height: 1;
}

#result-score-num {
  font-size: clamp(2.5rem, 5vw, 5rem);
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

#result-best-score {
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.best-new-record {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  font-weight: 900;
}

.best-existing {
  color: var(--text-dim);
}

/* ===== Unlock Notifications ===== */
#result-unlocks {
  margin: 0.8rem auto 1rem;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unlock-notification {
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.3);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 0.78rem;
  color: var(--primary);
  letter-spacing: 0.04em;
}

/* ===== Roster Hover Hint ===== */
.cs-roster-item {
  overflow: visible;
}

.cs-roster-hint {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  background: rgba(10, 10, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 0.6rem;
  color: var(--text-dim);
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 200;
  white-space: normal;
}

.cs-roster-item.locked:hover .cs-roster-hint {
  opacity: 1;
}

.cs-roster-item.locked {
  opacity: 0.45;
}

/* ===== Pending Unlock State ===== */
.cs-roster-item.pending-unlock {
  cursor: default;
  border-color: rgba(0, 242, 255, 0.25);
}

.cs-roster-pending {
  color: var(--primary);
  font-size: 1.3rem;
}

.cs-roster-pending-label {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.44rem;
  color: var(--primary);
  white-space: nowrap;
}

/* ===== Live Score (in-game) ===== */
#live-score-wrap {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

/* ===== Hint Key (infinite_time skill) ===== */
.arrow.hint-key {
  opacity: 0.28;
  color: var(--primary);
}

/* ===== Character Color Filters (char03〜char08 placeholder) ===== */
#p1-char-wrap.char03 img,
#p2-char-wrap.char03 img {
  filter: hue-rotate(120deg);
}

#p1-char-wrap.char05 img,
#p2-char-wrap.char05 img {
  filter: hue-rotate(270deg);
}

#p1-char-wrap.char06 img,
#p2-char-wrap.char06 img {
  filter: hue-rotate(320deg) saturate(1.5);
}

#p1-char-wrap.char07 img,
#p2-char-wrap.char07 img {
  filter: hue-rotate(0deg) saturate(2) brightness(0.8);
}

#p1-char-wrap.char08 img,
#p2-char-wrap.char08 img {
  filter: hue-rotate(40deg) sepia(0.5);
}

/* char03〜char08 portrait in charselect */
.cs-portrait-wrap.char03 img {
  filter: hue-rotate(120deg);
}


.cs-portrait-wrap.char05 img {
  filter: hue-rotate(270deg);
}

.cs-portrait-wrap.char06 img {
  filter: hue-rotate(320deg) saturate(1.5);
}

.cs-portrait-wrap.char07 img {
  filter: hue-rotate(0deg) saturate(2) brightness(0.8);
}

.cs-portrait-wrap.char08 img {
  filter: hue-rotate(40deg) sepia(0.5);
}

.live-score-label {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

#live-score {
  font-size: 1.8rem;
  font-family: var(--font-num);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: color 0.15s;
}

/* ===== Result Grade/Score Labels ===== */
#result-grade-row {
  align-items: center;
}

.result-stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.result-stat-label {
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  font-weight: 700;
}

.result-stat-sep {
  width: 1px;
  height: 60px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

/* ===== Monotony Penalty Badge ===== */
/* ===== Active Skill Effect Badge ===== */
/* ===== スキル情報ボックス（未発動＝スキルボタン / 発動中＝効果バッジ 共通） ===== */
.skill-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  max-width: 230px;
  border: 1px solid #ffc7a2;
  border-radius: 6px;
  text-align: left;
}

.skill-box--ready {
  background: rgba(0, 0, 0, 0.5);
}

/* 未発動 */
.skill-box--active {
  background: rgba(170, 78, 16, 0.3);
}

/* 発動中（#AA4E10 30%） */

.skill-box-tag {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: #ffc7a2;
}

.skill-box--active .skill-box-tag {
  font-weight: 700;
}

.skill-box-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.skill-box-desc {
  font-family: var(--font-sans);
  font-size: 0.64rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.45;
}

/* CPU スキルボックス：カラム（=HPゲージ）の右端に合わせる */
#skill-area-cpu {
  position: absolute;
  bottom: 40px;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 160px;
  gap: 3px;
}

/* スキル残使用回数ドット（プレイヤー・CPU共通） */
#player-skill-uses,
#cpu-skill-uses {
  display: flex;
  gap: 3px;
  width: 100%;
}

#player-skill-uses,
#cpu-skill-uses {
  justify-content: flex-start;
  margin-top: 3px;
}

#player-skill-uses .uses-dot,
#cpu-skill-uses .uses-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#player-skill-uses .uses-dot.spent,
#cpu-skill-uses .uses-dot.spent {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
}

/* ===== Score Breakdown ===== */
#result-breakdown {
  width: 100%;
  max-width: 320px;
  margin: 0.2rem auto 0.8rem;
  font-size: 0.72rem;
}

.bd-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 0;
}

.bd-label {
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 90px;
}

.bd-note {
  flex: 1;
  font-size: 0.58rem;
  color: rgba(136, 136, 136, 0.55);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bd-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 54px;
  text-align: right;
  flex-shrink: 0;
}

.bd-value.pos {
  color: var(--primary);
}

.bd-value.neg {
  color: var(--error);
}

.bd-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 5px 0;
}

.bd-mult-row .bd-label {
  color: rgba(136, 136, 136, 0.7);
}

.bd-mult-val {
  color: var(--warning) !important;
}

/* ===== Skill Button Area ===== */
/* プレイヤー スキルボックス：カラム（=HPゲージ）の左端に合わせる */
#skill-area {
  position: absolute;
  bottom: 40px;
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 160px;
  gap: 3px;
}

/* スキルボタン（=未発動ボックス）の状態 */
button.skill-box {
  cursor: pointer;
  transition: box-shadow 0.2s, opacity 0.2s;
}

button.skill-box:disabled {
  cursor: default;
}

.skill-box.skill-active {
  box-shadow: 0 0 14px rgba(255, 199, 162, 0.5);
  animation: skill-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes skill-pulse {
  from {
    box-shadow: 0 0 4px rgba(255, 199, 162, 0.3);
  }

  to {
    box-shadow: 0 0 16px rgba(255, 199, 162, 0.75);
  }
}

.skill-box.skill-exhausted {
  opacity: 0.4;
}

/* 残回数は HP 下の ✦ で表示するためボックス内では非表示 */
#skill-btn-uses {
  display: none;
}

/* ===== カットインオーバーレイ ===== */
/* ===== スキル発動カットイン（Case B: 斜め帯スイープ） ===== */
#cutin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* 帯全体がひとつの要素として左→右へスイープ */
#cutin-panels {
  position: absolute;
  width: 116%;
  left: -8%;
  top: 50%;
  height: clamp(160px, 15vw, 260px);
  display: flex;
  align-items: center;
  background: linear-gradient(105deg, rgba(42, 28, 60, 0.92) 0%, rgba(100, 62, 48, 0.92) 100%);
  clip-path: polygon(52px 0, 100% 0, calc(100% - 52px) 100%, 0 100%);
  transform: translate(-118%, -50%);
  transition: transform 0.28s cubic-bezier(0.05, 0, 0.1, 1);
  filter: drop-shadow(0 0 24px rgba(130, 40, 220, 0.8));
}

/* 左ペイン：キャラ画像エリア（独立アニメなし） */
#cutin-panel-left {
  flex: 0 0 52%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0;
  background: none;
  clip-path: none;
  transform: none !important;
  transition: none !important;
}

/* 右ペイン：スキル名エリア（独立アニメなし） */
#cutin-panel-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 16px;
  padding-right: 80px;
  background: none;
  clip-path: none;
  margin-left: 0;
  transform: none !important;
  transition: none !important;
}

#cutin-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  filter: drop-shadow(4px 0 12px rgba(0, 0, 0, 0.6));
}

#cutin-type-badge {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
}

/* キャラ紹介ページの .cp-skill-badge と同じスタイル */
#cutin-type-badge.buff {
  background: rgba(140, 106, 214, 0.25);
  color: #cbb6f5;
  border: 1px solid rgba(180, 150, 240, 0.5);
  width: fit-content;
}

#cutin-type-badge.debuff {
  background: rgba(214, 90, 120, 0.22);
  color: #f0b6c4;
  border: 1px solid rgba(240, 150, 170, 0.5);
  width: fit-content;
}

#cutin-name {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 7vw, 3.5rem);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* 帯が左から中央へ進入 */
#cutin-overlay.cutin-active #cutin-panels {
  transform: translate(0, -50%);
}

/* 帯が右へ退場 */
#cutin-overlay.cutin-exit #cutin-panels {
  transform: translate(118%, -50%);
  transition: transform 0.22s ease-in;
}

/* ===== キャラ選択：ロックキャラ表示 ===== */

/* ロスターのポートレートを半透明に */
.cs-roster-portrait-wrap.cs-roster-locked {
  opacity: 0.35;
  filter: grayscale(60%);
}

/* 🔒バッジをポートレート右上に重ねる */
.cs-roster-item.locked {
  position: relative;
}

.cs-roster-lock-icon {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.85rem;
  line-height: 1;
  pointer-events: none;
}

/* パネル内ポートレートのロック時半透明 */
.cs-portrait-wrap.cs-panel-locked {
  opacity: 0.35;
  filter: grayscale(60%);
}

/* パネル内アンロック条件表示 */
.cs-lock-info {
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 170, 0, 0.4);
  border-radius: 6px;
  background: rgba(255, 170, 0, 0.07);
  color: var(--warning);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

/* バトル開始ボタン：ロック時の非活性スタイル */
.cs-start-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== タイトル画面ミニランキングパネル（新デザイン） ===== */

/* .glass-panel と併用。固有のサイズ・余白のみ指定 */
.title-ranking-panel {
  flex-shrink: 0;
  width: clamp(360px, 32vw, 420px);
  padding: 28px 32px 24px;
  font-family: var(--font-serif);
}

.trp-best {
  text-align: center;
  margin-bottom: 16px;
}

.trp-best-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: #e2c0aa;
  margin-bottom: 2px;
}

.trp-best-num {
  display: block;
  font-family: var(--font-num);
  font-size: 2.6rem;
  line-height: 1.1;
  color: #e2c0aa;
  text-shadow: 0 0 18px rgba(226, 192, 170, 0.3);
}

/* Ranking 見出し：両脇に白の線形グラデ線 */
.trp-rank-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.trp-rank-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 1) 50%,
      rgba(255, 255, 255, 0) 100%);
}

.trp-rank-label {
  flex-shrink: 0;
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  color: #ffffff;
}

#title-ranking {
  width: 100%;
}

.tr-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto 1.4rem;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.tr-rank {
  text-align: center;
  font-family: var(--font-num);
  font-size: 1rem;
  color: #ffffff;
}

.tr-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tr-name {
  font-family: var(--font-num);
  font-size: 0.95rem;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tr-char {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tr-score {
  font-family: var(--font-num);
  font-size: 1rem;
  text-align: right;
  white-space: nowrap;
  color: #e2c0aa;
}

.tr-grade {
  font-family: var(--font-num);
  font-size: 1rem;
  text-align: center;
  color: #ffffff;
}

.trp-empty {
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  padding: 20px 0;
}

.trp-all-link {
  display: block;
  margin-top: 14px;
  text-align: right;
  font-size: 0.82rem;
  color: #e2c0aa;
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: color 0.2s, text-shadow 0.2s;
}

.trp-all-link:hover {
  color: #f3ddcc;
  text-shadow: 0 0 12px rgba(226, 192, 170, 0.5);
}

/* ===== ニックネーム入力（リザルト画面） ===== */

#result-nickname-wrap {
  margin: 12px 0 8px;
  padding: 12px 16px;
  border: 1px solid rgba(0, 230, 255, 0.25);
  border-radius: 8px;
  background: rgba(0, 230, 255, 0.05);
}

#result-nickname-wrap.hidden {
  display: none;
}

.nickname-prompt {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 0 0 8px;
  letter-spacing: 0.05em;
}

.nickname-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#nickname-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 230, 255, 0.35);
  border-radius: 4px;
  color: #fff;
  font-size: 0.9rem;
  padding: 6px 10px;
  outline: none;
  font-family: inherit;
}

#nickname-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(0, 230, 255, 0.3);
}

#nickname-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

#btn-nickname-save,
#btn-nickname-skip {
  background: transparent;
  border: 1px solid rgba(0, 230, 255, 0.4);
  border-radius: 4px;
  color: var(--primary);
  font-size: 0.8rem;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

#btn-nickname-save:hover {
  background: rgba(0, 230, 255, 0.15);
  box-shadow: 0 0 8px rgba(0, 230, 255, 0.3);
}

#btn-nickname-skip {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-dim);
}

#btn-nickname-skip:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ===== ランキングページ ===== */

/* ランキング画面：page-body → rk-panel → ranking-list と縦に伸長して画面全体を埋める */
#screen-ranking .page-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 32px;
}

#screen-ranking .rk-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#screen-ranking #ranking-list {
  flex: 1;
  max-height: none;
}

.ranking-empty {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 32px 0;
  text-align: center;
}

.ranking-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.88rem;
  transition: background 0.15s;
}

.ranking-row:hover {
  background: rgba(255, 255, 255, 0.04);
}


.rk-rank {
  font-size: 1rem;
  text-align: center;
  color: #aaa;
}

.rk-name {
  color: #fff;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rk-char {
  color: var(--text-dim);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rk-score {
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  text-align: right;
  white-space: nowrap;
}

.rk-grade {
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  min-width: 1.2em;
}

.rk-result {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 2.5em;
  text-align: center;
}

.ranking-back {
  display: inline-block;
  margin-top: 32px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}

.ranking-back:hover {
  color: var(--primary);
}

/* ============================================================
   キャラクター紹介ページ（characters.html / body.char-page）
   ※ ナビ=.site-nav / フレーム=.corner-frame / パネル=.glass-panel を共有
   ============================================================ */
.char-page {
  font-family: var(--font-serif);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: #1a1622;
}

/* 背景画像（固定・cover） */
.cp-bg {
  position: fixed;
  inset: 0;
  background: url('../img/bg02.jpg') center center / cover no-repeat;
  z-index: 0;
}

/* キャラクターページのナビ配置（.site-nav と併用） */
.cp-nav {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  padding: 40px 56px 18px;
}

/* メインステージ：余白があれば伸びてパネルを中央寄せ、収まらなければ縮まずスクロール */
.cp-stage {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 64px 4px;
}

/* パネル本体（.glass-panel と併用。レイアウト・サイズのみ） */
.cp-panel {
  position: relative;
  width: 100%;
  max-width: 1180px;
  max-height: 600px;
  display: flex;
  overflow: hidden;
}

/* 左カラム：Character表記・立ち絵・PREV/NEXT の縦並び */
.cp-left {
  flex: 0 0 40%;
  gap: 15px;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 20px;
  min-height: 0;
  justify-content: space-between;
}

/* 立ち絵wrapperの四隅の小飾り（kazariS_*、既に #E2C0AA 着色済み） */
.cp-lc {
  position: absolute;
  width: 52px;
  height: auto;
  pointer-events: none;
  z-index: 3;
}

.cp-lc-lt {
  top: 0;
  left: 0;
}

.cp-lc-rt {
  top: 0;
  right: 0;
}

.cp-lc-lb {
  bottom: 0;
  left: 0;
}

.cp-lc-rb {
  bottom: 0;
  right: 0;
}

.cp-counter {
  font-family: var(--font-num);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--peach);
  flex-shrink: 0;
}

.cp-portrait-wrap {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.cp-portrait {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.4));
  transition: filter 0.3s, opacity 0.3s;
}

.cp-portrait.is-locked {
  filter: brightness(0.25) blur(2px);
  opacity: 0.7;
}

.cp-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.cp-lock-overlay.hidden {
  display: none;
}

.cp-lock-icon {
  font-size: 2.8rem;
}

.cp-lock-label {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: rgba(255, 255, 255, 0.6);
}

.cp-pager {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 28px;
}

.cp-pager-btn {
  background: transparent;
  border: none;
  color: var(--peach);
  font-family: var(--font-serif);
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 6px 10px;
  transition: color 0.2s, text-shadow 0.2s;
}

.cp-pager-btn:hover {
  color: #f3ddcc;
  text-shadow: 0 0 12px rgba(226, 192, 170, 0.6);
}

/* 右カラム：情報 */
.cp-right {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 28px 36px 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.cp-right::-webkit-scrollbar {
  width: 5px;
}

.cp-right::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.cp-name {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.cp-profile {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.85;
}

/* セクション見出し（右へ伸びる線） */
.cp-section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  color: var(--peach);
  margin-bottom: 12px;
}

.cp-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

/* ステータス */
.cp-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-stat-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cp-stat-name {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.75);
  min-width: 74px;
}

.cp-stat-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.cp-stat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cp-fill-hp {
  background: linear-gradient(90deg, #9160c5, #f7a3a6);
}

.cp-fill-atk {
  background: linear-gradient(90deg, #aedbff, #ffc7a2);
}

.cp-stat-val {
  flex-shrink: 0;
  font-family: var(--font-num);
  font-size: 0.92rem;
  min-width: 46px;
  text-align: right;
  color: rgba(255, 255, 255, 0.9);
}

.cp-uses {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cp-use {
  color: #ffc7a2;
  font-size: 1rem;
  text-shadow: 0 0 8px rgba(255, 199, 162, 0.5);
}

/* スキル */
.cp-skill-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cp-skill-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cp-skill-badge {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 20px;
  letter-spacing: 0.06em;
}

.cp-skill-badge.buff {
  background: rgba(140, 106, 214, 0.25);
  color: #cbb6f5;
  border: 1px solid rgba(180, 150, 240, 0.5);
}

.cp-skill-badge.debuff {
  background: rgba(214, 90, 120, 0.22);
  color: #f0b6c4;
  border: 1px solid rgba(240, 150, 170, 0.5);
}

.cp-skill-duration {
  font-size: 0.72rem;
  color: var(--peach);
  letter-spacing: 0.04em;
}

.cp-skill-desc {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.75;
}

/* 戦術 */
.cp-strategy {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.8;
  border-left: 2px solid var(--peach);
  padding-left: 14px;
}

/* アンロック */
.cp-unlock-met {
  font-size: 0.78rem;
  color: #9fe0a8;
  letter-spacing: 0.04em;
}

.cp-unlock-locked {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 170, 0, 0.07);
  border: 1px solid rgba(226, 192, 170, 0.4);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
}

/* キャラクター画面のフッターはフレックス列で縮まないように（padding等は共通の .site-footer に従う） */
.char-page .site-footer {
  flex-shrink: 0;
}

/* サムネイル */
.cp-thumbs {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px 100px;
}

.cp-thumb {
  width: 58px;
  height: 70px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  background: rgba(42, 34, 53, 0.6);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.cp-thumb:hover {
  border-color: rgba(226, 192, 170, 0.6);
  transform: translateY(-3px);
}

.cp-thumb.active {
  border-color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
  transform: translateY(-3px);
}

.cp-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.cp-thumb.locked .cp-thumb-img {
  filter: brightness(0.3);
}

.cp-thumb-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* キャラクターページ：情報パネルのスライドイン */
@keyframes cpSlideR {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes cpSlideL {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.anim-forward {
  animation: cpSlideR 0.22s ease;
}

.anim-back {
  animation: cpSlideL 0.22s ease;
}

/* ============================================================
   読み物ページ共通（howtoplay / about / 今後の読み物ページ）
   base.css で確立したスキャフォールドを style.css に統合。
   ============================================================ */

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

/* 固定背景 */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: center center / cover no-repeat;
}

.page-bg--bg02 {
  background-image: url('../img/bg02.jpg');
}

.page-bg--bg01 {
  background-image: url('../img/bg01.jpg');
}

/* 暗転修飾（キャラ選択画面などバトル系の背景用） */
.page-bg--dim {
  filter: saturate(0.9) brightness(0.62);
}

/* 読み物ページの可読性確保ベール */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(120% 90% at 50% 0%, rgba(20, 16, 28, 0) 38%, rgba(16, 13, 24, 0.55) 100%);
  pointer-events: none;
}

/* キャラ選択画面用：より深いベール */
.page-veil--cs {
  background: radial-gradient(120% 95% at 50% 8%, rgba(20, 15, 30, 0.35) 30%, rgba(10, 8, 16, 0.82) 100%);
}

/* ページラッパー */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 「↩ タイトルへ」リンク */
.nav-back {
  position: absolute;
  left: clamp(40px, 5vw, 72px);
  top: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #16131f;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(20, 18, 30, 0.4);
  transition: color 0.2s, border-color 0.2s, text-shadow 0.2s;
  white-space: nowrap;
}

.nav-back .nav-ret {
  width: 16px;
  height: 16px;
}

.nav-back:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.6);
}

.nav-back:hover .nav-ret {
  filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}

/* 本文エリア */
.page-body {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 18px clamp(24px, 4vw, 56px) 72px;
}

/* ページ見出し */
.page-hero {
  text-align: center;
  margin: 12px 0;
}

.page-hero-jp {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
  line-height: 1.1;
}

.page-hero-en {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: var(--peach);
}

.page-hero-en::before,
.page-hero-en::after {
  content: '';
  width: clamp(34px, 6vw, 64px);
  height: 1px;
  background: linear-gradient(90deg, rgba(226, 192, 170, 0), var(--peach), rgba(226, 192, 170, 0));
}

/* セクション見出しライン */
.sec-label {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--peach);
  margin-bottom: 16px;
}

.sec-label .sec-jp {
  font-family: var(--font-serif);
  letter-spacing: 0.1em;
}

.sec-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

/* ✦ スパーク */
.spark {
  color: var(--peach-warm);
  text-shadow: 0 0 8px rgba(255, 199, 162, 0.5);
}

/* パネル内四隅小飾り（position:relative の親に置く） */
.inner-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.inner-corners .ic {
  position: absolute;
  width: 34px;
  height: auto;
  opacity: 0.9;
}

.inner-corners .ic-lt {
  top: 10px;
  left: 10px;
}

.inner-corners .ic-rt {
  top: 10px;
  right: 10px;
}

.inner-corners .ic-lb {
  bottom: 10px;
  left: 10px;
}

.inner-corners .ic-rb {
  bottom: 10px;
  right: 10px;
}

/* サイトフッター */
.site-footer {
  position: relative;
  z-index: 1;
  background: var(--title-footer-bg);
  width: 100%;
  text-align: center;
  padding: 34px 16px 42px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-serif);
}

.site-footer-name {
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.site-footer-sub {
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  opacity: 0.65;
  margin-bottom: 16px;
}

.site-footer-env {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  opacity: 0.55;
}

/* ============================================================
   遊び方ページ（howtoplay.html / body.howto-page）新デザイン
   ============================================================ */

.howto-page .howto-sec {
  margin-bottom: 52px;
}

/* 01 概要：リード文パネル */
.howto-page .howto-lead {
  position: relative;
  padding: 30px 36px;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 2;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.03em;
}

.howto-page .howto-lead .em {
  color: var(--peach);
  font-weight: 600;
}

/* 02 バトルの流れ：3ステップ */
.howto-page .flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
}

.howto-page .flow-step {
  position: relative;
  padding: 26px 22px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.howto-page .flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(6px, 1.4vw, 16px);
  color: var(--peach);
  font-size: 1.4rem;
  opacity: 0.7;
}

.howto-page .flow-num {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.45);
}

.howto-page .flow-tag {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 16px;
  border-radius: 20px;
  border: 1px solid currentColor;
}

.howto-page .flow-tag.t-memorize {
  color: var(--peach);
  background: rgba(226, 192, 170, 0.12);
}

.howto-page .flow-tag.t-input {
  color: var(--combo);
  background: rgba(255, 171, 54, 0.12);
}

.howto-page .flow-tag.t-add {
  color: var(--c-buff);
  background: rgba(179, 111, 255, 0.14);
}

.howto-page .flow-name {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
}

.howto-page .flow-desc {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.68);
}

.howto-page .flow-desc .hl-w {
  color: var(--combo);
  font-weight: 600;
}

.howto-page .flow-desc .hl-p {
  color: var(--c-buff);
  font-weight: 600;
}

.howto-page .mini-keys {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.howto-page .mini-key {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: #fff;
  background: rgba(20, 16, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
}

.howto-page .mini-key.lit-p {
  color: #c9a8ff;
  border-color: #b36fff;
  background: rgba(179, 111, 255, 0.16);
  box-shadow: 0 0 8px rgba(179, 111, 255, 0.4);
}

.howto-page .mini-key.lit-o {
  color: #f3b878;
  border-color: #eaa24f;
  background: rgba(234, 162, 79, 0.16);
  box-shadow: 0 0 8px rgba(234, 162, 79, 0.4);
}

/* 03 ルールカード（2×2） */
.howto-page .rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.howto-page .rule-card {
  position: relative;
  padding: 22px 24px;
  border-radius: 8px;
  background: var(--panel-glass-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--accent, var(--peach));
}

.howto-page .rule-card.r-combo {
  --accent: var(--combo);
}

.howto-page .rule-card.r-monotony {
  --accent: var(--monotony);
}

.howto-page .rule-card.r-length {
  --accent: var(--c-buff);
}

.howto-page .rule-card.r-skill {
  --accent: var(--peach-warm);
}

.howto-page .rule-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.howto-page .rule-head .spark {
  font-size: 1.05rem;
  color: var(--accent);
}

.howto-page .rule-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
}

.howto-page .rule-card p {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.72);
}

.howto-page .rule-card .hl {
  color: var(--accent);
  font-weight: 700;
}

/* 04 操作方法 */
.howto-page .key-list {
  display: flex;
  flex-direction: column;
}

.howto-page .key-row {
  display: grid;
  grid-template-columns: minmax(170px, 200px) 1fr;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.howto-page .key-row:last-child {
  border-bottom: none;
}

.howto-page .key-caps {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.howto-page .key-cap {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  background: rgba(20, 16, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
}

.howto-page .key-cap.arrow-cap {
  font-size: 1.1rem;
}

.howto-page .key-action {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: #fff;
  letter-spacing: 0.03em;
}

.howto-page .key-when {
  display: block;
  margin-top: 3px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--peach);
}

/* 05 スコア */
.howto-page .score-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
}

.howto-page .score-table th,
.howto-page .score-table td {
  text-align: left;
  padding: 13px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.howto-page .score-table thead th {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.45);
}

.howto-page .score-table td.s-item {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
}

.howto-page .score-table td.s-val {
  font-family: var(--font-num);
  font-size: 0.98rem;
  white-space: nowrap;
}

.howto-page .score-table td.s-val.pos {
  color: var(--peach);
}

.howto-page .score-table td.s-val.neg {
  color: var(--monotony);
}

.howto-page .score-table td.s-note {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

/* グレード帯 */
.howto-page .grade-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 26px;
}

.howto-page .grade-badge {
  position: relative;
  text-align: center;
  padding: 18px 6px 14px;
  border-radius: 8px;
  background: var(--panel-glass-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.howto-page .grade-letter {
  display: block;
  font-family: var(--font-num);
  font-size: 2.1rem;
  line-height: 1;
  margin-bottom: 8px;
}

.howto-page .grade-pts {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
}

.howto-page .g-s {
  color: var(--grade-s);
  text-shadow: 0 0 16px rgba(232, 201, 138, 0.6);
}

.howto-page .g-a {
  color: var(--grade-a);
  text-shadow: 0 0 14px rgba(201, 168, 240, 0.5);
}

.howto-page .g-b {
  color: var(--grade-b);
}

.howto-page .g-c {
  color: var(--grade-c);
}

.howto-page .g-d {
  color: var(--grade-d);
}

@media (max-width: 760px) {
  .howto-page .flow {
    grid-template-columns: 1fr;
  }

  .howto-page .flow-arrow {
    transform: rotate(90deg);
    padding: 6px 0;
  }

  .howto-page .rule-grid {
    grid-template-columns: 1fr;
  }

  .howto-page .grade-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .howto-page .key-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .howto-page .score-table td.s-note {
    display: none;
  }

  .howto-page .score-table thead th:last-child {
    display: none;
  }
}

/* ============================================================
   このゲームについてページ（about.html / body.about-page）
   ============================================================ */

.about-page .about-sec {
  margin-bottom: 46px;
}

.about-page .about-panel {
  position: relative;
  padding: 28px 34px;
}

.about-page .about-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 2;
  color: rgba(255, 255, 255, 0.86);
  letter-spacing: 0.02em;
}

.about-page .about-text+.about-text {
  margin-top: 14px;
}

.about-page .about-text .em {
  color: var(--peach);
  font-weight: 600;
}

.about-page .about-intro {
  text-align: center;
  padding: 34px 34px 30px;
}

.about-page .about-logo {
  width: clamp(220px, 30vw, 320px);
  height: auto;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.45));
  margin-bottom: 18px;
}

.about-page .about-intro .about-text {
  color: rgba(255, 255, 255, 0.8);
}

/* 二次創作注意パネル */
.about-page .notice-panel {
  position: relative;
  padding: 24px 30px;
  border-radius: 8px;
  backdrop-filter: blur(44px);
}

.about-page .notice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--peach);
}

.about-page .notice-panel .about-text {
  font-size: 0.92rem;
  line-height: 1.95;
  color: rgba(255, 255, 255, 0.82);
}

/* プレースホルダー（作者差し替え箇所） */
.about-page .ph {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.86em;
  letter-spacing: 0.02em;
  color: var(--peach-warm);
  background: rgba(255, 199, 162, 0.1);
  border: 1px dashed rgba(255, 199, 162, 0.5);
  border-radius: 4px;
  padding: 1px 8px;
}

/* クレジット行 */
.about-page .credit-list {
  display: flex;
  flex-direction: column;
}

.about-page .credit-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: baseline;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.about-page .credit-row:last-child {
  border-bottom: none;
}

.about-page .credit-role {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--peach);
}

.about-page .credit-val {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: #fff;
  letter-spacing: 0.02em;
}

/* 連絡先リンク */
.about-page .contact-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.about-page .contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 8px;
  background: var(--panel-glass-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s, background 0.2s;
}

.about-page .contact-link:hover {
  transform: translateY(-2px);
  border-color: rgba(226, 192, 170, 0.6);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4), 0 0 14px rgba(226, 192, 170, 0.18);
  background: rgba(226, 192, 170, 0.06);
}

.about-page .contact-ico {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(226, 192, 170, 0.12);
  border: 1px solid rgba(226, 192, 170, 0.4);
}

.about-page .contact-ico img {
  width: 16px;
  height: 16px;
}

.about-page .contact-body {
  min-width: 0;
}

.about-page .contact-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--peach);
  margin-bottom: 2px;
}

.about-page .contact-handle {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ご利用にあたって */
.about-page .about-fine {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.55);
}

.about-page .about-fine li {
  list-style: none;
  padding-left: 18px;
  position: relative;
}

.about-page .about-fine li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--peach);
  opacity: 0.7;
}

@media (max-width: 760px) {
  .about-page .contact-list {
    grid-template-columns: 1fr;
  }

  .about-page .credit-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ============================================================
   バトル結果画面（#overlay-result）新デザイン
   旧ネオン水色デザインを後勝ちで上書き。JS 変更不要。
   ============================================================ */

#overlay-result {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
  background: radial-gradient(120% 120% at 50% 30%, rgba(16, 12, 24, 0.82), rgba(8, 7, 14, 0.94));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-serif);
}

#result-box {
  position: relative;
  margin: auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 940px;
  background: transparent;
  max-height: none;
  overflow: visible;
}

#result-left {
  flex: 1 1 56%;
  min-width: 0;
  padding: 40px 44px 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

#result-right {
  flex: 0 0 40%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  background: transparent;
  min-width: 0;
}

/* RESULT ラベル */
.result-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.38em;
  text-indent: 0.38em;
  color: var(--peach);
  margin-bottom: 10px;
}

.result-eyebrow::before,
.result-eyebrow::after {
  content: '';
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, rgba(226, 192, 170, 0), var(--peach), rgba(226, 192, 170, 0));
}

/* WIN / LOSE / DRAW */
#result-title {
  font-family: var(--font-serif);
  font-size: clamp(3.4rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  margin-bottom: 18px;
}

.r-WIN {
  color: #fff;
  text-shadow: 0 0 26px rgba(232, 201, 138, 0.65), 0 0 8px rgba(255, 255, 255, 0.5);
}

.r-LOSE {
  color: #b9a7c7;
  text-shadow: 0 0 22px rgba(120, 90, 150, 0.5);
}

.r-draw,
.r-DRAW {
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
}

/* RANK + SCORE 行 */
#result-grade-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-bottom: 4px;
}

.result-stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-stat-label {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--peach);
}

#result-grade-letter {
  font-family: var(--font-num);
  font-size: clamp(3rem, 6vw, 4.4rem);
  line-height: 1;
}

#result-score-num {
  font-family: var(--font-num);
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.result-stat-sep {
  width: 1px;
  align-self: stretch;
  margin: 6px 0;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.25), transparent);
}

/* グレード配色（新世界観） */
.grade-s {
  color: var(--grade-s);
  text-shadow: 0 0 20px rgba(232, 201, 138, 0.7);
}

.grade-a {
  color: var(--grade-a);
  text-shadow: 0 0 16px rgba(201, 168, 240, 0.55);
}

.grade-b {
  color: var(--grade-b);
  text-shadow: 0 0 12px rgba(243, 221, 204, 0.4);
}

.grade-c {
  color: var(--grade-c);
}

.grade-d {
  color: var(--grade-d);
}

/* SCORE 下のかざり */
.result-kazari {
  display: block;
  width: 200px;
  height: auto;
  margin: 6px auto 14px;
}

/* ベストスコア */
#result-best-score {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.best-new-record {
  color: var(--grade-s);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(232, 201, 138, 0.5);
}

.best-existing {
  color: rgba(255, 255, 255, 0.55);
}

/* スコア内訳 */
#result-breakdown {
  width: 100%;
  max-width: 340px;
  margin: 0 auto 14px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
}

.bd-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
}

.bd-label {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.04em;
}

.bd-note {
  flex: 1;
  text-align: right;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bd-value {
  flex-shrink: 0;
  min-width: 56px;
  text-align: right;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.bd-value.pos {
  color: var(--peach);
}

.bd-value.neg {
  color: var(--monotony);
}

.bd-sep {
  height: 1px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.12);
}

.bd-total .bd-label {
  color: #fff;
  font-family: var(--font-serif);
}

.bd-total .bd-value {
  color: #fff;
  font-size: 1rem;
}

/* HP残量など補足 */
#result-detail {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 16px;
}

/* アンロック通知 */
#result-unlocks {
  width: 100%;
  max-width: 340px;
  margin: 0 auto 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unlock-notification {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--peach-warm);
  background: rgba(255, 199, 162, 0.08);
  border: 1px solid rgba(255, 199, 162, 0.4);
  border-radius: 6px;
}

.unlock-notification::before {
  content: '✦';
  color: var(--peach-warm);
}

/* ニックネーム入力 */
#result-nickname-wrap {
  width: 100%;
  max-width: 340px;
  margin: 2px auto 18px;
  padding: 14px 16px;
  background: rgba(20, 16, 28, 0.4);
  border: 1px solid rgba(226, 192, 170, 0.28);
  border-radius: 8px;
}

.nickname-prompt {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--peach);
  margin-bottom: 8px;
}

.nickname-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#nickname-input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(226, 192, 170, 0.4);
  border-radius: 5px;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  padding: 7px 10px;
  outline: none;
}

#nickname-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#nickname-input:focus {
  border-color: var(--peach);
  box-shadow: 0 0 10px rgba(226, 192, 170, 0.35);
}

#btn-nickname-save,
#btn-nickname-skip {
  flex-shrink: 0;
  font-family: var(--font-serif);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

#btn-nickname-save {
  background: var(--peach);
  border: 1px solid var(--peach);
  color: #1a1622;
  font-weight: 700;
}

#btn-nickname-save:hover {
  background: var(--peach-bright);
  box-shadow: 0 0 12px rgba(226, 192, 170, 0.4);
}

#btn-nickname-skip {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.6);
}

#btn-nickname-skip:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* タイトルへ戻るボタン */
#btn-retry {
  margin-top: auto;
  white-space: nowrap;
  font-family: var(--font-serif);
  font-size: 1rem;
  letter-spacing: 0.1em;
  padding: 13px 48px;
  border-radius: 5px;
  background: linear-gradient(120deg, rgba(86, 44, 140, 0.95), rgba(58, 32, 96, 0.95));
  border: 1px solid var(--peach);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(120, 60, 200, 0.3);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

#btn-retry:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 26px rgba(150, 90, 240, 0.55);
  border-color: var(--peach-bright);
}

#btn-retry:active {
  transform: translateY(0);
}

/* 勝者スチル */
.result-still {
  position: relative;
  width: 100%;
  max-width: 320px;
  line-height: 0;
}

#result-char-img {
  display: block;
  width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.55));
  max-width: none;
  border-radius: 0;
}

#result-char-comment {
  position: absolute;
  top: -22px;
  right: -16px;
  width: 80%;
  min-height: 90px;
  background-image: url('../img/fukidashi.svg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px 28px;
  font-family: var(--font-serif);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.55;
  color: #2a1f33;
  text-align: center;
  z-index: 5;
}

@media (max-width: 760px) {
  #result-box {
    flex-direction: column;
    max-width: 440px;
  }

  #result-right {
    flex: none;
    order: -1;
  }

  #result-char-img {
    max-width: 220px;
  }

  #result-left {
    padding: 28px 24px;
  }
}

/* ============================================================
   ランキングページ（ranking.html / body.ranking-page）新デザイン
   ============================================================ */

/* ページ全体：body のデフォルト flex を解除してスクロール可能に */
.ranking-page {
  display: block;
  min-height: 100vh;
}

/* ランキングパネル */
.ranking-page .rk-panel {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 0 8px;
  overflow: hidden;
}

/* ヘッダー部（タイトル＋区切り線） */
.ranking-page .rk-head {
  padding: 36px 40px 0;
  text-align: center;
}

.ranking-page .rk-title {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 300;
  text-indent: 0.32em;
  color: var(--peach);
  text-shadow: 0 0 20px rgba(226, 192, 170, 0.35);
  line-height: 1;
  margin-bottom: 18px;
}

.ranking-page .rk-divider {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--peach), transparent);
  margin: 0 auto 8px;
}

/* ランキング一覧 */
#ranking-list {
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(226, 192, 170, 0.3) transparent;
}

/* 各行 */
.ranking-page .ranking-row {
  display: grid;
  grid-template-columns: 2.8rem 1fr auto 2rem;
  align-items: center;
  gap: 12px;
  padding: 14px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s;
}

.ranking-page .ranking-row:last-child {
  border-bottom: none;
}

.ranking-page .ranking-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* 順位番号 */
.ranking-page .rk-rank {
  font-family: var(--font-num);
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  line-height: 1;
}

/* 名前＋キャラ2行ブロック */
.ranking-page .rk-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ranking-page .rk-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-page .rk-char {
  font-family: var(--font-serif);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* スコア */
.ranking-page .rk-score {
  font-family: var(--font-num);
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.85);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* グレード */
.ranking-page .rk-grade {
  font-family: var(--font-num);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  line-height: 1;
}

/* 空の状態 */
.ranking-page .ranking-empty {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  padding: 48px 24px;
  letter-spacing: 0.05em;
}

@media (max-width: 600px) {
  .ranking-page .ranking-row {
    padding: 12px 20px;
    gap: 8px;
  }

  .ranking-page .rk-head {
    padding: 28px 20px 0;
  }
}

/* ============================================================
   キャラクター選択画面（#screen-charselect）新デザイン
   旧ネオン水色デザインを後勝ちで上書き。JS 変更不要。
   ============================================================ */

#screen-charselect {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow-y: auto;
  background: var(--bg);
  font-family: var(--font-serif);
}

/* 内部ラッパー（.page 内の flex:1 コンテンツ） */
.cs-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 2.4vw, 30px);
  width: 100%;
  max-width: 1120px;
  padding: clamp(40px, 5vw, 64px) clamp(20px, 3.5vw, 48px) clamp(28px, 3vw, 44px);
  margin: 0 auto;
  box-sizing: border-box;
  flex: 1;
}

/* 見出し */
/* .cs-title は廃止。page-hero / page-hero-jp / page-hero-en を使用 */

/* ロースター */
#cs-roster {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(8px, 1vw, 12px);
  width: 100%;
  padding: 16px clamp(14px, 2vw, 24px);
}

.cs-roster-item {
  position: relative;
  width: clamp(58px, 7vw, 76px);
  height: clamp(58px, 7vw, 76px);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(16, 12, 24, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}

.cs-roster-item:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.4);
}

.cs-roster-portrait-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.cs-roster-img {
  width: 150%;
  height: 150%;
  object-fit: cover;
  object-position: center top;
  margin-top: -4%;
}

/* 選択リング */
.cs-roster-item.sel-player {
  border-color: var(--peach);
  box-shadow: 0 0 0 1px var(--peach), 0 0 16px rgba(226, 192, 170, 0.5);
}

.cs-roster-item.sel-cpu {
  border-color: #f0b6c4;
  box-shadow: 0 0 0 1px #f0b6c4, 0 0 16px rgba(240, 150, 170, 0.5);
}

.cs-roster-item.sel-both {
  border-color: #fff;
  box-shadow: 0 0 0 1px #fff, 0 0 16px rgba(226, 192, 170, 0.45), inset 0 0 0 2px rgba(240, 150, 170, 0.5);
}

/* P / C バッジ */
.cs-roster-badge {
  position: absolute;
  top: 3px;
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 50%;
  color: #1a1622;
  z-index: 3;
}

.cs-roster-badge.player {
  left: 3px;
  background: var(--peach);
}

.cs-roster-badge.cpu {
  right: 3px;
  background: #f0b6c4;
}

/* ロック表示 */
.cs-roster-portrait-wrap.cs-roster-locked .cs-roster-img,
.cs-roster-item.locked .cs-roster-img {
  filter: grayscale(1) brightness(0.4);
}

.cs-roster-lock-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* パネル（PLAYER | VS | CPU） */
.cs-panels {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 20px);
  width: 100%;
}

.cs-panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 22px 26px;
  border-radius: 10px;
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}

#cs-panel-player.active {
  border-color: var(--peach);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 26px rgba(226, 192, 170, 0.28);
}

#cs-panel-cpu.active {
  border-color: #f0b6c4;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 26px rgba(240, 150, 170, 0.28);
}

/* サイドラベル */
.cs-side-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
}

.cs-side-label.player-name {
  color: var(--peach);
}

.cs-side-label.enemy-name {
  color: #f0b6c4;
}

/* 立ち絵＋矢印 */
.cs-portrait-row {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1vw, 12px);
  width: 100%;
  justify-content: center;
}

.cs-portrait-wrap {
  position: relative;
  width: clamp(150px, 18vw, 210px);
  height: clamp(150px, 18vw, 210px);
  background: none;
  border: none;
}

.cs-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.cs-panel-locked .cs-portrait {
  filter: grayscale(1) brightness(0.45);
}

.cs-panel-locked::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  z-index: 4;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.cs-arrow {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 26, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.cs-arrow:hover:not(:disabled) {
  color: #fff;
  border-color: var(--peach);
  background: rgba(226, 192, 170, 0.12);
  box-shadow: 0 0 12px rgba(226, 192, 170, 0.35);
}

.cs-arrow:disabled {
  opacity: 0.22;
  cursor: default;
}

/* キャラ名 */
.cs-char-name {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  text-align: center;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

/* ステータス */
.cs-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cs-stat-label {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.7);
  width: 30px;
  flex-shrink: 0;
}

.cs-stat-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.cs-stat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cs-hp {
  background: linear-gradient(90deg, #9160c5, #f7a3a6);
  box-shadow: none;
}

.cs-atk {
  background: linear-gradient(90deg, #aedbff, #ffc7a2);
}

.cs-stat-val {
  flex-shrink: 0;
  font-family: var(--font-num);
  font-size: 0.9rem;
  min-width: 40px;
  text-align: right;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

/* スキル回数ドット */
.cs-uses-row .cs-stat-label {
  width: auto;
  white-space: nowrap;
  margin-right: 4px;
}

.cs-uses-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.uses-dot {
  width: 9px;
  height: 9px;
  background: var(--peach-warm);
  transform: rotate(45deg);
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(255, 199, 162, 0.55);
}

/* スキルボックス */
.cs-skill-box {
  width: 100%;
  margin-top: 2px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--panel-glass-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cs-skill-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cs-skill-type {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 3px 11px;
  border-radius: 20px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.cs-skill-type.buff {
  background: rgba(140, 106, 214, 0.25);
  color: #cbb6f5;
  border: 1px solid rgba(180, 150, 240, 0.5);
}

.cs-skill-type.debuff {
  background: rgba(214, 90, 120, 0.22);
  color: #f0b6c4;
  border: 1px solid rgba(240, 150, 170, 0.5);
}

.cs-skill-name {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  white-space: nowrap;
}

.cs-skill-duration {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--peach);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.cs-skill-desc {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.7;
}

/* ロック条件表示 */
.cs-lock-info {
  width: 100%;
  margin-top: 2px;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--peach-warm);
  background: rgba(255, 199, 162, 0.08);
  border: 1px solid rgba(255, 199, 162, 0.4);
  border-radius: 6px;
  line-height: 1.6;
}

/* VS */
.cs-vs {
  flex: 0 0 auto;
  align-self: center;
  padding: 0 clamp(8px, 1.4vw, 16px);
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.4vw, 1.85rem);
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 18px rgba(226, 192, 170, 0.7), 0 0 6px rgba(255, 255, 255, 0.5);
}

/* ヒント＋開始ボタン */
.cs-hint {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.cs-start-btn {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  padding: 14px 56px;
  border-radius: 5px;
  background: linear-gradient(120deg, rgba(86, 44, 140, 0.95), rgba(58, 32, 96, 0.95));
  border: 1px solid var(--peach);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(120, 60, 200, 0.3);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s, opacity 0.2s;
}

.cs-start-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 28px rgba(150, 90, 240, 0.55);
  border-color: var(--peach-bright);
}

.cs-start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

@media (max-width: 720px) {
  .cs-panels {
    flex-direction: column;
    align-items: stretch;
  }

  .cs-vs {
    padding: 4px 0;
  }

  .cs-portrait-wrap {
    width: clamp(160px, 46vw, 200px);
    height: clamp(160px, 46vw, 200px);
  }
}

/* ===== 読み物シェル（about/howto/ranking 共通の固定レイヤー） ===== */
#reading-shell {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow-y: auto;
  scrollbar-width: none;
}

#reading-shell::-webkit-scrollbar {
  display: none;
}

/* 表示中の本文ブロックを伸ばして footer を最下部へ押す */
#reading-shell>.page>#screen-about,
#reading-shell>.page>#screen-howto,
#reading-shell>.page>#screen-ranking {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===== キャラクター画面（独立固定レイヤー・縦に収まらなければスクロール） ===== */
#screen-characters {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow-y: auto;
  scrollbar-width: none;
}

#screen-characters::-webkit-scrollbar {
  display: none;
}

/* ===== BGM ON/OFF トグルボタン（右下固定） ===== */
.bgm-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px 7px 12px;
  background: rgba(8, 6, 14, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
  border: 1px solid #E2C0AA;
}

.bgm-toggle:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(18, 14, 28, 0.88);
}

.bgm-toggle-prefix {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: #E2C0AA;
  letter-spacing: 0.05em;
}

.bgm-toggle-label {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  color: var(--peach-warm);
  letter-spacing: 0.06em;
}

.bgm-on-label,
.bgm-off-label {
  transition: color 0.2s, opacity 0.2s;
}

/* ON 状態 */
.bgm-toggle[data-state="on"] .bgm-on-label {
  color: var(--text);
  font-weight: 700;
}

.bgm-toggle[data-state="on"] .bgm-off-label {
  opacity: 0.3;
}

/* OFF 状態 */
.bgm-toggle[data-state="off"] .bgm-on-label {
  opacity: 0.3;
}

.bgm-toggle[data-state="off"] .bgm-off-label {
  color: var(--text);
  font-weight: 700;
}

/* ===== BGM 音声同意オーバーレイ ===== */
#bgm-consent {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 14, 0.6);
}