/* Concept: a quiet late-afternoon sea, with instrument panels drawn from an
   explorer's slate. One deliberate look, so no dark-mode variant. */
:root {
  color-scheme: dark;
  --sea-high: #79aeac;
  --sea-low: #3f7488;
  --slate: #17333a;
  --slate-raised: #21444c;
  --slate-line: #3a626a;
  --paper: #efe9d8;
  --mist: #a9c6c1;
  --gold: #d9b872;
  --gold-deep: #b6924c;
  --coral: #d98c6e;
  --ink: #1c2f33;
  --display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Iowan Old Style", Georgia, serif;
  --body: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  --latin: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --panel-width: 408px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: linear-gradient(170deg, var(--sea-high), var(--sea-low) 78%);
  color: var(--paper);
  font: 15px/1.65 var(--body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h2, h3, p { margin: 0; }

#map { position: fixed; inset: 0; touch-action: none; cursor: grab; }
#map.is-dragging { cursor: grabbing; }
#world { width: 100%; height: 100%; display: block; user-select: none; }
#camera { transform-origin: 0 0; }
#camera.is-gliding { transition: transform 1100ms cubic-bezier(.3, .05, .2, 1); }

.ripple path { fill: none; stroke: #d6ebe2; stroke-width: 2; stroke-linecap: round; }
.ripple { opacity: .1; animation: ripple 7s ease-in-out infinite; }
.ripple-1 { animation-delay: -2.3s; }
.ripple-2 { animation-delay: -4.6s; }
@keyframes ripple { 50% { opacity: .42; } }

.era-line { stroke: #d6ebe2; stroke-opacity: .1; stroke-width: 1.5; stroke-dasharray: 2 12; stroke-linecap: round; }
.era-text { fill: #e9f2ea; fill-opacity: .46; font: 500 20px var(--latin); letter-spacing: .06em; }

.route { fill: none; stroke: #eef2e4; stroke-opacity: 0; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 13; transition: stroke-opacity .8s; }
.route.is-known { stroke-opacity: .3; }
.route.is-offered { stroke-opacity: .85; stroke: var(--gold); animation: flow 1.8s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -30; } }
.route.is-lit { stroke: #fff4d4; stroke-opacity: 1; stroke-width: 5; stroke-dasharray: none; animation: none; }
.voyage { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; opacity: .72; pointer-events: none; }
.is-overview .route { stroke-opacity: .34; }
.is-overview .route.is-known { stroke-opacity: .55; }
.is-overview .route.is-lit { stroke-opacity: 1; }
.is-overview .island-tag { opacity: 1; }
.is-overview .tag-name { font-size: 46px; }
.is-overview .tag-era { display: none; }
.is-overview .tag-star { font-size: 38px; }
.is-overview .island:not(.is-seen) .tag-name { fill: #cfe0da; }
.is-overview .fog { opacity: .55; }
.is-overview .island.is-seen .fog { opacity: .1; }
.is-overview .island.is-deep .fog { opacity: 0; }
.is-overview .fog-mark { opacity: 0 !important; }
.is-overview .sky-clouds { display: none; }

.island { cursor: pointer; }
.island-art { filter: saturate(.5) brightness(.92); transition: filter 1.2s; }
.island.is-seen .island-art { filter: saturate(.82); }
.island.is-deep .island-art { filter: none; }
.island-tag { opacity: 0; transition: opacity .8s .3s; pointer-events: none; }
.island.is-seen .island-tag { opacity: 1; }
.tag-name, .tag-era { paint-order: stroke; stroke: rgba(23, 51, 58, .72); stroke-width: 6px; stroke-linejoin: round; fill: #f7f2e2; }
.tag-name { font: 600 26px var(--display); letter-spacing: .03em; }
.tag-era { font: 500 17px var(--latin); fill: #dbe7df; }
.island.is-current .tag-name { fill: var(--gold); }
.island.is-selected .tag-name { fill: #f6d9a0; }
.tag-star { fill: var(--gold); font-size: 22px; opacity: 0; paint-order: stroke; stroke: rgba(23, 51, 58, .72); stroke-width: 5px; }
.island.is-saved .tag-star { opacity: 1; }

.fog { opacity: .86; transition: opacity 1.4s ease, transform 1.8s ease; pointer-events: none; }
.fog-drift { animation: drift 16s ease-in-out infinite alternate; }
.island.is-frontier .fog { opacity: .58; }
.island.is-seen .fog { opacity: .22; }
.island.is-deep .fog { opacity: 0; }
.island.is-seen .fog-drift { animation: none; }
.fog-mark { fill: #5d7f85; font: 600 44px var(--display); opacity: 0; transition: opacity .6s; pointer-events: none; }
.island.is-frontier .fog-mark { opacity: 1; fill: #fff; paint-order: stroke; stroke: rgba(23, 51, 58, .55); stroke-width: 6px; }
@keyframes drift { from { transform: translate(-8px, 2px); } to { transform: translate(10px, -3px); } }

.boat-bob { animation: bob 3.2s ease-in-out infinite; transform-origin: 0 8px; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1.6deg); } 50% { transform: translateY(-3px) rotate(1.6deg); } }
.boat.is-hidden { visibility: hidden; }

.sky-clouds { pointer-events: none; opacity: .5; }
.sky-cloud { animation: skydrift 50s ease-in-out infinite alternate; }
.sky-cloud-1 { animation-duration: 66s; }
.sky-cloud-2 { animation-duration: 82s; }
@keyframes skydrift { from { transform: translateX(-46px); } to { transform: translateX(58px); } }

.topbar {
  position: fixed; z-index: 3;
  top: env(safe-area-inset-top, 0px); left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; flex-direction: column; padding: 6px 12px; border-radius: 12px; background: rgba(23, 51, 58, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
/* The name is set as a lockup rather than a typed string: the gap and dot are
   drawn, so spacing stays the same in every language and nothing hangs off the end. */
.brand-name { display: flex; align-items: center; gap: .36em; font: 600 19px/1.25 var(--display); white-space: nowrap; }
.brand-main, .brand-world { letter-spacing: .04em; margin-right: -.04em; }
.brand-world { font-weight: 400; color: var(--gold); }
.brand-dot { flex: none; width: 3px; height: 3px; border-radius: 50%; background: var(--mist); }
:lang(en) .brand-main, :lang(en) .brand-world { letter-spacing: .01em; margin-right: -.01em; }
#progress { font-size: 12.5px; color: #e8f1ea; }
.topbar-actions { display: flex; gap: 8px; }
body.panel-right .topbar { right: var(--panel-width); }

.ghost {
  background: rgba(23, 51, 58, .72); border: 1px solid rgba(239, 233, 216, .24); border-radius: 999px;
  padding: 6px 14px; font-size: 13.5px; transition: background .2s;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ghost:hover { background: rgba(23, 51, 58, .94); }
.lang { appearance: none; -webkit-appearance: none; padding: 6px 12px; cursor: pointer; text-align: center; text-align-last: center; }
.lang option { background: var(--slate); color: var(--paper); }
.ghost.round { width: 36px; height: 36px; padding: 0; font-size: 18px; line-height: 1; }
.zoom { position: fixed; z-index: 2; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(env(safe-area-inset-top, 0px) + 78px); display: flex; flex-direction: column; gap: 6px; }

.panel {
  position: fixed; z-index: 4; top: 0; right: 0; bottom: 0; width: var(--panel-width);
  padding: calc(env(safe-area-inset-top, 0px) + 26px) max(24px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 26px) 24px;
  background: var(--slate); border-left: 1px solid var(--slate-line);
  overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
  transition: transform .5s cubic-bezier(.3, .05, .2, 1), opacity .3s;
}
.panel-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel.is-away { transform: translateX(105%); }
.panel.is-sailing .panel-body { opacity: .5; pointer-events: none; }
.back { align-self: flex-start; padding: 0; border: 0; background: transparent; color: var(--mist); font-size: 13.5px; }
.back:hover { color: var(--paper); }
.link-btn { display: block; text-align: center; text-decoration: none; }

.eyebrow { font-size: 12.5px; color: var(--gold); letter-spacing: .14em; }
.title { font: 600 30px/1.3 var(--display); letter-spacing: .02em; text-wrap: balance; }
.title small { display: block; margin-top: 4px; font: 500 15px var(--latin); color: var(--mist); letter-spacing: .02em; }
.lede { color: #d6dfd5; }
.note { font-size: 13px; color: var(--mist); }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.section-title { font: 600 15px var(--display); color: var(--gold); letter-spacing: .06em; }
.divider { height: 1px; background: var(--slate-line); flex: none; }

.search { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--slate-line); background: #0f272d;
}
.search input::placeholder { color: #7f9c9a; }
.btn {
  border: 0; border-radius: 10px; padding: 11px 18px; background: var(--gold); color: var(--ink);
  font-weight: 600; transition: background .2s, opacity .2s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #e6c98a; }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.quiet { background: var(--slate-raised); color: var(--paper); font-weight: 500; border: 1px solid var(--slate-line); }
.btn.quiet:hover:not(:disabled) { background: #2b535c; }

.song {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; padding: 8px; text-align: left; border-radius: 12px; border: 1px solid transparent; background: transparent;
}
button.song:hover { background: var(--slate-raised); border-color: var(--slate-line); }
.song img, .art-blank { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--slate-raised); display: block; }
.song-text { min-width: 0; display: flex; flex-direction: column; }
.song-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-artist { font-size: 13px; color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.routes { display: flex; flex-direction: column; gap: 10px; }
.route-card {
  display: grid; grid-template-columns: 46px minmax(0, 1fr); column-gap: 12px; row-gap: 10px; align-items: start;
  padding: 12px; border-radius: 14px; background: var(--slate-raised); border: 1px solid var(--slate-line);
  transition: border-color .25s;
}
.route-card.is-blind { align-items: center; }
.route-card.is-playing { border-color: var(--gold); }
.route-songs, .route-actions { grid-column: 1 / -1; min-width: 0; }
.route-card:has(.route-go) { grid-template-columns: 46px minmax(0, 1fr) auto; }
.route-card:has(.route-go) .route-info { grid-column: 2 / -1; }
.route-card:has(.route-go) .route-songs { grid-column: 1 / 3; }
.route-go { grid-column: 3; align-self: start; white-space: nowrap; }
.route-songs summary { cursor: pointer; font-size: 13px; color: var(--gold); padding: 4px 0; }
.route-songs[open] { grid-column: 1 / -1; }
.route-songs[open] summary { margin-bottom: 4px; }
.route-card:has(.route-songs[open]) .route-go { grid-row: 2; align-self: start; }
.route-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.route-name { display: block; padding: 0; border: 0; background: transparent; text-align: left; font: 600 17px var(--display); color: var(--paper); }
.route-name:hover { color: var(--gold); }
.route-dir-tag { margin-right: 8px; font: 500 12.5px var(--body); color: var(--gold); }
.fog-tag { margin-left: 8px; font: 400 12px var(--body); color: var(--mist); }
.route-link { margin-top: 3px; font-size: 13px; line-height: 1.55; color: var(--mist); }
.play {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--paper); color: var(--ink);
  display: grid; place-items: center; position: relative;
}
.play svg { width: 18px; height: 18px; fill: currentColor; }
.route-info { min-width: 0; }
.route-dir { font: 600 17px var(--display); }
.route-hint { font-size: 13px; color: var(--mist); }
.sail { padding: 7px 14px; }
.reveal-song { padding: 0; }
.listen-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.listen-list li { padding-left: 16px; position: relative; }
.listen-list li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-deep); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; font-size: 13px; text-decoration: none; color: var(--paper);
  background: transparent; border: 1px solid var(--slate-line);
}
.pill:hover { background: var(--slate-raised); }
.pill.is-on { background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 600; }

.relation { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: rgba(217, 184, 114, .08); border: 1px solid rgba(217, 184, 114, .28); }
.path { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.path-stop { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--slate-line); background: transparent; font-size: 13px; }
.path-stop:hover { background: var(--slate-raised); }
.path-stop.is-end { border-color: var(--gold-deep); color: var(--gold); }
.path-arrow { color: var(--mist); font-size: 13px; }
.legs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.legs b { font-size: 13.5px; }
.quiz { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.quiz-q { font-weight: 600; }
.option {
  text-align: left; padding: 10px 12px; border-radius: 10px; background: transparent; border: 1px solid var(--slate-line);
}
.option:hover:not(:disabled) { background: var(--slate-raised); }
.option:disabled { cursor: default; color: var(--mist); }
.option.is-right { border-color: var(--gold); color: var(--paper); background: rgba(217, 184, 114, .13); }
.option.is-picked:not(.is-right) { border-color: var(--coral); }
.why { font-size: 14px; color: #dbe3d9; }
details summary { cursor: pointer; color: var(--gold); font: 600 15px var(--display); letter-spacing: .06em; }
details p { margin-top: 8px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs .pill { cursor: pointer; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px 12px; }
.record { display: flex; flex-direction: column; gap: 6px; min-width: 0; background: transparent; border: 0; padding: 0; text-align: left; }
.record img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; background: var(--slate-raised); box-shadow: 0 7px 0 -1px #8a6b4e, 0 12px 0 -1px #5f4a38; margin-bottom: 12px; }
.record b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record span { font-size: 12.5px; color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atlas-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
  padding: 12px 4px; background: transparent; border: 0; border-bottom: 1px solid var(--slate-line); text-align: left;
}
.atlas-row:hover { background: rgba(255, 255, 255, .03); }
.atlas-era { font: 500 13.5px var(--latin); color: var(--mist); font-variant-numeric: tabular-nums; }
.atlas-name { font: 600 16px var(--display); }
.atlas-sub { display: block; font: 400 13px var(--body); color: var(--mist); }
.atlas-state { font-size: 12.5px; color: var(--mist); white-space: nowrap; }
.atlas-state.on { color: var(--gold); }
.log-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.log-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.log-index { font: 500 15px var(--latin); color: var(--gold); font-variant-numeric: tabular-nums; }
.share-box { display: flex; gap: 8px; }
.share-box input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; background: #0f272d; border: 1px solid var(--slate-line); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mist); }
.field input { padding: 10px 12px; border-radius: 10px; background: #0f272d; border: 1px solid var(--slate-line); color: var(--paper); font-size: 15px; }

.now {
  position: sticky; top: -26px; z-index: 2; flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-radius: 14px; background: #2a4e56; border: 1px solid var(--gold-deep);
  box-shadow: 0 6px 14px rgba(10, 28, 33, .42);
}
.now[hidden] { display: none; }
.now-main { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.now-info { display: flex; flex-direction: column; min-width: 0; padding: 0 4px; border: 0; background: transparent; text-align: left; }
.now-main .star[hidden] { display: none; }
.now-main .pill { padding: 5px 10px; white-space: nowrap; }
.now-toggle { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; }
.now-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.now-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12.5px; color: var(--mist); }
.auto { display: flex; align-items: center; gap: 6px; }
.auto input { accent-color: var(--gold); margin: 0; }
.now-links { display: flex; gap: 12px; }
.now-links[hidden] { display: none; }
.now-links a { color: var(--mist); }
.now-links a:hover { color: var(--paper); }
.now-links a[hidden] { display: none; }
.now-bar { height: 3px; border-radius: 2px; background: var(--slate-line); overflow: hidden; }
.now-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .25s linear; }

.fast-section { display: flex; flex-direction: column; gap: 2px; flex: none; }
.fast-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 6px; }
.fast-head .pill { flex: none; white-space: nowrap; }
.fast-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; border-radius: 10px; }
.fast-row[hidden] { display: none; }
.fast-row:hover { background: var(--slate-raised); }
.fast-row.no-star { grid-template-columns: minmax(0, 1fr); }
.fast-row.is-active { background: rgba(217, 184, 114, .14); }
.fast-play { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: center; padding: 7px 8px; border: 0; background: transparent; text-align: left; min-width: 0; }
.fast-play img, .fast-play .art-blank { width: 42px; height: 42px; border-radius: 5px; object-fit: cover; background: var(--slate-raised); display: block; }
.fast-row.is-heard .song-title { color: #c8d3c9; font-weight: 500; }
.fast-row.is-active .song-title { color: var(--gold); font-weight: 600; }
.star { width: 40px; height: 40px; border: 0; background: transparent; color: #6f9093; display: grid; place-items: center; }
.star svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.star:hover { color: var(--paper); }
.star.is-on { color: var(--gold); }
.star.is-on svg { fill: currentColor; }
.more { align-self: flex-start; margin: 4px 0 0 8px; padding: 2px 0; border: 0; background: transparent; color: var(--gold); font-size: 13px; }

.visit-banner { padding: 12px 14px; border-radius: 12px; background: var(--slate-raised); border: 1px solid var(--gold-deep); }

@media (max-width: 760px) {
  :root { --panel-width: 100%; }
  body.panel-right .topbar { right: 0; }
  .panel {
    top: auto; left: 0; width: 100%; max-height: 64%;
    border-left: 0; border-top: 1px solid var(--slate-line); border-radius: 20px 20px 0 0;
    padding: 20px max(18px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 20px) max(18px, env(safe-area-inset-left, 0px));
    gap: 12px;
  }
  .panel-body { gap: 14px; }
  .zoom { display: none; }
  .ghost { white-space: nowrap; padding: 4px 9px; font-size: 12.5px; }
  .topbar { flex-wrap: wrap; gap: 6px 4px; }
  .topbar-actions { flex: none; gap: 4px; margin-left: auto; }
  .brand { position: relative; flex: none; padding: 5px 8px; }
  .brand-name { font-size: 15px; }
  #progress {
    position: absolute; top: 100%; left: 0; margin-top: 6px; padding: 2px 8px; border-radius: 8px;
    background: rgba(23, 51, 58, .72); font-size: 11.5px; white-space: nowrap;
  }
  .panel.is-away { transform: translateY(105%); }
  .now { top: -20px; }
  .title { font-size: 25px; }
  .ghost { padding: 5px 12px; font-size: 13px; }
  .atlas-row { grid-template-columns: 74px minmax(0, 1fr) auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

.not-found { display: grid; place-items: center; min-height: 100%; padding-inline: 16px; overflow: auto; text-align: center; }
.not-found h1 { font: 600 28px var(--display); margin: 0 0 8px; }
.not-found a { color: var(--paper); }

/* Too narrow for the progress line to sit beside the wrapped buttons. */
@media (max-width: 340px) {
  #progress { display: none; }
}
