:root {
  color-scheme: light;
  --ink: #173f3a;
  --ink-soft: #60716c;
  --cream: #fffdf9;
  --paper: #f7f2e9;
  --gold: #f3b85b;
  --line: #e5e4dd;
  --shadow: 0 28px 70px rgba(31, 53, 49, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #f5efe6;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.page {
  min-height: 100vh;
  padding: 28px 18px 124px;
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 203, 126, 0.28), transparent 32rem),
    linear-gradient(180deg, #f5efe6 0%, #f8f5ef 45%, #edf3f0 100%);
}

.floating-controls {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(23, 63, 58, 0.94);
  box-shadow: 0 16px 44px rgba(15, 43, 39, 0.32);
  backdrop-filter: blur(16px);
}

.floating-controls button {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.floating-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.floating-controls__previous {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1.35rem;
}

.floating-controls__play {
  width: 56px;
  height: 56px;
  background: var(--gold);
  color: var(--ink);
  font-size: 1.25rem;
  box-shadow: 0 8px 20px rgba(5, 25, 23, 0.24);
}

.floating-controls__play.is-playing {
  box-shadow: 0 0 0 5px rgba(243, 184, 91, 0.18), 0 8px 20px rgba(5, 25, 23, 0.24);
}

.floating-play-symbol {
  transform: translateX(1px);
}

.floating-controls__play.is-playing .floating-play-symbol {
  transform: none;
}

.hero,
.reader {
  width: min(1120px, 100%);
  margin-inline: auto;
}

.hero {
  position: relative;
  min-height: clamp(340px, 52vw, 570px);
  overflow: hidden;
  border: 1px solid rgba(32, 70, 64, 0.16);
  border-radius: 32px 32px 10px 10px;
  box-shadow: var(--shadow);
}

.hero__image,
.hero__shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__image {
  object-fit: cover;
  object-position: center;
}

.hero__shade {
  background:
    linear-gradient(90deg, rgba(11, 33, 31, 0.8) 0%, rgba(11, 33, 31, 0.48) 34%, transparent 68%),
    linear-gradient(0deg, rgba(11, 33, 31, 0.42), transparent 48%);
}

.hero__copy {
  position: absolute;
  left: clamp(24px, 6vw, 72px);
  bottom: clamp(28px, 7vw, 72px);
  width: min(500px, calc(100% - 48px));
  color: white;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.3);
}

.eyebrow,
.chapter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chapter-label {
  margin-bottom: 8px;
  color: #f4d39d;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 7vw, 5.7rem);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.hero__copy > p:last-child {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.reader {
  position: relative;
  margin-top: -2px;
  overflow: hidden;
  border: 1px solid rgba(32, 70, 64, 0.15);
  border-radius: 10px 10px 32px 32px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.playback-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  color: #687873;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.4;
}

.playback-hint strong {
  color: var(--ink);
  font-weight: 850;
}

.chapter-nav {
  display: grid;
  grid-template-columns: 38px minmax(220px, 320px) 38px;
  align-items: stretch;
  gap: 7px;
}

.chapter-nav__arrow {
  display: grid;
  place-items: center;
  border: 1px solid #d9ded9;
  border-radius: 12px;
  background: #f6f2ea;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 850;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

a.chapter-nav__arrow:hover {
  background: #ebe6dc;
  transform: translateY(-1px);
}

.chapter-nav__arrow.is-disabled {
  cursor: default;
  opacity: 0.35;
}

.chapter-picker {
  position: relative;
  min-width: 0;
}

.chapter-picker summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  min-height: 52px;
  padding: 8px 38px 8px 13px;
  border: 1px solid #d9ded9;
  border-radius: 12px;
  background: #f6f2ea;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.chapter-picker summary::-webkit-details-marker {
  display: none;
}

.chapter-picker summary:focus-visible {
  outline: 3px solid rgba(243, 184, 91, 0.45);
  outline-offset: 2px;
}

.chapter-picker__counter {
  color: #7b8985;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter-picker summary strong {
  grid-column: 1 / -1;
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-picker__chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-55%);
  color: #697a75;
  font-size: 1.15rem;
  transition: transform 160ms ease;
}

.chapter-picker[open] .chapter-picker__chevron {
  transform: translateY(-35%) rotate(180deg);
}

.chapter-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 40;
  width: min(390px, calc(100vw - 36px));
  max-height: min(520px, 70vh);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(32, 70, 64, 0.16);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 24px 64px rgba(23, 63, 58, 0.22);
  backdrop-filter: blur(18px);
}

.chapter-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--ink);
  text-decoration: none;
}

a.chapter-option:hover {
  background: #f2ede4;
}

.chapter-option > span:first-child {
  color: #91a09b;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.chapter-option strong {
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-option small {
  color: #8b9692;
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
}

.chapter-option.is-current {
  background: var(--ink);
  color: white;
}

.chapter-option.is-current > span:first-child,
.chapter-option.is-current small {
  color: #f4d39d;
}

.chapter-option.is-disabled {
  opacity: 0.46;
}

.player-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  background: var(--ink);
  color: white;
}

.play-button,
.utility-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
}

.play-button {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(5, 25, 23, 0.28);
}

.play-button:disabled,
.utility-button:disabled,
.progress:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.play-symbol {
  transform: translateX(1px);
  font-size: 1.2rem;
}

.track {
  min-width: 0;
}

.track__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
}

.track__heading > div {
  min-width: 0;
}

.track__heading strong,
.track__heading span {
  display: block;
}

.track__heading strong {
  margin-bottom: 3px;
  font-size: 0.9rem;
}

.track__heading span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track__heading time {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
}

.progress {
  width: 100%;
  height: 5px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) var(--progress, 0%), rgba(255, 255, 255, 0.2) var(--progress, 0%));
  cursor: pointer;
}

.progress::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  appearance: none;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--gold);
}

.audio-note {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
}

.audio-note[hidden] {
  display: none;
}

.utility-button {
  min-height: 40px;
  min-width: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.09);
  color: white;
  font-weight: 800;
}

.utility-button--icon {
  padding-inline: 0;
  font-size: 1.25rem;
}

.columns-label {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 26px 68px 12px 78px;
  color: #71807c;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phrase-list {
  padding: 8px 22px 40px;
}

.phrase {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  gap: 16px;
  width: 100%;
  padding: 20px 14px;
  border: 0;
  border-bottom: 1px solid #ebe9e2;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.phrase:hover {
  background: var(--paper);
}

.phrase.is-active {
  background: #fff7e8;
  box-shadow: inset 4px 0 0 #e4a846, 0 8px 22px rgba(46, 69, 64, 0.07);
  transform: translateX(3px);
}

.phrase__number {
  padding-top: 3px;
  color: #a8b2af;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.phrase__copy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(18px, 4vw, 54px);
}

.phrase__english,
.phrase__ukrainian {
  display: block;
  font-size: clamp(1rem, 1.7vw, 1.15rem);
  line-height: 1.62;
}

.phrase__english {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
}

.phrase__ukrainian {
  color: #6d7471;
}

.story-illustration {
  margin: 26px 46px 34px 54px;
  overflow: hidden;
  border: 1px solid rgba(23, 63, 58, 0.14);
  border-radius: 24px;
  background: #f4eee4;
  box-shadow: 0 18px 44px rgba(31, 53, 49, 0.14);
}

.story-illustration img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.story-illustration figcaption {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding: 17px 22px 19px;
  border-top: 1px solid rgba(23, 63, 58, 0.1);
  background: rgba(255, 253, 249, 0.96);
  font-size: 0.84rem;
  line-height: 1.5;
}

.story-illustration__en {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
}

.story-illustration__uk {
  color: #727d79;
}

@media (max-width: 720px) {
  .page {
    padding: 0 0 112px;
  }

  .floating-controls {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .floating-controls__previous {
    width: 40px;
    height: 40px;
  }

  .floating-controls__play {
    width: 52px;
    height: 52px;
  }

  .hero {
    min-height: 520px;
    border: 0;
    border-radius: 0;
  }

  .hero__image {
    object-position: 34% center;
  }

  .reader {
    border-inline: 0;
    border-radius: 0 0 24px 24px;
  }

  .toolbar {
    align-items: flex-start;
    padding: 14px;
  }

  .chapter-nav {
    order: 3;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    width: 100%;
  }

  .chapter-menu {
    position: fixed;
    top: auto;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 14px;
    width: auto;
    max-height: min(580px, calc(100vh - 28px));
    border-radius: 22px;
  }

  .playback-hint {
    max-width: 100%;
    font-size: 0.72rem;
  }

  .player-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 18px 14px;
  }

  .utility-button--icon {
    display: none;
  }

  .track__heading time {
    display: none;
  }

  .columns-label {
    display: none;
  }

  .phrase-list {
    padding: 10px 10px 28px;
  }

  .phrase {
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    gap: 10px;
    padding: 17px 8px;
  }

  .phrase__copy {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .phrase__ukrainian {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .story-illustration {
    margin: 18px 0 28px;
    border-radius: 18px;
  }

  .story-illustration figcaption {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 14px 16px 16px;
  }

  .story-illustration__uk {
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
