:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66736d;
  --paper: #f7f3ea;
  --panel: #fffdf7;
  --line: #ded8c9;
  --green: #1b4d3e;
  --green-2: #2f7a61;
  --red: #ba463e;
  --gold: #d9a441;
  --blue: #3d7196;
  --violet: #754f7a;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #eaf2ef 0%, var(--paper) 46%, #f5efe3 100%);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(92px + env(safe-area-inset-bottom));
}

.topbar,
.toolbar,
.stats-row,
.section-title,
.word-row,
.bottom-nav {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.date,
.eyebrow,
.meta,
.note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  font-size: 18px;
}

.screen {
  display: none;
}

.screen.active {
  display: grid;
  gap: 14px;
}

.icon-button,
.primary,
.ghost,
.text-button,
.mini,
.nav-item,
.close {
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 24px;
}

.hero,
.panel,
.stats-row {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(30, 40, 34, 0.09);
}

.hero {
  overflow: hidden;
  border-radius: 22px;
}

.hero-copy {
  padding: 18px;
}

.hero-art {
  position: relative;
  height: 126px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(61, 113, 150, 0.28), rgba(255, 253, 247, 0)),
    linear-gradient(135deg, #c8ddd4, #f1dfb8 70%);
}

.sun {
  position: absolute;
  top: 22px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold);
}

.skyline {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 0.8fr 1.2fr 0.9fr 1fr;
  align-items: end;
  gap: 8px;
  padding: 0 18px;
}

.skyline span {
  display: block;
  height: 70px;
  border-radius: 12px 12px 0 0;
  background: var(--green);
}

.skyline span:nth-child(2) {
  height: 92px;
  background: var(--red);
}

.skyline span:nth-child(3) {
  height: 58px;
  background: var(--blue);
}

.skyline span:nth-child(4) {
  height: 82px;
  background: var(--violet);
}

.stats-row {
  justify-content: space-between;
  gap: 8px;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}

.stats-row div {
  flex: 1;
}

.stats-row strong,
.stats-row span {
  display: block;
}

.stats-row strong {
  font-size: 22px;
}

.stats-row span {
  color: var(--muted);
  font-size: 12px;
}

.panel {
  border-radius: 18px;
  padding: 16px;
}

.toolbar {
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.primary,
.ghost {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 14px;
}

.primary {
  color: white;
  background: var(--green);
}

.ghost {
  color: var(--green);
  background: #e7efe9;
}

.danger {
  color: #9f332d;
  background: #f4e4df;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.article {
  color: #24302b;
  font-size: 18px;
  line-height: 1.72;
}

.sentence {
  position: relative;
  margin: 0 0 14px;
  padding-right: 42px;
}

.ru-line,
.translation {
  margin: 0;
}

.translation {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.sentence-play {
  position: absolute;
  top: 4px;
  right: 0;
}

.term {
  border: 0;
  border-radius: 8px;
  padding: 1px 5px;
  color: #11382c;
  background: #dcebe4;
}

.section-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.text-button {
  padding: 0;
  color: var(--green);
  background: transparent;
}

.word-grid {
  display: grid;
  gap: 10px;
}

.word-card,
.lookup-result,
.history-card,
.catalog-card,
.review-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fbf8f0;
}

.word-card .toolbar,
.word-sheet .toolbar {
  margin: 12px 0 0;
}

.word-row {
  justify-content: space-between;
  gap: 12px;
}

.word {
  overflow-wrap: anywhere;
  font-size: 21px;
  font-weight: 700;
}

.meaning,
.example {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.mini {
  min-width: 38px;
  min-height: 34px;
  border-radius: 10px;
  color: white;
  background: var(--green-2);
}

.known {
  opacity: 0.55;
}

.search,
.field,
.switch {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.field,
.switch {
  margin-top: 16px;
}

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

input[type="range"] {
  accent-color: var(--green);
}

.switch {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.switch input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.lookup-result {
  min-height: 92px;
  margin-top: 12px;
  line-height: 1.55;
}

.lookup-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  display: none;
  color: var(--muted);
  line-height: 1.55;
}

.empty.active {
  display: block;
}

.history-list,
.catalog-list {
  display: grid;
  gap: 10px;
}

.history-card h4,
.catalog-card h4 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.history-meta,
.catalog-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-card .meaning,
.catalog-card .meaning {
  margin-top: 8px;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  color: white;
  background: var(--green-2);
  font-size: 12px;
}

.status-pill.unread {
  color: var(--green);
  background: #e7efe9;
}

.compact-select {
  width: auto;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  background: white;
}

.review-card {
  display: none;
}

.review-card.active {
  display: block;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.94);
  backdrop-filter: blur(14px);
}

.nav-item {
  width: min(18vw, 96px);
  min-height: 44px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
}

.nav-item.active {
  color: white;
  background: var(--green);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 8;
  max-width: 488px;
  margin: 0 auto;
  border-radius: 14px;
  padding: 12px 14px;
  color: white;
  background: rgba(23, 33, 29, 0.92);
  box-shadow: 0 14px 36px rgba(23, 33, 29, 0.2);
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

.word-sheet {
  width: min(calc(100% - 32px), 480px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 24px 72px rgba(30, 40, 34, 0.22);
}

.word-sheet[open] {
  animation: sheet-in 150ms ease-out;
}

.word-sheet::backdrop {
  background: rgba(23, 33, 29, 0.42);
}

.close {
  float: right;
  width: 34px;
  min-height: 34px;
  border-radius: 50%;
  color: var(--green);
  background: #e7efe9;
  font-size: 22px;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 21px;
  }

  .article {
    font-size: 17px;
  }

  .primary,
  .ghost {
    padding: 0 10px;
  }
}
