* {
  box-sizing: border-box;
}

:root {
  --paper: #efe2c6;
  --paper-deep: #d7bd8d;
  --ink: #1f1a14;
  --muted: #6b5841;
  --button: #fff7e6;
  --button-hover: #f6e4bd;
  --shadow: rgba(39, 27, 13, 0.28);
  --frame: #201712;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.55), transparent 35%),
    linear-gradient(135deg, #f8efdb, var(--paper) 45%, #dec796);
}

body.night {
  --paper: #16110d;
  --paper-deep: #2b1d12;
  --ink: #f4e6c7;
  --muted: #c3a975;
  --button: #2f2419;
  --button-hover: #463521;
  --shadow: rgba(0, 0, 0, 0.7);
  --frame: #f0d9a5;
  background: radial-gradient(circle at top, #312215, #100b08 70%);
}

.viewer {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(14px, 2.5vw, 34px);
}


.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.viewer-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 3px;
  font-size: clamp(0.72rem, 1.7vw, 0.95rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 3.1rem);
  line-height: 1;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 60vh;
}

.slide-card {
  margin: 0;
  max-width: min(100%, 960px);
  max-height: calc(100vh - 190px);
  display: grid;
  place-items: center;
  background: #fbf2dc;
  border: 2px solid var(--frame);
  border-radius: 8px;
  box-shadow: 0 18px 45px var(--shadow);
  overflow: hidden;
}

.slide-card img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 200px);
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.nav-button,
.controls button,
.small-button {
  border: 2px solid var(--frame);
  background: var(--button);
  color: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow);
}

.nav-button:hover,
.controls button:hover,
.small-button:hover {
  background: var(--button-hover);
}

.nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: clamp(42px, 6vw, 66px);
  height: clamp(42px, 6vw, 66px);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0;
  display: grid;
  place-items: center;
  padding-bottom: 8px;
}

.nav-left { left: 0; }
.nav-right { right: 0; }

.controls {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.controls button,
.small-button {
  font: 700 1rem/1 Georgia, "Times New Roman", serif;
  padding: 11px 18px;
}

.counter {
  color: var(--muted);
  font-weight: 700;
  padding-left: 8px;
}

.progress-wrap {
  height: 6px;
  width: min(100%, 960px);
  margin: 14px auto 0;
  background: rgba(62, 41, 20, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 10%;
  background: currentColor;
  opacity: 0.55;
  transition: width 250ms ease;
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 12px 0 0;
}

@media (max-width: 740px) {
  .viewer-header {
    align-items: start;
    flex-direction: column;
  }

  .nav-button {
    opacity: 0.92;
  }

  .nav-left { left: 8px; }
  .nav-right { right: 8px; }

  .slide-card,
  .slide-card img {
    max-height: calc(100vh - 245px);
  }
}
