/* ========== リセット & ベース ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --card-w:   80px;
  --card-h:   112px;
  --radius:   8px;
  --green-dark:  #145220;
  --green-mid:   #1e6e2e;
  --green-light: #2d8a43;
  --gold:   #f0c030;
  --gold2:  #c8840a;
  --red:    #e53e3e;
}

html, body {
  height: 100%;
  font-family: 'Hiragino Kaku Gothic Pro', 'Noto Sans JP', sans-serif;
  background:
    repeating-linear-gradient(
      30deg,
      rgba(0,0,0,0.025) 0px, rgba(0,0,0,0.025) 1px,
      transparent 1px, transparent 14px
    ),
    radial-gradient(ellipse at 30% 30%, #2d8a43 0%, #1a5c2a 60%, #145220 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: manipulation;
}

/* ========== ヘッダー ========== */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 8px;
}

#title {
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.05em;
  flex: 1;
  white-space: nowrap;
}

#progress {
  font-size: 13px;
  font-weight: bold;
  color: var(--gold);
  background: rgba(0,0,0,0.3);
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(240,192,48,0.35);
  white-space: nowrap;
}

#ranking-btn {
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background 0.15s;
}

#ranking-btn:active { background: rgba(255,255,255,0.25); }

#restart-confirm-btn {
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background 0.15s;
}

#restart-confirm-btn:active { background: rgba(255,255,255,0.25); }

/* ========== パイルエリア ========== */
#piles-area {
  padding: 8px 8px 4px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: 160px;
  min-height: 120px;
  -webkit-overflow-scrolling: touch;
}

#piles {
  display: flex;
  gap: 8px;
  width: max-content;
  min-width: 100%;
  justify-content: center;
  align-items: flex-start;
  padding-bottom: 4px;
}

/* ========== パイル共通 ========== */
.pile {
  width: var(--card-w);
  min-height: var(--card-h);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: none;
}

/* 空パイル（基礎カード待ち） */
.pile-empty {
  border-radius: var(--radius);
  border: 2px dashed rgba(255,255,255,0.28);
  background: rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.pile-empty.shake { border-color: var(--red) !important; }

.pile-placeholder {
  font-size: 32px;
  color: rgba(255,255,255,0.2);
  user-select: none;
}

/* コンプリートパイル */
.pile-completed {
  border-radius: var(--radius);
  border: 2px solid rgba(80, 220, 80, 0.6);
  background: linear-gradient(160deg, rgba(20,80,20,0.8) 0%, rgba(10,50,10,0.9) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 10px rgba(60, 200, 60, 0.25);
}

.pile-completed:active {
  border-color: rgba(120, 255, 120, 0.9);
}

.pile-complete-badge {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  user-select: none;
}

.pcb-check {
  font-size: 26px;
  line-height: 1;
  color: #7fff7f;
  text-shadow: 0 0 8px rgba(100, 255, 100, 0.7);
}

.pcb-category {
  font-size: 10px;
  font-weight: 900;
  color: rgba(180, 255, 180, 0.95);
  letter-spacing: 0.03em;
}

.pcb-label {
  font-size: 9px;
  color: rgba(100, 220, 100, 0.75);
  letter-spacing: 0.12em;
  font-weight: 700;
}

@keyframes pileFlashComplete {
  0%   { box-shadow: 0 0 0 0 rgba(100, 255, 100, 0.9), 0 0 10px rgba(60,200,60,0.25); }
  40%  { box-shadow: 0 0 0 18px rgba(100, 255, 100, 0.0), 0 0 10px rgba(60,200,60,0.25); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 rgba(100, 255, 100, 0), 0 0 10px rgba(60,200,60,0.25); transform: scale(1); }
}

.pile-flash-complete {
  animation: pileFlashComplete 0.55s ease-out;
}

/* 基礎カード配置済みパイル */
.pile-founded {
  border-radius: var(--radius);
}

/* カテゴリヘッダー */
.pile-category-header {
  width: 100%;
  height: 26px;
  background: linear-gradient(135deg, var(--gold2) 0%, #f0a800 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.pch-name  { font-size: 10px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.pch-count { font-size: 9px;  color: rgba(255,255,255,0.85); }

/* 基礎カードあり・通常カードなし の待機スロット */
.pile-waiting {
  position: absolute;
  width: 100%;
  height: var(--card-h);
  border: 2px dashed rgba(240,168,0,0.4);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(240,168,0,0.05);
}

/* ========== パイル内カード ========== */
.pile-card {
  position: absolute;
  width: 100%;
  height: var(--card-h);
  border-radius: var(--radius);
  left: 0;
}

/* 裏面カード */
.pile-card-back {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.045) 0px, rgba(255,255,255,0.045) 1px,
      transparent 1px, transparent 9px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0.045) 0px, rgba(255,255,255,0.045) 1px,
      transparent 1px, transparent 9px
    ),
    linear-gradient(150deg, #1e3a6e 0%, #162d58 50%, #1a3264 100%);
  border: 1.5px solid #0c1e3e;
  box-shadow: 0 2px 5px rgba(0,0,0,0.45);
}

.pile-card-back::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: calc(var(--radius) - 3px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* 表面カード（最前列） */
.pile-card-face {
  background: linear-gradient(160deg, #fffef8 0%, #f5f0de 60%, #ede5c0 100%);
  border: 1.5px solid #c8b87a;
  box-shadow: 0 6px 16px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
}

/* 表面カードの緑ヘッダー（正解確定を表す） */
.pile-card-face::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26px;
  background: linear-gradient(135deg, #2d8a43 0%, #1a5c2a 100%);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.pile-card-face::after {
  content: '✓';
  position: absolute;
  top: 4px; right: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
}

.pc-word {
  position: relative;
  font-size: 13px;
  font-weight: 900;
  color: #1a1008;
  letter-spacing: 0.02em;
  margin-top: 8px;
  text-align: center;
  padding: 0 4px;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  width: 100%;
}

.pc-meaning {
  position: relative;
  font-size: 11px;
  font-weight: bold;
  color: #8a6000;
  background: rgba(240,192,48,0.18);
  padding: 1px 6px;
  border-radius: 8px;
}

.pc-count {
  position: relative;
  font-size: 9px;
  color: rgba(26,16,8,0.4);
}

/* ========== シェイクアニメーション ========== */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

.shake { animation: shake 0.4s ease; }
.shake .pile-card-face {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px var(--red) !important;
}
.pile-founded.shake .pile-category-header { background: var(--red); }

/* ========== ヒントバー ========== */
#hint-bar {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  padding: 4px 12px 3px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

/* ========== 手札エリア（Klondikeタブロー） ========== */
#hand-area {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 4px;
  min-height: 180px;
}

#hand {
  display: flex;
  gap: 8px;
  width: max-content;
  min-width: 100%;
  justify-content: center;
  align-items: flex-start;
  padding-bottom: 4px;
}

/* ========== タブロー列 ========== */
.hand-col {
  width: var(--card-w);
  position: relative;
  flex-shrink: 0;
  touch-action: none;
}

.hand-col-empty {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.08);
}

/* ========== 裏向きカード（列内） ========== */
.hand-card-back {
  position: absolute;
  width: 100%;
  height: var(--card-h);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.045) 0px, rgba(255,255,255,0.045) 1px,
      transparent 1px, transparent 9px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0.045) 0px, rgba(255,255,255,0.045) 1px,
      transparent 1px, transparent 9px
    ),
    linear-gradient(150deg, #1e3a6e 0%, #162d58 50%, #1a3264 100%);
  border: 1.5px solid #0c1e3e;
  box-shadow: 0 2px 5px rgba(0,0,0,0.45);
}

.hand-card-back::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: calc(var(--radius) - 3px);
  border: 1px solid rgba(255,255,255,0.09);
}

/* ========== 表向きカード（列内・捨て札共通） ========== */
.hand-card-face,
.waste-card {
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fffef8 0%, #f5f0de 60%, #ede5c0 100%);
  border: 1.5px solid #c8b87a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.38);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 0.14s, box-shadow 0.14s;
}

.hand-card-face {
  position: absolute;
  width: 100%;
  height: var(--card-h);
}

.waste-card {
  position: relative;
  width: 100%;
  height: 100%;
}

/* 青ヘッダー */
.hand-card-face::before,
.waste-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26px;
  background: linear-gradient(135deg, #2558a0 0%, #1a3d7a 100%);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.hand-card-face::after,
.waste-card::after {
  content: '♦';
  position: absolute;
  bottom: 5px; right: 6px;
  font-size: 10px;
  color: rgba(180,150,80,0.3);
}

/* 選択状態 */
.hand-card-face.selected,
.waste-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 8px 20px rgba(0,0,0,0.5);
  transform: translateY(-5px) scale(1.03);
  z-index: 10;
}

/* 基礎カード（金色） */
.hand-card-face.foundation-face,
.waste-card.foundation-face {
  background: linear-gradient(160deg, #fffce0 0%, #ffe080 50%, #f5a000 100%);
  border-color: var(--gold2);
}
.hand-card-face.foundation-face::before,
.waste-card.foundation-face::before {
  background: linear-gradient(135deg, var(--gold2) 0%, #a06000 100%);
}
.hand-card-face.foundation-face::after,
.waste-card.foundation-face::after { content: ''; }

/* 奥の表カード：青いヘッダー部分に単語を白文字で表示 */
.hand-card-peek .hcf-word {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  line-height: 26px;
  margin-top: 0;
  padding: 0 8px;
  color: rgba(255,255,255,0.92);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  z-index: 2;
}

/* 単語・意味テキスト */
.hcf-word {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 900;
  color: #1a1008;
  text-align: center;
  padding: 0 4px;
  margin-top: 8px;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  width: 100%;
}

/* 日本語訳（合体 or 配置後のみ表示） */
.hcf-meaning {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: bold;
  color: #8a6000;
  background: rgba(240,192,48,0.22);
  padding: 1px 7px;
  border-radius: 8px;
  animation: reveal-pop 0.2s ease;
}

@keyframes reveal-pop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ========== 基礎カード（手札）共通パーツ ========== */
.fhc-crown {
  position: relative;
  z-index: 1;
  font-size: 18px;
  margin-top: 10px;
}

.fhc-category {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 900;
  color: #5a3000;
  text-align: center;
  padding: 0 4px;
  line-height: 1.2;
}

/* ========== 下部バー ========== */
#bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 8px 16px 14px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* 捨て札 + 山札エリア */
#stock-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

/* 捨て札スロット */
#waste-slot {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--radius);
  border: 2px dashed rgba(255,255,255,0.12);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.waste-placeholder {
  font-size: 11px;
  color: rgba(255,255,255,0.22);
  text-align: center;
  line-height: 1.4;
}

/* 山札補充ボタン表示 */
.deck-recycle {
  width: 52px;
  height: 72px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  border: 2px dashed rgba(255,255,255,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: rgba(255,255,255,0.5);
}

#undo-btn {
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
  touch-action: manipulation;
}

#undo-btn:active  { background: rgba(255,255,255,0.22); }
#undo-btn:disabled { opacity: 0.3; cursor: default; }

/* ========== 山札ウィジェット ========== */
#deck-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.deck-back-card {
  width: 52px;
  height: 72px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.045) 0px, rgba(255,255,255,0.045) 1px,
      transparent 1px, transparent 9px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0.045) 0px, rgba(255,255,255,0.045) 1px,
      transparent 1px, transparent 9px
    ),
    linear-gradient(150deg, #1e3a6e 0%, #162d58 50%, #1a3264 100%);
  border: 1.5px solid #0c1e3e;
  box-shadow: 0 2px 5px rgba(0,0,0,0.45);
}

.deck-count-label {
  font-size: 11px;
  font-weight: bold;
  color: rgba(255,255,255,0.7);
  text-align: center;
  line-height: 1.3;
}

.deck-empty-label {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  line-height: 1.4;
}

/* ========== ドラッグゴースト ========== */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fffef8 0%, #f5f0de 60%, #ede5c0 100%);
  border: 2px solid var(--gold);
  box-shadow: 0 12px 30px rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0.92;
  transform: rotate(3deg) scale(1.05);
  will-change: left, top;
}

.drag-ghost::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26px;
  background: linear-gradient(135deg, #2558a0 0%, #1a3d7a 100%);
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
}

.drag-ghost-word {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 900;
  color: #1a1008;
  margin-top: 8px;
}

/* 基礎カードのドラッグゴースト */
.foundation-drag-ghost {
  background: linear-gradient(160deg, #fffce0 0%, #ffe080 50%, #f5a000 100%);
  border-color: var(--gold2);
}

.foundation-drag-ghost::before {
  background: linear-gradient(135deg, var(--gold2) 0%, #a06000 100%);
}

/* ========== モードバッジ ========== */
#mode-badge {
  font-size: 10px;
  font-weight: bold;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ========== モーダル共通 ========== */
#clear-modal,
#confirm-modal,
#mode-modal,
#ranking-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(5px);
}

#clear-modal.hidden,
#confirm-modal.hidden,
#mode-modal.hidden,
#ranking-modal.hidden { display: none; }

/* 確認モーダルのボタン群 */
.confirm-btns {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

#confirm-yes {
  flex: 1;
  background: linear-gradient(135deg, var(--red) 0%, #b02020 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
}

#confirm-no {
  flex: 1;
  background: rgba(0,0,0,0.12);
  color: #444;
  border: 1.5px solid rgba(0,0,0,0.18);
  border-radius: 50px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
}

#confirm-yes:active { opacity: 0.8; }
#confirm-no:active  { background: rgba(0,0,0,0.2); }

.modal-box {
  background: linear-gradient(160deg, #fffef8 0%, #f5f0de 100%);
  color: #222;
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  max-width: 300px;
  width: 88%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  border: 2px solid var(--gold);
}

.clear-icon { font-size: 56px; margin-bottom: 12px; }

.modal-box h2 {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 12px;
  color: var(--green-dark);
}

.modal-box p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 24px;
  color: #444;
}

#restart-btn {
  background: linear-gradient(135deg, var(--green-mid) 0%, var(--green-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 32px;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  touch-action: manipulation;
}

#restart-btn:active { opacity: 0.8; }

/* ========== クリアモーダル スコア表示 ========== */
.modal-box-wide {
  max-width: 340px;
  max-height: 90vh;
  overflow-y: auto;
}

.score-main {
  margin: 8px 0 6px;
}

.score-best-label {
  font-size: 11px;
  font-weight: 900;
  color: #c47f00;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.score-pts {
  font-size: 38px;
  font-weight: 900;
  color: #1a5c2a;
  line-height: 1.1;
}

.score-unit {
  font-size: 18px;
  font-weight: bold;
  margin-left: 4px;
  color: #2d8a43;
}

.score-new-best .score-pts {
  color: #c47f00;
}

.score-breakdown {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 6px 0 14px;
  font-size: 13px;
  color: #555;
}

.sb-label {
  display: block;
  font-size: 10px;
  color: #888;
  margin-bottom: 1px;
}

.sb-val {
  font-weight: bold;
  color: #222;
}

.sr-title {
  font-size: 13px;
  font-weight: 900;
  color: #444;
  margin-bottom: 6px;
  text-align: left;
  padding-left: 4px;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}

.ranking-table thead th {
  font-size: 10px;
  color: #888;
  border-bottom: 1px solid #ddd;
  padding: 3px 4px;
  text-align: center;
}

.ranking-table tbody td {
  padding: 4px 4px;
  text-align: center;
  border-bottom: 1px solid #eee;
  color: #333;
}

.ranking-table tbody tr:first-child td {
  background: rgba(255, 215, 0, 0.12);
}

.ranking-empty {
  font-size: 13px;
  color: #aaa;
  padding: 16px 0;
  text-align: center;
}

/* ========== ランキングモーダル ========== */
.ranking-tabs {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
  justify-content: center;
}

.rtab {
  background: rgba(0,0,0,0.05);
  border: 1.5px solid #ccc;
  color: #555;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s;
}

.rtab-active {
  background: linear-gradient(135deg, var(--green-mid) 0%, var(--green-dark) 100%);
  border-color: var(--green-dark);
  color: #fff;
}

#ranking-close-btn {
  background: rgba(0,0,0,0.08);
  border: 1.5px solid #ccc;
  color: #444;
  border-radius: 50px;
  padding: 10px 28px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  touch-action: manipulation;
  margin-top: 4px;
}

#ranking-close-btn:active { opacity: 0.7; }

/* ========== モード選択 ========== */
.mode-modal-box {
  max-width: 320px;
}

.mode-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.mode-btns button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s, opacity 0.1s;
}

.mode-btns button:active { transform: scale(0.97); opacity: 0.85; }

.mode-btns button[data-mode="easy"] {
  background: linear-gradient(135deg, #2d8a43 0%, #1a5c2a 100%);
  color: #fff;
}

.mode-btns button[data-mode="normal"] {
  background: linear-gradient(135deg, #2558a0 0%, #1a3d7a 100%);
  color: #fff;
}

.mode-btns button[data-mode="hard"] {
  background: linear-gradient(135deg, #8a2020 0%, #5a1010 100%);
  color: #fff;
}

.mode-label {
  font-size: 17px;
  font-weight: 900;
}

.mode-desc {
  font-size: 12px;
  opacity: 0.8;
}
