:root {
  color-scheme: light;
  --ink: #1a3533; --muted: #536b68; --green: #175c51; --green-dark: #123d38;
  --wash: #eff5f1; --line: #cbdad2; --paper: #fbfcfa;
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.65; }
[hidden] { display: none !important; }
a { color: var(--green); text-underline-offset: .2em; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, select, input[type=search] { color: var(--ink); background: white; border: 1px solid #adbfba; padding: .55em .95em; border-radius: 8px; min-height: 44px; }
button:hover, .scene-entry:hover { background: var(--wash); }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid #008273; outline-offset: 3px; }
.sitebar { max-width: 1320px; margin: auto; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding: 14px clamp(18px,6vw,84px); }
.sitebar a { font-size:.9rem; text-decoration: none; }
a.wordmark { font-family: "Avenir Next", system-ui, sans-serif; font-weight:750; color:var(--green-dark); letter-spacing:.12em; }
.hero { position:relative; isolation:isolate; background: #183e3b url('scene-cover.jpg') center 55%/cover no-repeat; color:white; }
.hero::before { content:''; position:absolute; inset:0; z-index:-1; background:linear-gradient(90deg,rgba(10,37,34,.95) 0%,rgba(11,40,37,.77) 37%,rgba(14,42,40,.18) 78%); }
.hero-inner { max-width:1320px; margin:auto; padding: clamp(27px,4.7vw,65px) clamp(18px,6vw,84px); }
.hero h1 { font-size:clamp(2.3rem,5.4vw,4.5rem); line-height:1.15; letter-spacing:-.045em; margin:.22em 0 .32em; }
.hero p { margin:0; max-width:33em; font-size:clamp(.89rem,1.3vw,1rem); }
.catalog-body { max-width:1320px; margin:auto; padding:25px clamp(18px,6vw,84px) 64px; }
.controls, .toolbar, .actions, .finish, .scene-heading { display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; }
.controls, .scene-heading, .finish { justify-content:space-between; }
.filter-group, .study-tabs { display:inline-flex; flex-wrap:wrap; align-items:center; gap:5px; }
.filter-group button { border-radius:22px; padding:.4rem 1rem; }
button[aria-pressed=true], button.primary { background:var(--green); border-color:var(--green); color:white; }
button[aria-pressed=true]:hover, button.primary:hover { background:var(--green-dark); }
.search, .toolbar label { display:flex; align-items:center; gap:.5rem; font-size:.89rem; color:var(--muted); }
.search input { width:min(15rem,49vw); }
#groups { display:grid; gap:2.4rem 3rem; grid-template-columns:repeat(2,minmax(0,1fr)); }
.group h2 { margin:0; font-size:1.35rem; padding-bottom:.45rem; border-bottom:2px solid var(--green); }
.scene-entry { display:flex; justify-content:space-between; align-items:center; gap:.6rem; padding:.85rem .3rem; border-bottom:1px solid var(--line); text-decoration:none; color:var(--ink); }
.scene-entry .tail { color:var(--green); font-size:.85rem; white-space:nowrap; }
.subtle, .tip, .status { color:var(--muted); font-size:.89rem; }
#results { margin:.9rem 0 1.7rem; }
.reader { width:min(820px,100%); margin:auto; padding:24px clamp(18px,5vw,48px) 55px; }
.back { display:inline-block; margin-bottom:1.25rem; }
.category { color:var(--green); font-size:.9rem; font-weight:650; margin:0 0 .3rem; }
.scene-heading h1 { margin:0; font-size:clamp(1.6rem,4.25vw,2.65rem); line-height:1.3; letter-spacing:-.035em; }
.scene-heading button { font-size:.87rem; }
.context { margin:1rem 0 1.5rem; }
.study-tabs { display:flex; border-bottom:2px solid var(--green); margin:1rem 0; gap:.45rem; }
.study-tabs button { border-radius:8px 8px 0 0; border-bottom:0; }
.toolbar { margin:1rem 0; }
.toolbar input { accent-color:var(--green); width:18px; height:18px; }
.lines { list-style:none; margin:0; padding:0; }
.line { position:relative; border-top:1px solid var(--line); padding:14px 60px 14px 10px; }
.line.you { border-left:3px solid #77a997; padding-left:12px; background:#f1f6f2; }
.line.playing { box-shadow:inset 0 0 0 2px var(--green); }
.speaker { font-weight:650; font-size:.8rem; color:var(--muted); }
.en { font:600 clamp(1.12rem,2.65vw,1.42rem)/1.42 "Avenir Next", "Hiragino Sans", system-ui, sans-serif; overflow-wrap:anywhere; }
.line p { margin:.22rem 0; }
.line .ja { font-size:.94rem; }
.line button { position:absolute; right:8px; top:50%; transform:translateY(-50%); border-radius:50%; width:44px; padding:0; color:var(--green); }
.challenge, .role-box { background:#eef4ed; border:1px solid var(--line); border-radius:12px; padding:clamp(16px,3.7vw,28px); margin:1.35rem 0; }
.challenge h2, .role-box h2 { margin:0; font-size:1.22rem; }
.challenge summary { cursor:pointer; font-weight:650; color:var(--green); padding:.45rem 0; }
.tip { border-left:3px solid var(--line); padding-left:.85rem; margin:1.3rem 0; }
.finish { border-top:1px solid var(--line); padding-top:1.15rem; }
.status:empty { margin:0; }
#error { margin:2rem; }
@media(max-width:700px) {
  #groups { grid-template-columns:1fr; gap:1.75rem; }
  .hero::before { background:linear-gradient(90deg,rgba(10,37,34,.91),rgba(11,40,37,.73) 55%,rgba(11,40,37,.3)); }
  .controls { align-items:flex-start; } .search { width:100%; } .search input { flex:1; width:0; }
  .filter-group { gap:4px; } .filter-group button { padding:.42rem .78rem; }
  .reader { padding-top:15px; } .hero p:last-child { max-width:24em; }
}

.source-jump { display:inline-block; padding:.4rem 0; font-size:.94rem; }
.context:has(+ .source-jump) { margin-bottom:0; }
.scene-sources { border-top:2px solid var(--green); margin:1.6rem 0; padding:1rem 0 .15rem; }
.scene-sources h2 { font-size:1.25rem; margin:0 0 .7rem; }
.scene-sources ul { list-style:none; margin:0; padding:0; }
.scene-sources li { margin:.5rem 0; padding:.4rem 0; }
.scene-sources li + li { border-top:1px solid var(--line); padding-top:.9rem; }
.scene-sources p { margin:.2rem 0; }
.scene-sources .source-meta, .scene-sources .source-cue { font-size:.85rem; color:var(--muted); }
.scene-sources a { display:inline-block; font-weight:650; overflow-wrap:anywhere; padding:.3rem 0; }
.scene-sources .source-note { font-size:.95rem; }

.trip-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 1.1rem;
  margin-bottom: 1.6rem;
}
.trip-links a {
  display: grid;
  align-content: center;
  padding: .75rem .25rem;
  border-top: 2px solid var(--green);
  color: var(--ink);
  text-decoration: none;
}
.trip-links a:hover strong { text-decoration: underline; text-underline-offset: .22em; }
.trip-links span { font-size: .85rem; color: var(--muted); }
.scene-tools { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: .6rem; }
.scene-tools a { display: inline-block; padding: .65rem 0; font-size: .93rem; }
@media (max-width: 700px) {
  .trip-links { grid-template-columns: 1fr; gap: 0; }
  .trip-links a { border-top: 1px solid var(--line); padding: .6rem .15rem; }
}
