@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Libre+Baskerville:wght@400;700&display=swap");

body {
  padding: 0;
  margin: 0;
}

@font-face {
  font-family: "Ringbearer";
  src: url("../../assets/ringbearer.TTF") format("truetype");
}

html, body, #map {
  height: 100%;
  font: 10pt "Libre Baskerville", Georgia, serif;
}

body,
button,
input,
label,
table,
td,
th,
p {
  font-family: "Libre Baskerville", Georgia, serif;
}

h1,
h2,
h3,
.sidebar-header,
.polygon-label {
  font-family: "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0.02em;
}

.sidebar-tabs a,
.atlas-map-nav__link {
  font-family: "Ringbearer", Georgia, serif;
}

.map-title,
.brand-mark,
.ringbearer-accent {
  font-family: "Ringbearer", "Cormorant Garamond", Georgia, serif;
}

.lorem {
  font-style: italic;
  color: #AAA;
}

#settlementsSection,
#pathsSection,
#roadsSection,
#geographySection,
#battlesSection,
#itemsSection,
#campsSection,
#regionsSection,
#provisionsSection,
#creatures_and_beingsSection {
  display: flex;
  flex-direction: column; /* Stack the labels vertically */
  gap: 8px; /* Optional: Add spacing between items */
  padding-top: 16px; /* Optional: Add padding for indentation */
}

#regionsSection h1,
#campsSection h1,
#itemsSection h1, 
#provisionsSection h1,
#settlementsSection h1, 
#pathsSection h1, 
#geographySection h1,
#battlesSection h1,
#creatures_and_beingsSection h1 {
  font-size: 18px; /* Adjust the size as needed */
  font-weight: 600; /* Bold text */
  margin: 2px 0; /* Adjust top and bottom spacing */
  padding-top: 2px; /* Optional: Add spacing above the header */
  color: #444; /* Set a consistent text color */
  text-align: left; /* Align text to the left */
}

#settlementsSection label,
#pathsSection label,
#roadsSection label,
#geographySection label,
#battlesSection label,
#itemsSection label,
#campsSection label,
#regionsSection label,
#provisionsSection label,
#creatures_and_beingsSection label {
  display: flex;
  align-items: center; /* Align the checkbox and label text */
  cursor: pointer; /* Change the cursor to indicate clickability */
  font-size: 15px;
  line-height: 1.45;
}

#regionsSection input[type="checkbox"],
/* #campsSection input[type="checkbox"], */
#itemsSection input[type="checkbox"],
#provisionsSection input[type="checkbox"],
/* #pathsSection input[type="checkbox"], */
#roadsSection input[type="checkbox"],
#itemsSection input[type="checkbox"],
#battlesSection input[type="checkbox"],
#settlementsSection input[type="checkbox"],
#geographySection input[type="checkbox"],
#creatures_and_beingsSection input[type="checkbox"] {
  margin-right: 8px; /* Add spacing between the checkbox and label text */
}

.sidebar-tabs .material-icons {
  position: relative;
  top: 10px; /* Shifts the icons down */
}
.sidebar-tabs .material-symbols-outlined {
  position: relative;
  top: 10px; /* Shifts the icons down */
}

.polygon-label {
  /*background-color: rgba(255, 255, 255, 1); /* Fully opaque for visibility */
  border: 2px solid black;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 18px;
  color: black;
  font-weight: 600;
  text-align: center;
  pointer-events: none; /* Prevent the label from being interactive */
}

.leaflet-marker-icon.atlas-marker-icon {
  transition: opacity 140ms ease;
  transform-origin: 50% 100%;
  will-change: opacity, translate;
}

.leaflet-marker-icon.atlas-marker-icon--hover {
  opacity: 0.5;
}

.leaflet-marker-icon.atlas-marker-icon--hover-bounce {
  animation: atlas-marker-hover-bounce 220ms ease-out 1;
}

@keyframes atlas-marker-hover-bounce {
  0% {
    translate: 0 0;
  }

  38% {
    translate: 0 -8px;
  }

  65% {
    translate: 0 -5px;
  }

  100% {
    translate: 0 0;
  }
}

#campsSection, #pathsSection, #roadsSection {
  padding-top: 0; /* Remove extra padding from the top */
}

#campsSection h3,
#pathsSection h3,
#roadsSection h3 {
  margin-top: 0; /* Remove any extra margin on the h3 headers */
}

#campsSection label, #pathsSection label, #roadsSection label {
  margin-top: 0; /* Remove top margin from the labels */
}

.campsite-popup {
  min-width: 260px;
  max-width: 320px;
  color: #38291a;
}

.campsite-popup-shell .leaflet-popup-content-wrapper {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.campsite-popup-shell .leaflet-popup-content {
  margin: 0;
}

.campsite-popup-shell .leaflet-popup-tip {
  background: #fefaf0;
  box-shadow: none;
}

.lore-popup-shell .leaflet-popup-content-wrapper {
  padding: 0;
  background: transparent;
  box-shadow: none;
  max-width: min(760px, calc(100vw - 32px));
}

.lore-popup-shell .leaflet-popup-content {
  margin: 0;
}

.lore-popup-shell .leaflet-popup-tip {
  background: #fefaf0;
  box-shadow: none;
}

.campsite-popup__frame {
  padding: 16px;
  border: 1px solid #8f7650;
  border-radius: 10px;
  background: #fefaf0;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 224, 0.45);
}

.campsite-popup__kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7b5e32;
}

.campsite-popup__title {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  color: #2d2013;
}

.campsite-popup__subtitle {
  margin: 6px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(111, 83, 40, 0.35);
  font-size: 15px;
  font-style: italic;
  color: #5e4727;
}

.campsite-popup__details {
  display: grid;
  gap: 8px;
}

.campsite-popup__row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(111, 83, 40, 0.2);
}

.campsite-popup__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #755a32;
}

.campsite-popup__value {
  font-size: 14px;
  text-align: right;
  color: #2c2218;
}

.campsite-popup__notes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(111, 83, 40, 0.35);
}

.campsite-popup__notes-label {
  margin: 0 0 6px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  color: #41301c;
}

.campsite-popup__notes-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #38291a;
}

.lore-popup {
  min-width: 260px;
  max-width: 640px;
  color: #38291a;
}

.lore-popup--settlement {
  width: min(640px, calc(100vw - 56px));
  max-width: 100%;
}

.lore-popup--settlement .lore-popup__frame {
  display: flex;
  flex-direction: column;
  max-height: min(520px, calc(100vh - 120px));
  max-height: min(520px, calc(100dvh - 120px));
}

.lore-popup__frame {
  padding: 16px;
  border: 1px solid #8f7650;
  border-radius: 10px;
  background: #fefaf0;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 224, 0.45);
}

.lore-popup__kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7b5e32;
}

.lore-popup__title {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  color: #2d2013;
}

.lore-popup__details {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.lore-popup__sections {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.lore-popup__section {
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(111, 83, 40, 0.2);
}

.lore-popup__section-title {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  line-height: 1.05;
  color: #41301c;
}

.lore-popup__section-text {
  margin: 1px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: #38291a;
}

.lore-popup__row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(111, 83, 40, 0.2);
}

.lore-popup__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #755a32;
}

.lore-popup__value {
  font-size: 14px;
  text-align: right;
  color: #2c2218;
}

.lore-popup__notes {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(111, 83, 40, 0.35);
}

.lore-popup__notes-label {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  line-height: 1.05;
  color: #41301c;
}

.lore-popup__notes-text {
  margin: 1px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: #38291a;
  white-space: pre-line;
}

.lore-popup__notes--scrollable {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  min-height: 0;
  flex: 1 1 auto;
}

.lore-popup__link {
  display: table;
  margin-top: 14px;
  margin-left: auto;
  margin-right: auto;
  padding: 8px 12px;
  border: 1px solid #8f7650;
  border-radius: 999px;
  background: rgba(126, 102, 59, 0.12);
  color: #4d371a;
  text-decoration: none;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
}

.lore-popup__link:hover,
.lore-popup__link:focus-visible {
  background: rgba(126, 102, 59, 0.2);
}

.atlas-map-nav {
  position: absolute;
  top: 18px;
  right: 18px;
  left: auto;
  transform: none;
  z-index: 900;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  max-width: calc(100vw - 24px);
  pointer-events: auto;
}

.atlas-map-nav__menu {
  position: relative;
}

.atlas-map-nav__toggle {
  list-style: none;
  cursor: pointer;
}

.atlas-map-nav__toggle::-webkit-details-marker {
  display: none;
}

.atlas-map-nav__link {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  padding: 10px 14px;
  border: 1px solid rgba(218, 184, 112, 0.55);
  border-radius: 999px;
  background: rgba(31, 22, 13, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: #f5e6c8;
  text-decoration: none;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1;
}

.atlas-map-nav__dropdown {
  display: grid;
  gap: 8px;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none;
  width: max-content;
  min-width: max-content;
  max-width: calc(100vw - 24px);
  z-index: 901;
}

.atlas-map-nav__toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(218, 184, 112, 0.55);
  border-radius: 999px;
  background: rgba(31, 22, 13, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: #f5e6c8;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1;
}

.atlas-map-nav__toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.atlas-map-nav__link > span,
.atlas-map-nav__toggle-label > span {
  font-family: inherit;
  flex: initial;
}

.atlas-map-nav__link .material-icons,
.atlas-map-nav__toggle .material-icons {
  font-size: 20px;
}

.atlas-map-nav__link--home {
  background: rgba(31, 22, 13, 0.88);
}

.atlas-map-nav__link--current {
  background: rgba(111, 72, 32, 0.92);
}

.atlas-map-nav__menu[open] .atlas-map-nav__chevron {
  transform: rotate(180deg);
}

.atlas-map-nav__link:hover,
.atlas-map-nav__link:focus-visible,
.atlas-map-nav__toggle:hover,
.atlas-map-nav__toggle:focus-visible {
  transform: none;
  background: rgba(47, 33, 18, 0.95);
}

.stories-section {
  display: grid;
  gap: 16px;
  padding-top: 4px;
}

.story-launch-card {
  padding: 16px;
  border: 1px solid rgba(143, 118, 80, 0.85);
  border-radius: 14px;
  background: linear-gradient(rgba(255, 250, 240, 0.98), rgba(242, 232, 210, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 248, 224, 0.45);
}

.story-launch-card__eyebrow {
  margin: 0 0 6px;
  color: #7b5e32;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.story-launch-card__title {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  color: #2d2013;
}

.story-launch-card__copy {
  margin: 10px 0 0;
  color: #4f3b26;
  font-size: 14px;
  line-height: 1.6;
}

.story-launch-card__meta {
  margin-top: 12px;
  color: #755a32;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-launch-card__button {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(111, 83, 40, 0.65);
  border-radius: 999px;
  background: rgba(47, 29, 18, 0.92);
  color: #f3e1ba;
  cursor: pointer;
  font-family: "Ringbearer", Georgia, serif;
  font-size: 14px;
}

.story-launch-card__button:hover,
.story-launch-card__button:focus-visible {
  background: rgba(70, 45, 22, 0.96);
}

.leaflet-story-pane {
  z-index: 575;
  pointer-events: none;
}

.leaflet-story-pane canvas,
.leaflet-story-pane svg {
  pointer-events: none;
}

.story-panel {
  position: absolute;
  top: 18px;
  left: 60px;
  bottom: 104px;
  width: min(430px, calc(100vw - 36px));
  z-index: 850;
  pointer-events: none;
}

.story-panel--hidden {
  display: none;
}

.story-panel[hidden] {
  display: none !important;
}

.story-panel__inner {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(143, 118, 80, 0.85);
  border-radius: 18px;
  background: rgba(254, 250, 240, 0.97);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 248, 224, 0.45);
  overflow: hidden;
  pointer-events: auto;
}

.story-panel__summary {
  display: none;
}

.story-panel__body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  flex: 1 1 auto;
}

.story-panel__text {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.story-panel__kicker {
  margin: 0 0 6px;
  color: #7b5e32;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.story-panel__title {
  margin: 0;
  color: #2d2013;
  font-size: 29px;
  line-height: 1.02;
}

.story-panel__meta {
  margin: 8px 0 0;
  color: #5e4727;
  font-size: 14px;
  font-style: italic;
}

.story-panel__narrative {
  margin: 14px 0 0;
  color: #38291a;
  font-size: 14px;
  line-height: 1.65;
}

.story-panel__details {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(111, 83, 40, 0.35);
}

.story-panel__detail-row {
  display: grid;
  grid-template-columns: minmax(110px, 132px) minmax(0, 1fr);
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(111, 83, 40, 0.2);
}

.story-panel__detail-label {
  color: #755a32;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-panel__detail-value {
  color: #2c2218;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}

.story-panel__detail-value--notes {
  max-width: none;
}

.story-panel__counter {
  margin: 14px 0 0;
  color: #755a32;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-panel__media {
  order: -1;
  display: grid;
  align-items: stretch;
}

.story-panel__image,
.story-panel__placeholder {
  grid-area: 1 / 1;
  width: 100%;
  min-height: 200px;
  max-height: min(30vh, 240px);
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(143, 118, 80, 0.75);
  border-radius: 14px;
  background: #efe3c5;
}

.story-panel__image {
  display: block;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.story-panel__placeholder {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  color: #4f3b26;
  background:
    linear-gradient(rgba(254, 250, 240, 0.94), rgba(239, 227, 197, 0.98)),
    url("./assets/book.png") center 24px / 48px 48px no-repeat;
}

.story-panel__image--hidden,
.story-panel__placeholder--hidden {
  display: none;
}

.story-panel__preview-image--hidden,
.story-panel__preview-placeholder--hidden {
  display: none;
}

.story-panel__placeholder-title {
  margin: 40px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 28px;
  line-height: 1;
  color: #2d2013;
}

.story-panel__placeholder-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.story-controls {
  position: fixed;
  bottom: 22px;
  left: 85px;
  z-index: 860;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(218, 184, 112, 0.55);
  border-radius: 999px;
  background: rgba(31, 22, 13, 0.92);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
}

.story-controls--hidden {
  display: none;
}

.story-controls[hidden] {
  display: none !important;
}

.story-controls__button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border: 1px solid rgba(218, 184, 112, 0.45);
  border-radius: 999px;
  background: rgba(63, 43, 20, 0.96);
  color: #f5e6c8;
  cursor: pointer;
  font-family: "Ringbearer", Georgia, serif;
  font-size: 13px;
  line-height: 1;
}

.story-controls__button--primary {
  background: rgba(111, 72, 32, 0.98);
}

.story-controls__button:hover,
.story-controls__button:focus-visible {
  background: rgba(85, 56, 26, 0.98);
}

.story-controls__button .material-icons {
  font-size: 18px;
}

@media (max-width: 860px) {
  .story-panel {
    top: auto;
    bottom: 12px;
    left: 52px;
    width: min(420px, calc(100vw - 64px));
  }

  .story-panel__inner {
    height: auto;
    max-height: min(88vh, calc(100vh - 24px));
    gap: 12px;
    padding: 12px;
    border-radius: 22px;
  }

  .story-panel__summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
  }

  .story-panel__summary:focus-visible {
    outline: 2px solid rgba(111, 72, 32, 0.45);
    outline-offset: 6px;
  }

  .story-panel__grabber {
    width: 48px;
    height: 4px;
    border-radius: 999px;
    background: rgba(111, 83, 40, 0.35);
    align-self: center;
  }

  .story-panel__summary-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    gap: 12px;
    align-items: center;
  }

  .story-panel__summary-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .story-panel__summary-title {
    color: #2d2013;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 26px;
    line-height: 1;
  }

  .story-panel__summary-meta {
    color: #5e4727;
    font-size: 13px;
    line-height: 1.35;
    font-style: italic;
  }

  .story-panel__summary-counter {
    color: #755a32;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .story-panel__summary-media {
    display: grid;
    width: 84px;
    height: 84px;
  }

  .story-panel__preview-image,
  .story-panel__preview-placeholder {
    grid-area: 1 / 1;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(143, 118, 80, 0.7);
    border-radius: 12px;
    background: #efe3c5;
  }

  .story-panel__preview-image {
    display: block;
    object-fit: cover;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  }

  .story-panel__preview-placeholder {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #4f3b26;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    background: linear-gradient(rgba(254, 250, 240, 0.94), rgba(239, 227, 197, 0.98));
  }

  .story-controls {
    position: static;
    left: auto;
    bottom: auto;
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    box-shadow: none;
  }

  .story-controls__button {
    flex: 1 1 0;
    justify-content: center;
    padding: 10px 8px;
    font-size: 12px;
  }

  .story-controls__button span {
    display: none;
  }

  .story-controls__button .material-icons {
    font-size: 20px;
  }

  .story-panel__body {
    display: none;
    min-height: 0;
    overflow: hidden;
  }

  .story-panel--mobile-expanded .story-panel__inner {
    height: min(50vh, 460px);
  }

  .story-panel--mobile-full .story-panel__inner {
    height: min(86vh, calc(100vh - 24px));
  }

  .story-panel--mobile-expanded .story-panel__body,
  .story-panel--mobile-full .story-panel__body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
  }

  .story-panel__title {
    font-size: 28px;
  }

  .story-panel__text {
    padding-right: 0;
  }

  .story-panel__detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .story-panel__detail-value {
    text-align: left;
  }

  .story-panel__detail-value--notes {
    max-width: none;
  }

  .story-panel__image,
  .story-panel__placeholder {
    min-height: 180px;
    max-height: 220px;
    aspect-ratio: 16 / 9;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .story-panel {
    top: 12px;
    right: 24px;
    bottom: 12px;
    left: 52px;
    width: auto;
  }

  .story-panel__inner {
    height: 100%;
    gap: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .story-panel__summary {
    box-sizing: border-box;
    position: absolute;
    right: 0;
    bottom: 68px;
    left: 0;
    display: flex;
    gap: 0;
    padding: 10px 14px;
    border: 1px solid rgba(143, 118, 80, 0.82);
    border-radius: 16px;
    background: rgba(254, 250, 240, 0.96);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
    pointer-events: auto;
  }

  .story-panel__grabber {
    display: none;
  }

  .story-panel__summary-main {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .story-panel__summary-copy {
    gap: 2px;
  }

  .story-panel__summary-title {
    font-size: 22px;
  }

  .story-panel__summary-meta {
    font-size: 12px;
  }

  .story-panel__summary-counter {
    font-size: 10px;
  }

  .story-panel__summary-media {
    display: none;
  }

  .story-controls {
    box-sizing: border-box;
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
  }

  .story-controls__button {
    flex: 1 1 0;
    justify-content: center;
    padding: 8px 6px;
    font-size: 12px;
  }

  .story-controls__button span {
    display: none;
  }

  .story-controls__button .material-icons {
    font-size: 18px;
  }

  .story-panel__body {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 124px;
    left: 0;
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(143, 118, 80, 0.85);
    border-radius: 16px;
    background: rgba(254, 250, 240, 0.97);
    box-shadow:
      0 16px 30px rgba(0, 0, 0, 0.22),
      inset 0 0 0 1px rgba(255, 248, 224, 0.4);
    overflow: hidden;
    pointer-events: auto;
  }

  .story-panel--landscape-expanded .story-panel__body {
    display: grid;
  }

  .story-panel__media {
    order: 0;
    min-height: 0;
  }

  .story-panel__image,
  .story-panel__placeholder {
    min-height: 100%;
    max-height: none;
    aspect-ratio: auto;
  }

  .story-panel__text {
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
  }

  .story-panel__title {
    font-size: 24px;
  }

  .story-panel__meta,
  .story-panel__narrative,
  .story-panel__detail-value {
    font-size: 13px;
  }

  .story-panel__details {
    margin-top: 12px;
    padding-top: 10px;
    gap: 7px;
  }

  .story-panel__detail-row {
    grid-template-columns: 1fr;
    gap: 3px;
    padding-bottom: 6px;
  }
}

@media (max-width: 720px) {
  .lore-popup {
    min-width: 0;
    max-width: calc(100vw - 56px);
  }

  .lore-popup__frame {
    padding: 14px;
  }

  .lore-popup__title {
    font-size: 24px;
    line-height: 1.05;
  }

  .lore-popup--settlement .lore-popup__notes--scrollable {
    max-height: none;
    padding-right: 4px;
  }

  .atlas-map-nav {
    top: 12px;
    right: 12px;
    left: auto;
    bottom: auto;
    transform: none;
    width: auto;
  }

  .atlas-map-nav__link,
  .atlas-map-nav__toggle {
    justify-content: flex-start;
    font-size: 18px;
  }
}

.family-tree-page,
.family-tree-page * {
  box-sizing: border-box;
}

body.family-tree-page {
  margin: 0;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  background: #17110b;
  color: #f5f0e6;
}

.family-tree-page,
.family-tree-page button,
.family-tree-page p,
.family-tree-page strong {
  font-family: Georgia, "Times New Roman", serif;
}

.family-tree-page #tree {
  position: relative;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at top, rgba(183, 137, 68, 0.18), transparent 45%),
    linear-gradient(135deg, #1d150d, #0f0a06 70%);
  overflow: hidden;
}

.family-tree-page svg {
  display: block;
  cursor: grab;
}

.family-tree-page svg:active {
  cursor: grabbing;
}

.family-tree-page .atlas-map-nav {
  position: absolute;
  top: 18px;
  right: 18px;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 10;
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: auto;
  max-width: calc(100vw - 24px);
  justify-content: center;
  flex-wrap: wrap;
  align-items: flex-start;
  font-family: Arial, sans-serif;
}

.family-tree-page .atlas-map-nav__menu {
  position: relative;
}

.family-tree-page .atlas-map-nav__menu summary {
  list-style: none;
  cursor: pointer;
}

.family-tree-page .atlas-map-nav__menu summary::-webkit-details-marker {
  display: none;
}

.family-tree-page .atlas-map-nav__link,
.family-tree-page .atlas-map-nav__toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(218, 184, 112, 0.55);
  border-radius: 999px;
  background: rgba(31, 22, 13, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: #f5e6c8;
  text-decoration: none;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1;
  backdrop-filter: none;
}

.family-tree-page .atlas-map-nav__toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.family-tree-page .atlas-map-nav__dropdown {
  display: grid;
  gap: 8px;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none;
  width: max-content;
  min-width: max-content;
  max-width: calc(100vw - 24px);
  z-index: 11;
}

.family-tree-page .atlas-map-nav__link > span,
.family-tree-page .atlas-map-nav__toggle-label > span {
  font-family: inherit;
  flex: initial;
}

.family-tree-page .atlas-map-nav__link .material-icons,
.family-tree-page .atlas-map-nav__toggle .material-icons {
  font-size: 20px;
}

.family-tree-page .atlas-map-nav__link--home,
.family-tree-page .atlas-map-nav__link--current {
  background: rgba(31, 22, 13, 0.88);
}

.family-tree-page .atlas-map-nav__link--current {
  background: rgba(111, 72, 32, 0.92);
}

.family-tree-page .atlas-map-nav__menu[open] .atlas-map-nav__chevron {
  transform: rotate(180deg);
}

.family-tree-page .atlas-map-nav__link:hover,
.family-tree-page .atlas-map-nav__link:focus-visible,
.family-tree-page .atlas-map-nav__toggle:hover,
.family-tree-page .atlas-map-nav__toggle:focus-visible {
  transform: none;
  background: rgba(47, 33, 18, 0.95);
}

.family-tree-page #reset-view,
.family-tree-page .back-button {
  padding: 10px 16px;
  border: 1px solid rgba(218, 184, 112, 0.65);
  border-radius: 999px;
  background: rgba(31, 22, 13, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: #f5e6c8;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 14px;
}

.family-tree-page .back-button {
  font-size: 15px;
  margin-bottom: 34px;
  background: rgba(31, 22, 13, 0.8);
}

.family-tree-page .hint {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 10;
  padding: 8px 14px;
  border: 1px solid rgba(218, 184, 112, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #e8d3a6;
  font-family: Arial, sans-serif;
  font-size: 13px;
  pointer-events: none;
}

.family-tree-page .node {
  cursor: pointer;
}

.family-tree-page .node-card {
  fill: rgba(245, 240, 230, 0.94);
  stroke: #b78944;
  stroke-width: 2;
  rx: 16;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.38));
}

.family-tree-page .portrait-ring {
  fill: #efe1c4;
  stroke: #8c5f2a;
  stroke-width: 2;
}

.family-tree-page .node-name {
  fill: #2f2a1f;
  font-size: 16px;
  font-weight: bold;
  text-anchor: middle;
  dominant-baseline: middle;
}

.family-tree-page .node-title {
  fill: #66513a;
  font-size: 10px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.family-tree-page .parent-link {
  fill: none;
  stroke: rgba(211, 176, 105, 0.85);
  stroke-width: 2.5;
}

.family-tree-page .spouse-line {
  stroke: rgba(224, 202, 150, 0.95);
  stroke-width: 2.5;
}

.family-tree-page .descent-line {
  stroke: rgba(211, 176, 105, 0.9);
  stroke-width: 2.5;
}

.family-tree-page .couple-node {
  display: none;
}

.family-tree-page .character-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(circle at top left, rgba(183, 137, 68, 0.22), transparent 35%),
    linear-gradient(135deg, #21170e, #090604 75%);
  color: #f5f0e6;
  overflow-y: auto;
}

.family-tree-page .character-sheet.hidden {
  display: none;
}

.family-tree-page .character-sheet__inner {
  width: min(1000px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 60px;
}

.family-tree-page .character-header {
  display: flex;
  gap: 30px;
  align-items: center;
  padding: 30px;
  border: 1px solid rgba(218, 184, 112, 0.45);
  border-radius: 26px;
  background: rgba(255, 244, 222, 0.08);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.family-tree-page .character-header img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #b78944;
  background: #efe1c4;
}

.family-tree-page .character-header h1 {
  margin: 0 0 8px;
  color: #f7dfaa;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.95;
}

.family-tree-page .character-header h2 {
  margin: 0;
  color: #d7b36c;
  font-weight: normal;
  font-size: clamp(18px, 2.5vw, 28px);
}

.family-tree-page .character-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 24px 0;
}

.family-tree-page .meta-card {
  padding: 18px;
  border: 1px solid rgba(218, 184, 112, 0.35);
  border-radius: 18px;
  background: rgba(255, 244, 222, 0.07);
  color: #f0dfbd;
}

.family-tree-page .meta-card strong {
  display: block;
  margin-bottom: 8px;
  color: #d7b36c;
  font-family: Arial, sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.family-tree-page .character-section {
  padding: 26px 30px;
  border: 1px solid rgba(218, 184, 112, 0.3);
  border-radius: 22px;
  background: rgba(255, 244, 222, 0.07);
  color: #f5e9cf;
  font-size: 20px;
  line-height: 1.65;
}

.family-tree-page .tree-error-box {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 999;
  max-width: calc(100vw - 40px);
  padding: 16px;
  border: 1px solid #d7b36c;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.78);
  color: #f5e6c8;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .family-tree-page .atlas-map-nav {
    top: 12px;
    right: 12px;
    bottom: auto;
    left: auto;
    transform: none;
    width: auto;
  }

  .family-tree-page .character-header {
    flex-direction: column;
    text-align: center;
  }

  .family-tree-page .character-meta {
    grid-template-columns: 1fr;
  }
}
