/* strata-museum — 意味の地層 世界観CSS
   深い墨紺 × 金褐色 × 羊皮紙色 / しっぽり明朝 / 博物館の展示ラベルの趣 */

:root {
  --bg: #141824;
  --bg2: #1c2333;
  --bg3: #232b40;
  --ink: #e8e0d0;
  --ink-dim: #a89f8c;
  --gold: #c9a227;
  --gold-dim: #8a7434;
  --line: rgba(201, 162, 39, 0.35);
  --line-soft: rgba(201, 162, 39, 0.16);
  --danger: #b5533c;
  --serif: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.9;
  letter-spacing: 0.06em;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201, 162, 39, 0.06), transparent),
    linear-gradient(var(--bg), var(--bg));
}

/* ---------- ヘッダ ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1.2rem;
  background: rgba(20, 24, 36, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { font-size: 1.05rem; letter-spacing: 0.25em; cursor: pointer; white-space: nowrap; }
.brand small { display: block; font-size: 0.6rem; letter-spacing: 0.35em; color: var(--gold-dim); }
nav { margin-left: auto; display: flex; gap: 0.4rem; align-items: center; }
nav button {
  background: none; border: 1px solid transparent; color: var(--ink-dim);
  font-family: var(--serif); font-size: 0.85rem; letter-spacing: 0.15em;
  padding: 0.35rem 0.8rem; cursor: pointer; transition: color 0.3s, border-color 0.3s;
}
nav button:hover, nav button.active { color: var(--gold); border-color: var(--line-soft); }

.engine-badge {
  font-size: 0.7rem; letter-spacing: 0.2em; color: var(--gold);
  border: 1px solid var(--line); padding: 0.2rem 0.7rem;
  cursor: pointer; white-space: nowrap; background: rgba(201,162,39,0.06);
}
.engine-badge .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-right: 0.4em; vertical-align: middle; }

/* ---------- 共通 ---------- */
main { max-width: 900px; margin: 0 auto; padding: 2rem 1.2rem 6rem; }
.view { display: none; animation: fadein 0.8s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-weight: 500; letter-spacing: 0.18em; }
.section-label {
  text-align: center; color: var(--gold-dim); font-size: 0.75rem;
  letter-spacing: 0.5em; margin: 2.5rem 0 1rem; text-indent: 0.5em;
}
.section-label::before, .section-label::after { content: "―"; color: var(--line); margin: 0 0.8em; }

.btn {
  display: inline-block; background: none; cursor: pointer;
  font-family: var(--serif); font-size: 0.95rem; letter-spacing: 0.25em;
  color: var(--gold); border: 1px solid var(--line);
  padding: 0.75rem 2.4rem; transition: all 0.35s; text-indent: 0.25em;
}
.btn:hover { background: rgba(201, 162, 39, 0.1); box-shadow: 0 0 24px rgba(201, 162, 39, 0.15); }
.btn.primary { border-width: 1px; outline: 1px solid var(--line-soft); outline-offset: 3px; }
.btn.small { font-size: 0.78rem; padding: 0.4rem 1.1rem; letter-spacing: 0.15em; }
.btn.ghost { color: var(--ink-dim); border-color: rgba(232,224,208,0.2); }
.btn.danger { color: var(--danger); border-color: rgba(181,83,60,0.4); }
.btn:disabled { opacity: 0.35; cursor: default; }

/* 額装枠 */
.frame {
  border: 1px solid var(--line);
  outline: 1px solid var(--line-soft);
  outline-offset: 5px;
  padding: 2rem 1.8rem;
  background: linear-gradient(160deg, var(--bg2), var(--bg));
  position: relative;
}
.frame::before, .frame::after {
  content: "◆"; position: absolute; color: var(--gold-dim); font-size: 0.55rem;
}
.frame::before { top: -0.45rem; left: 50%; transform: translateX(-50%); }
.frame::after { bottom: -0.45rem; left: 50%; transform: translateX(-50%); }

/* ---------- 玄関 ---------- */
#view-hero { text-align: center; padding-top: 9vh; }
.hero-philosophy {
  color: var(--ink-dim); font-size: 0.92rem; letter-spacing: 0.3em;
  margin-bottom: 3rem; line-height: 2.6;
}
.hero-title { font-size: 2.4rem; letter-spacing: 0.5em; text-indent: 0.5em; margin-bottom: 0.8rem; }
.hero-sub { color: var(--gold-dim); font-size: 0.8rem; letter-spacing: 0.45em; margin-bottom: 4rem; }
.hero-note { margin-top: 4rem; color: var(--ink-dim); font-size: 0.72rem; letter-spacing: 0.15em; }

/* ---------- 選定の間 ---------- */
.tabs { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.tabs button {
  background: none; border: 1px solid var(--line-soft); color: var(--ink-dim);
  font-family: var(--serif); font-size: 0.85rem; letter-spacing: 0.2em;
  padding: 0.45rem 1.3rem; cursor: pointer; transition: all 0.3s;
}
.tabs button.active { color: var(--gold); border-color: var(--line); background: rgba(201, 162, 39, 0.07); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.8rem; }
.pick-card {
  border: 1px solid var(--line-soft); padding: 1rem 1.1rem; cursor: pointer;
  background: linear-gradient(160deg, var(--bg2), transparent);
  transition: all 0.3s; position: relative;
}
.pick-card:hover { border-color: var(--line); transform: translateY(-2px); }
.pick-card.selected { border-color: var(--gold); background: rgba(201, 162, 39, 0.08); box-shadow: 0 0 18px rgba(201, 162, 39, 0.12); }
.pick-card .name { font-size: 1.02rem; letter-spacing: 0.12em; }
.pick-card .meta { color: var(--gold-dim); font-size: 0.7rem; letter-spacing: 0.1em; margin-top: 0.15rem; }
.pick-card .bio { color: var(--ink-dim); font-size: 0.74rem; line-height: 1.7; margin-top: 0.4rem; }

.custom-form { margin-top: 1.2rem; border: 1px dashed var(--line-soft); padding: 1.2rem; }
.custom-form .hint { color: var(--ink-dim); font-size: 0.75rem; margin-bottom: 0.8rem; }
.field-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
input[type="text"], textarea, select {
  background: var(--bg); border: 1px solid var(--line-soft); color: var(--ink);
  font-family: var(--serif); font-size: 0.9rem; padding: 0.55rem 0.8rem;
  letter-spacing: 0.08em; flex: 1; min-width: 120px;
}
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--line); }
textarea { width: 100%; min-height: 110px; line-height: 1.9; resize: vertical; }

.selection-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(20, 24, 36, 0.96); border-top: 1px solid var(--line-soft);
  padding: 0.8rem 1.2rem; display: flex; align-items: center; gap: 1rem;
  justify-content: center; flex-wrap: wrap; backdrop-filter: blur(6px);
}
.selection-bar .pair { font-size: 0.9rem; letter-spacing: 0.12em; }
.selection-bar .pair .x { color: var(--gold-dim); margin: 0 0.6em; }
.selection-bar .placeholder { color: var(--ink-dim); }

/* ---------- 集積の間 ---------- */
#view-accretion { text-align: center; padding-top: 4vh; }
#accretion-canvas { display: block; margin: 0 auto; max-width: 100%; }
.accretion-msg {
  color: var(--ink-dim); font-size: 0.9rem; letter-spacing: 0.3em;
  min-height: 2.2em; margin-top: 1.6rem; transition: opacity 0.8s;
}
.accretion-elapsed { color: var(--gold-dim); font-size: 0.68rem; letter-spacing: 0.2em; margin-top: 0.8rem; }
.accretion-pair { font-size: 1.05rem; letter-spacing: 0.2em; margin-bottom: 0.6rem; }
.accretion-error { margin-top: 2rem; }
.accretion-error p { color: var(--ink-dim); font-size: 0.88rem; margin-bottom: 1.2rem; }

/* ---------- 開示の間 ---------- */
.reveal-head { text-align: center; margin-bottom: 2.4rem; }
.reveal-pair { font-size: 1.15rem; letter-spacing: 0.2em; }
.reveal-pair .x { color: var(--gold-dim); margin: 0 0.7em; font-size: 0.9rem; }
.reveal-kind { color: var(--gold-dim); font-size: 0.7rem; letter-spacing: 0.3em; margin-top: 0.4rem; }

.grain {
  border-left: 2px solid var(--line-soft); padding: 0.6rem 1rem; margin-bottom: 0.9rem;
  opacity: 0; transform: translateY(10px); transition: opacity 0.9s ease, transform 0.9s ease;
  background: linear-gradient(90deg, rgba(201, 162, 39, 0.04), transparent);
}
.grain.shown { opacity: 1; transform: none; }
.grain .tag {
  display: inline-block; font-size: 0.62rem; letter-spacing: 0.15em;
  color: var(--gold-dim); border: 1px solid var(--line-soft);
  padding: 0.05rem 0.5rem; margin-right: 0.6em; vertical-align: middle;
}
.grain .tag.conf-high { color: var(--gold); border-color: var(--line); }
.grain .tag.conf-speculative { color: var(--ink-dim); }
.grain .text { font-size: 0.9rem; line-height: 1.95; }
.grain.emotional { border-left-color: rgba(181, 83, 60, 0.45); background: linear-gradient(90deg, rgba(181, 83, 60, 0.05), transparent); }
.grain.emotional .tag { color: #c08a7a; border-color: rgba(181, 83, 60, 0.35); }

.hypothesis-frame { margin: 3rem 0; text-align: center; opacity: 0; transition: opacity 1.6s ease; }
.hypothesis-frame.shown { opacity: 1; }
.hypothesis-frame .angle { color: var(--gold-dim); font-size: 0.7rem; letter-spacing: 0.4em; margin-bottom: 1.2rem; }
.hypothesis-frame h2 { font-size: 1.45rem; line-height: 2.2; letter-spacing: 0.14em; }
.hypothesis-frame .statement { color: var(--ink-dim); font-size: 0.88rem; margin-top: 1.4rem; line-height: 2.1; }

.narrative-block { opacity: 0; transition: opacity 1.8s ease; }
.narrative-block.shown { opacity: 1; }
.narrative-text { font-size: 0.95rem; line-height: 2.4; white-space: pre-wrap; padding: 0 0.4rem; }
.epigraph { text-align: center; color: var(--gold); font-size: 0.95rem; letter-spacing: 0.25em; margin: 2.6rem 0 0.6rem; line-height: 2.2; }
.epigraph::before { content: "――"; color: var(--line); margin-right: 0.8em; }

.reveal-actions { text-align: center; margin-top: 3rem; display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.reveal-skip { text-align: center; margin: 1.2rem 0; }

.disclaimer {
  text-align: center; color: var(--ink-dim); font-size: 0.68rem;
  letter-spacing: 0.12em; margin-top: 2.6rem; opacity: 0.8;
}
.stock-note {
  text-align: center; color: var(--gold-dim); font-size: 0.72rem;
  letter-spacing: 0.1em; margin-bottom: 1.6rem;
  border: 1px dashed var(--line-soft); padding: 0.5rem 1rem;
}

/* ---------- 収蔵庫 ---------- */
.archive-tools { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.8rem; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.story-card {
  border: 1px solid var(--line-soft); padding: 1.2rem 1.2rem 1rem; cursor: pointer;
  background: linear-gradient(160deg, var(--bg2), transparent); transition: all 0.3s; position: relative;
}
.story-card:hover { border-color: var(--line); transform: translateY(-3px); }
.story-card .pair { font-size: 0.78rem; color: var(--gold-dim); letter-spacing: 0.12em; }
.story-card .title { font-size: 0.95rem; line-height: 1.9; margin: 0.5rem 0 0.8rem; letter-spacing: 0.08em; }
.story-card .foot { display: flex; justify-content: space-between; align-items: center; color: var(--ink-dim); font-size: 0.65rem; letter-spacing: 0.1em; }
.story-card .del {
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
  font-family: var(--serif); font-size: 0.65rem; letter-spacing: 0.1em;
}
.story-card .del:hover { color: var(--danger); }
.archive-empty { text-align: center; color: var(--ink-dim); font-size: 0.85rem; padding: 4rem 0; }

/* ---------- 設定ポップ ---------- */
.settings-pop {
  position: fixed; top: 3.6rem; right: 1rem; z-index: 60;
  background: var(--bg2); border: 1px solid var(--line);
  padding: 1.2rem 1.4rem; width: min(320px, 90vw); display: none;
}
.settings-pop.open { display: block; }
.settings-pop h3 { font-size: 0.85rem; letter-spacing: 0.25em; color: var(--gold); margin-bottom: 0.9rem; }
.settings-pop label { display: block; font-size: 0.78rem; color: var(--ink-dim); margin-bottom: 0.4rem; }
.settings-pop select { width: 100%; margin-bottom: 0.9rem; }
.settings-pop .desc { font-size: 0.68rem; color: var(--ink-dim); line-height: 1.8; }

/* ---------- モーダル(収蔵詳細) ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 70; background: rgba(10, 12, 20, 0.86);
  display: none; overflow-y: auto; padding: 3rem 1rem;
}
.modal-back.open { display: block; }
.modal-inner { max-width: 800px; margin: 0 auto; background: var(--bg); }
.modal-close { position: sticky; top: 0; text-align: right; padding: 0.4rem; }

footer {
  text-align: center; color: var(--ink-dim); font-size: 0.65rem;
  letter-spacing: 0.2em; padding: 2rem 1rem 6rem; opacity: 0.7;
}

@media (max-width: 600px) {
  .hero-title { font-size: 1.7rem; letter-spacing: 0.3em; }
  main { padding: 1.2rem 0.9rem 7rem; }
  .frame { padding: 1.4rem 1rem; }
  .hypothesis-frame h2 { font-size: 1.15rem; }
}
