:root {
  --bg-0: #0a0714;
  --bg-1: #150f26;
  --bg-2: #1d1636;
  --card: #1a1330;
  --card-2: #221a3d;
  --border: #3a2f5c;
  --border-soft: #2a2248;
  --text: #f1ecff;
  --text-sub: #a99cd6;
  --text-dim: #6f6493;
  --gold: #ffd76a;
  --gold-2: #ffb347;
  --violet: #a855f7;
  --violet-2: #7c3aed;
  --font-display: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif;
  --font-body: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(ellipse 120% 80% at 50% -10%, var(--bg-2), var(--bg-0) 60%);
  color: var(--text);
  padding: 20px 16px 40px;
  position: relative;
  overflow-x: hidden;
}

#bgfx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.8;
}

.wrap { max-width: 480px; margin: 0 auto; position: relative; z-index: 1; }

.app-header { text-align: center; margin-bottom: 18px; }
h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 18px rgba(168, 85, 247, 0.55), 0 0 4px rgba(255, 215, 106, 0.4);
}
h1 .accent-word {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 45%, #fff3d0 60%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer-text 4s linear infinite;
}
@keyframes shimmer-text {
  to { background-position: 200% center; }
}
.sub { font-size: 12px; color: var(--text-sub); margin: 0; letter-spacing: 0.02em; }

/* ===== ステータスバー ===== */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(34, 26, 61, 0.9), rgba(26, 19, 48, 0.9));
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 10px 12px 10px 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}
.pull-count { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.pull-count-label { font-size: 10px; color: var(--text-dim); letter-spacing: 0.05em; }
.pull-count-value { font-family: var(--font-display); font-size: 18px; color: var(--gold); font-variant-numeric: tabular-nums; }
.pull-count-max { font-size: 12px; color: var(--text-dim); font-family: var(--font-body); }
.ghost-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-sub);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.ghost-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(255,215,106,0.08); }
.ghost-btn .icon { font-size: 14px; }

/* ===== ステージ ===== */
#stage {
  position: relative;
  width: 100%;
  height: 440px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 100%, rgba(124, 58, 237, 0.25), transparent 70%),
    linear-gradient(180deg, #0d0a1a, #191029 55%, #120b22);
  border-radius: 22px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 20px 50px -12px rgba(124, 58, 237, 0.35), 0 0 0 1px var(--border-soft);
}
.stage-frame {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  border: 1px solid rgba(255, 215, 106, 0.18);
  box-shadow: inset 0 0 40px rgba(124, 58, 247, 0.15);
  z-index: 6;
  pointer-events: none;
}
#darken {
  position: absolute; inset: 0;
  background: #000;
  opacity: 0;
  z-index: 4;
  pointer-events: none;
}
#artBox {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 76%; height: 86%;
  border-radius: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  z-index: 1;
  transition: opacity 0.4s ease, transform 0.4s ease;
  overflow: hidden;
}
#auraCv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#artBox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.6));
  transition: filter 0.5s ease;
  position: relative;
  z-index: 1;
}
/* シルエット出現演出: 色を明かす前に暗い影として一瞬見せ、「間」を作る */
#artBox.silhouette img {
  filter: brightness(0.12) saturate(0.3) drop-shadow(0 12px 24px rgba(0,0,0,0.6));
}
#shine {
  position: absolute;
  top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55) 45%, rgba(255,215,106,0.7) 50%, transparent 60%);
  transform: skewX(-20deg);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}
#shine.sweep { animation: shine-sweep 1.1s ease-out; }
@keyframes shine-sweep {
  0% { left: -60%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: 130%; opacity: 0; }
}
#cv {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
}
#flash {
  position: absolute; inset: 0;
  background: #fff;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}
/* ===== 女神・魂・転生の門 演出 ===== */
.scene {
  position: absolute; inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.scene.show { opacity: 1; }
/* 女神の手元のオーブへ実際にズームインするためのコンテナ。
   transform-originを実画像内のオーブ座標(x=40.3%, y=27.2%、実測)に固定し、
   scaleを上げるだけでその一点に正しくズームできる。中の魂オーバーレイ
   (.closeup-soul)も同じコンテナの子にして、一緒に拡大させる。 */
.goddess-zoom {
  position: relative;
  height: 96%;
  aspect-ratio: 616 / 900;
  transform-origin: 40.3% 27.2%;
  transition: transform 1.6s cubic-bezier(.4, 0, .2, 1);
}
.goddess-zoom.zoomed { transform: scale(3.6); }
#goddessArt {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55));
}
.closeup-soul {
  left: 40.3% !important; top: 27.2% !important;
  width: 9% !important; height: 6.6% !important;
  margin: 0 !important;
  transform: translate(-50%, -50%);
}
#sceneGate { align-items: center; }
#gateArt {
  position: absolute; inset: 6% 16%;
  width: 68%; height: 88%;
  object-fit: contain;
  margin: auto;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.6));
  transition: opacity 0.25s ease;
}
#crackCv {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ===== 動画演出（シンプル版） ===== */
/* #sceneVideoの子。レア度帯ごとにランダムで1本選んだ動画をそのまま最初から最後まで
   再生するだけ（女神・魂・門・昇格の多幕構成や色被せは廃止）。
   実際の見た目上の継ぎ目（開始・終了）は#flashの白フラッシュで隠す。
   生成される動画は9:16の縦長(実測1080x1920)。ステージ枠の比率とは合わないため
   containで全体を収める。左右に生じる余白は#video-overlayの暗い背景と動画自身の
   暗い背景でほぼ馴染む。 */
.reveal-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  opacity: 0;
  z-index: 0;
}
.reveal-video.active { opacity: 1; z-index: 1; }

/* 動画演出中だけ、js/video-reveal.jsが#sceneVideo/#skipBtn/#flashをこの中へ一時的に
   移動させる。#stageの狭い枠(overflow:hidden)から出して画面いっぱいを使うことで、
   縦長動画のobject-fit:containによる余白を最小化する（実質的な疑似フルスクリーン化）。
   Fullscreen APIではなく固定オーバーレイにしているのは、iOS Safariがdiv要素への
   requestFullscreenに対応していないため。 */
.video-overlay {
  position: fixed; inset: 0;
  z-index: 1000;
  display: none;
  background: #0a0714;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.video-overlay.show { display: block; opacity: 1; }
.video-overlay #sceneVideo { z-index: 1; }
.video-overlay #skipBtn { z-index: 9; }
.video-overlay #flash { z-index: 3; }

.soul-wrap {
  position: absolute;
  left: 50%; top: 62%;
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: left 0.7s ease, top 0.7s ease, width 0.7s ease, height 0.7s ease,
    margin 0.7s ease, opacity 0.5s ease, transform 0.7s ease;
}
.soul-wrap.show { opacity: 1; }
.soul {
  position: absolute; inset: 0;
  -webkit-mask: url(../images/reveal/ui_soul.png) center / contain no-repeat;
  mask: url(../images/reveal/ui_soul.png) center / contain no-repeat;
  transition: opacity 0.5s ease, filter 0.5s ease;
}
.soul-base { background: #ffffff; opacity: 0.92; animation: soul-breathe 2.6s ease-in-out infinite; }
.soul-tint { opacity: 0; background: #ffffff; }
@keyframes soul-breathe {
  0%, 100% { opacity: 0.75; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.05); }
}
.soul-tint.soul-rainbow {
  background: conic-gradient(from 0deg, #ff6a8a, #ffd76a, #8affc1, #7fd8ff, #a855f7, #ff6a8a);
  animation: soul-hue-spin 3s linear infinite;
}
.soul-tint.soul-cosmic {
  background: radial-gradient(circle at 35% 30%, #ffffff, #a855f7 45%, #241a45 85%);
  animation: soul-cosmic-pulse 2.4s ease-in-out infinite;
}
.soul-tint.soul-distort {
  background: linear-gradient(120deg, #26215c, #ffffff, #26215c);
  background-size: 260% 260%;
  animation: soul-distort-shift 1.6s linear infinite;
}
@keyframes soul-hue-spin { to { filter: hue-rotate(360deg); } }
@keyframes soul-cosmic-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes soul-distort-shift { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }

#revealCaption {
  position: absolute;
  left: 50%; top: 20%;
  transform: translate(-50%, -50%);
  z-index: 6;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.1em;
  text-shadow: 0 0 16px rgba(168, 85, 247, 0.6);
  opacity: 0;
  transition: opacity 0.6s ease;
  text-align: center;
  padding: 0 24px;
  pointer-events: none;
}
#revealCaption.show { opacity: 1; }

#skipBtn {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 9;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(6, 4, 14, 0.55);
  color: var(--text-sub);
  font-size: 11px;
  cursor: pointer;
  display: none;
  backdrop-filter: blur(3px);
}
#skipBtn.show { display: block; }
#skipBtn:hover { color: var(--gold); border-color: var(--gold); }
#skipBtn:active { transform: scale(0.96); }

.credit-line {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 2px;
}
#rarityBadge {
  position: absolute;
  top: 12px; left: 12px;
  padding: 6px 16px;
  border-radius: 20px;
  color: #241505;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 400;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.5);
  letter-spacing: 0.02em;
}
#firstBadge {
  position: absolute;
  top: 12px; right: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ff6a8a, #e0653f);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 14px rgba(224, 101, 63, 0.5);
}
#rarityStamp {
  position: absolute;
  z-index: 8;
  top: 30%; left: 50%;
  font-family: var(--font-display);
  font-size: 42px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(224, 101, 63, 0.85), 0 0 40px rgba(255, 215, 106, 0.7), 3px 3px 0 #4a1030;
  opacity: 0;
  transform: translate(-50%, -50%) scale(2.6) rotate(-8deg);
  pointer-events: none;
  transition: opacity 0.7s ease;
}
#rarityStamp.slam { animation: stamp-slam 0.55s cubic-bezier(.2, 1.6, .4, 1) forwards; }
#rarityStamp.fadeout { opacity: 0 !important; }
@keyframes stamp-slam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.6) rotate(-8deg); }
  55% { opacity: 1; transform: translate(-50%, -50%) scale(0.9) rotate(2deg); }
  75% { transform: translate(-50%, -50%) scale(1.12) rotate(-1deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* ===== ガチャボタン ===== */
#pullBtn {
  position: relative;
  width: 100%;
  padding: 17px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--violet-2), var(--violet) 55%, #d946ef);
  color: #fff;
  cursor: pointer;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px -6px rgba(168, 85, 247, 0.6), inset 0 1px 0 rgba(255,255,255,0.25);
  animation: btn-breathe 2.6s ease-in-out infinite;
}
@keyframes btn-breathe {
  0%, 100% { box-shadow: 0 10px 30px -6px rgba(168, 85, 247, 0.55), inset 0 1px 0 rgba(255,255,255,0.25); }
  50% { box-shadow: 0 10px 42px -4px rgba(168, 85, 247, 0.9), inset 0 1px 0 rgba(255,255,255,0.35); }
}
#pullBtn .pull-btn-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.pull-btn-shine {
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.35) 50%, transparent);
  transform: skewX(-20deg);
  animation: btn-shine 3.2s ease-in-out infinite;
}
@keyframes btn-shine {
  0% { left: -80%; }
  35%, 100% { left: 140%; }
}
#pullBtn:disabled {
  opacity: 0.35;
  cursor: default;
  animation: none;
  box-shadow: none;
}
#pullBtn:disabled .pull-btn-shine { display: none; }
#pullBtn:not(:disabled):active { transform: scale(0.97); }

/* ===== ボーナス回数ボタン（広告視聴/SNSシェア） ===== */
.bonus-row {
  display: flex;
  gap: 10px;
  margin: -4px 0 16px;
}
.bonus-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-sub);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.bonus-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); background: rgba(255,215,106,0.08); }
.bonus-btn:active:not(:disabled) { transform: scale(0.97); }
.bonus-icon { font-size: 13px; }
.bonus-label { font-size: 11px; font-weight: 700; }
.bonus-count { font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.bonus-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.bonus-btn:disabled .bonus-label::after { content: " (本日分終了)"; font-weight: 400; }

/* ===== 広告視聴（模擬）モーダル ===== */
.ad-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 3, 10, 0.85);
  backdrop-filter: blur(2px);
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ad-overlay.show { display: flex; }
.ad-sheet {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  max-width: 320px;
  width: 100%;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.ad-label { font-family: var(--font-display); font-size: 15px; color: var(--gold); margin-bottom: 16px; }
.ad-dots { animation: ad-dots-blink 1.2s steps(1) infinite; }
@keyframes ad-dots-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.ad-progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.ad-progress-fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--violet-2), var(--gold)); }
.ad-hint { font-size: 11px; color: var(--text-dim); margin-top: 10px; letter-spacing: 0.04em; }

/* ===== 詳細カード ===== */
.detail-card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 18px;
  display: none;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.detail-card.show { display: flex; animation: card-in 0.4s ease-out; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-name { text-align: center; margin-bottom: -4px; }
.detail-name .job-title {
  display: block; font-size: 11px; color: var(--text-sub);
  letter-spacing: 0.14em; margin-bottom: 4px;
}
.detail-name .job-title::before, .detail-name .job-title::after { content: "・"; color: var(--gold); margin: 0 6px; opacity: 0.8; }
.detail-name .proper-name {
  display: block; font-family: var(--font-display); font-weight: 400;
  font-size: 21px; line-height: 1.4; letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff 10%, var(--gold) 55%, var(--gold-2) 90%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 0 24px rgba(255, 215, 106, 0.35);
}

.detail-section {}
.detail-label {
  font-size: 10px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  font-weight: 700;
  opacity: 0.85;
}
.detail-value { font-size: 14px; line-height: 1.6; }
.detail-value strong { font-size: 15px; color: var(--text); }
.skill-desc { color: var(--text-sub); font-size: 12.5px; }

.radar-wrap { display: flex; align-items: center; justify-content: center; gap: 8px; }
.radar-wrap svg { width: 190px; height: 190px; flex: 0 0 auto; overflow: visible; }
.radar-axis-label { font-size: 8px; fill: var(--text-sub); font-family: var(--font-body); }
.radar-axis-label.broken { fill: #ff3d5a; font-weight: 700; }
.radar-nums { display: grid; grid-template-columns: 1fr; gap: 3px; font-size: 10px; color: var(--text-sub); white-space: nowrap; }
.radar-nums .v { color: var(--gold); font-weight: 700; margin-left: 4px; font-variant-numeric: tabular-nums; }
.radar-nums .broken .v { color: #ff3d5a; }
.radar-nums .broken .v b { font-family: var(--font-display); font-weight: 400; font-size: 8px; margin-left: 2px; letter-spacing: 0.02em; }
.stat-fixed {
  font-size: 11px;
  font-weight: 700;
  word-break: break-all;
  line-height: 1.7;
  background: rgba(255, 215, 106, 0.06);
  border: 1px solid rgba(255, 215, 106, 0.25);
  border-radius: 10px;
  padding: 12px;
  color: var(--gold);
  font-family: var(--font-body);
}
.long-story {
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-sub);
}

/* ===== 図鑑モーダル ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 4, 14, 0.72);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-sheet {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-0));
  border-top: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  border-radius: 20px 20px 0 0;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-family: var(--font-display); font-weight: 400; font-size: 16px; margin: 0; color: var(--gold); }
.modal-header button {
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-sub);
  cursor: pointer;
  line-height: 1;
}
.codex-summary {
  font-size: 12px;
  color: var(--text-sub);
}
.codex-rarity-group { margin-bottom: 10px; }
.codex-rarity-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin: 12px 0 8px;
  text-transform: uppercase;
}
.codex-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.codex-cell {
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.codex-cell:active { transform: scale(0.95); }
.codex-cell img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
}
.codex-cell.locked {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
  font-size: 18px;
  cursor: default;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,0.02) 0 8px, transparent 8px 16px);
}
.codex-cell.locked:active { transform: none; }
.codex-cell .count {
  position: absolute;
  bottom: 3px; right: 5px;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  font-weight: 700;
}
.codex-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.codex-actions button {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
}
.codex-actions button:hover { border-color: var(--gold); color: var(--gold); }
#importFileInput { display: none; }

/* ===== 詳細シート（図鑑タップ時） ===== */
.job-detail-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 4, 14, 0.78);
  backdrop-filter: blur(2px);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.job-detail-overlay.show { display: flex; }
.job-detail-sheet {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.job-detail-sheet img {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 12px;
  background: #0d0a1a;
}
.job-detail-sheet .detail-name { margin-bottom: 6px; }
.job-detail-sheet .meta { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; }
.job-detail-sheet .story { font-size: 13px; line-height: 1.9; color: var(--text-sub); }
.job-detail-close {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
}
.job-detail-close:hover { border-color: var(--gold); color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
