@font-face { font-family: "Fredoka"; src: url("fredoka.woff") format("woff"); font-weight: 300 700; font-display: swap; }
:root {
  --ink:#25211c; --paper:#fffaf0; --muted:#6b6354; --sun:#ffd23f; --sun2:#f5b800; --grass:#7cc95a; --grass2:#4ea63a;
  --red:#e8483d; --blue:#3b84ee; --yellow:#f7c42c; --green:#3fb15b; --bad:#d6403a; --warn:#f08a1c;
  --shadow:0 5px 0 rgba(37,33,28,.18);
}
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body {
  margin:0; font-family:"Fredoka","Nunito","Trebuchet MS",ui-rounded,system-ui,sans-serif; color:var(--ink); font-size:17px; line-height:1.45;
  background:linear-gradient(#bfe6ff 0, #e4f6ff 220px, #dff3c4 520px, #b8e08e 100%) fixed; min-height:100vh; padding-bottom:70px; position:relative;
}
.sky { position:fixed; inset:0 0 auto 0; height:260px; overflow:hidden; pointer-events:none; z-index:0; }
.cloud { position:absolute; background:#fff; border-radius:60px; opacity:.85; animation:drift linear infinite; }
.cloud::before,.cloud::after { content:""; position:absolute; background:#fff; border-radius:50%; }
.cloud.c1 { width:120px; height:34px; top:46px; left:-160px; animation-duration:70s; }
.cloud.c1::before { width:50px; height:50px; left:18px; top:-24px; } .cloud.c1::after { width:36px; height:36px; left:62px; top:-14px; }
.cloud.c2 { width:90px; height:26px; top:120px; left:-120px; animation-duration:95s; animation-delay:-30s; opacity:.7; }
.cloud.c2::before { width:38px; height:38px; left:12px; top:-18px; } .cloud.c2::after { width:28px; height:28px; left:46px; top:-10px; }
.cloud.c3 { width:150px; height:40px; top:20px; left:-200px; animation-duration:120s; animation-delay:-70s; opacity:.6; }
.cloud.c3::before { width:62px; height:62px; left:24px; top:-30px; } .cloud.c3::after { width:44px; height:44px; left:80px; top:-18px; }
@keyframes drift { to { transform:translateX(calc(100vw + 360px)); } }

.head { position:sticky; top:0; z-index:20; }
.top { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 12px; padding-top:max(8px, env(safe-area-inset-top)); background:rgba(255,250,240,.92); backdrop-filter:blur(6px); border-bottom:3px solid var(--ink); }
.logo { background:none; border:0; font:inherit; color:inherit; display:flex; align-items:baseline; gap:6px; padding:4px; cursor:pointer; text-align:left; }
.logo b { font-size:1.15rem; } .logo small { color:var(--muted); font-size:.78rem; }
.top nav { display:flex; gap:6px; }
.chip { font:inherit; font-weight:600; font-size:.92rem; background:#fff; color:var(--ink); border:2.5px solid var(--ink); border-radius:999px; padding:5px 12px; cursor:pointer; box-shadow:0 3px 0 rgba(37,33,28,.2); }
.chip:active { transform:translateY(2px); box-shadow:none; } .chip.ghost { padding:5px 10px; }

.hud { position:relative; z-index:2; max-width:980px; margin:10px auto 0; padding:8px 14px; background:var(--paper); border:3px solid var(--ink); border-radius:18px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:6px; }
.hud-row { display:flex; align-items:center; gap:10px 14px; flex-wrap:wrap; }
.hud[hidden] { display:none; }
.hud .yr { font-weight:700; font-size:1.05rem; white-space:nowrap; } .hud .yr small { display:block; font-weight:400; color:var(--muted); font-size:.8rem; } .hud .yr .sz-short { display:none; } .hud .ms { display:none; } .hud .mw { flex:1; min-width:140px; } .pill.caps { white-space:nowrap; }
.hud .mw { min-width:0; } .hud .ml { display:flex; justify-content:space-between; font-size:.82rem; color:var(--muted); gap:8px; }
.hud .ml b { color:var(--ink); }
.meter { position:relative; height:16px; border-radius:99px; border:2.5px solid var(--ink); overflow:hidden; background:linear-gradient(90deg,#e8483d,#f4a02c 35%,#f7d52c 60%,#3fb15b); }
.meter .cover { position:absolute; top:0; right:0; bottom:0; background:#e9e2d2; transition:width .6s cubic-bezier(.3,1.4,.5,1); border-left:2.5px solid var(--ink); }
.hud .pills { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:6px 8px; align-items:center; }
.pill { display:inline-flex; align-items:center; gap:6px; background:#fff; border:2px solid var(--ink); border-radius:99px; padding:2px 10px; font-size:.84rem; font-weight:500; }
.pill.f0 { background:#e3f6dc; } .pill.f1 { background:#fff3c4; } .pill.f2 { background:#ffe0b3; } .pill.f3,.pill.f4 { background:#ffc9c4; }
.dots { display:inline-flex; gap:3px; } .dot { width:14px; height:14px; border-radius:50%; border:2px solid var(--ink); } .dot.off { background:#fff !important; opacity:.45; position:relative; }
.dot.off::after { content:""; position:absolute; left:50%; top:-2px; bottom:-2px; width:2px; background:var(--ink); transform:rotate(45deg); }

.stage { position:relative; z-index:1; max-width:980px; margin:14px auto 0; padding:0 12px; }
.page { background:var(--paper); border:3px solid var(--ink); border-radius:24px; box-shadow:var(--shadow); padding:20px 20px 22px; animation:pop .35s cubic-bezier(.3,1.4,.5,1); }
@keyframes pop { from { transform:translateY(14px) scale(.98); opacity:0; } to { transform:none; opacity:1; } }
.page h1 { font-size:2rem; line-height:1.1; margin:.1em 0 .25em; } .page h2 { font-size:1.45rem; line-height:1.15; margin:.1em 0 .35em; }
.page h3 { font-size:1.1rem; margin:1.1em 0 .4em; }
.kicker { display:inline-block; background:var(--sun); border:2.5px solid var(--ink); border-radius:99px; padding:1px 12px; font-weight:600; font-size:.85rem; margin-bottom:6px; }
.lead { font-size:1.12rem; } .muted { color:var(--muted); } .small { font-size:.88rem; }
.hero { display:grid; grid-template-columns:minmax(150px,260px) 1fr; gap:18px; align-items:center; }
.hero .herofig .sheep { width:100%; animation:bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform:translateY(-6px) rotate(-1deg); } }

.btn { font:inherit; font-weight:700; font-size:1.08rem; background:var(--sun); color:var(--ink); border:3px solid var(--ink); border-radius:16px; padding:10px 22px; cursor:pointer; box-shadow:0 5px 0 var(--ink); transition:transform .06s, box-shadow .06s; }
.btn:hover { background:#ffdc5c; } .btn:active { transform:translateY(4px); box-shadow:0 1px 0 var(--ink); }
.btn[disabled] { opacity:.5; cursor:not-allowed; } .btn.sec { background:#fff; font-size:.95rem; padding:7px 14px; box-shadow:0 3px 0 var(--ink); } .btn.big { font-size:1.2rem; padding:12px 28px; }
.actions { margin-top:18px; display:flex; flex-wrap:wrap; gap:10px; align-items:center; }

.mixbar { display:flex; height:12px; border-radius:99px; overflow:hidden; border:2px solid var(--ink); width:100%; background:#fff; } .mixbar i { display:block; min-width:2px; border-right:1.5px solid rgba(37,33,28,.5); } .mixbar i:last-child { border-right:0; }
.mixbar.lg { height:18px; }

.sheep { display:block; width:100%; height:auto; overflow:visible; }
.ex { display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:center; margin:12px 0; }
.ex .f { width:120px; text-align:center; font-size:.8rem; } .ex .op { font-size:1.6rem; font-weight:700; } .ex .f small { display:block; color:var(--muted); line-height:1.2; }
.flockrow { display:flex; flex-wrap:wrap; gap:4px; justify-content:center; } .flockrow .f { width:110px; text-align:center; font-size:.85rem; }

.rams { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:14px; margin-top:12px; }
.ramcmp { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:12px; }
.ramcol h3 { margin:0 0 8px; font-size:1.05rem; display:flex; align-items:baseline; gap:8px; }
.ramcol h3 small { font-weight:500; color:var(--muted); font-size:.85rem; }
.ramcol.yours { background:#f6f1e4; border:2px dashed #cbbd9a; border-radius:18px; padding:10px; }
.ramcol.market { background:#fff8e8; border:2.5px solid var(--ink); border-radius:18px; padding:10px; }
.ramrow { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.sellrow { margin:10px 0; }
.ram { background:#fff; border:3px solid var(--ink); border-radius:20px; padding:12px 14px 14px; box-shadow:0 4px 0 rgba(37,33,28,.2); display:flex; flex-direction:column; gap:6px; position:relative; }
.ram.cmp { padding:8px 8px 10px; gap:4px; }
.ram.cmp .fig { padding:0 6px; }
.ram.cmp h3 { font-size:1.05rem; }
.ram.cmp .stal { font-size:.75rem; margin:0; }
.ram.cmp .chk { font-size:.75rem; padding:4px 6px; }
.ram.cmp .pred { font-size:.75rem; }
.ram.cmp .btn { margin-top:auto; font-size:.9rem; padding:7px 8px; }
.ram.cmp .info { position:absolute; top:8px; right:8px; width:26px; height:26px; border-radius:50%; border:2px solid var(--ink); background:#fff; font:inherit; font-weight:700; cursor:pointer; line-height:1; padding:0; }
.ram.cmp.empty { background:#f7f3ea; border-style:dashed; box-shadow:none; align-items:center; text-align:center; }
.ram.cmp.empty .emptyfig { font-size:2.4rem; color:var(--muted); opacity:.45; line-height:2.2; }
.ram .tag { align-self:flex-start; font-size:.74rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; background:#eee6d4; border-radius:99px; padding:1px 9px; }
.ram .tag.same { background:#d9ecff; } .ram .tag.home { background:#dff3c4; } .ram .tag.kept { background:#e8e4ff; } .ram .tag.market { background:#fff4d0; } .ram .tag.mixed { background:#f3d9ff; }
.ram .fig { padding:0 14px; } .ram h3 { margin:0; font-size:1.3rem; } .ram .stal { color:var(--muted); font-size:.85rem; margin-top:-4px; }
.chk { font-size:.88rem; border-radius:12px; padding:6px 10px; border:2px solid var(--ink); }
.chk.ok { background:#e3f6dc; } .chk.w1 { background:#fff3c4; } .chk.w2 { background:#ffe0b3; } .chk.w3,.chk.w4 { background:#ffc9c4; }
.ram details { font-size:.85rem; } .ram details summary { cursor:pointer; color:var(--muted); } .ram ul { margin:.3em 0 0; padding-left:1.1em; }
.ram .pred { font-size:.84rem; color:var(--muted); }
.ram .btn { margin-top:auto; }

.row { display:flex; gap:12px; align-items:center; padding:8px 0; border-bottom:2px dashed #e0d6bd; } .row:last-child { border:0; }
.row .mini { width:76px; flex:none; } .row .txt { flex:1; min-width:0; }
.lambs { display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
.lamb-card { width:104px; background:#fff; border:2.5px solid var(--ink); border-radius:14px; padding:2px 6px 6px; text-align:center; font-size:.82rem; animation:drop .5s cubic-bezier(.3,1.5,.5,1) backwards; cursor:pointer; }
@keyframes drop { from { transform:translateY(-30px) scale(.6); opacity:0; } }
.lost { background:#fff0ee; border:2px dashed var(--bad); border-radius:10px; padding:4px 8px; font-size:.85rem; margin-top:4px; }
.badge { display:inline-block; font-size:.72rem; font-weight:700; border:2px solid var(--ink); border-radius:99px; padding:0 7px; background:#fff; vertical-align:middle; }
.badge.f1 { background:#fff3c4; } .badge.f2 { background:#ffe0b3; } .badge.f3,.badge.f4 { background:#ffc9c4; } .badge.new { background:var(--sun); }

.keepbar { position:sticky; top:58px; z-index:5; background:var(--paper); border:3px solid var(--ink); border-radius:16px; padding:8px 12px; margin:10px 0; display:flex; gap:12px; align-items:center; flex-wrap:wrap; box-shadow:0 3px 0 rgba(37,33,28,.2); }
.keepbar .cnt { font-weight:700; font-size:1.1rem; } .keepbar .cnt.over { color:var(--bad); }
.keepbar .prog { flex:1; min-width:100px; height:12px; border:2px solid var(--ink); border-radius:99px; background:#fff; overflow:hidden; } .keepbar .prog i { display:block; height:100%; background:var(--grass2); } .keepbar .prog.over i { background:var(--bad); }
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; }
.acard { position:relative; background:#fff; border:3px solid var(--ink); border-radius:16px; padding:4px 8px 8px; text-align:center; cursor:pointer; user-select:none; transition:transform .08s, opacity .2s; font-size:.85rem; }
.acard .nm { font-weight:700; font-size:1rem; } .acard .meta { color:var(--muted); font-size:.78rem; line-height:1.25; margin-top:3px; }
.acard .sx { font-weight:700; } .acard .sx.M { color:#2159ad; } .acard .sx.F { color:#c0397a; }
.acard.sel { box-shadow:0 0 0 4px var(--grass); border-color:var(--ink); }
.acard:not(.sel) { opacity:.6; background:#f1ebdc; } .acard:not(.sel) .sheep { filter:grayscale(.7); }
.acard .state { position:absolute; top:6px; left:6px; font-size:.7rem; font-weight:700; border:2px solid var(--ink); border-radius:99px; padding:0 7px; background:var(--grass); }
.acard:not(.sel) .state { background:#e8ddc4; }
.acard .info { position:absolute; top:4px; right:4px; width:28px; height:28px; border-radius:50%; border:2px solid var(--ink); background:#fff; font:inherit; font-weight:700; cursor:pointer; line-height:1; padding:0; }
.acard .fig { margin-top:20px; }
.acard.static { cursor:pointer; } .acard.static:not(.sel) { opacity:1; background:#fff; } .acard.static .sheep { filter:none; }

.beats { list-style:none; padding:0; margin:10px 0; display:grid; gap:8px; }
.beats li { background:#fff; border:2.5px solid var(--ink); border-radius:14px; padding:8px 12px 8px 12px; animation:pop .4s backwards; }
.beats li.good { background:#e8f8de; } .beats li.bad { background:#ffe3df; } .beats li.warn { background:#fff1cc; } .beats li.tip { background:#e3f0ff; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; margin:12px 0; }
.stat { background:#fff; border:2.5px solid var(--ink); border-radius:14px; padding:8px 10px; text-align:center; } .stat b { display:block; font-size:1.6rem; line-height:1.1; } .stat span { font-size:.78rem; color:var(--muted); }
.chart { width:100%; height:auto; background:#fff; border:2.5px solid var(--ink); border-radius:14px; }
.legend { display:flex; gap:14px; font-size:.82rem; flex-wrap:wrap; margin-top:4px; } .legend i { display:inline-block; width:18px; height:4px; border-radius:2px; vertical-align:middle; margin-right:4px; }

.modal { position:fixed; inset:0; z-index:50; background:rgba(37,33,28,.55); display:flex; align-items:flex-end; justify-content:center; }
.modal[hidden] { display:none; }
.sheet { position:relative; width:100%; max-width:760px; max-height:92vh; overflow:auto; background:var(--paper); border:3px solid var(--ink); border-bottom:0; border-radius:26px 26px 0 0; padding:20px 18px 40px; animation:up .3s cubic-bezier(.3,1.2,.5,1); -webkit-overflow-scrolling:touch; }
@keyframes up { from { transform:translateY(60px); opacity:.4; } }
.sheet .x { position:sticky; float:right; top:0; width:38px; height:38px; border-radius:50%; border:2.5px solid var(--ink); background:#fff; font:inherit; font-weight:700; cursor:pointer; z-index:2; }
.sheet h2 { margin-top:0; }
@media (min-width:700px) { .modal { align-items:center; } .sheet { border-bottom:3px solid var(--ink); border-radius:26px; max-height:88vh; } }
.detail { display:grid; grid-template-columns:minmax(140px,220px) 1fr; gap:14px; align-items:center; }
table.mix { border-collapse:collapse; width:100%; font-size:.92rem; } table.mix td { padding:3px 6px; } table.mix .b { width:55%; } table.mix .sw { width:14px; }
.sw i { display:block; width:14px; height:14px; border-radius:50%; border:2px solid var(--ink); }
.ped { display:flex; gap:6px; margin:8px 0; min-height:380px; } .pedcol { flex:1; display:flex; flex-direction:column; justify-content:space-around; gap:4px; min-width:0; }
.node { background:#fff; border:2.5px solid var(--ink); border-radius:12px; padding:0 3px 3px; text-align:center; font-size:.68rem; line-height:1.1; overflow:hidden; } .node .nn { font-weight:700; display:block; }
.node.unk { background:#f1ebdc; border-style:dashed; color:var(--muted); padding:10px 2px; }
.node.dup { box-shadow:0 0 0 3px var(--bad); background:#fff0ee; } .node .tg { display:block; font-size:.62rem; color:var(--muted); }
.node.m { border-top:5px solid #3b84ee; } .node.fm { border-top:5px solid #e0569c; }
.ped-h { display:flex; gap:6px; font-size:.7rem; color:var(--muted); text-align:center; } .ped-h span { flex:1; }
.formulas { background:#fff; border:2.5px solid var(--ink); border-radius:14px; padding:8px 14px; margin-top:10px; font-size:.92rem; } .formulas summary { cursor:pointer; font-weight:600; } .formulas code { background:#f1ebdc; border-radius:6px; padding:1px 5px; font-size:.88em; }
.lesson ol { padding-left:1.2em; } .lesson li { margin:.5em 0; }
.foot { position:relative; z-index:1; text-align:center; color:var(--muted); font-size:.8rem; margin:26px 12px 0; }
@media (max-width:700px) {
  .ramcmp { grid-template-columns:1fr; gap:10px; }
}
@media (max-width:640px) {
  body { font-size:16px; } .page { padding:16px 14px 18px; border-radius:20px; } .page h1 { font-size:1.65rem; }
  .hero { grid-template-columns:1fr; } .hero .herofig { max-width:240px; margin:0 auto; }
  .logo small { display:none; } .detail { grid-template-columns:1fr; } .detail .fig { max-width:220px; margin:0 auto; }
  .grid { grid-template-columns:repeat(auto-fill,minmax(138px,1fr)); } .ex .f { width:96px; }
  .keepbar { top:96px; }
  .ram.cmp .fig { padding:0 2px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; } }
.chip, .logo b, .logo { white-space:nowrap; }
.chip { display:inline-flex; align-items:center; gap:4px; }
@media (max-width:640px) {
  .logo b { font-size:1rem; } .chip { padding:4px 8px; font-size:.8rem; } .top nav { gap:4px; }
  .top { padding:4px 8px; padding-top:max(4px, env(safe-area-inset-top)); }
  .hud { margin:0; border-radius:0; border-left:0; border-right:0; border-top:0; padding:6px 10px; box-shadow:none; gap:0; }
  .hud-row { flex-wrap:nowrap; gap:8px; }
  .hud .yr { font-size:.9rem; display:flex; align-items:baseline; gap:6px; }
  .hud .yr .sz-full { display:none; } .hud .yr .sz-short { display:inline; }
  .hud .ml { display:none; }
  .hud .mw { display:flex; align-items:center; gap:6px; min-width:0; flex:1; }
  .hud .meter { height:10px; flex:1; }
  .hud .ms { display:block; font-size:.72rem; font-weight:700; white-space:nowrap; }
  .pill.caps { font-size:.75rem; padding:1px 7px; }
  .hud-more { display:inline-flex; align-items:center; justify-content:center; min-width:32px; padding:0 8px; cursor:pointer; }
  .hud-extra { display:none; }
  .hud.open .hud-extra { display:flex; flex-wrap:wrap; gap:6px 8px; margin-top:6px; }
}

/* ---------- ronde 3: modi, badges, kwalenboek ---------- */
.personas { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.persona { background: #fff; border: 2px solid #e0d6bd; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; }
.persona .pic svg { width: 110px; height: auto; display: block; margin: 0 auto 4px; }
.persona h3 { margin: 4px 0; }
.persona ul { padding-left: 18px; margin: 6px 0 12px; flex: 1; }
.persona li { margin: 3px 0; }
.persona .actions { margin-top: auto; }
.tbs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.tbs.c { justify-content: center; }
.tb { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; line-height: 1.2; padding: 2px 7px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.tb i { font-style: normal; }
.tb-good { background: #e6f5ea; border-color: #b9e0c3; color: #1f6b35; }
.tb-bad { background: #fde8e6; border-color: #f4bdb7; color: #9a2a22; }
.tb-car { background: #fff4d6; border-color: #f0d68a; color: #7a5a00; }
.tb-age { background: #eef0f6; border-color: #cdd3e4; color: #3e4766; }
.pill.mode { background: #fff; }
.pbtn { cursor: pointer; font: inherit; border: 1px solid #e0d6bd; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; font-weight: 700; }
.lost.warnline { color: #7a5a00; }
table.genes td { padding: 4px 6px; vertical-align: top; border-bottom: 1px solid #f0e8d6; }
table.genes td:first-child { white-space: nowrap; }
.genes .bad { color: #9a2a22; } .genes .car { color: #7a5a00; }
details.trait { background: #fff; border: 1px solid #e0d6bd; border-left: 5px solid #bbb; border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
details.trait.bad { border-left-color: #d6403a; } details.trait.good { border-left-color: #2f9e4f; } details.trait.mix { border-left-color: #e0a526; }
details.trait summary { cursor: pointer; }
details.trait p { margin: 6px 0; }
ul.book li { margin: 6px 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
@media (max-width: 470px) { .logo b { font-size: 1rem; } .clabel { display: none; } }
.acard.static .btn { display:block; width:100%; margin-top:6px; }

.hud .hud-more { display:none; }
@media (max-width:640px) {
  .hud .pills.hud-extra { display:none; }
  .hud.open .pills.hud-extra { display:flex; flex-wrap:wrap; gap:6px 8px; margin-top:6px; }
  .hud .hud-more { display:inline-flex; }
}

@media (max-width:640px) {
  .ram-page { padding-top:14px; }
  .ram-page h2 { font-size:1.35rem; margin-bottom:.2em; }
  .ram-page > p { font-size:.95rem; margin:.2em 0 .6em; }
}

.keepbar .why { flex: 1 1 100%; margin: 4px 0 0; }
.confirm-why { flex: 1 1 100%; margin: 0 0 8px; }

.foot a { color: inherit; text-decoration: underline; }
.lesson a { color: inherit; }
