/* FABULOUS MINDMAP — clean black & white */

@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;
}

:root {
    --black: #0a0a0a;
    --ink: #171717;
    --muted: #6b6b6b;
    --faint: #a3a3a3;
    --line: #e7e7e7;
    --line-strong: #d4d4d4;
    --soft: #f5f5f5;
    --white: #ffffff;
    --warn: #b45309;
    --radius: 14px;
    --radius-sm: 10px;
    --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
    margin: 0;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
::selection { background: var(--black); color: var(--white); }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--black); color: var(--white); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 20px;
    border-radius: 999px; border: 1px solid transparent;
    font-size: 15px; font-weight: 500; letter-spacing: -.01em;
    text-decoration: none; white-space: nowrap;
    transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn--sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn--lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn--block { width: 100%; }
.btn--dark { background: var(--black); color: var(--white); }
.btn--dark:hover { background: #2a2a2a; }
.btn--ghost { background: var(--white); color: var(--black); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--black); }
.btn.is-done { background: var(--black); color: var(--white); border-color: var(--black); }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--black); }

/* ---------- Nav ---------- */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--black); }
.brand__name { font-weight: 500; letter-spacing: .02em; font-size: 15px; }
.brand__name b { font-weight: 800; }

.nav__tag {
    display: none; align-items: center; gap: 10px; margin: 0; padding: 6px 14px;
    border: 1px solid var(--line-strong); border-radius: 999px;
    font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.nav__tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--black); box-shadow: 0 0 0 3px rgba(10,10,10,.12); }
@media (min-width: 720px) { .nav__tag { display: inline-flex; } }

/* ---------- Legal ---------- */
.legal { padding: 64px 0 96px; }
.legal__inner { max-width: 760px; }
.legal h1 { margin: 0 0 8px; font-size: clamp(36px, 6vw, 56px); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; color: var(--black); }
.legal__meta { margin: 0 0 48px; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.legal h2 { margin: 48px 0 12px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: var(--black); }
.legal h3 { margin: 28px 0 8px; font-size: 16px; font-weight: 600; color: var(--black); }
.legal p, .legal li { color: #404040; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal a { text-underline-offset: 3px; }
.legal address { font-style: normal; }
.legal .box { padding: 20px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
.legal .box p { margin: 0; }
.legal .box p + p { margin-top: 12px; }
.legal dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 0; }
.legal dt { color: var(--muted); }
.legal dd { margin: 0; color: var(--ink); }
@media (max-width: 520px) { .legal dl { grid-template-columns: 1fr; gap: 0; } .legal dd { margin-bottom: 10px; } }
.legal .toc { list-style: none; padding: 0; margin: 0 0 8px; columns: 2; column-gap: 24px; font-size: 14px; }
.legal .toc li { margin-bottom: 4px; break-inside: avoid; }
.legal .toc a { color: var(--muted); text-decoration: none; }
.legal .toc a:hover { color: var(--black); }
@media (max-width: 520px) { .legal .toc { columns: 1; } }

/* ---------- 404 ---------- */
.notfound { padding: 120px 0; text-align: center; }
.notfound h1 { margin: 0; font-size: clamp(80px, 16vw, 180px); font-weight: 800; letter-spacing: -.06em; line-height: 1; color: var(--black); }
.notfound p { color: var(--muted); margin: 12px 0 32px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px; min-height: 48px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; color: var(--faint); }
.footer__links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer__links a { text-decoration: none; color: var(--muted); }
.footer__links a:hover { color: var(--black); }

/* toast */
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 90;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 10px 18px; border-radius: 999px; background: var(--black); color: var(--white); font-size: 14px;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,.35);
    transition: all .3s var(--ease);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mindmap app (one screen) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav__end { display: flex; align-items: center; gap: 10px; }
body.page-home { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.page-home .nav { position: static; flex: none; border-bottom-color: var(--line); }
.page-home .nav__inner { height: 60px; }
.page-home main { flex: 1; min-height: 0; display: flex; }
.page-home .footer { flex: none; }
.app { flex: 1; display: flex; max-width: 1600px; padding-top: 16px; padding-bottom: 16px; }
.board { position: relative; flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 20px; overflow: hidden; background: var(--white); }

.stage {
    position: absolute; inset: 0; overflow: hidden; outline: none; touch-action: none;
    background-color: var(--white);
    background-image: radial-gradient(circle, #d9d9d9 1px, transparent 1.3px);
    background-size: 24px 24px;
}
.stage svg { display: block; width: 100%; height: 100%; cursor: grab; user-select: none; -webkit-user-select: none; opacity: 0; transition: opacity .25s; }
.stage.is-ready svg { opacity: 1; }
.stage svg.is-panning { cursor: grabbing; }
.mm-node, .mm-badge { cursor: pointer; }
#mm-edit {
    position: absolute; z-index: 5; box-sizing: border-box; margin: 0; border: 0; background: transparent;
    resize: none; overflow: hidden; outline: none; text-align: center; font-family: var(--sans);
    white-space: pre-wrap; overflow-wrap: anywhere; caret-color: currentColor;
}

/* toolbar */
.toolbar {
    position: absolute; z-index: 10; top: 12px; left: 12px; right: 12px;
    display: flex; align-items: center; gap: 4px; padding: 6px;
    border: 1px solid var(--line-strong); border-radius: 16px;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px -16px rgba(0, 0, 0, .25);
    overflow-x: auto; scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.tb {
    flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px;
    border: 0; border-radius: 10px; background: transparent; color: var(--ink);
    font-size: 13.5px; font-weight: 500; white-space: nowrap; transition: background .15s, opacity .15s;
}
.tb:hover:not(:disabled) { background: var(--soft); }
.tb:disabled { opacity: .3; cursor: default; }
.tb svg { width: 18px; height: 18px; flex: none; }
.tb[aria-expanded="true"] { background: var(--soft); }
.tb--dark { background: var(--black); color: var(--white); padding: 0 10px 0 14px; }
.tb--dark:hover:not(:disabled), .tb--dark[aria-expanded="true"] { background: #2a2a2a; }
.tb-sep { flex: none; width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.tb-spacer { flex: 1; min-width: 6px; }
.color-dot { width: 15px; height: 15px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); background: var(--black); }

/* popovers */
.pop {
    position: absolute; z-index: 20; top: 64px; padding: 8px;
    border: 1px solid var(--line-strong); border-radius: 14px; background: var(--white);
    box-shadow: 0 18px 44px -16px rgba(0, 0, 0, .3);
}
.pop--colors { display: grid; grid-template-columns: repeat(5, 30px); gap: 8px; padding: 12px; }
.swatch { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .15s; }
.swatch:hover { transform: scale(1.1); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--c); }
.pop--menu { display: grid; min-width: 230px; }
.pop--menu button { display: grid; gap: 1px; padding: 9px 12px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 14px; font-weight: 500; color: var(--ink); }
.pop--menu button small { font-size: 12px; font-weight: 400; color: var(--muted); }
.pop--menu button:hover { background: var(--soft); }

/* bottom bar */
.hint {
    position: absolute; z-index: 5; left: 16px; bottom: 16px; margin: 0;
    display: flex; align-items: center; gap: 18px; font-size: 12px; color: var(--muted); pointer-events: none;
}
.hint__keys { display: flex; align-items: center; gap: 6px; }
.hint kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--white); color: var(--ink); }
.hint kbd:not(:first-child) { margin-left: 8px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .9); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }
.status.is-error::before { background: #dc2626; }
.zoom {
    position: absolute; z-index: 10; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 2px; padding: 4px;
    border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(255, 255, 255, .94);
}
.zoom button { height: 32px; min-width: 32px; padding: 0 6px; border: 0; border-radius: 8px; background: none; font-size: 17px; color: var(--ink); }
.zoom button:hover { background: var(--soft); }
#zoom-level { min-width: 60px; font-family: var(--mono); font-size: 12px; }

/* library dialog */
.lib {
    width: min(520px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 48px)); padding: 0;
    border: 1px solid var(--line-strong); border-radius: 20px; color: var(--ink); background: var(--white);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .35);
}
.lib[open] { display: flex; flex-direction: column; }
.lib::backdrop { background: rgba(10, 10, 10, .35); }
.lib__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 0 22px; }
.lib__head h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.02em; color: var(--black); }
.lib__x { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; font-size: 24px; line-height: 1; color: var(--muted); }
.lib__x:hover { background: var(--soft); color: var(--black); }
.lib__note { margin: 6px 22px 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.lib__note strong { color: var(--ink); font-weight: 600; }
.lib__list { flex: 1; min-height: 0; margin: 0; padding: 0 12px; list-style: none; overflow-y: auto; }
.lib__item { display: flex; align-items: center; gap: 4px; border-radius: 12px; }
.lib__item:hover, .lib__item.is-current { background: var(--soft); }
.lib__open { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 10px 12px; border: 0; background: none; text-align: left; color: var(--ink); }
.lib__open strong { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib__open small { font-size: 12px; color: var(--muted); }
.lib__item.is-current .lib__open small::after { content: " · geöffnet"; color: var(--black); }
.lib__del { flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-right: 6px; border: 0; border-radius: 9px; background: none; color: var(--faint); }
.lib__del:hover { background: var(--white); color: #dc2626; }
.lib__del svg { width: 18px; height: 18px; }
.lib__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }

/* confirmation modal */
.ask {
    width: min(440px, calc(100vw - 32px)); padding: 0;
    border: 1px solid var(--line-strong); border-radius: 20px; color: var(--ink); background: var(--white);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .35);
}
.ask::backdrop { background: rgba(10, 10, 10, .35); }
.ask[open] { animation: ask-in .18s var(--ease); }
@keyframes ask-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.ask__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 16px 0 22px; }
.ask__head h2 { margin: 4px 0 0; font-size: 19px; font-weight: 650; line-height: 1.3; letter-spacing: -.02em; color: var(--black); overflow-wrap: anywhere; }
.ask__text { margin: 8px 22px 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.ask__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 20px 22px 20px; }
.btn--danger { background: #dc2626; color: var(--white); }
.btn--danger:hover { background: #b91c1c; }

@media (max-width: 1180px) { .tb__label:not(.tb__label--keep) { display: none; } .hint__keys { display: none; } }
@media (max-width: 959px) {
    .page-home .nav__inner { height: 52px; }
    .app { padding-top: 10px; padding-bottom: 10px; }
    .board { border-radius: 16px; }
    .toolbar { top: 8px; left: 8px; right: 8px; border-radius: 14px; }
    .page-home .footer__inner { min-height: 40px; justify-content: center; font-size: 12px; }
    .page-home .footer__inner > span { display: none; }
}
@media (max-width: 759px) {
    .toolbar { flex-wrap: wrap; row-gap: 2px; overflow: visible; }
    .tb-spacer { flex-basis: 100%; height: 0; }
    .tb-sep { display: none; }
    .tb__label--keep { display: inline; }
}
@media (max-width: 520px) { .tb { padding: 0 8px; } .hint { left: 12px; bottom: 12px; } }
