/* Stil an gratielaweb.com angepasst: Tinte #14171C, Rot #C8272A, Systemschriften, eckige Formen.
   Zum Anpassen nur die Farben in :root ändern. */
:root {
  color-scheme: dark;
  --bg: #14171C;
  --surface: #1B1F26;
  --surface-2: #232830;
  --fg: #F4F4F2;
  --muted: #B8BEC8;
  --line: #2C323B;
  --edge: #444B56;
  --accent: #C8272A;
  --accent-hi: #E66767;
  --accent-ink: #FFFFFF;
  --accent-soft: #2B1A1E;
  --err: #FF9C94;
  --err-bg: #3A1D1B;
  /* Diagrammfarben: geprüfte Reihenfolge für dunklen Hintergrund */
  --s1: #E66767; --s2: #3987E5; --s3: #199E70; --s4: #C98500;
  --s5: #D55181; --s6: #008300; --s7: #9085E9; --s8: #D95926;
  --other: #5B6470;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  padding-inline: clamp(16px, 4vw, 40px); padding-block: 24px 40px;
}
.wrap { max-width: 1180px; margin-inline: auto; display: flex; flex-direction: column; gap: 20px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.logo-sq { fill: none; stroke: var(--fg); stroke-width: 1.5; }
.logo-sq.red { fill: var(--accent); stroke: none; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.privacy { margin: 0; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border: 1px solid var(--accent); border-radius: 0;
  background: var(--accent); color: var(--accent-ink); font: 500 0.92rem var(--font-body); cursor: pointer; text-decoration: none;
  transition: background-color .15s, color .15s;
}
.btn:hover { background: var(--accent-ink); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--edge); padding: 8px 14px; }
.btn.ghost:hover { border-color: var(--accent-hi); background: var(--accent-soft); color: var(--fg); }


.drop {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px;
  min-height: 380px; padding: clamp(24px, 5vw, 56px);
  background: var(--surface); border: 1px dashed var(--edge); border-top: 4px solid var(--accent); border-radius: 6px; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop:focus-within { border-color: var(--accent-hi); background: var(--surface-2); }
.drop h2 { margin: 0; font-size: clamp(1.8rem, 4.5vw, 2.6rem); line-height: 1.08; font-weight: 700; letter-spacing: -0.02em; max-width: 14ch; text-wrap: balance; }
.drop p { margin: 0; color: var(--muted); max-width: 54ch; }
.drop .fmt { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.drop:focus-within .btn { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
.eq { display: flex; align-items: flex-end; gap: 6px; height: 46px; }
.eq i { display: block; width: 8px; height: 100%; background: var(--accent); transform-origin: bottom; animation: eq 1.8s ease-in-out infinite; }
.eq i:nth-child(1) { animation-delay: -0.2s; }
.eq i:nth-child(2) { animation-delay: -0.9s; background: var(--accent-hi); }
.eq i:nth-child(3) { animation-delay: -0.5s; }
.eq i:nth-child(4) { animation-delay: -1.3s; background: var(--accent-hi); }
.eq i:nth-child(5) { animation-delay: -0.7s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

.msg { margin: 0; padding: 10px 14px; background: var(--accent-soft); border-left: 3px solid var(--accent); font-size: 0.9rem; }
.msg.err { background: var(--err-bg); color: var(--err); }

.filebar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 10px 14px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--line);
}
.filebar .name { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
#fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fmeta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.filebar .sheet { display: flex; align-items: center; gap: 8px; }

.layout { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .stage { order: -1; }
}

.panel { display: flex; flex-direction: column; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lbl { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
select, input[type="text"] {
  width: 100%; min-width: 0; padding: 9px 10px; font: inherit; color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--edge); border-radius: 0;
}
select.auto { width: auto; }
select:focus-visible, input[type="text"]:focus-visible, .btn:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px;
  border: 1px solid var(--line); font-size: 0.78rem; color: var(--muted); cursor: pointer; text-align: center;
  transition: border-color .15s, color .15s;
}
.card svg { width: 30px; height: 30px; }
.card:hover { border-color: var(--edge); color: var(--fg); }
.card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
.card:has(input:checked) svg { color: var(--accent-hi); }
.card:has(input:focus-visible) { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 5px 11px; border: 1px solid var(--line); font-size: 0.85rem; cursor: pointer; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { border-color: var(--edge); }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.hint { margin: 0; font-size: 0.85rem; color: var(--muted); }

.stage { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: clamp(14px, 2.5vw, 24px); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 6px; animation: rise .45s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stage-head h2 { margin: 0; font-size: clamp(1.15rem, 3vw, 1.5rem); font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
.stage-head p { margin: 4px 0 0; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.chartbox { position: relative; width: 100%; height: 430px; }
.chartbox canvas { max-width: 100%; }
.empty { padding: 40px 16px; border: 1px dashed var(--edge); color: var(--muted); }
.note { margin: 0; font-size: 0.85rem; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 16px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.stat { min-width: 0; }
.stat dt { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-family: var(--font-mono); font-size: 1.3rem; font-weight: 500; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat small { display: block; font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

details.more { border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-size: 0.9rem; font-weight: 500; }
.tblwrap { margin-top: 10px; overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
th, td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
th { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; letter-spacing: .04em; color: var(--muted); }
th small { display: block; font-size: 0.62rem; text-transform: uppercase; opacity: .8; }
td.num { text-align: right; }

.foot { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding-top: 8px; font-size: 0.85rem; color: var(--muted); }
.foot a { color: var(--muted); text-underline-offset: 3px; }
.foot a:hover { color: var(--accent-hi); }

.veil {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 23, 28, .9); border: 3px dashed var(--accent);
  font-size: 1.6rem; font-weight: 700; pointer-events: none;
}

/* Eingebettet auf der Startseite (?embed=1): ohne Titel und Fusszeile */
.embed body { padding: 16px; }
.embed .brand, .embed .foot { display: none; }
.embed .top { justify-content: flex-end; }

/* Dekoration */
.leaves { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.mascot { position: fixed; right: 12px; bottom: 8px; width: 80px; height: 96px; pointer-events: none; z-index: 2; will-change: transform; }
.mascot svg { display: block; }
.fx-off .leaves, .fx-off .mascot { display: none; }
.btn.small { padding: 8px 14px; font-size: 0.85rem; }
.btn.small[aria-pressed="false"] { opacity: .75; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; justify-content: space-between; }
.dl { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 520px) { .mascot { transform-origin: bottom right; scale: .7; } }

@media (prefers-reduced-motion: reduce) {
  .eq i, .stage { animation: none; }
  .eq i { transform: scaleY(.7); }
  * { transition: none !important; }
}

/* Optionen unter der Dateileiste */
.hint.ok { color: var(--accent-hi); margin: 0 0 12px; }
.opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 20px; }
.field.small { width: auto; }
.field.small select { width: auto; min-width: 150px; }
input[type="number"] { width: 90px; padding: 9px 10px; font: inherit; color: var(--fg); background: var(--surface-2); border: 1px solid var(--edge); border-radius: 0; }
input[type="number"]:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.eyebrow { display: block; margin-bottom: 6px; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-hi); }

/* Kinoreife: Lichtkegel, Vignette, gestaffeltes Einblenden */
body { background: radial-gradient(1200px 600px at 15% -10%, #2A1417 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #1D2430 0%, transparent 55%), var(--bg); background-attachment: fixed; }
.spot { position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(420px circle at var(--mx, 70%) var(--my, 30%), rgba(200,39,42,.14), transparent 70%); }
.wrap { position: relative; z-index: 2; }
.drop { position: relative; overflow: hidden; background: linear-gradient(135deg, #1B1F26 0%, #20161A 100%); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.drop::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.06) 50%, transparent 60%); transform: translateX(-120%); animation: sheen 6s ease-in-out 1s infinite; pointer-events: none; }
@keyframes sheen { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.drop h2 { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
.drop p, .drop .btn, .drop .fmt, .drop .eq { animation: rise .8s cubic-bezier(.2,.7,.2,1) .15s both; }
.panel, .filebar { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.stage { box-shadow: 0 24px 70px rgba(0,0,0,.4); }
.stat { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.stat:nth-child(2) { animation-delay: .08s; } .stat:nth-child(3) { animation-delay: .16s; } .stat:nth-child(4) { animation-delay: .24s; } .stat:nth-child(5) { animation-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .drop::after, .drop h2, .drop p, .drop .btn, .drop .fmt, .panel, .filebar, .stat { animation: none; } }

.ren { margin-bottom: 20px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); }
.renlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }

.filt { gap: 6px; }

#fxToggle[aria-pressed="true"]::before { content: "● "; color: #3FB950; }
#fxToggle[aria-pressed="false"]::before { content: "○ "; color: var(--muted); }
