:root {
  --ink: #2b1b40;
  --ink-deep: #2a1350;
  --muted: #6d5f86;
  --gold: #f2a93b;
  --violet: #5b3fd1;
  --purple: #8c36c9;
  --magenta: #c93a63;
  --orange: #f0761e;
  --blue: #2f6be0;
  --panel: rgba(255,255,255,.72);
  --panel-strong: rgba(255,255,255,.9);
  --line: rgba(140,54,201,.22);
  --shadow: 0 28px 60px rgba(42,19,80,.16);
  --shadow-soft: 0 14px 32px rgba(42,19,80,.11);
  font-family: Georgia, "Times New Roman", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 8% -5%, rgba(240,118,30,.16), transparent 38%),
    radial-gradient(circle at 96% 4%, rgba(47,107,224,.16), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(140,54,201,.14), transparent 45%),
    linear-gradient(135deg,#f7f1ea 0%,#f2eefb 52%,#eaf1fb 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: linear-gradient(rgba(91,63,209,.08) 1px,transparent 1px),linear-gradient(90deg,rgba(91,63,209,.08) 1px,transparent 1px);
  background-size: 76px 76px;
  mask-image: linear-gradient(to bottom,black,transparent 72%);
}
button, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
button:disabled { opacity: .62; cursor: default; transform: none !important; }

.topbar {
  width: min(1340px, calc(100% - 2rem));
  min-height: 78px;
  margin: 16px auto 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 12px;
  z-index: 30;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.74);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}
.brand { display: flex; gap: .8rem; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg,var(--violet),var(--purple) 58%,var(--magenta));
  box-shadow: 0 10px 22px rgba(91,63,209,.24);
}
.brand-mark::before { content: ""; width: 24px; height: 14px; border: 2px solid rgba(255,255,255,.94); border-radius: 50%; }
.brand-mark span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); position: absolute; }
.brand strong {
  display: block;
  font-size: 1.08rem;
  background: linear-gradient(100deg,var(--ink-deep),var(--violet) 42%,var(--magenta) 72%,var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand small { display: block; color: var(--muted); font-size: .74rem; letter-spacing: .13em; text-transform: uppercase; }
.menu-button, .duration-options button, .secondary, .ghost-button, .carousel-button {
  border: 1px solid rgba(91,63,209,.22);
  background: rgba(255,255,255,.9);
  color: #3d2564;
  border-radius: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.menu-button { padding: .72rem 1rem; }
.menu-button:hover, .duration-options button:hover, .secondary:hover, .ghost-button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(91,63,209,.12); }
.topbar nav {
  position: absolute;
  right: 10px;
  top: 70px;
  min-width: 250px;
  padding: .55rem;
  display: none;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.topbar nav.open { display: grid; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: .72rem .85rem; border-radius: 12px; font-weight: 700; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: #3d2564; background: rgba(91,63,209,.09); }
.offline-status {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.84);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  color: var(--muted);
  font-size: .8rem;
}
.offline-status span { width: 9px; height: 9px; border-radius: 50%; background: #53a77a; box-shadow: 0 0 0 4px rgba(83,167,122,.13); }
.offline-status.waiting span { background: var(--orange); box-shadow: 0 0 0 4px rgba(240,118,30,.13); }

#app { min-height: calc(100vh - 94px); position: relative; z-index: 1; }
.page { width: min(1240px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem,5vw,4.8rem) 0 6rem; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.page-head h1, .start-copy h1 {
  margin: .5rem 0 0;
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.035em;
  background: linear-gradient(100deg,var(--ink-deep) 0%,var(--violet) 38%,var(--magenta) 68%,var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-head h1 { font-size: clamp(2.45rem,5vw,4.8rem); }
.page-head p { max-width: 580px; margin: 0; color: #4c3f63; }
.eyebrow, .kicker {
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.eyebrow { display: inline-flex; width: max-content; padding: .46rem .72rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.62); }

.start-shell {
  width: min(1340px, calc(100% - 2rem));
  min-height: calc(100vh - 110px);
  margin: 0 auto;
  padding: clamp(1.5rem,4vw,3.6rem) 0 5rem;
  display: grid;
  grid-template-columns: minmax(0,1.1fr) minmax(350px,.75fr);
  gap: 24px;
  align-items: stretch;
}
.start-copy, .setup-card, .archive-control {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.start-copy { padding: clamp(2rem,5vw,4.5rem); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.start-copy::before, .start-copy::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.start-copy::before { width: 260px; height: 260px; right: -80px; top: -100px; background: radial-gradient(circle,rgba(240,118,30,.2),transparent 70%); }
.start-copy::after { width: 330px; height: 330px; left: -150px; bottom: -170px; background: radial-gradient(circle,rgba(91,63,209,.2),transparent 70%); }
.start-copy > * { position: relative; z-index: 1; }
.start-copy h1 { font-size: clamp(3.35rem,7.2vw,7rem); }
.start-copy h1 em { font-style: italic; font-weight: 400; }
.lead { margin: 1.3rem 0 0; max-width: 680px; color: #4c3f63; font-size: clamp(1.08rem,2vw,1.38rem); line-height: 1.62; }
.journey-notes { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.5rem; }
.journey-notes span { padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.62); color: #4d4160; font-size: .92rem; }
.setup-card { padding: clamp(1.4rem,3vw,2.2rem); display: flex; flex-direction: column; justify-content: center; }
.setup-card h2 { margin: .2rem 0 .5rem; color: #3d2564; font-size: clamp(1.65rem,3vw,2.25rem); font-weight: 500; }
.setup-card > p { margin: 0; color: #4c3f63; }
.setup-label { margin: 1.4rem 0 .65rem; color: var(--muted); font-size: .76rem; letter-spacing: .17em; text-transform: uppercase; }
.duration-options { display: grid; grid-template-columns: repeat(3,1fr); gap: .55rem; }
.duration-options button { min-height: 52px; padding: .7rem .45rem; }
.duration-options button.active { color: #fff; border-color: transparent; background: linear-gradient(120deg,var(--violet),var(--purple) 55%,var(--magenta)); box-shadow: 0 12px 24px rgba(91,63,209,.25); }
.primary, .soft {
  min-height: 50px;
  padding: .78rem 1rem;
  border-radius: 16px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: transform .14s ease, box-shadow .14s ease;
}
.primary { color: #fff; background: linear-gradient(120deg,var(--violet),var(--purple) 55%,var(--magenta)); box-shadow: 0 12px 24px rgba(91,63,209,.26); }
.primary:hover, .soft:hover { transform: translateY(-1px); }
.soft { color: #7a3d13; border: 1px solid rgba(240,118,30,.3); background: linear-gradient(135deg,rgba(240,118,30,.2),rgba(242,169,59,.16)); }
.wide { width: 100%; margin-top: .75rem; }
.archive-meter { margin-top: .8rem; padding: .72rem .85rem; border-radius: 14px; background: rgba(91,63,209,.07); color: #5c5072; font-size: .88rem; }
.archive-meter strong { color: #3d2564; }
.mini-note { display: flex; align-items: center; gap: .55rem; margin-top: .85rem; color: var(--muted); font-size: .82rem; }
.resume-box { margin-top: 1rem; padding: .9rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.5); }
.resume-box strong { display: block; color: #3d2564; }
.resume-box span { color: var(--muted); font-size: .86rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: .9rem; }
.button-row > * { padding: .7rem .9rem; display: inline-grid; place-items: center; text-decoration: none; }

.play-page { width: min(1340px,calc(100% - 2rem)); min-height: calc(100vh - 110px); margin: 0 auto; padding: clamp(1.5rem,3vw,2.5rem) 0 3rem; display: grid; grid-template-rows: auto 1fr auto; gap: 1rem; }
.play-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow-soft); backdrop-filter: blur(12px); }
.play-meta { color: var(--muted); font-size: .78rem; letter-spacing: .15em; text-transform: uppercase; }
.play-meta.right { text-align: right; }
.timer { --progress: 100%; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--orange) var(--progress),rgba(91,63,209,.12) 0); }
.timer::before { content: ""; position: absolute; inset: 5px; border-radius: inherit; background: rgba(255,255,255,.94); }
.timer strong { position: relative; z-index: 1; color: #3d2564; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pair-stage { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(.75rem,2vw,1.5rem); align-items: center; }
.choice-card { min-width: 0; padding: 0; position: relative; overflow: hidden; cursor: pointer; border: 1px solid rgba(255,255,255,.8); border-radius: 28px; background: #fff; box-shadow: 0 30px 70px rgba(42,19,80,.2); }
.choice-card .photo-frame { aspect-ratio: 3/2; }
.choice-card::after { content: ""; position: absolute; inset: 0; border: 5px solid transparent; border-radius: 28px; pointer-events: none; transition: border-color .15s ease; }
.choice-card:hover::after { border-color: rgba(255,255,255,.78); }
.choice-card.selected::after { border-color: var(--orange); }
.select-label { position: absolute; left: 1rem; bottom: 1rem; z-index: 3; padding: .55rem .82rem; border: 1px solid rgba(255,255,255,.7); border-radius: 999px; background: rgba(255,255,255,.84); color: #3d2564; font-weight: 700; box-shadow: 0 8px 20px rgba(42,19,80,.13); backdrop-filter: blur(8px); }
.choice-card.selected .select-label { color: #fff; border-color: transparent; background: linear-gradient(120deg,var(--violet),var(--purple) 55%,var(--magenta)); }
.play-instruction { min-height: 1.5rem; text-align: center; color: var(--muted); }
.pause-stage { min-height: min(64vh,680px); display: grid; place-items: center; text-align: center; border: 1px solid var(--line); border-radius: 30px; background: var(--panel); box-shadow: var(--shadow); }
.pulse { width: 92px; height: 92px; margin: auto; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; position: relative; background: rgba(255,255,255,.6); }
.pulse::after { content: ""; position: absolute; inset: 14px; border-radius: inherit; background: linear-gradient(135deg,var(--violet),var(--magenta),var(--orange)); opacity: .5; animation: breathe 1.6s ease-in-out infinite; }
.pause-stage h2 { margin: 1.2rem 0 .3rem; font-size: clamp(2.5rem,6vw,5rem); font-weight: 500; color: #3d2564; }
.pause-stage p { color: var(--muted); }
@keyframes breathe { 50% { transform: scale(.64); opacity: .82; } }

.photo-frame { position: relative; overflow: hidden; background: linear-gradient(135deg,#e9e0f4,#eff3fb); }
.photo-frame .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; pointer-events: none; }
.photo-frame .sprite { position: absolute; width: 400%; height: 400%; max-width: none; object-fit: fill; user-select: none; pointer-events: none; }
.photo-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg,transparent 58%,rgba(42,19,80,.15)); pointer-events: none; }
.photo-badge { position: absolute; top: .8rem; left: .8rem; z-index: 2; padding: .38rem .62rem; border: 1px solid rgba(255,255,255,.65); border-radius: 999px; background: rgba(255,255,255,.82); color: #3d2564; font-size: .75rem; font-weight: 700; box-shadow: 0 8px 20px rgba(42,19,80,.1); backdrop-filter: blur(8px); }
.photo-badge.chosen { color: #fff; border-color: transparent; background: linear-gradient(120deg,var(--violet),var(--purple) 55%,var(--magenta)); }
.photo-badge.open { color: #7a3d13; background: rgba(255,244,225,.88); }

.summary-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: .8rem; margin-bottom: 2rem; }
.metric { padding: 1.15rem; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow-soft); }
.metric strong { display: block; color: #3d2564; font-size: 1.95rem; line-height: 1; }
.metric span { color: var(--muted); font-size: .86rem; }
.reflection-list { display: grid; gap: 1rem; }
.reflection-pair { display: grid; grid-template-columns: 90px 1fr 1fr; gap: .85rem; align-items: stretch; padding: .85rem; border: 1px solid var(--line); border-radius: 26px; background: var(--panel); box-shadow: var(--shadow-soft); backdrop-filter: blur(12px); }
.pair-index { display: grid; align-content: center; justify-items: center; border-right: 1px solid var(--line); color: var(--muted); }
.pair-index strong { color: #3d2564; font-size: 1.65rem; }
.reflection-item { min-width: 0; }
.reflection-item .photo-frame { aspect-ratio: 16/9; border-radius: 18px; }
.field-label { display: flex; justify-content: space-between; gap: 1rem; margin: .7rem .15rem .4rem; color: var(--muted); font-size: .8rem; }
.field-label b { color: #3d2564; }
textarea { width: 100%; min-height: 88px; resize: vertical; padding: .75rem; border: 1px solid rgba(91,63,209,.24); border-radius: 14px; background: rgba(255,255,255,.8); color: var(--ink); line-height: 1.48; }
textarea::placeholder { color: #8d819c; }

.carousel-shell { display: grid; grid-template-columns: 56px minmax(0,840px) 56px; gap: 1rem; justify-content: center; align-items: center; }
.carousel-button { width: 56px; height: 56px; border-radius: 50%; font-size: 1.4rem; }
.carousel-card { padding: .9rem; border: 1px solid var(--line); border-radius: 28px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.carousel-card .photo-frame { aspect-ratio: 16/9; border-radius: 21px; }
.carousel-copy { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; padding: .9rem .25rem .1rem; }
.carousel-copy h2 { margin: .15rem 0; color: #3d2564; font-size: 1.35rem; }
.carousel-copy p { margin: .2rem 0; color: var(--muted); font-size: .9rem; }
.carousel-dots { display: flex; gap: .42rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.carousel-dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: rgba(91,63,209,.22); cursor: pointer; }
.carousel-dots button.active { background: var(--orange); transform: scale(1.35); }
.empty-state { padding: 3rem; text-align: center; border: 1px dashed var(--line); border-radius: 24px; background: var(--panel); color: var(--muted); }

.report-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.report-actions button { padding: .75rem 1rem; }
.report-sheet { padding: clamp(1.5rem,4vw,3.5rem); border: 1px solid rgba(91,63,209,.14); border-radius: 28px; background: rgba(255,255,255,.95); color: #2b1b40; box-shadow: var(--shadow); }
.report-brand { display: flex; justify-content: space-between; gap: 2rem; padding-bottom: 1rem; margin-bottom: 1.5rem; border-bottom: 3px solid var(--violet); }
.report-brand strong { color: #3d2564; font-size: 1.28rem; }
.report-brand span { color: var(--muted); font-size: .88rem; }
.report-sheet h2 { margin: 2rem 0 .75rem; color: #3d2564; font-size: 1.3rem; }
.report-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: .75rem; }
.report-stat { padding: .95rem; border: 1px solid rgba(91,63,209,.14); border-radius: 16px; background: linear-gradient(135deg,rgba(91,63,209,.08),rgba(240,118,30,.07)); }
.report-stat strong { display: block; color: #3d2564; font-size: 1.6rem; }
.report-entry { padding: 1rem 0; border-top: 1px solid rgba(91,63,209,.16); break-inside: avoid; }
.report-entry h3 { margin: 0 0 .5rem; color: #3d2564; font-size: 1rem; }
.report-entry p { margin: .25rem 0; font-size: .92rem; }
.dim { color: var(--muted); }
.print-hint { margin-top: .8rem; color: var(--muted); font-size: .84rem; }

.archive-control { margin-bottom: 1.25rem; padding: 1.3rem 1.45rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.archive-control h2 { margin: .15rem 0; color: #3d2564; font-size: 1.45rem; }
.archive-control p { margin: 0; color: var(--muted); }
.archive-control button { min-width: 250px; }
.source-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; }
.source-card { padding: 1.35rem; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow-soft); }
.source-card.featured { background: linear-gradient(135deg,rgba(255,255,255,.86),rgba(241,232,253,.76)); }
.source-card h2 { margin: .25rem 0; color: #3d2564; font-size: 1.38rem; }
.source-card p { color: #4c3f63; }
.source-card a { color: var(--purple); font-weight: 700; }
.source-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.source-note { margin-top: 1.25rem; padding: 1.2rem 1.25rem; border: 1px solid rgba(240,118,30,.24); border-left: 4px solid var(--orange); border-radius: 16px; background: rgba(255,255,255,.6); color: #5c5072; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 50; padding: .78rem 1.05rem; border-radius: 999px; background: #3d2564; color: #fff; font-weight: 700; box-shadow: var(--shadow); transform: translate(-50%,120px); transition: transform .25s ease; }
.toast.show { transform: translate(-50%,0); }

@media (max-width: 960px) {
  .start-shell { grid-template-columns: 1fr; }
  .start-copy h1 { font-size: clamp(3rem,12vw,6.2rem); }
  .page-head { align-items: start; flex-direction: column; }
  .reflection-pair { grid-template-columns: 70px 1fr; }
  .reflection-item:last-child { grid-column: 2; }
  .pair-index { grid-row: span 2; }
  .archive-control { align-items: stretch; flex-direction: column; }
  .archive-control button { min-width: 0; }
}
@media (max-width: 680px) {
  .topbar { width: min(100% - 1rem,1340px); min-height: 68px; margin-top: 8px; top: 6px; border-radius: 19px; }
  .brand small { display: none; }
  .offline-status { display: none; }
  .start-shell, .page, .play-page { width: calc(100% - 1rem); }
  .start-shell { min-height: calc(100vh - 85px); padding-top: .8rem; }
  .start-copy, .setup-card { border-radius: 24px; }
  .start-copy { padding: 2rem 1.35rem; }
  .start-copy h1 { font-size: clamp(2.8rem,14vw,4.4rem); }
  .duration-options { gap: .35rem; }
  .duration-options button { font-size: .9rem; }
  .play-page { min-height: calc(100vh - 85px); padding-top: .8rem; }
  .pair-stage { gap: .45rem; }
  .choice-card { border-radius: 18px; }
  .choice-card::after { border-width: 3px; border-radius: 18px; }
  .choice-card .photo-frame { aspect-ratio: 4/5; }
  .select-label { left: .45rem; bottom: .45rem; padding: .38rem .48rem; font-size: .74rem; }
  .play-head { padding: .55rem .7rem; }
  .play-meta { font-size: .64rem; }
  .timer { width: 52px; height: 52px; }
  .summary-strip, .report-grid, .source-grid { grid-template-columns: 1fr; }
  .reflection-pair { grid-template-columns: 1fr; }
  .pair-index { grid-row: auto; display: flex; justify-content: flex-start; gap: .4rem; padding-bottom: .6rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .reflection-item:last-child { grid-column: auto; }
  .carousel-shell { grid-template-columns: 42px minmax(0,1fr) 42px; gap: .4rem; }
  .carousel-button { width: 42px; height: 42px; }
  .carousel-copy { grid-template-columns: 1fr; }
  .report-actions { width: 100%; }
  .report-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; color: #222; }
  body::before, .topbar, .offline-status, .page-head, .report-actions, .print-hint, .toast { display: none !important; }
  #app, .page { width: 100%; min-height: 0; margin: 0; padding: 0; }
  .report-sheet { padding: 0; border: 0; box-shadow: none; }
  .report-entry { break-inside: avoid; }
}
