/* ============================================================
   奇数・偶数ハンター v2.0.0（シンプルUI版）
   固定ヘッダー＋全画面メインエリア＋右下縦型ツールバー
   全て .oeh-root 配下にスコープ
   ============================================================ */

.oeh-root, .oeh-root * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.oeh-root{
  --base: #FFFFFF;
  --base-light: #FAFAFA;
  --base-dark: #F5F5F5;

  --main: #1e3a5f;
  --main-light: #2d5a8f;
  --main-dark: #0f1e3a;

  --accent: #d4af37;
  --accent-light: #f4cf5f;
  --accent-dark: #b8941f;

  --text: #2C3E50;
  --text-light: #7F8C8D;
  --border: #E8E8E8;

  --warn: #f59e0b;
  --danger: #ef4444;

  --shadow: 0 4px 20px rgba(30, 58, 95, 0.1);
  --shadow-hover: 0 8px 30px rgba(30, 58, 95, 0.15);
}
.oeh-root{
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  color: var(--text);
  background: #7f8fa5; /* 修正: 参考画像から抽出した落ち着いたブルーグレーに変更 */
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  /* 修正: テーマの本文カラム幅に閉じ込められて右側に大きな余白ができる問題対策。
     親要素の幅制約を無視してビューポート全幅まで広げる */
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

/* ---------- 全体レイアウト ---------- */
.oeh-root .oeh-app{
  height: 100vh; display: flex; flex-direction: column;
}

/* ---------- 固定ヘッダー ---------- */
.oeh-root .oeh-header{
  flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: var(--main);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  flex-wrap: wrap;
}
.oeh-root .oeh-title{
  margin: 0; font-size: 17px; font-weight: 900; letter-spacing: .02em;
  white-space: nowrap;
}
.oeh-root .oeh-instruction{
  flex: 1; text-align: center; font-size: 13px; font-weight: 600;
  opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 80px;
}
.oeh-root .oeh-status{
  display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap;
}
.oeh-root .oeh-stat{
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255,255,255,.12);
  border-radius: 12px; padding: 4px 12px; min-width: 56px;
}
.oeh-root .oeh-stat-label{ font-size: 10px; font-weight: 700; opacity: .8; letter-spacing: .04em; }
.oeh-root .oeh-stat-value{ font-size: 16px; font-weight: 900; line-height: 1.3; }
.oeh-root .oeh-stat-value small{ font-size: 11px; font-weight: 700; opacity: .85; margin-left: 2px; }
.oeh-root .oeh-stat-warn{ background: rgba(245,158,11,.25); }
.oeh-root .oeh-stat-danger{ background: rgba(239,68,68,.25); }

/* ---------- 全画面メインエリア ---------- */
.oeh-root .oeh-main{
  flex: 1; min-height: 0;
  position: relative;
  padding: 20px;
  display: flex;
}

/* ===== 設定画面 ===== */
.oeh-root .target-selection{
  flex: 1;
  display: flex; align-items: center; justify-content: center;
}
.oeh-root .oeh-setup-card{
  background: #FFFFFF; /* 修正: 参考画像に合わせてカードは白に */
  padding: 28px;
  border-radius: 20px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  overflow: auto;
}

.oeh-root .setting-group{ margin-bottom: 16px; }

.oeh-root .target-buttons{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 500px;
  margin: 0 auto 12px;
}
.oeh-root .target-btn{
  padding: 16px 20px;
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 900;
  background: var(--base);
  color: var(--text);
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px;
  position: relative;
}
.oeh-root .target-btn:hover{
  border-color: var(--accent);
  background: #fffcf5;
}
.oeh-root .target-btn.selected{
  border-color: var(--main);
  background: var(--main);
  color: var(--accent);
}
.oeh-root .target-btn.selected::before{
  content: '✓'; position: absolute; top: 6px; right: 10px;
  font-size: 1.1rem; font-weight: bold;
}
.oeh-root .target-icon{ font-size: 1.3rem; }

.oeh-root .difficulty-buttons{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  max-width: 600px;
  margin: 0 auto 12px;
}
.oeh-root .difficulty-btn{
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 900;
  background: var(--base);
  color: var(--text);
  position: relative;
}
.oeh-root .difficulty-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.2);
  border-color: var(--accent);
}
.oeh-root .difficulty-btn.selected{
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  color: var(--main-dark);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}
.oeh-root .difficulty-btn.selected::before{
  content: '✓'; position: absolute; top: 4px; right: 8px; font-size: 1.2rem;
}
.oeh-root .difficulty-info{
  font-size: 0.82rem;
  color: var(--text-light);
  text-align: center;
  padding: 8px;
}

.oeh-root .start-game-section{
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.oeh-root .start-game-btn{
  padding: 16px 40px;
  font-size: 1.2rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  color: var(--main-dark);
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}
.oeh-root .start-game-btn:hover:not(:disabled){
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}
.oeh-root .start-game-btn:disabled{
  background: #cfd8dc; cursor: not-allowed; transform: none;
  box-shadow: none; color: #90a4ae;
}

/* ===== ゲーム画面 ===== */
.oeh-root .game-section{
  display: none;
  flex: 1;
  min-width: 0;
  justify-content: center; /* 修正: 横幅を縮小した分、中央に寄せる */
}
.oeh-root .game-section.active{ display: flex; }

.oeh-root .game-layout{
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  gap: 0;
  width: 90%; /* 修正: 横幅を10%縮小(100%→90%) */
  height: 100%;
}

.oeh-root .collection-side{
  background: var(--base-light);
  border-radius: 16px;
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
}
.oeh-root .collection-side.left{
  border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none;
}
.oeh-root .collection-side.right{
  border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: none;
}

.oeh-root .game-area{
  width: 100%; height: 100%;
  background: linear-gradient(180deg, var(--base) 0%, var(--base-light) 100%);
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--main-light);
  border-bottom: 3px solid var(--main-light);
  box-shadow: 0 4px 16px rgba(30, 58, 95, 0.15);
  touch-action: manipulation;
}
.oeh-root .game-area.paused .number{ animation-play-state: paused; }
.oeh-root .game-area.input-locked{ pointer-events: none; }

.oeh-root .number{
  position: absolute;
  width: 70px; height: 70px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 900;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: oeh-fall linear;
  background: var(--base);
  color: var(--main);
  box-shadow: 0 4px 16px rgba(30, 58, 95, 0.2);
  border: 4px solid var(--main-light);
}
.oeh-root .number:hover{
  transform: scale(1.15);
  box-shadow: 0 6px 24px rgba(30, 58, 95, 0.3);
  border-color: var(--accent);
}
.oeh-root .number:active{ transform: scale(0.95); }

.oeh-root .collected-ball{
  position: absolute;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  background: linear-gradient(135deg, var(--base) 0%, #f5f5f5 100%);
  color: var(--main);
  box-shadow: 0 2px 12px rgba(30, 58, 95, 0.2);
  border: 3px solid var(--accent-light);
  pointer-events: none;
  opacity: 0.65;
}

/* 修正: 落下距離を固定px(530px)からコンテナ高さ基準(top:100%)に変更。
   全画面レイアウトでgame-areaの高さが可変になったため、
   どんな画面サイズでも枠の下端まで正しく落ちるようにする */
@keyframes oeh-fall{
  from{ top: -80px; }
  to{ top: 100%; }
}

.oeh-root .score-effect{
  position: absolute;
  font-size: 1.8rem;
  font-weight: bold;
  pointer-events: none;
  z-index: 1000;
  animation: oeh-scoreFloat 1s ease-out forwards;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
@keyframes oeh-scoreFloat{
  0%{ transform: translateY(0); opacity: 1; }
  100%{ transform: translateY(-60px); opacity: 0; }
}

/* ---------- 右下 縦型アイコンツールバー ---------- */
.oeh-root .oeh-toolbar{
  position: fixed; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 14px;
  z-index: 50;
}
.oeh-root .oeh-toolbar button{
  width: 54px; height: 54px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: #fff; color: var(--main);
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}
.oeh-root .oeh-toolbar button:hover:not(:disabled){ transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.oeh-root .oeh-toolbar button:active:not(:disabled){ transform: translateY(0); }
.oeh-root .oeh-toolbar button.oeh-primary{ background: var(--accent); color: var(--main-dark); }
.oeh-root .oeh-toolbar button:disabled{ opacity: .4; cursor: not-allowed; box-shadow: none; }

/* ---------- ゲームオーバー画面 ---------- */
.oeh-root .game-over{
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 30, 58, 0.9);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.oeh-root .game-over-content{
  background: var(--base);
  padding: 40px;
  border-radius: 24px;
  text-align: center;
  max-width: 520px; width: 90%;
  max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(30, 58, 95, 0.3);
  border-top: 4px solid var(--accent);
  border-bottom: 4px solid var(--accent);
  position: relative;
}
.oeh-root .close-gameover-btn{
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border: 2px solid var(--border);
  background: var(--base-light); color: var(--text);
  font-size: 1.5rem; font-weight: 900; border-radius: 50%;
  cursor: pointer; transition: all 0.3s ease;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.oeh-root .close-gameover-btn:hover{
  background: var(--main); color: var(--base);
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}
.oeh-root .game-over-title{
  font-size: 1.7rem; margin-bottom: 20px; font-weight: 900; color: var(--main);
}
.oeh-root .score-display{
  font-size: 2.6rem; margin: 20px 0; font-weight: 900;
  color: var(--main);
  padding: 14px 18px; border-radius: 16px;
  background: linear-gradient(135deg, #fff 0%, var(--base-dark) 100%);
  box-shadow: 0 10px 25px rgba(30, 58, 95, 0.18);
  text-align: center;
}
.oeh-root .game-stats{
  background: var(--base-light);
  padding: 20px; border-radius: 16px; margin: 20px 0;
  border: 2px solid var(--border);
}
.oeh-root .stat-row{
  display: flex; justify-content: space-between; margin: 10px 0;
  font-size: 1rem; color: var(--text);
}
.oeh-root .stat-label{ font-weight: 600; color: var(--text-light); }
.oeh-root .stat-value{ font-weight: 900; color: var(--main); }

.oeh-root .game-over-buttons{
  display: flex; flex-direction: column; gap: 12px; margin-top: 24px;
}
.oeh-root .game-over-buttons button{
  padding: 15px 30px; font-size: 1.1rem; border-radius: 50px;
  border: none; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.oeh-root .retry-btn{
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  color: var(--main-dark); font-weight: 900;
}
.oeh-root .retry-btn:hover{ background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); }
.oeh-root .settings-btn{
  background: linear-gradient(135deg, var(--main-light) 0%, var(--main) 100%);
  color: #ffffff; font-weight: 900;
}
.oeh-root .settings-btn:hover{ background: linear-gradient(135deg, var(--main) 0%, var(--main-dark) 100%); }

/* ---------- レスポンシブ対応 ---------- */
@media (max-width: 768px){
  .oeh-root .oeh-instruction{ display: none; }
  .oeh-root .oeh-title{ font-size: 15px; }
  .oeh-root .target-buttons{ grid-template-columns: 1fr; }
  .oeh-root .game-layout{ grid-template-columns: 70px 1fr 70px; }
  .oeh-root .number{ width: 56px; height: 56px; font-size: 1.4rem; }
}

@media (max-width: 480px){
  .oeh-root .difficulty-buttons{ grid-template-columns: 1fr 1fr; }
  .oeh-root .oeh-stat{ min-width: 44px; padding: 4px 8px; }
}
