:root {
  --paper: #eef1f4;
  --paper-deep: #dde3ea;
  --ink: #1a2330;
  --ink-soft: #4c5a70;
  --line: #c3ccd8;
  --card: #fbfcfe;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --stamp: #8a1f1f;
  --chip: #1a2330;
  --chip-ink: #f4f6f9;
  --focus: #8a1f1f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --paper: #141a24;
  --paper-deep: #1d2534;
  --ink: #e8edf4;
  --ink-soft: #a9b4c6;
  --line: #354052;
  --card: #1b2331;
  --accent: #7aa5ff;
  --accent-ink: #141a24;
  --stamp: #ff9c8a;
  --chip: #e8edf4;
  --chip-ink: #141a24;
  --focus: #ffb4a6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 50;
}
.skip-link:focus { top: 0.5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 3rem;
  padding: 0 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.topbar .home { font-family: var(--serif); font-weight: 700; color: var(--ink); text-decoration: none; }
.topnav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--ink-soft); text-decoration: none; padding: 0.4rem 0.6rem; }
.topnav a[aria-current="true"] { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.spacer { flex: 1 1 auto; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
main { max-width: 56rem; margin: 0 auto; padding: 0 1.25rem 3rem; }
section { scroll-margin-top: 4rem; }
.hero { padding: 2.5rem 0 0.5rem; max-width: 44rem; }
.dateline { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.95rem; }
h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5.4vw, 3.2rem);
  line-height: 1.12;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}
.deck { font-size: 1.2rem; line-height: 1.55; margin: 0; max-width: 40rem; }
h2 { font-family: var(--serif); font-size: 1.65rem; line-height: 1.25; margin: 3rem 0 1rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
.plink { color: var(--ink-soft); text-decoration: none; font-size: 1.1rem; padding: 0.5rem; }
.share { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 1.75rem; padding: 1rem 0; }
.share h2 { font-family: var(--sans); font-size: 1rem; margin: 0 0 0.25rem; }
.share-summary, .share-checked { margin: 0 0 0.25rem; font-size: 0.95rem; color: var(--ink-soft); }
.share-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.6rem; }
.share-btn, .share-open {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}
.share-open { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.share-status { min-height: 1.4em; margin: 0.4rem 0 0; font-size: 0.95rem; }
#forma { margin-top: 1rem; max-width: 36rem; }
#forma label { display: block; font-weight: 700; margin-bottom: 0.4rem; }
.input-row { display: flex; gap: 0.6rem; }
#intrare {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.6rem 0.9rem;
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 0.4rem;
}
.input-row button {
  min-height: 3.25rem;
  padding: 0.6rem 1.4rem;
  font: inherit;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 0.4rem;
  cursor: pointer;
}
.hint { font-size: 0.92rem; color: var(--ink-soft); margin: 0.5rem 0 0; }
.hint code, .result-link code { font-family: var(--mono); font-size: 0.9em; }
.exemple { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.9rem 0 0; }
.exemple span { color: var(--ink-soft); font-size: 0.95rem; }
.exemple button {
  font-family: var(--mono);
  font-weight: 700;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  color: var(--chip-ink);
  background: var(--chip);
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
}
.result {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  padding: 1.5rem;
}
.result-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.result-code {
  font-family: var(--mono);
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 700;
  margin: 0;
  color: var(--stamp);
}
.result-chip {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
}
.result-gloss { font-size: 1.3rem; line-height: 1.4; margin: 0.75rem 0 0; font-weight: 700; }
.result-official { margin: 0.75rem 0 0; }
.official-label { color: var(--ink-soft); }
.result-note { margin: 0.75rem 0 0; padding: 0.6rem 0.9rem; background: var(--paper); border-radius: 0.35rem; }
.result-subs { margin: 0.75rem 0 0; }
.subs-label { margin: 0 0 0.4rem; color: var(--ink-soft); font-size: 0.95rem; }
.subs-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; }
.subs-chips a {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--chip-ink);
  background: var(--chip);
  border-radius: 0.3rem;
  padding: 0.45rem 0.75rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.result-link { margin: 1rem 0 0; font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.result-link code { word-break: break-all; }
.mini-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 0.35rem;
  padding: 0.45rem 0.9rem;
  min-height: 2.75rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.mini-status { min-height: 1.4em; margin: 0.25rem 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.card-schema svg { display: block; width: 100%; max-width: 30rem; height: auto; }
.card-schema { margin: 1rem 0 0; }
.card-bg { fill: var(--card); stroke: var(--line); stroke-width: 2; }
.card-grid rect { fill: none; stroke: var(--line); stroke-width: 1.5; }
.card-grid .cell-12 { fill: var(--paper-deep); stroke: var(--stamp); }
.schema-num { font: 700 13px var(--sans); fill: var(--stamp); }
.schema-code { font: 700 20px var(--mono); fill: var(--ink); }
.schema-cap { font: 13px var(--sans); fill: var(--ink-soft); }
.card-schema figcaption { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.4rem; }
.codes { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.codes caption { text-align: left; padding-bottom: 0.6rem; color: var(--ink-soft); }
.codes th, .codes td { text-align: left; padding: 0.5rem 0.7rem; border-top: 1px solid var(--line); vertical-align: top; }
.codes tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.codes tbody tr:target td { background: var(--paper-deep); }
.codes td.code, .codes th.code { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.codes td.code a { color: inherit; }
.codes tr[id] { scroll-margin-top: 4rem; }
.table-scroll { overflow-x: auto; }
.table-scroll .codes { min-width: 40rem; }
details { border-top: 1px solid var(--line); padding: 0.8rem 0; max-width: 44rem; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 700; font-size: 1.08rem; }
details p { margin: 0.5rem 0 0.25rem; }
.sources { padding-left: 1.25rem; max-width: 46rem; }
.sources li { margin-bottom: 0.6rem; }
.sources a, main a:not(.share-btn):not(.plink):not(.subs-chips a) { color: inherit; }
footer { border-top: 1px solid var(--line); margin-top: 2rem; padding: 1.5rem 1.25rem 2.5rem; text-align: center; color: var(--ink-soft); }
footer a { color: inherit; }
.totop { font-weight: 700; }
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .result { padding: 1.1rem; }
  .result-code { font-size: 2.1rem; }
  .result-gloss { font-size: 1.15rem; }
  .input-row { flex-direction: column; }
  .input-row button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
