/* ---------- Schriften (lokal, SIL Open Font License) ---------- */
@font-face { font-family: 'Nunito'; src: url(fonts/nunito-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(fonts/nunito-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url(fonts/fredoka-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }

/* ---------- Farben ---------- */
:root {
  --primary: #15803d;      /* Knöpfe, Kontrast zu Weiß 5:1 */
  --primary-dark: #166534;
  --primary-soft: #dcfce7;
  --ink: #17261b;
  --muted: #4b5d50;        /* Nebentext, Kontrast > 6:1 */
  --bg: #eef7e8;
  --surface: #ffffff;
  --line: #d6e6cf;
  --sand: #ead9ad;
  --grass: #a7dc8c;
  --pos: #15803d;
  --neg: #b91c1c;
  --gold: #f59e0b;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(23, 38, 27, .14);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { -webkit-user-select: none; user-select: none; font-family: 'Nunito', system-ui, sans-serif; font-size: 16px; color: var(--ink); background: var(--bg); overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
input { -webkit-user-select: text; user-select: text; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { opacity: .45; }
h1, h2, h3 { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; }
.splash { height: 100dvh; display: grid; place-content: center; text-align: center; font: 600 28px 'Fredoka', sans-serif; color: var(--primary-dark); }

/* ---------- Knöpfe ---------- */
.btn { min-height: 48px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { color: var(--neg); border-color: #f3c4c4; background: #fff; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: 14px; }
.btn.big { min-height: 56px; font-size: 18px; padding: 0 22px; }
.btn.round { width: 60px; height: 60px; border-radius: 50%; font-size: 30px; padding: 0; }
.link { border: 0; background: none; color: var(--primary-dark); font-weight: 700; text-decoration: underline; padding: 8px 2px; min-height: 44px; }
.iconbtn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #f1f5ef; font-size: 20px; }
.field { width: 100%; min-height: 52px; font-size: 18px; padding: 0 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; }
.field:focus { outline: 3px solid #86efac; border-color: var(--primary); }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.row.end { justify-content: flex-end; }
.lead { font-size: 17px; line-height: 1.45; margin: 4px 0 10px; }
.hint { font-size: 14px; color: var(--muted); line-height: 1.45; margin: 6px 0 10px; }
.pos { color: var(--pos); }
.negc { color: var(--neg); }

/* ---------- Begrüßung ---------- */
.intro { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 0, #d9f5c8, var(--bg) 70%); }
.intro-card { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding: 22px; max-width: 480px; width: 100%; text-align: center; }
.intro-card h1 { margin: 6px 0; color: var(--primary-dark); font-size: 28px; }
.steps { text-align: left; padding: 0; list-style: none; margin: 14px 0; }
.steps li { padding: 7px 0; line-height: 1.4; }
.namef { display: grid; gap: 10px; text-align: left; margin-top: 10px; }
.namef label { font-weight: 700; }

/* ---------- Spiel ---------- */
.game { height: 100dvh; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--primary); color: #fff; padding-top: max(8px, env(safe-area-inset-top)); }
.zname { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font: 600 19px 'Fredoka', sans-serif; }
.zname img { background: #fff; border-radius: 50%; padding: 2px; flex: none; }
.zname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayno { font-weight: 700; font-size: 15px; background: rgba(255,255,255,.18); padding: 6px 10px; border-radius: 999px; }
.money { min-height: 44px; border: 0; border-radius: 999px; background: #fff; color: var(--primary-dark); font-weight: 700; font-size: 17px; padding: 0 14px; white-space: nowrap; }
.money.neg { color: var(--neg); }
.strip { display: flex; gap: 8px; padding: 8px 10px; background: #f8fcf5; border-bottom: 1px solid var(--line); }
.chip-btn { min-height: 44px; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 4px 10px; font-weight: 700; font-size: 14px; text-align: left; line-height: 1.25; }
.chip-btn.weather { flex: none; }
.chip-btn.goal { flex: 1; min-width: 0; }
.gbar { display: block; height: 8px; border-radius: 4px; background: #e5efe1; margin-top: 4px; overflow: hidden; }
.gbar i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }

.map { flex: 1; min-height: 0; position: relative; overflow: hidden; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr); gap: 16px; padding: 12px 12px 46px;
  background-color: var(--sand); background-image: radial-gradient(rgba(150,120,60,.18) 1.5px, transparent 1.6px); background-size: 18px 18px; }
.plot { position: relative; border: 0; border-radius: var(--radius); padding: 6px; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; overflow: hidden; box-shadow: 0 3px 0 rgba(0,0,0,.14); background-size: cover; background-position: center; }
.plot.empty { background: rgba(167,220,140,.6); border: 3px dashed #6aa84f; color: #2f5d22; }
.plot.locked { background: #cdb98a repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 10px, transparent 10px 20px); }
.plot .sign { background: #fffaf0; border: 3px solid #8b5a2b; border-radius: 8px; padding: 4px 10px; font-weight: 700; font-size: 13px; color: #5a3a12; display: flex; flex-direction: column; align-items: center; box-shadow: 0 6px 0 -2px #6b4423; }
.plot .sign b { font-size: 15px; }
.plot .big { font-size: 30px; line-height: 1; }
.plot .pn { font-weight: 700; font-size: 13px; line-height: 1.2; text-align: center; }
.plot.shop, .plot.pen { justify-content: flex-start; align-items: flex-start; }
.plot.shop .pn, .plot.pen .pn { background: rgba(255,255,255,.85); padding: 1px 8px; border-radius: 999px; position: relative; z-index: 2; }
.plot.f-wood { border: 4px solid #a0692f; }
.plot.f-glass { border: 4px solid #a9d8f0; }
.plot.f-wood::after, .plot.f-glass::after { content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none; }
.plot.f-wood::after { border: 3px dashed #5b3a1a; }
.plot.f-glass::after { border: 2px solid rgba(255,255,255,.85); box-shadow: inset 0 0 12px rgba(255,255,255,.5); }
.plot .a { position: absolute; transform: translate(-50%, -50%); transition-property: left, top; transition-timing-function: ease-in-out; font-size: 26px; line-height: 1; pointer-events: none; z-index: 1; }
.plot .af { display: block; transform: scaleX(var(--fx, 1)); transition: transform .25s; }
.plot .a i { display: block; font-style: normal; animation: hop 1.8s ease-in-out var(--d) infinite; filter: drop-shadow(0 2px 1px rgba(0,0,0,.25)); }
.plot[data-mood="0"] .a i { animation: none; }
.plot[data-w] .a i { animation: swim 2.6s ease-in-out var(--d) infinite; }
@keyframes hop { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-3px); } 90% { transform: translateY(0); } }
@keyframes swim { 0%, 100% { transform: translateY(-2px) rotate(-3deg); } 50% { transform: translateY(2px) rotate(3deg); } }
.emptyhint { margin: auto; font-size: 13px; font-weight: 700; color: var(--ink); background: rgba(255,255,255,.8); padding: 2px 8px; border-radius: 999px; font-style: normal; }
.burst { position: absolute; left: 45%; top: 50%; font-size: 22px; z-index: 3; pointer-events: none; animation: burst 1.4s ease-out forwards; }
.burst.b2 { left: 30%; animation-delay: .15s; opacity: 0; }
.burst.b3 { left: 62%; animation-delay: .3s; opacity: 0; }
@keyframes burst { 0% { transform: translateY(0) scale(.6); opacity: 1; } 100% { transform: translateY(-40px) scale(1.2); opacity: 0; } }
.badge { position: absolute; z-index: 3; font-size: 12px; font-weight: 700; border-radius: 999px; background: #fff; padding: 1px 6px; line-height: 1.5; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.badge.mood { top: 5px; right: 5px; font-size: 18px; padding: 0 3px; background: transparent; box-shadow: none; }
.badge.hungry { bottom: 5px; left: 5px; background: #fee2e2; color: #7f1d1d; }
.badge.keeper { bottom: 5px; right: 5px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); background: #7c4a1e; color: #fff; font-weight: 700; font-size: 14px; padding: 6px 16px; border-radius: 12px 12px 6px 6px; white-space: nowrap; }
.live { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); background: rgba(255,255,255,.95); border-radius: 999px; padding: 6px 14px; font-size: 15px; box-shadow: var(--shadow); z-index: 3; white-space: nowrap; }
.walker { position: absolute; left: 0; top: 0; font-size: 24px; pointer-events: none; z-index: 2; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.coin { position: absolute; font-weight: 700; font-size: 14px; color: #7a4a00; background: #fde68a; border-radius: 999px; padding: 1px 8px; pointer-events: none; z-index: 2; }

.bar { display: flex; align-items: stretch; gap: 4px; padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.tab { flex: 1; min-height: 56px; border: 0; background: transparent; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); gap: 1px; min-width: 0; }
.tab span { font-size: 22px; line-height: 1; }
.tab:active { background: var(--primary-soft); }
.btn.open { flex: 1.6; font-size: 17px; }
.is-day .bar { align-items: center; }
.daytxt { flex: 1; text-align: center; color: var(--muted); font-weight: 700; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.75); } 50% { box-shadow: 0 0 0 8px rgba(245,158,11,0); } }

@media (orientation: landscape) {
  .map { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); }
}
@media (max-width: 380px) { .tab { font-size: 11px; } .money { font-size: 15px; padding: 0 10px; } }

/* ---------- Blätter ---------- */
.sheet-bd { position: fixed; inset: 0; background: rgba(23,38,27,0); display: flex; align-items: flex-end; justify-content: center; z-index: 20; transition: background .2s; }
.sheet-bd.open { background: rgba(23,38,27,.45); }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92dvh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .2s ease-out; }
.sheet.wide { max-width: 760px; }
.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px 18px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 21px; }
.sheet-body { overflow-y: auto; padding: 4px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet-body h3 { margin: 18px 0 8px; font-size: 17px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; background: #17261b; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; z-index: 40; max-width: min(92vw, 520px); text-align: center; transition: .25s; line-height: 1.35; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.card { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-height: 44px; }
.card:active { background: var(--primary-soft); }
.card.lock { background: #f4f4f2; }
.ce { font-size: 34px; line-height: 1.1; }
.cn { font-weight: 700; }
.cp { font-weight: 700; color: var(--primary-dark); font-size: 17px; }
.cs { font-size: 12px; color: var(--muted); }
.ci { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 4px; }
.status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 16px; background: #f6faf3; border-radius: 12px; padding: 10px 12px; }
.mood-big { font-size: 28px; }
.status .cap { margin-left: auto; color: var(--muted); font-size: 14px; }
.mine { display: grid; gap: 8px; }
.mrow { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 14px; padding: 6px 8px; }
.mi { flex: 1; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 0; min-height: 44px; min-width: 0; }
.mi small { display: block; color: var(--muted); font-size: 13px; }
.me { font-size: 30px; }
.feedrow { margin: 12px 0 4px; }
.feedrow .btn { width: 100%; }
.feedrow .ok { display: block; text-align: center; font-weight: 700; color: var(--pos); padding: 12px; background: var(--primary-soft); border-radius: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 0 14px; font-weight: 700; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.facts { padding-left: 20px; line-height: 1.8; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 16px 0; }
.pv { font: 600 40px 'Fredoka', sans-serif; min-width: 120px; text-align: center; }
.estimate { text-align: center; background: #fff8e1; border-radius: 14px; padding: 12px; font-size: 16px; line-height: 1.6; }

.balance { display: flex; justify-content: space-between; align-items: center; background: var(--primary-soft); border-radius: 14px; padding: 12px 16px; font-weight: 700; }
.balance b { font-size: 24px; }
.balance b.neg { color: var(--neg); }
.chart { display: flex; justify-content: center; align-items: stretch; gap: 4px; height: 160px; padding: 6px; background: #f8fbf6; border-radius: 12px; }
.chart .col { flex: 1; max-width: 40px; display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.chart .up, .chart .down { flex: 1; display: flex; }
.chart .up { align-items: flex-end; border-bottom: 2px solid #9fb39a; }
.chart .down { align-items: flex-start; }
.chart i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--pos); }
.chart .down i { background: var(--neg); border-radius: 0 0 4px 4px; }
.chart span { font-size: 11px; text-align: center; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.tbl th, .tbl td { padding: 7px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.lex dt { font-weight: 700; margin-top: 8px; }
.lex dd { margin: 2px 0 0; color: var(--muted); line-height: 1.4; font-size: 15px; }
.goals { list-style: none; padding: 0; margin: 0; }
.goals li { padding: 10px 6px; border-bottom: 1px solid var(--line); line-height: 1.4; }
.goals li.now { font-weight: 700; background: #fff8e1; border-radius: 10px; }
.goals li.later { color: var(--muted); }
.gtext { font-size: 13px; font-weight: 400; margin-top: 4px; }
.menu { display: grid; gap: 10px; }
.help { padding-left: 22px; line-height: 1.5; }
.help li { margin-bottom: 8px; }

.receipt { font-size: 15px; }
.rhead { background: #f6faf3; border-radius: 12px; padding: 8px 12px; line-height: 1.4; }
.receipt h3 { margin: 14px 0 4px; }
.rl { display: flex; justify-content: space-between; gap: 10px; padding: 6px 2px; border-bottom: 1px dashed var(--line); }
.rl.sum { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 700; }
.result { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; padding: 14px 16px; border-radius: 14px; font: 600 20px 'Fredoka', sans-serif; }
.result.win { background: var(--primary-soft); color: var(--primary-dark); }
.result.loss { background: #fee2e2; color: var(--neg); }
.calc { background: #f8fbf6; border-radius: 14px; padding: 2px 12px 6px; margin-bottom: 8px; }
.note { background: #fff8e1; border-radius: 12px; padding: 10px 12px; line-height: 1.4; }
.tip { background: #e0f2fe; border-radius: 12px; padding: 10px 12px; line-height: 1.45; }
.star { background: #fef3c7; border-radius: 12px; padding: 10px 12px; font-weight: 700; animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.8); opacity: 0; } 70% { transform: scale(1.04); } 100% { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) { .plot .a i, .pulse { animation: none; } }

/* ---------- Figuren: Avatar, Besucher, Pfleger ---------- */
.ahead { width: 36px; height: 36px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.avgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 12px; }
.av { min-height: 96px; border: 3px solid var(--line); border-radius: 16px; background: #f6faf3; display: grid; place-items: center; padding: 6px; }
.av.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px #86efac; }
.person { position: absolute; transform: translate(-50%, -100%); transition-property: left, top; transition-timing-function: linear; pointer-events: none; z-index: 4; }
.person .fig { display: block; filter: drop-shadow(0 2px 1px rgba(0,0,0,.3)); }
.person.flip .fig { transform: scaleX(-1); }
.person.keeper { z-index: 3; }
.director::after { content: ''; position: absolute; left: 50%; bottom: -3px; width: 26px; height: 7px; transform: translateX(-50%); background: rgba(0,0,0,.18); border-radius: 50%; z-index: -1; }
.bubble { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 0) scale(0); background: #fff; border-radius: 12px; padding: 2px 6px; font-size: 18px; box-shadow: var(--shadow); opacity: 0; }
.bubble.show { animation: bubble 2.4s ease-out forwards; }
@keyframes bubble { 0% { transform: translate(-50%, 4px) scale(.4); opacity: 0; } 15%, 80% { transform: translate(-50%, -2px) scale(1); opacity: 1; } 100% { transform: translate(-50%, -8px) scale(1); opacity: 0; } }
.walking .leg { animation: step .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 0; }
.walking .leg.r { animation-delay: -.25s; }
@keyframes step { from { transform: rotate(14deg); } to { transform: rotate(-14deg); } }
.walker { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; }
.walker .wb { display: block; transform: translate(-50%, -100%); }
.walker .fig { display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.emo { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; font-size: 16px; margin: -58px 0 0 -12px; background: #fff; border-radius: 10px; padding: 0 4px; box-shadow: 0 1px 4px rgba(0,0,0,.2); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .walking .leg { animation: none; } }
