:root {
  --bg: #ffffff;
  --fg: #1b1b1f;
  --muted: #5f6368;
  --line: #e3e3e6;
  --accent: #1a4b8c;
  --accent-soft: #eef3fa;
  --danger: #b3261e;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1f23; --fg: #ececed; --muted: #a9abb0; --line: #35353b;
    --accent: #7aa7e0; --accent-soft: #23303f; --danger: #f2b8b5;
  }
}

* { box-sizing: border-box; }

/* Muss vor allem anderen stehen und !important tragen: das hidden-Attribut kommt
   aus dem Browser-Standard und verliert gegen jede Klassenregel, die display
   setzt. Ohne diese Zeile blieben Status- und Ergebnisleiste dauerhaft sichtbar,
   weil .status und .resultbar auf display:flex stehen. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px;
}
header h1 { margin: 0; font-size: 15px; font-weight: 600; }
header p { margin: 0; font-size: 12px; color: var(--muted); }
#model {
  font: inherit; font-size: 12px; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
}

main { padding: 14px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.actions button {
  font: inherit; text-align: left; padding: 9px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
}
.actions button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.actions button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.actions button:disabled { opacity: .5; cursor: default; }

.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field em { font-style: normal; opacity: .7; }
textarea {
  width: 100%; font: inherit; padding: 8px; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
}

.ctxline { font-size: 12px; color: var(--muted); margin-bottom: 12px; min-height: 18px; }

.status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
.timer { margin-left: auto; font-variant-numeric: tabular-nums; }
.spinner {
  width: 12px; height: 12px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.output {
  white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; max-height: 46vh; overflow-y: auto; margin-bottom: 10px;
}

.resultbar { display: flex; gap: 8px; margin-bottom: 10px; }
.resultbar button {
  font: inherit; flex: 1; padding: 9px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
}
.resultbar .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.resultbar button:disabled { opacity: .5; cursor: default; }

.link {
  font: inherit; font-size: 12px; padding: 0; cursor: pointer;
  background: none; border: none; color: var(--accent); text-decoration: underline;
}

.notice { font-size: 13px; color: var(--muted); }
.error {
  font-size: 13px; color: var(--danger);
  border: 1px solid currentColor; border-radius: var(--radius);
  padding: 9px 10px; background: color-mix(in srgb, currentColor 8%, transparent);
}
