/* Blocklotse – modernes Design mit Minecraft-Akzenten */
@font-face { font-family: 'Geist'; src: url('../fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Monocraft'; src: url('../fonts/monocraft.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --line: #e3e0d7;
  --line-strong: #cfcbbf;
  --ink: #1c1d1a;
  --ink-2: #55574f;
  --ink-3: #6a6b63;
  --green: #357a24;
  --green-dark: #2b661d;
  --green-soft: #e8f3e1;
  --focus: #3d8b2a;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(28, 29, 26, 0.05), 0 4px 14px rgba(28, 29, 26, 0.05);
  --shadow-lg: 0 10px 30px rgba(28, 29, 26, 0.14), 0 2px 6px rgba(28, 29, 26, 0.08);
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, Consolas, monospace;
  --pixel: 'Monocraft', var(--mono);
  --chip: rgba(255, 255, 255, 0.94);
  --seg-hover: rgba(255, 255, 255, 0.6);
  --knob: #ffffff;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2355574f' stroke-width='1.5'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Dunkler Modus: folgt dem System, solange nichts gewählt wurde */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #131411; --surface: #1b1c19; --surface-2: #252621; --line: #30312b; --line-strong: #44453e;
    --ink: #ecebe4; --ink-2: #b6b5ab; --ink-3: #94948a;
    --green: #56b03c; --green-dark: #47962f; --green-soft: #1f2d19; --focus: #6cc84f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
    --chip: rgba(27, 28, 25, 0.92); --seg-hover: rgba(255, 255, 255, 0.05); --knob: #f2f1ea;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b6b5ab' stroke-width='1.5'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #131411; --surface: #1b1c19; --surface-2: #252621; --line: #30312b; --line-strong: #44453e;
  --ink: #ecebe4; --ink-2: #b6b5ab; --ink-3: #94948a;
  --green: #56b03c; --green-dark: #47962f; --green-soft: #1f2d19; --focus: #6cc84f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
  --chip: rgba(27, 28, 25, 0.92); --seg-hover: rgba(255, 255, 255, 0.05); --knob: #f2f1ea;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b6b5ab' stroke-width='1.5'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
canvas { image-rendering: pixelated; }
a { color: var(--green-dark); text-underline-offset: 2px; }
a:hover { color: var(--green); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Kopfzeile ---------- */
.site-head {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo img { width: 30px; height: 30px; }
.logo span { font-family: var(--pixel); font-size: 19px; letter-spacing: 0.02em; }
.logo:hover { color: var(--ink); }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current='page'] { color: var(--ink); background: var(--surface-2); }

/* ---------- Knöpfe ---------- */
.mc-btn {
  font: 500 14px/1 var(--font);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.mc-btn:hover { background: var(--surface-2); color: var(--ink); }
.mc-btn:disabled { color: var(--ink-3); background: var(--surface-2); cursor: default; }
.mc-btn.green, .mc-btn.primary { background: var(--green); border-color: var(--green-dark); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18); }
.mc-btn.green:hover, .mc-btn.primary:hover { background: var(--green-dark); color: #fff; }
.mc-btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.mc-btn.icon { width: 36px; padding: 0; }
.btn-row { display: flex; gap: 6px; }
.btn-row > .mc-btn { flex: 1; }

/* Segment-Umschalter (Edition, Dimension) */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.segmented .mc-btn { height: 32px; padding: 0 8px; border-color: transparent; background: transparent; color: var(--ink-2); }
.segmented .mc-btn:hover { color: var(--ink); background: var(--seg-hover); }
.segmented .mc-btn[aria-pressed='true'] { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.dim-btn::before { content: ''; width: 14px; height: 14px; border-radius: 3px; background-size: cover; image-rendering: pixelated; flex: none; }
.dim-btn[data-dim='0']::before { background-image: url('../img/grass_side.png'); }
.dim-btn[data-dim='-1']::before { background-image: url('../img/netherrack.png'); }
.dim-btn[data-dim='1']::before { background-image: url('../img/endstone.png'); }

/* ---------- Formularfelder ---------- */
.label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 0 0 6px; }
.mc-input, .mc-select {
  font: 400 14px var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  width: 100%;
  height: 36px;
}
.mc-input.mono { font-family: var(--mono); }
.mc-input:focus, .mc-select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(61, 139, 42, 0.15); }
.mc-input::placeholder { color: var(--ink-3); }
.mc-select {
  appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Schalter */
.mc-check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; color: var(--ink); }
.mc-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mc-check .box {
  width: 30px; height: 18px; flex: none;
  border-radius: 9px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.15s;
}
.mc-check .box::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--knob);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.mc-check input:checked + .box { background: var(--green); }
.mc-check input:checked + .box::after { transform: translateX(12px); }
.mc-check input:focus-visible + .box { outline: 2px solid var(--focus); outline-offset: 2px; }
.mc-check input:disabled + .box { opacity: 0.45; }

.mc-range { width: 100%; accent-color: var(--green); margin: 4px 0 0; }

.hint { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 0; line-height: 1.45; }
.mono { font-family: var(--mono); }

/* ---------- Karten-Popup, Meldungen ---------- */
.mc-tip {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  font-size: 14px;
}

/* ---------- Startseite ---------- */
.home-hero {
  max-width: 1160px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 48px;
  align-items: center;
}
.eyebrow { font-family: var(--pixel); font-size: 13px; color: var(--green-dark); margin: 0 0 14px; letter-spacing: 0.02em; }
.home-hero h1 { font-size: clamp(34px, 4.4vw, 52px); margin: 0 0 16px; font-weight: 700; letter-spacing: -0.03em; }
.home-hero h1 em { font-style: normal; color: var(--green); }
.home-hero .lead { font-size: 17px; color: var(--ink-2); margin: 0 0 26px; max-width: 520px; }
.quick-seed { display: grid; gap: 10px; max-width: 520px; }
.quick-seed .row { display: flex; gap: 8px; }
.quick-seed .row .mc-input { height: 44px; font-size: 15px; flex: 1; min-width: 0; font-family: var(--mono); }
.quick-seed .row .mc-btn { height: 44px; padding: 0 18px; font-size: 15px; }
.quick-seed .segmented { max-width: 260px; }
.facts { display: flex; gap: 10px 22px; flex-wrap: wrap; margin: 26px 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 14px; }
.facts li { display: flex; align-items: center; gap: 8px; }
.facts li::before { content: ''; width: 8px; height: 8px; background: var(--green); flex: none; }

.preview {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  background: #0c1a2b;
  aspect-ratio: 4 / 3;
}
.preview canvas { width: 100%; height: 100%; display: block; }
.preview .chip {
  position: absolute; left: 12px; bottom: 12px;
  background: var(--chip);
  border-radius: 8px;
  padding: 6px 10px;
  font: 500 13px var(--mono);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.preview .open { position: absolute; right: 12px; bottom: 12px; }

.section { max-width: 1160px; margin: 0 auto; padding: 28px 24px 56px; }
.section h2 { font-size: 22px; margin: 0 0 6px; }
.section > p { color: var(--ink-2); margin: 0 0 22px; }
.tool-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tool-list li { border-bottom: 1px solid var(--line); }
.tool-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 8px;
  color: var(--ink);
  text-decoration: none;
}
a.tool-row:hover { background: var(--surface); color: var(--ink); }
a.tool-row:hover .go { color: var(--green); transform: translateX(2px); }
.tool-row .tile { width: 44px; height: 44px; border-radius: 8px; background-size: cover; image-rendering: pixelated; }
.tool-row h3 { font-size: 16px; margin: 0 0 2px; }
.tool-row p { margin: 0; color: var(--ink-2); font-size: 14px; }
.tool-row .go { font-size: 20px; color: var(--ink-3); transition: transform 0.15s; }
.tool-row .state { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.tool-row.soon .tile { filter: grayscale(0.6); opacity: 0.7; }

.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; border-top: 1px solid var(--line); padding-top: 26px; }
.how h3 { font-size: 15px; margin: 0 0 6px; }
.how p { margin: 0; color: var(--ink-2); font-size: 14px; }

/* ---------- Fußzeile ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: 13px; }
.site-foot .inner { max-width: 1160px; margin: 0 auto; padding: 20px 24px; display: flex; gap: 12px 24px; flex-wrap: wrap; align-items: center; }
.site-foot nav { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.site-foot a { color: var(--ink-2); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Rechtstexte ---------- */
.content { max-width: 760px; margin: 0 auto; padding: 48px 24px 64px; }
.content h1 { font-size: 32px; margin: 0 0 24px; }
.content h2 { font-size: 18px; margin: 30px 0 8px; }
.content p, .content li { color: var(--ink-2); }
.page-404 { text-align: center; padding: 90px 24px; }
.page-404 h1 { font-family: var(--pixel); font-size: 30px; font-weight: 400; color: #b3261e; margin: 0 0 10px; }
.page-404 p { color: var(--ink-2); margin: 0 0 24px; }
.page-404 .btn-row { justify-content: center; }
.page-404 .btn-row > .mc-btn { flex: none; }

/* ---------- Seedmap ---------- */
body.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
html:has(body.app) { overflow: hidden; }
.app-main { flex: 1; display: flex; min-height: 0; overflow: hidden; }

.sidebar {
  width: 340px;
  flex: none;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar .mc-panel { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sidebar .mc-panel h2, .panel-head h2, .faq h1 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.field + .field { margin-top: 14px; }
.seed-row { display: flex; gap: 6px; }
.seed-row .mc-input { flex: 1; min-width: 0; font-family: var(--mono); }
.xz-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.xz-row label { font-size: 13px; font-weight: 500; color: var(--ink-2); display: grid; gap: 6px; }
.xz-row .mc-input { font-family: var(--mono); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { margin: 0 !important; }
.panel-head .btn-row .mc-btn { height: 26px; font-size: 12.5px; padding: 0 8px; }

.struct-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; margin: 0 -8px; padding: 0; list-style: none; }
.struct-item { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 8px; border-radius: 8px; }
.struct-item:hover { background: var(--surface-2); }
.struct-item .slot { width: 26px; height: 26px; flex: none; display: grid; place-items: center; }
.struct-item .slot canvas { width: 24px; height: 24px; }
.struct-item .mc-check { flex: 1; min-width: 0; flex-direction: row-reverse; }
.struct-item .name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.struct-item .count { font: 500 12px var(--mono); color: var(--ink-3); min-width: 30px; text-align: right; }
.struct-item .go { height: 26px; width: 26px; padding: 0; font-size: 14px; border-color: transparent; background: transparent; color: var(--ink-3); }
.struct-item .go:hover { background: var(--surface); border-color: var(--line); color: var(--green); }
.struct-item.unavailable { opacity: 0.45; }

.near-list { list-style: none; margin: 0 -8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.near-list button {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  font: 400 13.5px var(--font); color: var(--ink);
  background: transparent; border: 0; border-radius: 8px;
  padding: 6px 8px; cursor: pointer; text-align: left;
}
.near-list button:hover { background: var(--surface-2); }
.near-list canvas { width: 20px; height: 20px; flex: none; }
.near-list button span:not(.d) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.near-list .d { margin-left: auto; color: var(--ink-3); white-space: nowrap; font: 500 12px var(--mono); }
.near-list .hint { padding: 0 8px; }

/* Karte */
.map-wrap { flex: 1; position: relative; min-width: 0; background: #0c1a2b; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
#map.on-marker { cursor: pointer; }

.map-tools {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.map-tools .mc-btn { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 0; font-size: 20px; font-weight: 400; }
.map-tools .mc-btn + .mc-btn { border-top: 1px solid var(--line); }

.debug {
  position: absolute; left: 14px; bottom: 14px; z-index: 3;
  display: flex; flex-wrap: wrap; gap: 6px;
  max-width: calc(100% - 28px);
  pointer-events: none;
}
.debug > span {
  background: var(--chip);
  color: var(--ink);
  border-radius: 8px;
  padding: 5px 9px;
  font: 500 12.5px var(--mono);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}
.debug .k { color: var(--ink-3); font-weight: 400; }
#dbgSeed { display: none; }

.loading {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 3; display: none; align-items: center; gap: 10px;
  padding: 8px 12px; font-size: 13px; white-space: nowrap;
}
.loading.show { display: flex; }
.loading .bar { width: 120px; height: 4px; background: var(--surface-2); border-radius: 2px; position: relative; overflow: hidden; }
.loading .bar i { position: absolute; inset: 0; width: 0; background: var(--green); transition: width 0.15s; }

.popup { position: absolute; z-index: 4; width: 280px; display: none; padding: 14px 16px; }
.popup.show { display: block; }
.popup h3 { margin: 0 0 2px; font-size: 16px; display: flex; align-items: center; gap: 8px; padding-right: 20px; }
.popup h3 canvas { width: 24px; height: 24px; }
.popup .sub { color: var(--ink-2); font-size: 13px; margin: 6px 0; }
.popup dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 10px 0 12px; font-size: 13.5px; }
.popup dt { color: var(--ink-3); }
.popup dd { margin: 0; font-family: var(--mono); font-size: 13px; }
.popup .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.popup .acts .mc-btn:first-child { font-family: var(--mono); font-size: 12px; }
.popup .close { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 6px; background: none; border: 0; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; }
.popup .close:hover { background: var(--surface-2); color: var(--ink); }

.toast { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 20; display: none; padding: 9px 14px; }
.toast.show { display: block; }

.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:first-of-type { border-top: 0; padding-top: 0; }
.faq summary { cursor: pointer; font-weight: 500; font-size: 14px; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--ink-3); }
.faq details[open] summary::after { content: '–'; }
.faq p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.legal { font-size: 12px; color: var(--ink-3); padding: 16px 20px 24px; margin: 0; }
.legal a { color: var(--ink-2); }

.menu-toggle { display: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; gap: 32px; padding-top: 36px; }
  .how { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 10; top: 0; bottom: 0; left: 0;
    width: min(340px, 88vw);
    transform: translateX(-105%);
    transition: transform 0.2s;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35); }
  .menu-toggle { display: inline-flex; }
  .site-head { padding: 0 12px; gap: 10px; }
  .app .site-nav a:not([aria-current]) { display: none; }
  #dbgChunk { display: none; }
  .map-tools { top: 10px; right: 10px; }
  .map-tools .mc-btn { width: 38px; height: 38px; }
  .debug { left: 10px; bottom: 10px; }
}
@media (max-width: 520px) {
  .site-foot nav { margin-left: 0; }
  .tool-row { grid-template-columns: 40px minmax(0, 1fr); }
  .tool-row .go, .tool-row .state { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

body:not(.app) { min-height: 100vh; display: flex; flex-direction: column; }
body:not(.app) > main { flex: 1; }

/* Umschalter Hell/Dunkel */
.theme-btn { width: 36px; padding: 0; border-color: transparent; background: transparent; color: var(--ink-2); }
.theme-btn:hover { color: var(--ink); }
.theme-btn .moon { display: none; }
:root[data-theme='dark'] .theme-btn .sun { display: none; }
:root[data-theme='dark'] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-btn .sun { display: none; }
  :root:not([data-theme='light']) .theme-btn .moon { display: block; }
}
.site-nav + .theme-btn { margin-left: -10px; }

/* Biom-Legende */
.legend { list-style: none; margin: 0 -8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1px 4px; max-height: 260px; overflow-y: auto; }
.legend button {
  width: 100%; display: flex; align-items: center; gap: 8px;
  font: 400 13px var(--font); color: var(--ink); text-align: left;
  background: transparent; border: 0; border-radius: 7px; padding: 4px 8px; cursor: pointer;
}
.legend button:hover, .legend button[aria-pressed='true'] { background: var(--surface-2); }
.legend button[aria-pressed='true'] { box-shadow: inset 0 0 0 1px var(--green); }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.legend .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile Schnellzugriffsleiste */
.mobile-bar { display: none; }
@media (max-width: 860px) {
  .mobile-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3;
    padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  }
  .mobile-bar .mc-btn { border: 0; height: 40px; font-size: 13px; padding: 0 4px; }
  .debug { bottom: 70px; }
}

[hidden] { display: none !important; }

/* ---------- Navigation scrollbar auf kleinen Bildschirmen ---------- */
.site-nav { overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { white-space: nowrap; }
@media (max-width: 640px) { body:not(.app) .site-nav a { padding: 7px 8px; font-size: 14px; } .logo span { font-size: 16px; } }

/* ---------- Startseite: Vorschau-Info, Schritte, Seeds ---------- */
.preview-tip { position: absolute; transform: translate(-50%, calc(-100% - 22px)); pointer-events: none; padding: 7px 10px; display: grid; gap: 1px; font-size: 13px; white-space: nowrap; z-index: 2; }
.preview-tip span { font: 500 12px var(--mono); color: var(--ink-2); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head p { margin: 0; color: var(--ink-2); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.steps h3 { font-size: 16px; margin: 16px 0 6px; display: flex; align-items: center; gap: 10px; }
.steps p { margin: 0; color: var(--ink-2); font-size: 14px; }
.steps .num { width: 24px; height: 24px; border-radius: 6px; background: var(--green-soft); color: var(--green); font: 600 13px var(--mono); display: grid; place-items: center; }
.step-shot { height: 150px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: grid; place-content: center; gap: 12px; padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.shot-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 4px 4px 12px; background: var(--surface); min-width: 230px; justify-content: space-between; }
.shot-seg { width: 230px; }
.shot-seg .mc-btn { height: 28px; font-size: 13px; }
.shot-map { background: linear-gradient(135deg, #7fae58 0 40%, #4d89b9 40% 52%, #55913f 52%); }
.shot-icon { position: absolute; left: 30%; top: 58%; width: 30px; height: 30px; background: #fff; border-radius: 7px; padding: 3px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.shot-pop { position: absolute; left: 44%; top: 16%; display: grid; gap: 4px; padding: 10px 12px; }
.shot-pop b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.shot-pop canvas { width: 20px; height: 20px; }
.shot-pop .mono { font-size: 12px; color: var(--ink-2); }
.shot-cmd { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 12px; font-size: 13px; }
.shot-cmd .mc-btn { color: var(--green); }
.seed-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.seed-card { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s; }
.seed-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--ink); }
.seed-card canvas { width: 100%; aspect-ratio: 16 / 10; display: block; background: #0c1a2b; }
.seed-card .body { display: grid; gap: 2px; padding: 12px 14px; }
.seed-card b { font-size: 15px; }
.seed-card .mono { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Tool-Seiten ---------- */
.tool-page { max-width: 980px; margin: 0 auto; padding: 44px 24px 64px; display: grid; gap: 20px; }
.tool-head h1 { font-size: clamp(30px, 4vw, 42px); margin: 0 0 10px; letter-spacing: -0.02em; }
.tool-head .lead { font-size: 16.5px; color: var(--ink-2); margin: 0; max-width: 680px; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; box-shadow: var(--shadow); }
.tool-card h2 { font-size: 18px; margin: 0 0 14px; }
.tool-card > p { color: var(--ink-2); margin: 0 0 16px; }
.prose h3 { font-size: 15px; margin: 18px 0 6px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 20px; margin: 0; display: grid; gap: 6px; }
.convert { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.coords { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.coords legend { padding: 0 6px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.coords label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.coords .mc-input { font-size: 16px; height: 42px; }
.dim-dot { width: 16px; height: 16px; border-radius: 4px; background-size: cover; image-rendering: pixelated; }
.convert-arrow { font-size: 24px; color: var(--ink-3); }
.btn-row.wrap { flex-wrap: wrap; }
.btn-row.wrap > .mc-btn { flex: none; }
.cmd-line { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-3); word-break: break-all; }
.link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.result { display: grid; gap: 10px; }
.result .hint { margin: 0; }
.res-row { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); }
.res-row .mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; color: #fff; }
.res-row.ok { background: var(--green-soft); }
.res-row.ok .mark { background: var(--green); }
.res-row.bad { background: rgba(217, 83, 79, 0.12); }
.res-row.bad .mark { background: #d9534f; }
.res-row b { font-size: 14.5px; }
.res-row p { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }

.circle-tool { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.circle-controls { display: grid; gap: 4px; }
.circle-controls .field { margin-bottom: 10px; }
.small-num { width: 80px; height: 32px; margin-top: 6px; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0 12px; font-size: 14px; }
.stats dt { color: var(--ink-3); }
.stats dd { margin: 0; }
.circle-view canvas { width: 100%; aspect-ratio: 1; display: block; border-radius: var(--radius); border: 1px solid var(--line); cursor: pointer; image-rendering: auto; }

.seed-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.seed-item canvas { width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius); background: #0c1a2b; display: block; }
.seed-item h2 { font-size: 19px; margin: 4px 0 6px; }
.seed-item p { color: var(--ink-2); margin: 0 0 10px; }
.seed-line { display: flex; align-items: center; gap: 10px; }
.seed-line .mono { font-size: 14px; color: var(--ink); }
.facts-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 14px; font-size: 13.5px; }
.facts-dl dt { color: var(--ink-3); }
.facts-dl dd { margin: 0; }

@media (max-width: 900px) {
  .steps, .seed-grid { grid-template-columns: 1fr; }
  .circle-tool { grid-template-columns: 1fr; }
  .seed-item { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .convert { grid-template-columns: 1fr; }
  .convert-arrow { transform: rotate(90deg); justify-self: center; }
  .link-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: start; }
  .tool-card { padding: 18px; }
}

/* ---------- Werkzeuge (gemeinsame Bausteine) ---------- */
.seed-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.seed-form .field + .field { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.form-grid .field + .field { margin-top: 0; }
.form-grid.five { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.form-grid .label { min-height: 2.6em; display: flex; align-items: end; }
.list-out { margin-top: 18px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table td.acts { text-align: right; white-space: nowrap; }
.data-table td.acts .mc-btn + .mc-btn { margin-left: 6px; }
.data-table canvas { display: block; }
.big-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 18px; }
.big { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; background: var(--surface-2); }
.big .label { margin: 0; font-size: 12.5px; }
.big b { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.hint-i { font-size: 12.5px; color: var(--ink-3); }
.total-line { margin: 10px 0 0; font-size: 15px; color: var(--ink-2); }
.coords-3 { grid-template-columns: 1fr 1fr 1.3fr; }
.eye-canvas { width: 100%; max-width: 720px; aspect-ratio: 720 / 420; border-radius: var(--radius); border: 1px solid var(--line); margin-top: 14px; display: block; }
.slime-wrap { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; margin-top: 18px; align-items: start; }
.slime-wrap canvas { width: 100%; aspect-ratio: 1; border-radius: var(--radius); border: 1px solid var(--line); display: block; image-rendering: auto; }
.sub-h { font-size: 15px; margin: 0 0 8px; }
.near-chunks { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; }

.ench-tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; align-items: start; }
.ench-tool h2 { margin-top: 0; }
.ench-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ench-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 8px; align-items: center; padding: 3px 0; }
.ench-row .mc-select { height: 30px; font-size: 13px; padding-right: 26px; }
.ench-row.blocked .n { color: var(--ink-3); }
.ench-row .mc-check { min-width: 0; }
.ench-row .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps-list { list-style: none; margin: 14px 0 10px; padding: 0; display: grid; gap: 8px; counter-reset: s; }
.steps-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; counter-increment: s; }
.steps-list li::before { content: counter(s) '.'; font: 600 13px var(--mono); color: var(--ink-3); min-width: 20px; padding-top: 2px; }
.lv-badge { order: 3; margin-left: auto; background: var(--green-soft); color: var(--green); font: 600 13px var(--mono); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.lv-badge::after { content: ' Lv.'; font-weight: 400; }

.sky { --sun: 25%; position: relative; height: 90px; border-radius: var(--radius); margin: 14px 0; overflow: hidden; transition: background 0.2s; }
.sky::before { content: ''; position: absolute; width: 22px; height: 22px; background: #ffe680; left: calc(var(--sun) - 11px); top: 30px; box-shadow: 0 0 16px rgba(255, 230, 128, 0.8); }
.sky.dark::before { background: #e9eef5; box-shadow: none; left: calc(var(--sun) - 61px); }
.sky span { position: absolute; left: 12px; bottom: 10px; color: #fff; font: 600 14px var(--mono); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, 0.2); cursor: pointer; }
.swatch[aria-pressed='true'] { outline: 2px solid var(--green); outline-offset: 2px; }
#fmts .mc-btn[aria-pressed='true'], .parts .mc-btn[aria-pressed='true'] { background: var(--green-soft); border-color: var(--green); }
.mc-preview { margin: 16px 0; padding: 16px 18px; border-radius: var(--radius); background: #2b2b2b; font: 18px var(--pixel); color: #fff; text-shadow: 2px 2px 0 #3f3f3f; min-height: 56px; word-break: break-word; }
.mc-preview .obf { filter: blur(2px); }
.code-outs { display: grid; gap: 12px; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row code { flex: 1; min-width: 0; font: 12.5px var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; overflow-x: auto; white-space: nowrap; }
.parts { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sw-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; border: 1px solid rgba(0, 0, 0, 0.2); }

.group-h { font-size: 22px; margin: 18px 0 0; }
.ver-line { margin: 0 0 4px; font-size: 13px; color: var(--ink-3); }
.ver { display: inline-block; font: 600 12px var(--mono); color: var(--green); background: var(--green-soft); border-radius: 5px; padding: 2px 7px; }
.ver.old { color: #a8650f; background: rgba(232, 160, 60, 0.15); }
.seed-item h3 { font-size: 19px; margin: 4px 0 6px; }
.tool-group h2 { font-size: 18px; margin: 10px 0 8px; }

@media (max-width: 900px) {
  .seed-form, .ench-tool, .slime-wrap { grid-template-columns: 1fr; }
}

/* ---------- Farm-Anleitungen ---------- */
.crumbs { display: flex; gap: 8px; font-size: 13px; color: var(--ink-3); margin-bottom: -8px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.farm-facts { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 4px; align-content: start; }
.fact .label { margin: 0; font-size: 12.5px; }
.fact b { font-size: 16px; }
.fact p { margin: 0; color: var(--ink-2); font-size: 14px; }
.status { display: inline-block; font: 600 12px var(--font); border-radius: 5px; padding: 2px 8px; }
.status.ok { color: var(--green); background: var(--green-soft); }
.status.warn { color: #a8650f; background: rgba(232, 160, 60, 0.16); }
.status.bad { color: #b3261e; background: rgba(217, 83, 79, 0.12); }
.farm-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px !important; }
.mat-list { margin: 0; padding-left: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; color: var(--ink-2); }
.build-steps { margin: 0; padding: 0; list-style: none; counter-reset: b; display: grid; gap: 10px; }
.build-steps li { counter-increment: b; display: grid; grid-template-columns: 30px 1fr; gap: 12px; color: var(--ink); line-height: 1.5; }
.build-steps li::before { content: counter(b); width: 26px; height: 26px; border-radius: 7px; background: var(--green-soft); color: var(--green); font: 600 13px var(--mono); display: grid; place-items: center; }
.sources li { word-break: break-all; font-size: 13.5px; }
@media (max-width: 760px) {
  .farm-facts { grid-template-columns: 1fr 1fr; }
  .fact.wide { grid-column: 1 / -1; }
  .mat-list { grid-template-columns: 1fr; }
}

/* Vorzeichen-Knopf für Touch-Geräte */
.signed { position: relative; display: block; }
.signed .mc-input { padding-right: 40px; }
.sign-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 32px; height: calc(100% - 6px); border: 0; border-radius: 5px; background: var(--surface-2); color: var(--ink); font: 600 16px var(--font); cursor: pointer; }

/* Grafik-Container für Werkzeuge */
.viz { margin: 16px 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; }
.viz canvas, .viz svg { display: block; width: 100%; height: auto; }
.viz canvas.pixel { image-rendering: pixelated; }

/* ---------- Symbol-Kacheln, verwandte Werkzeuge, FAQ, Fußzeile ---------- */
.tile, .tool-icon, .rel-tile { display: grid; place-items: center; background-size: cover; image-rendering: pixelated; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.tile .glyph { width: 26px; height: 26px; }
.tool-head.has-icon { position: relative; }
.tool-icon { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 16px; box-shadow: var(--shadow), inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.tool-icon .glyph { width: 36px; height: 36px; }
.related { display: grid; gap: 14px; margin-top: 8px; }
.related h2 { font-size: 18px; margin: 0; }
.related > .mc-btn { justify-self: start; }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.rel-card { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.rel-card:hover { border-color: var(--green); transform: translateY(-1px); color: var(--ink); }
.rel-card b { display: block; font-size: 14.5px; }
.rel-card span span { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.rel-tile { width: 40px; height: 40px; border-radius: 9px; flex: none; }
.rel-tile .glyph { width: 22px; height: 22px; }
.faq-block details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq-block details:first-of-type { border-top: 0; padding-top: 0; }
.faq-block summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-block summary::-webkit-details-marker { display: none; }
.faq-block summary::after { content: '+'; color: var(--ink-3); font-weight: 400; }
.faq-block details[open] summary::after { content: '–'; }
.faq-block p { margin: 8px 0 0; color: var(--ink-2); }
.tool-search { margin: 4px 0 6px; }
.tool-search .mc-input { height: 46px; font-size: 16px; }
.foot-cols { max-width: 1160px; margin: 0 auto; padding: 28px 24px 8px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; border-bottom: 1px solid var(--line); }
.foot-cols h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 8px; }
.foot-cols ul { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; }
.foot-cols a { font-size: 13px; }
@media (max-width: 900px) { .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Map-Art ---------- */
.mapart { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.ma-controls { display: grid; gap: 4px; }
.ma-controls .field { margin-bottom: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-3); }
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); margin-bottom: 14px; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--green); background: var(--green-soft); }
.drop-inner { display: grid; gap: 4px; padding: 18px; text-align: center; cursor: pointer; }
.drop-inner b { color: var(--green); }
.drop-inner span { font-size: 13px; color: var(--ink-2); }
.ma-view { display: grid; gap: 12px; position: sticky; top: 12px; }
.ma-stage { position: relative; border-radius: var(--radius); border: 1px solid var(--line); background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px; display: grid; place-items: center; min-height: 320px; overflow: hidden; }
.ma-stage canvas { width: 100%; height: auto; image-rendering: pixelated; display: block; }
.ma-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--ink-2); }
.linkish { background: none; border: 0; padding: 0; color: var(--green); font: inherit; text-decoration: underline; cursor: pointer; }
.ma-tip { position: absolute; pointer-events: none; display: grid; gap: 2px; padding: 7px 10px; font-size: 13px; white-space: nowrap; z-index: 2; }
.ma-tip span { font-size: 12px; color: var(--ink-2); }
.ma-tabs { max-width: 340px; }
.palette-box summary { cursor: pointer; font-size: 13.5px; color: var(--green); margin-top: 10px; }
.palette-list { display: grid; gap: 4px; margin-top: 10px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.pal-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: center; }
.pal-row .mc-select { height: 30px; font-size: 12.5px; }
.sw-dot.big { width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; margin: 0; }
.mat-table td:first-child { width: 28px; }
@media (max-width: 900px) { .mapart { grid-template-columns: 1fr; } .ma-view { position: static; order: -1; } }

/* ---------- Farm-Schemata ---------- */
.farm-fig { margin: 0; display: grid; gap: 14px; }
.farm-fig figcaption { font-weight: 600; font-size: 14.5px; }
.farm-svg-wrap { background: linear-gradient(var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.farm-svg { display: block; width: 100%; height: auto; margin: 0 auto; shape-rendering: crispEdges; }
.farm-svg .mark-n { shape-rendering: auto; }
.farm-notes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 18px; font-size: 14px; color: var(--ink-2); }
.farm-notes li { display: flex; gap: 8px; align-items: flex-start; }
.farm-notes .n { width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #fff; font: 700 11px var(--font); display: grid; place-items: center; flex: none; margin-top: 1px; }
.farm-legend { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-3); }
.farm-legend li { display: flex; align-items: center; gap: 6px; }

/* Kontrast im Dunkelmodus: dunkle Schrift auf hellem Grün, helleres Rot */
:root[data-theme='dark'] .mc-btn.primary, :root[data-theme='dark'] .mc-btn.green,
:root[data-theme='dark'] .mc-btn.primary:hover, :root[data-theme='dark'] .mc-btn.green:hover { color: #0f1a0b; }
:root[data-theme='dark'] .status.bad { color: #ff8a80; }
:root[data-theme='dark'] .status.warn { color: #f2b766; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .mc-btn.primary, :root:not([data-theme='light']) .mc-btn.green,
  :root:not([data-theme='light']) .mc-btn.primary:hover, :root:not([data-theme='light']) .mc-btn.green:hover { color: #0f1a0b; }
  :root:not([data-theme='light']) .status.bad { color: #ff8a80; }
  :root:not([data-theme='light']) .status.warn { color: #f2b766; }
}

/* Tabellen auf schmalen Bildschirmen seitlich scrollbar statt Seitenüberlauf */
.tool-card, .tool-page > * { min-width: 0; }
.table-wrap, .list-out, #materials { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tool-card > .data-table { display: block; overflow-x: auto; }

/* ---------- Schmale Bildschirme: nichts darf die Seite seitlich verbreitern ---------- */
.segmented { grid-auto-columns: minmax(0, 1fr); }
.segmented .mc-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.field, .form-grid > *, .code-outs > *, .tool-card > div, .tool-card > section { min-width: 0; }
.mc-select, .mc-input { min-width: 0; max-width: 100%; }
.code-row { min-width: 0; max-width: 100%; }
pre, .cmd-block { max-width: 100%; overflow-x: auto; }
@media (max-width: 700px) {
  .data-table { display: block; overflow-x: auto; max-width: 100%; }
  .segmented .mc-btn { white-space: normal; height: auto; min-height: 32px; padding: 4px 4px; line-height: 1.2; font-size: 12.5px; }
  .btn-row:not(.wrap) { flex-wrap: wrap; }
  .btn-row > .mc-btn { min-width: 0; }
}
