/* ==========================================================
   偶数奇数レーサー — even-odd-racer.css
   すべてのセレクタを .eor-root でスコープ化しテーマ干渉を防止
   ========================================================== */

.eor-root {
  --eor-good: #2ecc71;
  --eor-bad:  #e74c3c;
  --eor-gold: #f5c518;
  --eor-blue: #2d6cdf;
  --eor-even: #1f9e57;  /* ぐうすう色 */
  --eor-odd:  #e07b1a;  /* きすう色 */

  position: relative;
  width: 100%;
  /* 電子黒板・タブレットを想定した16:9ビューポート高さ */
  height: min(100vw * 9 / 16, 92vh);
  max-width: 760px;
  margin: 0 auto;
  overflow: hidden;
  background: #0c1326;
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", system-ui, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* Cocoonテーマの body 設定に引きずられないよう上書き */
  box-sizing: border-box;
}

.eor-root *, .eor-root *::before, .eor-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Canvas ---------- */
.eor-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- HUD ---------- */
.eor-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0,0,0,.6);
  font-weight: 800;
}
.eor-hud.hidden { display: none !important; }

.eor-hud-pill {
  background: rgba(16,24,46,.78);
  border-radius: 14px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 54px;
}
.eor-hud-pill small { font-size: 11px; font-weight: 700; opacity: .8; }
.eor-hud-pill b     { font-size: 20px; }

.eor-quest {
  flex: 1;
  text-align: center;
  font-size: clamp(18px, 5vw, 30px);
  color: #fff;
}
/* 修正: お題ワードをゲートのタグ色と同じ色で表示（ぐうすう=緑 / きすう=オレンジ） */
.eor-quest-word { font-weight: 900; }
.eor-word-even  { color: var(--eor-even); text-shadow: 0 0 12px rgba(46,204,113,.7), 0 2px 4px rgba(0,0,0,.6); }
.eor-word-odd   { color: var(--eor-odd);  text-shadow: 0 0 12px rgba(255,152,0,.7),  0 2px 4px rgba(0,0,0,.6); }
.eor-lives b    { font-size: 18px; }

/* 修正: れんしゅう終了・チャレンジ中断用の「やめる」ボタン */
.eor-quit {
  pointer-events: auto;
  border: none;
  border-radius: 12px;
  background: rgba(16,24,46,.78);
  color: #cfd8ea;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
}
.eor-quit:active { background: rgba(60,72,110,.9); }

/* ---------- コンボ・判定・レベルアップ ---------- */
.eor-combo {
  position: absolute;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  font-size: 34px; font-weight: 900;
  color: var(--eor-gold); opacity: 0;
  text-shadow: 0 3px 0 #b8860b, 0 0 18px rgba(245,197,24,.8);
  pointer-events: none;
}
/* 修正: 走行を止めないレベルアップ・トースト */
.eor-level-toast {
  position: absolute;
  top: 30%; left: 50%;
  transform: translateX(-50%);
  font-size: clamp(24px, 6vw, 40px);
  font-weight: 900;
  color: #9fe0ff;
  opacity: 0;
  text-shadow: 0 3px 0 #1a5f8a, 0 0 22px rgba(120,200,255,.9);
  pointer-events: none;
  white-space: nowrap;
}
.eor-judge {
  position: absolute;
  top: 42%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 90px; font-weight: 900;
  opacity: 0; pointer-events: none;
}

/* ---------- 操作ボタン ---------- */
.eor-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  pointer-events: none;
}
.eor-controls.hidden { display: none !important; }

.eor-ctrl-btn {
  pointer-events: auto;
  width: 92px; height: 92px;
  border: none; border-radius: 50%;
  background: rgba(45,108,223,.9);
  color: #fff; font-size: 42px; font-weight: 900;
  box-shadow: 0 6px 0 #1a4ba0, 0 8px 16px rgba(0,0,0,.4);
  cursor: pointer;
  transition: transform .06s, box-shadow .06s;
}
.eor-ctrl-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1a4ba0;
}

/* ---------- 画面共通 ---------- */
.eor-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  background: rgba(8,12,28,.55);
  text-align: center;
}
.eor-screen.hidden { display: none !important; }

.eor-game-title {
  font-size: clamp(34px, 9vw, 58px);
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  text-shadow:
    0 4px 0 rgba(20,40,90,.9),
    0 0 26px rgba(90,160,255,.55);
  display: flex;
  flex-direction: column;
}
.eor-game-title small {
  font-size: clamp(12px, 2.6vw, 16px);
  letter-spacing: .35em;
  color: var(--eor-gold);
  font-weight: 800;
}

.eor-road-divider {
  width: min(320px, 70%);
  height: 6px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    90deg,
    #f5c518 0 26px,
    transparent 26px 44px
  );
  opacity: .9;
}

.eor-lead {
  font-size: clamp(14px, 3.6vw, 19px);
  line-height: 1.8;
  font-weight: 700;
  color: #dce6f7;
  text-shadow: 0 2px 4px rgba(0,0,0,.6);
}

/* ---------- ボタン ---------- */
.eor-big-btn {
  border: none;
  border-radius: 999px;
  padding: 16px 56px;
  font-size: clamp(19px, 4.6vw, 25px);
  font-weight: 900;
  color: #14213d;
  background: linear-gradient(180deg, #ffe27a, #f5c518);
  box-shadow: 0 6px 0 #b8860b, 0 10px 20px rgba(0,0,0,.45);
  cursor: pointer;
  font-family: inherit;
  transition: transform .06s, box-shadow .06s;
}
.eor-big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #b8860b;
}

.eor-sub-btn {
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 999px;
  padding: 9px 30px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: rgba(255,255,255,.08);
  cursor: pointer;
  font-family: inherit;
}
.eor-sub-btn:active { background: rgba(255,255,255,.2); }

/* ---------- モード選択 ---------- */
.eor-mode-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.eor-mode-card {
  width: min(240px, 42vw);
  padding: 20px 14px;
  border-radius: 18px;
  background: rgba(24,34,66,.92);
  border: 2px solid rgba(140,170,230,.4);
  cursor: pointer;
  transition: transform .1s, border-color .1s;
}
.eor-mode-card:hover,
.eor-mode-card:active {
  transform: translateY(-3px);
  border-color: var(--eor-gold);
}
.eor-mc-title {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 900;
  color: var(--eor-gold);
  margin-bottom: 8px;
}
.eor-mc-desc {
  font-size: clamp(12px, 3vw, 14px);
  line-height: 1.7;
  font-weight: 700;
  color: #cfd8ea;
}

/* ---------- お題選択（練習） ---------- */
.eor-panel {
  background: rgba(24,34,66,.92);
  border: 2px solid rgba(140,170,230,.4);
  border-radius: 18px;
  padding: 18px;
  max-width: min(560px, 92%);
}
.eor-parity-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.eor-opt {
  min-width: 128px;
  padding: 16px 14px;
  border-radius: 14px;
  background: rgba(45,58,100,.9);
  border: 2px solid rgba(140,170,230,.35);
  font-size: clamp(17px, 4.2vw, 21px);
  font-weight: 900;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform .08s, border-color .08s, background .08s;
}
.eor-opt small {
  font-size: 12px;
  font-weight: 700;
  color: #b9c6e2;
}
.eor-opt.sel {
  background: var(--eor-blue);
  border-color: #fff;
  transform: scale(1.05);
}
.eor-opt-even.sel { background: var(--eor-even); }
.eor-opt-odd.sel  { background: var(--eor-odd); }

/* ---------- アナウンス・結果 ---------- */
.eor-stage-no {
  font-size: clamp(18px, 4.6vw, 24px);
  font-weight: 900;
  letter-spacing: .2em;
  color: #9fc0ff;
}
.eor-stage-quest {
  font-size: clamp(26px, 7vw, 42px);
  font-weight: 900;
  color: var(--eor-gold);
  text-shadow: 0 3px 0 rgba(120,90,0,.7);
}
.eor-stage-meta {
  font-size: clamp(13px, 3.4vw, 17px);
  font-weight: 800;
  color: #cfd8ea;
}

.eor-result-score {
  font-size: clamp(44px, 12vw, 74px);
  font-weight: 900;
  color: var(--eor-gold);
  text-shadow: 0 4px 0 #b8860b, 0 0 24px rgba(245,197,24,.6);
  line-height: 1;
}
.eor-result-line {
  font-size: clamp(14px, 3.6vw, 18px);
  font-weight: 800;
  color: #dce6f7;
}
.eor-best {
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 800;
  color: #9fe0ff;
}

/* ---------- 修正: モーダル画面（ゲームオーバー・けっか）専用のハンバーガーメニュー ----------
   ゲーム中の画面や設定・お題選択の各画面には出さず、結果を表示する2つの.eor-screenの
   左上にだけ配置。押すと他の整数関連アプリへのリンク一覧ドロワーが右から開く */
.eor-root .eor-menu-btn {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 5;
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: rgba(16,24,46,.78);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s ease;
}
.eor-root .eor-menu-btn:hover { background: rgba(60,72,110,.9); }
.eor-root .eor-menu-btn-icon { width: 20px; height: 20px; fill: #fff; flex-shrink: 0; }

.eor-root .eor-menu-overlay {
  position: fixed; inset: 0; z-index: 1150;
  background: rgba(15, 30, 58, .45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.eor-root .eor-menu-overlay.is-open { opacity: 1; pointer-events: auto; }
.eor-root .eor-menu-drawer {
  position: fixed; z-index: 1151; top: 0; right: 0;
  width: min(380px, 90%); height: 100%; height: 100dvh;
  display: flex; flex-direction: column;
  background: #fff; border-left: 1px solid #d7e0eb;
  box-shadow: -12px 0 30px rgba(15, 30, 58, .25);
  transform: translateX(105%);
  transition: transform .25s ease;
  /* 修正: レース画面のダークテーマと切り離し、ドロワー内は可読性優先の白基調で統一 */
  color: #24364d;
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", system-ui, sans-serif;
  text-align: left;
}
.eor-root .eor-menu-drawer.is-open { transform: translateX(0); }
.eor-root .eor-menu-header {
  display: flex; align-items: center; gap: 10px;
  min-height: 64px; padding: 12px 14px;
  border-bottom: 1px solid #e5eaf2;
  flex: 0 0 auto;
}
.eor-root .eor-menu-heading { flex: 1; margin: 0; color: #1e3a5f; font-size: 18px; font-weight: 900; }
.eor-root .eor-menu-close,
.eor-root .eor-menu-back {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: #f3f6fa; color: #1e3a5f;
  font: inherit; font-size: 20px; cursor: pointer;
}
.eor-root .eor-menu-content { flex: 1; overflow-y: auto; padding: 14px; }
.eor-root .eor-menu-topic-list,
.eor-root .eor-menu-app-list { display: grid; gap: 10px; }
.eor-root .eor-menu-topic {
  width: 100%; display: flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 13px 15px;
  border: 1px solid #d7e0eb; border-radius: 16px;
  background: #fff; color: #24364d;
  font: inherit; font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.eor-root .eor-menu-topic:hover { background: #f5f8fb; }
.eor-root .eor-menu-topic-name { flex: 1; }
.eor-root .eor-menu-topic-count { color: #667085; font-size: 13px; font-weight: 700; }
.eor-root .eor-menu-topic-arrow { color: #98a2b3; }
.eor-root .eor-menu-app {
  position: relative; display: block;
  padding: 14px 15px; border: 1px solid #d7e0eb; border-radius: 14px;
  background: #fff; color: #24364d;
  text-decoration: none !important;
  font-size: 15px; font-weight: 700; line-height: 1.5;
}
.eor-root .eor-menu-app:hover { background: #f5f8fb; }
.eor-root .eor-menu-app.is-current {
  padding-right: 66px;
  background: #eef4fb; border-color: #9db7d3; color: #1e3a5f;
  cursor: default;
}
.eor-root .eor-menu-current-badge {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
  padding: 3px 7px; border-radius: 999px;
  background: #1e3a5f; color: #fff; font-size: 10px; font-weight: 700;
}
.eor-root .eor-menu-empty { padding: 26px 12px; color: #667085; text-align: center; font-size: 14px; }
@media (max-width: 700px) {
  .eor-root .eor-menu-drawer { width: min(340px, 94%); }
}

/* ---------- レスポンシブ調整 ---------- */
@media (max-width: 520px) {
  .eor-ctrl-btn { width: 74px; height: 74px; font-size: 34px; }
  .eor-hud-pill b { font-size: 16px; }
  .eor-hud { gap: 6px; padding: 8px 10px; }
}
