:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --line: #d8e0ea;
  --text: #182230;
  --muted: #667085;
  --accent: #2878bd;
  --accent-strong: #175d99;
  --ok: #16845b;
  --bad: #b42318;
  --warn: #ad6f00;
  --shadow: 0 16px 40px rgba(24, 34, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar,
.settings-panel,
.filters,
.tabs,
.test-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
}

h2 {
  font-size: 1.5rem;
}

.status-pill {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.status-pill.ready {
  color: var(--ok);
  border-color: rgba(22, 132, 91, 0.35);
}

.settings-panel,
.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filters {
  grid-template-columns: minmax(120px, 0.7fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  box-shadow: none;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

button:active {
  transform: translateY(1px);
}

.icon-button {
  align-self: end;
  min-width: 48px;
  background: var(--surface-2);
  color: var(--accent-strong);
  font-weight: 800;
}

.icon-button:hover,
.tab:hover {
  background: #dfe9f3;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.tabs {
  margin: 16px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-width: 112px;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  background: var(--text);
  color: #fff;
}

.message {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: #fff7e6;
  color: var(--warn);
  border: 1px solid rgba(173, 111, 0, 0.25);
}

.hidden {
  display: none !important;
}

.learn-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.word-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 68vh;
  overflow: auto;
  padding-right: 4px;
}

.word-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.word-button.active {
  border-color: var(--accent);
  background: #eaf4ff;
}

.word-button strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.score {
  color: var(--muted);
  font-weight: 800;
}

.study-surface,
.test-layout {
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.study-surface {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(20px, 5vw, 56px);
}

.german {
  color: var(--muted);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 800;
}

.english {
  font-size: clamp(2.5rem, 8vw, 5.2rem);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.example {
  color: var(--muted);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  line-height: 1.45;
}

.study-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-button {
  background: var(--surface-2);
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}

.test-layout {
  padding: 18px;
}

.test-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.quiz-form {
  display: grid;
  gap: 10px;
}

.quiz-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quiz-prompt {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.quiz-result {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.result-item.good .result-state {
  color: var(--ok);
}

.result-item.bad .result-state {
  color: var(--bad);
}

.result-state {
  font-weight: 900;
}

@media (max-width: 840px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar,
  .test-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-panel,
  .filters,
  .learn-layout,
  .quiz-row {
    grid-template-columns: 1fr;
  }

  .word-list {
    max-height: 260px;
  }

  .study-surface,
  .test-layout {
    min-height: auto;
  }
}
