:root {
  --bg: #080d1d; --bg2: #0e1530; --card: #111a38; --line: #22305e; --text: #eef1ff; --muted: #9aa5cf;
  --pink: #ff3d8b; --cyan: #29e0ff; --yellow: #ffd23d; --green: #39e58c; --red: #ff5a6a;
  --r: 18px; --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #1c1f5a 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #3a0f3f 0%, transparent 55%), var(--bg);
  background-attachment: fixed; color: var(--text); font: 16px/1.5 var(--font); min-height: 100vh;
}
a { color: var(--cyan); }
code { background: #0003; border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .85em; word-break: break-all; }
h1, h2 { line-height: 1.15; margin: 0 0 .6em; }
h1 { font-size: clamp(28px, 4.4vw, 48px); font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: 20px; font-weight: 800; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.grad { background: linear-gradient(90deg, var(--pink), var(--yellow) 50%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.brand { font-weight: 900; letter-spacing: .02em; color: var(--text); text-decoration: none; font-size: 20px; }
.brand b { color: var(--pink); font-weight: 900; margin-left: 2px; }
.brand.big { font-size: 40px; text-align: center; display: block; margin-top: 8vh; }

.top { display: flex; align-items: center; gap: 20px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: #080d1dcc; backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex: 1; }
.tab { background: none; border: 0; color: var(--muted); font: 600 15px var(--font); padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.top-r { display: flex; gap: 8px; align-items: center; }
.top-r form { margin: 0; }
.ghost { background: none; border: 0; color: var(--muted); font: 500 14px var(--font); cursor: pointer; text-decoration: none; padding: 6px 8px; }
.ghost:hover { color: var(--text); }

.view > * { min-width: 0; }
.view { max-width: 1100px; margin: 0 auto; padding: 28px 24px 40px; display: grid; gap: 24px; }
.card { background: linear-gradient(180deg, #131d40, #0f1734); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.hero { padding: 32px; position: relative; overflow: hidden; }
.hero::after { content: '✂'; position: absolute; right: -10px; top: -30px; font-size: 180px; opacity: .06; transform: rotate(-20deg); pointer-events: none; }

textarea, input, select {
  width: 100%; background: #0a1128; color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font: 15px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { font-size: 16px; resize: vertical; min-height: 84px; }
textarea:focus, input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #29e0ff22; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--pink); }
input[type=file] { padding: 8px; max-width: 320px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
label.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
label.full, .full { grid-column: 1 / -1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: #1a2550; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; font: 700 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #3a4c8c; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: linear-gradient(90deg, var(--pink), #ff7a3d); border: 0; color: #fff; box-shadow: 0 8px 24px #ff3d8b40; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { font-size: 18px; padding: 16px 26px; margin-top: 16px; border-radius: 14px; }
.btn.wide { width: 100%; margin-top: 14px; padding: 14px; }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.danger { color: #ffb3bb; }
.btn.danger:hover { border-color: var(--red); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

details.opts { margin-top: 12px; }
details > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; list-style: none; }
details > summary::before { content: '▸ '; }
details[open] > summary::before { content: '▾ '; }
.optgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 14px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 20px; }
.seg { display: grid; gap: 8px; margin-bottom: 12px; }
.seg label { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 15px; }

.row-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.row-h h2 { margin: 0; }

.jobs { display: grid; gap: 12px; }
.job { display: grid; grid-template-columns: 160px 1fr auto; gap: 16px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.job.running { border-color: #29e0ff55; }
.job.error { border-color: #ff5a6a55; }
.jthumb { aspect-ratio: 16/9; border-radius: 10px; background: #0a1128 center/cover; position: relative; }
.jthumb .count { position: absolute; right: 6px; bottom: 6px; background: var(--pink); color: #fff; font-weight: 900; border-radius: 999px; padding: 1px 10px; font-size: 14px; }
.jtitle { font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.jmain { min-width: 0; }
.bar { height: 8px; background: #0a1128; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--pink)); border-radius: 999px; transition: width .6s ease; }
.job.running .bar i { background-size: 200% 100%; animation: flow 1.6s linear infinite; background-image: linear-gradient(90deg, var(--cyan), var(--pink), var(--cyan)); }
@keyframes flow { to { background-position: -200% 0; } }
.stage { color: var(--muted); }
.err { color: #ffb3bb; margin-top: 6px; }
.jact { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; max-width: 330px; }
.pill { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: #22305e; color: var(--muted); }
.pill.running { background: #29e0ff22; color: var(--cyan); }
.pill.done { background: #39e58c22; color: var(--green); }
.pill.error { background: #ff5a6a22; color: var(--red); }

dialog { width: min(1200px, 96vw); max-height: 92vh; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 0; }
dialog::backdrop { background: #02040cc0; backdrop-filter: blur(4px); }
.dlg-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg2); z-index: 2; flex-wrap: wrap; }
.dlg-head h2 { margin: 0 0 4px; }
#dlgBody { padding: 20px 24px 28px; }
.memes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.meme { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.meme.off { opacity: .55; }
.vid { aspect-ratio: 16/9; background: #000 center/cover; position: relative; cursor: pointer; }
.vid video { width: 100%; height: 100%; display: block; background: #000; }
.vid .play { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 50%; background: #ff3d8bdd; display: grid; place-items: center; font-size: 20px; color: #fff; padding-left: 4px; box-shadow: 0 6px 20px #0008; transition: transform .15s; }
.vid:hover .play { transform: scale(1.1); }
.vid .dur, .vid .kind { position: absolute; bottom: 6px; right: 6px; background: #000b; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.vid .kind { left: 6px; right: auto; background: var(--yellow); color: #000; text-transform: uppercase; }
figcaption { display: flex; gap: 8px; padding: 10px 12px 4px; align-items: baseline; }
.num { color: var(--pink); font-weight: 900; font-size: 13px; }
.mtitle { font-weight: 700; font-size: 14px; outline: none; border-radius: 6px; padding: 0 3px; flex: 1; word-break: break-word; }
.mtitle:focus { background: #0a1128; box-shadow: 0 0 0 1px var(--cyan); }
.mact { display: flex; gap: 6px; padding: 6px 12px 12px; align-items: center; margin-top: auto; flex-wrap: wrap; }
.mact .muted { margin-left: auto; }
details.hid { margin-top: 24px; }
details.hid .memes { margin-top: 14px; }

.checks { width: 100%; border-collapse: collapse; table-layout: fixed; }
.checks td { word-break: break-word; overflow-wrap: anywhere; }
.checks td { padding: 7px 8px; border-bottom: 1px solid #22305e88; vertical-align: middle; }
.checks td:first-child { width: 32px; }
.checks td:nth-child(2) { width: 34%; }
.checks td:last-child { text-align: right; }
.checks form { margin: 0; }

.alert { padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-size: 14px; }
.alert.error { background: #ff5a6a1c; border: 1px solid #ff5a6a55; color: #ffd0d5; }
.alert.ok { background: #39e58c1c; border: 1px solid #39e58c55; }
.warn-box { background: #ffd23d14; border: 1px solid #ffd23d44; padding: 12px; border-radius: 12px; font-size: 14px; }
#banners { max-width: 1100px; margin: 16px auto 0; padding: 0 24px; display: grid; gap: 8px; }
#banners:empty { display: none; }
.banner { background: #ffd23d14; border: 1px solid #ffd23d55; border-radius: 12px; padding: 12px 16px; font-size: 14px; }

#toast { visibility: hidden; opacity: 0; position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: #1a2550; border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; font-weight: 600; transition: transform .25s, opacity .25s, visibility .25s; z-index: 100; max-width: 92vw; box-shadow: 0 10px 30px #0008; }
#toast.show { transform: translate(-50%, 0); visibility: visible; opacity: 1; }
#toast.bad { border-color: var(--red); color: #ffd0d5; }

.copy { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 32px; }

.auth main { max-width: 440px; margin: 0 auto; padding: 0 16px; }
.auth main.install { max-width: 760px; }
.auth .card { margin-top: 20px; display: grid; gap: 14px; }
.auth form.card h2 { margin: 10px 0 0; }

@media (max-width: 760px) {
  .top { padding: 12px 16px; gap: 10px; }
  .tabs { order: 3; flex-basis: 100%; }
  .top-r { margin-left: auto; }
  .view { padding: 20px 16px 32px; }
  .hero { padding: 22px; }
  .job { grid-template-columns: 96px 1fr; }
  .jact { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .grid2 { grid-template-columns: 1fr; }
  #banners { padding: 0 16px; }
  .dlg-head, #dlgBody { padding-left: 16px; padding-right: 16px; }
  .memes { grid-template-columns: 1fr 1fr; gap: 10px; }
  .checks td:last-child { text-align: left; }
}
@media (max-width: 420px) { .memes { grid-template-columns: 1fr; } }

.banner pre.log { white-space: pre-wrap; word-break: break-word; background: #0006; padding: 8px 10px; border-radius: 8px; margin: 8px 0 0; font-size: 12px; max-height: 160px; overflow: auto; }
