@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700&display=swap');

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

/* 画像の保存・持ち出し防止(JS側のcontextmenu/dragstart禁止と合わせて) */
img {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}

:root {
  --bg-dark: #09060e;
  --bg-panel: rgba(18, 13, 26, 0.85);
  --accent-gold: #d4a359;
  --accent-gold-glow: rgba(212, 163, 89, 0.4);
  --text-white: rgba(255, 255, 255, 0.92);
  --text-dim: rgba(255, 255, 255, 0.55);
  --border-gold: rgba(212, 163, 89, 0.25);
  --border-gold-active: rgba(212, 163, 89, 0.75);
  --border-opponent: rgba(255, 122, 60, 0.45);
  --border-opponent-active: rgba(255, 122, 60, 0.85);
  --border-player: rgba(178, 95, 214, 0.45);
  --border-player-active: rgba(178, 95, 214, 0.85);
  --cat-position: #5b8def;
  --cat-act: #e0577f;
  --cat-tempo: #3ec6c6;
  --cat-item: #6fbf73;
  --cat-location: #d4a75b;
  --font-serif: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
}

html, body {
  width: 100%; min-height: 100%;
  background: var(--bg-dark);
  color: var(--text-white);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.btn {
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 0.05em;
  color: var(--text-white);
  background: rgba(9,6,14,0.6);
  border: 1px solid var(--border-gold);
  border-radius: 3px;
  padding: 13px 30px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
.btn:hover { border-color: var(--border-gold-active); background: rgba(212,163,89,0.12); }
.btn:active { transform: scale(0.98); }
.btn-primary { border-color: var(--accent-gold); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-secondary { color: var(--text-dim); }

.ctrl-btn {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-white);
  background: rgba(9,6,14,0.6);
  border: 1px solid var(--border-gold);
  border-radius: 3px;
  padding: 8px 16px;
  cursor: pointer;
}
.ctrl-btn:hover { border-color: var(--border-gold-active); }

/* ── タイトル画面 ── */
#title-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(rgba(9,6,14,0.75), rgba(9,6,14,0.9)),
    url("../assets/images/ui/bg_title.png") center / cover no-repeat,
    radial-gradient(ellipse at center, #140d1e 0%, var(--bg-dark) 70%);
}
#title-inner { text-align: center; max-width: 520px; padding: 40px 24px; }
.deco { color: var(--accent-gold); font-size: 28px; display: block; margin-bottom: 12px; }
#title-inner h1 { font-size: 34px; letter-spacing: 0.08em; margin-bottom: 8px; }
.tagline { color: var(--accent-gold); font-size: 14px; letter-spacing: 0.15em; margin-bottom: 24px; }
.desc { color: var(--text-dim); font-size: 14px; line-height: 2; margin-bottom: 32px; }
#stats-display { color: var(--accent-gold); font-size: 12px; letter-spacing: 0.05em; margin-bottom: 16px; min-height: 1em; }
#title-inner .btn { display: block; width: 100%; margin-bottom: 12px; }

/* ── ドラフト / デッキ公開画面 ── */
#draft-screen, #reveal-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-dark);
  padding: 30px 16px;
}
#draft-inner, #reveal-inner { max-width: 760px; width: 100%; text-align: center; }
#draft-inner h2, #reveal-inner h2 { font-size: 20px; letter-spacing: 0.1em; color: var(--accent-gold); margin-bottom: 10px; }
.draft-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 12px; }
.draft-rules {
  text-align: left; font-size: 12px; color: var(--text-dim);
  border: 1px solid var(--border-gold); border-radius: 4px;
  padding: 8px 14px; margin-bottom: 20px;
}
.draft-rules summary {
  cursor: pointer; color: var(--accent-gold); font-size: 13px;
  letter-spacing: 0.05em; padding: 4px 0; list-style: none;
}
.draft-rules summary::-webkit-details-marker { display: none; }
.draft-rules summary::before { content: "▸ "; }
.draft-rules[open] summary::before { content: "▾ "; }
.draft-rules p { padding-top: 8px; line-height: 1.9; }

.draft-rules-section { margin-top: 12px; }
.draft-rules-section:first-of-type { margin-top: 8px; }
.draft-rules-heading {
  color: var(--accent-gold); font-size: 12px; font-weight: 700;
  letter-spacing: 0.03em; margin-bottom: 3px;
}
.draft-rules-section p { padding-top: 0; margin: 0; }
.draft-rules ul { list-style: none; margin: 0; padding: 0; }
.draft-rules li { line-height: 1.8; padding-left: 1.1em; text-indent: -1.1em; }
.draft-rules li::before { content: "・"; }

/* カード種類アイコン(カードチップのカテゴリバッジと同じ画像を流用) */
.rules-cat-icon {
  display: inline-block;
  width: 15px; height: 15px;
  border-radius: 50%;
  background-color: rgba(9,6,14,0.75);
  background-size: 95%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25) inset;
  vertical-align: -3px;
  margin-right: 4px;
  text-indent: 0;
}
.rules-cat-icon-position { background-image: url("../assets/images/ui/icon_position.png"); }
.rules-cat-icon-act      { background-image: url("../assets/images/ui/icon_act.png"); }
.rules-cat-icon-tempo    { background-image: url("../assets/images/ui/icon_tempo.png"); }
.rules-cat-icon-location { background-image: url("../assets/images/ui/icon_location.png"); }
.rules-cat-icon-item     { background-image: url("../assets/images/ui/icon_item.png"); }

/* 場所カードが強化するカテゴリーの対応関係 */
.rules-relation-from { color: var(--text-white); }
.rules-relation-arrow { color: var(--accent-gold); margin: 0 6px; }
#draft-teaser {
  color: var(--accent-gold); font-size: 13px; font-style: italic;
  margin-bottom: 10px; letter-spacing: 0.03em;
}
#draft-teaser:empty { display: none; }
#draft-milestone {
  color: var(--accent-gold); font-size: 12px; margin-bottom: 14px;
  border: 1px solid var(--border-gold); border-radius: 4px; padding: 8px 14px;
  background: rgba(212,163,89,0.08);
}
#draft-count { color: var(--accent-gold); font-weight: 700; }
#draft-hint {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px;
  font-size: 12px; color: var(--text-dim);
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  padding: 10px 16px;
  margin-bottom: 16px;
}
#draft-hint b { color: var(--accent-gold); }
#draft-hint .tone-chip {
  display: inline-block; padding: 1px 7px; border-radius: 10px; margin-left: 3px;
  border: 1px solid var(--border-gold);
}
#draft-hint .tone-chip.covered { color: var(--accent-gold); border-color: var(--accent-gold); }
#draft-pool { flex-wrap: wrap; justify-content: center; margin-bottom: 24px; }
.deck-reveal-group { margin-bottom: 22px; }

/* ── ゲーム画面 ── */
#game-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
#game-screen > * { width: 100%; max-width: 760px; }

#game-header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-gold);
}
#gauges { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.gauge-row { display: flex; align-items: center; gap: 10px; }
.gauge-name { font-size: 11px; color: var(--text-dim); letter-spacing: 0.1em; width: 34px; flex: none; }
.gauge-track {
  flex: 1; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.gauge-fill {
  height: 100%; width: 0%;
  transition: width 0.4s ease;
}
.gauge-fill-opponent {
  background: linear-gradient(90deg, var(--accent-gold), #ff7a3c);
  box-shadow: 0 0 8px var(--accent-gold-glow);
}
.gauge-fill-player {
  background: linear-gradient(90deg, #6a7fbf, #b25fd6);
  box-shadow: 0 0 8px rgba(178, 95, 214, 0.4);
}
#turn-counter { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
#streak-badge {
  font-size: 11px; color: var(--accent-gold); white-space: nowrap;
  border: 1px solid var(--border-gold); border-radius: 10px; padding: 2px 9px;
}
#streak-badge:empty { display: none; }

#state-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-gold);
}
.state-card { display: flex; align-items: center; gap: 8px; }
.state-card-label {
  font-size: 10px; color: var(--text-dim); letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 4px;
}
.state-card-label::before {
  content: "";
  width: 12px; height: 12px;
  background-image: url("../assets/images/ui/icon_desire.png");
  background-size: cover; background-position: center;
  border-radius: 50%;
  opacity: 0.85;
}
#state-player .state-card-label { flex-direction: row-reverse; }
.state-card-thumb-wrap {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--border-gold-active);
  background: url("../assets/images/ui/card_back.png") center / cover no-repeat;
  flex: none;
}
.state-card-thumb { width: 100%; height: 100%; object-fit: cover; }
.state-card-name { font-size: 13px; color: var(--accent-gold); }
.state-card-name.state-card-name-hint {
  font-size: 14px; color: var(--text-dim); font-style: italic;
  max-width: 190px; line-height: 1.6;
}
#state-player { flex-direction: row-reverse; text-align: right; }

/* 舞台効果(場所カードの永続バフ)表示 */
#stage-indicator {
  font-size: 11px; color: var(--accent-gold); text-align: center;
  padding: 6px 20px; background: rgba(212,163,89,0.08);
  border-bottom: 1px solid var(--border-gold); letter-spacing: 0.03em;
}

/* 相手デッキとあなたの手札の間に挟むメッセージ欄(テキストのみ。カード画像はライトボックスで表示) */
#narration-box {
  padding: 16px 24px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-gold);
  border-bottom: 1px solid var(--border-gold);
  min-height: 60px;
  display: flex; align-items: center; justify-content: center;
}
#narration-text { font-size: 15px; line-height: 1.9; text-align: center; }

#hand-area { padding: 12px 16px; }
.hand-group { margin-bottom: 10px; }
.hand-label {
  font-size: 12px; color: var(--accent-gold); letter-spacing: 0.1em; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.hand-label::before {
  content: "";
  width: 18px; height: 18px;
  background-size: cover;
  background-position: center;
  border-radius: 50%;
  opacity: 0.9;
}
#group-position .hand-label::before { background-image: url("../assets/images/ui/icon_position.png"); }
#group-act .hand-label::before      { background-image: url("../assets/images/ui/icon_act.png"); }
#group-tempo .hand-label::before    { background-image: url("../assets/images/ui/icon_tempo.png"); }
#group-location .hand-label::before { background-image: url("../assets/images/ui/icon_location.png"); }
#group-item .hand-label::before     { background-image: url("../assets/images/ui/icon_item.png"); }
.hand-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; justify-content: center; }

.card-chip {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.1s;
}
.card-chip-rare-badge {
  position: absolute;
  top: 4px; right: 4px;
  z-index: 2;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  color: #2a1505;
  background: radial-gradient(circle at 35% 30%, #ffe6ad, var(--accent-gold) 70%);
  box-shadow: 0 0 6px var(--accent-gold-glow), 0 0 0 1px rgba(255,255,255,0.4) inset;
}
.deck-group .card-chip-rare-badge,
.deck-reveal-group .card-chip-rare-badge {
  width: 22px; height: 22px;
  font-size: 12px;
}

/* ── ドラフト画面/駆け引き画面: 初心者向けヒントモード(推奨カード) ── */
#hint-mode-row, #battle-hint-mode-row {
  text-align: center; font-size: 12px; color: var(--text-dim);
  margin-bottom: 14px;
}
#hint-mode-row label, #battle-hint-mode-row label { cursor: pointer; }
#hint-mode-row input, #battle-hint-mode-row input { vertical-align: middle; margin-right: 6px; }

.card-chip.card-chip-recommended {
  border-color: #6fbf73;
  box-shadow: 0 0 8px rgba(111, 191, 115, 0.45);
}
.card-chip-recommend-badge {
  position: absolute;
  bottom: 4px; left: 4px;
  z-index: 2;
  font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 8px;
  background: rgba(111, 191, 115, 0.9);
  color: #06210a;
  letter-spacing: 0.02em;
}

/* カード属性(体位/行為/緩急/アイテム)を一目で区別するバッジと枠色 */
.card-chip-cat-badge {
  position: absolute;
  top: 4px; left: 4px;
  z-index: 2;
  width: 16px; height: 16px;
  border-radius: 50%;
  background-color: rgba(9,6,14,0.75);
  background-size: 95%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25) inset;
}
.card-chip-cat-badge-position { background-image: url("../assets/images/ui/icon_position.png"); }
.card-chip-cat-badge-act      { background-image: url("../assets/images/ui/icon_act.png"); }
.card-chip-cat-badge-tempo    { background-image: url("../assets/images/ui/icon_tempo.png"); }
.card-chip-cat-badge-location { background-image: url("../assets/images/ui/icon_location.png"); }
.card-chip-cat-badge-item     { background-image: url("../assets/images/ui/icon_item.png"); }
.card-chip-cat-badge-desire   { background-image: url("../assets/images/ui/icon_desire.png"); }

.card-chip-cat-position { border-color: var(--cat-position); }
.card-chip-cat-act      { border-color: var(--cat-act); }
.card-chip-cat-tempo    { border-color: var(--cat-tempo); }
.card-chip-cat-item     { border-color: var(--cat-item); }
.card-chip-cat-location { border-color: var(--cat-location); }
.card-chip:hover { border-color: var(--border-gold-active); transform: translateY(-2px); }
/* 選択済みは場所カード(金系統)の枠色と紛れるため、カテゴリ色と重ならない紫+チェックマークで明示する */
.card-chip.selected {
  border-color: var(--border-player-active);
  border-width: 2px;
  box-shadow: 0 0 10px rgba(178, 95, 214, 0.55);
}
.card-chip-selected-badge {
  position: absolute;
  bottom: 4px; right: 4px;
  z-index: 2;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
  background: var(--border-player-active);
  box-shadow: 0 0 6px rgba(178, 95, 214, 0.6);
}
#hand-opponent-deck .card-chip { cursor: zoom-in; }

/* 自分(紫)/彼女(橙)のカード枠を色分けして識別しやすくする */
#hand-opponent-deck .card-chip,
#reveal-opponent-deck .card-chip {
  border-color: var(--border-opponent);
}
#hand-opponent-deck .card-chip:hover,
#reveal-opponent-deck .card-chip:hover {
  border-color: var(--border-opponent-active);
}
#hand-player-deck .card-chip,
#reveal-player-deck .card-chip {
  border-color: var(--border-player);
}
#hand-player-deck .card-chip:hover,
#reveal-player-deck .card-chip:hover {
  border-color: var(--border-player-active);
}
#hand-player-deck .card-chip.selected,
#reveal-player-deck .card-chip.selected {
  border-color: var(--accent-gold);
}

/* 未選択時: 「カードを選べ」という促しとして自分の手札枠を明滅させる */
.card-chip.prompt-select {
  animation: prompt-select-pulse 1.6s ease-in-out infinite;
}
@keyframes prompt-select-pulse {
  0%, 100% {
    border-color: var(--border-player);
    box-shadow: none;
  }
  50% {
    border-color: var(--border-player-active);
    box-shadow: 0 0 10px rgba(178, 95, 214, 0.55);
  }
}
@media (prefers-reduced-motion: reduce) {
  .card-chip.prompt-select { animation: none; border-color: var(--border-player-active); }
}
.card-chip-thumb {
  width: 100%; height: 96px;
  object-fit: cover;
  display: block;
  background: #14101c;
}
.card-chip-thumb-placeholder {
  width: 100%; height: 96px;
  display: flex; align-items: center; justify-content: center;
  background: #14101c url("../assets/images/ui/card_back.png") center / cover no-repeat;
  color: var(--text-dim);
  font-size: 10px;
  text-shadow: 0 0 6px #000;
}
.card-chip-name {
  font-size: 11px;
  text-align: center;
  padding: 5px 4px 2px;
  line-height: 1.3;
  color: var(--text-white);
}
.card-chip-stats {
  font-size: 10px;
  text-align: center;
  padding: 0 4px 6px;
  color: var(--accent-gold);
  letter-spacing: 0.02em;
}

/* デッキ公開画面: カードが1枚ずつめくれるように登場する演出 */
/* 8枚デッキは横一列に収まらないため、横スクロールではなく折り返し表示にする */
.deck-reveal-group .hand-row {
  perspective: 900px;
  flex-wrap: wrap;
  overflow-x: visible;
}
.card-reveal-in {
  opacity: 0;
  backface-visibility: hidden;
  animation: card-flip-in 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes card-flip-in {
  0% {
    opacity: 0;
    transform: rotateY(-95deg) translateY(6px) scale(0.92);
  }
  60% {
    opacity: 1;
    box-shadow: 0 0 16px var(--accent-gold-glow);
  }
  100% {
    opacity: 1;
    transform: rotateY(0deg) translateY(0) scale(1);
    box-shadow: none;
  }
}
#reveal-confirm-btn {
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#reveal-confirm-btn.reveal-btn-hidden {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .card-reveal-in { animation: none; opacity: 1; }
  #reveal-confirm-btn.reveal-btn-hidden { opacity: 1; transform: none; pointer-events: auto; }
}

/* デッキ表示(相手のデッキ・デッキ公開画面)は大きめに表示(5枚×gapが760px枠に収まる幅) */
.deck-group .card-chip,
.deck-reveal-group .card-chip {
  width: 128px;
}
.deck-group .card-chip-thumb,
.deck-reveal-group .card-chip-thumb,
.deck-group .card-chip-thumb-placeholder,
.deck-reveal-group .card-chip-thumb-placeholder {
  height: 128px;
}
.deck-group .card-chip-name,
.deck-reveal-group .card-chip-name {
  font-size: 13px;
}
.deck-group .card-chip-stats,
.deck-reveal-group .card-chip-stats {
  font-size: 11px;
}

#turn-controls { padding: 12px 20px 24px; text-align: center; }

/* ── エンディング画面 ── */
#ending-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-dark);
}
#ending-inner { max-width: 560px; width: 92vw; text-align: center; padding: 24px; }
#ending-inner h2 { font-size: 20px; letter-spacing: 0.1em; margin-bottom: 20px; color: var(--accent-gold); }
#ending-image { max-width: 100%; max-height: 50vh; object-fit: contain; margin-bottom: 20px; border: 1px solid var(--border-gold); }
#ending-placeholder {
  color: var(--text-white); font-size: 14px; border: 1px solid var(--border-gold);
  padding: 60px 20px; margin-bottom: 20px;
  background:
    linear-gradient(rgba(5,3,8,0.6), rgba(5,3,8,0.6)),
    url("../assets/images/ui/card_back.png") center / cover no-repeat;
  text-shadow: 0 0 8px #000, 0 0 4px #000;
  white-space: pre-line;
}
#ending-text { font-size: 15px; line-height: 1.9; margin-bottom: 16px; }
#ending-reveal {
  font-size: 13px; color: var(--text-dim); line-height: 1.8;
  border-top: 1px solid var(--border-gold); padding-top: 16px; margin-bottom: 24px;
}
#ending-inner .btn { margin: 6px; }
#ending-result {
  font-size: 22px; letter-spacing: 0.15em; margin-bottom: 10px; font-weight: 700;
}
#ending-result.result-win { color: var(--accent-gold); }
#ending-result.result-lose { color: #b25fd6; }
#ending-result.result-draw { color: #e8c37a; }
#ending-rank {
  font-size: 13px; color: var(--text-dim); letter-spacing: 0.1em; margin-bottom: 16px;
}
#ending-rank .rank-value { color: var(--accent-gold); font-size: 18px; font-weight: 700; }
#ending-girl-type { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }
#ending-streak { font-size: 13px; color: var(--accent-gold); margin-bottom: 12px; }

/* ── ギャラリー ── */
#gallery-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
}
#gallery-panel {
  width: 92vw; max-width: 900px; height: 82vh;
  background: var(--bg-dark);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
#gallery-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-gold);
}
#gallery-title { font-size: 15px; letter-spacing: 0.08em; }
#gallery-progress { flex: 1; font-size: 12px; color: var(--text-dim); }
#gallery-tabs { display: flex; gap: 6px; padding: 10px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--border-gold); }
.gallery-tab {
  font-size: 12px; padding: 6px 12px; border: 1px solid var(--border-gold); border-radius: 12px;
  cursor: pointer; color: var(--text-dim);
}
.gallery-tab.active { color: var(--accent-gold); border-color: var(--accent-gold); }
#gallery-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 120px));
  justify-content: center;
  gap: 10px; padding: 16px 18px;
}
.gallery-cell {
  border: 1px solid var(--border-gold); border-radius: 4px; overflow: hidden; cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  height: 206px; /* overflow:hidden の要素はグリッド行の自動サイズ計算で中身の高さが無視されるため明示指定 */
}
.gallery-cell:hover { border-color: var(--border-gold-active); transform: translateY(-2px); }
.gallery-cell img { width: 100%; height: 180px; object-fit: cover; display: block; }
.gallery-cell-locked {
  width: 100%; height: 180px; display: flex; align-items: center; justify-content: center;
  background: #14101c url("../assets/images/ui/card_back.png") center / cover no-repeat;
  color: var(--text-dim); font-size: 22px; text-shadow: 0 0 6px #000;
}
.gallery-cell-name { font-size: 10px; text-align: center; padding: 4px; color: var(--text-dim); }

/* ── カード拡大表示(ライトボックス) ── */
#card-lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#card-lightbox-inner { max-width: 420px; width: 100%; text-align: center; }
#card-lightbox-img { width: 100%; max-height: 68vh; object-fit: contain; border: 1px solid var(--border-gold); margin-bottom: 16px; }
#card-lightbox-info { margin-bottom: 18px; }
#card-lightbox-name { font-size: 17px; color: var(--accent-gold); letter-spacing: 0.05em; margin-bottom: 6px; }
#card-lightbox-meta { font-size: 12px; color: var(--text-dim); }

/* ターン結果演出(両者のカードを並べて優劣を示す) */
#turn-result-overlay {
  position: fixed; inset: 0; z-index: 65;
  background: #06040a;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#turn-result-inner { max-width: 720px; width: 100%; text-align: center; }
#turn-result-vs {
  display: flex; align-items: center; justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}
.turn-result-side {
  flex: 1 1 0;
  min-width: 0;
  max-width: 280px;
  opacity: 0;
  transform: scale(0.85);
  animation: turn-side-in 0.4s ease-out forwards;
  transition: flex-grow 0.5s cubic-bezier(0.3, 0.7, 0.3, 1),
              max-width 0.5s cubic-bezier(0.3, 0.7, 0.3, 1),
              opacity 0.4s ease, filter 0.4s ease;
}
#turn-result-opponent-side { animation-delay: 0.05s; }
#turn-result-player-side { animation-delay: 0.2s; }
@keyframes turn-side-in {
  to { opacity: 1; transform: scale(1); }
}
.turn-result-side-label { font-size: 12px; color: var(--text-dim); letter-spacing: 0.08em; margin-bottom: 6px; }
.turn-result-card-wrap {
  position: relative;
  border: 2px solid var(--border-gold);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 弱点的中(会心)カットイン */
.turn-result-side.turn-result-critical .turn-result-card-wrap {
  animation: turn-critical-flash 0.6s ease-out;
}
.turn-result-side.turn-result-critical .turn-result-card-wrap::after {
  content: "会心";
  position: absolute; top: 6px; left: 6px; z-index: 3;
  background: var(--accent-gold); color: #2a1505;
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px;
  box-shadow: 0 0 8px var(--accent-gold-glow);
}
@keyframes turn-critical-flash {
  0% { box-shadow: 0 0 0 rgba(255,255,255,0); transform: scale(1); }
  30% { box-shadow: 0 0 32px 8px rgba(255,255,255,0.85); transform: scale(1.07); }
  100% { box-shadow: 0 0 18px var(--accent-gold-glow); transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .turn-result-side.turn-result-critical .turn-result-card-wrap { animation: none; }
}
#turn-result-opponent-side .turn-result-card-wrap { border-color: var(--border-opponent); }
#turn-result-player-side .turn-result-card-wrap { border-color: var(--border-player); }
.turn-result-card-img { width: 100%; height: 42vh; max-height: 320px; object-fit: cover; display: block; background: #14101c; }
.turn-result-card-img.turn-result-img-fallback { object-fit: contain; padding: 20px; }
.turn-result-card-name { font-size: 14px; color: var(--text-white); margin-bottom: 3px; }
.turn-result-dmg { font-size: 13px; color: var(--accent-gold); letter-spacing: 0.03em; }
.turn-result-side.turn-result-winner {
  flex-grow: 1.5;
  max-width: 340px;
}
.turn-result-side.turn-result-winner .turn-result-card-wrap {
  box-shadow: 0 0 18px var(--accent-gold-glow);
}
#turn-result-opponent-side.turn-result-winner .turn-result-card-wrap { border-color: var(--border-opponent-active); }
#turn-result-player-side.turn-result-winner .turn-result-card-wrap { border-color: var(--border-player-active); }
.turn-result-side.turn-result-loser {
  flex-grow: 0.65;
  max-width: 190px;
  opacity: 0.55;
  filter: grayscale(0.45);
}
.turn-result-side.turn-result-loser .turn-result-card-name,
.turn-result-side.turn-result-loser .turn-result-dmg {
  font-size: 0.82em;
}

#turn-result-clash {
  flex: 0 0 auto;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-gold);
  opacity: 0;
}
.turn-result-clash-anim { animation: turn-clash-pop 0.5s 0.35s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }
@keyframes turn-clash-pop {
  0% { opacity: 0; transform: scale(2.2); }
  60% { opacity: 1; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

#turn-result-badge {
  display: inline-block;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 6px 22px;
  border-radius: 20px;
  margin-bottom: 14px;
  border: 1px solid var(--border-gold);
  opacity: 0;
  animation: turn-badge-in 0.4s 0.55s ease-out forwards;
}
@keyframes turn-badge-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.turn-result-badge-win  { color: var(--accent-gold); border-color: var(--border-player-active); background: rgba(178, 95, 214, 0.12); }
.turn-result-badge-lose { color: var(--accent-gold); border-color: var(--border-opponent-active); background: rgba(255, 122, 60, 0.12); }
.turn-result-badge-draw { color: var(--text-dim); }

#turn-result-narration {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-white);
  margin: 0 auto 20px;
  max-width: 560px;
  opacity: 0;
  animation: turn-badge-in 0.4s 0.7s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .turn-result-side, #turn-result-clash, #turn-result-badge, #turn-result-narration {
    animation: none; opacity: 1; transform: none;
  }
}

@media (max-width: 560px) {
  #turn-result-vs { flex-direction: column; }
  #turn-result-clash { order: 2; }
  #turn-result-player-side { order: 3; }
}

@media (max-width: 560px) {
  .card-chip { width: 78px; }
  .card-chip-thumb, .card-chip-thumb-placeholder { height: 78px; }
}

/* ── おねだりターン(彼女からの要求バナー) ── */
#request-banner {
  text-align: center; font-size: 12px; color: var(--accent-gold);
  padding: 6px 20px; margin-bottom: 10px;
  border: 1px solid var(--border-gold); border-radius: 4px;
  background: rgba(212,163,89,0.08);
}

/* ── 理性ロック(ゲージ高騰時、選べる手札が一枚に絞られる)の警告 ── */
#reason-lock-notice {
  text-align: center; font-size: 12px; color: #ff8f8f;
  padding: 4px 12px; margin: 6px 0; letter-spacing: 0.03em;
}

/* ── 選択中カードの効果プレビュー ── */
#selected-card-preview {
  text-align: center; margin: 0 20px 10px;
  padding: 10px 16px;
  border: 1px solid var(--border-player); border-radius: 4px;
  background: rgba(178, 95, 214, 0.08);
}
#selected-card-preview-name {
  font-size: 13px; color: var(--text-white); margin-bottom: 2px;
}
#selected-card-preview-power {
  font-size: 15px; color: var(--accent-gold); font-weight: 700; margin-bottom: 6px;
}
#selected-card-preview-tags {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
}
.selected-card-preview-tag {
  font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--border-gold); border-radius: 10px;
  padding: 1px 9px;
}

/* ── ターン操作(耐える/観察する/仕掛ける/身を委ねる) ── */
#turn-controls { padding: 12px 20px 24px; text-align: center; }
#turn-action-row, #turn-attack-row {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
}
#turn-action-row { margin-bottom: 10px; }
#endure-btn, #observe-btn { font-size: 13px; padding: 10px 20px; }
#surrender-btn { border-color: var(--border-opponent); }
#surrender-btn:hover:not(:disabled) { border-color: var(--border-opponent-active); background: rgba(255,122,60,0.12); }

/* ── ゲージ段階(ティア)による視覚エスカレーション ── */
#game-screen[data-tier="2"] .state-card-thumb { filter: brightness(1.05) saturate(1.1); }
#game-screen[data-tier="3"] .state-card-thumb { filter: brightness(1.12) saturate(1.25); }
#game-screen[data-tier="4"] .state-card-thumb { filter: brightness(1.2) saturate(1.4); }
#game-screen::after {
  content: "";
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  opacity: 0; transition: opacity 0.6s ease;
}
#game-screen[data-tier="2"]::after {
  opacity: 1;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(212,120,60,0.10) 100%);
}
#game-screen[data-tier="3"]::after {
  opacity: 1;
  background: radial-gradient(ellipse at center, transparent 46%, rgba(212,90,60,0.18) 100%);
  animation: tier3-pulse 2.4s ease-in-out infinite;
}
#game-screen[data-tier="4"]::after {
  opacity: 1;
  background: radial-gradient(ellipse at center, transparent 36%, rgba(200,40,50,0.28) 100%);
  animation: tier4-pulse 1.5s ease-in-out infinite;
}
@keyframes tier3-pulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
@keyframes tier4-pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #game-screen[data-tier="3"]::after, #game-screen[data-tier="4"]::after { animation: none; }
}

/* ── 会心演出の強化(既存のフラッシュに放射状バーストを重ねる) ── */
.turn-result-side.turn-result-critical .turn-result-card-wrap::before {
  content: "";
  position: absolute; inset: -40%; z-index: 1;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 60%);
  opacity: 0;
  animation: turn-critical-burst 0.6s ease-out;
  pointer-events: none;
}
@keyframes turn-critical-burst {
  0% { opacity: 0; transform: scale(0.4); }
  35% { opacity: 0.9; transform: scale(1.3); }
  100% { opacity: 0; transform: scale(1.6); }
}
@media (prefers-reduced-motion: reduce) {
  .turn-result-side.turn-result-critical .turn-result-card-wrap::before { animation: none; opacity: 0; }
}

/* ── 絶頂カットシーン ── */
#climax-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#climax-flash { position: absolute; inset: 0; background: #fff; opacity: 0; z-index: 2; }
.climax-flash-anim { animation: climax-flash-seq 1.2s ease-out forwards; }
@keyframes climax-flash-seq {
  0% { opacity: 0; }
  12% { opacity: 0.95; }
  45% { opacity: 0.15; }
  100% { opacity: 0; }
}
#climax-image-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#climax-image {
  max-width: 90%; max-height: 90%; object-fit: contain;
  transform: scale(0.85); opacity: 0;
  animation: climax-zoom-in 1.1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
#climax-placeholder { color: var(--text-dim); font-size: 14px; }
@keyframes climax-zoom-in {
  0% { opacity: 0; transform: scale(0.8); }
  30% { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .climax-flash-anim, #climax-image { animation: none; opacity: 1; transform: none; }
}

/* ── エンディング: 敗北時の救済メッセージ・解禁進捗の一言 ── */
#ending-consolation { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; font-style: italic; }
.unlock-hint { color: var(--text-dim); font-size: 11px; }

/* ── 夜の記録(リプレイ小説) ── */
#story-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#story-inner {
  max-width: 560px; width: 100%; max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--bg-dark); border: 1px solid var(--border-gold); border-radius: 6px;
  padding: 24px; text-align: center;
}
#story-title { font-size: 17px; color: var(--accent-gold); letter-spacing: 0.05em; margin-bottom: 14px; }
#story-body {
  font-size: 14px; line-height: 2; text-align: left; overflow-y: auto;
  margin-bottom: 18px; color: var(--text-white);
}

/* ── 操作ヘルプ ── */
#action-help-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#action-help-inner {
  max-width: 480px; width: 100%; max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--bg-dark); border: 1px solid var(--border-gold); border-radius: 6px;
  padding: 24px; text-align: center;
}
#action-help-title { font-size: 17px; color: var(--accent-gold); letter-spacing: 0.05em; margin-bottom: 16px; }
#action-help-list {
  text-align: left; overflow-y: auto; margin-bottom: 14px;
}
#action-help-list dt {
  font-size: 14px; color: var(--accent-gold); font-weight: 700;
  margin-top: 14px;
}
#action-help-list dt:first-child { margin-top: 0; }
#action-help-list dd {
  font-size: 12px; color: var(--text-white); line-height: 1.8;
  margin: 4px 0 0;
}
#action-help-note {
  font-size: 11px; color: var(--text-dim); line-height: 1.7;
  border-top: 1px solid var(--border-gold); padding-top: 12px; margin-bottom: 18px;
}
