:root {
  color-scheme: light dark;
  --page: #f7f6f2; --surface: #fff; --ink: #202d29; --muted: #596860;
  --accent: #27674e; --accent-hover: #1b4c39; --on-accent: #fff;
  --line: #d5ded7; --control-line: #7b8f82; --error: #b02a37; --soft: #edf2ed; --spark: #d5aa60;
  --glow: rgba(39, 103, 78, .055); --shadow: 0 12px 36px rgba(30, 60, 43, .055);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --bs-fg-body: var(--ink); --bs-bg-body: var(--page);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #17201c; --surface: #202c25; --ink: #eef3ed; --muted: #b3c3b8;
    --accent: #8ed9ad; --accent-hover: #b1efc9; --on-accent: #17201c;
    --line: #405346; --control-line: #748e7d; --error: #ffabb8; --soft: #29392e; --glow: rgba(142, 217, 173, .04);
    --shadow: 0 12px 36px rgba(0, 0, 0, .14);
  }
}
body { background: radial-gradient(ellipse at 50% 0, var(--glow), transparent 42rem), var(--page); color: var(--ink); font-family: system-ui, sans-serif; }
a { color: var(--accent); text-underline-offset: .2em; }
button, a, textarea, summary { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent) !important; outline-offset: 4px; }
[hidden], .icon-sprite { display: none !important; }
.container { max-width: 1000px; padding-inline: 1.5rem; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 10; padding: .75rem 1rem; background: var(--surface); border-radius: .5rem; }
.skip-link:focus { top: 1rem; }
.icon { width: 1.1rem; height: 1.1rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-header { max-width: 780px; padding-block: 1.65rem 1rem; display: flex; align-items: center; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: .7rem; font-weight: 650; text-decoration: none; font-size: 1.08rem; letter-spacing: -.035em; }
.brand-aha { color: var(--accent); }
.brand-mark { position: relative; display: grid; place-items: center; width: 2.65rem; height: 2.65rem; border-radius: .8rem; background: var(--accent); color: var(--on-accent); font-family: Georgia, serif; font-size: 1.85rem; line-height: 1; box-shadow: 0 3px 10px var(--glow); }
.brand-mark::after { content: ''; position: absolute; right: -.12rem; top: -.12rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--spark); border: 2px solid var(--page); }
.app-main { max-width: 780px; padding-top: 1.8rem; }
.intro { margin-bottom: 1.85rem; }
.eyebrow { display: flex; align-items: center; gap: .6rem; color: var(--accent); font-size: .72rem; font-weight: 650; letter-spacing: .11em; text-transform: uppercase; margin-bottom: 1rem; }
.eyebrow::before { content: ''; width: .4rem; height: .4rem; background: var(--spark); border-radius: 50%; }
h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.8rem, 6.8vw, 4.35rem); font-weight: 400; letter-spacing: -.045em; line-height: 1.06; color: var(--ink); }
.headline-emphasis { position: relative; display: inline-block; z-index: 0; }
.headline-emphasis::after { content: ''; position: absolute; z-index: -1; left: .02em; right: .02em; bottom: .02em; height: .1em; border-radius: 50%; background: var(--spark); opacity: .32; transform-origin: left; }
.lead { color: var(--muted); font-size: 1.02rem; font-weight: 400; line-height: 1.65; margin: 1.15rem 0 0; }
.lookup-panel, .result-card { border: 1px solid var(--line); background: var(--surface); padding: 1.65rem; border-radius: 1.25rem; box-shadow: var(--shadow); }
.lookup-panel:focus-within { border-color: var(--accent); }
.form-label { color: var(--ink); font-weight: 650; font-size: .95rem; margin-bottom: .8rem; }
.form-control { background: var(--page); color: var(--ink); border: 1px solid var(--control-line); border-radius: .8rem; font-size: 1.04rem; padding: .95rem 1rem; line-height: 1.65; min-height: 112px; resize: vertical; }
.form-control:user-invalid { border-color: var(--error); }
.form-control::placeholder { color: var(--muted); opacity: 1; }
.form-control:focus { background: var(--page); color: var(--ink); border-color: var(--accent); box-shadow: none; }
.input-details { display: flex; justify-content: space-between; gap: .8rem; color: var(--muted); font-size: .74rem; margin-top: .6rem; }
#character-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: 1.2rem; }
.theme-primary { --bs-theme-bg: var(--accent); --bs-theme-fg: var(--accent); --bs-theme-border: var(--accent); --bs-theme-contrast: var(--on-accent); }
.theme-secondary { --bs-theme-bg: var(--soft); --bs-theme-fg: var(--muted); --bs-theme-border: var(--control-line); --bs-theme-contrast: var(--ink); }
.btn-solid, .btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; border-radius: .7rem; min-height: 46px; padding: .65rem 1rem; font-weight: 550; font-size: .9rem; }
.btn-solid.theme-primary:hover { background-color: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-outline { background: transparent; }
.btn-outline:not(:disabled):not(.recording):hover { background: var(--soft); border-color: var(--muted); color: var(--ink); }
.stop-icon { display: none; }
.recording { color: #b02a37; border-color: #b02a37; background: transparent; }
.recording .mic-icon { display: none; }
.recording .stop-icon { display: block; }
.voice-hint { font-size: .74rem; color: var(--muted); line-height: 1.55; margin: .8rem 0 0; }
.examples { border-top: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding-top: 1rem; margin-top: 1rem; font-size: .76rem; color: var(--muted); }
.example { background: var(--soft); border: 1px solid transparent; border-radius: 2rem; color: var(--ink); padding: .45rem .7rem; min-height: 40px; }
.status { display: flex; align-items: center; gap: .65rem; min-height: 1.5rem; font-size: .85rem; color: var(--muted); margin: 1rem .15rem; }
.status.is-pending::before { content: ''; width: 1rem; height: 1rem; flex-shrink: 0; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; }
.alert.theme-danger { background: #fdf1f3; color: #882b3c; border-color: #db98a1; }
.alert { border-radius: .85rem; font-size: .9rem; }
.results { scroll-margin-top: 1rem; border-radius: 1.25rem; }
.result-card { position: relative; border-top: 3px solid var(--accent); }
.result-label { display: inline-flex; align-items: center; gap: .45rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 650; margin-bottom: .6rem; }
.result-label::before { content: ''; width: .35rem; height: .35rem; border-radius: 50%; background: var(--accent); }
.word { font-size: clamp(2.2rem, 6vw, 3.2rem); font-family: Georgia, serif; font-weight: 400; letter-spacing: -.025em; overflow-wrap: anywhere; user-select: all; margin: 0 0 .5rem; color: var(--ink); }
.pronunciation { color: var(--muted); font-size: .9rem; margin-bottom: 1.25rem; }
.definitions { padding-left: 1.15rem; line-height: 1.75; font-size: .95rem; margin-block: 1rem 0; }
.definitions li { padding-left: .3rem; margin-bottom: .4rem; }
.no-definition { padding-left: 0; color: var(--muted); }
.result-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.5rem; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--line); }
.result-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.copy-button.is-copied { color: var(--accent); border-color: var(--accent); background: var(--soft); }
.copy-button .check-icon, .copy-button.is-copied .copy-icon { display: none; }
.copy-button.is-copied .check-icon { display: block; }
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; font-size: .85rem; }
.feedback.is-expanded { flex-basis: 100%; }
@media (min-width: 576px) { .feedback:not(.is-expanded) { margin-left: auto; } }
.feedback-title { margin: 0; color: var(--muted); font-weight: 600; }
.feedback-choices { display: flex; gap: .5rem; }
.feedback-choice { min-width: 4.25rem; min-height: 40px; padding: .4rem .9rem; border: 1px solid var(--control-line); border-radius: 2rem; background: var(--surface); color: var(--ink); font-weight: 550; }
.feedback-choice:hover { border-color: var(--accent); color: var(--accent); }
.feedback-thanks { margin: 0; color: var(--accent); font-weight: 550; }
.feedback-share { flex-basis: 100%; display: grid; gap: .55rem; justify-items: start; }
.feedback-label { font-weight: 600; color: var(--ink); }
.feedback-optional { color: var(--muted); font-weight: 400; }
.feedback-input { max-width: 22rem; min-height: 44px; }
.feedback-consent { display: flex; align-items: flex-start; gap: .55rem; color: var(--ink); }
.feedback-checkbox { width: 1.15rem; height: 1.15rem; margin-top: .15rem; flex-shrink: 0; accent-color: var(--accent); }
.feedback-note { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.feedback-send { min-height: 40px; }
.feedback-message { margin: 0; min-height: 1.2em; color: var(--muted); font-size: .8rem; }
.alternatives-title { font-size: .8rem; margin: 1.35rem .15rem .7rem; font-weight: 650; color: var(--muted); }
.alternative { display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .9rem 1rem; border-radius: .85rem; margin-bottom: .5rem; }
.alternative-copy { flex: 1; min-width: 0; }
.alternative strong { display: block; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.alternative-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .81rem; color: var(--muted); margin-top: .2rem; }
.alternative > .icon { color: var(--accent); }
.partial { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }
.empty-state-title { color: var(--ink); font-size: 1.4rem; font-weight: 550; }
.mature-note { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: .4rem 0 .2rem; color: var(--muted); font-size: .9rem; }
.mature-note p { margin: 0; }
.ai-note { color: var(--muted); font-size: .76rem; margin: .9rem .15rem 0; }
.refine { display: inline-flex; align-items: center; gap: .4rem; border: 0; min-height: 44px; padding: .65rem .15rem; background: transparent; color: var(--accent); font-size: .85rem; text-decoration: underline; text-underline-offset: .2em; }
.how-it-works { border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; padding-top: 1.6rem; margin-top: 2.3rem; }
.step-number { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; background: var(--soft); border-radius: .5rem; font-size: .72rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.how-it-works h2 { font-size: .82rem; margin: .75rem 0 .45rem; font-weight: 650; color: var(--ink); }
.how-it-works p { font-size: .8rem; color: var(--muted); line-height: 1.65; margin-bottom: 0; }
.app-footer { max-width: 780px; padding-block: 2rem; font-size: .73rem; color: var(--muted); }
.app-footer details { max-width: 730px; }
.app-footer summary { cursor: pointer; min-height: 32px; color: var(--muted); }
.app-footer details p { margin: .8rem 0; line-height: 1.7; }
@media (prefers-color-scheme: dark) {
  .alert.theme-danger { background: #40232b; color: #ffccd4; border-color: #78434e; }
  .recording { color: #ffabb8; border-color: #ffabb8; }
}
@media (max-width: 575px) {
  .container { padding-inline: 1rem; }
  .app-header { padding-top: 1.2rem; }
  .app-main { padding-top: 1rem; }
  .intro { margin-bottom: 1.5rem; }
  .eyebrow { font-size: .66rem; letter-spacing: .08em; }
  .lookup-panel, .result-card { padding: 1.15rem; border-radius: 1rem; }
  .actions { align-items: stretch; }
  .btn-solid, .btn-outline { padding: .65rem .75rem; font-size: .84rem; }
  .input-details { font-size: .68rem; }
  .how-it-works { grid-template-columns: 1fr; gap: 1rem; }
  .how-it-works > div { position: relative; padding-left: 2.7rem; }
  .step-number { position: absolute; left: 0; top: .15rem; }
  .how-it-works h2 { margin-top: .2rem; }
  .app-footer { padding-top: 1.6rem; }
  /* After the first search the answer matters more than the pitch. */
  .has-result .eyebrow, .has-result .lead { display: none; }
  .has-result .intro { margin-bottom: 1rem; }
  .has-result .intro h1 { font-size: 1.65rem; }
}
@media (max-width: 360px) { .actions { display: grid; grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .brand-mark, .btn-solid, .btn-outline, .example, .alternative, .refine { transition: transform 180ms var(--ease), background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
  .lookup-panel, .form-control { transition: border-color 180ms ease, box-shadow 180ms ease; }
  /* Page entry plays once: after a search the hero may be hidden and re-shown (phone rotation),
     which would otherwise restart these animations. */
  body:not(.has-result) :is(.eyebrow, h1, .lead) { animation: enter 500ms var(--ease) backwards; }
  h1 { animation-delay: 40ms; }
  .lead { animation-delay: 90ms; }
  body:not(.has-result) .headline-emphasis::after { animation: underline-in 700ms var(--ease) 200ms backwards; }
  .result-label, .word, .pronunciation, .definitions, .partial { animation: enter 380ms var(--ease) backwards; }
  .alternative-copy { animation: slide-content 380ms var(--ease) backwards; }
  .alternative:nth-of-type(2) .alternative-copy { animation-delay: 35ms; }
  .alternative:nth-of-type(3) .alternative-copy { animation-delay: 70ms; }
  .alternative:nth-of-type(4) .alternative-copy { animation-delay: 105ms; }
  .status.is-pending::before { animation: spin 800ms linear infinite; }
  .recording .stop-icon { animation: breathe 1600ms ease-in-out infinite; }
  .btn-solid:not(:disabled):active, .btn-outline:not(:disabled):active, .example:not(:disabled):active { transform: scale(.98); }
  @media (hover: hover) and (pointer: fine) {
    .brand:hover .brand-mark { transform: rotate(-4deg); }
    .btn-solid:not(:disabled):hover, .btn-outline:not(:disabled):not(.recording):hover, .example:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 4px 12px var(--glow); }
    .alternative:hover { border-color: var(--accent); background: var(--soft); transform: translateX(3px); }
  }
}
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slide-content { from { transform: translateX(6px); } to { transform: none; } }
@keyframes underline-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: .55; } }
