:root {
  --ink: #f8f2e8;
  --muted: #e2c99f;
  --gold: #e0b476;
  --gold-light: #f1cea0;
  --night: #0d1115;
  --night-soft: #171c20;
  --line: rgba(225, 183, 124, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #090c0f;
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  background:
    radial-gradient(circle at 50% 20%, #273039 0, #101418 42%, #07090b 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button,
a,
select,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(241, 206, 160, 0.85);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.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;
}

.shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 0;
}

.experience {
  isolation: isolate;
  position: relative;
  width: min(100%, 540px);
  min-height: 100svh;
  overflow: hidden;
  background: #101419;
}

.experience::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background-image: var(--story-image, url("/assets/porto-cathedral.webp"));
  background-position: center;
  background-size: cover;
  transform: scale(1.01);
}

.experience::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(
      180deg,
      rgba(7, 13, 18, 0.9) 0%,
      rgba(10, 13, 16, 0.4) 22%,
      rgba(12, 12, 11, 0.12) 43%,
      rgba(8, 9, 10, 0.68) 72%,
      #0a0c0e 100%
    ),
    linear-gradient(90deg, rgba(5, 8, 11, 0.2), rgba(5, 8, 11, 0.02));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: max(24px, env(safe-area-inset-top)) 24px 8px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.34));
}

.language-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 160px;
}

.language-icon {
  position: absolute;
  left: 17px;
  z-index: 1;
  width: 18px;
  height: 18px;
  pointer-events: none;
  color: var(--ink);
}

.language-select {
  width: 100%;
  height: 50px;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0 42px 0 48px;
  background:
    linear-gradient(rgba(15, 20, 25, 0.72), rgba(15, 20, 25, 0.72));
  color: #fff;
  cursor: pointer;
  font-size: 15px;
}

.language-chevron {
  position: absolute;
  right: 17px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid white;
  border-bottom: 1.5px solid white;
  transform: rotate(45deg) translateY(-3px);
  pointer-events: none;
}

.listen-view,
.complete-view {
  min-height: calc(100svh - 94px);
  animation: view-in 520ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.listen-view {
  display: flex;
  flex-direction: column;
  padding-top: clamp(44px, 9svh, 102px);
}

.story-copy {
  padding: 0 32px;
  text-align: center;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.76);
}

.eyebrow {
  margin: 0 0 3px;
  color: rgba(255, 255, 255, 0.92);
  font-family: "Iowan Old Style", Baskerville, Georgia, serif;
  font-size: clamp(56px, 18vw, 96px);
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 0.95;
  text-transform: uppercase;
}

.tagline {
  max-width: 310px;
  margin: 14px auto 0;
  color: var(--gold-light);
  font-size: clamp(22px, 6.2vw, 31px);
  font-weight: 500;
  line-height: 1.18;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(280px, 74%);
  margin: 26px auto 18px;
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.ornament::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.ornament img {
  width: 25px;
  height: 25px;
  object-fit: contain;
}

.place {
  margin: 0;
  color: #fff;
  font-size: clamp(21px, 5.6vw, 28px);
  font-weight: 650;
  letter-spacing: 0.01em;
}

.place-icon {
  display: inline-block;
  margin-right: 8px;
  color: var(--gold-light);
  transform: translateY(2px);
}

.route {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 4.1vw, 20px);
}

.player {
  display: grid;
  justify-items: center;
  margin-top: clamp(30px, 6svh, 62px);
  padding: 0 24px;
}

.play-rings {
  position: relative;
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
}

.play-rings::before,
.play-rings::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(237, 203, 157, 0.44);
  border-radius: 50%;
}

.play-rings::before {
  width: 152px;
  height: 152px;
}

.play-rings::after {
  width: 182px;
  height: 182px;
  opacity: 0.6;
}

.play-button {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #f0d7af 0, #d9b47f 47%, #b7884f 100%);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.45),
    inset 0 0 0 4px rgba(255, 255, 255, 0.12);
  color: #17191a;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.play-button:hover {
  transform: scale(1.035);
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.52),
    inset 0 0 0 4px rgba(255, 255, 255, 0.16);
}

.play-button:active {
  transform: scale(0.98);
}

.play-button svg {
  width: 55px;
  height: 55px;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5));
}

.play-label {
  margin: 31px 0 0;
  color: var(--gold-light);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.timeline {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  width: min(100%, 388px);
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.timeline time:last-child {
  text-align: right;
}

.seek {
  width: 100%;
  height: 4px;
  appearance: none;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--gold-light) 0 var(--progress),
    rgba(255, 255, 255, 0.28) var(--progress) 100%
  );
  cursor: pointer;
}

.seek::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  appearance: none;
  border: 2px solid #fff1dc;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #fff1dc;
  border-radius: 50%;
  background: var(--gold);
}

.audio-error {
  max-width: 340px;
  margin: 14px auto 0;
  color: #ffe0da;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: auto;
  padding: 27px 14px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 11, 13, 0.84);
  backdrop-filter: blur(12px);
}

.feature {
  min-width: 0;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
  text-align: center;
}

.feature + .feature {
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.feature svg {
  display: block;
  width: 25px;
  height: 25px;
  margin: 0 auto 9px;
  color: var(--gold-light);
}

.complete-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(52px, 9svh, 88px) 28px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
}

.complete-view::before {
  content: "";
  position: absolute;
  inset: 94px 0 0;
  z-index: -1;
  background:
    linear-gradient(
      180deg,
      rgba(11, 15, 18, 0.38) 0%,
      rgba(9, 10, 11, 0.38) 38%,
      rgba(7, 8, 9, 0.95) 78%,
      #080a0b 100%
    );
}

.check-ring {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 4px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-light);
}

.check-ring svg {
  width: 42px;
  height: 42px;
}

.complete-title {
  max-width: 410px;
  margin: 28px 0 0;
  font-family: "Iowan Old Style", Baskerville, Georgia, serif;
  font-size: clamp(34px, 9vw, 48px);
  font-weight: 500;
  line-height: 1.08;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.85);
}

.complete-copy {
  max-width: 365px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 17px;
  line-height: 1.5;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.82);
}

.journey-copy {
  margin-top: auto;
  padding-top: clamp(120px, 27svh, 260px);
}

.journey-copy img {
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
}

.journey-copy h2 {
  margin: 0;
  font-family: "Iowan Old Style", Baskerville, Georgia, serif;
  font-size: 29px;
  font-weight: 500;
}

.journey-copy p {
  max-width: 370px;
  margin: 8px auto 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
  line-height: 1.45;
}

.store-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(100%, 440px);
  min-height: 76px;
  margin-top: 28px;
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  background: linear-gradient(90deg, #f0c27f, #e1af70);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
  color: #121416;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    filter 180ms ease;
}

.store-cta:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.store-cta img {
  width: 40px;
  height: 40px;
}

.store-cta svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.store-note {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  max-width: 360px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.store-note svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.replay-button {
  margin-top: 18px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  padding: 4px 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-size: 13px;
}

.loading-screen,
.not-found {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #0c1014;
  color: var(--ink);
  text-align: center;
}

.not-found > div {
  max-width: 390px;
}

.not-found img {
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
}

.not-found h1 {
  margin: 0;
  font-family: "Iowan Old Style", Baskerville, Georgia, serif;
  font-size: 38px;
}

.not-found p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 600px) {
  .shell {
    padding: 28px;
  }

  .experience {
    min-height: min(920px, calc(100svh - 56px));
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 34px;
    box-shadow: 0 34px 80px rgba(0, 0, 0, 0.5);
  }

  .listen-view,
  .complete-view {
    min-height: calc(min(920px, calc(100svh - 56px)) - 94px);
  }

  .complete-view::before {
    border-radius: 0 0 34px 34px;
  }
}

@media (max-height: 760px) {
  .listen-view {
    padding-top: 28px;
  }

  .eyebrow {
    font-size: 56px;
  }

  .ornament {
    margin-block: 17px 12px;
  }

  .player {
    margin-top: 22px;
  }

  .play-rings {
    width: 132px;
    height: 132px;
  }

  .play-rings::before {
    width: 126px;
    height: 126px;
  }

  .play-rings::after {
    width: 146px;
    height: 146px;
  }

  .play-button {
    width: 108px;
    height: 108px;
  }

  .play-label {
    margin-top: 17px;
  }

  .feature-strip {
    padding-top: 18px;
  }

  .complete-view {
    padding-top: 35px;
  }

  .journey-copy {
    padding-top: 85px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
