html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="light"] body {
  background-color: #f6f3ee;
  background-image: none;
  color: #1c1b22;
}

html[data-theme="light"] a,
html[data-theme="light"] .logo {
  color: #1c1b22;
}

html[data-theme="light"] nav {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] p,
html[data-theme="light"] li,
html[data-theme="light"] .paragraph,
html[data-theme="light"] .center,
html[data-theme="light"] .chapter1_content h1,
html[data-theme="light"] .h3Question,
html[data-theme="light"] #titleH2 {
  color: #1c1b22;
  -webkit-text-stroke: 0;
}

html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] .chapter1_content h1 {
  color: #146c43;
}

html[data-theme="light"] .p {
  -webkit-text-stroke: 0;
}

html[data-theme="light"] .p a {
  color: #9a3412;
}

html[data-theme="light"] .bottomNav {
  background: #e8e2d6;
}

html[data-theme="light"] .bottomNav p {
  color: #3f3c37;
}

html[data-theme="light"] .faq {
  border-bottom-color: rgba(28, 27, 34, 0.16);
}

html[data-theme="light"] .faq svg path {
  stroke: #1c1b22;
}

html[data-theme="light"] .mobile-menu div {
  background: #1c1b22;
}

@media (max-width: 999px) {
  html[data-theme="light"] body {
    background-image: none;
    background-color: #f6f3ee;
  }

  html[data-theme="light"] .nav-list {
    background: #f6f3ee;
  }
}

html[data-theme="light"] .font-size-control__toggle {
  background: rgba(28, 27, 34, 0.08);
  color: #1c1b22;
}

html[data-theme="light"] .font-size-control__panel {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .font-size-control__panel button,
html[data-theme="light"] .font-size-control__value {
  color: #1c1b22;
}

.theme-toggle {
  position: fixed;
  top: 0;
  right: 8px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 44px;
  height: 8vh;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  opacity: 0.9;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: 1;
}

html[data-theme="light"] .theme-toggle {
  color: rgba(28, 27, 34, 0.5);
}

.theme-toggle svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 999px) {
  .theme-toggle {
    top: auto;
    right: auto;
    bottom: 14px;
    left: 14px;
    width: 44px;
    height: 44px;
  }
}

audio.audio-source {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.player {
  width: min(640px, calc(100% - 28px));
  margin: 12px auto 20px;
  padding: 14px 16px 12px;
  border-radius: 18px;
  background: #f4f6f8;
  color: #1c1b22;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  font-family: system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

.player__transport {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.player__play {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #1d6fe8;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.player__play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.player__time {
  min-width: 38px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #3c4250;
}

.player__seek,
.player__volume input {
  width: 100%;
  accent-color: #1d6fe8;
  cursor: pointer;
}

.player__tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.player__speeds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player__rate {
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: #e6e9ef;
  color: #1c1b22;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.player__rate.is-active {
  background: #1d6fe8;
  color: #fff;
}

.player__volume {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 110px;
  color: #1d6fe8;
}

.player__volume svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: none;
}

.read-word {
  cursor: pointer;
  border-radius: 0.18em;
}

.read-line.is-active {
  background: rgba(245, 197, 24, 0.16);
  border-radius: 8px;
}

.read-word.is-active {
  background: #f5c518;
  color: #1a1404;
  -webkit-text-stroke: 0;
}

.player-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 45;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: #f4f6f8;
  color: #1c1b22;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  font-family: system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

.player-dock[hidden] {
  display: none;
}

.player-dock__time {
  min-width: 42px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .player__tools {
    flex-direction: column;
    align-items: stretch;
  }

  .player__volume {
    min-width: 0;
  }
}

.nav-list a[aria-current] {
  color: #3adb78;
  opacity: 1;
}

.nav-list a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.nav-list a[aria-current]:hover {
  color: #3adb78;
  opacity: 1;
}

html[data-theme="light"] .nav-list a[aria-current],
html[data-theme="light"] .nav-list a[aria-current]:hover {
  color: #146c43;
}

.nav-list .has-submenu {
  position: relative;
}

.nav-list .has-submenu > a::after {
  content: "";
  display: inline-block;
  margin-left: 7px;
  border: 4px solid transparent;
  border-top-color: currentColor;
  transform: translateY(1px);
}

.nav-list .submenu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 60;
  min-width: 230px;
  margin: 0;
  padding: 8px 0 6px;
  list-style: none;
  background: #2c2c3a;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.nav-list .has-submenu:hover > .submenu,
.nav-list .has-submenu:focus-within > .submenu {
  display: block;
}

.nav-list .submenu li {
  margin: 0;
  letter-spacing: 0;
}

.nav-list .submenu a {
  display: block;
  padding: 10px 16px;
  font-size: 15px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

html[data-theme="light"] .nav-list .submenu {
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

@media (max-width: 999px) {
  .nav-list .has-submenu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .nav-list .submenu {
    display: flex;
    position: static;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-list .submenu li {
    opacity: 1;
  }

  .nav-list .submenu a {
    padding: 0;
    font-size: 16px;
    white-space: normal;
    text-align: center;
  }
}

body.home {
  background-color: rgb(11, 6, 26);
  background-image: url(/images/home-night.jpg?v=2);
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
  background-size: cover;
}

@media (max-width: 999px) {
  body.home {
    background-image: url(/images/Stranger_in_Woodend.jpg);
  }
}

html:has(body.vocab-page) {
  background-color: #0b061a;
  background-image: url(/images/background.jpg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

body.vocab-page {
  isolation: isolate;
  background-color: transparent;
  background-image: none;
}

body.vocab-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(8, 6, 18, 0.55);
  backdrop-filter: blur(16px) saturate(0.75);
  -webkit-backdrop-filter: blur(16px) saturate(0.75);
}

@media (max-width: 999px) {
  html:has(body.vocab-page) {
    background-image: url(/images/Stranger_in_Woodend.jpg);
  }
}

.vocab-lead {
  width: min(640px, 92%);
  margin: 8px auto 28px;
  font-size: 1.15rem;
}

.vocab-practice {
  width: min(760px, 92%);
  margin: 0 auto 42px;
}

.vocab-practice h3 {
  text-align: center;
}

.vocab-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 12px;
}

.vocab-word {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(12, 10, 24, 0.78);
  color: #fff;
  font: inherit;
  font-size: 1.15rem;
  line-height: 1.2;
  cursor: pointer;
}

.vocab-word.is-active {
  background: #f5c518;
  border-color: #f5c518;
  color: #1a1404;
}

html[data-theme="light"] .vocab-word {
  background: #fff;
  border-color: rgba(28, 27, 34, 0.18);
  color: #1c1b22;
}

.vocab-speak {
  display: block;
  margin: 4px auto 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 18px;
  background: rgba(12, 10, 24, 0.78);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

html[data-theme="light"] .vocab-speak {
  background: #fff;
  border-color: rgba(28, 27, 34, 0.18);
  color: #1c1b22;
}
