:root {
  color-scheme: light;
  --paper: #f2ecdf;
  --paper-deep: #e9e1d0;
  --card: #fbf8f0;
  --card-soft: #f6f1e6;
  --ink: #211c15;
  --ink-soft: #3b3429;
  --muted: #6f6658;
  --faint: #928876;
  --line: #d9cfbc;
  --line-strong: #c7bba4;
  --red: #a32f24;
  --red-dark: #7d2119;
  --red-soft: #f3ddd8;
  --gold: #ad7f27;
  --gold-soft: #f0e4c8;
  --green: #2e6a4d;
  --green-soft: #dfece3;
  --shadow: 0 28px 70px -38px rgba(52, 38, 16, 0.55);
  --shadow-soft: 0 12px 34px -24px rgba(52, 38, 16, 0.45);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --radius: 26px;
  --ring-circumference: 345.58;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #14120e;
    --paper-deep: #1a1711;
    --card: #1e1a14;
    --card-soft: #241f18;
    --ink: #f3ecdf;
    --ink-soft: #ded4c2;
    --muted: #a99d89;
    --faint: #857a67;
    --line: #3a3327;
    --line-strong: #4b4232;
    --red: #e2685a;
    --red-dark: #f08a7e;
    --red-soft: #3a221d;
    --gold: #d8ad57;
    --gold-soft: #332a19;
    --green: #74b894;
    --green-soft: #1d2f26;
    --shadow: 0 28px 70px -34px rgba(0, 0, 0, 0.9);
    --shadow-soft: 0 12px 34px -20px rgba(0, 0, 0, 0.7);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 12% -8%, color-mix(in srgb, var(--gold) 15%, transparent), transparent 62%),
    radial-gradient(700px 440px at 100% 0%, color-mix(in srgb, var(--red) 9%, transparent), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 12%, transparent) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  opacity: 0.35;
  mask-image: linear-gradient(to bottom, black, transparent 62%);
}

::selection {
  background: color-mix(in srgb, var(--gold) 38%, transparent);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

.shell {
  width: min(1240px, calc(100% - 48px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 20px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 14px;
}

/* ------------------------------------------------------------- top bar --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--paper) 16%, transparent);
}

.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-dash {
  color: var(--red);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline: auto;
}

.nav-link {
  position: relative;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--card) 70%, transparent);
}

.nav-link.is-active {
  color: var(--ink);
}

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
  transform: translateX(-50%);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.today-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 74%, transparent);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.sync-chip[data-state="syncing"] .sync-dot,
.sync-chip[data-state="saving"] .sync-dot {
  background: var(--gold);
  animation: pulse 1s ease-in-out infinite;
}

.sync-chip[data-state="synced"] .sync-dot,
.sync-chip[data-state="ok"] .sync-dot {
  background: var(--green);
}

.sync-chip[data-state="error"] .sync-dot,
.sync-chip[data-state="offline"] .sync-dot {
  background: var(--red);
}

.sync-chip[data-state="error"],
.sync-chip[data-state="offline"] {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, var(--line));
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.78); }
}

/* --------------------------------------------------------------- hero --- */

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 26px;
  align-items: start;
  padding-block: 54px 72px;
}

.daily-card {
  position: relative;
  padding: clamp(28px, 4.4vw, 54px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--card) 97%, transparent), color-mix(in srgb, var(--card-soft) 86%, transparent));
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.6s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.daily-card::after {
  content: "";
  position: absolute;
  top: -120px;
  right: -100px;
  width: 320px;
  height: 320px;
  border: 1px solid color-mix(in srgb, var(--gold) 22%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

.daily-card::before {
  content: "";
  position: absolute;
  top: -74px;
  right: -54px;
  width: 200px;
  height: 200px;
  border: 1px solid color-mix(in srgb, var(--red) 14%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

.eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(34px, 5vw, 56px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow-rule {
  display: inline-block;
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.day-count {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.word-head {
  display: flex;
  align-items: baseline;
  gap: clamp(10px, 1.6vw, 20px);
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.article {
  color: var(--red);
  font-family: var(--serif);
  font-size: clamp(26px, 3.2vw, 44px);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  transform: translateY(-0.12em);
}

.article:empty {
  display: none;
}

#german {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.4rem, 8.4vw, 7.4rem);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.pronunciation-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 18px 0 22px;
}

.ipa {
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(14px, 1.7vw, 18px);
  letter-spacing: 0.02em;
}

.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.speak-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.speak-btn:hover {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--card) 80%, transparent);
}

.speak-btn:active {
  transform: scale(0.97);
}

.speak-btn.is-speaking {
  border-color: var(--gold);
  color: var(--gold);
}

.speak-btn.is-speaking svg {
  animation: speak-wave 0.8s ease-in-out infinite;
}

@keyframes speak-wave {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.meaning-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: clamp(30px, 4vw, 46px);
}

.pos-badge {
  display: inline-flex;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--gold) 42%, var(--line));
  border-radius: 6px;
  background: var(--gold-soft);
  color: color-mix(in srgb, var(--gold) 80%, var(--ink));
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.english {
  color: var(--ink-soft);
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 450;
  letter-spacing: -0.01em;
}

.example {
  position: relative;
  margin: 0 0 clamp(30px, 4vw, 44px);
  padding: 2px 0 2px 22px;
  border-left: 2px solid color-mix(in srgb, var(--gold) 55%, var(--line));
}

.example-label {
  display: block;
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.example blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 21px);
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.example figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-learn {
  background: var(--ink);
  color: var(--paper);
}

.btn-learn:hover {
  background: color-mix(in srgb, var(--ink) 88%, var(--red));
}

.btn-learn[aria-pressed="true"] {
  background: var(--green);
  color: #fff;
}

.btn-learn[aria-pressed="true"] .icon-check {
  stroke-width: 2.6;
}

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover {
  border-color: var(--ink);
}

.btn-ghost .icon-bookmark {
  fill: none;
}

.btn-ghost[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--gold) 60%, var(--line));
  background: var(--gold-soft);
  color: color-mix(in srgb, var(--gold) 82%, var(--ink));
}

.btn-ghost[aria-pressed="true"] .icon-bookmark {
  fill: currentColor;
}

.key-hint {
  margin-left: auto;
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--card-soft);
  font-family: var(--mono);
  font-size: 10px;
}

/* ---------------------------------------------------------------- side --- */

.side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.6s 0.08s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.progress-card,
.sync-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow: var(--shadow-soft);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-label {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.card-stamp {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}

.ring-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  margin: 2px 0 18px;
}

.ring {
  width: min(190px, 72%);
  transform: rotate(-90deg);
  overflow: visible;
}

.ring-track,
.ring-fill {
  fill: none;
  stroke-width: 8;
}

.ring-track {
  stroke: var(--line);
}

.ring-fill {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: var(--ring-circumference);
  stroke-dashoffset: var(--ring-circumference);
  transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  pointer-events: none;
}

.ring-center strong {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

.ring-center span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.stat span {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.1;
}

.stat small {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.progress-bar {
  height: 4px;
  margin-top: 18px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), color-mix(in srgb, var(--gold) 55%, var(--red)));
  transition: width 0.7s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.progress-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.sync-card {
  background: color-mix(in srgb, var(--card-soft) 70%, transparent);
}

.sync-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.gh-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.sync-pill {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: lowercase;
}

.sync-pill[data-state="synced"],
.sync-pill[data-state="ok"] {
  background: var(--green-soft);
  color: var(--green);
}

.sync-pill[data-state="saving"],
.sync-pill[data-state="syncing"] {
  background: var(--gold-soft);
  color: var(--gold);
}

.sync-pill[data-state="error"],
.sync-pill[data-state="offline"] {
  background: var(--red-soft);
  color: var(--red);
}

.sync-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.sync-card code {
  padding: 1px 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--line) 55%, transparent);
  font-family: var(--mono);
  font-size: 10.5px;
}

.d1-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 10px !important;
  letter-spacing: 0.02em;
}

.d1-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

/* ------------------------------------------------------------- library --- */

.library {
  position: relative;
  z-index: 1;
  padding-block: 10px 90px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

.library-count {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0 26px;
  flex-wrap: wrap;
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 280px;
  max-width: 420px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 76%, transparent);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.search:focus-within {
  border-color: var(--ink-soft);
  background: var(--card);
}

.search svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.search input::placeholder {
  color: var(--faint);
}

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

.chip {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.16s ease;
}

.chip:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

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

.word-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 126px;
  padding: 17px 17px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  animation: fade-in 0.3s ease both;
}

.word-card::after {
  content: "";
  position: absolute;
  left: 17px;
  right: 17px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.16s ease;
}

.word-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}

.word-card:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.word-card.is-learned {
  border-color: color-mix(in srgb, var(--green) 30%, var(--line));
}

.word-card.is-learned::after {
  background: var(--green);
}

.word-card-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
}

.word-card .article {
  font-size: 15px;
  transform: none;
}

.word-card .word {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.card-markers {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: none;
}

.marker {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
}

.marker svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.marker.learned {
  color: var(--green);
}

.marker.saved {
  color: var(--gold);
}

.marker.saved svg {
  fill: currentColor;
}

.word-card .translation {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.word-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--line) 80%, transparent);
}

.word-card .card-ipa {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-card .card-pos {
  margin-left: auto;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.empty {
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
  font-family: var(--serif);
  font-size: 20px;
}

/* -------------------------------------------------------------- dialog --- */

.dialog {
  width: min(620px, calc(100% - 32px));
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(4px);
}

.dialog[open] {
  animation: dialog-in 0.22s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.dialog-inner {
  position: relative;
  padding: clamp(26px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: border-color 0.16s ease, color 0.16s ease;
}

.dialog-close:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.dialog-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.dialog-word {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}

.dialog-word .article {
  font-size: 28px;
}

.dialog-word h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(40px, 7vw, 58px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.dialog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.dialog-meta .english {
  font-size: 17px;
}

.dialog-example {
  margin-bottom: 28px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------- toast --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(440px, calc(100% - 32px));
  padding: 12px 18px;
  border: 1px solid color-mix(in srgb, var(--paper) 20%, transparent);
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.6);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-tone="error"] {
  background: var(--red);
  color: #fff;
}

/* -------------------------------------------------------------- footer --- */

.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-deep) 45%, transparent);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-block: 26px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.footer-inner p {
  margin: 0;
}

.footer-brand {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
}

.footer-brand span {
  color: var(--red);
}

.footer-sync {
  font-family: var(--mono);
  font-size: 10px;
}

.footer a:hover {
  color: var(--ink);
}

/* ----------------------------------------------------------- animations --- */

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ responsive --- */

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-block: 34px 56px;
  }

  .side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .progress-card,
  .sync-card {
    height: 100%;
  }

  .ring {
    width: 150px;
  }

  .ring-center strong {
    font-size: 34px;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(100% - 32px);
  }

  .topbar-inner {
    min-height: 66px;
    gap: 14px;
  }

  .nav {
    display: none;
  }

  .today-label {
    display: none;
  }

  .topbar-meta {
    margin-left: auto;
  }

  .brand-name {
    font-size: 18px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 18px;
    border-radius: 9px;
  }

  .daily-card {
    border-radius: 20px;
  }

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

  .ring {
    width: 170px;
  }

  .key-hint {
    display: none;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }

  .toolbar {
    align-items: stretch;
  }

  .search {
    max-width: none;
  }

  .filters {
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }

  .word-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .word-card {
    min-height: 122px;
    padding: 14px 13px 12px;
    border-radius: 13px;
  }

  .word-card .word {
    font-size: 20px;
  }

  .word-card .translation {
    font-size: 11.5px;
  }

  .word-card .article {
    font-size: 13px;
  }

  .word-card .card-pos {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 460px) {
  .actions .btn {
    flex: 1 1 auto;
  }

  .example {
    padding-left: 16px;
  }

  .stats {
    gap: 4px;
  }

  .stat span {
    font-size: 20px;
  }

  .stat small {
    font-size: 9px;
  }

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

  .word-card {
    min-height: 108px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
