@font-face { font-family: "Nunito"; src: url("/static/fonts/Nunito.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }

:root {
  --purple: #2e1052; --purple-2: #4b1e86; --ink: #22093a; --bg: #f6f1ff; --card: #ffffff; --muted: #7a6a93;
  --orange: #ff8a00; --pink: #ff46a0; --blue: #28a0ff; --lime: #78d246; --yellow: #ffce30; --red: #f53c3c;
  --radius: 18px; --shadow: 0 3px 0 rgba(34, 9, 58, .12), 0 8px 24px rgba(34, 9, 58, .08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: "Nunito", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.35; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 20; background: var(--purple); color: #fff; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); box-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.topbar img.logo { height: 30px; display: block; }
.topbar .spacer { flex: 1; }
.topbar .rainbow { position: absolute; left: 0; right: 0; bottom: -4px; height: 4px;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--yellow), var(--lime), var(--blue), #8c50f5, var(--pink)); }
.iconbtn { background: rgba(255, 255, 255, .14); border: 0; color: #fff; border-radius: 12px; padding: 8px 12px; font-weight: 800; cursor: pointer; }
.langsw { display: flex; background: rgba(255, 255, 255, .14); border-radius: 12px; overflow: hidden; }
.langsw button { background: none; border: 0; color: #fff; padding: 8px 10px; font-weight: 800; opacity: .6; cursor: pointer; }
.langsw button.on { opacity: 1; background: rgba(255, 255, 255, .18); }

main { max-width: 720px; margin: 0 auto; padding: 16px 14px 240px; }
h1 { font-size: 26px; margin: 8px 0 14px; font-weight: 900; }
h2 { font-size: 19px; margin: 22px 0 10px; font-weight: 900; }
.muted { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 16px; padding: 13px 18px;
  font-weight: 900; font-size: 17px; cursor: pointer; background: var(--purple-2); color: #fff; box-shadow: 0 4px 0 var(--ink);
  text-decoration: none; transition: transform .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.orange { background: var(--orange); }
.btn.pink { background: var(--pink); }
.btn.light { background: #fff; color: var(--ink); box-shadow: 0 4px 0 #d8cdea; border: 2px solid #e8def7; }
.btn.danger { background: #fff; color: var(--red); box-shadow: 0 4px 0 #f2c6c6; border: 2px solid #f5d6d6; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }

label.field { display: block; margin: 10px 0; }
label.field span { display: block; font-size: 13px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password] { width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid #e3d8f3; background: #fff; font-size: 17px; }
input[type=text]:focus, input[type=password]:focus { outline: none; border-color: var(--purple-2); }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 90px; border: 2px solid #e3d8f3; background: #fff; border-radius: 14px; padding: 12px; font-weight: 900; cursor: pointer; }
.seg button.on { border-color: var(--purple-2); background: var(--purple-2); color: #fff; }

/* job list */
.job { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.job .thumb { width: 64px; height: 96px; border-radius: 12px; background: #eadff8 center/cover no-repeat; flex: none; overflow: hidden; }
.job .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.job .meta { flex: 1; min-width: 0; }
.job .meta b { font-size: 17px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 900; background: #eee5fa; color: var(--purple-2); }
.chip.done { background: #dff5d2; color: #2f7a12; }
.chip.error { background: #fde0e0; color: #b42020; }
.chip.queued, .chip.rendering { background: #fff1d6; color: #a05a00; }

/* editor */
.block-card { border-left: 8px solid var(--orange); }
.block-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.block-head b { flex: 1; }
.presets { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.presets button { flex: none; border: 0; background: #f1eafb; color: var(--purple-2); padding: 7px 11px; border-radius: 999px; font-weight: 800; font-size: 13px; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.ph { position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; background: #eadff8; cursor: pointer; border: 0; padding: 0; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .num { position: absolute; left: 6px; top: 6px; background: rgba(34, 9, 58, .75); color: #fff; font-size: 12px; font-weight: 900; border-radius: 8px; padding: 1px 7px; }
.ph .badges { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.ph .badge { background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 11px; font-weight: 900; border-radius: 8px; padding: 1px 6px; }
.ph .badge.cover { background: var(--yellow); }
.ph .badge.blur { background: var(--blue); color: #fff; }
.ph.uploading { display: flex; align-items: center; justify-content: center; color: var(--purple-2); font-weight: 900; font-size: 14px; }
.ph.uploading .bar { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--orange); }
.ph.failed { background: #fde0e0; color: #b42020; font-size: 12px; padding: 8px; display: flex; align-items: center; text-align: center; }
.addph { aspect-ratio: 3/4; border-radius: 12px; border: 3px dashed #cdbbe8; display: flex; align-items: center; justify-content: center; color: var(--purple-2);
  font-weight: 900; cursor: pointer; background: #fbf8ff; }
.addph input { display: none; }

.footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: rgba(255, 255, 255, .97); box-shadow: 0 -4px 20px rgba(34, 9, 58, .12);
  padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.footer .in { max-width: 720px; margin: 0 auto; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.consent input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--purple-2); }
.savestate { font-size: 13px; color: var(--muted); text-align: right; min-height: 18px; }

.progress { height: 18px; border-radius: 999px; background: #eadff8; overflow: hidden; margin: 14px 0; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--orange), var(--pink)); transition: width .6s; }
video { width: 100%; max-height: 70vh; border-radius: 16px; background: #000; display: block; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }
.banner { background: #fff1d6; color: #7a4300; border-radius: 14px; padding: 10px 12px; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.banner.err { background: #fde0e0; color: #9b1c1c; }

/* sheet / modal */
.backdrop { position: fixed; inset: 0; background: rgba(20, 6, 36, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 16px 14px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.sheet .acts { display: grid; gap: 8px; }
.sheet .acts .btn { width: 100%; }
.sheet img.preview { width: 120px; border-radius: 12px; display: block; margin: 0 auto 12px; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 22px; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 14px;
  font-weight: 800; z-index: 60; max-width: 90vw; text-align: center; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #5a2a9a, var(--purple) 60%); }
.login-card { background: #fff; border-radius: 24px; padding: 24px 20px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.login-card img { width: 100%; margin-bottom: 8px; }
.err { color: var(--red); font-weight: 800; font-size: 14px; min-height: 20px; margin: 6px 0; }

/* admin tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee5fa; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pwbox { font-family: ui-monospace, monospace; font-size: 20px; background: #f1eafb; padding: 10px; border-radius: 12px; text-align: center; user-select: all; margin: 8px 0; }
.scroll-x { overflow-x: auto; }
.mt { margin-top: 14px; }
.spacer16 { height: 16px; }
.login-card .langsw { background: #f1eafb; display: inline-flex; }
.login-card .langsw button { color: var(--purple-2); }
