:root {
  --ink: #26352f;
  --muted: #69736d;
  --forest: #245746;
  --forest-dark: #183f33;
  --periwinkle: #6f78ba;
  --periwinkle-soft: #e8e9f8;
  --cream: #f7f3e9;
  --paper: #fffdf8;
  --coral: #df806d;
  --line: #dcddd5;
  --shadow: 0 24px 70px rgba(55, 71, 63, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; }

.site-shell {
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}
.site-shell::before,
.site-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 999px;
}
.site-shell::before {
  width: 420px;
  height: 420px;
  top: 90px;
  right: -240px;
  background: rgba(111, 120, 186, 0.12);
}
.site-shell::after {
  width: 280px;
  height: 280px;
  top: 570px;
  left: -180px;
  background: rgba(223, 128, 109, 0.1);
}

.topbar {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}
.book-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--forest);
  display: grid;
  place-items: center;
  box-shadow: 0 7px 16px rgba(36, 87, 70, 0.22);
}
.book-mark span {
  width: 16px;
  height: 18px;
  border: 2px solid white;
  border-radius: 2px 5px 5px 2px;
  position: relative;
}
.book-mark span::before {
  content: "";
  position: absolute;
  left: 4px;
  top: -2px;
  height: 18px;
  border-left: 2px solid rgba(255, 255, 255, 0.7);
}
.language-badge {
  padding: 8px 13px;
  border: 1px solid rgba(36, 87, 70, 0.18);
  border-radius: 999px;
  color: var(--forest);
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main { width: min(900px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 66px 0 34px; text-align: center; }
.eyebrow, .result-kicker, .section-label {
  margin: 0;
  color: var(--periwinkle);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 15px 0 14px;
  color: var(--forest-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}
.hero-copy {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.search-panel {
  max-width: 760px;
  margin: 38px auto 0;
  padding: 12px;
  text-align: left;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(36, 87, 70, 0.14);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.search-panel > label {
  display: block;
  padding: 8px 10px 10px;
  color: var(--forest-dark);
  font-size: 0.83rem;
  font-weight: 750;
}
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-row input {
  width: 100%;
  min-width: 0;
  height: 62px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 1.12rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-row input::placeholder { color: #969e99; }
.search-row input:focus {
  border-color: var(--periwinkle);
  box-shadow: 0 0 0 4px rgba(111, 120, 186, 0.16);
}
.search-row button {
  min-width: 126px;
  padding: 0 24px;
  border: 0;
  border-radius: 15px;
  background: var(--forest);
  color: white;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(36, 87, 70, 0.2);
  transition: transform 160ms ease, background 160ms ease;
}
.search-row button:hover:not(:disabled) { background: var(--forest-dark); transform: translateY(-1px); }
.search-row button:focus-visible,
.retry-button:focus-visible,
.sample-words button:focus-visible,
.synonyms-section button:focus-visible,
.brand:focus-visible {
  outline: 3px solid rgba(111, 120, 186, 0.45);
  outline-offset: 3px;
}
.search-row button:disabled { opacity: 0.78; }
.search-meta {
  min-height: 29px;
  padding: 9px 10px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.76rem;
}
.search-meta p { margin: 0; }
.validation-message { color: #a64f40; font-weight: 650; text-align: right; }

.results-region { min-height: 250px; padding: 20px 0 72px; }
.starter-card, .state-card, .result-card {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(36, 87, 70, 0.13);
  box-shadow: 0 18px 55px rgba(55, 71, 63, 0.08);
}
.starter-card {
  max-width: 580px;
  margin: 0 auto;
  padding: 26px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 22px;
  text-align: left;
}
.starter-note {
  flex: 0 0 auto;
  width: 70px;
  height: 86px;
  border-radius: 9px 16px 16px 9px;
  display: grid;
  place-items: center;
  background: var(--periwinkle-soft);
  border-left: 7px solid var(--periwinkle);
  color: var(--periwinkle);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  box-shadow: 0 9px 20px rgba(111, 120, 186, 0.14);
}
.starter-card h2 {
  margin: 6px 0 13px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 500;
}
.sample-words, .synonyms-section ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sample-words button, .synonyms-section button {
  padding: 8px 13px;
  border: 1px solid rgba(36, 87, 70, 0.16);
  border-radius: 999px;
  background: white;
  color: var(--forest);
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 150ms ease, border-color 150ms ease;
}
.sample-words button:hover, .synonyms-section button:hover {
  background: #edf4f0;
  border-color: rgba(36, 87, 70, 0.34);
}

.state-card {
  max-width: 650px;
  margin: 0 auto;
  padding: 27px 30px;
  border-radius: 20px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.state-symbol, .loading-dot {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--periwinkle-soft);
  color: var(--periwinkle);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 700;
}
.loading-dot {
  width: 18px;
  height: 18px;
  margin: 12px;
  background: var(--periwinkle);
  animation: breathe 1.1s ease-in-out infinite alternate;
}
@keyframes breathe { to { transform: scale(0.55); opacity: 0.45; } }
.state-card h2 {
  margin: 1px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 500;
}
.state-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.retry-button {
  margin-top: 16px;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--forest);
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
}

.result-card { border-radius: 28px; overflow: hidden; }
.result-heading {
  padding: 34px 40px 30px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.result-heading h2 {
  margin: 7px 0 0;
  color: var(--forest-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}
.meaning-count {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--periwinkle-soft);
  color: #545e9e;
  font-size: 0.78rem;
  font-weight: 750;
}
.meaning-list { padding: 6px 40px 8px; }
.meaning-group {
  padding: 26px 0;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}
.meaning-group:last-child { border-bottom: 0; }
.meaning-group h3, .synonyms-section h3 {
  margin: 1px 0 0;
  color: var(--forest);
  font-size: 0.88rem;
  font-style: italic;
  font-weight: 750;
}
.meaning-group ol { margin: 0; padding-left: 26px; }
.meaning-group li { padding: 0 0 24px 6px; }
.meaning-group li:last-child { padding-bottom: 0; }
.meaning-group li::marker { color: var(--coral); font-family: Georgia, serif; font-weight: 700; }
.definition {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.13rem;
  line-height: 1.62;
}
.example {
  margin: 13px 0 0;
  padding: 13px 16px;
  border-left: 3px solid var(--coral);
  border-radius: 0 9px 9px 0;
  background: #fbf3ed;
  color: #655d58;
  font-size: 0.91rem;
  line-height: 1.55;
}
.example span {
  display: block;
  margin-bottom: 4px;
  color: #a75c4e;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.synonyms-section {
  padding: 30px 40px 34px;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 25px;
  background: #f1f3eb;
}
.synonyms-section h3 { margin-top: 6px; font-style: normal; font-size: 1.05rem; }
.synonyms-section ul { align-content: flex-start; }
.no-alternates { margin: 0; color: var(--muted); font-size: 0.9rem; }

footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 23px 0 30px;
  display: flex;
  justify-content: center;
  gap: 9px;
  border-top: 1px solid rgba(36, 87, 70, 0.12);
  color: var(--muted);
  font-size: 0.74rem;
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 680px) {
  .topbar, footer { width: min(100% - 28px, 1120px); }
  .topbar { padding: 18px 0; }
  main { width: min(100% - 28px, 900px); }
  .hero { padding: 43px 0 24px; }
  .hero h1 { font-size: clamp(2.8rem, 15vw, 4.5rem); }
  .search-panel { margin-top: 28px; border-radius: 20px; }
  .search-row { grid-template-columns: 1fr; }
  .search-row input, .search-row button { height: 56px; }
  .search-meta { display: block; }
  .validation-message { margin-top: 4px !important; text-align: left; }
  .starter-card { padding: 22px; }
  .starter-note { width: 56px; height: 70px; }
  .result-heading { padding: 29px 24px 24px; align-items: flex-start; flex-direction: column; gap: 14px; }
  .meaning-list { padding: 0 24px; }
  .meaning-group, .synonyms-section { grid-template-columns: 1fr; gap: 15px; }
  .synonyms-section { padding: 25px 24px 28px; }
  .state-card { padding: 23px; }
  footer { flex-wrap: wrap; }
}

@media (max-width: 430px) {
  .brand { font-size: 0.9rem; }
  .book-mark { width: 32px; height: 32px; }
  .starter-card { align-items: flex-start; }
  .starter-note { display: none; }
}

.noscript-message {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto 40px;
  padding: 16px 20px;
  border: 1px solid rgba(166, 79, 64, 0.24);
  border-radius: 12px;
  background: #fbf3ed;
  color: #7d4035;
  text-align: center;
}
