/* ===== さんすうトレーニング 共通スタイル ===== */

:root {
  --color-bg: #FFF8E1;
  --color-bg-alt: #E1F5FE;
  --color-primary: #29B6F6;
  --color-primary-dark: #0288D1;
  --color-accent: #FFA726;
  --color-success: #66BB6A;
  --color-success-dark: #43A047;
  --color-danger: #EF5350;
  --color-text: #37474F;
  --color-text-soft: #607D8B;
  --color-card: #FFFFFF;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 6px 16px rgba(55, 71, 79, 0.12);
  --shadow-button: 0 4px 0 rgba(0, 0, 0, 0.15);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Meiryo", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 45%);
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  display: flex;
  justify-content: center;
  align-items: center;
}

button { font-family: inherit; }

/* マスクエストだけ ドットの ゲームふうフォントに する（Google Fonts） */
body.rpg-page {
  font-family: 'DotGothic16', "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Meiryo", system-ui, -apple-system, sans-serif;
}

.app-shell {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  /* スマホの たかさの ちょうど100%だと、ブラウザの アドレスバーなどの ごく わずかな
     さで つねに たてスクロールが 出てしまう ことが あった ため、95%に して すこし
     よゆうを もたせる（小さくなりすぎない ように 95%に とどめる） */
  height: 95vh;
  height: 95dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: calc(8px + var(--safe-top)) calc(16px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

/* ---- ヘッダー ---- */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  min-height: 44px;
  flex: 0 0 auto;
}

.app-header__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  color: var(--color-primary-dark);
  text-decoration: none;
  font-size: 20px;
  flex: 0 0 auto;
}

.app-header__title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  flex: 1;
}

.app-header__icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  margin-top: -3px;
}

.app-header__points {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-card);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow-card);
  font-weight: 800;
  font-size: 15px;
  color: var(--color-accent);
  text-decoration: none;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ---- トップ画面 ---- */
.hero {
  text-align: center;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.hero__emoji {
  font-size: 38px;
  line-height: 1;
}

.hero__title {
  font-size: 21px;
  font-weight: 900;
  margin: 4px 0 2px;
  color: var(--color-primary-dark);
}

.hero__subtitle {
  font-size: 13px;
  color: var(--color-text-soft);
  margin: 0;
}

.points-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #FFD54F, var(--color-accent));
  color: #6D4C00;
  border-radius: var(--radius-lg);
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 auto;
}

.points-banner__value {
  font-size: 22px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: auto;
  align-content: start;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.menu-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 10px;
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-card);
  border: none;
  font-size: 14px;
  font-weight: 800;
  min-height: 0;
  aspect-ratio: 1 / 1;
  transition: transform 0.08s ease;
}

.menu-tile:active {
  transform: scale(0.96);
}

.menu-tile--primary {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  flex-direction: row;
  gap: 10px;
  background: linear-gradient(135deg, #4FC3F7, var(--color-primary-dark));
  color: #fff;
  min-height: 0;
  padding: 46px 10px;
  font-size: 20px;
}

.menu-tile__emoji {
  font-size: 22px;
}

.menu-tile--primary .menu-tile__emoji {
  font-size: 36px;
}

.app-footer {
  text-align: center;
  color: var(--color-text-soft);
  font-size: 12px;
  margin-top: 8px;
  flex: 0 0 auto;
}

/* ---- 汎用カード / ボタン ---- */
.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.card__title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card--compact {
  padding: 10px 14px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.card--compact .card__title {
  font-size: 13px;
  margin: 0 0 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  box-shadow: var(--shadow-button);
}

.btn[hidden] {
  display: none;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 0 var(--color-primary-dark);
}
.btn-primary:active { box-shadow: 0 1px 0 var(--color-primary-dark); }

.btn-success {
  background: var(--color-success);
  color: #fff;
  box-shadow: 0 4px 0 var(--color-success-dark);
}
.btn-success:active { box-shadow: 0 1px 0 var(--color-success-dark); }

.btn-secondary {
  background: #ECEFF1;
  color: var(--color-text);
  box-shadow: 0 4px 0 #CFD8DC;
}
.btn-secondary:active { box-shadow: 0 1px 0 #CFD8DC; }

.btn-danger {
  background: #fff;
  color: var(--color-danger);
  border: 2px solid var(--color-danger);
  box-shadow: none;
  padding: 14px;
}
.btn-danger:active { transform: scale(0.98); }

.btn-row {
  display: flex;
  gap: 12px;
}

.btn-row[hidden] {
  display: none;
}

.btn-row .btn {
  font-size: 15px;
  white-space: nowrap;
  padding: 16px 6px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-soft);
  margin-bottom: 6px;
}

.field input[type="number"] {
  width: 100%;
  font-size: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid #E0E0E0;
  font-weight: 700;
  color: var(--color-text);
}

.field input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

.empty-state {
  text-align: center;
  color: var(--color-text-soft);
  padding: 24px 8px;
  font-size: 14px;
}

/* ---- ゲーム選択カード ---- */
.game-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
  text-decoration: none;
  color: var(--color-text);
}

.game-card__emoji {
  font-size: 40px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  border-radius: 50%;
  flex: 0 0 auto;
  overflow: hidden;
}

.game-card__emoji img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card__name {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 2px;
}

.game-card__desc {
  font-size: 13px;
  color: var(--color-text-soft);
  margin: 0;
}

.game-card--logo {
  position: relative;
  padding: 0;
  overflow: hidden;
}

.game-card__logo-full {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1769 / 889;
  object-fit: contain;
  background: #000;
}

.game-card__go--overlay {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}

.game-card__go {
  margin-left: auto;
  font-size: 22px;
  color: var(--color-primary);
  flex: 0 0 auto;
}

/* ---- ゲーム画面 ---- */
#gameScreen:not([hidden]),
#roomScreen:not([hidden]),
#treasureScreen:not([hidden]),
#shardRewardScreen:not([hidden]),
#springScreen:not([hidden]),
#slotScreen:not([hidden]),
#zukanScreen:not([hidden]),
#shopScreen:not([hidden]),
#itemScreen:not([hidden]),
#openingScreen:not([hidden]),
#passwordScreen:not([hidden]),
#roadmapScreen:not([hidden]) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-header[hidden] { display: none; }

.game-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
  flex: 0 0 auto;
}

.game-stats__item {
  flex: 1;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.game-stats__label {
  font-size: 11px;
  color: var(--color-text-soft);
  font-weight: 700;
}

.game-stats__value {
  font-size: 20px;
  font-weight: 900;
  color: var(--color-primary-dark);
}

.progress-track {
  height: 10px;
  background: #E0E0E0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.progress-track__fill {
  height: 100%;
  background: linear-gradient(90deg, #4FC3F7, var(--color-accent));
  border-radius: 999px;
  transition: width 0.25s ease;
  width: 0%;
}

.question-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 40px;
  font-weight: 900;
  color: var(--color-text);
  margin-bottom: 12px;
  transition: background-color 0.15s ease;
  flex: 0 0 auto;
}

.question-card.is-correct { background-color: #E8F5E9; }
.question-card.is-incorrect { background-color: #FFEBEE; }

.question-card--stacked {
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
}

.question-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.question-furigana {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-soft);
  letter-spacing: 2px;
}

.question-furigana[hidden] { display: none; }

.question-card__blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 64px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 3px dashed var(--color-primary);
  color: var(--color-primary);
  font-size: 30px;
}

.feedback-text {
  text-align: center;
  min-height: 20px;
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.feedback-text.is-correct { color: var(--color-success-dark); }
.feedback-text.is-incorrect { color: var(--color-danger); }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.keypad button {
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: 0 4px 0 #CFD8DC;
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary-dark);
  min-height: 0;
}

.keypad button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #CFD8DC;
}

.keypad button:disabled {
  opacity: 0.5;
}

/* ---- なんいど選択 ---- */
.difficulty-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.difficulty-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--color-card);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px 10px;
  box-shadow: var(--shadow-card);
  font-weight: 800;
  color: var(--color-text);
}

.difficulty-tile:active { transform: scale(0.96); }

.difficulty-tile__name {
  font-size: 18px;
}

.difficulty-tile__meta {
  font-size: 12px;
  color: var(--color-text-soft);
  font-weight: 700;
}

.difficulty-tile--easy { border: 3px solid #81C784; }
.difficulty-tile--normal { border: 3px solid #4FC3F7; }
.difficulty-tile--hard { border: 3px solid #FFB74D; }
.difficulty-tile--extreme { border: 3px solid #E57373; }

/* ---- タイマー ---- */
.timer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.timer-row__value {
  font-size: 20px;
  font-weight: 900;
  color: var(--color-danger);
  min-width: 46px;
  text-align: center;
}

.timer-track {
  flex: 1;
  height: 14px;
  background: #E0E0E0;
  border-radius: 999px;
  overflow: hidden;
}

.timer-track__fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #66BB6A, #FFEE58, var(--color-danger));
  transition: width 0.08s linear;
}

/* ---- 選択メニュー（サブメニュー用） ---- */
.select-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.select-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--color-card);
  border: none;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  text-align: left;
  font-weight: 800;
  color: var(--color-text);
}

.select-tile:active { transform: scale(0.98); }

.select-tile__name {
  font-size: 17px;
}

.select-tile__meta {
  font-size: 12px;
  color: var(--color-text-soft);
  font-weight: 600;
}

.dan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.dan-tile {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  font-size: 22px;
  font-weight: 900;
  color: var(--color-primary-dark);
}

.dan-tile:active { transform: scale(0.94); }

.dan-tile.is-selected {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 0 var(--color-primary-dark);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 14px;
}

.toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  flex: 0 0 auto;
}

/* ---- 電卓風キーパッド（複数桁入力） ---- */
.calc-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.calc-keypad button {
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: 0 4px 0 #CFD8DC;
  font-size: 24px;
  font-weight: 800;
  color: var(--color-primary-dark);
  min-height: 0;
}

.calc-keypad button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #CFD8DC;
}

.calc-keypad button:disabled { opacity: 0.5; }

.calc-keypad__clear {
  background: #ECEFF1 !important;
  color: var(--color-text-soft) !important;
  font-size: 18px !important;
}

.calc-keypad__submit {
  background: var(--color-success) !important;
  color: #fff !important;
  box-shadow: 0 4px 0 var(--color-success-dark) !important;
  font-size: 16px !important;
}

/* ---- かけ算イメージゲーム（ビーズ） ---- */
.target-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  text-align: center;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.target-card__label {
  font-size: 21px;
  font-weight: 700;
  color: var(--color-text-soft);
}

#targetNumberEcho {
  font-size: 32px;
  font-weight: 900;
  color: var(--color-danger);
}

.target-card--split {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 6px;
}

.target-card--split .target-card__side {
  flex: 0 0 auto;
}

.target-card__equation {
  flex: 0 0 auto;
  text-align: center;
  font-size: 48px;
  font-weight: 900;
  color: var(--color-text);
  white-space: nowrap;
  transition: font-size 0.15s ease, color 0.15s ease;
}

.target-card__equation.is-revealed {
  font-size: 60px;
  color: var(--color-success-dark);
}

.target-card__equation #targetNumber {
  color: var(--color-danger);
  font-size: 1.15em;
}

.target-card__yomikata {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--color-success-dark);
  letter-spacing: 2px;
  margin: 0 0 10px;
  flex: 0 0 auto;
}

.bead-total-display {
  text-align: center;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 8px;
  margin: 0 0 10px;
  font-weight: 800;
  font-size: 15px;
  color: var(--color-primary-dark);
  flex: 0 0 auto;
}

.bead-total-display[hidden] { display: none; }

.target-card__yomikata[hidden] { display: none; }

.bead-box {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
  border: 3px dashed var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.bead-box__empty {
  margin: auto;
  color: var(--color-text-soft);
  font-size: 13px;
  font-weight: 700;
}

.bead-bar {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  padding: 5px;
  border: 2px solid #90A4AE;
  border-radius: 10px;
  background: rgba(144, 164, 174, 0.08);
}

.bead {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: inset 0 -2px 2px rgba(0, 0, 0, 0.15);
}

.bead--2 { background: #43A047; }
.bead--3 { background: #F48FB1; }
.bead--4 { background: #FDD835; }
.bead--5 { background: #4FC3F7; }
.bead--6 { background: #B39DDB; }
.bead--7 { background: #FAFAFA; border: 2px solid #BDBDBD; }
.bead--8 { background: #8D6E63; }
.bead--9 { background: #1A237E; }

.bead-controls {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.bead-controls .btn { flex: 1; }

.bead-controls .btn-add {
  flex: 2;
}

/* ---- 割り切れる数タップ ---- */
.group-label {
  font-weight: 800;
  font-size: 13px;
  color: var(--color-text-soft);
  margin: 14px 0 8px;
}

.group-label:first-child { margin-top: 0; }

.dan-grid--3col {
  grid-template-columns: repeat(3, 1fr);
}

.fall-field {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  background: linear-gradient(180deg, #E1F5FE, #ffffff);
  border: 3px dashed var(--color-primary);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
}

.falling-number {
  position: absolute;
  top: -75px;
  min-width: 75px;
  padding: 12px 15px;
  text-align: center;
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  font-size: 30px;
  font-weight: 900;
  color: var(--color-text);
  transition-property: top;
  transition-timing-function: linear;
  cursor: pointer;
  user-select: none;
}

.falling-number:active { transform: scale(0.92); }

/* ---- 算数RPG ---- */
/* バトル画面の カード（敵／勇者） */
.rpg-battle-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: #2E3A40;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 6px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

/* 敵カードは、いちばん うしろの まっくろい 背景と さかいめが 出ない ように、
   カードじたいの 背景も 黒に する（敵表示エリアと 色が とぎれない） */
.rpg-battle-card--enemy {
  flex: 1.19;
  min-height: 0;
  background: #000000;
  padding-bottom: 3px;
  margin-bottom: 0;
}

.rpg-battle-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.rpg-enemy-name {
  font-weight: 800;
  font-size: 15px;
  color: var(--color-text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rpg-battle-card__hp {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-soft);
}

.rpg-player-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 14px;
  color: #FFFFFF;
}

.rpg-player-badge__icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: #263238;
}

.rpg-hp-bar {
  height: 14px;
  background: #E0E0E0;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.rpg-hp-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #EF5350, #FF7043);
  border-radius: 999px;
  transition: width 0.3s ease;
  width: 100%;
}

/* 勇者がわの HPバーは、のこりHPに あわせて 緑→黄→赤に かわる（すうじの 色と そろえる） */
.rpg-hp-bar--player .rpg-hp-bar__fill {
  background: linear-gradient(90deg, #66BB6A, #43A047);
}

.rpg-hp-bar--player .rpg-hp-bar__fill.is-warning {
  background: linear-gradient(90deg, #FFD54F, #FFA000);
}

.rpg-hp-bar--player .rpg-hp-bar__fill.is-critical {
  background: linear-gradient(90deg, #EF5350, #E53935);
}

.rpg-shard-line {
  margin-top: 2px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
}

.rpg-shard-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}

.rpg-shard-row__icon {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.rpg-shard-divider {
  color: #78909C;
  font-size: 13px;
}

.rpg-shard-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: -2px;
  margin-right: 3px;
}

.rpg-enemy-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: 32vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: linear-gradient(180deg, #EDE7F6, #FFFFFF);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-top: 3px;
  overflow: hidden;
  padding: 3px;
}

/* かけらを もった 中雑魚せん: 下2/3が くろ、上に むかって あかい グラデーション */
.rpg-enemy-stage.is-shard-bearer {
  background-image: none;
  background: linear-gradient(180deg, #B71C1C 0%, #000000 33%, #000000 100%);
}

/* 中ボスの はいけいは、はばに あわせて きりぬく のでは なく、たかさを きじゅんに 表示する */
.rpg-enemy-stage.is-midboss {
  background-size: 100% auto;
}

.rpg-shard-indicator {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
  z-index: 3;
}

.rpg-shard-indicator[hidden] { display: none; }

/* ふつうの こうげきの きりつけ エフェクト（1びょう、てんめつ） */
.rpg-fx-slash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 5;
  animation: rpg-fx-slash-blink 1s steps(1, end) forwards;
}

@keyframes rpg-fx-slash-blink {
  0% { opacity: 1; transform: scale(0.8); }
  12% { opacity: 0; }
  24% { opacity: 1; transform: scale(1.05); }
  36% { opacity: 0; }
  48% { opacity: 1; transform: scale(1); }
  62% { opacity: 0; }
  74% { opacity: 1; }
  88% { opacity: 0; }
  100% { opacity: 0; }
}

/* ひっさつの ひのたま えんしゅつ（4つが かさなって まわりながら ひろがる） */
.rpg-fx-fire {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.rpg-fx-fire__orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  animation: rpg-fx-fire-spin 1.2s cubic-bezier(0.3, 0, 0.7, 1) forwards;
}

.rpg-fx-fire__ball {
  position: absolute;
  left: -30px;
  top: -30px;
  width: 60px;
  height: 60px;
  image-rendering: pixelated;
  animation: rpg-fx-fire-open 1.2s ease-in forwards;
}

@keyframes rpg-fx-fire-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(900deg); }
}

@keyframes rpg-fx-fire-open {
  0% { transform: rotate(var(--a)) translateX(64px) scale(1.3); opacity: 0; }
  15% { opacity: 1; }
  60% { transform: rotate(var(--a)) translateX(36px) scale(1.1); opacity: 1; }
  92% { transform: rotate(var(--a)) translateX(0) scale(0.9); opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(0) scale(1.3); opacity: 0; }
}

.rpg-enemy-announce {
  font-family: "MS Gothic", "ＭＳ ゴシック", "Courier New", monospace;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #FFEB3B;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
  text-align: center;
  min-height: 20px;
  transition: font-size 0.15s ease, color 0.15s ease;
}

.rpg-enemy-announce.is-name-only {
  font-size: 14px;
  color: #90A4AE;
  text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
}

.rpg-enemy-sprite {
  width: 48%;
  max-width: 170px;
  max-height: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 0.05s ease;
}

.rpg-enemy-sprite.is-midboss {
  width: 62%;
  max-width: 210px;
}

.rpg-enemy-sprite.is-shaking {
  animation: rpg-shake 0.5s ease;
}

.rpg-enemy-sprite.is-trembling {
  animation: rpg-tremble 0.25s ease-in-out infinite;
}

@keyframes rpg-tremble {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-3px) rotate(-2deg); }
  75% { transform: translateX(3px) rotate(2deg); }
}

@keyframes rpg-shake {
  0% { transform: translateX(0); opacity: 1; }
  8% { transform: translateX(-14px) rotate(-5deg); opacity: 0.15; }
  16% { transform: translateX(12px) rotate(5deg); opacity: 1; }
  24% { transform: translateX(-10px) rotate(-4deg); opacity: 1; }
  32% { transform: translateX(9px) rotate(4deg); opacity: 0.15; }
  40% { transform: translateX(-7px) rotate(-3deg); opacity: 1; }
  55% { transform: translateX(5px) rotate(2deg); }
  70% { transform: translateX(-3px) rotate(-1deg); }
  100% { transform: translateX(0) rotate(0); opacity: 1; }
}

.rpg-enemy-sprite.is-defeated {
  animation: rpg-defeat-shrink 0.5s ease forwards;
}

@keyframes rpg-defeat-shrink {
  to { transform: scale(0); opacity: 0; }
}

.rpg-damage-popup {
  position: absolute;
  top: 40%;
  left: 50%;
  font-size: 34px;
  font-weight: 900;
  color: var(--color-danger);
  text-shadow: 0 2px 0 #fff, 0 -1px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff;
  pointer-events: none;
  animation: rpg-damage-float 0.7s ease forwards;
}

@keyframes rpg-damage-float {
  0% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -60px); opacity: 0; }
}

.rpg-enemy-stage.is-glowing {
  box-shadow: 0 0 0 4px #FFD54F, 0 0 24px 6px rgba(255, 213, 79, 0.8);
}

.rpg-enemy-stage.is-shiny {
  box-shadow: 0 0 0 3px #E1BEE7, 0 0 26px 8px rgba(186, 104, 200, 0.7);
  animation: rpg-shiny-pulse 1.6s ease-in-out infinite;
}

@keyframes rpg-shiny-pulse {
  0%, 100% { box-shadow: 0 0 0 3px #E1BEE7, 0 0 26px 8px rgba(186, 104, 200, 0.7); }
  50% { box-shadow: 0 0 0 3px #F8BBD0, 0 0 36px 12px rgba(240, 98, 146, 0.85); }
}

.rpg-combo {
  flex: 0 0 auto;
  text-align: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--color-accent);
  margin-bottom: 6px;
}

.rpg-combo[hidden] { display: none; }

.rpg-question {
  flex: 0 0 auto;
  align-self: center;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  color: var(--color-text);
  margin-bottom: 10px;
}

.rpg-choices {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.rpg-choice-btn {
  min-height: 56px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: 0 4px 0 #CFD8DC;
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary-dark);
}

.rpg-choice-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #CFD8DC; }
.rpg-choice-btn:disabled { opacity: 0.6; }

.rpg-choice-btn.is-correct-flash {
  background: #C8E6C9;
  box-shadow: 0 4px 0 var(--color-success-dark);
}

.rpg-choice-btn.is-wrong-flash {
  background: #FFCDD2;
  box-shadow: 0 4px 0 var(--color-danger);
}

.rpg-player-hp__now {
  font-weight: 800;
  color: #FFFFFF;
}

.rpg-player-hp__now.is-warning {
  color: #FFD54F;
}

.rpg-player-hp__now.is-critical {
  color: #FF5252;
}

/* ---- バトルちゅうの アイテムパネル ---- */
.rpg-item-panel {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 340px;
  background: #37474F;
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 90;
}

.rpg-item-panel[hidden] { display: none; }

.rpg-item-panel__title {
  color: #ECEFF1;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 10px;
}

.rpg-item-panel__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.rpg-item-panel__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: #263238;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  color: #ECEFF1;
}

.rpg-item-panel__item img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.rpg-item-panel__item span {
  font-size: 10px;
  font-weight: 700;
}

.rpg-item-panel__item:disabled {
  opacity: 0.4;
}

.rpg-item-panel__close {
  width: 100%;
}

.rpg-move-panel__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.rpg-move-panel__btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 2px;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  color: #263238;
  text-align: center;
  background: linear-gradient(180deg, #FFB300, #FF8F00);
}

.rpg-move-panel__btn--thunder { background: linear-gradient(180deg, #FDD835, #F9A825); }
.rpg-move-panel__btn--tsunami { background: linear-gradient(180deg, #64B5F6, #1E88E5); color: #fff; }
.rpg-move-panel__btn--quake { background: linear-gradient(180deg, #BCAAA4, #8D6E63); color: #fff; }
.rpg-move-panel__btn--heal { background: linear-gradient(180deg, #81C784, #43A047); color: #fff; }
.rpg-move-panel__btn--heal2 { background: linear-gradient(180deg, #F48FB1, #D81B60); color: #fff; }
.rpg-move-panel__btn--eruption { background: linear-gradient(180deg, #FF7043, #BF360C); color: #fff; }
.rpg-move-panel__btn--locust { background: linear-gradient(180deg, #AED581, #689F38); }
.rpg-move-panel__btn--fairy { background: linear-gradient(180deg, #F8BBD0, #CE93D8); }

/* おおいなる イナヅマ: まんなかが おちたあと 0.5びょうで ひだり・みぎが てんめつしながら おちる */
.rpg-fx-thunder {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.rpg-fx-thunder__bolt {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: auto;
  aspect-ratio: 1 / 1;
  transform: translateX(-50%);
  image-rendering: pixelated;
  opacity: 0;
}

.rpg-fx-thunder__bolt--center {
  animation: rpg-fx-thunder-center 1.2s steps(1, end) forwards;
}

.rpg-fx-thunder__bolt--left {
  margin-left: -62px;
  animation: rpg-fx-thunder-side 1.2s steps(1, end) forwards;
}

.rpg-fx-thunder__bolt--right {
  margin-left: 62px;
  animation: rpg-fx-thunder-side 1.2s steps(1, end) forwards;
}

@keyframes rpg-fx-thunder-center {
  0% { opacity: 1; }
  60% { opacity: 0; }
  67% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes rpg-fx-thunder-side {
  0%, 41% { opacity: 0; }
  42% { opacity: 1; }
  52% { opacity: 0; }
  60% { opacity: 1; }
  70% { opacity: 0; }
  78% { opacity: 1; }
  92% { opacity: 0; }
  100% { opacity: 0; }
}

.rpg-combo-row {
  margin: 2px 0 0;
}

.rpg-combo-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.rpg-combo-row__label {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-soft);
}

.rpg-combo-row__hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-soft);
  margin: 4px 0 0;
  text-align: center;
}

.rpg-combo-gauge__bar {
  height: 12px;
  display: flex;
  gap: 3px;
}

.rpg-combo-gauge__seg {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #E0E0E0;
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.rpg-combo-gauge__seg.is-filled {
  background: linear-gradient(90deg, #4FC3F7, #29B6F6);
  box-shadow: none;
}

.rpg-combo-gauge__seg.is-filled.is-ready {
  background: linear-gradient(90deg, #FFD54F, #FFA000);
  animation: rpg-gauge-pulse 0.8s ease-in-out infinite;
}

@keyframes rpg-gauge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.6); }
  50% { box-shadow: 0 0 8px 2px rgba(255, 193, 7, 0.9); }
}

/* バトル下段: 左に アクションいちらん、右に もんだい・せんたくし */
.rpg-battle-lower {
  flex: 0.9;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.rpg-actionlist {
  flex: 0 0 auto;
  width: 100px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rpg-actionlist__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: none;
  border-radius: 10px;
  background: #37474F;
  color: #ECEFF1;
  padding: 3px 4px;
  box-shadow: 0 3px 0 #1C2529;
  opacity: 0.6;
}

.rpg-actionlist__item:not(:disabled) {
  opacity: 1;
}

.rpg-actionlist__item:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1C2529;
}

#specialMoveBtn.rpg-actionlist__item:not(:disabled) {
  background: linear-gradient(180deg, #FFB300, #FF8F00);
  box-shadow: 0 3px 0 #E65100;
}

#barrierBtn.rpg-actionlist__item:not(:disabled) {
  background: linear-gradient(180deg, #42A5F5, #1E88E5);
  box-shadow: 0 3px 0 #1565C0;
}

.rpg-actionlist__icon {
  font-size: 14px;
  line-height: 1.1;
}

.rpg-actionlist__label {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
}

.rpg-actionlist__status {
  font-size: 8px;
  font-weight: 700;
  color: #CFD8DC;
  line-height: 1.1;
}

.rpg-question-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #2E3A40;
  border-radius: var(--radius-md);
  padding: 10px;
}

.rpg-question-panel__hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-soft);
  text-align: center;
  margin: 6px 0 0;
}

.rpg-hearts {
  font-size: 22px;
  letter-spacing: 4px;
}

.rpg-level-chip {
  flex: 0 0 auto;
  width: 78px;
  text-align: right;
  transition: transform 0.15s ease;
}

.rpg-level-chip.is-levelup {
  animation: rpg-levelup-pop 0.7s ease;
}

@keyframes rpg-levelup-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.35); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.rpg-level-chip__lv {
  font-size: 13px;
  font-weight: 900;
  color: var(--color-primary-dark);
}

.rpg-level-chip__ex {
  font-size: 9px;
  font-weight: 700;
  color: var(--color-text-soft);
  margin-top: 2px;
}

.rpg-exp-bar {
  height: 6px;
  background: #E0E0E0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}

.rpg-exp-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FFD54F, #FFA726);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.rpg-flash-red {
  position: fixed;
  inset: 0;
  background: rgba(239, 83, 80, 0.35);
  pointer-events: none;
  opacity: 0;
  z-index: 80;
}

.rpg-flash-red.is-active {
  animation: rpg-flash 0.25s ease;
}

@keyframes rpg-flash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

.rpg-result-sub {
  font-weight: 700;
  margin: 0 0 8px;
}

.rpg-gold-gain {
  font-weight: 900;
  font-size: 15px;
  color: #F9A825;
  margin: 0 0 18px;
}

/* ---- レベルアップ モーダル ---- */
.rpg-levelup-lvup {
  font-size: 22px;
  font-weight: 900;
  color: var(--color-primary-dark);
  margin: 0 0 16px;
}

.rpg-levelup-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 20px;
}

.rpg-levelup-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg, #F5F5F5);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
}

.rpg-levelup-stat__label {
  font-weight: 800;
  font-size: 13px;
  color: var(--color-text-soft);
}

.rpg-levelup-stat__value {
  font-weight: 900;
  font-size: 16px;
  color: var(--color-text);
}

/* ---- メダル かくとくの おおきな ポップアップ ---- */
.rpg-medal-earned-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 320px;
}

.rpg-medal-earned-panel__close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: #ECEFF1;
  font-family: Arial, "Hiragino Kaku Gothic ProN", sans-serif; /* DotGothic16は ✕の じたいが きちんと 出ない ため 除外 */
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}

.rpg-medal-earned-panel__title {
  font-size: 18px;
  font-weight: 900;
  color: #FFD54F;
  margin: 0;
}

.rpg-medal-earned-panel__img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  animation: rpg-daily-pop 0.35s ease;
}

.rpg-medal-earned-panel__name {
  font-size: 17px;
  font-weight: 900;
  color: #ECEFF1;
  margin: 0;
  text-align: center;
}

/* ---- しんか（りっぞうの スタイルが かわった とき）ポップアップ ---- */
.rpg-evolution-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.rpg-evolution-panel__title {
  font-size: 19px;
  font-weight: 900;
  color: #FFD54F;
  margin: 0;
  text-align: center;
}

.rpg-evolution-panel__img {
  width: 200px;
  max-width: 60vw;
  height: auto;
  max-height: 40vh;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  animation: rpg-daily-pop 0.35s ease;
}

.rpg-evolution-panel__subtitle {
  font-size: 16px;
  font-weight: 800;
  color: #ECEFF1;
  margin: 0 0 10px;
}

/* ---- へやの画面 ---- */
.rpg-room {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  overflow-y: auto;
}

.rpg-room__hero {
  width: 400px;
  max-width: 88vw;
  height: 550px;
  max-height: 50vh;
  object-fit: contain;
  object-position: bottom;
  background: none;
  flex-shrink: 1;
  min-height: 0;
}

.rpg-room__title-badge {
  font-size: 12px;
  font-weight: 700;
  color: #FFD54F;
  margin: 0 0 2px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.rpg-room__title {
  font-size: 22px;
  font-weight: 900;
  margin: 0;
  color: #ECEFF1;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.rpg-room__statsTable {
  width: 100%;
  max-width: 320px;
  background: #263238;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.rpg-room__statCell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  min-width: 0;
}

.rpg-room__statCell:nth-child(odd) {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.rpg-room__statCell:nth-child(n+3) {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rpg-room__statCell:nth-child(4n+1),
.rpg-room__statCell:nth-child(4n+2) {
  background: rgba(255, 255, 255, 0.04);
}

.rpg-room__statLabel {
  color: #B0BEC5;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.rpg-room__statValue {
  color: #ECEFF1;
  font-weight: 900;
  font-size: 14px;
  white-space: nowrap;
}

.rpg-room__statValue--gold {
  color: #FFCA28;
}

.rpg-room__adventure {
  width: 100%;
  max-width: 280px;
  padding: 18px;
  font-size: 19px;
  border-radius: var(--radius-lg);
  margin-top: 6px;
  flex-shrink: 0;
}

.rpg-room__subrow {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}

.rpg-room__sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-height: 56px;
  padding: 12px 10px;
  border: none;
  border-radius: var(--radius-md);
  background: #37474F;
  color: #ECEFF1;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 3px 0 #1c2529;
}

.rpg-room__sub:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1c2529;
}

.rpg-room__sub:disabled {
  opacity: 0.55;
}

.rpg-room__soon {
  font-size: 10px;
  font-weight: 600;
  color: #78909C;
}

/* ---- たからばこイベント ---- */
.rpg-treasure {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
}

.rpg-treasure__lead {
  font-size: 18px;
  font-weight: 900;
  color: #ECEFF1;
  margin: 0;
}

.rpg-treasure__boxes {
  display: flex;
  gap: 14px;
}

.rpg-treasure__box {
  width: 96px;
  height: 96px;
  border: none;
  background: #000;
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
}

.rpg-treasure__box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rpg-treasure__box:active {
  transform: scale(0.94);
}

.rpg-treasure__box:disabled {
  opacity: 0.5;
}

.rpg-treasure__box.is-picked {
  box-shadow: 0 0 0 3px #FFD54F, 0 0 20px 6px rgba(255, 213, 79, 0.7);
  opacity: 1;
}

.rpg-treasure__result {
  font-size: 16px;
  font-weight: 800;
  color: #FFD54F;
  margin: 0;
  min-height: 22px;
}

.rpg-treasure__continue {
  width: 200px;
}

/* ---- いずみイベント ---- */
.rpg-spring {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  overflow-y: auto;
}

.rpg-spring__portrait {
  width: 240px;
  max-width: 70vw;
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.rpg-spring__text {
  font-size: 16px;
  font-weight: 800;
  color: #ECEFF1;
  line-height: 1.6;
  margin: 0;
}

.rpg-spring__ask {
  gap: 16px;
}

.rpg-spring__choice {
  width: 76px;
  height: 76px;
  font-size: 28px;
  font-weight: 900;
  border-radius: 50%;
}

.rpg-spring__result {
  font-size: 16px;
  font-weight: 800;
  color: #FFD54F;
  margin: 0;
}

/* ---- かけら かくとく ---- */
.rpg-shard-reward {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.rpg-shard-reward__close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: #ECEFF1;
  font-family: Arial, "Hiragino Kaku Gothic ProN", sans-serif; /* DotGothic16は ✕の じたいが きちんと 出ない ため 除外 */
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}

.rpg-shard-reward__icon {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
  animation: rpg-spring-bob 1.2s ease-in-out infinite;
}

.rpg-shard-reward__title {
  font-size: 20px;
  font-weight: 900;
  color: #FFD54F;
  margin: 4px 0 0;
}

.rpg-shard-reward__remain {
  font-size: 15px;
  font-weight: 700;
  color: #ECEFF1;
  margin: 0 0 10px;
}

.rpg-shard-reward__continue {
  width: 200px;
}

/* ---- モンスターゲットチャンス（スロット） ---- */
.rpg-slot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.rpg-slot__lead {
  font-size: 17px;
  font-weight: 900;
  color: #ECEFF1;
  margin: 0;
}

.rpg-slot__reels {
  display: flex;
  gap: 10px;
}

.rpg-slot__reel {
  width: 70px;
  height: 84px;
  border: none;
  padding: 0;
  border-radius: var(--radius-md);
  background: #000;
  color: #FFD54F;
  font-family: inherit;
  font-size: 36px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.rpg-slot__reel:disabled {
  cursor: default;
}

.rpg-slot__reel.is-spinning span {
  animation: rpg-slot-spin 0.15s linear infinite;
}

@keyframes rpg-slot-spin {
  0% { transform: translateY(-8px); opacity: 0.4; }
  50% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(8px); opacity: 0.4; }
}

.rpg-slot__reel.is-spinning:not(:disabled) {
  cursor: pointer;
  animation: rpg-slot-invite 0.9s ease-in-out infinite;
}

@keyframes rpg-slot-invite {
  0%, 100% { box-shadow: 0 0 0 2px #4FC3F7, 0 4px 14px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 0 4px #81D4FA, 0 4px 18px rgba(0, 0, 0, 0.6); }
}

.rpg-slot__reel.is-stopped {
  box-shadow: 0 0 0 3px #FFD54F, 0 4px 14px rgba(0, 0, 0, 0.5);
  animation: none;
}

.rpg-slot__hint {
  font-size: 13px;
  font-weight: 800;
  color: #81D4FA;
  margin: 0;
}

.rpg-slot__spin {
  width: 200px;
}

.rpg-slot__result {
  font-size: 16px;
  font-weight: 800;
  color: #FFD54F;
  margin: 0;
}

.rpg-slot__coin-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.rpg-slot__coin-prompt[hidden] {
  display: none;
}

.rpg-slot__coin-text {
  font-size: 15px;
  font-weight: 700;
  color: #ECEFF1;
  margin: 0;
}

.rpg-slot__coin-prompt .btn-row {
  width: 220px;
}

.rpg-slot__ask {
  width: 220px;
  justify-content: center;
}

.rpg-slot__ask[hidden] { display: none; }

.rpg-slot__continue {
  width: 200px;
}

.rpg-slot.is-shiny-catch .rpg-slot__reel.is-stopped {
  box-shadow: 0 0 0 3px #F8BBD0, 0 0 26px 8px rgba(240, 98, 146, 0.8);
}

/* ---- ずかん ---- */
.rpg-zukan {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.rpg-zukan__title {
  font-size: 18px;
  font-weight: 900;
  color: #ECEFF1;
  text-align: center;
  margin: 0;
  flex: 0 0 auto;
}

.rpg-zukan__tabs {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.rpg-zukan__tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-md);
  background: #263238;
  color: #90A4AE;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.rpg-zukan__tab.is-active {
  background: #FFD54F;
  color: #37474F;
}

.rpg-zukan__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rpg-zukan__body[hidden] {
  display: none;
}

.rpg-zukan__stageSection {
  margin-bottom: 22px;
}

.rpg-zukan__stageTitle {
  font-size: 14px;
  font-weight: 900;
  color: #FFD54F;
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.rpg-zukan__categoryGroup {
  margin-bottom: 12px;
}

.rpg-zukan__categoryGroup:last-child {
  margin-bottom: 0;
}

.rpg-zukan__categoryTitle {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  padding: 2px 10px;
  border-radius: 999px;
  margin: 0 0 8px;
}

.rpg-zukan__categoryTitle--zako { background: #3498DB; }
.rpg-zukan__categoryTitle--midzako { background: #C0742C; }
.rpg-zukan__categoryTitle--midboss { background: #B33333; }
.rpg-zukan__categoryTitle--bigboss { background: #7B2D8E; }

.rpg-zukan__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  align-items: start;
  align-content: start;
  gap: 10px;
}

.rpg-zukan__card {
  position: relative;
  background: #37474F;
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.rpg-zukan__portrait {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rpg-zukan__img {
  width: 85%;
  height: 85%;
  object-fit: contain;
}

.rpg-zukan__img.is-silhouette {
  filter: brightness(0) invert(1);
  opacity: 0.7;
}

.rpg-zukan__shinyToggle {
  width: 100%;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #F8BBD0, #F06292);
  color: #4A148C;
  font-weight: 800;
  font-size: 10px;
  padding: 4px 2px;
  cursor: pointer;
}

.rpg-zukan__name {
  font-size: 12px;
  font-weight: 800;
  color: #ECEFF1;
  margin: 0;
}

.rpg-zukan__defeated {
  font-size: 10px;
  font-weight: 600;
  color: #B0BEC5;
  margin: 0;
}

.rpg-zukan__back {
  flex: 0 0 auto;
}

/* ---- メダル タブ（大きめの カードで、とった かんじが 出るように） ---- */
.rpg-medal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.rpg-medal-grid__card {
  position: relative;
  background: #37474F;
  border-radius: var(--radius-lg);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.rpg-medal-grid__card.is-got {
  background: linear-gradient(180deg, #4E342E, #37474F);
  box-shadow: 0 0 0 2px #FFD54F, 0 8px 20px rgba(255, 213, 79, 0.35);
}

.rpg-medal-grid__card.is-locked {
  opacity: 0.5;
}

.rpg-medal-grid__portrait {
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rpg-medal-grid__portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.rpg-medal-grid__lock {
  font-size: 40px;
}

.rpg-medal-grid__name {
  font-size: 14px;
  font-weight: 900;
  color: #FFD54F;
  margin: 0;
  text-align: center;
}

.rpg-medal-grid__card.is-locked .rpg-medal-grid__name {
  color: #ECEFF1;
}

.rpg-medal-grid__desc {
  font-size: 11px;
  font-weight: 600;
  color: #CFD8DC;
  margin: 0;
  text-align: center;
}

/* ---- ざっかや ---- */
.rpg-shop {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.rpg-shop__keeper {
  width: 110px;
  height: 110px;
  object-fit: contain;
  background: #000;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.rpg-shop__lead {
  font-size: 15px;
  font-weight: 800;
  color: #ECEFF1;
  margin: 0;
}

.rpg-shop__goods {
  display: flex;
  gap: 10px;
}

.rpg-shop__item {
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border: none;
  border-radius: var(--radius-md);
  background: #37474F;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.rpg-shop__item-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rpg-shop__item-icon img {
  width: 85%;
  height: 85%;
  object-fit: contain;
}

.rpg-shop__item-name {
  font-size: 11px;
  font-weight: 700;
  color: #ECEFF1;
}

.rpg-shop__item-price {
  font-size: 13px;
  font-weight: 900;
  color: #FFCA28;
}

.rpg-shop__item:disabled {
  opacity: 0.45;
}

.rpg-shop__gold {
  font-size: 15px;
  font-weight: 900;
  color: #FFCA28;
  margin: 0;
}

.rpg-shop__leave {
  width: 220px;
}

/* ---- アイテム ---- */
.rpg-itemlist {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rpg-itemlist__title {
  font-size: 18px;
  font-weight: 900;
  color: #ECEFF1;
  text-align: center;
  margin: 0;
  flex: 0 0 auto;
}

.rpg-itemlist__grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.rpg-itemlist__row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #37474F;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.rpg-itemlist__icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rpg-itemlist__icon img {
  width: 85%;
  height: 85%;
  object-fit: contain;
}

.rpg-itemlist__info {
  flex: 1;
  min-width: 0;
}

.rpg-itemlist__name {
  font-size: 13px;
  font-weight: 800;
  color: #ECEFF1;
  margin: 0 0 2px;
}

.rpg-itemlist__count {
  color: #FFCA28;
}

.rpg-itemlist__desc {
  font-size: 11px;
  font-weight: 500;
  color: #B0BEC5;
  margin: 0;
}

.rpg-itemlist__back {
  flex: 0 0 auto;
}

/* ---- せいげん時間バー（チョボバット） ---- */
.rpg-timer {
  flex: 0 0 auto;
  height: 8px;
  background: #263238;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.rpg-timer__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #66BB6A, #FFEE58, #EF5350);
  border-radius: 999px;
}

/* ---- ヒビ演出（ヘボカルゴ） ---- */
.rpg-crack-overlay {
  position: absolute;
  top: 12%;
  left: 32%;
  width: 36%;
  height: 76%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
}

.rpg-enemy-stage.is-cracked .rpg-crack-overlay {
  opacity: 1;
}

.rpg-damage-popup--crack {
  color: #CFD8DC;
}

.rpg-damage-popup--heal {
  color: #66BB6A;
}

.rpg-damage-popup--dodge {
  color: #FFD54F;
}

.rpg-damage-popup--danger {
  color: #EF5350;
}

.rpg-damage-popup--crit {
  color: #FFA000;
}

/* ---- 算数RPG（グレー／ダークテーマ） ---- */
body.rpg-page {
  background: #000000;
}

body.rpg-page .rpg-level-chip__lv {
  color: #FFD54F;
}

body.rpg-page .rpg-level-chip__ex {
  color: #B0BEC5;
}

body.rpg-page .rpg-exp-bar {
  background: #263238;
}

body.rpg-page .app-header__back {
  background: #546E7A;
  color: #ECEFF1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

body.rpg-page .app-header__title {
  color: #ECEFF1;
}

body.rpg-page .rpg-enemy-name {
  color: #ECEFF1;
}

body.rpg-page .rpg-hp-bar {
  background: #263238;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

body.rpg-page .rpg-battle-card__hp {
  color: #B0BEC5;
}

body.rpg-page .rpg-combo-row__label,
body.rpg-page .rpg-combo-row__hint {
  color: #B0BEC5;
}

/* :not(.is-filled) に して、たまった マスの いろ（.is-filled）を うわがき しない ように する */
body.rpg-page .rpg-combo-gauge__seg:not(.is-filled) {
  background: #263238;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

body.rpg-page .rpg-enemy-stage {
  /* background の しょうりゃくけいで かくと background-size など ほかの せってい
     （中ボスの たかさ100%ひょうじ など）まで リセットされて しまう ため、
     background-color だけを してい する */
  background-color: #000000;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

body.rpg-page .rpg-question {
  color: #FFFFFF;
}

body.rpg-page .rpg-combo {
  color: #FFB74D;
}

body.rpg-page .rpg-choice-btn {
  background: #607D8B;
  color: #FFFFFF;
  box-shadow: 0 4px 0 #37474F;
}

body.rpg-page .rpg-choice-btn:active {
  box-shadow: 0 1px 0 #37474F;
}

body.rpg-page .rpg-choice-btn.is-correct-flash {
  background: #66BB6A;
  color: #fff;
  box-shadow: 0 4px 0 var(--color-success-dark);
}

body.rpg-page .rpg-choice-btn.is-wrong-flash {
  background: #EF5350;
  color: #fff;
  box-shadow: 0 4px 0 #B71C1C;
}

body.rpg-page .overlay {
  /* うらの がめんが 見えていても「おせない」と わかるように、ほぼ まっくろに する */
  background: rgba(0, 0, 0, 0.92);
}

body.rpg-page .overlay__panel {
  background: #37474F;
  border: 3px solid #ECEFF1;
}

body.rpg-page .overlay__title {
  color: #ECEFF1;
}

body.rpg-page .rpg-result-sub {
  color: #B0BEC5;
}

/* ---- オーバーレイ（ターン終了・結果） ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 50, 56, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.overlay[hidden] { display: none; }

.overlay__panel {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

.overlay__emoji {
  font-size: 48px;
  margin-bottom: 6px;
}

.overlay__title {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.result-grid__item {
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  padding: 12px 4px;
}

.result-grid__value {
  font-size: 22px;
  font-weight: 900;
  color: var(--color-primary-dark);
}

.result-grid__label {
  font-size: 11px;
  color: var(--color-text-soft);
  font-weight: 700;
  margin-top: 2px;
}

.result-points {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 18px;
}

/* ---- 履歴 ---- */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: #ECEFF1;
  padding: 6px;
  border-radius: 999px;
}

.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  color: var(--color-text-soft);
}

.tabs button.is-active {
  background: var(--color-primary);
  color: #fff;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--color-bg-alt);
  font-size: 14px;
}

.stats-row:last-child { border-bottom: none; }

.stats-row__name { font-weight: 700; color: var(--color-text); }
.stats-row__count { font-weight: 800; color: var(--color-primary-dark); }

.history-item {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
}

.history-item__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.history-item__name {
  font-weight: 800;
  font-size: 15px;
}

.history-item__date {
  font-size: 12px;
  color: var(--color-text-soft);
}

.history-item__detail {
  font-size: 13px;
  color: var(--color-text-soft);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.history-item__accuracy {
  font-weight: 800;
  color: var(--color-primary-dark);
}

.history-item__points {
  font-weight: 800;
  color: var(--color-accent);
}

.tab-panel[hidden] { display: none; }

/* ---- インストールバナー ---- */
.install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  max-width: 456px;
  margin: 0 auto;
  background: var(--color-text);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 100;
}

.install-banner__emoji {
  font-size: 26px;
  flex: 0 0 auto;
}

.install-banner__text {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
}

.install-banner__icon {
  display: inline-block;
  margin: 0 2px;
}

.install-banner__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.install-banner__button {
  background: var(--color-accent);
  color: #4A2900;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.install-banner__close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

/* ---- トースト ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--color-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
}

@media (max-width: 340px) {
  .question-card { font-size: 34px; }
  .question-card__blank { width: 52px; height: 52px; font-size: 24px; }
}

/* ---- オープニング ---- */
.rpg-opening {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.rpg-opening__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rpg-opening__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.55) 72%, rgba(0, 0, 0, 0.8) 100%);
}

.rpg-opening__content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 20px;
  text-align: center;
}

.rpg-opening__buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.rpg-opening__btn {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  border-radius: var(--radius-lg);
}

.rpg-opening__password-link {
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.8;
  padding: 8px;
  margin-top: 2px;
}

.rpg-opening__password-link:active {
  opacity: 0.5;
}

/* ---- あんごう にゅうりょく ---- */
.rpg-password {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 6px;
}

.rpg-password__title {
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  color: #ECEFF1;
  margin: 4px 0 0;
}

.rpg-password__desc {
  font-size: 12px;
  color: #B0BEC5;
  text-align: center;
  margin: 0;
  line-height: 1.6;
}

.rpg-password__input {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 16px;
  text-align: center;
  letter-spacing: 1px;
  box-sizing: border-box;
}

.rpg-password__error {
  color: #FF8A80;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin: 0;
}

.rpg-password__error[hidden] { display: none; }

.rpg-password__submit {
  width: 100%;
}

.rpg-password__reveal-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  color: #90A4AE;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px;
  margin: 2px auto 0;
}

.rpg-password__key-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex: 0 0 auto;
}

.rpg-password__list {
  background: #263238;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-top: 4px;
}

.rpg-password__list-title {
  font-size: 11px;
  font-weight: 800;
  color: #90A4AE;
  margin: 0 0 8px;
  text-align: center;
}

.rpg-password__list-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rpg-password__list-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rpg-password__list-row:last-child {
  border-bottom: none;
}

.rpg-password__list-row b {
  color: #FFD54F;
  font-size: 11px;
}

.rpg-password__list-haiku {
  font-size: 12px;
  color: #ECEFF1;
  line-height: 1.5;
}

.rpg-password__list-code {
  font-size: 11px;
  color: #78909C;
  word-break: break-all;
  line-height: 1.5;
}

.rpg-password__back {
  flex: 0 0 auto;
}

/* ---- せってい（おんりょう・BGM しちょう） ---- */
.rpg-settings {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 6px;
}

.rpg-settings__title {
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  color: #ECEFF1;
  margin: 4px 0 0;
}

.rpg-settings__block {
  background: #263238;
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.rpg-settings__volRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.rpg-settings__volLabel {
  font-size: 13px;
  font-weight: 700;
  color: #ECEFF1;
}

.rpg-settings__volDots {
  display: flex;
  gap: 4px;
}

.rpg-settings__volDots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #37474F;
}

.rpg-settings__volDots span.is-on {
  background: #FFD54F;
}

.rpg-settings__slider {
  width: 100%;
  accent-color: #FFD54F;
}

.rpg-settings__bgmList {
  background: #263238;
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.rpg-settings__bgmListTitle {
  font-size: 12px;
  font-weight: 800;
  color: #90A4AE;
  margin: 0 0 8px;
  text-align: center;
}

.rpg-settings__stageGroup {
  margin-bottom: 10px;
}

.rpg-settings__stageGroup:last-child {
  margin-bottom: 0;
}

.rpg-settings__stageTitle {
  font-size: 12px;
  font-weight: 800;
  color: #FFD54F;
  margin: 0 0 4px;
}

.rpg-settings__bgmRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rpg-settings__stageGroup .rpg-settings__bgmRow:last-child {
  border-bottom: none;
}

.rpg-settings__bgmLabel {
  font-size: 12px;
  color: #ECEFF1;
}

.rpg-settings__bgmPlayBtn {
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 800;
  color: #ECEFF1;
  background: #37474F;
}

.rpg-settings__bgmPlayBtn.is-playing {
  background: linear-gradient(180deg, #66BB6A, #43A047);
}

.rpg-settings__back {
  flex: 0 0 auto;
}

/* ---- ろーどまっぷ ---- */
.rpg-roadmap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rpg-roadmap__title {
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  margin: 4px 0 0;
  color: #ECEFF1;
}

.rpg-roadmap__chain {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 12px 4px 16px;
}

.rpg-roadmap__back {
  flex: 0 0 auto;
}

.rpg-roadmap__node {
  position: relative;
  width: 100%;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #37474F;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
  text-align: left;
  color: #ECEFF1;
}

.rpg-roadmap__node:last-child {
  margin-bottom: 0;
}

.rpg-roadmap__node:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 33px;
  top: 100%;
  width: 4px;
  height: 20px;
  background: #546E7A;
  border-radius: 2px;
}

.rpg-roadmap__node-num {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  background: #263238;
  color: #78909C;
}

.rpg-roadmap__node.is-cleared .rpg-roadmap__node-num {
  background: #FFD54F;
  color: #263238;
}

.rpg-roadmap__node.is-current {
  animation: rpg-roadmap-pulse 1.6s ease-in-out infinite;
}

.rpg-roadmap__node.is-current .rpg-roadmap__node-num {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.35);
}

@keyframes rpg-roadmap-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(41, 182, 246, 0.55); }
  50% { transform: scale(1.035); box-shadow: 0 0 16px 5px rgba(41, 182, 246, 0.65); }
}

.rpg-roadmap__node-body {
  flex: 1;
  min-width: 0;
}

.rpg-roadmap__node-name {
  font-weight: 800;
  font-size: 14px;
  margin: 0 0 2px;
}

.rpg-roadmap__node-desc {
  font-size: 11px;
  color: #B0BEC5;
  margin: 0;
  line-height: 1.4;
}

.rpg-roadmap__node-progress {
  font-size: 11px;
  font-weight: 800;
  color: #FFD54F;
  margin: 4px 0 0;
}

.rpg-roadmap__node.is-locked {
  opacity: 0.55;
}

.rpg-roadmap__node.is-locked .rpg-roadmap__node-name {
  color: #90A4AE;
}

.rpg-roadmap__node.is-bigboss .rpg-roadmap__node-num {
  background: #B71C1C;
  color: #fff;
}

/* ---- 中ボス とうじょう えんしゅつ ---- */
body.rpg-page .rpg-midboss-intro__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #1A1A2E;
  border: 3px solid #FFD54F;
}

.rpg-midboss-intro__close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: #ECEFF1;
  font-family: Arial, "Hiragino Kaku Gothic ProN", sans-serif; /* DotGothic16は ✕の じたいが きちんと 出ない ため 除外 */
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  z-index: 1;
}

.rpg-midboss-intro__portrait {
  width: 140px;
  height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
}

.rpg-midboss-intro__name {
  font-size: 20px;
  font-weight: 900;
  color: #FFD54F;
  margin: 0;
}

.rpg-midboss-intro__line {
  font-size: 15px;
  font-weight: 700;
  color: #ECEFF1;
  margin: 0;
  text-align: center;
}

.rpg-midboss-intro.is-flashing {
  animation: rpg-midboss-flash 0.35s steps(1) 3;
}

@keyframes rpg-midboss-flash {
  0%, 100% { background: rgba(38, 50, 56, 0.55); }
  50% { background: rgba(255, 255, 255, 0.92); }
}

/* ---- アイテム ドロップの トースト / ボスの こうげき けいこく ---- */
.rpg-item-toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #263238;
  color: #ECEFF1;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  z-index: 120;
  animation: rpg-toast-pop 0.25s ease;
}

.rpg-item-toast[hidden] { display: none; }

.rpg-item-toast__icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* デイリーボーナスは トーストでは なく、画面中央の ✕で とじる ポップアップ（うらの がめんは 操作できない） */
.rpg-daily-overlay {
  z-index: 130;
}

.rpg-daily-toast {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  padding: 22px 30px;
  animation: rpg-daily-pop 0.25s ease;
}

@keyframes rpg-daily-pop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.rpg-daily-toast__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.rpg-daily-toast__icon {
  font-size: 32px;
  line-height: 1;
}

.rpg-daily-toast__text {
  color: #ECEFF1;
  font-weight: 800;
  font-size: 15px;
}

.rpg-daily-toast__stars {
  font-size: 18px;
  letter-spacing: 3px;
  color: #FFD54F;
}

.rpg-daily-toast__close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: #ECEFF1;
  font-family: Arial, "Hiragino Kaku Gothic ProN", sans-serif; /* DotGothic16は ✕の じたいが きちんと 出ない ため 除外 */
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}

@keyframes rpg-toast-pop {
  0% { transform: translateX(-50%) translateY(10px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.rpg-boss-warning {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: #B71C1C;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  z-index: 130;
  animation: rpg-boss-warning-pulse 0.4s ease infinite alternate;
}

.rpg-boss-warning[hidden] { display: none; }

@keyframes rpg-boss-warning-pulse {
  from { opacity: 1; }
  to { opacity: 0.55; }
}

/* ---- 中雑魚・大ボス の 見た目 ---- */
.rpg-enemy-sprite.is-midzako {
  filter: drop-shadow(0 0 10px rgba(255, 152, 0, 0.75));
}

.rpg-enemy-sprite.is-bigboss {
  width: 70%;
  max-width: 230px;
  filter: drop-shadow(0 0 16px rgba(211, 47, 47, 0.8));
}

.rpg-enemy-stage.is-bigboss {
  background: linear-gradient(180deg, #4A148C, #1A1A2E);
}

/* おおつなみ: ひだり→みぎへ、すこし うえした しながら ながれる */
.rpg-fx-tsunami {
  position: absolute;
  top: 10%;
  left: -45%;
  height: 80%;
  width: auto;
  aspect-ratio: 1 / 1;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 5;
  animation: rpg-fx-tsunami-move 1.2s linear forwards;
}

@keyframes rpg-fx-tsunami-move {
  0%   { left: -45%; transform: translateY(0); }
  20%  { transform: translateY(-14px); }
  40%  { transform: translateY(10px); }
  60%  { transform: translateY(-14px); }
  80%  { transform: translateY(10px); }
  100% { left: 100%; transform: translateY(-6px); }
}

/* だいちのいかり: じめんの われめが てんめつし、てきが グラグラ ゆれる */
.rpg-fx-quake {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 130px;
  margin: -65px 0 0 -65px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 5;
  animation: rpg-fx-quake-blink 1.2s steps(1, end) forwards;
}

@keyframes rpg-fx-quake-blink {
  0% { opacity: 1; }
  10% { opacity: 0; }
  20% { opacity: 1; }
  30% { opacity: 0; }
  40% { opacity: 1; }
  50% { opacity: 0; }
  60% { opacity: 1; }
  70% { opacity: 0; }
  80% { opacity: 1; }
  90% { opacity: 0; }
  100% { opacity: 0; }
}

.rpg-enemy-sprite.is-quaking {
  animation: rpg-fx-quake-shake 0.1s linear infinite;
}

@keyframes rpg-fx-quake-shake {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(-9px, 3px) rotate(-7deg); }
  50%  { transform: translate(8px, -4px) rotate(6deg); }
  75%  { transform: translate(-7px, -3px) rotate(-5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ゼロ大王の ぞくせいバリア */
.rpg-barrier-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 96%;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  z-index: 6;
  pointer-events: none;
}

.rpg-enemy-stage.is-barrier-water { box-shadow: 0 0 0 3px #29B6F6, 0 0 22px 6px rgba(41, 182, 246, 0.75); }
.rpg-enemy-stage.is-barrier-earth { box-shadow: 0 0 0 3px #A1887F, 0 0 22px 6px rgba(161, 136, 127, 0.75); }
.rpg-enemy-stage.is-barrier-electric { box-shadow: 0 0 0 3px #FFEB3B, 0 0 22px 6px rgba(255, 235, 59, 0.75); }
.rpg-enemy-stage.is-barrier-nature { box-shadow: 0 0 0 3px #66BB6A, 0 0 22px 6px rgba(102, 187, 106, 0.75); }

/* ゼロ大王の しんか えんしゅつ: まっしろな ひかりが てんめつし、がぞうが ぶるぶる ふるえながら ひかる */
.rpg-fx-evolve {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  background: radial-gradient(circle, #fff 0%, #FFF59D 45%, rgba(255, 213, 79, 0) 75%);
  animation: rpg-fx-evolve-flash 1.8s ease-in-out forwards;
}

@keyframes rpg-fx-evolve-flash {
  0% { opacity: 0; }
  15% { opacity: 0.9; }
  25% { opacity: 0.2; }
  40% { opacity: 1; }
  50% { opacity: 0.3; }
  55% { opacity: 1; }
  100% { opacity: 0; }
}

.rpg-enemy-sprite.is-evolving {
  animation: rpg-fx-evolve-glow 1.8s ease-in-out forwards;
}

@keyframes rpg-fx-evolve-glow {
  0% { filter: brightness(1); transform: scale(1); }
  20% { filter: brightness(2.5); transform: scale(1.05) translateX(-4px); }
  30% { filter: brightness(1.2); transform: scale(1) translateX(4px); }
  50% { filter: brightness(6); transform: scale(1.25); }
  100% { filter: brightness(1); transform: scale(1); }
}

/* はじめから の オープニング ストーリー */
.rpg-story {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rpg-story__img {
  width: 100%;
  max-width: 420px;
  max-height: 52vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  image-rendering: pixelated;
}

.rpg-story__box {
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  background: #1c262b;
  border: 2px solid #ECEFF1;
  border-radius: var(--radius-md);
  padding: 12px 14px 8px;
}

.rpg-story__text {
  margin: 0;
  min-height: 7.2em;
  color: #ECEFF1;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.8;
  white-space: pre-line;
}

.rpg-story__hint {
  margin: 4px 0 0;
  text-align: right;
  font-size: 11px;
  font-weight: 800;
  color: #FFD54F;
  animation: rpg-story-blink 1s steps(1, end) infinite;
}

@keyframes rpg-story-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* くくの ふりがな（ステージ7〜） */
.rpg-question__reading {
  margin: -6px 0 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #FFD54F;
  letter-spacing: 1px;
}

.rpg-question__reading[hidden] { display: none; }

/* ステージ7〜9: ちょうせんけんが あるあいだ 右上に でる 丸ボタン */
.rpg-challenge-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 74px;
  height: 74px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FF8A65, #E53935);
  color: #fff;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  z-index: 8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
  animation: rpg-challenge-pulse 1.2s ease-in-out infinite;
}

.rpg-challenge-btn[hidden] { display: none; }
.rpg-challenge-btn span { font-size: 13px; line-height: 1.1; white-space: nowrap; }
.rpg-challenge-btn small { font-size: 10px; line-height: 1.1; font-weight: 800; white-space: nowrap; }

@keyframes rpg-challenge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.rpg-voice-btn {
  margin-left: 8px;
  width: 30px;
  height: 30px;
  border: 2px solid #FFD54F;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  vertical-align: middle;
}
.rpg-voice-btn[hidden] { display: none; }

/* いなごの たいぐん: 4ひきが ひだり→みぎ、そのあと みぎ→ひだり */
.rpg-fx-locust {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.rpg-fx-locust__bug {
  position: absolute;
  left: -30%;
  width: 26%;
  height: auto;
  image-rendering: pixelated;
  animation: rpg-fx-locust-fly 1.6s ease-in-out both;
}

@keyframes rpg-fx-locust-fly {
  0%   { left: -30%; transform: scaleX(1) translateY(0); }
  12%  { transform: scaleX(1) translateY(-6px); }
  25%  { transform: scaleX(1) translateY(5px); }
  49%  { left: 104%; transform: scaleX(1) translateY(-4px); }
  50%  { left: 104%; transform: scaleX(-1) translateY(0); }
  62%  { transform: scaleX(-1) translateY(6px); }
  75%  { transform: scaleX(-1) translateY(-5px); }
  100% { left: -30%; transform: scaleX(-1) translateY(0); }
}

/* マンジャロス: キラキラが ランダムに チカチカ */
.rpg-fx-sparkle {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.rpg-fx-sparkle__star {
  position: absolute;
  height: auto;
  image-rendering: pixelated;
  animation: rpg-fx-sparkle-blink 0.32s steps(2, end) both;
}

@keyframes rpg-fx-sparkle-blink {
  0% { opacity: 0; transform: scale(0.5); }
  35% { opacity: 1; transform: scale(1.15); }
  70% { opacity: 0.4; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* だいふんか: したから ゴゴゴと ふるえながら せりあがる */
.rpg-fx-eruption {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.rpg-fx-eruption__img {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 78%;
  max-width: 280px;
  height: auto;
  margin-left: calc(min(78%, 280px) / -2);
  image-rendering: pixelated;
  animation: rpg-fx-eruption-rise 1.6s ease-out both, rpg-fx-eruption-shake 0.09s linear infinite;
}

@keyframes rpg-fx-eruption-rise {
  0%   { transform: translateY(105%); opacity: 1; }
  70%  { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(0); opacity: 0; }
}

@keyframes rpg-fx-eruption-shake {
  0%, 100% { margin-left: calc(min(78%, 280px) / -2 - 5px); }
  50% { margin-left: calc(min(78%, 280px) / -2 + 5px); }
}

/* ---- ゲットチャンス: じゃんけん ---- */
.rpg-janken {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.rpg-janken[hidden] { display: none; }

.rpg-janken__enemy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: rpg-janken-pop 0.25s ease-out;
}

.rpg-janken__enemy[hidden] { display: none; }

.rpg-janken__enemy img {
  width: 110px;
  height: 110px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(255, 213, 79, 0.7));
}

.rpg-janken__enemy span {
  font-size: 14px;
  font-weight: 900;
  color: #FFD54F;
}

@keyframes rpg-janken-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.rpg-janken__hands {
  display: flex;
  gap: 10px;
}

.rpg-janken__hand {
  width: 92px;
  border: none;
  padding: 8px 4px 6px;
  border-radius: var(--radius-md);
  background: #263238;
  color: #ECEFF1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 0 0 2px #4FC3F7, 0 4px 14px rgba(0, 0, 0, 0.5);
}

.rpg-janken__hand img {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
}

.rpg-janken__hand:not(:disabled) {
  cursor: pointer;
  animation: rpg-slot-invite 0.9s ease-in-out infinite;
}

.rpg-janken__hand:disabled { opacity: 0.55; cursor: default; }
.rpg-janken__hand.is-picked { opacity: 1; box-shadow: 0 0 0 3px #FFD54F, 0 4px 14px rgba(0, 0, 0, 0.5); }

/* ---- くりさがり ひきざん（13を 10と 3に わけて 2だんで とく） ---- */
.bw-eq { margin-bottom: 4px; padding: 8px 14px; font-size: 38px; gap: 10px; }
.bw-eq__ans {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  padding: 0 8px;
  border-radius: 12px;
  background: #FFF3E0;
  color: #E65100;
}

.bw-step {
  margin: 0 0 2px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--color-text);
}
.bw-step b { font-size: 20px; color: #E65100; }
.bw-step b.bw-num--split { color: #2E7D32; }
.bw-step b.bw-num--ans { color: #E65100; }
.bw-step__sub { display: block; font-size: 12px; font-weight: 700; color: var(--color-text-soft); margin-bottom: 1px; }

.bw-board {
  position: relative;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 4px 8px 6px;
  margin-bottom: 2px;
}

.bw-origin {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bw-origin span {
  font-size: 42px;
  font-weight: 900;
  color: var(--color-text);
  line-height: 1;
}
.bw-origin span.is-small {
  font-size: 18px;
  color: var(--color-text-soft);
}

.bw-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 4px 0;
  transition: opacity 0.3s ease;
}
.bw-row--2 { border-top: 2px dashed #CFD8DC; padding-top: 8px; }
.bw-board:not(.is-step2) .bw-row--2 { opacity: 0.6; }
.bw-board.is-step2 .bw-row:not(.bw-row--2) { opacity: 0.65; }

.bw-cellwrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.bw-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 14px;
  border: 3px solid #CFD8DC;
  background: #fff;
  color: var(--color-text);
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
}
.bw-cell--ten { border-color: #29B6F6; background: #E1F5FE; color: #0277BD; }
.bw-cell--split { border-color: #66BB6A; background: #E8F5E9; color: #2E7D32; }
.bw-cell--ans { border-color: #FFA726; background: #FFF3E0; color: #E65100; }
.bw-cell--res { border-color: #7986CB; background: #E8EAF6; color: #3949AB; }
.bw-cell--res.is-done { background: #C5CAE9; color: #1A237E; }
.bw-cell.is-empty { border-style: dashed; background: transparent; color: transparent; }
.bw-cell--res.is-empty { color: #7986CB; }
.bw-cell.is-wrong { border-color: var(--color-danger); background: #FFEBEE; color: #C62828; }
.bw-cell.bw-pop { animation: bw-pop 0.3s ease-out; }

@keyframes bw-pop {
  0% { transform: scale(0.5); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.bw-op {
  width: 26px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 900;
  color: var(--color-text-soft);
}

.bw-cap { font-size: 11px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.bw-cap--split { color: #2E7D32; }
.bw-cap--ans { color: #E65100; }

.bw-chip {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 3px solid;
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.bw-chip--ten { border-color: #29B6F6; background: #E1F5FE; color: #0277BD; }
.bw-chip--split { border-color: #66BB6A; background: #E8F5E9; color: #2E7D32; }
.bw-chip--ans { border-color: #FFA726; background: #FFF3E0; color: #E65100; }

.bw-bigresult {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-lg);
  background: #fff;
  font-size: 54px;
  font-weight: 900;
  color: var(--color-text);
  animation: bw-big-pop 0.4s ease-out;
}
.bw-bigresult[hidden] { display: none; }
.bw-bigresult.is-ok { box-shadow: inset 0 0 0 5px var(--color-success); }
.bw-bigresult.is-ng { box-shadow: inset 0 0 0 5px #FFB74D; }
.bw-bigresult__ans { color: #E65100; font-size: 66px; }

@keyframes bw-big-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.bw-choices {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 2px;
}

.bw-choice {
  flex: 1;
  max-width: 110px;
  height: 62px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  font-family: inherit;
  font-size: 30px;
  font-weight: 900;
  box-shadow: var(--shadow-button);
}
.bw-choice:active:not(:disabled) { transform: translateY(2px); }
.bw-choice:disabled { opacity: 0.85; }
.bw-choice.is-correct-flash { background: var(--color-success); }
.bw-choice.is-wrong-flash { background: var(--color-danger); }

/* ボール（もとの しきから おりてくる／ぶんれつする） */
.bw-chip.is-ball { border-radius: 50%; }
.bw-chip--ball { border-color: #FFB74D; background: #FFE0B2; color: #E65100; }

.bw-split {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.bw-goo {
  position: absolute;
  inset: 0;
  filter: url(#bwGoo);
}
.bw-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #FFB74D;
}
.bw-split__label {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 900;
  color: #fff;
  transition: opacity 0.2s ease;
}

.bw-fadein { animation: bw-fadein 0.35s ease-out; }
@keyframes bw-fadein {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* いま とく しきの こたえらん：ふわふわ ふくらんで ちぢむ */
.bw-cell.is-asking {
  animation: bw-breathe 1.1s ease-in-out infinite;
  background: #fff;
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(255, 167, 38, 0.25);
}
.bw-cell--res.is-asking { box-shadow: 0 0 0 4px rgba(121, 134, 203, 0.28); }

@keyframes bw-breathe {
  0%, 100% { transform: scale(0.94); }
  50% { transform: scale(1.18); }
}

/* ---- せっていの アコーディオン ---- */
.acc.card { padding: 0; flex-shrink: 0; } /* app-shell は たかさ こていの たて並びなので、ちぢまない ように する（ちぢむと なかみが きれる） */
.acc__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  color: var(--color-text);
}
.acc__summary::-webkit-details-marker { display: none; }
.acc__summary::after {
  content: '▾';
  font-size: 18px;
  color: var(--color-text-soft);
  transition: transform 0.2s ease;
}
.acc[open] > .acc__summary { border-bottom: 2px solid #ECEFF1; }
.acc[open] > .acc__summary::after { transform: rotate(180deg); }
.acc__body { padding: 16px 20px 20px; }

/* ---- AIしんだん ---- */
.ai-box { margin: 12px 0 0; padding: 12px; background: #F3E5F5; border-radius: 12px; font-size: 13px; line-height: 1.7; color: var(--color-text); }
.ai-box h4 { margin: 0 0 6px; font-size: 14px; font-weight: 800; }
.ai-box ul { margin: 4px 0 0; padding-left: 18px; }
.ai-weak { margin: 6px 0 0; padding: 8px 10px; background: #fff; border-radius: 10px; border-left: 5px solid #FFA726; }
.ai-weak--2 { border-left-color: #FB8C00; }
.ai-weak--3 { border-left-color: #E53935; }
.ai-weak b { font-size: 13px; }
.ai-weak small { display: block; color: var(--color-text-soft); font-size: 12px; }
.ai-goal { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; padding: 8px 10px; background: #fff; border-radius: 10px; }
.ai-goal__name { flex: 1; font-size: 13px; font-weight: 800; }
.ai-goal__name small { display: block; font-weight: 600; font-size: 11px; color: var(--color-text-soft); }
.ai-goal input { width: 64px; padding: 8px; border: 2px solid #CFD8DC; border-radius: 10px; font-size: 16px; text-align: center; }
.ai-progress { height: 8px; background: #ECEFF1; border-radius: 6px; overflow: hidden; margin-top: 4px; }
.ai-progress > span { display: block; height: 100%; background: linear-gradient(90deg, #66BB6A, #43A047); border-radius: 6px; }
.ai-progress.is-done > span { background: linear-gradient(90deg, #FFD54F, #FFA726); }
