/* claude starter – Aussehen. Mobil zuerst, hell und dunkel über dieselben Variablen. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --ink: #172026;
  --soft: #45555b;
  --muted: #56656b;
  --line: #cad5d2;
  --line-soft: #dce4e1;
  --field: #a9b8b4;
  --tile-line: #d5dedb;
  --accent: #0e5a62;
  --accent-hover: #0a434a;
  --on-accent: #ffffff;
  --tile-on: #e2eeec;
  --code-bg: #eef3f1;
  --panel: #0f3b42;
  --panel-2: #0a2e34;
  --panel-ink: #e6f0ee;
  --panel-muted: #9db8b6;
  --panel-line: #4f7f82;
  --panel-guide: #5e8c8f;
  --signal: #f2c230;
  --signal-hover: #f6cf52;
  --signal-ink: #172026;
  --scrim: rgba(15, 59, 66, 0.55);
  --focus: #0e5a62;

  --sans: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, 'Cascadia Mono', 'Segoe UI Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --gutter: 16px;
  --radius: 12px;
}

/* Dunkle Werte: einmal fürs System, einmal für die Wahl über den Knopf */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #10191c;
    --surface: #172327;
    --surface-2: #1b292d;
    --ink: #e3ecea;
    --soft: #b6c6c4;
    --muted: #9fb2b0;
    --line: #2b3b40;
    --line-soft: #24343a;
    --field: #4a5e63;
    --tile-line: #2b3b40;
    --accent: #5ec0bc;
    --accent-hover: #86d3cf;
    --on-accent: #0b1a1c;
    --tile-on: #163a3e;
    --code-bg: #1e2d31;
    --panel: #0e3439;
    --panel-2: #0a272b;
    --scrim: rgba(0, 0, 0, 0.6);
    --focus: #5ec0bc;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #10191c;
  --surface: #172327;
  --surface-2: #1b292d;
  --ink: #e3ecea;
  --soft: #b6c6c4;
  --muted: #9fb2b0;
  --line: #2b3b40;
  --line-soft: #24343a;
  --field: #4a5e63;
  --tile-line: #2b3b40;
  --accent: #5ec0bc;
  --accent-hover: #86d3cf;
  --on-accent: #0b1a1c;
  --tile-on: #163a3e;
  --code-bg: #1e2d31;
  --panel: #0e3439;
  --panel-2: #0a272b;
  --scrim: rgba(0, 0, 0, 0.6);
  --focus: #5ec0bc;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  font-optical-sizing: auto;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
code, kbd, pre { font-family: var(--mono); }
code { font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Seite und Kopf ---------- */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 32px;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; }
.wordmark {
  margin: 0;
  font-size: clamp(30px, 4vw, 36px);
  line-height: 1;
  font-weight: 800;
  font-stretch: 78%;
  letter-spacing: -0.01em;
}
.tagline { margin: 0; color: var(--muted); max-width: 62ch; }
.header-nav { display: flex; align-items: center; gap: 8px; }
.header-link { font-weight: 600; padding: 10px 12px; text-decoration: none; }
.header-link:hover { text-decoration: underline; }

.icon-button {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--field); }
.icon-sun { display: none; }
:root[data-theme='dark'] .icon-sun { display: block; }
:root[data-theme='dark'] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-sun { display: block; }
  :root:not([data-theme='light']) .icon-moon { display: none; }
}

/* ---------- Aufteilung: links auswählen, rechts das Paket ---------- */

.layout { display: grid; gap: 40px; padding-top: 28px; }
.config { min-width: 0; display: flex; flex-direction: column; gap: 44px; padding-bottom: 32px; }

.section-title {
  margin: 0;
  font-size: 26px; line-height: 1.2;
  font-weight: 750; font-stretch: 88%;
}

/* ---------- Projekt ---------- */

.project { display: flex; flex-direction: column; gap: 20px; }
.field-row { display: grid; gap: 20px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 650; padding: 0; }
.field > legend { margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--muted); }
.hint { margin: 0; font-size: 14px; color: var(--muted); }

.input {
  width: 100%;
  font: inherit; font-size: 17px;
  padding: 11px 14px;
  border: 1px solid var(--field); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus-visible { outline-offset: 1px; }
textarea.input { resize: vertical; min-height: 76px; font-size: 16px; }

.segmented {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
  padding: 4px;
  border: 1px solid var(--field); border-radius: var(--radius);
  background: var(--surface);
}
.segment { position: relative; cursor: pointer; }
.segment input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segment span {
  display: block; text-align: center;
  padding: 8px 12px; border-radius: 8px;
  font-weight: 600;
}
.segment input:checked + span { background: var(--accent); color: var(--on-accent); }
.segment input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Skills ---------- */

.skills { display: flex; flex-direction: column; gap: 20px; }
.skills-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.skills-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.count { margin: 0; color: var(--muted); }
.search { position: relative; flex: 1 1 260px; max-width: 340px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search .input { padding-left: 42px; font-size: 16px; }

.status:empty { display: none; }
.status {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 22px;
  border: 1px dashed var(--field); border-radius: 14px;
}
.status p { margin: 0; }

.groups { display: flex; flex-direction: column; gap: 28px; }
.group { display: flex; flex-direction: column; gap: 12px; }
.group-title { margin: 0; font-size: 18px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.group-count { font-size: 14px; font-weight: 500; color: var(--muted); }
.tile-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  padding: 16px 18px 8px;
  border: 2px solid var(--tile-line); border-radius: 14px;
  background: var(--surface);
}
.tile:not(.is-selected):hover { border-color: var(--field); }
.tile.is-selected { border-color: var(--accent); background: var(--tile-on); }
.tile-main { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.tile-check { position: absolute; opacity: 0; width: 1px; height: 1px; }
.checkbox {
  flex: none; width: 22px; height: 22px; margin-top: 2px;
  display: grid; place-items: center;
  border: 2px solid var(--muted); border-radius: 6px;
  background: var(--surface); color: var(--on-accent);
}
.checkbox .icon { width: 14px; height: 14px; stroke-width: 3.5; visibility: hidden; }
.tile.is-selected .checkbox { background: var(--accent); border-color: var(--accent); }
.tile.is-selected .checkbox .icon { visibility: visible; }
.tile-check:focus-visible + .checkbox { outline: 3px solid var(--focus); outline-offset: 3px; }
.tile-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-title { font-size: 18px; line-height: 1.3; font-weight: 650; }
.tile-summary { font-size: 15px; color: var(--soft); }
.link-button {
  align-self: flex-end;
  min-height: 40px; padding: 8px 6px;
  border: 0; background: none;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--accent); cursor: pointer;
}
.link-button:hover { color: var(--accent-hover); text-decoration: underline; }

.footnote { margin: 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

/* ---------- Paket ---------- */

.package {
  position: sticky; bottom: 0;
  margin: 0 calc(-1 * var(--gutter));
  padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--panel); color: var(--panel-ink);
  display: flex; flex-direction: column; gap: 12px;
  z-index: 2;
}
.package :focus-visible { outline-color: var(--signal); }
.package-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.package-title { margin: 0; font-size: 18px; font-weight: 700; }
.package-summary { margin: 0; color: var(--panel-muted); font-size: 15px; }
.package code { color: var(--panel-ink); }

.tree {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--panel-2);
  font-family: var(--mono); font-size: 14px; line-height: 1.75;
  overflow: auto; max-height: 44vh;
}
.tree-line { white-space: pre; border-radius: 4px; }
.tree-pre { color: var(--panel-guide); }
.tree-line.kind-root .tree-name { font-weight: 600; }
.tree-line.kind-dir .tree-name { color: var(--panel-muted); }
.tree-line.kind-skill .tree-name { color: var(--signal); font-weight: 600; }
.tree-extra { color: var(--panel-muted); }

.package-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.package-actions .prompt-result { grid-column: 1 / -1; order: -1; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
}
.button:active { transform: translateY(1px); }
.button-primary {
  min-height: 52px;
  border: 0;
  background: var(--signal); color: var(--signal-ink);
  font-size: 18px; font-weight: 700;
}
.button-primary:hover { background: var(--signal-hover); color: var(--signal-ink); }
.button-primary[aria-busy='true'] { cursor: progress; }
.kbd {
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 2px 6px;
  border: 1px solid rgba(23, 32, 38, 0.35); border-radius: 6px;
}
.button-ghost { border-color: var(--panel-line); background: transparent; color: var(--panel-ink); }
.button-ghost:hover { background: rgba(255, 255, 255, 0.07); color: var(--panel-ink); }
.secondary-actions { display: flex; gap: 10px; }
.text-button {
  min-height: 44px; padding: 8px 0;
  border: 0; background: none;
  font: inherit; font-size: 15px; font-weight: 600; text-align: left;
  color: var(--panel-ink); text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.package-hint { margin: 0; font-size: 14px; color: var(--panel-muted); }
/* Steht der Prompt da, sagt sein Hinweis schon alles */
.package-actions:has(.prompt-result:not([hidden])) #prompt-hint { display: none; }

/* Auf dem Handy nur das Nötigste in der Leiste unten. Der Rest steckt in der Vorschau. */
.tree, .package-hint, #download-zip, .package-link { display: none; }
.kbd { display: none; }

.prompt-result {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--panel-2);
}
.prompt-note { margin: 0; font-size: 15px; }
.prompt-note.is-error { color: var(--signal); }
.prompt-text {
  width: 100%; min-height: 112px;
  padding: 10px 12px;
  border: 1px solid var(--panel-line); border-radius: 8px;
  background: transparent; color: var(--panel-ink);
  font: 13px/1.55 var(--mono);
  resize: vertical;
}

/* ---------- Breiter Bildschirm ---------- */

@media (min-width: 960px) {
  :root { --gutter: clamp(24px, 4vw, 56px); }
  .site-header { padding: 28px 0 24px; }
  .layout { grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); align-items: start; gap: 40px; padding-top: 36px; }
  .config { gap: 48px; padding-bottom: 64px; }
  .package {
    position: sticky; top: 24px; bottom: auto;
    margin: 0;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 28px;
    border-radius: 18px;
    gap: 20px;
  }
  .tree { max-height: 38vh; }
  .package-head { flex-direction: column; align-items: flex-start; }
  .package-title { font-size: 26px; line-height: 1.2; font-weight: 750; font-stretch: 88%; }
  .package-summary { font-size: 16px; }
  .tree, .package-hint, #download-zip, .package-link { display: block; }
  #download-zip { display: inline-flex; }
  .package-actions { display: flex; flex-direction: column; gap: 10px; }
  .package-actions .prompt-result { order: 0; }
  .secondary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .secondary-actions .button { padding: 0 10px; font-size: 15px; white-space: nowrap; }
  .package-link { align-self: flex-start; }
}
@media (min-width: 960px) and (hover: hover) {
  .kbd { display: inline-block; }
}

/* ---------- Dialoge ---------- */

.dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0; border-radius: 18px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; animation: rise 0.18s ease-out; }
.dialog::backdrop { background: var(--scrim); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 20px 14px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.dialog-head .icon-button { border: 0; background: var(--bg); }
.dialog-kicker { margin: 0; font-size: 14px; color: var(--muted); }
.dialog-title { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 750; font-stretch: 88%; }
.dialog-title code { font-size: 0.8em; font-weight: 600; }
.dialog-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 24px 22px; }
.dialog-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 20px 16px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.dialog-path { margin: 0; font-size: 14px; color: var(--muted); }
.dialog-path code { color: var(--ink); overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.dialog .text-button { color: var(--accent); }
@media (max-width: 559px) {
  .dialog-head { padding: 16px 14px 12px 18px; }
  .dialog-body { padding: 16px 18px 20px; }
  .dialog-foot { padding: 10px 14px 14px 18px; }
  .dialog-foot .button-text { padding: 0 8px; }
}

.button-text { background: transparent; color: var(--accent); border: 0; padding: 0 12px; }
.button-text:hover { color: var(--accent-hover); text-decoration: underline; }
.button-toggle { border: 2px solid var(--accent); background: transparent; color: var(--accent); font-weight: 700; padding: 0 18px; }
.button-toggle .icon-check { display: none; width: 16px; height: 16px; stroke-width: 3; }
.button-toggle[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); }
.button-toggle[aria-pressed='true'] .icon-check { display: block; }
.button-signal { border: 0; background: var(--signal); color: var(--signal-ink); font-weight: 700; padding: 0 18px; }
.button-signal:hover { background: var(--signal-hover); color: var(--signal-ink); }
.button-small { min-height: 40px; padding: 0 12px; font-size: 15px; border-color: var(--field); background: var(--surface); color: var(--ink); }
.button-small .icon { width: 16px; height: 16px; }

/* README im Dialog */
.readme { max-width: 70ch; }
.readme > :first-child { margin-top: 0; }
.readme p, .readme ul, .readme ol, .readme pre, .readme table { margin: 0 0 14px; }
.readme h1, .readme h2, .readme h3 { margin: 22px 0 8px; line-height: 1.25; }
.readme h1 { font-size: 22px; }
.readme h2 { font-size: 19px; }
.readme h3 { font-size: 17px; }
.readme ul, .readme ol { padding-left: 22px; }
.readme li + li { margin-top: 6px; }
.readme code { padding: 1px 5px; border-radius: 5px; background: var(--code-bg); }
.readme pre { padding: 12px 14px; border-radius: 8px; background: var(--code-bg); overflow: auto; font-size: 14px; }
.readme pre code { padding: 0; background: none; }
.readme table { border-collapse: collapse; display: block; overflow-x: auto; }
.readme th, .readme td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; }

/* Vorschau */
.dialog-preview { width: min(1080px, calc(100vw - 24px)); height: min(740px, calc(100dvh - 24px)); }
.preview-main { flex: 1; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.preview-files {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 168px; overflow: auto;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-family: var(--mono); font-size: 14px;
}
.preview-folder { margin: 10px 12px 2px; color: var(--accent); font-weight: 600; overflow-wrap: break-word; }
.preview-file {
  padding: 8px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; overflow-wrap: break-word;
}
.preview-file.is-nested { padding-left: 28px; }
.preview-file:hover { background: var(--code-bg); }
.preview-file[aria-current='true'] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.preview-view { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.preview-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px 8px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.preview-path { margin: 0; font-family: var(--mono); font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.preview-content {
  flex: 1; min-height: 0; margin: 0;
  padding: 18px 22px;
  overflow: auto;
  font-size: 14px; line-height: 1.65;
  white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
}
@media (min-width: 760px) {
  .preview-main { grid-template-rows: none; grid-template-columns: 290px minmax(0, 1fr); }
  .preview-files { max-height: none; border-bottom: 0; border-right: 1px solid var(--line-soft); padding: 14px 10px; }
}

/* Kurze Meldung unten */
.toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 10;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink); color: var(--bg);
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
@media (min-width: 960px) { .toast { bottom: 28px; } }

/* Neu im Paket: kurz hervorheben, damit man sieht, was dazukam */
@media (prefers-reduced-motion: no-preference) {
  .tree-line.is-new { animation: arrive 1.4s ease-out; }
  @keyframes arrive { from { background: rgba(242, 194, 48, 0.28); } to { background: transparent; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
