:root { --wood: #6b4527; --dark: #3f2a17; --cream: #fffaf0; --paper: #fbf5e8; --line: #d8c6a2; --green: #3f5a2a; --ok: #2a8d48; --bad: #c62828; --accent: #e8a24f; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 17px; color: #2b2116; background: #b9cfde; }
.hidden { display: none !important; }
.muted { color: #75644c; font-size: .9em; }
#world { position: fixed; inset: 0; }
#world canvas { display: block; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(#a9c8de, #dfe8d0); z-index: 50; }
.ld { text-align: center; } .ld-title { font-family: Georgia, serif; font-size: 52px; color: var(--dark); } .ld-sub { color: #5d4b33; margin-top: 8px; }

/* Kopfleiste */
#hud { position: fixed; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: rgba(255,250,240,.93); border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 6px 18px rgba(40,25,10,.18); z-index: 10; flex-wrap: wrap; }
.brand { font-family: Georgia, serif; font-size: 22px; color: var(--dark); font-weight: bold; }
.brand small { font-family: inherit; font-size: 13px; color: #75644c; font-weight: normal; margin-left: 6px; }
.goal { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; }
.goal-bar { flex: 1; max-width: 260px; height: 12px; border-radius: 99px; background: #e8dcc4; overflow: hidden; }
#goalFill { height: 100%; width: 0; background: linear-gradient(90deg, #8fbf4f, #4f8a2a); transition: width .5s; }
#goalTxt { font-size: 14px; color: #5d4b33; white-space: nowrap; }
.hud-btns { display: flex; gap: 8px; }
#camBtns { position: fixed; left: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 10; }
#hint { position: fixed; right: 12px; bottom: 12px; max-width: calc(100vw - 340px); pointer-events: none; background: rgba(255,250,240,.9); border: 1px solid var(--line); padding: 6px 12px; border-radius: 10px; font-size: 14px; z-index: 10; }

/* Knöpfe */
.btn { font: inherit; font-weight: 700; border: 2px solid var(--line); border-radius: 12px; padding: 9px 15px; cursor: pointer; background: #fffaf0; color: var(--dark); transition: transform .05s, filter .15s; }
.btn:hover { filter: brightness(1.04); } .btn:active { transform: translateY(1px); } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: #b97626; color: #2a1708; box-shadow: 0 3px 0 #a8661c; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 14px; }
.btn.big { font-size: 1.15em; padding: 13px 26px; }
.btn.danger { background: #fde2e2; border-color: #e6aaaa; color: #8b1a1a; }
.btn.choice { min-width: 76px; font-size: 1.15em; background: #fff; }
.btn.choice.right { background: #d8f2df; border-color: var(--ok); } .btn.choice.wrong { background: #fde2e2; border-color: var(--bad); } .btn.choice.sel { background: #fff0d6; border-color: var(--accent); }

/* Panel */
#overlay { position: fixed; inset: 0; background: rgba(30,25,15,.35); display: grid; place-items: center; z-index: 20; padding: 14px; }
#panel { background: var(--paper); border: 2px solid var(--line); border-radius: 20px; width: min(800px, 100%); max-height: calc(100vh - 28px); overflow: auto; padding: 20px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.3); position: relative; }
#panel.wide { width: min(980px, 100%); }
#panel h2 { font-family: Georgia, serif; color: var(--dark); margin: 4px 0 10px; }
#panel h3 { margin: 16px 0 6px; color: var(--dark); }
.phead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.phead .sp { flex: 1; }
.pill { background: var(--green); color: #fff; padding: 4px 11px; border-radius: 99px; font-weight: 700; font-size: 14px; }
.pill.light { background: #efe4cc; color: var(--dark); }
.x { position: absolute; top: 10px; right: 12px; }
.dots { display: flex; gap: 5px; } .dot { width: 13px; height: 13px; border-radius: 50%; background: #e2d6bd; } .dot.cur { background: var(--accent); } .dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.done { background: #8a7b62; }
.qtext { font-size: 1.22em; line-height: 1.55; margin: 6px 0 14px; }
.visual { display: flex; justify-content: center; margin: 4px 0 14px; overflow-x: auto; }
.answerrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.answerrow input { font: inherit; font-size: 1.25em; padding: 9px 13px; border: 2px solid var(--line); border-radius: 12px; min-width: 220px; background: #fff; }
.answerrow input:focus { outline: none; border-color: var(--accent); }
.inhint { font-size: .85em; color: #7a6a52; }
.choices { display: flex; gap: 9px; flex-wrap: wrap; }
.hintbox { margin: 12px 0 4px; background: #fff3cf; border-radius: 10px; padding: 7px 12px; } .hintbox summary { cursor: pointer; font-weight: 700; }
.fb { margin-top: 12px; padding: 12px 15px; border-radius: 12px; } .fb.ok { background: #d8f2df; } .fb.bad { background: #fde2e2; }
.solution { margin: 9px 0 4px; padding: 10px 12px; background: #fff; border-radius: 10px; line-height: 1.6; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; } .actions.left { justify-content: flex-start; } .actions.center { justify-content: center; }
.center { text-align: center; }
.big-msg { font-family: Georgia, serif; font-size: 30px; color: var(--dark); margin: 8px 0; }
.tag { display: inline-block; background: #e5efd6; color: #2f4a1f; border-radius: 99px; padding: 3px 11px; font-size: .8em; font-weight: 700; }
.introbody { font-size: 1.08em; line-height: 1.65; }

/* Tierkarten */
.spgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.spcard { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px; cursor: pointer; text-align: left; font: inherit; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.spcard:hover { border-color: var(--accent); } .spcard.dis { opacity: .6; }
.spcard b { font-size: 1.02em; color: var(--dark); } .spcard .cnt { font-size: .85em; color: #6b5a40; } .spcard .goal-t { margin-top: auto; font-size: .82em; font-weight: 700; color: var(--green); }
.spcard img { width: 100%; height: 70px; object-fit: cover; border-radius: 8px; background: #e8efd9; }
.animals-row { display: flex; gap: 4px; flex-wrap: wrap; }
.ani { width: 14px; height: 14px; border-radius: 50%; background: #8a6a45; } .ani.b { width: 9px; height: 9px; margin-top: 3px; background: #d9b46a; } .ani.empty { background: transparent; border: 1.5px dashed #c7b590; }
.bar { height: 10px; background: #eadfc8; border-radius: 99px; overflow: hidden; } .bar > div { height: 100%; } .bar.food > div { background: #c9a35b; } .bar.water > div { background: #4f8fb8; }
.picker { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 14px; align-items: center; }
.stepper { display: flex; align-items: center; gap: 6px; } .stepper span { min-width: 22px; text-align: center; font-weight: 700; }

/* Eltern */
.tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 2px solid var(--line); }
.tab { font: inherit; font-weight: 700; background: none; border: 0; padding: 8px 12px; cursor: pointer; border-radius: 10px 10px 0 0; color: #75644c; } .tab.on { background: var(--line); color: var(--dark); }
.chk { display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px; background: #fff; border: 1px solid #eadfc8; border-radius: 10px; margin: 4px 0; cursor: pointer; } .chk input { width: 20px; height: 20px; margin-top: 2px; } .chk small { display: block; color: #7a6a52; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; font-size: .92em; }
.tbl th, .tbl td { padding: 7px 9px; border-bottom: 1px solid #f0e6d2; text-align: left; } .tbl th { background: #efe4cc; }
.tbl.small { width: auto; margin: 6px 0; } .tbl.small td { border: 1px solid #ddd; text-align: center; min-width: 34px; }
.amp { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; } .amp.g { background: #2a9d4b; } .amp.y { background: #f2c230; } .amp.r { background: #d62828; } .amp.n { background: #bbb; }
.meter { display: inline-block; width: 90px; height: 9px; background: #eee3cc; border-radius: 99px; overflow: hidden; vertical-align: middle; } .meter > i { display: block; height: 100%; background: #6fa53c; }
label.row { display: flex; align-items: center; gap: 10px; margin: 9px 0; } select, .field { font: inherit; padding: 7px 10px; border: 2px solid var(--line); border-radius: 10px; background: #fff; }

/* Mathe-Darstellung */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 2px; font-size: .95em; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 3px; } .frac > span:last-child { padding: 0 3px; }
.stw { border-collapse: collapse; margin: 6px 0; } .stw th, .stw td { border: 2px solid #b9a37c; padding: 3px 9px; text-align: center; font-weight: 700; } .stw th { background: #f1e6cf; font-size: .85em; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 11px 18px; border-radius: 13px; z-index: 60; max-width: 90%; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
#printArea { display: none; }
@media print { body > *:not(#printArea) { display: none !important; } #printArea { display: block; } html, body { overflow: visible; background: #fff; height: auto; } .pagebreak { page-break-before: always; } .exam li { margin: 0 0 22px; } }
@media (max-width: 700px) { #hud { gap: 8px; } .brand { font-size: 18px; } .goal { order: 3; min-width: 100%; } }

#overlay.bottom { place-items: end center; background: transparent; pointer-events: none; }
#overlay.bottom #panel { pointer-events: auto; margin-bottom: 8px; }
#panel.compact { width: min(620px, 100%); padding: 14px 18px; }
#panel.compact .big-msg { font-size: 24px; margin: 2px 0; }
.center-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
