/* ==========================================================================
   Dicționar Român-Englez / Englez-Român — mobile first, temă light + dark
   ========================================================================== */

:root {
  --fundal: #f6f3ec;
  --fundal-hartie: #fffdf8;
  --card: #ffffff;
  --linie: #e6e0d2;
  --linie-tare: #d5cdbb;
  --text: #1c2230;
  --text-slab: #6b6f78;
  --accent: #1f3c88;          /* albastru tricolor, ușor estompat */
  --accent-2: #c8102e;        /* roșu */
  --accent-galben: #f2c230;
  --umbra: 0 1px 2px rgba(28, 34, 48, .05), 0 8px 28px -12px rgba(28, 34, 48, .18);
  --camp: #fffef6;
  --camp-focus: #fffbd6;

  /* traducerea — valorile site-ului vechi */
  --tr-text: #000;
  --tr-link: #000;
  --tr-link-linie: #ddd;
  --tr-hover: #169916;
  --tr-forma-fundal: #f4f5eb;
  --tr-forma-text: #2c4d86;
  --tr-forma-linie: #dae8ff;
  --tr-expr-header: #2c4d86;
  --tr-expr: #666;
  --tr-red: #954b02;
  --tr-cuvant: #232f47;
  --tr-rosu-fundal: #fff1f0;
  --tr-rosu-linie: #f3c3bf;
  --tr-eroare: #a90000;
  --tr-succes: #357100;

  --raza: 14px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-titlu: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --fundal: #10141c;
  --fundal-hartie: #141925;
  --card: #171d2a;
  --linie: #263043;
  --linie-tare: #33405a;
  --text: #e3e7ef;
  --text-slab: #98a1b3;
  --accent: #8fb0ff;
  --accent-2: #ff6b7d;
  --accent-galben: #f2c230;
  --umbra: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  --camp: #0f1420;
  --camp-focus: #121a2b;

  --tr-text: #e6e8ee;
  --tr-link: #f1f3f7;
  --tr-link-linie: #4a5368;
  --tr-hover: #5fd35f;
  --tr-forma-fundal: #222a3a;
  --tr-forma-text: #9dbbf2;
  --tr-forma-linie: #34415c;
  --tr-expr-header: #9dbbf2;
  --tr-expr: #a7adba;
  --tr-red: #e5a463;
  --tr-cuvant: #e7ecf7;
  --tr-rosu-fundal: #2a1a1e;
  --tr-rosu-linie: #5a2b32;
  --tr-eroare: #ff8a80;
  --tr-succes: #9be37a;
  color-scheme: dark;
}

/* fără JavaScript: urmează tema sistemului */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --fundal: #10141c; --fundal-hartie: #141925; --card: #171d2a; --linie: #263043; --linie-tare: #33405a;
    --text: #e3e7ef; --text-slab: #98a1b3; --accent: #8fb0ff; --accent-2: #ff6b7d;
    --umbra: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6); --camp: #0f1420; --camp-focus: #121a2b;
    --tr-text: #e6e8ee; --tr-link: #f1f3f7; --tr-link-linie: #4a5368; --tr-hover: #5fd35f;
    --tr-forma-fundal: #222a3a; --tr-forma-text: #9dbbf2; --tr-forma-linie: #34415c; --tr-expr-header: #9dbbf2;
    --tr-expr: #a7adba; --tr-red: #e5a463; --tr-cuvant: #e7ecf7; --tr-rosu-fundal: #2a1a1e; --tr-rosu-linie: #5a2b32;
    --tr-eroare: #ff8a80; --tr-succes: #9be37a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--fundal);
  background-image: radial-gradient(1200px 400px at 50% -200px, var(--fundal-hartie), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font: 16px/1.5 var(--font-ui);
  transition: background-color .25s, color .25s;
}

a { color: var(--accent); }
img, svg { display: block; }

/* ---------- Antet ---------- */
.antet {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 16px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sigla {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.sigla img { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 3px 6px rgba(31, 60, 136, .25)); }
.sigla-text { display: flex; flex-direction: column; line-height: 1.1; }
.sigla-mic {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-slab);
  font-weight: 600;
}
.sigla-mare {
  font-family: var(--font-titlu);
  font-size: 21px;
  font-weight: 700;
  white-space: nowrap;
}

.unelte { display: flex; align-items: center; gap: 8px; }

.comutator {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--linie);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.comutator a {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--text-slab);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .03em;
  transition: background-color .15s, color .15s;
}
.comutator a:hover { color: var(--text); }
.comutator a[aria-current] { background: var(--accent); color: var(--card); }
.comutator .sageata { font-weight: 400; opacity: .8; }

.comutator.limbi a { padding: 3px; }
.comutator.limbi img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  opacity: .72;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
  transition: opacity .15s, transform .15s;
}
.comutator.limbi a:hover img { opacity: 1; transform: scale(1.08); }
.comutator.limbi a[aria-current] { background: transparent; box-shadow: 0 0 0 2px var(--accent); }
.comutator.limbi a[aria-current] img { opacity: 1; }

.buton-tema {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--linie);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: transform .2s;
}
.buton-tema:hover { transform: rotate(-15deg); }
.buton-tema svg {
  grid-area: 1 / 1;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity .2s, transform .3s;
}
.buton-tema .ic-luna { fill: currentColor; stroke: none; }
:root[data-theme="dark"] .buton-tema .ic-luna,
:root:not([data-theme="dark"]) .buton-tema .ic-soare { opacity: 0; transform: scale(.5) rotate(-60deg); }

/* ---------- Pagina ---------- */
.pagina {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  flex: 1;
}

/* ---------- Căutare ---------- */
.cautare {
  margin: 8px 0 20px;
  padding: 18px 16px 14px;
  background: var(--card);
  border: 1px solid var(--linie);
  border-radius: var(--raza);
  box-shadow: var(--umbra);
  position: relative;
  overflow: hidden;
}
.cautare::before { /* tricolor discret */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #1f3c88 0 33.3%, var(--accent-galben) 33.3% 66.6%, #c8102e 66.6%);
}
.eticheta {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-titlu);
  font-size: 19px;
}
.eticheta b { color: var(--accent); }
.camp { display: flex; gap: 8px; }
.camp input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 14px;
  border: 2px solid var(--linie-tare);
  border-radius: 10px;
  background: var(--camp);
  color: var(--text);
  font: 700 18px/1 "Trebuchet MS", var(--font-ui);
  outline: none;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.camp input::placeholder { color: var(--text-slab); font-weight: 400; opacity: .7; }
.camp input:focus {
  border-color: var(--accent);
  background: var(--camp-focus);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.camp button {
  flex: none;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--card);
  font: 700 16px/1 var(--font-ui);
  cursor: pointer;
  transition: filter .15s, transform .05s;
}
.camp button:hover { filter: brightness(1.1); }
.camp button:active { transform: translateY(1px); }
.indiciu { margin: 10px 2px 0; font-size: 13px; color: var(--text-slab); }

.mesaj { padding: 4px 4px 16px; color: var(--text-slab); }

/* ---------- Rezultate: tab-uri ---------- */
.rezultate { margin-top: 4px; }
.taburi {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}
.taburi::-webkit-scrollbar { display: none; }
.taburi a {
  flex: none;
  padding: 9px 16px 8px;
  border: 1px solid var(--linie);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: color-mix(in srgb, var(--card) 55%, var(--fundal));
  color: var(--text-slab);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.taburi a:hover { color: var(--text); }
.taburi a.sel {
  background: var(--card);
  color: var(--accent);
  border-color: var(--linie);
  box-shadow: inset 0 3px 0 var(--accent);
}

#content {
  background: var(--card);
  border: 1px solid var(--linie);
  border-radius: var(--raza);
  box-shadow: var(--umbra);
  padding: 16px 8px 18px;
  overflow-wrap: anywhere;
}
.taburi + #content { border-top-left-radius: 0; }

.similare, .apropiate, .mesaj-cautare p { margin: 0 8px 10px; font-size: 15px; }
.similare a, .apropiate a { font-weight: 600; }
.mesaj-cautare { padding: 4px 0 6px; }
.b { font-weight: bold; }
.error { color: var(--tr-eroare); font-weight: 600; }
.succes { color: var(--tr-succes); font-size: 1.05em; }
.div_rosu {
  margin: 0 8px 14px;
  padding: 10px 12px;
  border: 1px solid var(--tr-rosu-linie);
  background: var(--tr-rosu-fundal);
  border-radius: 8px;
  font-size: 15px;
}
.div_rosu b { color: var(--text); }

/* ---------- Traducerea (stilurile site-ului vechi) ---------- */
.d_cuvant {
  display: inline;
  padding: 0;
  margin: 0;
  font-size: 28px;
  font-family: 'Times New Roman', 'Trebuchet MS', serif;
  font-weight: normal;
  color: var(--tr-cuvant);
  border: 0 none;
}
#traducere {
  padding: 5px 10px 0 10px;
  font-size: 17px;
  font-family: 'Times New Roman', Times, serif;
  color: var(--tr-text);
}
#traducere a {
  color: var(--tr-link);
  font-size: 15px;
  text-decoration: none;
  border-bottom: double 3px var(--tr-link-linie);
}
#traducere a:hover {
  text-decoration: none;
  color: var(--tr-hover);
  border-bottom: double 3px var(--tr-hover);
}
#traducere .forma {
  background: var(--tr-forma-fundal);
  font-family: Arial, sans-serif;
  color: var(--tr-forma-text);
  font-size: 15px;
  font-weight: bold;
  padding: 2px;
  display: block;
  border: solid 1px var(--tr-forma-linie);
}
#traducere .sensuri { padding-left: 10px; }
#traducere .expresii { padding-left: 10px; }
#traducere .expr_header {
  display: inline-block;
  margin-top: 5px;
  font-family: 'Trebuchet MS', sans-serif;
  color: var(--tr-expr-header);
  font-size: 13px;
  font-weight: bold;
}
#traducere .expr { color: var(--tr-expr); }
#traducere .expr a { color: var(--tr-expr); }
#traducere .expr a:hover { color: var(--tr-hover); }
#traducere .red { font-style: italic; color: var(--tr-red); }
#traducere h2 { display: inline; font: inherit; margin: 0; padding: 0; }

/* ---------- Reclame ---------- */
.reclama {
  display: flex;
  justify-content: center;
  overflow: hidden;
  margin: 18px auto;
  max-width: 100%;
}
.reclama-sus { min-height: 50px; margin-top: 0; }
#traducere .reclama { margin: 6px auto 18px; }

/* ---------- Subsol ---------- */
.subsol {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text-slab);
  border-top: 1px solid var(--linie);
}
.subsol a { color: var(--text-slab); }
.subsol a:hover { color: var(--accent); }

/* ---------- Ecrane mici ---------- */
@media (max-width: 479px) {
  .antet { padding-top: 10px; }
  .sigla-mare { font-size: 18px; }
  .unelte { width: 100%; justify-content: space-between; }
  .camp button { padding: 0 14px; font-size: 15px; }
  .eticheta { font-size: 17px; }
}

/* ---------- Ecrane mari ---------- */
@media (min-width: 720px) {
  .antet { padding: 22px 24px 10px; }
  .pagina { padding: 8px 24px 40px; }
  .sigla img { width: 46px; height: 46px; }
  .sigla-mare { font-size: 25px; }
  .cautare { padding: 24px 24px 18px; margin-bottom: 24px; }
  .eticheta { font-size: 21px; }
  .camp input { height: 54px; font-size: 19px; }
  .camp button { height: 54px; padding: 0 26px; }
  #content { padding: 20px 14px 22px; }
  .taburi { padding: 0 14px; }
  .subsol { padding: 18px 24px 28px; }
}
@media (min-width: 800px) {
  .reclama-sus { min-height: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
