/* ========== Layout ========== */
body {
  font-family: sans-serif;
  margin: 0;
  height: 100vh;
}

#page {
  min-width: 1000px;
  margin: 0 auto;
  padding: 0.5rem 0.5rem 0.5rem;
  box-sizing: border-box;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#main-content {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  flex: 1;
  height: 100%;
}

/* ========== Headings ========== */
h1 {
  text-align: left;
  margin: 0 0 0.5rem 0;
}

#sidebar h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

/* ========== Map ========== */
#map-wrapper {
  flex: 3;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  max-height: 100%;
}

.map-container {
  position: relative;
  border: 2px solid black;
  display: inline-block;
}

#map {
  width: 100%;
  height: auto;
  transform-origin: top left;
}

.map-image {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  object-fit: cover;
}

/* ========== Sidebar ========== */
#sidebar {
  flex: 1;
  background-color: white;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-box {
  border: 2px solid black;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

.sidebar-box > * + * {
  margin-top: 0.3rem;
}

.sidebar-box button {
  padding: 0.4rem;
  border: 2px solid black;
  background: white;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
  font-size: 0.85rem;
}

.sidebar-box button:hover {
  background: #f0f0f0;
}

.about-text {
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.4;
}

.about-text a {
  color: black;
  text-decoration: underline;
  transition: opacity 0.2s;
}

.about-text a:hover {
  opacity: 0.6;
  cursor: pointer;
}

/* ========== Location list ========== */
#location-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  overflow-y: auto;
}

.location-entry h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.character-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.85rem;
  text-align: center;
  min-width: 0;
}

.character-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.25rem;
}

.character-label {
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

/* ========== Characters on Map ========== */
.character {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 50%;
  outline: 1px solid rgb(0, 0, 0);
  overflow: hidden;
}

/* ========== Timeline ========== */
.timeline {
  border: 2px solid black;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

.timeline-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow-x: auto;
}

.timeline-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 300px;
  flex-wrap: nowrap;
  align-items: center;
}

.timeline-title {
  flex: 2.5;
  font-weight: bold;
  font-size: 0.9rem;
  padding-top: 0.25rem;
  white-space: nowrap;
}

.timeline-chapters {
  flex: 3;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  overflow-x: auto;
}

.timeline-chapter {
  width: 80px;
  text-align: center;
  padding: 0.4rem;
  border: 2px solid black;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.timeline-chapter:hover {
  background: #f0f0f0;
}

.timeline-chapter.active {
  background-color: black;
  color: white;
  font-weight: bold;
}

/* ========== Modal ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border: 2px solid black;
  padding: 1rem;
  width: 600px;
  max-width: 90%;
  border-radius: 4px;
  position: relative;
  box-shadow: 4px 4px 0 black;
  text-align: left;
}

.modal-close {
  position: absolute;
  top: 0.2rem;
  right: 0.5rem;
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.changelog-section {
  margin-bottom: 1rem;
}

#changelog-list {
  padding-left: 0;
  margin: 0;
}

#changelog-list ul {
  list-style-type: disc;
  margin: 0.5rem 0;
}

#changelog-list li {
  margin-bottom: 0.25rem;
}