/* ==========================================================================
   宇宙一生 / Cosmic Lifetime
   ========================================================================== */

:root {
  --bg: #030609;
  --text: #e9e7df;
  --text-bright: #f8f5ed;
  --muted: #929ba2;
  --faint: #5c666e;
  --line: rgba(235, 240, 242, 0.12);
  --line-soft: rgba(235, 240, 242, 0.07);
  --accent: #d9c3a0;
  --accent-cool: #a9c1ca;
  --sans: "Avenir Next", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Times New Roman", serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", "Liberation Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { color: inherit; font: inherit; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 1px solid rgba(217, 195, 160, 0.9);
  outline-offset: 4px;
}
::selection { color: #16120b; background: var(--accent); }
svg { display: block; }

/* Loading ------------------------------------------------------------------ */

.story-loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #030609;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.story-loading.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.story-loading-mark { position: relative; width: 52px; height: 52px; display: grid; place-items: center; }
.story-loading-mark i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px rgba(217,195,160,.8); }
.story-loading-mark i:nth-child(1) { animation: story-orbit 2.6s linear infinite; }
.story-loading-mark i:nth-child(2) { animation: story-orbit 2.6s linear infinite reverse; animation-delay: -0.9s; opacity: .65; }
.story-loading-mark i:nth-child(3) { width: 3px; height: 3px; opacity: .45; }
@keyframes story-orbit {
  0% { transform: rotate(0) translateX(21px); }
  100% { transform: rotate(360deg) translateX(21px); }
}
.story-loading > span { font-family: var(--mono); font-size: 8px; letter-spacing: .18em; color: rgba(187,188,175,.7); }
.story-loading > b { font-family: var(--mono); font-size: 7px; font-weight: 400; color: rgba(217,195,160,.6); }

/* Scene -------------------------------------------------------------------- */

.story-scene { position: fixed; inset: 0; z-index: 0; }
.story-scene canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.story-scene canvas.is-dragging { cursor: grabbing; }

.story-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 48% 48%, transparent 38%, rgba(3,6,9,.34) 100%),
    linear-gradient(90deg, rgba(3,6,9,.56) 0%, transparent 31%, transparent 68%, rgba(3,6,9,.44) 100%),
    linear-gradient(0deg, rgba(3,6,9,.62) 0%, transparent 20%);
}

/* Topbar ------------------------------------------------------------------- */

.story-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  pointer-events: none;
}
.story-brand { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.story-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid rgba(217,195,160,.3); border-radius: 50%;
  color: rgba(239,208,153,.96);
}
.story-mark svg { width: 30px; height: 30px; }
.story-brand-copy { display: flex; flex-direction: column; gap: 4px; }
.story-brand-copy > span { font-size: 15px; font-weight: 500; letter-spacing: .09em; color: rgba(243,239,230,.94); }
.story-brand-copy small { font-family: var(--mono); font-size: 6px; letter-spacing: .2em; color: rgba(141,151,156,.8); }

.story-status {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 7px; letter-spacing: .1em;
  color: rgba(160,165,160,.75); white-space: nowrap;
}
.story-status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(217,195,160,.7); }
.story-status i { width: 28px; height: 1px; background: rgba(235,240,242,.14); }
.story-status span:last-child { color: rgba(196,191,176,.78); }

.story-actions { display: flex; align-items: center; gap: 5px; pointer-events: auto; }
.story-actions a {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(5,9,13,.5);
  font-family: var(--mono); font-size: 8px; letter-spacing: .05em;
  color: rgba(210,207,198,.78);
  backdrop-filter: blur(14px);
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.story-actions a span { opacity: .55; }
.story-actions a:hover { border-color: rgba(217,195,160,.45); color: var(--text-bright); background: rgba(16,21,26,.8); }

/* Copy --------------------------------------------------------------------- */

.story-copy {
  position: fixed;
  left: 44px;
  top: 128px;
  z-index: 8;
  width: 430px;
  max-width: 42vw;
  pointer-events: none;
}
.story-kicker {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 7px; letter-spacing: .15em;
  color: rgba(203,182,146,.78);
}
.story-kicker i { width: 5px; height: 5px; border-radius: 50%; background: #dfb676; box-shadow: 0 0 10px rgba(223,182,118,.7); }
.story-copy h1 {
  margin: 17px 0 0;
  font-family: var(--serif);
  font-size: clamp(47px, 5vw, 74px);
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: .035em;
  color: rgba(245,241,231,.97);
  text-shadow: 0 2px 34px rgba(0,0,0,.2);
}
.story-copy h1 em { font-style: normal; color: #ddb77d; }
.story-age { display: flex; align-items: center; gap: 12px; margin-top: 19px; font-family: var(--mono); font-size: 9px; letter-spacing: .05em; color: rgba(183,174,157,.82); }
.story-age span + span::before { content: "·"; margin-right: 12px; color: rgba(112,120,122,.75); }
.story-copy > p {
  margin: 17px 0 0;
  max-width: 370px;
  font-size: 12px;
  line-height: 1.85;
  color: rgba(151,160,163,.92);
}
.story-scroll-note {
  display: flex; align-items: center; gap: 9px;
  margin-top: 24px;
  padding-top: 12px;
  width: 300px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 6.5px; letter-spacing: .07em;
  color: rgba(116,126,130,.72);
}
.story-scroll-note i { width: 17px; height: 1px; background: rgba(217,195,160,.35); }

/* Panel -------------------------------------------------------------------- */

.story-panel {
  position: fixed;
  top: 108px;
  right: 34px;
  bottom: 146px;
  z-index: 20;
  width: 356px;
  padding: 19px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(6,10,15,.74);
  box-shadow: 0 22px 70px rgba(0,0,0,.28);
  backdrop-filter: blur(22px) saturate(.9);
  -webkit-backdrop-filter: blur(22px) saturate(.9);
  scrollbar-width: thin;
  scrollbar-color: rgba(174,160,135,.3) transparent;
  pointer-events: auto;
}
.story-panel-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 6.5px; letter-spacing: .12em;
  color: rgba(140,150,153,.72);
}
.story-panel h2 {
  margin: 14px 0 0;
  font-family: var(--serif); font-size: 30px; font-weight: 400; line-height: 1.15;
  letter-spacing: .03em; color: rgba(247,242,231,.96);
}
.story-panel-copy { margin: 13px 0 0; font-size: 11px; line-height: 1.75; color: rgba(145,155,158,.9); }
.story-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  margin-top: 17px;
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
}
.story-stats div { display: flex; flex-direction: column; gap: 4px; padding: 10px 7px; }
.story-stats div:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--line-soft); }
.story-stats div:nth-child(-n+2) { border-bottom: 1px solid rgba(235,240,242,.035); }
.story-stats span { font-family: var(--mono); font-size: 6.5px; letter-spacing: .06em; color: rgba(117,127,131,.86); }
.story-stats strong { font-family: var(--mono); font-size: 9.5px; font-weight: 400; color: rgba(226,222,211,.92); }
.story-facts { margin: 16px 0 0; padding: 0; list-style: none; }
.story-facts li {
  position: relative; padding: 0 0 10px 13px;
  font-size: 10px; line-height: 1.6; color: rgba(150,159,161,.88);
}
.story-facts li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 4px; height: 4px; border-radius: 50%; background: rgba(217,195,160,.55);
}
.story-link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px; min-height: 36px; padding: 0 12px;
  border: 1px solid rgba(255,255,255,.11); border-radius: 2px;
  font-family: var(--mono); font-size: 8px; color: rgba(222,215,202,.9);
  transition: border-color .2s ease, background .2s ease;
}
.story-link span { opacity: .6; }
.story-link:hover { border-color: rgba(217,195,160,.42); background: rgba(217,195,160,.06); }
.story-disclaimer { margin: 15px 0 0; font-size: 8.5px; line-height: 1.65; color: rgba(103,114,118,.72); }

/* Timeline ----------------------------------------------------------------- */

.story-timeline {
  position: fixed;
  left: 26px;
  right: 26px;
  bottom: 20px;
  z-index: 30;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr) 172px;
  align-items: center;
  gap: 22px;
  min-height: 88px;
  padding: 12px 16px;
  border: 1px solid rgba(235,240,242,.14);
  border-radius: 3px;
  background: rgba(5,9,13,.78);
  box-shadow: 0 18px 60px rgba(0,0,0,.3);
  backdrop-filter: blur(20px) saturate(.9);
  -webkit-backdrop-filter: blur(20px) saturate(.9);
}
.story-now { display: flex; align-items: center; gap: 10px; }
.story-play {
  flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid rgba(217,195,160,.32); border-radius: 50%;
  background: rgba(217,195,160,.08); color: #e8ceA4;
  transition: border-color .2s ease, background .2s ease;
}
.story-play:hover { border-color: rgba(217,195,160,.62); background: rgba(217,195,160,.14); }
.story-play svg { width: 19px; height: 19px; }
.story-pause-icon { display: none; }
.story-now.is-playing .story-play-icon { display: none; }
.story-now.is-playing .story-pause-icon { display: block; }
.story-now-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.story-now-copy span { font-family: var(--mono); font-size: 6.5px; letter-spacing: .09em; color: rgba(139,149,152,.85); }
.story-now-copy b { font-family: var(--mono); font-size: 9px; font-weight: 400; color: rgba(230,221,204,.92); white-space: nowrap; }

.story-track-wrap { position: relative; min-width: 0; padding-top: 21px; }
.story-ticks { position: absolute; left: 0; right: 0; top: 0; height: 17px; pointer-events: none; }
.story-tick {
  position: absolute; top: 0; transform: translateX(-50%);
  padding: 0; border: 0; background: transparent;
  font-family: var(--mono); font-size: 6px; letter-spacing: .04em;
  color: rgba(129,139,143,.72); white-space: nowrap; pointer-events: auto;
  transition: color .2s ease;
}
.story-tick::after {
  content: ""; display: block; width: 1px; height: 4px; margin: 3px auto 0;
  background: rgba(189,196,193,.24);
}
.story-tick:hover, .story-tick.is-active { color: rgba(232,213,181,.94); }
.story-tick.is-active::after { background: rgba(217,195,160,.85); }

#story-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
#story-range::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(99,112,117,.5), rgba(217,195,160,.55) 82%, rgba(135,109,140,.6));
}
#story-range::-moz-range-track {
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(99,112,117,.5), rgba(217,195,160,.55) 82%, rgba(135,109,140,.6));
}
#story-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px; margin-top: -4.5px;
  border: 1px solid rgba(14,16,16,.7); border-radius: 50%;
  background: #e7d0a8; box-shadow: 0 0 0 4px rgba(217,195,160,.12), 0 0 15px rgba(217,195,160,.45);
}
#story-range::-moz-range-thumb {
  width: 10px; height: 10px;
  border: 1px solid rgba(14,16,16,.7); border-radius: 50%;
  background: #e7d0a8; box-shadow: 0 0 0 4px rgba(217,195,160,.12), 0 0 15px rgba(217,195,160,.45);
}
.story-track-meta { display: flex; justify-content: space-between; margin-top: 3px; font-family: var(--mono); font-size: 6px; letter-spacing: .05em; color: rgba(107,118,122,.68); }
.story-now-mark { color: rgba(217,195,160,.78); }

.story-actions-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.story-today, .story-info {
  height: 34px; padding: 0 11px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 2px;
  background: rgba(255,255,255,.018);
  font-family: var(--mono); font-size: 7.5px; color: rgba(207,203,192,.86);
}
.story-today:hover, .story-info:hover { border-color: rgba(217,195,160,.4); background: rgba(217,195,160,.06); color: var(--text-bright); }
.story-info { display: none; }

/* Flash -------------------------------------------------------------------- */

.story-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #e9dcc2;
  opacity: 0;
  pointer-events: none;
}
.story-flash.is-active { animation: story-flash .6s var(--ease); }
@keyframes story-flash {
  0% { opacity: .36; }
  100% { opacity: 0; }
}

/* Responsive --------------------------------------------------------------- */

@media (max-width: 1120px) {
  .story-copy { left: 30px; width: 390px; }
  .story-copy h1 { font-size: clamp(44px, 5.4vw, 64px); }
  .story-panel { width: 326px; right: 22px; }
  .story-timeline { left: 18px; right: 18px; grid-template-columns: 170px minmax(0, 1fr) 150px; gap: 15px; }
  .story-topbar { padding: 0 26px; }
}

@media (max-width: 900px) {
  .story-topbar { height: 68px; padding: 0 15px; }
  .story-mark { width: 35px; height: 35px; }
  .story-mark svg { width: 25px; height: 25px; }
  .story-brand-copy > span { font-size: 13px; }
  .story-brand-copy small { font-size: 5px; }
  .story-status { display: none; }
  .story-actions a { height: 31px; padding: 0 9px; font-size: 7px; }

  .story-copy { top: 92px; left: 18px; width: min(330px, 82vw); max-width: none; }
  .story-copy h1 { margin-top: 13px; font-size: 42px; }
  .story-age { margin-top: 13px; font-size: 8px; }
  .story-copy > p { margin-top: 12px; max-width: 310px; font-size: 10.5px; line-height: 1.7; }
  .story-scroll-note { display: none; }

  .story-panel {
    top: auto; left: 10px; right: 10px; bottom: 116px;
    width: auto; max-height: min(48vh, 370px);
    display: none; padding: 17px;
  }
  .story-panel.is-open { display: block; }
  .story-panel h2 { font-size: 25px; }
  .story-info { display: inline-flex; align-items: center; }

  .story-timeline {
    left: 10px; right: 10px; bottom: 10px;
    grid-template-columns: 1fr auto;
    grid-template-areas: "track track" "now actions";
    gap: 10px 14px;
    padding: 10px 12px;
    min-height: 0;
  }
  .story-track-wrap { grid-area: track; padding-top: 18px; }
  .story-now { grid-area: now; }
  .story-actions-bottom { grid-area: actions; }
  .story-play { width: 38px; height: 38px; }
  .story-play svg { width: 17px; height: 17px; }
  .story-now-copy b { font-size: 8px; }
  .story-tick { font-size: 5.5px; }
  .story-tick:nth-child(even) { display: none; }
  .story-now-mark { display: none; }
  .story-track-meta { font-size: 5.5px; }
  .story-today { height: 31px; padding: 0 9px; font-size: 7px; }
}

@media (max-width: 560px) {
  .story-copy { top: 82px; width: min(290px, 80vw); }
  .story-copy h1 { font-size: 36px; }
  .story-copy > p { max-width: 275px; font-size: 10px; }
  .story-kicker { font-size: 6px; }
  .story-age { font-size: 7.5px; }
  .story-brand-copy > span { font-size: 12px; }
  .story-actions a { font-size: 6.5px; padding: 0 8px; }
  .story-actions a span { display: none; }
  .story-panel { bottom: 118px; max-height: min(48vh, 355px); padding: 15px; }
  .story-timeline { left: 6px; right: 6px; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); padding: 9px 10px; }
  .story-now-copy span { font-size: 6px; }
  .story-now-copy b { font-size: 7.5px; }
  .story-play { width: 35px; height: 35px; }
  .story-tick { font-size: 5px; letter-spacing: 0; }
  .story-track-meta { font-size: 5px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .story-topbar { height: 52px; }
  .story-copy { top: 62px; left: 14px; width: 270px; }
  .story-copy h1 { font-size: 30px; margin-top: 8px; }
  .story-copy > p { display: none; }
  .story-age { margin-top: 8px; }
  .story-panel { top: 55px; bottom: auto; right: 10px; left: auto; width: 270px; max-height: 62vh; display: none; }
  .story-panel.is-open { display: block; }
  .story-timeline {
    left: 8px; right: 8px; bottom: 7px;
    grid-template-columns: 150px minmax(0, 1fr) auto;
    grid-template-areas: none;
    gap: 12px; min-height: 64px; padding: 7px 10px;
  }
  .story-track-wrap { grid-area: auto; padding-top: 15px; }
  .story-now { grid-area: auto; }
  .story-actions-bottom { grid-area: auto; }
  .story-scroll-note { display: none; }
}

/* Readability + title fit (final pass) */
.story-copy { width: 470px; }
.story-tick { font-size: 7px; }
.story-track-meta { font-size: 6.5px; }
@media (max-width: 1120px) { .story-copy { width: 390px; } }
@media (max-width: 900px) { .story-copy { width: min(330px, 82vw); } .story-tick { font-size: 6px; } .story-track-meta { font-size: 5.8px; } }
@media (max-width: 560px) { .story-copy { width: min(290px, 80vw); } .story-tick { font-size: 5.4px; } .story-track-meta { font-size: 5.2px; } }
