:root {
  --paper: #ffffff;
  --tile: #f6f6f4;
  --ink: #0b0b0b;
  --muted: rgba(0,0,0,.52);
  --faint: rgba(0,0,0,.28);
  --hair: rgba(0,0,0,.08);
  --chip: rgba(0,0,0,.055);
  --c-art: #f0359a;
  --c-type: #2d6bff;
  --c-print: #10a37f;
  --c-ru: #e8541f;
  --ease: cubic-bezier(.2,0,0,1);
  --bar-h: 56px;
  --axis: 58px;
  --panel-w: 420px;
}
*,*::before,*::after { box-sizing: border-box; }
html,body { margin:0; height:100%; overflow:hidden; background:var(--paper); color:var(--ink);
  font-family: Inter, InterVariable, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size:13px; line-height:1.4; -webkit-font-smoothing:antialiased; font-feature-settings:"cv11","ss01"; }
button { font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; }
h1,h2,h3,p { margin:0; }
[hidden] { display:none !important; }

.tl { position:fixed; inset:0; display:flex; flex-direction:column; }

/* ---------- top bar ---------- */
.bar { height:var(--bar-h); flex:none; display:flex; align-items:center; gap:14px; padding:0 14px;
  border-bottom:1px solid var(--hair); background:var(--paper); z-index:30; }
.bar__title { display:flex; flex-direction:column; min-width:0; }
.bar__title h1 { font-size:15px; font-weight:600; letter-spacing:-.01em; white-space:nowrap; }
.bar__sub { font-size:11px; color:var(--muted); white-space:nowrap; }

.search { position:relative; flex:1 1 260px; max-width:340px; }
.search input { width:100%; height:32px; border-radius:16px; border:0; background:var(--chip);
  padding:0 12px 0 32px; font:inherit; color:inherit; outline:none; transition:background .15s; }
.search input:focus { background:#fff; box-shadow:0 0 0 1.5px var(--ink); }
.search__ico { position:absolute; left:10px; top:8px; width:16px; height:16px; fill:none; stroke:var(--muted); stroke-width:1.8; }
.search__list { position:absolute; top:38px; left:0; right:0; margin:0; padding:6px; list-style:none; background:#fff;
  border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,.16), 0 0 0 1px var(--hair); max-height:60vh; overflow:auto; z-index:50; }
.search__list li { display:flex; gap:10px; align-items:center; padding:6px; border-radius:8px; cursor:pointer; }
.search__list li:hover, .search__list li.is-on { background:var(--chip); }
.search__list img { width:36px; height:36px; object-fit:cover; border-radius:6px; flex:none; background:var(--tile); }
.search__list b { display:block; font-weight:500; }
.search__list small { color:var(--muted); }

.lanes-filter { display:flex; gap:6px; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
.lanes-filter::-webkit-scrollbar { display:none; }
.lchip { display:inline-flex; align-items:center; gap:6px; height:28px; padding:0 10px; border-radius:14px; background:var(--chip);
  white-space:nowrap; font-size:12px; transition:opacity .15s, background .15s; }
.lchip i { width:8px; height:8px; border-radius:50%; background:var(--c); }
.lchip.is-off { opacity:.4; }
.lchip.is-off i { background:transparent; box-shadow:inset 0 0 0 1.5px var(--c); }

.bar__actions { margin-left:auto; display:flex; gap:6px; }
.pill { display:inline-flex; align-items:center; gap:6px; height:30px; padding:0 12px; border-radius:15px; background:var(--chip);
  font-size:12px; font-weight:500; white-space:nowrap; transition:background .15s, transform .1s; }
.pill:hover { background:rgba(0,0,0,.1); }
.pill:active { transform:scale(.97); }
.pill svg { width:12px; height:12px; fill:currentColor; }
.pill--black { background:var(--ink); color:#fff; }
.pill--black:hover { background:#333; }
.pill--icon { width:30px; padding:0; justify-content:center; }
.pill.is-on { background:var(--ink); color:#fff; }

/* ---------- stage ---------- */
.stage { position:relative; flex:1; overflow:hidden; touch-action:none; cursor:grab; user-select:none; -webkit-user-select:none; background:var(--paper); }
.stage.is-drag { cursor:grabbing; }

.axis { position:absolute; left:0; right:0; top:0; height:var(--axis); z-index:12; background:rgba(255,255,255,.92);
  backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); border-bottom:1px solid var(--hair); }
.axis__epochs, .axis__ticks { position:absolute; left:0; right:0; overflow:hidden; }
.axis__epochs { top:0; height:30px; }
.axis__ticks { top:30px; height:28px; }
.epoch { position:absolute; top:6px; height:22px; border-radius:6px; overflow:hidden; cursor:pointer; transition:filter .15s; }
.epoch:hover { filter:brightness(.95); }
.epoch span { position:absolute; top:0; line-height:22px; font-size:11px; font-weight:600; letter-spacing:.02em; text-transform:uppercase;
  white-space:nowrap; padding:0 8px; color:rgba(0,0,0,.72); }
.tick { position:absolute; top:0; font-size:11px; color:var(--muted); white-space:nowrap; transform:translateX(-50%); padding-top:7px; font-variant-numeric:tabular-nums; }
.tick::before { content:""; position:absolute; left:50%; top:0; height:4px; width:1px; background:var(--faint); }

.epoch-bg { position:absolute; inset:0; z-index:0; pointer-events:none; }
.epoch-bg div { position:absolute; top:0; bottom:0; }
.lanes-bg { position:absolute; inset:0; z-index:1; pointer-events:none; }
.lane-row { position:absolute; left:0; right:0; border-top:1px solid var(--hair); }
.lane-row__label { position:absolute; left:10px; top:6px; font-size:10.5px; font-weight:600; letter-spacing:.05em; text-transform:uppercase;
  color:var(--c); background:rgba(255,255,255,.85); padding:2px 6px; border-radius:4px; z-index:9; white-space:nowrap; }

.links { position:absolute; inset:0; width:100%; height:100%; z-index:2; pointer-events:none; overflow:visible; }
.links path { fill:none; stroke-width:1.2; opacity:.16; transition:opacity .25s, stroke-width .25s; }
.tl.has-sel .links path { opacity:.04; }
.tl.has-sel .links path.is-chain { opacity:.45; stroke-width:1.6; }
.tl.has-sel .links path.is-direct { opacity:.95; stroke-width:2.4; }

.nodes { position:absolute; inset:0; z-index:3; }
.dot { position:absolute; left:0; top:0; width:9px; height:9px; margin:-4.5px 0 0 -4.5px; border-radius:50%; background:#fff;
  box-shadow:inset 0 0 0 2px var(--c); cursor:pointer; z-index:4; transition:transform .15s, opacity .2s; }
.dot.lv1 { width:11px; height:11px; margin:-5.5px 0 0 -5.5px; background:var(--c); }
.dot:hover { transform:scale(1.5); }
.dot::after { content:""; position:absolute; inset:-8px; }

.card { position:absolute; left:0; top:0; display:flex; gap:8px; align-items:center; width:196px; height:58px; padding:5px 8px 5px 5px;
  background:#fff; border-radius:10px; box-shadow:0 0 0 1px var(--hair), 0 1px 2px rgba(0,0,0,.04); cursor:pointer;
  transition:box-shadow .15s, opacity .2s; z-index:5; will-change:transform; }
.card::before { content:""; position:absolute; left:-1px; top:-1px; bottom:-1px; width:3px; border-radius:10px 0 0 10px; background:var(--c); }
.card:hover { box-shadow:0 0 0 1px rgba(0,0,0,.18), 0 6px 18px rgba(0,0,0,.1); z-index:7; }
.card img, .card .noimg { width:48px; height:48px; border-radius:6px; object-fit:cover; flex:none; background:var(--tile); }
.card .noimg { display:grid; place-items:center; font-weight:700; font-size:18px; color:var(--c); }
.card__txt { min-width:0; padding-right:20px; }
.card__date { font-size:10.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-variant-numeric:tabular-nums; }
.card__title { font-size:12px; font-weight:500; line-height:1.22; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; letter-spacing:-.005em; }
.card.lv1 .card__title { font-weight:650; }
.card__play { position:absolute; right:5px; top:50%; transform:translateY(-50%); width:22px; height:22px; border-radius:50%; background:var(--chip); color:var(--ink); border:none; display:flex; align-items:center; justify-content:center; cursor:pointer; opacity:0.65; transition:opacity .15s, background .15s, color .15s, transform .15s; z-index:3; flex:none; }
.card__play svg { width:9px; height:9px; fill:currentColor; margin-left:1px; }
.card:hover .card__play, .card.is-sel .card__play { opacity:1; background:rgba(0,0,0,.14); }
.card__play:hover { background:var(--ink); color:#fff; transform:translateY(-50%) scale(1.15); opacity:1; }
.card__play.is-playing { opacity:1; background:var(--c-type); color:#fff; }
.card.is-sel { box-shadow:0 0 0 2px var(--c), 0 8px 24px rgba(0,0,0,.14); z-index:8; }
.tl.has-sel .card:not(.is-rel), .tl.has-sel .dot:not(.is-rel) { opacity:.28; }
.tl.has-sel .card.is-rel, .tl.has-sel .dot.is-rel { opacity:1; }
.tl.is-filtering .card:not(.is-match), .tl.is-filtering .dot:not(.is-match) { opacity:.15; }

.tip { position:absolute; z-index:20; pointer-events:none; background:var(--ink); color:#fff; font-size:11.5px; padding:5px 8px; border-radius:6px;
  white-space:nowrap; transform:translate(-50%, -130%); }

/* zoom buttons */
.zoom { position:absolute; right:14px; bottom:14px; z-index:15; display:flex; flex-direction:column; background:#fff; border-radius:12px;
  box-shadow:0 0 0 1px var(--hair), 0 4px 16px rgba(0,0,0,.08); overflow:hidden; }
.zoom button { width:38px; height:38px; font-size:20px; line-height:1; display:grid; place-items:center; }
.zoom button + button { border-top:1px solid var(--hair); }
.zoom button:hover { background:var(--chip); }
.zoom svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.8; }

/* hint */
.hint { position:absolute; inset:0; z-index:40; display:grid; place-items:center; background:rgba(255,255,255,.55); backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); padding:16px; }
.hint__card { max-width:440px; background:#fff; border-radius:16px; padding:22px 22px 18px; box-shadow:0 20px 60px rgba(0,0,0,.18), 0 0 0 1px var(--hair); }
.hint__card h2 { font-size:18px; font-weight:650; margin-bottom:10px; letter-spacing:-.01em; }
.hint__card ul { margin:0 0 16px; padding-left:18px; color:rgba(0,0,0,.78); }
.hint__card li { margin:6px 0; }
.only-v { display:none; }
.tl.is-vertical .only-v { display:inline; }
.tl.is-vertical .only-h { display:none; }

/* ---------- panel ---------- */
.panel { position:fixed; top:var(--bar-h); right:0; bottom:0; width:var(--panel-w); max-width:100%; background:#fff; z-index:35;
  box-shadow:-1px 0 0 var(--hair), -12px 0 40px rgba(0,0,0,.08); transform:translateX(105%); transition:transform .32s var(--ease);
  display:flex; flex-direction:column; }
.panel.is-open { transform:none; }
.panel__grip { display:none; }
.panel__compact { display:none; }
.panel__close { position:absolute; top:10px; right:10px; z-index:3; width:32px; height:32px; border-radius:50%; background:rgba(255,255,255,.9);
  font-size:22px; line-height:1; box-shadow:0 0 0 1px var(--hair); }
.panel__scroll { flex:1; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.panel__media { margin:0; background:var(--tile); }
.panel__media img { width:100%; max-height:340px; object-fit:contain; display:block; background:var(--tile); }
.panel__media figcaption { font-size:10.5px; color:var(--muted); padding:6px 16px; background:#fff; border-bottom:1px solid var(--hair); }
.panel__media figcaption a { color:inherit; text-decoration:underline; text-decoration-color:var(--faint); }
.panel__body { padding:16px 20px 28px; }
.panel__meta { display:flex; align-items:center; gap:10px; font-size:12px; color:var(--muted); margin-bottom:8px; font-variant-numeric:tabular-nums; }
.pill--tour-start { display:inline-flex; align-items:center; gap:6px; margin-left:auto; padding:4px 12px; border-radius:14px; font-size:11.5px; font-weight:600; background:var(--ink); color:#fff; border:none; cursor:pointer; transition:all .15s; }
.pill--tour-start:hover { background:#000; transform:scale(1.03); }
.pill--tour-start.is-playing { background:var(--c-type); box-shadow:0 0 0 1.5px var(--c-type); }
.pill--tour-start svg { width:11px; height:11px; fill:currentColor; margin-left:1px; }
.lane-badge { display:inline-flex; align-items:center; gap:6px; color:var(--c); font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:.04em; }
.lane-badge::before { content:""; width:8px; height:8px; border-radius:50%; background:var(--c); }
.panel h2 { font-size:22px; line-height:1.15; font-weight:650; letter-spacing:-.02em; margin-bottom:12px; }
.panel__text { font-size:14.5px; line-height:1.55; color:rgba(0,0,0,.84); }
.fact { margin-top:16px; padding:12px 14px; border-radius:10px; background:#fff7d6; font-size:13.5px; line-height:1.5; }
.fact b { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.05em; margin-bottom:4px; color:#8a6a00; }
.rel { margin-top:20px; }
.rel h3 { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:600; margin-bottom:8px; }
.rel__list { display:flex; flex-direction:column; gap:6px; }
.rel__item { display:flex; align-items:center; gap:10px; padding:5px; border-radius:10px; text-align:left; box-shadow:0 0 0 1px var(--hair); transition:background .15s; position:relative; }
.rel__item:hover { background:var(--chip); }
.rel__item img, .rel__item .noimg { width:40px; height:40px; border-radius:6px; object-fit:cover; flex:none; background:var(--tile); }
.rel__item .noimg { display:grid; place-items:center; color:var(--c); font-weight:700; }
.rel__item b { display:block; font-weight:500; font-size:13px; line-height:1.25; }
.rel__item small { color:var(--muted); font-size:11px; }
.rel__item::after { content:""; position:absolute; right:10px; top:50%; width:6px; height:6px; margin-top:-3px; border-radius:50%; background:var(--c); }
.wiki { display:inline-block; margin-top:22px; font-size:13px; font-weight:500; border-bottom:1px solid var(--faint); text-decoration:none; color:inherit; }
.wiki:hover { border-color:var(--ink); }
.tour { flex:none; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top:1px solid var(--hair); font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; background:#fff; }
.tour__ctrls, .tour__nav { display:flex; align-items:center; gap:6px; }
.pill--rate { min-width:32px; padding:0 8px; font-variant-numeric:tabular-nums; font-size:11px; }
.ico-sound { width:15px; height:15px; fill:currentColor; overflow:visible; }
.tour button.is-on { background:var(--ink); color:#fff; }
.tour button.is-speaking { background:#eef4ff; color:var(--c-type); box-shadow:0 0 0 1.5px var(--c-type); }
.tour button.is-speaking .wave--1 { animation:pulseWave .8s infinite alternate ease-in-out; }
.tour button.is-speaking .wave--2 { animation:pulseWave .8s .3s infinite alternate ease-in-out; }
@keyframes pulseWave {
  from { opacity:.2; transform:scale(.85); }
  to { opacity:1; transform:scale(1.1); }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .bar__sub { display:none; }
}
@media (max-width: 860px) {
  :root { --bar-h: 96px; }
  .bar { flex-wrap:wrap; height:var(--bar-h); align-content:center; row-gap:8px; padding:0 10px; }
  .bar__title { order:1; }
  .bar__actions { order:2; }
  .search { order:3; flex:1 1 140px; max-width:none; }
  .lanes-filter { order:4; flex:1 1 100%; }
  .pill span { display:none; }
  #tourBtn span { display:inline; }
}
@media (max-width: 860px) {
  .panel {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: 220px;
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
    box-shadow: 0 -12px 40px rgba(0,0,0,.18);
    transition: transform .3s var(--ease), height .3s var(--ease), max-height .3s var(--ease);
  }
  .panel.is-open {
    transform: translateY(var(--sheet-y, 0));
  }
  .panel.is-open:not(.is-full) {
    height: auto;
    max-height: 220px;
  }
  .panel.is-full {
    height: 82%;
    max-height: 82%;
  }
  .panel.is-dragging {
    transition: none;
  }
  .panel.is-open:not(.is-full) .panel__scroll {
    display: none;
  }
  .panel.is-full .panel__compact {
    display: none;
  }
  .panel.is-full .panel__scroll {
    display: block;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .panel__grip {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 22px;
    z-index: 4;
    touch-action: none;
    cursor: grab;
    background: #fff;
    border-radius: 18px 18px 0 0;
  }
  .panel__grip span {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0,0,0,.2);
    box-shadow: none;
    margin: 0;
  }
  .panel__expand-btn {
    position: absolute;
    right: 48px;
    top: 0;
    bottom: 0;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    transition: transform .25s ease, color .15s;
  }
  .panel__expand-btn:hover {
    color: var(--ink);
  }
  .panel__expand-btn svg {
    width: 15px;
    height: 15px;
  }
  .panel.is-full .panel__expand-btn {
    transform: rotate(180deg);
  }
  .panel__compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 48px 10px 14px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .panel__compact-thumb {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 8px;
    overflow: hidden;
    background: var(--tile);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px var(--hair);
  }
  .panel__compact-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .panel__compact-thumb .noimg {
    font-size: 16px;
    font-weight: 700;
    color: var(--muted);
  }
  .panel__compact-info {
    flex: 1;
    min-width: 0;
  }
  .panel__compact-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    margin-bottom: 2px;
  }
  .panel__compact-meta .lane-badge {
    font-size: 10.5px;
    letter-spacing: .02em;
  }
  .panel__compact-title {
    font-size: 13.5px;
    font-weight: 650;
    line-height: 1.25;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .panel__compact-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
  }
  .pill--compact-play {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 12px;
  }
  .panel__media img { max-height: 240px; }
  .panel h2 { font-size: 20px; }
  .zoom { bottom: calc(14px + env(safe-area-inset-bottom)); right: 10px; }
}

/* vertical (portrait phone) mode */
.tl.is-vertical .axis { top:0; bottom:0; left:0; right:auto; width:var(--axis); height:auto; border-bottom:0; border-right:1px solid var(--hair); }
.tl.is-vertical .axis__epochs { top:0; bottom:0; left:0; width:26px; height:auto; right:auto; }
.tl.is-vertical .axis__ticks { top:0; bottom:0; left:26px; right:0; width:auto; height:auto; }
.tl.is-vertical .epoch { top:auto; left:4px; width:20px; height:auto; }
.tl.is-vertical .epoch span { writing-mode:vertical-rl; transform:rotate(180deg); left:0; top:auto; line-height:20px; padding:8px 0; font-size:10px; }
.tl.is-vertical .tick { transform:translateY(-50%); padding:0 0 0 7px; left:0; font-size:10px; }
.tl.is-vertical .tick::before { left:0; top:50%; width:4px; height:1px; }
.tl.is-vertical .lane-row { top:0; bottom:0; left:auto; right:auto; border-top:0; border-left:1px solid var(--hair); }
.tl.is-vertical .lane-row__label { position:sticky; left:auto; top:0; display:block; text-align:center; font-size:9px; padding:4px 2px; letter-spacing:.02em; white-space:normal; line-height:1.15; border-radius:0 0 6px 6px; }
.tl.is-vertical .card { flex-direction:column; align-items:stretch; gap:4px; width:var(--cw); height:var(--ch); padding:4px; border-radius:8px; }
.tl.is-vertical .card::before { left:-1px; right:-1px; top:-1px; bottom:auto; width:auto; height:3px; border-radius:8px 8px 0 0; }
.tl.is-vertical .card img, .tl.is-vertical .card .noimg { width:100%; height:calc(var(--ch) - 46px); }
.tl.is-vertical .card__title { font-size:10.5px; line-height:1.18; }
.tl.is-vertical .card__date { font-size:9.5px; }
