:root {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-accent: #ecfeff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.12);
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f172a;
    --bg-accent: #134e4a;
    --surface: rgba(15, 23, 42, 0.82);
    --surface-strong: rgba(15, 23, 42, 0.95);
    --text: #e2e8f0;
    --muted: #cbd5e1;
    --border: rgba(148, 163, 184, 0.28);
    --accent: #5eead4;
    --accent-soft: rgba(94, 234, 212, 0.16);
    --shadow: 0 24px 60px rgba(2, 6, 23, 0.42);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-accent: #ecfeff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.12);
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-accent: #134e4a;
  --surface: rgba(15, 23, 42, 0.82);
  --surface-strong: rgba(15, 23, 42, 0.95);
  --text: #e2e8f0;
  --muted: #cbd5e1;
  --border: rgba(148, 163, 184, 0.28);
  --accent: #5eead4;
  --accent-soft: rgba(94, 234, 212, 0.16);
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, var(--bg-accent), var(--bg) 60%);
  color: var(--text);
}

button,
input,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
article:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.75rem 1rem;
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  border-radius: 0.8rem;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.page-shell {
  width: min(1100px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1rem 0 2.5rem;
}

.site-header,
.panel,
.help-dialog {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  padding: 1.25rem;
  border-radius: 1.5rem;
  margin-bottom: 1rem;
}

.eyebrow,
.section-label,
.result-count,
.status,
.site-footer,
.definition-context,
.pinned-meta {
  color: var(--muted);
}

.eyebrow,
.section-label {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0.6rem;
  font-size: clamp(2rem, 6vw, 3.3rem);
  line-height: 1.05;
}

.lede,
.definition-copy,
.daily-card,
.help-dialog li {
  line-height: 1.65;
}

.lede {
  max-width: 64ch;
  color: var(--muted);
}

.theme-toggle,
.ghost-button,
.chip,
.pin-button,
.related-chip,
.close-help {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 0.9rem;
}

.theme-toggle,
.ghost-button,
.pin-button,
.close-help {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
}

.app-shell {
  display: grid;
  gap: 1rem;
}

.panel {
  border-radius: 1.5rem;
  padding: 1.25rem;
}

.search-label {
  display: block;
  margin-bottom: 0.55rem;
  font-weight: 700;
}

.search-input {
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface-strong);
  color: var(--text);
}

.big-search {
  font-size: clamp(1.1rem, 3vw, 1.45rem);
}

.toolbar-row,
.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.chip-heading {
  margin: 0;
}

.chip-row,
.related-list,
.pinned-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.chip,
.related-chip {
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

.chip[aria-pressed="true"],
.related-chip:hover,
.related-chip:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.result-count {
  margin-top: 1rem;
}

.daily-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--accent-soft);
  margin-bottom: 1rem;
}

.card-grid {
  display: grid;
  gap: 1rem;
}

.acronym-card {
  border: 1px solid var(--border);
  border-radius: 1.3rem;
  padding: 1rem;
  background: var(--surface-strong);
  display: grid;
  gap: 0.85rem;
}

.acronym-card.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.acronym-word {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
}

.expansion {
  font-size: 1.05rem;
  font-weight: 600;
}

.category-badge {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.definition-copy {
  font-size: 0.98rem;
}

.definition-context {
  font-size: 0.94rem;
}

.related-heading {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.pinned-item {
  padding: 0.7rem 0.9rem;
  border-radius: 1rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 1.25rem;
  text-align: center;
}

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 30;
}

.help-dialog {
  width: min(520px, 100%);
  border-radius: 1.5rem;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.help-dialog ul {
  padding-left: 1.2rem;
}

.close-help {
  justify-self: end;
}

.site-footer {
  text-align: center;
  padding-top: 1.25rem;
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--accent);
}

@media (min-width: 720px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
  }

  .theme-toggle {
    width: 100%;
    justify-content: center;
  }

  .card-topline {
    flex-direction: column;
  }
}
