:root {
  color-scheme: light;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", serif;
  --bg: #dddcd6;
  --bg-deep: #bebdb3;
  --paper: #f4f4f1;
  --ink: #222320;
  --muted: #5c5d58;
  --line: #cdcbc2;
  --accent: #2f4b63;
  --accent-soft: #6e8698;
  --content-scale: 1;
}

* {
  box-sizing: border-box;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

body[data-page="start"] {
  background: #e8e5de;
}

.start-shell,
.tour-shell {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding-inline: clamp(0.8rem, 2vw, 1.6rem);
}

.start-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(1rem, env(safe-area-inset-top)) clamp(0.8rem, 2vw, 1.6rem) max(1.4rem, env(safe-area-inset-bottom));
  display: grid;
  align-items: center;
  justify-items: center;
  position: relative;
}

.start-panel {
  width: min(100%, 560px);
  background: rgba(250, 250, 247, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-top: 7px solid #e4c316;
  box-shadow: 0 16px 34px rgba(20, 22, 20, 0.24);
  padding: clamp(1rem, 3vw, 1.7rem);
  display: grid;
  gap: 0.9rem;
}

.start-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.tour-pill {
  display: inline-block;
  border-radius: 3px;
  background: #73bf28;
  color: #ffffff;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  line-height: 1;
  padding: 0.35rem 0.5rem;
  text-transform: uppercase;
}

.duration {
  margin: 0;
  color: #6e7068;
  font-size: 0.95rem;
}

.start-button {
  border: 0;
  border-radius: 999px;
  min-height: 50px;
  background: #74c71a;
  color: #ffffff;
  font-size: 1.06rem;
}

.copyright {
  margin: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(0.65rem, env(safe-area-inset-bottom));
  color: rgba(41, 43, 38, 0.72);
  font-size: 0.74rem;
}

.kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.page-title,
.tour-title,
.stop-title {
  margin: 0;
  color: #1c1d1a;
  font-family: var(--font-heading);
  line-height: 1.2;
}

.page-title {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
}

.tour-title {
  font-size: clamp(1.55rem, 2.8vw, 2.2rem);
}

.stop-title {
  font-size: clamp(1.4rem, 2.4vw, 1.95rem);
}

.intro,
.stop-text,
.audio-status,
.progress-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: calc(1rem * var(--content-scale));
}

body[data-page="start"] .intro {
  border-top: 1px dotted #9f9f97;
  border-bottom: 1px dotted #9f9f97;
  padding: 0.75rem 0;
}

.tour-progress-wrap {
  background: #ecece8;
  border-bottom: 1px solid var(--line);
}

.tour-progress-inner {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 0.5rem clamp(0.8rem, 2vw, 1.6rem) 0.52rem;
}

.progress-text {
  font-size: 0.9rem;
}

.progress-shell {
  width: min(100%, 520px);
  margin: 0 auto;
}

.progress {
  display: none;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: #1f201d;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.progress-dots {
  position: static;
  display: flex;
  justify-content: center;
  gap: 0.45rem;
}

.progress-dot {
  width: 22px;
  height: 22px;
  border: 1.5px solid #343630;
  border-radius: 999px;
  background: #f1f1ed;
  color: #262823;
  font-size: 0.66rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    width 0.2s ease,
    height 0.2s ease;
}

.progress-dot:hover {
  transform: translateY(-1px);
}

.progress-dot.active {
  width: 34px;
  height: 34px;
  margin-top: 0;
  font-size: 0.92rem;
  background: #191a18;
  border-color: #191a18;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(17, 18, 16, 0.22);
}

.progress-dot.done {
  background: #878a83;
  border-color: #878a83;
  color: #ffffff;
}

.tour-shell {
  padding-block: 0.85rem max(1.1rem, env(safe-area-inset-bottom));
  display: grid;
  align-items: start;
}

.stop-card {
  background: var(--paper);
  border: 1px solid var(--line);
  width: min(100%, 900px);
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(16, 20, 20, 0.08);
  padding: clamp(0.75rem, 2vw, 1.1rem);
  display: grid;
  gap: 0.75rem;
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.24s ease;
  will-change: transform, opacity;
}

.stop-card.is-transitioning-out {
  opacity: 0;
  transform: translateX(calc(var(--slide-direction, 1) * -28px));
}

.stop-card.is-transitioning-in {
  opacity: 0;
  transform: translateX(calc(var(--slide-direction, 1) * 28px));
}

.text-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.control-label {
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #656862;
  font-weight: 700;
}

.text-size-selector {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.text-size-selector button {
  width: 34px;
  height: 34px;
  border: 1px solid #b8b6ab;
  background: #ffffff;
  color: #2d2f2b;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
}

.text-size-selector button[data-size="small"] {
  font-size: 0.7rem;
}

.text-size-selector button[data-size="medium"] {
  font-size: 0.95rem;
}

.text-size-selector button[data-size="large"] {
  font-size: 1.15rem;
}

.text-size-selector button.active {
  background: #2d4357;
  color: #ffffff;
  border-color: #2d4357;
}

.media-frame {
  margin: 0;
  border: 1px solid var(--line);
  background: #d9d9d3;
  overflow: hidden;
}

.main-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
}

.thumbnail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.thumbnail {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  line-height: 0;
  cursor: pointer;
}

.thumbnail.active {
  border-color: #4e6273;
}

.thumb-image {
  width: 70px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
}

.audio-panel {
  display: grid;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-left: 4px solid #e0bc48;
  background: #f7f7f3;
  padding: 0.65rem;
}

.detail-card {
  border: 1px solid var(--line);
  background: #f7f7f3;
  padding: 0.65rem;
  display: grid;
  gap: 0.5rem;
}

.map-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #d7d6cf;
}

.card-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
  font-size: calc(0.98rem * var(--content-scale));
}

.transcript-wrap {
  border: 1px solid var(--line);
  background: #f7f7f3;
  padding: 0.65rem;
}

.transcript-panel {
  margin-top: 0.6rem;
  color: #444640;
  line-height: 1.65;
  font-size: calc(0.98rem * var(--content-scale));
  white-space: pre-line;
}

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.58rem 0.95rem;
  font-family: var(--font-body);
  font-size: 0.97rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.button.primary {
  background: #243a4e;
  color: #ffffff;
}

.button.ghost {
  border-color: var(--line);
  background: #ffffff;
  color: #222320;
}

.button.audio {
  width: 100%;
  background: #8d99a3;
  color: #ffffff;
}

.button:disabled,
.button.disabled,
.button[aria-disabled="true"] {
  opacity: 0.58;
  cursor: not-allowed;
  pointer-events: none;
}

.screen-nav {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.arrow-button {
  position: fixed;
  top: 52%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: 1px solid rgba(30, 32, 28, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #30322e;
  font-size: 1.45rem;
  box-shadow: 0 2px 8px rgba(20, 22, 20, 0.1);
  cursor: pointer;
  pointer-events: auto;
}

.arrow-button.left {
  left: max(10px, env(safe-area-inset-left));
}

.arrow-button.right {
  right: max(10px, env(safe-area-inset-right));
}

.arrow-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.hidden {
  display: none;
}

.thumbnail:focus-visible,
.button:focus-visible,
.arrow-button:focus-visible,
.progress-dot:focus-visible {
  outline: 3px solid #7ea0ba;
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .start-shell {
    align-items: start;
    padding-top: 1rem;
  }

  .start-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .tour-progress-inner {
    padding-top: 0.48rem;
    padding-bottom: 0.52rem;
  }

  .progress-shell {
    width: 100%;
  }

  .progress-dot {
    width: 18px;
    height: 18px;
    font-size: 0.56rem;
  }

  .progress-dot.active {
    width: 27px;
    height: 27px;
    margin-top: 0;
    font-size: 0.72rem;
  }

  .main-image {
    aspect-ratio: 16 / 9;
  }

  .arrow-button {
    top: auto;
    bottom: max(10px, calc(env(safe-area-inset-bottom) + 6px));
    transform: none;
    width: 44px;
    height: 44px;
  }

  .text-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }
}

@media (min-width: 900px) {
  body[data-page="tour"] {
    overflow: hidden;
  }

  .tour-shell {
    height: calc(100dvh - 112px);
    padding-block: 0.55rem 0.8rem;
  }

  .stop-card {
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
  }
}
