:root { --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e5ea; --accent: #2457d6; --danger: #c62828; }
@media (prefers-color-scheme: dark) {
    :root { --bg: #14171c; --card: #1d2129; --text: #e7e9ee; --muted: #9aa1ad; --line: #2c313b; --accent: #6d95ff; --danger: #ff6b6b; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
header form { display: flex; gap: 12px; align-items: center; }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.narrow { max-width: 360px; margin: 48px auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
label { display: block; font-weight: 600; margin-bottom: 10px; }
label small { font-weight: 400; color: var(--muted); }
input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
button { padding: 8px 14px; font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 6px; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; }
button.danger { background: none; color: var(--danger); border: 1px solid var(--danger); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.actions { text-align: right; }
a { color: var(--accent); }
.muted, .hint { color: var(--muted); }
.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 10px 12px; border-radius: 6px; }
code { font-size: 13px; }
.notice { background: color-mix(in srgb, #2f9e44 14%, transparent); color: #2f9e44; padding: 10px 12px; border-radius: 6px; }
h1 a { color: inherit; text-decoration: none; }
textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
fieldset.choice { display: flex; gap: 20px; border: 0; padding: 0; margin: 0 0 12px; }
fieldset.choice legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
fieldset.choice label { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }
fieldset.choice input { width: auto; margin: 0; }
button.danger-link { color: var(--danger); }
td form { display: inline; }
/* Show only the fields for the chosen option */
.mode-form:has(input[name=mode][value=website]:checked) .stream-fields,
.mode-form:has(input[name=mode][value=stream]:checked) .website-fields,
.link-form:has(input[name=type][value=redirect]:checked) .stream-fields,
.link-form:has(input[name=type][value=stream]:checked) .redirect-fields { display: none; }
