/* Kreaturen-Lexikon (/creature) – mobil zuerst, hell/dunkel */
:root {
  --bg: #eef1f5; --surface: #ffffff; --surface2: #f4f6f9; --text: #1b1d22; --muted: #5b6270; --line: #d9dde4;
  --accent: #3c8d3c; --accent-ink: #fff; --mon: #6e4a78; --mon-bg: #efe7f2; --pred: #b46a1c; --pred-bg: #fbf0e2; --bug-bg: #eaf4e6; --animal-bg: #e7f0f8; --t-aggr: #f6cdc8; --t-pass: #f7ebb4; --t-fried: #d3edc4;
  --d0: #3a8fb7; --d1: #3c8d3c; --d2: #c8962a; --d3: #c2472f;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.06);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --mono: 'Courier New', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131419; --surface: #1d1f26; --surface2: #252832; --text: #e9ebf0; --muted: #9aa1ae; --line: #30343f;
    --mon-bg: #2c2233; --pred-bg: #2f2518; --bug-bg: #1c2a1c; --animal-bg: #1b2531; --t-aggr: #4a1f1c; --t-pass: #4a4018; --t-fried: #1f3a1a; --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
body.lock { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
kbd, code { font-family: var(--mono); background: var(--surface2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 0 16px 8px; padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 48px; max-width: 1200px; margin: 0 auto; }
.brand { font: bold 18px var(--mono); color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.play { background: var(--accent); color: var(--accent-ink); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.controls { max-width: 1200px; margin: 0 auto; display: grid; gap: 8px; }
.row { display: flex; gap: 8px; }
#q { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
#biome { width: 40%; max-width: 240px; height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.seg { display: flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 6px; border-radius: 8px; font-weight: 600; cursor: pointer; white-space: nowrap; font-size: 14px; }
.seg button b { font-weight: 500; opacity: .6; }
.seg button.on { background: var(--surface); box-shadow: var(--shadow); }
#tabs button[data-tab="monsters"].on { color: var(--mon); }
#tabs button[data-tab="animals"].on { color: var(--accent); }
/* Unter-Reiter der Monster: Kampf / Flucht / Weltbosse (monsterkind.js) */
.seg.sub button { font-size: 13px; padding: 5px 4px; }
.seg.sub button[data-k="fight"].on { color: var(--mon); } .seg.sub button[data-k="flee"].on { color: #2f8fd8; } .seg.sub button[data-k="world"].on { color: #c8960a; }
.seg.diff button.on[data-d="0"] { background: var(--d0); color: #fff; } .seg.diff button.on[data-d="1"] { background: var(--d1); color: #fff; }
.seg.diff button.on[data-d="2"] { background: var(--d2); color: #fff; } .seg.diff button.on[data-d="3"] { background: var(--d3); color: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.chips button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Liste */
main { max-width: 1200px; margin: 0 auto; padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); }
.gh { margin: 18px 2px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gh:first-child { margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
.card { display: flex; flex-direction: column; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; padding: 0; box-shadow: var(--shadow); transition: transform .12s; }
.card:active { transform: scale(.98); }
@media (hover: hover) { .card:hover { transform: translateY(-2px); } }
.card .pic { aspect-ratio: 1 / 0.8; background: var(--animal-bg); display: flex; align-items: center; justify-content: center; position: relative; }
.card.k-bug .pic { background: var(--bug-bg); } .card.k-predator .pic, .card.k-territorial .pic { background: var(--pred-bg); } .card.mon .pic { background: var(--mon-bg); }
.card.t-aggressiv .pic { background: var(--t-aggr); } .card.t-passiv .pic { background: var(--t-pass); } .card.t-friedlich .pic { background: var(--t-fried); }
.card img { width: 88%; height: 88%; object-fit: contain; opacity: 0; transition: opacity .25s; }
.card img.ok { opacity: 1; }
.card .i { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font: italic bold 13px Georgia, serif; color: #2a6ab0; display: grid; place-items: center; }
.card .body { padding: 8px 10px 10px; display: grid; gap: 3px; }
.card .n { font-weight: 700; font-size: 15px; line-height: 1.2; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface2); color: var(--muted); width: fit-content; }
.badge.k-hostile { background: var(--mon); color: #fff; } .badge.k-predator, .badge.k-territorial { background: var(--pred); color: #fff; }
.badge.k-passive { background: var(--accent); color: #fff; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* Detail */
#detail { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
#detail[hidden] { display: none; }
.sheet { background: var(--bg); width: 100%; max-width: 760px; max-height: 100%; height: 100%; overflow-y: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
@media (min-width: 800px) { #detail { align-items: center; } .sheet { height: auto; max-height: 92vh; border-radius: 16px; } }
.dhead { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; background: var(--bg); padding: calc(10px + env(safe-area-inset-top)) 0 10px; border-bottom: 1px solid var(--line); }
.dhead h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.dtitle { flex: 1; min-width: 0; }
.back, .share { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; flex: none; }
.stage { position: relative; margin: 12px 0; border-radius: var(--radius); background: radial-gradient(circle at 50% 35%, #cfe3f5, #93b8d6); aspect-ratio: 16 / 10; overflow: hidden; touch-action: none; }
.stage.mon { background: radial-gradient(circle at 50% 35%, #7a6682, #3c3044); }
.stage canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.stage .hint { position: absolute; bottom: 6px; right: 10px; font-size: 11px; color: rgba(255,255,255,.85); text-shadow: 0 1px 2px rgba(0,0,0,.5); pointer-events: none; }
.intro { margin: 12px 0 6px; }
.sum { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); border-left: 4px solid var(--d2); font-weight: 600; }
.sum.d0 { border-color: var(--d0); } .sum.d1 { border-color: var(--d1); } .sum.d3 { border-color: var(--d3); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
@media (min-width: 560px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.quick b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.quick span { font-size: 12px; color: var(--muted); }
.facts { margin: 12px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts div { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.facts dd { margin: 0; }
@media (min-width: 640px) { .facts div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; } .facts dt { margin: 2px 0 0; } }
.foot { font-size: 12px; color: var(--muted); margin-top: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-size: 14px; z-index: 30; }

.sortrow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
#sort { flex: 1; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 600; }
.card .rank { position: absolute; top: 6px; left: 6px; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--text); color: var(--bg); font: 700 12px/22px var(--font); text-align: center; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge.calm { background: #3a8fb7; color: #fff; }
.stats .hi { color: var(--text); font-weight: 700; }

/* Gefahren-Sterne */
.stars { font-size: 13px; letter-spacing: 1px; line-height: 1; }
.stars.d1 { color: #6aa84f; } .stars.d2 { color: #b5a331; } .stars.d3 { color: #e0901f; } .stars.d4 { color: #d9582b; } .stars.d5 { color: #c01e3a; }
.quick .dz b.stars { font-size: 17px; letter-spacing: 2px; }
.quick .dz.d1 b { color: #6aa84f; } .quick .dz.d2 b { color: #b5a331; } .quick .dz.d3 b { color: #e0901f; } .quick .dz.d4 b { color: #d9582b; } .quick .dz.d5 b { color: #c01e3a; }

/* Seltenheit */
.badge.rar { border: 1px solid currentColor; background: transparent; }
.badge.rar.r5 { color: #6a7480; } .badge.rar.r4 { color: #3a8a4a; } .badge.rar.r3 { color: #2a73b8; } .badge.rar.r2 { color: #8a3ab8; } .badge.rar.r1 { color: #c07a10; } .badge.rar.r0 { color: #999; }
@media (prefers-color-scheme: dark) { .badge.rar.r5 { color: #a8b0bc; } .badge.rar.r4 { color: #6cc47c; } .badge.rar.r3 { color: #6aaaf0; } .badge.rar.r2 { color: #c58af0; } .badge.rar.r1 { color: #f0b040; } }

/* Spawn im Detail */
.spawnbox { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.spawnbox h3 { margin: 0 0 6px; font-size: 17px; } .spawnbox h3 small, .spawnbox h4 small { font-weight: 500; color: var(--muted); }
.spawnbox h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.scond { margin: 0; padding-left: 20px; } .scond li { margin: 4px 0; }
.scond li::marker { content: '✓  '; color: var(--accent); font-weight: 700; }
.snote { font-weight: 700; color: var(--d3); }
.splace { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.splace p { margin: 4px 0; font-size: 14px; }
.sph { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.stype { font-size: 12px; color: var(--muted); }
.sbar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; margin: 6px 0; }
.sbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #9ccc65); }
.sfreq { color: var(--text); }
.scomp { font-size: 13px !important; color: var(--muted); } .scomp span { font-variant-numeric: tabular-nums; opacity: .8; }
.spawnbox .small { font-size: 12px; color: var(--muted); margin-top: 10px; }

.nav { display: flex; align-items: center; gap: 12px; }
.nav a:not(.play) { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
@media (max-width: 430px) { .brand { font-size: 15px; } .nav { gap: 8px; } .nav a:not(.play) { font-size: 13px; } .play { padding: 6px 10px; } }

/* Größenvergleich mit Steve */
.stevebtn { position: absolute; top: 10px; right: 10px; border: 1px solid rgba(255,255,255,.6); background: rgba(0,0,0,.35); color: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer; backdrop-filter: blur(4px); }
.stevebtn.on { background: #2aa6b0; border-color: #2aa6b0; }
.stevebtn:not(.on) { opacity: .85; text-decoration: line-through; }
.scap { position: absolute; left: 12px; top: 14px; max-width: calc(100% - 140px); font-size: 11px; color: rgba(255,255,255,.9); text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none; }

/* Angriffs-Simulation */
.simbtn { position: absolute; right: 10px; bottom: 10px; border: 0; background: #c2472f; color: #fff; border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.simbtn.on { background: rgba(0,0,0,.55); }
.simbtn:disabled { background: rgba(0,0,0,.3); cursor: default; box-shadow: none; }
.simagain { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 0; background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; padding: 10px 18px; font-size: 15px; font-weight: 700; cursor: pointer; }
.stage.sim .hint, .stage.sim .scap, .stage.sim .stevebtn { display: none; }
.simlayer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.simlbl { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.7), 0 0 6px rgba(0,0,0,.4); color: #fff; }
.simlbl.mode { position: absolute; left: 12px; top: 12px; transform: none; font-size: 13px; font-weight: 700; background: rgba(0,0,0,.45); padding: 3px 9px; border-radius: 999px; text-shadow: none; }
.simlbl.hint { left: 50% !important; top: 18% !important; font-size: 14px; }
.simlbl.dmg { font-size: 22px; color: #ff5a5a; }
.simlbl.eff { font-size: 14px; color: #bdf; }
.simlbl.note { font-size: 20px; color: #ffe; }
/* Stufen 6–7 */
.stars.d6 { color: #a0103a; } .stars.d7 { color: #5a0018; }
.quick .dz.d6 b { color: #a0103a; } .quick .dz.d7 b { color: #5a0018; }

/* Echte Angriffe (realsim.js): Auswahl unter der Bühne, Lebensanzeige im Bild */
.atks { margin: -4px 0 12px; }
.atkchips { flex-wrap: wrap; margin: 0; padding: 0; }
.atkinfo { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.atkinfo b { color: var(--text); }
.atkinfo .konter { color: #55ff55; }
.simhud { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; max-width: calc(100% - 150px); }
.simhud .hearts { display: flex; gap: 1px; }
.simhud .h { width: 13px; height: 12px; display: inline-block; background: #e22; clip-path: polygon(50% 100%, 0 45%, 0 15%, 15% 0, 35% 0, 50% 18%, 65% 0, 85% 0, 100% 15%, 100% 45%); filter: drop-shadow(1px 1px 0 #000); }
.simhud .h.half { background: linear-gradient(90deg, #e22 50%, #3a1212 50%); }
.simhud .h.e { background: #3a1212; }
.simhud .fx, .simhud .mhp { font-size: 13px; color: #fff; text-shadow: 1px 1px 0 #000, 0 0 4px rgba(0,0,0,.6); }
.simhud .fx:empty { display: none; }
.simhud .mhp { color: #ffd0d0; }
.simhud .hearts { flex-wrap: wrap; max-width: 140px; }
.simhud .h { width: 12px; height: 11px; }
.simhud .arm { font-size: 13px; color: #cfe6ff; text-shadow: 1px 1px 0 #000, 0 0 4px rgba(0,0,0,.6); }
/* Rüstung für Steve */
.armor { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--surface2); }
.armor summary { cursor: pointer; font-weight: 600; }
.armor summary span { font-weight: normal; color: var(--muted); }
.armslots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 6px; margin: 8px 0; }
.armslots label { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); min-width: 0; }
.armslots select { width: 100%; min-width: 0; }
.armsave { display: flex; gap: 6px; margin-bottom: 8px; }
.armsave input { flex: 1; min-width: 0; }
.armsets { flex-wrap: wrap; margin: 0; padding: 0; }
.armsets .aset { display: inline-flex; }
.armsets .aset.on button:first-child { color: #ffff55; border-color: #fff; }
.armsets .del { padding-left: 6px; padding-right: 6px; color: #ff7070; }
.armsets .none { color: var(--muted); font-size: 13px; }
/* Waffen, die die Kreatur natürlich nutzt (mobarms_data.js) */
.warms { display: flex; flex-wrap: wrap; gap: 3px 6px; margin-top: 4px; }
.warm { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.warm img { width: 16px; height: 16px; image-rendering: pixelated; }
.card .warm img { width: 16px; height: 16px; opacity: 1; transition: none; image-rendering: pixelated; flex: none; }
.warms { max-width: 100%; min-width: 0; }
.warm { white-space: normal; min-width: 0; overflow-wrap: anywhere; }
.atkchips .wic { width: 16px; height: 16px; image-rendering: pixelated; vertical-align: -3px; margin-right: 4px; }
.gh .wgic { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: -4px; margin-right: 6px; }
/* Steve-Modus in der Angriffs-Vorschau: stillhalten / kämpfen / fliehen */
.smode { margin-bottom: 6px; }
.smode button { flex: 1 1 0; }
.simlbl.hitm { font-size: 18px; color: #ffe066; }
.simlbl.crit { font-size: 22px; color: #ffb020; }
.simhud .run { font-size: 13px; color: #fff; text-shadow: 1px 1px 0 #000, 0 0 4px rgba(0,0,0,.6); }
.simhud .run .dz { color: #ff6060; font-weight: normal; } .simhud .run .ok { color: #66ff66; font-weight: normal; }
/* Unter-Reiter auf dem Handy: ohne Anzahl, kleinere Schrift, passt in eine Zeile */
.seg.sub button { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .seg.sub button { font-size: 11px; padding: 5px 2px; } .seg.sub button b { display: none; } }
/* Lebensraum gruppiert: Dimension (h2) → Biom (h3) */
.gh.dimh { margin-top: 26px; padding-bottom: 4px; border-bottom: 2px solid rgba(255, 255, 85, .35); }
.gh.bioh { margin: 12px 2px 6px 10px; color: #e8e8e8; text-shadow: 2px 2px 0 #3a3a3a; font-size: calc(13px * var(--k, 1)); }
