:root {
  --bg: #f6efe6;
  --bg2: #efe3d3;
  --card: #fffaf4;
  --ink: #3b2a22;
  --muted: #8b7565;
  --line: #eadccb;
  --terra: #c4683f;
  --terra-d: #a5522c;
  --terra-soft: #f6dfd0;
  --sage: #7d9877;
  --sage-d: #5d7a58;
  --sage-soft: #e2ebdc;
  --butter: #f5e6bb;
  --flag: #c2412d;
  --flag-soft: #fbe1da;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(59, 42, 34, .04), 0 10px 30px -16px rgba(59, 42, 34, .25);
  --serif: 'Fraunces', 'Frank Ruhl Libre', Georgia, serif;
  --sans: 'Nunito', 'Rubik', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 100% -10%, #f3dccb 0%, transparent 60%),
    radial-gradient(700px 500px at -10% 30%, #e4ead9 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
h1 em { font-style: italic; color: var(--terra); }
p { margin: 0 0 .8em; }
a { color: var(--terra-d); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; color: var(--sage-d); margin-bottom: .6em; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1000px; margin: 0 auto; padding: 18px 20px;
}
.logo { font-family: var(--serif); font-weight: 700; font-size: 1.4rem; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.logo span { font-size: 1.6rem; }
.host-nav { display: flex; align-items: center; gap: 18px; }
.host-nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 700; opacity: .75; }
.host-nav a:not(.btn):hover { opacity: 1; }
.lang-toggle { font: 800 .85rem var(--sans); color: var(--ink); background: rgba(255,255,255,.6); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.lang-toggle:hover { background: #fff; }
[dir=rtl] { --serif: 'Frank Ruhl Libre', 'Fraunces', Georgia, serif; --sans: 'Rubik', 'Nunito', system-ui, sans-serif; }
[dir=rtl] .eyebrow { letter-spacing: .02em; }
body[data-mode="candidate"] .host-nav { display: none; }

main { max-width: 1000px; margin: 0 auto; padding: 8px 20px 120px; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 20px 40px; }
body[data-mode="candidate"] .foot { display: none; }

section { margin-bottom: 28px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.two-col { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; margin-bottom: 28px; }
.two-col > section { margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.tight { gap: 6px; }
.row.center { justify-content: center; }
.center { text-align: center; }
.page-head { margin: 10px 0 26px; }
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 700; color: var(--muted); }
.back:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 1rem var(--sans); color: var(--ink); text-decoration: none;
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 12px 22px; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(59, 42, 34, .35); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.primary:hover { background: var(--terra-d); }
.btn.sage { background: var(--sage); border-color: var(--sage); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 16px; font-size: .9rem; }
.btn.big { padding: 16px 30px; font-size: 1.1rem; width: 100%; }
.link { background: none; border: 0; font: 700 .95rem var(--sans); color: var(--muted); cursor: pointer; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }
.link.danger { color: var(--flag); }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 14px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px;
  font: 400 1rem var(--sans); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--terra); box-shadow: 0 0 0 4px var(--terra-soft); }
textarea { resize: vertical; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; align-items: center; padding: 30px 0 20px; }
.lead { font-size: 1.15rem; color: #5e4a3f; max-width: 34em; margin-bottom: 1.4em; }
.hero-art { position: relative; height: 300px; }
.paper {
  position: absolute; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 18px 20px; width: 240px;
}
.paper.p1 { top: 10px; left: 10px; transform: rotate(-5deg); }
.paper.p2 { top: 165px; right: 0; transform: rotate(4deg); }
.paper .mini-q { font-family: var(--serif); font-weight: 600; margin-bottom: 10px; }
.paper .mini-a { font-size: .85rem; padding: 6px 10px; border-radius: 10px; background: var(--bg); margin-bottom: 6px; }
.paper .mini-a.ok { background: var(--sage-soft); }
.paper .mini-a.bad { background: var(--flag-soft); }
.paper .big { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; color: var(--sage-d); line-height: 1; }
.plant { position: absolute; bottom: 0; left: 46%; font-size: 3.4rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step { padding: 22px; }
.step .num { font-size: 2rem; margin-bottom: 8px; }
.empty { text-align: center; padding: 40px 26px; }
.empty .big-emoji { font-size: 3rem; }

.test-card .tc-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.tc-emoji { font-size: 2rem; background: var(--terra-soft); border-radius: 16px; width: 54px; height: 54px; display: grid; place-items: center; flex-shrink: 0; }
.test-card h3 { margin-bottom: 2px; }
.test-card p { margin: 0; }
.test-card .link { margin-top: 8px; font-size: .8rem; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed #d7c3ac; border-radius: 18px; padding: 26px; text-align: center;
  color: var(--muted); cursor: pointer; background: rgba(255, 255, 255, .5); font-weight: 600; margin: 0;
  transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone.over { background: var(--terra-soft); border-color: var(--terra); color: var(--ink); }
.dz-icon { font-size: 2rem; }

/* ---------- builder ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 14px 18px; border-radius: 16px; background: var(--butter); font-weight: 700; font-size: .9rem; margin-bottom: 30px; }
.cat-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cat-head h2 { margin: 0; }
.cat-head p { margin: 0; }
.qlist { display: grid; gap: 10px; }
.qcard { background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; transition: border-color .15s, box-shadow .15s; }
.qcard.on { border-color: #e2b89f; box-shadow: var(--shadow); }
.qhead {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: start;
  background: none; border: 0; padding: 16px 18px; cursor: pointer; font: inherit; color: inherit;
}
.check {
  width: 26px; height: 26px; border-radius: 9px; border: 2px solid #d7c3ac; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem;
}
.qcard.on .check { background: var(--terra); border-color: var(--terra); }
.qtitle { flex: 1; font-weight: 700; }
.qcard:not(.on) .qtitle { color: var(--muted); }
.tag { font-size: .75rem; font-weight: 800; color: var(--muted); background: var(--bg); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.qbody { padding: 0 18px 18px; padding-inline-start: 58px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.gchip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: 600 .9rem var(--sans); color: var(--ink); padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid transparent; transition: transform .1s;
}
.gchip:active { transform: scale(.96); }
.g-ideal { background: var(--sage-soft); border-color: #c4d6bb; }
.g-ok { background: #f4ecdf; border-color: #e8dac6; }
.g-no { background: #f7e6cf; border-color: #ecd0a8; }
.g-flag { background: var(--flag-soft); border-color: #f0b4a6; color: var(--flag); }
.weight { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.weight .muted { font-size: .85rem; font-weight: 700; margin-inline-end: 6px; }
.seg { font: 700 .82rem var(--sans); padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.seg.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.note { font-size: .88rem; background: var(--butter); padding: 10px 14px; border-radius: 12px; }

.savebar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 18px; justify-content: space-between;
  width: min(640px, calc(100% - 32px)); padding: 10px; padding-inline-start: 24px;
  background: var(--ink); color: #fff; border-radius: 999px; box-shadow: 0 16px 40px -12px rgba(59, 42, 34, .55);
}
.savebar .btn { white-space: nowrap; }

/* ---------- share ---------- */
.share-card { max-width: 680px; margin: 20px auto; text-align: center; }
.share-card .big-emoji { font-size: 3.4rem; }
.linkbox { display: flex; gap: 8px; margin: 18px 0; }
.linkbox input { margin: 0; font-size: .85rem; color: var(--muted); }
.hint { background: var(--butter); border-radius: 14px; padding: 12px 16px; font-size: .9rem; text-align: start; margin-top: 18px; }
.key-card { max-width: 680px; margin: 0 auto 28px; background: #fdf6e3; }
.key-card .linkbox { margin: 12px 0; }
.lang-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.cta { text-align: center; background: linear-gradient(135deg, var(--terra-soft), var(--sage-soft)); }
.cta .big-emoji { font-size: 2.6rem; }
.loading { display: grid; place-items: center; min-height: 50vh; font-size: 2.4rem; }
.loading span, .spin { display: inline-block; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }

/* ---------- take ---------- */
.take-wrap { max-width: 620px; margin: 0 auto; }
.welcome { text-align: center; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0; }
.facts span { background: var(--bg); padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.about { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: #5e4a3f; }
.progress { position: relative; height: 10px; background: var(--bg2); border-radius: 99px; margin: 26px 6px 28px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--sage), var(--terra)); border-radius: 99px; transition: width .35s ease; }
.progress .house { position: absolute; top: 50%; transform: translate(-50%, -55%); font-size: 1.5rem; transition: inset-inline-start .35s ease; }
[dir=rtl] .progress .house { transform: translate(50%, -55%); }
[dir=rtl] .progress > div { background: linear-gradient(270deg, var(--sage), var(--terra)); }
.qscreen { animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.qmeta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.chip { background: var(--terra-soft); color: var(--terra-d); font-weight: 800; font-size: .8rem; padding: 5px 12px; border-radius: 999px; }
.qtext { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 22px; }
.opt {
  display: block; width: 100%; text-align: start; margin-bottom: 10px; cursor: pointer;
  font: 600 1.05rem var(--sans); color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: 16px; padding: 16px 18px; transition: all .15s;
}
.opt:hover { border-color: #dcb79f; background: #fffdf9; transform: translateX(3px); }
[dir=rtl] .opt:hover { transform: translateX(-3px); }
.opt.picked { border-color: var(--terra); background: var(--terra-soft); }
.qnav { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb .x { position: absolute; top: 6px; inset-inline-end: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(59, 42, 34, .75); color: #fff; cursor: pointer; font-size: 1rem; line-height: 1; }
.docicon { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 8px; font-size: 2rem; text-align: center; }
.docicon small { font-size: .7rem; color: var(--muted); word-break: break-all; margin-top: 4px; }
.finish { text-align: center; }
.finish .big-emoji { font-size: 3.6rem; margin-bottom: 6px; }
.mini { text-align: start; background: var(--bg); border-radius: 16px; padding: 16px 18px; margin: 12px 0; }

.mini .row { margin-top: 10px; }
.host-peek { margin-top: 22px; padding: 12px 16px; border-radius: 14px; background: var(--sage-soft); font-weight: 700; }

/* ---------- report ---------- */
.report-top { display: flex; gap: 30px; align-items: center; }
.ring {
  --p: 0; --c: var(--sage);
  width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg2) 0);
  display: grid; place-items: center; text-align: center;
}
.ring::before { content: ''; position: absolute; inset: 14px; border-radius: 50%; background: var(--card); }
.ring > * { position: relative; }
.ring span { font-family: var(--serif); font-weight: 700; font-size: 2.4rem; line-height: 1; display: block; }
.ring small { display: block; color: var(--muted); font-weight: 700; font-size: .8rem; }
.ring.mid { --c: #d9a54a; }
.ring.bad { --c: var(--terra); }
.ring.sm { width: 74px; height: 74px; }
.ring.sm::before { inset: 8px; }
.ring.sm span { font-size: 1.2rem; }
.verdict { display: inline-flex; gap: 8px; align-items: center; padding: 8px 16px; border-radius: 999px; font-weight: 800; }
.verdict.good { background: var(--sage-soft); color: var(--sage-d); }
.verdict.mid { background: var(--butter); color: #8a6420; }
.verdict.bad { background: var(--terra-soft); color: var(--terra-d); }
.verdict.sm { font-size: .8rem; padding: 4px 10px; }
.quote { font-family: var(--serif); font-style: italic; color: #5e4a3f; font-size: 1.05rem; }
.flags { background: var(--flag-soft); border-color: #f0b4a6; }
.flags h2 { color: var(--flag); }
.flags ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.flags li { background: rgba(255, 255, 255, .6); padding: 12px 16px; border-radius: 14px; }
.noflags { background: var(--sage-soft); border-color: #c4d6bb; font-weight: 700; }
.bar { margin-bottom: 14px; }
.bar-top { display: flex; justify-content: space-between; font-weight: 700; font-size: .92rem; margin-bottom: 5px; }
.bar-track { height: 10px; border-radius: 99px; background: var(--bg2); overflow: hidden; }
.bar-track > div { height: 100%; border-radius: 99px; background: var(--sage); }
.bar-track > div.mid { background: #d9a54a; }
.bar-track > div.bad { background: var(--terra); }
.statuses { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.stars { display: flex; gap: 2px; margin-bottom: 14px; align-items: center; }
.stars .gut { font-weight: 700; margin-inline-end: 8px; }
.stars button { background: none; border: 0; font-size: 1.6rem; cursor: pointer; padding: 0 2px; filter: grayscale(1) opacity(.35); transition: transform .1s; }
.stars button.on { filter: none; }
.stars button:hover { transform: scale(1.15); }
.answers { display: grid; gap: 4px; }
.ans { display: grid; grid-template-columns: 1fr 1.1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ans:last-child { border-bottom: 0; }
.ans-q { font-weight: 700; }
.ans-q small { display: block; color: var(--muted); font-weight: 600; }
.ans-a .gchip { cursor: default; }
.ans-a .wanted { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.gallery-q { margin-bottom: 18px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 14px; margin-bottom: 8px; }
.doc-row span { flex: 1; font-weight: 700; word-break: break-all; }

.cand-card { display: flex; gap: 18px; align-items: center; text-decoration: none; color: inherit; transition: transform .15s; }
.cand-card:hover { transform: translateY(-2px); }
.cand-card h3 { margin-bottom: 0; }
.cand-card p { margin: 0 0 8px; }
.cc-body { flex: 1; min-width: 0; }
.pill { font-size: .78rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--bg); }
.pill.flag { background: var(--flag-soft); color: var(--flag); }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; top: 20px; transform: translate(-50%, -20px); opacity: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 700;
  transition: all .25s; pointer-events: none; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lightbox { position: fixed; inset: 0; background: rgba(40, 28, 22, .85); display: grid; place-items: center; z-index: 90; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 16px; }
.confetti { position: fixed; top: -20px; font-size: 1.5rem; z-index: 80; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .steps, .two-col, .grid2 { grid-template-columns: 1fr; }
  .report-top { flex-direction: column; text-align: center; }
  .ans { grid-template-columns: 1fr; gap: 6px; }
  .qbody { padding-left: 18px; }
  .host-nav a:not(.btn) { display: none; }
  .card { padding: 20px; }
  .savebar { padding-left: 18px; font-size: .9rem; }
}
