/* Stil „welt“: die dunkle, gezeichnete Welt aus Franks alter Zentrale.
   Gilt nur unter <html data-stil="welt">; der Rest der App bleibt im Apple-Stil. */

[data-stil="welt"] {
  color-scheme: dark;
  --schrift: Inter, system-ui, -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
  --schrift-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --farbe-hintergrund: #0a0c11;
  --farbe-flaeche: #11141b;
  --farbe-flaeche-2: #171b24;
  --farbe-flaeche-gedrueckt: #1d2230;
  --farbe-linie: #232836;
  --farbe-text: #e9ebf1;
  --farbe-text-leise: #8b91a1;
  --farbe-text-dunkel: #5d6373;
  --farbe-akzent: #ffffff;
  --farbe-auf-akzent: #0a0c11;
  --farbe-fehler: #ff6b6b;
  --farbe-fehler-flaeche: #3a1416;
  --farbe-hinweis-flaeche: #1d2230;
  --farbe-bereit: #3ddc97;
  --farbe-ohne-link: #6b7180;
  --farbe-aufbau: #f5b942;
  /* Neues Konzept: Kategorie springt ins Auge, Status ist dezent */
  --kat-arbeit: #9fb4ff;
  --kat-privat: #ffd29a;
  --status-live: #3ddc97;
  --status-in-arbeit: #f5b942;
  --status-idee: #7d8495;
  --status-aus: #5d6373;
  --typ-symbol: #c9cdd6;
  --haus-buero: #9fb4ff;
  --haus-studio: #e9ebf1;
  --haus-zuhause: #ffd29a;
  --studio-schild: #ffffff;
  --studio-schrift: #1c1f26;
  --studio-zone: #8a909c;
  --schatten: none;
  --inhalt-max: 1180px;
}

[data-stil="welt"] body {
  background: radial-gradient(1200px 600px at 70% -10%, #1a2140 0%, transparent 60%), var(--farbe-hintergrund);
}

@layer komponenten {
  [data-stil="welt"] {
    .welt-kopf { display: flex; align-items: center; gap: var(--abstand-3); flex-wrap: wrap; max-width: var(--inhalt-max); margin-inline: auto; padding: var(--abstand-4) var(--abstand-4) 0; }
    .marke { display: flex; align-items: center; gap: 11px; margin-inline-end: auto; text-decoration: none; color: inherit; }
    .logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #ffd25a, #ff8a4c); display: grid; place-items: center; font-weight: 700; color: #1a1206; font-size: 15px; }
    .marke b { display: block; font-size: 16px; letter-spacing: -0.01em; }
    .marke span { font-size: 12px; color: var(--farbe-text-leise); }

    .tabs { display: flex; background: var(--farbe-flaeche); border: 1px solid var(--farbe-linie); border-radius: 12px; padding: 4px; }
    .tabs a { display: inline-flex; align-items: center; min-height: var(--touch-min); padding: 0 16px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--farbe-text-leise); text-decoration: none; }
    .tabs a[aria-current="page"] { background: #fff; color: #0a0c11; }

    h1 { font-size: 28px; }
    .unter { color: var(--farbe-text-leise); margin-top: 6px; font-size: 15px; }

    .chips { display: flex; gap: 8px; flex-wrap: wrap; margin: var(--abstand-4) 0; }
    .chip { display: inline-flex; align-items: center; gap: 7px; min-height: var(--touch-min); border: 1px solid var(--farbe-linie); background: var(--farbe-flaeche); border-radius: 999px; padding: 0 14px; font-size: 13px; white-space: nowrap; color: var(--farbe-text); cursor: pointer; }
    .chip[aria-pressed="true"] { border-color: #fff; background: #fff; color: #0a0c11; }
    span.chip { cursor: default; }
    .punkt { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

    .buehne { position: relative; border: 1px solid var(--farbe-linie); background: linear-gradient(180deg, #0e1118, #0b0d13); border-radius: 18px; overflow: hidden; margin-top: var(--abstand-4); }
    .buehne svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
    .legende { display: flex; align-items: center; gap: 10px 16px; padding: 12px 16px 14px; border-top: 1px solid var(--farbe-linie); font-size: 12px; color: var(--farbe-text-leise); flex-wrap: wrap; }
    .legende > span { display: inline-flex; align-items: center; gap: 7px; }

    .haeuser { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; margin-top: var(--abstand-4); }
    .haus-karte { display: flex; flex-direction: column; gap: 8px; background: var(--farbe-flaeche); border: 1px solid var(--farbe-linie); border-radius: 16px; padding: 16px; color: inherit; text-decoration: none; }
    .haus-karte b { font-size: 17px; }
    .oben-zeile { display: flex; align-items: center; gap: 8px; }
    .haus-karte .chips { margin: 4px 0 0; }
    .haus-karte p { font-size: 13.5px; color: var(--farbe-text-leise); }

    .liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; margin-top: 22px; }
    .liste-kopf { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--farbe-text-leise); margin-top: 10px; }
    .karte-w { display: flex; flex-direction: column; gap: 6px; min-height: var(--touch-min); background: var(--farbe-flaeche); border: 1px solid var(--farbe-linie); border-radius: 14px; padding: 14px; text-align: left; color: inherit; text-decoration: none; font: inherit; cursor: pointer; }
    .karte-w .oben { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
    .karte-w b { font-size: 15px; }
    .karte-w p { font-size: 13px; color: var(--farbe-text-leise); line-height: 1.4; }
    .status { font-size: 11.5px; font-family: var(--schrift-mono); padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; background: var(--farbe-flaeche-2); color: var(--farbe-text-leise); margin-inline-start: auto; }
    .w-knopf { display: inline-flex; align-items: center; justify-content: center; min-height: var(--touch-min); gap: 6px; border-radius: 10px; padding: 0 16px; font-size: 14px; font-weight: 600; border: 1px solid var(--farbe-linie); background: var(--farbe-flaeche-2); color: var(--farbe-text); text-decoration: none; transition: transform .2s cubic-bezier(.3,1.4,.5,1); }
    .w-knopf:active { transform: scale(.96); }
    .w-knopf.haupt { background: #fff; color: #0a0c11; border-color: #fff; }
    .w-knopf[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; font-weight: 500; }

    /* Kartentyp als kleines Symbol */
    .typ { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--farbe-flaeche-2); border: 1px solid var(--farbe-linie); }
    .typ svg { fill: none; stroke: var(--typ-symbol); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .legende .typ { width: 22px; height: 22px; border-radius: 6px; }
    .legende .typ svg { width: 13px; height: 13px; }
    .karte-w .oben { justify-content: flex-start; }
    .karte-w .oben b { min-width: 0; overflow-wrap: anywhere; }
    .karte-w .unten { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: auto; padding-top: 6px; }
    .karte-w .unten .kat { margin-inline-end: auto; }
    .karte-w.aus b { color: var(--farbe-text-leise); }
    .kat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--farbe-text-leise); }

    /* Punkte: Kategorie kräftig, Status klein */
    .punkt.kat-arbeit, .kat-arbeit .punkt { background: var(--kat-arbeit); }
    .punkt.kat-privat, .kat-privat .punkt { background: var(--kat-privat); }
    .punkt.klein { width: 6px; height: 6px; }
    .s-live .punkt, .punkt.s-live { background: var(--status-live); }
    .s-in_arbeit .punkt, .punkt.s-in_arbeit { background: var(--status-in-arbeit); }
    .s-idee .punkt, .punkt.s-idee { background: var(--status-idee); }
    .s-aus .punkt, .punkt.s-aus { background: var(--status-aus); }
    .haus-buero > .oben-zeile .punkt { background: var(--haus-buero); }
    .haus-studio > .oben-zeile .punkt { background: var(--haus-studio); }
    .haus-zuhause > .oben-zeile .punkt { background: var(--haus-zuhause); }
    .haus-karte .chip { gap: 8px; }
    .haus-karte .chip .typ { width: 22px; height: 22px; border-radius: 6px; }
    .haus-karte .chip .typ svg { width: 13px; height: 13px; }
    .haus-karte .fehlt { color: var(--status-in-arbeit); }

    .zurueck-w { display: inline-flex; align-items: center; min-height: var(--touch-min); margin-bottom: 4px; font-size: 15px; font-weight: 600; color: var(--farbe-text-leise); text-decoration: none; }
    .zurueck-w:hover { color: var(--farbe-text); }
    .legende .trenner { width: 1px; height: 14px; background: var(--farbe-linie); }
    .buehne-rahmen { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
    .buehne-rahmen::-webkit-scrollbar { display: none; }
    .studio-liste { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
    .zone-gruppe .liste-kopf { margin: 18px 0 10px; }
    .raster-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    h2.liste-kopf { font-weight: 600; }
    .schrank { margin-top: 28px; border-top: 1px solid var(--farbe-linie); padding-top: 6px; }
    .schrank > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--farbe-text-leise); list-style: none; }
    .schrank > summary::-webkit-details-marker { display: none; }
    .schrank > summary::before { content: "›"; font-size: 18px; transition: transform .2s; }
    .schrank[open] > summary::before { transform: rotate(90deg); }
    .schrank .unter { margin: 0 0 10px; }

    /* Fenster für Bücherregal und Werkzeugschrank */
    dialog.fenster { margin: 0 0 0 auto; height: 100dvh; max-height: none; width: min(440px, 100%); border: 0; border-left: 1px solid var(--farbe-linie); background: #10131a; color: var(--farbe-text); padding: 0; overflow-y: auto; }
    dialog.fenster::backdrop { background: rgb(0 0 0 / 0.5); }
    .fenster-innen { padding: 22px 20px 40px; min-height: 100%; display: flex; flex-direction: column; gap: 12px; }
    .f-kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
    .f-kopf h2 { font-size: 21px; flex: 1; }
    .f-kopf .typ { width: 40px; height: 40px; border-radius: 12px; }
    .zu { width: var(--touch-min); height: var(--touch-min); border-radius: 10px; border: 1px solid var(--farbe-linie); background: none; color: var(--farbe-text-leise); font-size: 20px; flex: none; cursor: pointer; }

    .abmelden { min-height: var(--touch-min); order: 3; }
    .tabs { order: 2; }
  }

  /* SVG: Schriften und Bedeutungs-Farben über Klassen (statt style-Attributen) */
  .welt-svg {
    .bld, a.karte-svg { cursor: pointer; }
    .bld { transition: filter 0.2s; }
    .bld:hover, a.karte-svg:hover { filter: brightness(1.12); }
    a.karte-svg:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
    .karte-svg { transition: opacity .25s; }
    .karte-svg.platzhalter { opacity: .35; }
    .ohne-link { cursor: default; }
    .pill:hover .pill-r { stroke-opacity: 1; }
    .pill-r { fill: #141821; fill-opacity: .95; }
    .ohne-link .pill-r { stroke-dasharray: 3 3; }
    .ohne-link .lbl { fill: #9aa0ae; }
    .typ-icon path { fill: none; stroke: var(--typ-symbol); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
    .lbl { font: 600 11px var(--schrift); fill: #eef0f5; }
    .lbls { font: 8px var(--schrift-mono); fill: #9aa0ae; }
    .zone { font: 700 11px var(--schrift); letter-spacing: 2px; }
    .zonesub { font: 6.5px var(--schrift-mono); letter-spacing: 1.5px; opacity: 0.75; }
    .sammlung-svg { cursor: pointer; }
    .sammlung-svg:hover { filter: brightness(1.15); }
    .lbl .lbls { font: 8px var(--schrift-mono); fill: #9aa0ae; }
    .haus-t { font: 700 12px var(--schrift); fill: #eef0f5; }
    .haus-s { font: 8px var(--schrift-mono); fill: #9aa0ae; }
    .schild { fill: #141821; fill-opacity: .95; stroke-opacity: .8; }
    .schild-linie { stroke-opacity: .5; }
    .schild-buero { stroke: var(--haus-buero); }
    .schild-studio { stroke: var(--haus-studio); }
    .schild-zuhause { stroke: var(--haus-zuhause); }

    /* Kategorie (kräftig) und Status (kleines Licht) */
    .k-arbeit { fill: var(--kat-arbeit); }
    .k-privat { fill: var(--kat-privat); }
    .leuchtflaeche { opacity: .32; }
    .bildschirm { opacity: .95; }
    .s-live { fill: var(--status-live); }
    .s-in_arbeit { fill: var(--status-in-arbeit); }
    .s-idee { fill: var(--status-idee); }
    .s-aus { fill: var(--status-aus); }
    .karte-svg.idee { opacity: .82; }

    /* Lebendige Mitte: Datenfluss vom Kern zu jedem Platz */
    .flow { stroke-dasharray: 3 7; animation: flow 1.6s linear infinite; }
    .ring { animation: ring 2.8s ease-out infinite; transform-origin: center; transform-box: fill-box; }
    .float { animation: float 3s ease-in-out infinite; }
    .glow { animation: glow 3s ease-in-out infinite; }

    /* Studio innen */
    .s-schild { fill: var(--studio-schild); filter: drop-shadow(0 3px 6px rgb(10 16 28 / .22)); }
    .s-name { font: 600 12.5px var(--schrift); fill: var(--studio-schrift); }
    .s-faden { stroke: #8a909c; stroke-opacity: .55; }
    .s-zone { font: 700 8.5px var(--schrift); letter-spacing: .6px; fill: #5d6676; }
    .frei { font: 500 11px var(--schrift); fill: #8a6b4a; }
  }
  /* Filter im Studio: Passendes bleibt, der Rest tritt zurück */
  .welt-svg[data-filter="arbeit"] .karte-svg:not(.kat-arbeit),
  .welt-svg[data-filter="privat"] .karte-svg:not(.kat-privat),
  .welt-svg[data-filter="in_arbeit"] .karte-svg:not(.st-in_arbeit) { opacity: .18; }
}

@media (max-width: 1000px) { [data-stil="welt"] .raster-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { [data-stil="welt"] .raster-4 { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  [data-stil="welt"] {
    dialog.fenster { margin: auto 0 0; width: 100%; max-width: 100%; height: 88dvh; border-left: 0; border-top: 1px solid var(--farbe-linie); border-radius: 18px 18px 0 0; }
    .tabs { width: 100%; order: 4; }
    .tabs a { flex: 1; justify-content: center; padding: 0 6px; }
    h1 { font-size: 24px; }
  }
}

@keyframes flow { to { stroke-dashoffset: -20; } }
@keyframes ring { 0% { opacity: 0.8; transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes float { 50% { transform: translateY(-4px); } }
@keyframes glow { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .welt-svg .flow, .welt-svg .ring, .welt-svg .float, .welt-svg .glow { animation: none; }
}
