:root {
  --bg: #0f1020;
  --bg-2: #15172d;
  --card: #1a1c36;
  --card-2: #22254a;
  --line: #2e3260;
  --text: #ecebf5;
  --muted: #a5a7c8;
  --gold: #e8c46a;
  --gold-2: #f4dc9c;
  --on-gold: #1a1503;
  --pos: #5fd39a;
  --neg: #ff7f7f;
  --unc: #b9a7ff;
  --focus: #9fb4ff;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --radius: 14px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f3ea;
    --bg-2: #efe9da;
    --card: #fffdf7;
    --card-2: #f4eedf;
    --line: #ddd3bb;
    --text: #1d1b2e;
    --muted: #5e5a72;
    --gold: #9a6f12;
    --gold-2: #7a560a;
    --on-gold: #fffaf0;
    --pos: #1c8a55;
    --neg: #c03a3a;
    --unc: #6a52c9;
    --focus: #3550c8;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--sans);
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -200px, var(--bg-2), var(--bg)) fixed, var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 16px 48px; flex: 1; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 .5em; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Antet */
.site-header { text-align: center; padding: 36px 16px 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark { width: 48px; height: 48px; }
.brand-name { font-family: var(--serif); font-size: 2.2rem; letter-spacing: .04em; }
.tagline { margin: 6px 0 0; color: var(--muted); }

/* Carduri și formular */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
fieldset { border: 0; padding: 0; margin: 0 0 24px; min-width: 0; }
legend { font-family: var(--serif); font-size: 1.2rem; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--on-gold); font: 600 .85rem var(--sans); }
.optional { color: var(--muted); font: .85rem var(--sans); }
.hint { color: var(--muted); font-size: .88rem; margin: 8px 0 0; }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.chip { position: relative; }
.chip input, .seg input { position: absolute; opacity: 0; pointer-events: none; }
.chip label {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); cursor: pointer;
  font-size: .92rem; line-height: 1.25; transition: border-color .15s, background .15s;
}
.chip label:hover { border-color: var(--gold); }
.chip input:checked + label { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, var(--card)); }
.chip input:focus-visible + label, .seg input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }
.chip .ico { font-size: 1.2rem; }

textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--card-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 84px; }
textarea:focus, select:focus { border-color: var(--gold); outline: none; }
.question-meta { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-top: 8px; }
.count { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; }
.example {
  font: .82rem var(--sans); color: var(--muted); background: transparent; border: 1px dashed var(--line);
  border-radius: 999px; padding: 4px 10px; cursor: pointer; text-align: left;
}
.example:hover { color: var(--text); border-color: var(--gold); }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { position: relative; flex: 1 1 auto; }
.seg label {
  display: block; text-align: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-2); cursor: pointer; white-space: nowrap; font-size: .92rem;
}
.seg input:checked + label { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 600; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.field span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }

.btn-primary, .btn-ghost {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  font: 600 1rem var(--sans); border-radius: 12px; padding: 14px 22px; cursor: pointer; text-decoration: none;
}
.btn-primary { width: 100%; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--on-gold); border: 0; font-size: 1.08rem; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--gold); }
.error { color: var(--neg); margin: 0 0 12px; }

/* Recente */
.recent { margin-top: 36px; }
.recent h2 { font-size: 1.3rem; }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent-list a {
  display: flex; gap: 12px; align-items: baseline; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--text); text-decoration: none;
}
.recent-list a:hover { border-color: var(--gold); }
.recent-list .r-title { flex: 1; min-width: 0; }
.recent-list .r-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* Progres */
.progress-card { text-align: center; }
.orb { width: 96px; height: 96px; margin: 8px auto 20px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 40%, transparent 72%);
  box-shadow: 0 0 40px color-mix(in srgb, var(--gold) 45%, transparent); animation: pulse 2.4s ease-in-out infinite; }
.orb span { position: absolute; inset: -10px; border: 2px dashed color-mix(in srgb, var(--gold) 60%, transparent); border-radius: 50%; animation: spin 14s linear infinite; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 70px color-mix(in srgb, var(--gold) 60%, transparent); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orb, .orb span { animation: none; } }
.elapsed { font-variant-numeric: tabular-nums; color: var(--muted); margin: 0 0 16px; }
.log { list-style: none; text-align: left; margin: 0 auto; padding: 0; max-width: 620px; display: grid; gap: 6px; }
.log li { display: flex; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--card-2); font-size: .9rem; animation: fadein .3s ease; overflow-wrap: anywhere; }
.log li .k { flex: none; }
.log li.thought { font-style: italic; color: var(--muted); }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }

/* Rezultat */
.result { display: grid; gap: 16px; }
.result .card h3 { font-size: 1.15rem; margin-bottom: 12px; }
.r-head { text-align: center; padding: 28px 24px; }
.r-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 12px; }
.tag { font-size: .78rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.r-head h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.r-summary { font-size: 1.08rem; margin: 0 auto; max-width: 680px; }
.quatrain { font-family: var(--serif); font-style: italic; font-size: 1.15rem; line-height: 1.7; color: var(--gold-2); white-space: pre-line; margin: 20px auto 0; padding-top: 18px; border-top: 1px solid var(--line); max-width: 520px; }
.conf { display: inline-flex; gap: 6px; align-items: center; margin-top: 14px; font-size: .88rem; color: var(--muted); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--gold); }

.scenarios { display: grid; gap: 12px; }
.scenario { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--card-2); }
.scenario-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.scenario-head strong { font-family: var(--serif); font-size: 1.05rem; }
.pct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--line); margin: 8px 0 10px; overflow: hidden; }
.bar b { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.scenario p { margin: 0 0 6px; }
.signals { margin: 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }

.preds { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pred { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.ring { --p: 50; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--line) 0); }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }
.pred-claim { font-weight: 600; margin: 0 0 4px; }
.pred-meta { font-size: .82rem; color: var(--muted); margin: 0 0 6px; }
.pred-why { margin: 0; font-size: .92rem; }

.drivers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.drivers li { padding-left: 14px; border-left: 3px solid var(--unc); }
.drivers li.positive { border-color: var(--pos); }
.drivers li.negative { border-color: var(--neg); }
.drivers .imp { font-size: .78rem; color: var(--muted); margin-left: 6px; }
.drivers p { margin: 2px 0 0; font-size: .92rem; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.plain .when { color: var(--muted); font-size: .85rem; }
.text-block { margin: 0; white-space: pre-line; }

.sources { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: .9rem; overflow-wrap: anywhere; }
.sources .host { color: var(--muted); font-size: .8rem; margin-left: 6px; }
.r-foot { font-size: .82rem; color: var(--muted); text-align: center; }
.declined { text-align: center; }

.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .9rem; }

.site-footer { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: .8rem; text-align: center; }

@media (max-width: 640px) {
  .card { padding: 18px; }
  .row, .two { grid-template-columns: 1fr; }
  .chips { grid-template-columns: 1fr 1fr; }
  .brand-name { font-size: 1.8rem; }
  .pred { grid-template-columns: 52px 1fr; gap: 10px; }
  .ring { width: 52px; height: 52px; }
  .ring span { width: 40px; height: 40px; font-size: .82rem; }
  .question-meta { flex-direction: column; }
}
