/* フェルメール展 鑑賞ガイド(非公式) */
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('../assets/fonts/vermeer-serif.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #10141c;          /* フェルメールの闇 */
  --bg-card: #1a2130;
  --bg-card2: #202a3d;
  --ink: #f0ede6;         /* 真珠の白 */
  --ink-dim: #9aa3b5;
  --ultramarine: #3b5fa0; /* ウルトラマリン */
  --ultramarine-l: #6f92cf;
  --pearl-gold: #d9b45b;  /* 上着の黄 */
  --danger: #c0564f;
  --radius: 14px;
  --maxw: 640px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.8;
  font-size: 16px;
}
body.font-large { font-size: 19px; }

a { color: var(--ultramarine-l); }

/* header */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(16,20,28,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #2a3346;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand small { color: var(--pearl-gold); font-weight: 400; border: 1px solid var(--pearl-gold); border-radius: 4px; padding: 0 4px; margin-left: 4px; font-size: .68em; vertical-align: 2px; }
.brand-pearl {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fffdf5 0%, #e8e2d2 30%, #9aa3b5 75%, #6b7488 100%);
  box-shadow: 0 1px 4px rgba(0,0,0,.6);
  flex: none;
}

/* layout */
#app { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px 96px; min-height: 62vh; }
h1 { font-size: 1.35em; line-height: 1.5; margin: .4em 0 .6em; }
h2 { font-size: 1.12em; color: var(--pearl-gold); margin: 1.6em 0 .5em; }
h3 { font-size: 1em; margin: 1.2em 0 .4em; }
p { margin: .5em 0; }
.dim { color: var(--ink-dim); font-size: .9em; }
.center { text-align: center; }

.card {
  background: var(--bg-card);
  border: 1px solid #2a3346;
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.btn {
  display: inline-block;
  background: var(--ultramarine);
  color: #fff; text-decoration: none;
  border: none; border-radius: 12px;
  padding: 12px 18px;
  font-size: 1em; font-weight: 700;
  font-family: inherit; line-height: 1.5;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--bg-card2); color: var(--ink); border: 1px solid #3a465e; }
.btn.gold { background: var(--pearl-gold); color: #2a2313; }
.btn.wide { display: block; width: 100%; text-align: center; margin: 10px 0; }
.btn.big { padding: 16px 18px; font-size: 1.08em; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* home hero(ポスター調: 《少女》を画面全体の背景に敷き、パネル群まで一体化) */
.hero {
  position: relative;
  margin: -18px -16px 0;
  padding: 0 16px 8px;
  overflow: hidden;
  text-align: center;
}
.hero-img {
  /* 上に10%はみ出させて絵の上部の余白をカットし、顔を上へ寄せる */
  position: absolute; top: -10%; left: 0;
  width: 100%; height: 110%;
  object-fit: cover;
  object-position: 50% 0;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(16,20,28,.60) 0%,
    rgba(16,20,28,.30) 16%,
    rgba(16,20,28,.20) 32%,
    rgba(16,20,28,.55) 52%,
    rgba(16,20,28,.80) 72%,
    rgba(16,20,28,.90) 100%);
}
.hero-body {
  position: relative; z-index: 1;
  padding: 14px 16px 18px;
  text-shadow: 0 1px 10px rgba(0,0,0,.6);
}
.hero .menu-grid, .hero .notice, .hero .hero-meta { position: relative; z-index: 1; }
.hero-meta {
  color: #d3d9e4; font-size: .84em; line-height: 1.7; margin: 14px 0 0;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.hero-meta .hm-dates { color: var(--pearl-gold); font-weight: 700; }
.wordmark {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 500;
  font-size: clamp(3.4rem, 16vw, 5.2rem);
  line-height: 1;
  color: #f2ecdc;
  letter-spacing: .015em;
  text-shadow: 0 2px 28px rgba(0,0,0,.6), 0 1px 4px rgba(0,0,0,.4);
}
.wordmark-sub {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  color: var(--pearl-gold);
  font-size: .8rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  margin: 8px 0 16px;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.hero-title {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  display: table; margin: 0 auto 6px; text-align: left;
  line-height: 1.3; font-weight: 600;
}
/* px指定: 「文字を大きくする」設定の影響を受けない(タイトルはポスターとして固定サイズ) */
.hero-title .ht-artist { display: block; font-size: clamp(20px, 5.8vw, 25px); letter-spacing: .16em; }
.hero-title .ht-main { display: block; font-size: clamp(23px, 7.2vw, 30px); letter-spacing: .04em; white-space: nowrap; }
.hero-sub { color: var(--pearl-gold); font-size: .86em; font-weight: 600; }
.hero-dates { color: #e9c96f; font-size: .95em; margin-top: 8px; font-weight: 700; }
.phase-badge {
  display: inline-block; margin-top: 30px;
  font-size: .8em; padding: 2px 12px; border-radius: 99px;
  background: var(--bg-card2); border: 1px solid #3a465e;
}
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.menu-grid a {
  background: rgba(26,33,48,.55); border: 1px solid #55648a; border-radius: var(--radius);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  text-decoration: none; color: var(--ink);
  padding: 16px 12px; text-align: center; font-weight: 700;
}
.menu-grid a small { display: block; font-weight: 400; color: var(--ink-dim); font-size: .75em; margin-top: 2px; }
.menu-grid a.primary { grid-column: 1 / -1; }

/* works list */
.work-list { display: flex; flex-direction: column; gap: 10px; }
.work-item {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-card); border: 1px solid #2a3346; border-radius: var(--radius);
  padding: 10px; text-decoration: none; color: var(--ink);
}
.work-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; background: #263048; }
.work-item .t { font-weight: 700; line-height: 1.4; }
.work-item .a { color: var(--ink-dim); font-size: .82em; }

/* work detail */
.detail-top { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }
.back-link { color: var(--ultramarine-l); text-decoration: none; font-weight: 700; font-size: .9em; padding: 6px 10px 6px 0; }
.work-fig { margin: 0 0 12px; }
.work-fig img {
  width: 100%; border-radius: var(--radius); display: block;
  background: #263048; cursor: zoom-in;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.work-fig figcaption { font-size: .78em; color: var(--ink-dim); margin-top: 6px; }
.work-meta { color: var(--ink-dim); font-size: .88em; line-height: 1.7; }
.work-desc p { margin: .9em 0; }
.highlight-box {
  border-left: 3px solid var(--pearl-gold);
  background: rgba(217,180,91,.08);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px; margin: 14px 0;
}
.highlight-box .hb-title { color: var(--pearl-gold); font-weight: 700; font-size: .85em; }

.player {
  background: var(--bg-card2); border: 1px solid #3a465e;
  border-radius: var(--radius); padding: 12px 14px; margin: 14px 0;
}
.p-controls { display: flex; align-items: center; justify-content: center; gap: 16px; }
.player .p-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: none; background: var(--ultramarine); color: #fff;
  cursor: pointer; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.player .p-btn svg { width: 24px; height: 24px; }
.p-skip {
  width: 44px; height: 44px; border-radius: 50%;
  background: transparent; border: none; color: var(--ink);
  cursor: pointer; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.p-skip svg { width: 28px; height: 28px; }
.player:not(.active) .p-skip { opacity: .35; }
.p-rate {
  min-width: 54px; height: 34px; border-radius: 17px;
  border: 1px solid #3a465e; background: transparent;
  color: var(--ink-dim); font-weight: 700; font-size: .85em;
  cursor: pointer; flex: none;
  font-variant-numeric: tabular-nums;
}
.player.playing .p-btn { background: var(--pearl-gold); color: #212a3d; }
.p-progress {
  height: 4px; background: #3a465e; border-radius: 2px;
  margin-top: 12px; overflow: hidden; display: none;
}
.p-bar { height: 100%; width: 0%; background: var(--pearl-gold); }
.p-times {
  display: none; justify-content: space-between;
  font-size: .78em; color: var(--ink-dim); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.player.active .p-progress { display: block; }
.player.active .p-times { display: flex; }
.player .p-info { font-size: .85em; color: var(--ink-dim); line-height: 1.5; text-align: center; margin-top: 10px; }

textarea.memo {
  width: 100%; min-height: 96px;
  background: var(--bg); color: var(--ink);
  border: 1px solid #3a465e; border-radius: 10px;
  padding: 10px; font-size: 1em; font-family: inherit; line-height: 1.7;
}
.saved-note { color: var(--pearl-gold); font-size: .82em; min-height: 1.4em; }

.worknav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.wn-card {
  flex: 1; min-width: 0;
  display: block; text-decoration: none; color: var(--ink);
  border: 1px solid #2a3346; border-radius: var(--radius);
  padding: 10px 12px;
  -webkit-tap-highlight-color: transparent;
}
.wn-card:active { background: var(--bg-card); }
.wn-card.next { text-align: right; }
.wn-card .wn-dir { display: block; font-size: .74em; color: var(--ink-dim); }
.wn-card .wn-title {
  display: block; font-size: .88em; font-weight: 700; line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wn-spacer { flex: 1; }

/* zoom overlay */
.zoom-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,7,11,.96);
  display: flex; align-items: center; justify-content: center;
  overflow: auto; -webkit-overflow-scrolling: touch;
}
.zoom-overlay img { max-width: none; width: 160%; }
.zoom-overlay .close {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 14px;
  background: rgba(26,33,48,.9); color: var(--ink);
  border: 1px solid #3a465e; border-radius: 99px;
  width: 44px; height: 44px; font-size: 1.2em; cursor: pointer;
}

.mini-list { list-style: none; padding: 0; margin: 8px 0; }
.mini-list li { padding: 6px 0; border-bottom: 1px dashed #2a3346; }
.mini-list li a { color: var(--ink); text-decoration: none; }
.mini-list .sub { color: var(--ink-dim); font-size: .8em; }

/* card maker */
.card-preview-wrap { text-align: center; margin: 12px 0; }
#cardCanvas {
  width: 100%; max-width: 420px;
  border-radius: 12px; border: 1px solid #3a465e;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.select, input.text {
  width: 100%; background: var(--bg); color: var(--ink);
  border: 1px solid #3a465e; border-radius: 10px;
  padding: 12px; font-size: 1em; font-family: inherit;
}
.field { margin: 12px 0; }
.field label { display: block; font-size: .85em; color: var(--ink-dim); margin-bottom: 4px; }

/* links */
.link-list { list-style: none; padding: 0; }
.link-list li {
  background: var(--bg-card); border: 1px solid #2a3346;
  border-radius: var(--radius); margin: 8px 0;
}
.link-list a { display: block; padding: 14px; text-decoration: none; color: var(--ink); font-weight: 700; }
.link-list .sub { display: block; font-weight: 400; font-size: .8em; color: var(--ink-dim); margin-top: 2px; }

/* tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: rgba(16,20,28,.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid #2a3346;
  padding-bottom: var(--safe-b);
}
.tabbar a {
  flex: 1; text-align: center; text-decoration: none;
  color: var(--ink-dim); font-size: .68em;
  padding: 8px 0 6px; line-height: 1.3;
}
.tabbar a svg { display: block; width: 22px; height: 22px; margin: 0 auto 3px; }
.tabbar a.active { color: var(--ink); }

/* miniplayer(全ページ共通・音声再生中のみ表示) */
.miniplayer[hidden] { display: none; } /* display:flex が hidden属性に勝つため明示 */
.miniplayer {
  position: fixed; left: 0; right: 0;
  bottom: calc(53px + var(--safe-b)); z-index: 29;
  display: flex; align-items: center; gap: 8px;
  padding: 8px max(12px, calc((100% - var(--maxw)) / 2 + 12px));
  background: rgba(22, 28, 40, .97);
  backdrop-filter: blur(8px);
  border-top: 1px solid #2a3346;
}
.mini-progress {
  position: absolute; top: -1px; left: 0; right: 0; height: 3px;
  background: #3a465e;
}
.mini-bar { height: 100%; width: 0%; background: var(--pearl-gold); }
.mini-link {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
  text-decoration: none; color: var(--ink);
}
.mini-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex: none; }
.mini-title { font-size: .8em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-controls { display: flex; align-items: center; gap: 2px; flex: none; }
.mini-skip, .mini-stop {
  width: 38px; height: 38px; border: none; background: transparent;
  color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mini-skip svg { width: 22px; height: 22px; }
.mini-play {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; background: var(--ultramarine); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mini-play svg { width: 18px; height: 18px; }
.mini-stop { font-size: 15px; color: var(--ink-dim); }
body.font-large .miniplayer { bottom: calc(56px + var(--safe-b)); } /* 大きな文字モードはタブバーが高くなる */
body.has-miniplayer #app { padding-bottom: 158px; }
body.has-miniplayer .app-footer { padding-bottom: calc(132px + var(--safe-b)); }

/* footer */
.app-footer {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px 16px calc(70px + var(--safe-b));
  color: var(--ink-dim); font-size: .74em; line-height: 1.7;
  border-top: 1px solid #222b3d;
}

/* misc */
.notice { font-size: .82em; color: var(--ink-dim); }
.tag { display: inline-block; font-size: .75em; border: 1px solid #3a465e; border-radius: 6px; padding: 0 6px; color: var(--ink-dim); }
hr { border: none; border-top: 1px dashed #2a3346; margin: 18px 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b));
  transform: translateX(-50%);
  background: var(--pearl-gold); color: #2a2313;
  border-radius: 99px; padding: 8px 20px; font-weight: 700; font-size: .9em;
  z-index: 200; box-shadow: 0 4px 16px rgba(0,0,0,.5);
  animation: toastin .2s ease-out;
}
@keyframes toastin { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ---------------- 起動スプラッシュ ----------------
   ホームのヒーローと同一マークアップの複製(index.html)に、既存のヒーロー用CSSを
   そのまま効かせて位置をぴったり一致させる。.splash-ghostは高さ確保用の不可視要素。
   タイムライン(CSSのみで完結。DOM除去はapp.js):
   0.16s  「Vermeer」が浮かび上がる
   0.8s   「GIRL WITH A PEARL EARRING」+《少女》が同時に浮かび上がる
   1.6s   スプラッシュ全体がフェードアウト → 実画面(ヒーローの各要素が順に出現) */
#splash {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  overflow: hidden;
  animation: splash-hide .6s ease 1.6s forwards;
}
#splash .splash-ghost { visibility: hidden; }
.splash-main { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px 0; }
.splash-img { opacity: 0; animation: splash-in 1s ease .8s forwards; }
.splash-wordmark { opacity: 0; animation: splash-rise .9s ease .16s forwards; }
.splash-sub { opacity: 0; animation: splash-rise 1s ease .8s forwards; }
@keyframes splash-in { to { opacity: 1; } }
@keyframes splash-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes splash-hide { to { opacity: 0; visibility: hidden; } }

/* スプラッシュ明け: ヒーロー内の各要素とヘッダー/タブバーが順に浮かび上がる
   (wordmark・背景画像はスプラッシュと同一デザインのため動かさず連続感を出す) */
body.intro .hero-title, body.intro .hero-sub, body.intro .phase-badge,
body.intro .menu-grid a, body.intro .hero-meta, body.intro .hero .notice,
body.intro .app-header, body.intro .tabbar, body.intro .app-footer {
  opacity: 0;
  animation: splash-rise .9s ease forwards;
}
body.intro .hero-title { animation-delay: 1.6s; }
body.intro .hero-sub { animation-delay: 1.7s; }
body.intro .phase-badge { animation-delay: 1.8s; }
body.intro .menu-grid a:nth-child(1) { animation-delay: 1.8s; }
body.intro .menu-grid a:nth-child(2) { animation-delay: 1.92s; }
body.intro .menu-grid a:nth-child(3) { animation-delay: 2.04s; }
body.intro .menu-grid a:nth-child(4) { animation-delay: 2.16s; }
body.intro .menu-grid a:nth-child(5) { animation-delay: 2.28s; }
body.intro .hero-meta, body.intro .hero .notice { animation-delay: 2.4s; }
body.intro .app-header, body.intro .tabbar, body.intro .app-footer { animation-delay: 1.9s; }

@media (prefers-reduced-motion: reduce) {
  #splash { display: none; }
  body.intro .hero-title, body.intro .hero-sub, body.intro .phase-badge,
  body.intro .menu-grid a, body.intro .hero-meta, body.intro .hero .notice,
  body.intro .app-header, body.intro .tabbar, body.intro .app-footer {
    opacity: 1; animation: none;
  }
}
