/* Appearance: page layout, controls, map marks, then light-theme overrides.
   Search by element class/ID from index.html or src/. Dark colors are fallbacks. */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400%3B500%3B600%3B700&family=Playfair+Display:wght@400%3B500&display=swap');

.genre-editor {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
}

.genre-editor label {
  display: block;
  font-size: 11px;
  margin-bottom: 8px;
}

.genre-editor p {
  font-size: 10px;
  margin-bottom: 0;
}

#import-note {
  max-width: 660px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
}

button,
a,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid #a57839;
  outline-offset: 4px;
}

button {
  color: inherit;
}

header {
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-family: 'Playfair Display', Georgia, serif;
}

.brand svg {
  width: 27px;
  height: 34px;
  margin-right: 12px;
}

.brand-dot {
  color: #b08b54;
}

.header-note {
  margin: auto;
  font-size: 12px;
}

.text-button {
  border: 0;
  background: none;
  padding: 8px 0;
  font-size: 12px;
}

.text-button span {
  margin-left: 14px;
}

main {
  margin: auto;
}

.landing {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  min-height: 690px;
  align-items: center;
  gap: 15px;
}

.eyebrow {
  letter-spacing: 2px;
  margin: 0 0 21px;
}

h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 400;
  font-size: 57px;
  line-height: 1.16;
  margin: 0 0 25px;
}

.intro-copy {
  color: #778074;
  line-height: 1.9;
  font-size: 15px;
  margin-bottom: 32px;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.primary,
.secondary {
  border-radius: 4px;
  padding: 14px 19px;
  font-size: 12px;
  font-weight: 500;
}

.primary {
  border: 1px solid var(--green);
}

.primary span {
  margin-left: 18px;
}

.secondary {
  border: 1px solid #d4d9cb;
  background: transparent;
}

.privacy {
  font-size: 10px;
  color: #929486;
  margin-top: 22px;
}

details {
  margin-top: 33px;
  max-width: 385px;
  font-size: 11px;
  color: #7b8376;
  line-height: 1.7;
}

summary {
  cursor: pointer;
}

details p {
  padding-left: 12px;
}

.landing-art {
  position: relative;
  text-align: center;
}

.landing-art svg {
  width: 100%;
  height: 560px;
}

.art-caption {
  font-size: 9px;
  letter-spacing: 2px;
  color: #939887;
  display: block;
  margin-top: -25px;
}

.map-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-heading .eyebrow {
  margin-bottom: 12px;
}

.map-heading p:last-child {
  font-size: 12px;
}

.workspace {
  display: grid;
  position: relative;
}

.sidebar {
  padding-right: 25px;
}

.side-section .eyebrow {
  margin-bottom: 12px;
  display: block;
}

.filter {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  border-radius: 3px;
  margin-bottom: 2px;
  gap: 9px;
}

.filter .count {
  margin-left: auto;
  font-size: 10px;
}

.swatch {
  height: 7px;
  width: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

select {
  border: 1px solid var(--line);
  width: 100%;
  border-radius: 3px;
}

.map-area {
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.canvas-top,
.canvas-bottom {
  position: absolute;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
  pointer-events: none;
}

.canvas-top {
  top: 20px;
}

.canvas-bottom {
  bottom: 17px;
}

.zoom-controls {
  display: flex;
  pointer-events: auto;
}

.zoom-controls button {
  background: none;
  border: 0;
  font-size: 12px;
  padding: 6px 10px;
}

.zoom-controls button:nth-child(2) {
  font-size: 9px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

#map-canvas {
  height: 550px;
  touch-action: none;
  cursor: grab;
}

#map-canvas,
#map-canvas * {
  -webkit-user-select: none;
  user-select: none;
}

#map-canvas svg.panning {
  cursor: grabbing;
}

.discoveries {
  margin: 48px 0 24px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.discovery-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 26px;
}

.discovery-heading h2 {
  font-family: Georgia, serif;
  font-weight: normal;
  font-size: 32px;
  margin: 8px 0;
}

.discovery-heading p:not(.eyebrow),
.insight-limits {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.insight-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 32px;
}

.insight-card {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.insight-card h3 {
  font-family: Georgia, serif;
  font-weight: normal;
  font-size: 23px;
  margin: 8px 0 12px;
  overflow-wrap: anywhere;
}

.insight-card>p:not(.eyebrow) {
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 16px;
}

.insight-action {
  margin-top: auto;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.history-discovery,
.sentiment-editor {
  margin: 18px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.history-discovery>p:not(.eyebrow),
.raw-rating p {
  font-size: 12px;
  line-height: 1.8;
}

.history-discovery .eyebrow {
  margin-bottom: 8px;
}

.sentiment-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sentiment-choices button {
  font-size: 11px;
  padding: 8px 10px;
}

.sentiment-choices [aria-pressed="true"] {
  background: #e3e8dc;
  border-color: #788c70;
  color: #304c3c;
}

.clear-sentiment {
  font-size: 11px;
  margin-top: 10px;
}

.raw-rating {
  font-size: 11px;
  margin: 12px 0;
  color: #7c8772;
}

.tour-banner {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
}

.tour-banner>div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tour-banner strong {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: normal;
}

.tour-banner #tour-note {
  font-size: 12px;
  line-height: 1.7;
  max-width: 760px;
}

.tour-banner button {
  flex-shrink: 0;
}

.tour-banner .tour-actions {
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
}

.tour-actions a {
  font-size: 11px;
}

.tour-actions a {
  text-underline-offset: 3px;
}

#tooltip .history-discovery {
  margin: 8px 0 0;
  padding: 8px 0 0;
}

#tooltip .history-discovery p {
  margin: 0 0 5px;
}

@media (max-width: 900px) {
  .insight-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .insight-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .discovery-heading,
  .tour-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .discovery-heading h2 {
    font-size: 28px;
  }
}

#map-canvas:active {
  cursor: grabbing;
}

#map-canvas svg {
  width: 100%;
  height: 100%;
}

.collection-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats {
  display: flex;
  gap: 34px;
}

.stat strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 400;
}

.stat span {
  font-size: 10px;
  color: #8a917f;
  margin-left: 7px;
}

.collection-footer>p {
  font-size: 10px;
  color: #969a8c;
  font-style: italic;
}

footer {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  font-size: 10px;
}

footer>span:last-child {
  font-size: 9px;
  letter-spacing: 2px;
}

.footer-mark {
  font-size: 19px;
  margin-left: 10px;
}

.book-panel {
  position: absolute;
  z-index: 5;
  border: 1px solid #dddccd;
}

.book-panel h2 {
  margin: 14px 0 8px;
}

.book-panel p {
  font-size: 11px;
  color: #7a8370;
  line-height: 1.7;
}

.book-panel .close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: none;
  font-size: 18px;
}

.book-panel dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 11px;
  gap: 12px;
  margin-top: 20px;
}

.book-panel dt {
  color: #959b89;
}

.book-panel dd {
  margin: 0;
  text-align: right;
}

.book-panel .author-link {
  border: 0;
  background: none;
  padding: 0;
  color: #486343;
  text-decoration: underline;
  font-size: 11px;
}

#tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 10;
  border: 1px solid #d9dccb;
  border-radius: 4px;
  padding: 12px 15px;
  font-size: 11px;
  max-width: 240px;
  line-height: 1.6;
}

#tooltip strong {
  font-family: Georgia, serif;
  font-size: 14px;
  display: block;
}

#tooltip span {
  display: block;
}

.import-result {
  min-height: 650px;
  padding: 90px 0;
  text-align: center;
}

.import-result .actions {
  justify-content: center;
}

.import-summary {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 35px 0;
}

.import-summary strong {
  display: block;
  font: 32px Georgia, serif;
}

.import-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

#import-note {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 30px;
}

#message {
  padding: 14px;
  border: 1px solid #d4c6a5;
  border-radius: 4px;
}

#empty-filter {
  position: absolute;
  bottom: 65px;
  left: 20px;
  right: 20px;
  text-align: center;
  font-size: 12px;
  color: #7b806c;
}

[hidden] {
  display: none !important;
}

@media(min-width:1550px) {
  #map-canvas {
    height: 640px;
  }

  .landing {
    min-height: 760px;
  }
}

@media(max-width:900px) {
  header {
    height: 80px;
  }

  .header-note {
    display: none;
  }

  header .text-button {
    margin-left: auto;
  }

  .landing {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 55px;
  }

  .intro {
    text-align: center;
  }

  h1 {
    font-size: 45px;
  }

  .actions {
    justify-content: center;
  }

  details {
    margin: 25px auto;
  }

  .landing-art svg {
    height: 470px;
  }

  .landing-art {
    padding-bottom: 35px;
  }

  .map-heading h1 {
    font-size: 34px;
  }

  .workspace {
    grid-template-columns: 135px 1fr;
  }

  .sidebar {
    padding-right: 13px;
  }

  .collection-footer {
    margin-left: 135px;
  }

  .collection-footer>p {
    display: none;
  }

  #map-canvas {
    height: 530px;
  }
}

@media(max-width:560px) {
  main {
    padding: 0 5%;
  }

  .brand {
    font-size: 23px;
  }

  .text-button {
    font-size: 10px;
  }

  h1 {
    font-size: 38px;
  }

  .intro-copy {
    font-size: 13px;
  }

  .actions {
    flex-wrap: wrap;
  }

  .primary,
  .secondary {
    padding: 12px;
  }

  .landing-art svg {
    height: 370px;
  }

  .map-heading {
    margin-top: 30px;
    align-items: flex-start;
    gap: 12px;
  }

  .map-heading h1 {
    font-size: 30px;
  }

  .map-heading .eyebrow {
    font-size: 8px;
  }

  .map-heading p:last-child {
    font-size: 11px;
  }

  .export {
    font-size: 10px;
    white-space: nowrap;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
  }

  .side-section {
    margin-bottom: 10px;
    width: 100%;
  }

  .side-section .eyebrow {
    margin-bottom: 6px;
  }

  #years,
  #genres {
    display: flex;
    overflow: auto;
    gap: 4px;
  }

  .filter {
    width: auto;
    white-space: nowrap;
    padding: 8px;
    font-size: 10px;
  }

  .author-section {
    width: 65%;
  }

  .reset {
    align-self: center;
  }

  #map-canvas {
    height: 440px;
  }

  .canvas-top,
  .canvas-bottom {
    left: 15px;
    right: 15px;
  }

  .collection-footer {
    margin-left: 0;
  }

  .stats {
    gap: 20px;
  }

  .stat strong {
    font-size: 21px;
  }

  .stat span {
    font-size: 9px;
  }

  .book-panel {
    top: auto;
    bottom: 20px;
    right: 10px;
    width: 230px;
  }

  footer {
    font-size: 9px;
  }

  .import-summary {
    gap: 22px;
  }

  .import-summary strong {
    font-size: 26px;
  }
}

@media(min-width:561px) {
  #map-canvas {
    height: 100%;
    min-height: 620px;
  }
}

@media(min-width:561px) {
  .map-area {
    min-height: 620px;
  }

  #map-canvas {
    position: absolute;
    inset: 0;
    min-height: 0;
    height: 100%;
  }
}

.map-node {
  cursor: pointer;
  transition: opacity .18s;
}

.map-node:focus-visible .node-dot {
  stroke: #b48b53;
  stroke-width: 1.7;
}

.map-node.selected .node-dot {
  stroke: #334e3d;
  stroke-width: 1.4;
}

.map-label {
  cursor: pointer;
}

.map-label:focus-visible {
  outline: none;
}

#map-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #7c8773;
  font: 24px Georgia, serif;
  pointer-events: none;
}

.timeline-controls {
  margin: 20px 0 0 174px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 14px;
}

.timeline-actions {
  display: flex;
  align-items: center;
  margin-bottom: 13px;
}

.timeline-actions button {
  font-size: 11px;
  padding: 8px 10px;
}

#path-toggle[aria-pressed=true] {
  background: #e5e9dc;
  border-color: #9da98c;
}

#timeline-date {
  margin-left: auto;
  font: 14px Georgia, serif;
}

#timeline-slider {
  width: 100%;
  cursor: pointer;
  margin: 0;
}

#timeline-years {
  position: relative;
  height: 20px;
  margin: 5px 12px 0;
  font-size: 9px;
  color: #9a9f8b;
}

#timeline-years span {
  position: absolute;
  transform: translateX(-50%);
}

#timeline-note {
  font-size: 10px;
  line-height: 1.6;
  color: #939987;
  margin: 8px 0 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.book-panel {
  max-height: calc(100% - 85px);
  overflow: auto;
}

.book-panel h2 {
  font-size: 23px;
  margin-top: 8px;
}

.relationship-list {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.relationship-list .eyebrow {
  font-size: 8px;
  margin-bottom: 12px;
}

.relationship-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid #e5e6da;
  padding: 8px 0;
}

.relationship-item strong {
  font: 13px/1.35 Georgia, serif;
  display: block;
}

.relationship-item span {
  font-size: 9px;
  color: #89917c;
  display: block;
  line-height: 1.5;
  margin-top: 4px;
}

.relationship-item:hover strong {
  text-decoration: underline;
}

.relationship-note {
  font-size: 9px !important;
}

.metadata-note,
.original-title {
  font-size: 10px;
  color: #909680;
  line-height: 1.6;
}

.original-title p {
  font-size: 11px;
  margin-top: 7px;
}

.series-link {
  margin: 12px 0 0;
  text-align: left;
}

.author-region {
  cursor: pointer;
  transition: opacity .18s;
}

.author-region:focus-visible {
  stroke-width: 1.6;
}

.minor-genres summary {
  color: #949986;
  font-size: 10px;
  cursor: pointer;
}

.minor-genres #genres {
  margin-top: 10px;
}

.replay-speed {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 10px;
}

.replay-speed select {
  border: 1px solid var(--line);
  background: transparent;
  color: #65775e;
  padding: 4px;
}

.why-here,
.journey-context,
.reading-order-list {
  border-top: 1px solid var(--line);
  margin-top: 17px;
  padding-top: 14px;
}

.why-here .eyebrow,
.journey-context .eyebrow,
.reading-order-list summary {
  font-size: 9px;
  letter-spacing: 1px;
  color: #879179;
}

.why-here p {
  font-size: 11px;
  line-height: 1.65;
}

.chronology-link {
  display: block;
  border: 0;
  background: none;
  padding: 5px 0;
  text-align: left;
  font: 12px/1.5 Georgia, serif;
  color: #667c70;
}

.chronology-link:hover {
  text-decoration: underline;
}

.order-controls {
  display: flex;
  gap: 8px;
  margin: 15px 0 8px;
}

.order-controls button {
  padding: 6px 9px;
  font-size: 10px;
}

.order-controls button[aria-pressed=true] {
  background: #e6e9df;
}

.series-order-note {
  font-size: 11px !important;
  color: #7f826a;
}

button:disabled {
  opacity: .45;
  cursor: default;
}

@media(max-width:900px) {
  .timeline-controls {
    margin-left: 135px;
  }
}

@media(max-width:560px) {
  .brand {
    font-size: 21px;
  }

  .brand svg {
    width: 22px;
    margin-right: 7px;
  }

  .timeline-controls {
    margin-left: 0;
  }

  .timeline-actions {
    gap: 9px;
    flex-wrap: wrap;
  }

  .timeline-actions button {
    font-size: 10px;
    padding: 7px;
  }

  .book-panel {
    width: 280px;
    max-height: 390px;
    bottom: 24px;
  }

  #timeline-date {
    font-size: 12px;
  }

  .canvas-bottom>span {
    font-size: 7px;
    letter-spacing: 1px;
  }
}

@media(prefers-reduced-motion:reduce) {
  .map-node {
    transition: none;
  }
}

:root {
  color-scheme: dark;
  --paper: var(--theme-paper, #101310);
  --ink: var(--theme-ink, #f2e8d8);
  --muted: var(--theme-muted, #a5acb5);
  --line: var(--theme-border, #ffffff20);
  --green: var(--theme-green, #aeba9e);
}

body {
  background: var(--theme-paper, #101310);
  color: var(--ink);
}

header {
  height: 68px;
  margin: 0;
  padding: 0 2.5%;
  border-bottom: 1px solid var(--line);
  background: var(--theme-paper, #101310);
  gap: 26px;
}

.brand {
  color: var(--theme-ink, #f2e8d8);
  font-size: 29px;
  letter-spacing: .2px;
}

.brand svg {
  color: var(--theme-accent, #e7cfab);
}

.header-note {
  color: var(--theme-muted, #afb5bd);
  margin-left: auto;
  margin-right: auto;
}

.map-nav {
  display: flex;
  align-items: center;
  gap: 25px;
  font: 14px Georgia, serif;
}

.map-nav a {
  color: var(--theme-muted, #bcc2cb);
  text-decoration: none;
  padding: 12px 0;
}

.map-nav a:first-child {
  color: var(--theme-accent, #f7ebd5);
  border-bottom: 1px solid var(--theme-accent, #dab783);
}

.map-nav button {
  font: inherit;
  color: var(--theme-muted, #bcc2cb);
}

body:has(#map-screen[hidden]) .map-nav {
  display: none;
}

main {
  max-width: 1900px;
  padding: 0 2.5%;
}

h1 {
  color: var(--theme-ink, #f5eddf);
  letter-spacing: -1.5px;
}

.eyebrow {
  color: var(--theme-accent, #c9c0ac);
  font-weight: 500;
  font-size: 10px;
}

.map-heading {
  margin: 30px 0 24px;
  gap: 25px;
  flex-wrap: wrap;
}

.map-heading>div:first-child {
  flex: 1 1 480px;
}

.map-heading h1 {
  font-size: 46px;
  margin-bottom: 10px;
}

.map-heading p:last-child {
  font: 16px/1.5 Georgia, serif;
  color: var(--theme-muted, #afb5bd);
}

.map-heading .stats {
  gap: 0;
  margin-left: auto;
  flex-wrap: nowrap;
}

.map-heading .stat {
  min-width: 86px;
  padding: 6px 19px;
  border-left: 1px solid var(--line);
  text-align: center;
}

.map-heading .stat strong {
  font: 25px/1.5 Georgia, serif;
  color: var(--theme-ink, #f5eddf);
  display: block;
  white-space: nowrap;
}

.map-heading .stat span {
  font-size: 11px;
  color: var(--theme-muted, #a6adb7);
  margin-left: 0;
}

.export {
  font-size: 11px;
  padding: 10px 14px;
}

.workspace {
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 16px;
  min-height: 630px;
}

.sidebar {
  padding: 16px 14px;
  border: 1px solid var(--line);
  background: var(--theme-surface, #151a15);
  border-radius: 8px;
}

.side-section {
  margin-bottom: 16px;
}

.sidebar .side-section:last-of-type {
  margin-bottom: 12px;
}

.side-section .eyebrow {
  color: var(--theme-muted, #b7bea8);
  font-size: 9px;
}

.filter {
  color: var(--theme-muted, #aeb6c2);
  font-size: 12px;
  padding: 5px 10px;
}

.filter:hover {
  background: var(--theme-hover, #ffffff08);
}

.filter.active {
  background: var(--theme-hover, #293029);
  color: var(--theme-ink, #f4ebdb);
}

.filter .count {
  color: var(--theme-muted, #acb4bf);
}

select {
  background: var(--theme-surface, #181d18);
  border-color: var(--theme-border, #ffffff28);
  color: var(--theme-ink, #d2d7de);
  padding: 10px 8px;
  font-size: 11px;
}

option {
  background: var(--theme-surface, #181d18);
  color: var(--theme-ink, #eee6d8);
}

.reset {
  color: var(--theme-accent, #d7c2a2);
  font-size: 11px;
}

.map-area {
  background: var(--theme-paper, #101310);
  border-radius: 0;
  min-height: 630px;
}

.canvas-top,
.canvas-bottom {
  color: var(--theme-muted, #9da6b1);
  font-size: 8px;
  letter-spacing: 1.8px;
  left: 18px;
  right: 18px;
}

.zoom-controls {
  background: var(--theme-surface, #0f151bcc);
  border: 1px solid var(--theme-border, #ffffff30);
  border-radius: 5px;
}

.zoom-controls button {
  color: var(--theme-accent, #ebd1ab);
}

.zoom-controls button:nth-child(2) {
  border-color: var(--theme-border, #ffffff25);
}

.map-node.selected .node-dot,
.map-node:focus-visible .node-dot {
  stroke: var(--theme-accent, #fff0cf);
  stroke-width: 1.2;
}

.map-label:focus-visible {
  outline-color: var(--theme-accent, #eac58b);
}

.author-region:focus-visible {
  stroke: var(--theme-accent, #ffe5b7);
  stroke-opacity: .9;
  outline: none;
}

.book-panel {
  width: 300px;
  padding: 22px;
  background: var(--theme-surface, #181d18f5);
  border-color: var(--theme-border, #ffffff30);
  box-shadow: none;
  border-radius: 8px;
  right: 18px;
  top: 28px;
}

.book-panel h2 {
  color: var(--theme-ink, #f5ecdd);
  font: 25px/1.3 Georgia, serif;
}

.book-panel p,
.book-panel dt,
.relationship-item span,
.relationship-note,
.metadata-note {
  color: var(--theme-muted, #a9b3c1);
}

.book-panel dd {
  color: var(--theme-ink, #ddd7cd);
}

.book-panel .author-link,
.chronology-link {
  color: var(--theme-accent, #e6c795);
}

.book-panel .close {
  color: var(--theme-ink, #c8cfd8);
}

.relationship-item {
  border-color: var(--theme-border, #ffffff18);
  color: var(--theme-ink, #eee4d3);
}

.relationship-item strong {
  color: var(--theme-accent, #eadfcd);
  font-family: Georgia, serif;
  font-weight: normal;
  font-size: 13px;
}

.relationship-item:hover {
  background: var(--theme-hover, #ffffff07);
}

.sentiment-choices [aria-pressed="true"],
.order-controls [aria-pressed="true"] {
  background: var(--theme-hover, #d9af7020);
  border-color: var(--theme-green, #aeba9e);
  color: var(--theme-accent, #ffe8bd);
}

.secondary,
.primary {
  border: 1px solid var(--theme-border, #ffffff30);
  color: var(--theme-ink, #e9dece);
  background: var(--theme-surface, #141b23);
  border-radius: 5px;
}

.secondary:hover {
  background: var(--theme-hover, #202a36);
}

.primary {
  border-color: var(--theme-green, #aeba9e);
  color: var(--theme-accent, #fae4bb);
  background: linear-gradient(90deg, var(--theme-hover, #b98c4330), var(--theme-hover, #aeba9e12));
}

.primary:hover {
  background: var(--theme-hover, #aeba9e28);
}

.primary:disabled,
.secondary:disabled,
.text-button:disabled {
  opacity: .4;
}

.timeline-controls {
  margin-left: 221px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.timeline-actions {
  gap: 20px;
}

.timeline-actions button {
  color: var(--theme-ink, #c4cbd5);
}

#path-toggle[aria-pressed="true"] {
  color: var(--theme-accent, #ffe1a8);
  border-color: var(--theme-accent, #dab67d);
  background: var(--theme-hover, #aeba9e12);
  box-shadow: none;
}

#timeline-date {
  color: var(--theme-accent, #e0c79f);
  font-family: Georgia, serif;
  font-size: 16px;
}

#timeline-slider {
  accent-color: var(--theme-accent, #e5c48c);
}

#timeline-slider::-webkit-slider-runnable-track {
  background: var(--theme-accent, #a08a60);
  height: 4px;
  border-radius: 4px;
  box-shadow: none;
}

#timeline-slider::-webkit-slider-thumb {
  background: var(--theme-accent, #ffe5b5);
  border: 1px solid var(--theme-accent, #edca8a);
  box-shadow: none;
  margin-top: -5px;
}

#timeline-years,
#timeline-note,
#timeline-note span {
  color: var(--theme-muted, #99a3b0);
}

.replay-speed {
  color: var(--theme-muted, #99a3b0);
}

.collection-footer {
  margin-left: 221px;
  border-color: var(--line);
  min-height: 0;
  padding: 12px 0;
}

.collection-footer p {
  color: var(--theme-muted, #8993a1);
}

.tour-banner {
  background: var(--theme-surface, #151d26);
  border-color: var(--theme-border, #ad8b5444);
  margin-left: 221px;
}

.tour-banner .eyebrow {
  color: var(--theme-accent, #dfbd87);
}

.tour-banner #tour-note {
  color: var(--theme-muted, #bbc3cd);
}

.tour-actions a {
  color: var(--theme-accent, #e6c795);
}

.discoveries {
  border-color: var(--line);
  margin-top: 28px;
}

.discovery-heading h2,
.insight-card h3 {
  color: var(--theme-ink, #eee4d4);
}

.insight-card>p:not(.eyebrow) {
  color: var(--theme-muted, #a9b3c1);
}

.insight-card .eyebrow {
  color: var(--theme-accent, #dab982);
}

.insight-action {
  color: var(--theme-accent, #e6c795);
}

.raw-rating,
details,
.original-title {
  color: var(--theme-muted, #a9b3c1);
}

#tooltip {
  background: var(--theme-surface, #111923f5);
  border-color: var(--theme-border, #ffffff30);
  color: var(--theme-muted, #bac4d1);
  box-shadow: none;
}

#tooltip strong {
  color: var(--theme-accent, #f4e7d1);
}

#tooltip span {
  color: var(--theme-muted, #bac4d1);
}

#tooltip .eyebrow {
  color: var(--theme-accent, #e1bc82);
}

.intro-copy,
.privacy,
.art-caption {
  color: var(--theme-muted, #a2acb8);
}

footer {
  border-color: var(--line);
  color: var(--theme-muted, #8993a1);
  margin: 20px 2.5% 0;
}

#message {
  background: var(--theme-surface, #22202a);
  border-color: var(--theme-accent, #c59669);
  color: var(--theme-accent, #eee0cc);
}

@media (min-width: 1500px) {
  .map-area {
    min-height: 700px;
  }
}

@media (max-width: 1100px) {
  .header-note {
    display: none;
  }

  .map-nav {
    margin-left: auto;
  }

  .map-heading>div:first-child {
    flex-basis: 100%;
  }

  .map-heading .stats {
    margin-left: 0;
  }

  .map-heading .stat:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .workspace {
    grid-template-columns: 174px minmax(0, 1fr);
  }

  .timeline-controls,
  .collection-footer,
  .tour-banner {
    margin-left: 190px;
  }
}

@media (max-width: 560px) {
  header {
    height: 65px;
    padding: 0 5%;
    gap: 14px;
  }

  .brand {
    font-size: 22px;
  }

  .map-nav {
    display: none;
  }

  main {
    padding: 0 5%;
  }

  .map-heading {
    margin-top: 25px;
    gap: 15px;
  }

  .map-heading h1 {
    font-size: 32px;
  }

  .map-heading p:last-child {
    font-size: 13px;
  }

  .map-heading .stats {
    width: 100%;
    justify-content: space-between;
    order: 2;
  }

  .map-heading .stat {
    min-width: 0;
    padding: 4px 8px;
  }

  .map-heading .stat strong {
    font-size: 18px;
  }

  .map-heading .stat span {
    font-size: 9px;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    margin-bottom: 12px;
    padding: 12px;
  }

  .map-area {
    min-height: 440px;
  }

  .timeline-controls,
  .collection-footer,
  .tour-banner {
    margin-left: 0;
  }

  .timeline-actions {
    gap: 10px;
  }

  .book-panel {
    width: min(290px, calc(100% - 25px));
    right: 10px;
    top: auto;
    bottom: 20px;
  }

  .tour-banner {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-node {
    transition: none;
  }
}

.map-area {
  border: 1px solid var(--theme-border, #7d89782b);
}

.sidebar,
.book-panel,
.secondary,
.primary {
  border-radius: 2px;
}

.map-label:focus-visible {
  filter: none;
}

.catalog-index {
  font: 9px/1.6 monospace;
  letter-spacing: 1px;
  color: var(--theme-muted, #a7ae9d);
}

.author-region {
  pointer-events: stroke;
}

.overview-region {
  cursor: pointer;
}

.overview-region:focus-visible path {
  stroke: var(--theme-accent, #eee3c9);
}

#years {
  max-height: 240px;
  overflow-y: auto;
}

.reading-portrait [role="button"] {
  cursor: pointer;
}

.reading-portrait [role="button"]:focus-visible {
  outline: 1px solid var(--theme-ink, #ddd8c7);
}

.portrait-debug {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 10px;
  max-height: 300px;
  overflow-y: auto;
}

:root[data-theme="light"] {
  color-scheme: light;
  --paper: #f6f3ea;
  --ink: #293b30;
  --muted: #586859;
  --green: #42634d;
  --line: #293b3029;
  --theme-paper: #f6f3ea;
  --theme-surface: #eeeee4;
  --theme-hover: #e2e8db;
  --theme-border: #293b3033;
  --theme-ink: #293b30;
  --theme-muted: #586859;
  --theme-accent: #795422;
  --theme-green: #42634d;
  --theme-loved: #304b36;
  --theme-liked: #637b5d;
  --theme-unrated: #7a8471;
}

#theme-toggle {
  flex-shrink: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}

:root[data-theme="light"] .text-button {
  color: var(--theme-accent);
}

:root[data-theme="light"] .brand-dot {
  color: var(--theme-accent);
}

:root[data-theme="light"] #theme-toggle {
  color: var(--ink);
}

:root[data-theme="light"] .map-node.selected .node-dot,
:root[data-theme="light"] .map-node:focus-visible .node-dot {
  stroke: #795422;
}

:root[data-theme="light"] .map-label:focus-visible {
  outline-color: #795422;
}

:root[data-theme="light"] .author-region:focus-visible {
  stroke: #795422;
}

:root[data-theme="light"] svg [fill="#101310"] {
  fill: #f6f3ea;
}

:root[data-theme="light"] svg [fill="#ddd8c7"],
:root[data-theme="light"] svg [fill="#eee3cb"],
:root[data-theme="light"] svg [fill="#c6c7b9"],
:root[data-theme="light"] svg [fill="#cfccb6"] {
  fill: #293b30;
}

:root[data-theme="light"] svg [fill="#a7ae9d"],
:root[data-theme="light"] svg [fill="#879183"],
:root[data-theme="light"] svg [fill="#8e9a8b"],
:root[data-theme="light"] svg [fill="#929c92"],
:root[data-theme="light"] svg [fill="#a3ae99"],
:root[data-theme="light"] svg [fill="#a6ad9c"],
:root[data-theme="light"] svg [fill="#b5aa96"],
:root[data-theme="light"] svg [fill="#adb3a5"] {
  fill: #586859;
}

:root[data-theme="light"] svg [stroke="#c9c9b4"],
:root[data-theme="light"] svg [stroke="#c1c7ad"],
:root[data-theme="light"] svg [stroke="#778571"],
:root[data-theme="light"] svg [stroke="#89918c"],
:root[data-theme="light"] svg [stroke="#a9b5a0"],
:root[data-theme="light"] svg [stroke="#aab4a3"],
:root[data-theme="light"] svg [stroke="#adb7a3"],
:root[data-theme="light"] svg [stroke="#9da691"],
:root[data-theme="light"] svg [stroke="#8b9481"] {
  stroke: #52674c;
}

:root[data-theme="light"] svg [stroke="#c4ae91"] {
  stroke: #795422;
}

:root[data-theme="light"] svg [stroke="#e6e0cb"],
:root[data-theme="light"] svg [stroke="#b8bdae"],
:root[data-theme="light"] svg [stroke="#b4bcae"] {
  stroke: #486044;
}

:root[data-theme="light"] svg .node-dot[fill="#ded8c2"] {
  fill: #304b36;
}

:root[data-theme="light"] svg .node-dot[fill="#a3ad9b"] {
  fill: #637b5d;
}

:root[data-theme="light"] svg .node-dot[fill="#737a77"] {
  fill: #7a8471;
}

:root[data-theme="light"] svg .rating-mark[stroke="#343832"] {
  stroke: #f6f3ea;
}

@media(max-width:560px) {
  header {
    gap: 8px;
  }

  header .brand {
    font-size: 20px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  header .brand svg {
    width: 21px;
    margin-right: 7px;
  }

  #theme-toggle {
    font-size: 10px;
    padding: 7px;
    margin-left: auto;
  }

  #import-top {
    font-size: 0;
  }

  #import-top span {
    font-size: 16px;
    margin-left: 0;
  }
}

/* Evidence stays close at hand, but closed until requested. */
.map-key {
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.placement-details,
.why-here {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
}

.placement-details>summary,
.why-here>summary {
  color: var(--ink);
  font-size: 12px;
}
