:root {
  --bg: #fefdfb;
  --panel: #ffffff;
  --panel-alt: #fdfaf5;
  --sidebar-bg: #fefdfb;
  --chip-bg: #fbf7ef;
  --surface-muted: #f9f4ed;
  --input-bg: #ffffff;
  --border: #ede4d9;
  --muted: #615d73;
  --text: #2f2f2f;
  --accent: #b581e3;
  --shadow: none;
  font-size: 14px;
}

body.theme-dark {
  --bg: #1a1a1a;
  --panel: #1f1f1f;
  --panel-alt: #1c1c1c;
  --sidebar-bg: #1a1a1a;
  --chip-bg: #1d1d1d;
  --surface-muted: #1e1e1e;
  --input-bg: #1b1b1b;
  --border: #2a2a2a;
  --muted: #9d9d9d;
  --text: #ededed;
  --accent: #b581e3;
  --shadow: none;
}

body.theme-light {
  --bg: #fefdfb;
  --panel: #ffffff;
  --panel-alt: #fdfaf5;
  --sidebar-bg: #fefdfb;
  --chip-bg: #fbf7ef;
  --surface-muted: #f9f4ed;
  --input-bg: #ffffff;
  --border: #ede4d9;
  --muted: #615d73;
  --text: #2f2f2f;
  --accent: #b581e3;
  --shadow: none;
}

body.theme-system {
  --bg: #fefdfb;
  --panel: #ffffff;
  --panel-alt: #fdfaf5;
  --sidebar-bg: #fefdfb;
  --chip-bg: #fbf7ef;
  --surface-muted: #f9f4ed;
  --input-bg: #ffffff;
  --border: #ede4d9;
  --muted: #615d73;
  --text: #2f2f2f;
  --accent: #b581e3;
  --shadow: none;
}

/* Global focus outlines */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  body.theme-system {
    --bg: #1a1a1a;
    --panel: #1f1f1f;
    --panel-alt: #1c1c1c;
    --sidebar-bg: #1a1a1a;
    --chip-bg: #1d1d1d;
    --surface-muted: #1e1e1e;
    --input-bg: #1b1b1b;
    --border: #2a2a2a;
    --muted: #9d9d9d;
    --text: #ededed;
    --accent: #b581e3;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  transition: background 160ms ease, color 160ms ease;
}

h1,
h2,
h3,
h4,
h5,
h6,
.heading-font,
.card-title,
.section-title,
.grid-title,
.modal-title,
.dialog-title,
.drawer-title,
.page-title {
  font-family: "Playwright", "Playfair Display", "Times New Roman", serif;
  font-weight: 600;
}

body.settings-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.highlight {
  color: var(--accent);
}

.subtitle {
  color: #b3b3b3;
  font-size: 0.95rem;
}

.error-text {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin: 0.2rem 0 0.8rem;
}

.landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  padding: 2.5rem 1.75rem 1.5rem;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  gap: 1.5rem;
}

.landing-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  width: min(920px, 100%);
  margin: 0 auto;
  text-align: center;
  padding: 0 0.25rem;
}

.definition-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.75rem 1.9rem;
  width: min(720px, 100%);
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, box-shadow 180ms ease;
  text-align: left;
}

.definition-word {
  font-family: "Playwright", "Playfair Display", "Times New Roman", serif;
  font-size: clamp(3.1rem, 8vw, 4.9rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.definition-pronunciation {
  font-family: "Montserrat", sans-serif;
  margin-top: 0.9rem;
  font-size: clamp(1.05rem, 3.2vw, 1.35rem);
  color: var(--muted);
  line-height: 1.35;
}

.definition-pronunciation .pronounce-core {
  color: var(--accent);
}

.definition-divider {
  width: min(420px, 82vw);
  height: 1px;
  background: var(--border);
  margin: 1.1rem auto 1rem;
}

.definition-meaning {
  font-family: "Playwright", "Playfair Display", "Times New Roman", serif;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
  margin-left: 0.6rem;
}

.chevron-button {
  border: none;
  background: rgba(181, 129, 227, 0.12);
  color: var(--accent);
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  animation: chevronBounce 1.85s ease-in-out infinite;
  transition: transform 160ms ease, color 160ms ease, background 200ms ease, opacity 200ms ease;
}

.chevron-button:hover {
  background: rgba(181, 129, 227, 0.2);
  color: var(--text);
  animation-play-state: paused;
}

.chevron-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.chevron-button--hide {
  opacity: 0;
  transform: translateY(10px) scale(0.94);
  pointer-events: none;
  animation-play-state: paused;
}

@keyframes chevronBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(9px);
  }
}

.definition-card--swap-out {
  animation: definitionSwapOut 180ms ease forwards;
}

.definition-card--swap-in {
  animation: definitionSwapIn 190ms ease forwards;
}

@keyframes definitionSwapOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

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

.auth-grid {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  text-align: center;
  width: min(640px, 100%);
  margin: 0 auto;
  margin-top: 1.25rem;
  min-height: 210px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease, visibility 240ms ease;
}

.auth-grid--visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.grid-title {
  grid-column: span 2;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
}

.grid-label {
  margin-top: 0.4rem;
  margin-bottom: 0.3rem;
  font-family: "Montserrat", sans-serif;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
}

.auth-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 0.9rem;
  background: var(--panel-alt);
  cursor: pointer;
  transition: transform 200ms ease, opacity 200ms ease;
  opacity: 0;
  transform: translateY(14px);
  will-change: transform, opacity;
}

.auth-card h3 {
  font-family: "Montserrat", sans-serif;
}

.auth-card:hover {
  transform: translateY(-4px);
}

.auth-grid--visible .auth-card {
  opacity: 1;
  transform: translateY(0);
}

.auth-card--enter {
  opacity: 0;
  transform: translateY(16px);
  animation: authCardIn 260ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

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

.auth-card i {
  font-size: 2.15rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.auth-card p {
  color: var(--muted);
}

/* Landing Page Footer */
.landing-footer {
  margin-top: auto;
  width: 100%;
  max-width: 960px;
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-family: "Montserrat", sans-serif;
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.footer-link:hover {
  color: var(--accent);
  background: rgba(181, 129, 227, 0.12);
}

.footer-separator {
  color: var(--muted);
  font-size: 0.9rem;
  opacity: 0.4;
}

@media (max-width: 960px) {
  .landing {
    padding: 1.9rem 1.25rem 1.25rem;
  }
}

@media (max-width: 720px) {
  .landing {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem 1rem 1rem;
  }

  .landing-body {
    justify-content: flex-start;
    gap: 1rem;
  }

  .definition-card {
    padding: 1.4rem 1.25rem;
  }

  .chevron-button {
    width: 2.75rem;
    height: 2.75rem;
  }

  .auth-grid {
    grid-template-columns: 1fr;
    width: 100%;
    padding: 1.25rem 0;
  }
}

@media (max-width: 480px) {
  .definition-card {
    border-radius: 14px;
  }

  .chevron-button {
    width: 2.6rem;
    height: 2.6rem;
  }
}
