:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --glass: rgb(255 255 255 / 0.88);
  --raised: #fbfaf7;
  --ink: #17161c;
  --ink-2: #4b4a55;
  --ink-3: #8b8a96;
  --line: #e4e2dc;
  --accent: #d9481f;
  --accent-ink: #ffffff;
  --accent-soft: #fbe4da;
  --dim: #d6d4ce;
  --shadow: 0 1px 2px rgb(20 20 30 / 0.06), 0 8px 28px rgb(20 20 30 / 0.10);
  --radius: 16px;
  --panel-w: 400px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --surface: #1a1a1f;
    --glass: rgb(26 26 31 / 0.88);
    --raised: #202026;
    --ink: #ececf1;
    --ink-2: #b3b3bf;
    --ink-3: #7c7c8a;
    --line: #2c2c34;
    --accent: #ff7a4d;
    --accent-ink: #1a0d07;
    --accent-soft: #3a2018;
    --dim: #34343d;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 21px; line-height: 1.25; margin: 2px 0 4px; }
h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 22px 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.error { color: var(--accent); }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }
.floating {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---------- map ---------- */
.stage { position: fixed; inset: 0; background: var(--surface); }
.stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.tip {
  position: absolute; z-index: 5; pointer-events: none;
  max-width: 380px; padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.4;
}
.tip-row { display: flex; gap: 11px; align-items: flex-start; }
.tip-row img { flex: none; width: 104px; height: 148px; border-radius: 8px; object-fit: cover; background: var(--dim); }
.tip-text { min-width: 0; }
.tip b { font-size: 14px; }
.tip-meta, .tip-hint { color: var(--ink-3); }
.tip-theme { display: flex; align-items: center; }
.tip-hint { margin-top: 4px; font-size: 12px; }

/* ---------- header ---------- */
.top {
  position: fixed; z-index: 10; top: 16px; left: 16px;
  width: min(760px, calc(100vw - var(--panel-w) - 64px));
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
body.panel-closed .top { width: min(760px, calc(100vw - 32px)); }
/* the header shares the width with the panel: when it gets tight, the name and then the filter summary
   give way to the search box (the logo and filter icon stay) */
.top { container-type: inline-size; }
@container (max-width: 580px) { .brand span:last-child, .search kbd { display: none; } }
@container (max-width: 420px) { .filter-btn span { display: none; } }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 16px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--ink) 0 22%, transparent 23%),
              conic-gradient(var(--accent) 0 25%, #5468d4 0 50%, #2a9d8f 0 75%, #c49a2c 0);
}
.search { position: relative; flex: 1; min-width: 0; }
.search > svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.search input {
  width: 100%; padding: 9px 40px 9px 38px;
  font: inherit; color: var(--ink);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 999px;
  outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.search kbd {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  font: 12px ui-monospace, monospace; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 6px;
}
.results {
  position: absolute; z-index: 20; top: calc(100% + 10px); left: 0; right: 0;
  max-height: 70vh; overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.results .rh { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.res { display: flex; align-items: center; gap: 6px; border-radius: 10px; }
.res:hover, .res:has(.active) { background: var(--bg); }
.res [data-go] {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border: 0; background: none; cursor: pointer; text-align: left;
}
.res-main { display: flex; flex-direction: column; min-width: 0; }
.res-main > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .muted { font-size: 12.5px; }
.res .cover { width: 28px; height: 40px; border-radius: 5px; }

.filter-wrap { position: relative; flex: none; }
.filter-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--bg); border: 1px solid transparent; font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.filter-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.filter-btn:hover, .filter-btn[aria-expanded="true"] { border-color: var(--line); color: var(--ink); }
.filter-btn.changed { background: var(--accent-soft); color: var(--accent); }
.filter-pop {
  position: absolute; z-index: 20; top: calc(100% + 10px); right: 0;
  width: 340px; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  font-size: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.field.years { flex-direction: row; align-items: center; gap: 8px; color: var(--ink-2); }
.field.years .label { margin-right: auto; }
.years select { font: inherit; color: var(--ink); padding: 5px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--bg); border-radius: 10px; }
.seg button, .sizes button {
  padding: 5px 11px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"], .sizes button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.rating-head { display: flex; justify-content: space-between; align-items: baseline; }
#rating-val { font-size: 13px; font-weight: 600; color: var(--ink); }
#rating { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.rating-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: -2px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); }
.pop-foot { display: flex; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }

/* ---------- map overlays ---------- */
.stagebar {
  position: fixed; z-index: 6; top: 84px; left: 16px;
  max-width: calc(100vw - var(--inset-right, 0px) - 48px);
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
  padding: 7px 16px; border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 14px;
}
.stagebar b { font-weight: 700; }
.stagebar .sep { color: var(--ink-3); }
.status {
  position: fixed; z-index: 6; bottom: calc(var(--inset-bottom, 0px) + 64px);
  left: calc((100vw - var(--inset-right, 0px)) / 2); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 13px; color: var(--ink-2);
}
.status b { display: block; width: 90px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.status i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.pill {
  position: fixed; z-index: 6; top: 84px; right: calc(var(--inset-right, 0px) + 16px);
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 12px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; box-shadow: var(--shadow);
}
.pill { flex-wrap: wrap; max-width: calc(100vw - var(--inset-right, 0px) - 32px); }
.pill-tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.pill i { font-style: normal; opacity: .8; }
.pill button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.25); color: inherit; cursor: pointer; line-height: 1; }
.note, .hint {
  position: fixed; z-index: 6; margin: 0;
  left: calc((100vw - var(--inset-right, 0px)) / 2); transform: translateX(-50%);
  max-width: min(560px, calc(100vw - var(--inset-right, 0px) - 120px));
  padding: 7px 14px; border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); text-align: center;
}
/* above the credits line, which must stay readable */
.hint { bottom: calc(var(--inset-bottom, 0px) + 44px); pointer-events: none; }
.note { bottom: calc(var(--inset-bottom, 0px) + 86px); border-radius: 12px; }
.zoom { position: fixed; z-index: 6; right: calc(var(--inset-right, 0px) + 16px); bottom: calc(var(--inset-bottom, 0px) + 16px); display: flex; flex-direction: column; gap: 6px; }
.zoom button {
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 17px; line-height: 1; color: var(--ink-2);
}
.zoom button:hover { color: var(--ink); }
.credits {
  position: fixed; z-index: 5; left: 16px; bottom: calc(var(--inset-bottom, 0px) + 12px);
  max-width: calc(100vw - var(--inset-right, 0px) - 100px);
  padding: 3px 9px; border-radius: 8px;
  background: var(--glass);
  font-size: 11.5px; color: var(--ink-3);
}
.credits a, .credits .link { color: var(--ink-2); }
body:has(.hint:not([hidden])) .credits { bottom: calc(var(--inset-bottom, 0px) + 12px); }

/* ---------- licences and privacy page ---------- */
body.doc { overflow: auto; height: auto; background: var(--bg); }
.doc-page { max-width: 680px; margin: 0 auto; padding: 32px 20px 64px; }
.doc-page h1 { margin: 12px 0 8px; }
.doc-page h2 { margin: 28px 0 8px; font-size: 18px; }
.doc-page p, .doc-page li { color: var(--ink-2); }
.doc-page li { margin: 4px 0; }
.doc-page code { font-size: 13px; }

/* the footer's credits repeated at the end of the panel, for phones (where the footer is hidden) */
.panel-credit { display: none; margin-top: 28px; }
.panel-credit a { color: var(--ink-2); }

/* ---------- panel ---------- */
.panel {
  position: fixed; z-index: 8; top: 16px; right: 16px; bottom: 16px; width: var(--panel-w);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
body.panel-closed .panel { transform: translateX(calc(100% + 16px)); }
body.panel-none .panel { display: none; }
.panel-body { height: 100%; overflow-y: auto; padding: 22px 22px 28px; border-radius: inherit; }
.panel-toggle {
  position: absolute; top: 18px; left: -40px; width: 30px; height: 44px;
  border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; cursor: pointer;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink-3);
}
.panel-toggle::before { content: "›"; font-size: 20px; line-height: 1; }
body.panel-closed .panel-toggle::before { content: "‹"; }
.panel-toggle:hover { color: var(--ink); }

.eyebrow { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.head h2 { overflow-wrap: anywhere; }
.ext-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.ext {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 13px; font-weight: 650; color: var(--ink);
}
.ext span { color: var(--ink-3); font-weight: 400; }
.ext:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.ext.btn { padding: 8px 14px; border-radius: 10px; font-size: 14px; }
.ext.small { padding: 2px 8px; font-size: 11.5px; }

.cover {
  position: relative; flex: none; display: inline-block;
  width: 36px; height: 50px; border-radius: 6px; overflow: hidden;
  background: var(--tint, var(--dim));
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; animation: fade .25s ease-out; }
.cover.big { width: 96px; height: 136px; border-radius: 10px; }
.cover.poster { width: 150px; height: 214px; border-radius: 12px; box-shadow: var(--shadow); }
@keyframes fade { from { opacity: 0; } }


.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 14px; color: var(--ink);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.ghost { background: none; border-style: dashed; color: var(--ink-2); }
.chips.small .chip { padding: 3px 10px; font-size: 13px; }

.steer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.steer-chip { display: inline-flex; align-items: center; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; }
.steer-chip button { border: 0; background: none; cursor: pointer; }
.steer-chip [data-steer] { width: 24px; height: 26px; color: var(--ink-3); font-size: 15px; line-height: 1; border-radius: 999px; }
.steer-chip [data-steer]:hover { color: var(--accent); }
.steer-chip .tag { padding: 0 2px; color: var(--ink); }
.steer-chip .tag:hover { text-decoration: underline; }
.steer-chip.more { background: var(--accent-soft); border-color: var(--accent); }
.steer-chip.more [data-how="more"], .steer-chip.less [data-how="less"] { color: var(--accent); font-weight: 800; }
.steer-chip.less .tag { color: var(--ink-3); text-decoration: line-through; }


.dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.dot.none { background: var(--dim); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 8px; }
.list-head h3 { margin: 0; }
.sizes { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border-radius: 10px; font-size: 12.5px; }
.sizes button { padding: 3px 9px; }
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 0 -10px;
  border-radius: 10px; cursor: pointer;
}
.row:hover, .row.hot { background: var(--bg); }
.list:not(:has(.rank)) .row { grid-template-columns: auto minmax(0, 1fr) auto; }
.rank { width: 20px; text-align: right; font-size: 13px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.row-title { display: flex; align-items: center; font-weight: 600; line-height: 1.3; }
.row-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 12.5px; color: var(--ink-3); }
.row-why { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-links { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.row .meter { margin-top: 4px; }
.meter { display: block; width: 54px; height: 5px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.row:hover .meter { background: var(--surface); }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.card h2 { font-size: 22px; margin: 6px 0 8px; }
.card-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; }
.card-info { display: flex; flex-direction: column; min-width: 0; }
.card-info h2 { overflow-wrap: anywhere; }
.card-info p { margin: 0 0 2px; }
.card-info .ext-row { margin-top: auto; padding-top: 12px; }
.card .actions { margin-top: 18px; }
.card .actions .btn { flex: 1 1 auto; justify-content: center; }
.synopsis { margin-top: 18px; }
.synopsis-text { font-size: 14px; color: var(--ink-2); }
.synopsis-text p { margin: 0 0 8px; }
.synopsis .source { display: flex; justify-content: space-between; gap: 12px; margin: 4px 0 0; }
.synopsis .source span { margin-left: auto; }
.why { list-style: none; margin: 0; padding: 0; }
.why li { display: grid; grid-template-columns: minmax(0, 1fr) 90px; align-items: center; gap: 12px; padding: 3px 0; }
.why .link { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.why .meter { width: 100%; }
.series { margin: 0; padding-left: 18px; }
.series li { margin: 3px 0; }
.series .link { color: var(--ink); }

/* ---------- phones: the panel becomes a bottom sheet ---------- */
@media (max-width: 760px) {
  .top { top: 8px; left: 8px; width: calc(100vw - 16px); gap: 8px; padding: 6px 6px 6px 10px; }
  body.panel-closed .top { width: calc(100vw - 16px); }
  .brand span:last-child, .search kbd { display: none; }
  .filter-btn { padding: 8px 10px; }
  .filter-btn span { display: none; }
  .filter-pop { width: min(340px, calc(100vw - 16px)); }
  .stagebar { top: 64px; left: 8px; max-width: calc(100vw - 16px); font-size: 13px; }
  .pill { top: 64px; right: 8px; }
  body:has(.stagebar:not([hidden])) .pill { top: 106px; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 48dvh;
    border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0;
  }
  body.panel-closed .panel { transform: translateY(calc(100% - 56px)); }
  .panel-body { padding: 26px 16px 24px; }
  .panel-toggle {
    top: 0; left: 50%; transform: translateX(-50%); width: 64px; height: 22px;
    border: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .panel-toggle::before, body.panel-closed .panel-toggle::before {
    content: ""; display: block; width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--dim);
  }
  .zoom, .credits { display: none; }
  .panel-credit { display: block; }
  /* with no panel open (the bird's-eye map), the footer itself shows, compactly */
  body.panel-none .credits { display: block; left: 8px; right: 8px; bottom: 8px; max-width: none; font-size: 10.5px; line-height: 1.35; }
  .hint { top: 64px; bottom: auto; font-size: 12px; padding: 5px 12px; }
  body:has(.stagebar:not([hidden])) .hint { display: none; }
    .cover.big { width: 80px; height: 114px; }
    .cover.poster { width: 120px; height: 171px; }
}
