:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #16181d;
  --muted: #5d6370;
  --line: #e2e5ea;
  --accent: #d63a2f;
  --accent-dark: #b42d24;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo { background: var(--accent); color: #fff; border-radius: 6px; padding: 2px 7px; font-size: 13px; letter-spacing: 0.5px; }
.topbar nav { display: flex; gap: 20px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.topbar nav a[aria-current] { color: var(--text); }

.layout {
  display: grid; grid-template-columns: minmax(360px, 480px) 1fr; gap: 24px;
  padding: 24px 28px; max-width: 1500px; margin: 0 auto; align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; padding: 16px; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 20px; }

.tabs { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.tab { border: 0; background: transparent; padding: 7px 16px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > span, legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; }
input[type="text"], input[type="number"], input[type="password"], select, textarea {
  font: inherit; color: inherit; background: #fff; width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
textarea { resize: vertical; }
#source { font-size: 16px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: var(--accent); }

.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; margin-top: 6px; }
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, #fff); }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.choice small { display: block; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid .wide { grid-column: 1 / -1; }
.advanced { border-top: 1px solid var(--line); padding: 12px 0 0; margin: 4px 0 14px; }
.advanced summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.checks { display: grid; gap: 8px; }
.checks label { display: flex; gap: 8px; align-items: center; }
.checks input { accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

button.primary, .button {
  font: inherit; font-weight: 600; border-radius: 9px; padding: 11px 18px; cursor: pointer; text-decoration: none; display: inline-block;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--accent-dark); }
form > button.primary { width: 100%; font-size: 16px; padding: 13px; }
button:disabled { opacity: .6; cursor: progress; }

.result { min-height: 70vh; display: flex; flex-direction: column; }
.empty, .busy { margin: auto; text-align: center; color: var(--muted); }
.empty-icon { font-size: 40px; opacity: .4; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { margin: auto; max-width: 520px; background: #fff3f2; color: #8a1c14; border: 1px solid #f5c2bd; border-radius: 10px; padding: 14px 16px; }
.done { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.done-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.preview { flex: 1; min-height: 70vh; border: 1px solid var(--line); border-radius: 10px; overflow: auto; background: #e9ebef; }
.preview iframe { width: 100%; height: 100%; min-height: 70vh; border: 0; display: block; }
.preview img { width: 100%; display: block; }
pre { background: #0f1115; color: #e6e6e6; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12.5px; }

/* Docs page */
.docs { max-width: 900px; margin: 0 auto; padding: 32px 28px 80px; }
.docs h1 { font-size: 30px; }
.docs h2 { margin-top: 44px; padding-top: 12px; border-top: 1px solid var(--line); }
.docs table { border-collapse: collapse; width: 100%; font-size: 14px; background: #fff; }
.docs th, .docs td { text-align: left; border: 1px solid var(--line); padding: 7px 9px; vertical-align: top; }
.docs th { background: #fafbfc; }
.docs code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.docs pre code { background: none; padding: 0; color: inherit; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: #e8f1ff; color: #1d4ed8; vertical-align: middle; }
textarea.code{font:12.5px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;white-space:pre;overflow:auto}
