/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg: #f5f5f7;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --bg-solid: #ffffff;
  --text: #1d1d1f;
  --text-soft: #6e6e73;
  --text-faint: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-hover: #0077ed;

  --sev-low: #34c759;
  --sev-medium: #ff9500;
  --sev-high: #ff3b30;

  --orb-1: rgba(0, 113, 227, 0.45);
  --orb-2: rgba(175, 82, 222, 0.4);
  --orb-3: rgba(52, 199, 89, 0.35);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
    'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: rgba(28, 28, 30, 0.72);
    --bg-solid: #1c1c1e;
    --text: #f5f5f7;
    --text-soft: #a1a1a6;
    --text-faint: #8e8e93;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #0a84ff;
    --accent-hover: #409cff;

    --orb-1: rgba(10, 132, 255, 0.35);
    --orb-2: rgba(191, 90, 242, 0.3);
    --orb-3: rgba(48, 209, 88, 0.25);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  }
}

/* ============================================================
   Reset
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   Ambient background orbs
   ============================================================ */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.9;
  animation: drift 22s ease-in-out infinite alternate;
}

.orb--1 {
  width: 480px;
  height: 480px;
  background: var(--orb-1);
  top: -120px;
  left: -80px;
}

.orb--2 {
  width: 420px;
  height: 420px;
  background: var(--orb-2);
  top: 30%;
  right: -120px;
  animation-delay: -7s;
}

.orb--3 {
  width: 380px;
  height: 380px;
  background: var(--orb-3);
  bottom: -120px;
  left: 30%;
  animation-delay: -14s;
}

.orb--4 {
  width: 320px;
  height: 320px;
  background: var(--orb-1);
  top: 50%;
  left: 45%;
  animation: drift 26s ease-in-out infinite alternate, pulse-orb 12s ease-in-out infinite;
  animation-delay: -4s;
  opacity: 0.6;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  to {
    transform: translate3d(60px, -40px, 0) scale(1.15) rotate(8deg);
  }
}

@keyframes pulse-orb {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.75;
  }
}

/* ============================================================
   Nav
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 24px;
  text-decoration: none;
  color: var(--text);
}

.nav__logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--orb-2));
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
  transition: transform 0.4s var(--spring), box-shadow 0.4s var(--ease);
}

.nav__brand:hover .nav__logo {
  transform: rotate(-8deg) scale(1.1);
  box-shadow: 0 6px 18px rgba(0, 113, 227, 0.5);
}

.nav__brand:hover .nav__logo i {
  animation: wiggle 0.6s var(--ease);
}

.nav__title {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.nav__title-accent {
  background: linear-gradient(120deg, var(--accent), var(--orb-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.hero {
  text-align: center;
  padding: 72px 0 48px;
}

.hero__eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  margin-bottom: 14px;
}

.hero__eyebrow i {
  display: inline-block;
  animation: bolt-pulse 2.4s ease-in-out infinite;
}

.hero__title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 20px;
}

.hero__subtitle {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-soft);
  font-size: clamp(16px, 2.4vw, 20px);
}

/* ============================================================
   Card base
   ============================================================ */
.card {
  background: var(--bg-elevated);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ============================================================
   Editor
   ============================================================ */
.editor {
  overflow: hidden;
  transition: box-shadow 0.4s var(--ease), border-color 0.4s var(--ease),
    transform 0.4s var(--ease);
}

.editor:focus-within {
  border-color: rgba(0, 113, 227, 0.4);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12), var(--shadow-lg);
}

.editor__toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

/* macOS traffic-light window controls */
.editor__traffic {
  display: flex;
  gap: 8px;
  z-index: 2;
}

.traffic {
  position: relative;
  width: 13px;
  height: 13px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  /* subtle inner ring like real macOS */
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.2);
  transition: filter 0.15s var(--ease), transform 0.1s var(--ease);
}

.traffic:active {
  transform: scale(0.9);
  filter: brightness(0.85);
}

.traffic--close {
  background: #ff5f57;
}
.traffic--min {
  background: #febc2e;
}
.traffic--max {
  background: #28c840;
}

.traffic i {
  font-size: 8px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

/* macOS reveals all three glyphs when hovering the group */
.editor__traffic:hover .traffic i,
.editor__traffic:focus-within .traffic i {
  opacity: 1;
}

/* dim the dots when the cursor leaves the whole window, like an unfocused Mac window */
.editor:not(:hover):not(:focus-within) .traffic {
  filter: saturate(0.25) brightness(1.05);
}

/* centered window title with the SnipCheck logo */
.editor__title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  pointer-events: none;
  white-space: nowrap;
}

.editor__title-logo {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--orb-2));
  color: #fff;
  font-size: 10px;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.35);
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 980px;
  background: rgba(120, 120, 128, 0.16);
}

.segmented__item {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 980px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.segmented__item:hover {
  color: var(--text);
}

.segmented__item.is-active {
  background: var(--bg-solid);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  animation: pop 0.3s var(--spring);
}

.editor__body {
  padding: 0;
}

.editor__textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  padding: 22px;
  tab-size: 2;
}

.editor__textarea::placeholder {
  color: var(--text-faint);
}

.editor__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.editor__count {
  color: var(--text-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

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

/* ----------------------------------------------------------------
   Window states — minimize / maximize / close (macOS behaviour)
   ---------------------------------------------------------------- */
.editor__collapsible {
  transition: max-height 0.4s var(--ease), opacity 0.3s var(--ease);
  max-height: 1200px;
  overflow: hidden;
}

/* Minimize: collapse everything below the title bar */
.editor.is-min .editor__collapsible {
  max-height: 0;
  opacity: 0;
}

.editor.is-min {
  cursor: pointer;
}

/* Zoom: grow the editing surface, like maximizing a window */
.editor.is-max .editor__textarea {
  min-height: min(72vh, 760px);
}

.editor.is-max {
  box-shadow: var(--shadow-lg);
}

/* Close: scale + fade out, then the element is hidden by JS */
.editor.is-closing {
  animation: window-close 0.32s var(--ease) forwards;
  pointer-events: none;
}

@keyframes window-close {
  to {
    opacity: 0;
    transform: scale(0.92) translateY(-8px);
  }
}

/* "New check" button shown after the window is closed */
.reopen {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px auto 0;
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  animation: pop 0.35s var(--spring) both;
  transition: transform 0.2s var(--spring), border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.reopen:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.reopen:hover i {
  animation: wiggle 0.6s var(--ease);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 980px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
  cursor: pointer;
  transition: transform 0.2s var(--spring), background 0.2s var(--ease),
    opacity 0.2s var(--ease);
  position: relative;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  cursor: default;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 113, 227, 0.3);
}

.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 113, 227, 0.42);
}

.btn--primary:hover .btn__icon {
  animation: sparkle 0.8s var(--ease);
}

.btn--ghost {
  background: rgba(120, 120, 128, 0.12);
  color: var(--text);
}

.btn--ghost:hover {
  background: rgba(120, 120, 128, 0.2);
  transform: translateY(-2px);
}

.btn--ghost:hover i {
  animation: wiggle 0.6s var(--ease);
}

.btn__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn__icon,
.btn.is-loading .btn__label {
  display: none;
}

.btn.is-loading .btn__spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   Alert
   ============================================================ */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 59, 48, 0.12);
  border: 1px solid rgba(255, 59, 48, 0.3);
  color: var(--sev-high);
  font-size: 15px;
  animation: pop 0.3s var(--spring) both;
}

/* ============================================================
   Results
   ============================================================ */
.results {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.results__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results__head h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 600;
}

.badge--lang {
  background: rgba(0, 113, 227, 0.14);
  color: var(--accent);
  text-transform: lowercase;
  animation: pop 0.4s var(--spring) both;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.result-card {
  padding: 24px;
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.result-card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
}

.result-card__title i {
  color: var(--accent);
  transition: transform 0.3s var(--spring);
}

.result-card:hover .result-card__title i {
  transform: scale(1.2) rotate(-6deg);
}

.result-card__body {
  color: var(--text-soft);
  font-size: 15px;
}

.count-pill {
  margin-left: auto;
  background: rgba(120, 120, 128, 0.16);
  color: var(--text-soft);
  border-radius: 980px;
  padding: 2px 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Issues */
.issues {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.issue {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(120, 120, 128, 0.08);
  animation: slide-in 0.45s var(--spring) both;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.issue:hover {
  background: rgba(120, 120, 128, 0.14);
  transform: translateX(4px);
}

.issue__sev {
  flex-shrink: 0;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 980px;
  color: #fff;
}

.issue__sev[data-sev='low'] {
  background: var(--sev-low);
}
.issue__sev[data-sev='medium'] {
  background: var(--sev-medium);
}
.issue__sev[data-sev='high'] {
  background: var(--sev-high);
}

.issue__desc {
  color: var(--text);
  font-size: 14px;
}

.empty-state {
  color: var(--text-faint);
  font-size: 15px;
  font-style: italic;
}

/* Complexity */
.complexity__rating {
  text-transform: capitalize;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.meter {
  height: 8px;
  border-radius: 980px;
  background: rgba(120, 120, 128, 0.16);
  overflow: hidden;
  margin-bottom: 14px;
}

.meter__fill {
  display: block;
  height: 100%;
  border-radius: 980px;
  width: 0;
  transition: width 0.6s var(--spring), background 0.4s var(--ease);
}

.meter[data-rating='low'] .meter__fill {
  width: 33%;
  background: var(--sev-low);
}
.meter[data-rating='medium'] .meter__fill {
  width: 66%;
  background: var(--sev-medium);
}
.meter[data-rating='high'] .meter__fill {
  width: 100%;
  background: var(--sev-high);
}

/* Suggestions */
.suggestions {
  list-style: none;
  counter-reset: suggestion;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggestions li {
  counter-increment: suggestion;
  position: relative;
  padding-left: 38px;
  color: var(--text);
  font-size: 15px;
  animation: slide-in 0.45s var(--spring) both;
}

.suggestions li::before {
  transition: transform 0.3s var(--spring), background 0.3s var(--ease);
}

.suggestions li:hover::before {
  transform: scale(1.15);
  background: var(--accent);
  color: #fff;
}

.suggestions li::before {
  content: counter(suggestion);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.14);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

/* ============================================================
   History
   ============================================================ */
.history {
  margin-top: 40px;
  animation: rise 0.5s var(--ease) both;
}

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

.history__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.history__title i {
  color: var(--accent);
}

.btn--sm {
  font-size: 13px;
  padding: 7px 14px;
}

.history__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history__item {
  display: flex;
  align-items: stretch;
  gap: 8px;
  animation: slide-in 0.4s var(--spring) both;
}

.history__open {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.history__open:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.history__open:active {
  transform: scale(0.99);
}

.history__meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history__time {
  color: var(--text-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.history__preview {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history__del {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease),
    transform 0.2s var(--spring);
}

.history__del:hover {
  color: var(--sev-high);
  background: rgba(255, 59, 48, 0.12);
  transform: scale(1.05);
}

/* ============================================================
   Skeleton (loading)
   ============================================================ */
.skeleton-card {
  height: 120px;
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(120, 120, 128, 0.12),
    transparent
  );
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 13px;
  flex-wrap: wrap;
}

.footer__links {
  display: flex;
  gap: 20px;
}

.footer__links a {
  color: var(--text-soft);
  text-decoration: none;
}

.footer__links a:hover {
  color: var(--text);
}

/* ============================================================
   Cookie consent popup
   ============================================================ */
.cookie {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  width: min(560px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px 16px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  /* off-screen until .is-visible */
  opacity: 0;
  transform: translate(-50%, 140%);
  transition: transform 0.55s var(--spring), opacity 0.4s var(--ease);
}

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

.cookie__icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--sev-medium), #ff6a3d);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(255, 149, 0, 0.4);
  animation: cookie-bob 3.2s ease-in-out infinite;
}

.cookie__body {
  flex: 1 1 220px;
}

.cookie__title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.cookie__text {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.cookie__text a {
  color: var(--accent);
  text-decoration: none;
}

.cookie__text a:hover {
  text-decoration: underline;
}

.cookie__actions {
  flex-basis: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes cookie-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-4px) rotate(4deg);
  }
}

/* ============================================================
   Legal pages
   ============================================================ */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.legal h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.legal .legal__updated {
  color: var(--text-faint);
  font-size: 14px;
  margin-bottom: 32px;
}

.legal h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 32px 0 12px;
}

.legal p,
.legal li {
  color: var(--text-soft);
  font-size: 16px;
  margin-bottom: 12px;
}

.legal ul {
  padding-left: 22px;
}

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

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

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

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Staggered reveal on load — drives the hero + editor entrance */
.reveal {
  opacity: 0;
  animation: reveal-up 0.7s var(--spring) both;
  animation-delay: var(--d, 0ms);
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sparkle {
  0% {
    transform: scale(1) rotate(0deg);
  }
  40% {
    transform: scale(1.3) rotate(12deg);
  }
  70% {
    transform: scale(0.95) rotate(-8deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-12deg);
  }
  75% {
    transform: rotate(12deg);
  }
}

@keyframes bolt-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.7;
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 680px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .editor__toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  /* the centered window title would overlap the stacked toolbar */
  .editor__title {
    display: none;
  }
}

/* ============================================================
   Accessibility — respect reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
