:root {
  color-scheme: light;
  --ink: #1d2433;
  --muted: #667085;
  --line: #d9e2ec;
  --panel: #ffffff;
  --paper: #f7f9fb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --ok: #047857;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

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

.topbar nav a,
.logout button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.logout {
  margin: 0;
}

.page {
  margin: 0 auto;
  max-width: 1120px;
  padding: 32px 24px 64px;
}

.public-hero {
  align-items: center;
  display: grid;
  gap: 36px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  min-height: 62vh;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.public-hero h1 {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 18px;
  max-width: 760px;
}

.hero-copy {
  color: var(--muted);
  font-size: 20px;
  line-height: 1.5;
  margin: 0;
  max-width: 620px;
}

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

.demo-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(29, 36, 51, 0.12);
  display: grid;
  gap: 14px;
  padding: 28px;
}

.demo-label {
  color: var(--ok);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.demo-card strong {
  font-size: 34px;
}

.demo-card p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.demo-review {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  padding-top: 14px;
}

.demo-review span {
  color: var(--muted);
  font-size: 14px;
}

.feature-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}

.feature-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.feature-grid h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

.feature-grid p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

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

.dashboard-grid,
.word-detail {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 380px;
  margin-bottom: 36px;
}

.stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 180px));
}

.stat,
.add-word,
.auth-panel,
.review-card,
.example {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat {
  display: block;
  padding: 20px;
  text-decoration: none;
}

.stat strong {
  display: block;
  font-size: 36px;
}

.stat span,
.muted,
.word-card span,
.status {
  color: var(--muted);
}

.add-word,
.auth-panel,
.review-card {
  padding: 24px;
}

.stacked-form p,
.add-word {
  display: grid;
  gap: 10px;
}

input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.primary,
.button {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  text-decoration: none;
}

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

.button.secondary {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.button.secondary:hover {
  background: #eef2f6;
}

.section-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 24px 0 16px;
}

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

.word-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  overflow: hidden;
  padding-bottom: 14px;
  text-decoration: none;
}

.word-card img,
.image-placeholder {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

.image-placeholder {
  align-items: center;
  background: #e6eef8;
  color: #174ea6;
  display: flex;
  font-size: 64px;
  font-weight: 800;
  justify-content: center;
}

.word-card div {
  display: grid;
  gap: 4px;
  padding: 0 14px;
}

.card-status {
  font-size: 13px;
  line-height: 1.35;
}

.card-status.complete,
.fetch-status.complete {
  color: var(--ok);
}

.card-status.partial,
.fetch-status.partial {
  color: #93370d;
}

.card-status.failed,
.fetch-status.failed {
  color: var(--bad);
}

.fetch-status {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: inline-flex;
  line-height: 1.35;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.fetch-status.complete {
  background: #ecfdf3;
  border-color: #abefc6;
}

.fetch-status.partial {
  background: #fffaeb;
  border-color: #fedf89;
}

.fetch-status.failed {
  background: #fef3f2;
  border-color: #fecdca;
}

.hero-image {
  border-radius: 8px;
  max-width: 100%;
  width: 100%;
}

.image-credit {
  font-size: 13px;
  margin-top: 8px;
}

.missing-image {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: #eef2f6;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  justify-items: center;
  padding: 24px;
  text-align: center;
}

.image-preview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-bottom: 28px;
}

.image-preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 8px;
  overflow: hidden;
  padding: 8px;
  text-decoration: none;
}

.image-preview.selected {
  border-color: var(--accent);
}

.image-preview img {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
}

.image-preview div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.image-preview span {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.image-preview a {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  background: #e9f7ef;
  border-radius: 999px;
  color: var(--ok);
  display: inline-flex;
  padding: 6px 10px;
}

.examples,
.card-list {
  display: grid;
  gap: 12px;
}

.example,
.review-row {
  padding: 16px;
}

.blank {
  color: var(--accent-dark);
  font-weight: 700;
}

.review-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.review-shell,
.empty-state {
  display: grid;
  min-height: 60vh;
  place-items: center;
}

.review-card {
  max-width: 620px;
  width: 100%;
}

.review-image {
  border-radius: 8px;
  display: block;
  margin-bottom: 18px;
  max-height: 420px;
  object-fit: cover;
  width: 100%;
}

.sentence {
  font-size: 28px;
  line-height: 1.35;
}

.answer-form {
  display: grid;
  gap: 12px;
}

.message {
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.message.success {
  background: #ecfdf3;
  color: var(--ok);
}

.message.error {
  background: #fef3f2;
  color: var(--bad);
}

.message.warning {
  background: #fffaeb;
  color: #93370d;
}

.message.processing {
  background: #eef4ff;
  color: #1849a9;
}

.form-error {
  color: var(--bad);
}

@media (max-width: 760px) {
  .topbar,
  .topbar nav,
  .section-title,
  .review-row {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .public-hero,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .public-hero {
    min-height: auto;
  }

  .public-hero h1 {
    font-size: 42px;
  }
}
