:root {
  color-scheme: light;
  --ink: #22262b;
  --muted: #66717c;
  --paper: #fffaf4;
  --surface: #ffffff;
  --line: #ded8cf;
  --red: #b51d2a;
  --red-dark: #941521;
  --red-soft: #f9e7e8;
  --blue: #244d75;
  --blue-soft: #e7f0f7;
  --gold: #d39325;
  --charcoal: #2d3339;
  --shadow: 0 16px 44px rgba(40, 38, 33, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
  opacity: 0.72;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(222, 216, 207, 0.86);
  background: rgba(255, 250, 244, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.98rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav a {
  border-radius: 8px;
  color: var(--charcoal);
  padding: 8px 11px;
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover,
.nav a:focus-visible {
  background: var(--red-soft);
  outline: none;
}

main {
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: clamp(26px, 5vw, 70px);
  align-items: center;
  padding: clamp(34px, 6vw, 72px) clamp(18px, 4vw, 56px) clamp(28px, 5vw, 60px);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--charcoal);
  font-size: clamp(3.05rem, 7.2vw, 6.4rem);
  line-height: 0.95;
  letter-spacing: 0;
  overflow-wrap: normal;
  word-break: normal;
}

h2 {
  margin: 0;
  color: var(--charcoal);
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 610px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.22rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.secondary-action,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.primary-action {
  gap: 10px;
  border: 0;
  background: var(--red);
  color: #fff;
  padding: 0 18px;
  box-shadow: 0 12px 26px rgba(181, 29, 42, 0.22);
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--red-dark);
  outline: none;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--charcoal);
  padding: 0 16px;
}

.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: var(--red);
  outline: none;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
}

.stats strong {
  color: var(--red);
}

.hero-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(36, 77, 117, 0.08), rgba(211, 147, 37, 0.08)),
    #fff;
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 40px);
}

.hero-card blockquote {
  display: grid;
  gap: 22px;
  margin: 0;
  color: var(--charcoal);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 3vw, 2.55rem);
  line-height: 1.22;
}

.control-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
  margin: 0 clamp(18px, 4vw, 56px) 28px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(40, 38, 33, 0.08);
}

.control-strip > div {
  min-width: 0;
}

.control-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

select,
input[type="search"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--red);
}

.icon-button {
  width: 44px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--red);
  font-weight: 800;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--red);
  background: var(--red-soft);
  outline: none;
}

.section {
  padding: 52px clamp(18px, 4vw, 56px);
}

.section-band {
  background: #f4f0e9;
  border-block: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.search-wrap {
  width: min(420px, 100%);
}

.sentence-list {
  display: grid;
  gap: 14px;
}

.sentence-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 44px;
  gap: 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 10px 28px rgba(40, 38, 33, 0.08);
  cursor: pointer;
}

.sentence-card:hover,
.sentence-card:focus-within {
  border-color: rgba(181, 29, 42, 0.45);
}

.sentence-index {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.sentence-main p {
  margin: 12px 0 0;
  color: var(--muted);
}

.token-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
  color: var(--charcoal);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.token-wrap {
  display: inline-flex;
  align-items: baseline;
}

.token-button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--charcoal);
  padding: 2px 5px;
  cursor: pointer;
  font-weight: 700;
}

.token-button:hover,
.token-button:focus-visible {
  background: var(--red-soft);
  color: var(--red-dark);
  outline: none;
}

.punct {
  font-weight: 700;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.word-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  grid-template-rows: auto auto;
  gap: 6px 10px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.word-card:hover,
.word-card:focus-visible {
  border-color: var(--red);
  background: #fff9f9;
  outline: none;
}

.word-russian {
  grid-column: 1;
  color: var(--red-dark);
  font-size: 1.35rem;
  font-weight: 800;
}

.word-chinese {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.94rem;
}

.word-play {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  color: var(--red);
  font-weight: 800;
}

.translation-card {
  max-width: 920px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(40, 38, 33, 0.08);
}

.translation-card p {
  margin: 0;
  color: var(--charcoal);
  font-size: 1.08rem;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 24px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(18px, 4vw, 56px) 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-card {
    max-width: 760px;
  }

  .control-strip {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav a {
    padding-inline: 10px;
  }

  .control-strip {
    grid-template-columns: 1fr 1fr;
  }

  .offline-action {
    grid-column: 1 / -1;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .sentence-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .sentence-play {
    grid-column: 1 / -1;
    width: 100%;
  }

  .word-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 2.85rem;
  }

  .control-strip {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
  }

  .token-line {
    gap: 7px 8px;
    font-size: 1.12rem;
  }
}
