:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1c1b19;
  --muted: #6b6760;
  --line: #dedad2;
  --accent: #d9480f;
  --accent-ink: #ffffff;
  --ok: #2b8a3e;
  --warn: #c92a2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312;
    --surface: #1d1c1a;
    --surface-2: #272522;
    --text: #f1efea;
    --muted: #a39e94;
    --line: #34312c;
    --accent: #ff6b2c;
    --accent-ink: #160a03;
    --ok: #51cf66;
    --warn: #ff8787;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131312; --surface: #1d1c1a; --surface-2: #272522; --text: #f1efea; --muted: #a39e94; --line: #34312c;
  --accent: #ff6b2c; --accent-ink: #160a03; --ok: #51cf66; --warn: #ff8787; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* sonst überschreibt z. B. .seg { display } das hidden-Attribut */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 980px; margin: 0 auto; padding: 0 16px 64px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.02em; }
h2.section { font-size: 1.05rem; margin: 2rem 0 .75rem; color: var(--muted); font-weight: 600; }
h3 { margin: 0 0 .5rem; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 6px; font-size: .92em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fine { color: var(--muted); font-size: .9rem; }
.msg { min-height: 1.4em; margin: .5rem 0 0; font-size: .95rem; color: var(--warn); }
.msg.ok { color: var(--ok); }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: -.01em; }
.logo { width: 22px; height: 22px; border-radius: 7px; background: conic-gradient(from 210deg, var(--accent), #f59f00, #12b886, #4263eb, var(--accent)); }
.top-right { display: flex; align-items: center; gap: .5rem; }
.bal { font-weight: 600; background: var(--surface); border: 1px solid var(--line); padding: .25rem .65rem; border-radius: 999px; font-variant-numeric: tabular-nums; }

button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: .5rem .9rem; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.primary.big { width: 100%; padding: .85rem 1rem; font-size: 1.05rem; margin-top: 1rem; }
.ghost { background: transparent; }
input, textarea {
  font: inherit; width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .7rem .8rem;
}
textarea { resize: vertical; min-height: 5.5rem; }

.hero { max-width: 560px; margin: 12vh auto 0; }
.hero p { color: var(--muted); }
.codeform { display: grid; gap: .5rem; margin: 1.5rem 0 1rem; background: var(--surface); padding: 1rem; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.codeform label { font-weight: 600; }
#codeIn, #code2 { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; text-transform: uppercase; }

.tabs { display: flex; gap: .25rem; margin: 1rem 0; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: none; background: transparent; color: var(--muted); padding: .55rem .9rem; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.lbl { font-size: .85rem; color: var(--muted); margin: 1rem 0 .4rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button { border-radius: 999px; padding: .4rem .8rem; }
.chips button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
#modes { margin-bottom: .9rem; }

.drop {
  display: grid; place-items: center; min-height: 92px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); text-align: center; padding: 1rem; cursor: pointer; margin-bottom: .75rem; background: var(--bg);
}
.drop.over { border-color: var(--accent); color: var(--text); }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; padding: 0; border-radius: 50%; line-height: 1; font-size: 14px; background: rgba(0,0,0,.6); color: #fff; border: none; }
.thumb .main { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; text-align: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.thumb .star { position: absolute; left: 3px; bottom: 3px; padding: 0 .3rem; font-size: 11px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; border: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card .media { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.card .media img, .card .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .media .wait { color: var(--muted); font-size: .9rem; text-align: center; padding: 1rem; }
.card .meta { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem .75rem 0; font-size: .85rem; }
.card .kind { font-weight: 600; }
.card .state { color: var(--muted); }
.card .state.bad { color: var(--warn); }
.card .ptext { margin: .25rem .75rem 0; font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .actions { display: flex; flex-wrap: wrap; gap: .35rem; padding: .6rem .75rem .75rem; margin-top: auto; }
.card .actions button, .card .actions a { font-size: .85rem; padding: .3rem .6rem; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--text); background: var(--surface); }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto .5rem; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dlg { padding: 1.1rem; }
.row { display: flex; gap: .5rem; margin-top: .5rem; }
.row.end { justify-content: flex-end; margin-top: 1rem; }

@media (max-width: 520px) {
  .tabs button { flex: 1; padding: .5rem .45rem; font-size: .92rem; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card .actions button, .card .actions a { padding: .25rem .45rem; font-size: .8rem; }
  .hero { margin-top: 6vh; }
}
