@font-face { font-family: "Lora"; src: url(fonts/Lora.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Lora"; src: url(fonts/Lora-Italic.woff2) format("woff2"); font-style: italic; font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/Inter-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/Inter-SemiBold.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg2: #0f1628;
  --panel: #141c30;
  --panel2: #1a2340;
  --line: #27324f;
  --text: #eef1f7;
  --muted: #95a1ba;
  --faint: #66718c;
  --accent: #a8e4de;
  --accent-ink: #08201e;
  --gold: #ecc880;
  --danger: #ff9a8f;
  --ok: #8fe3a6;
  --radius: 14px;
  --serif: "Lora", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #1b2748 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text); font: 15px/1.5 var(--sans); min-height: 100vh;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; background: rgba(11, 16, 32, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(160deg, #314a7a, #0e1830); position: relative; overflow: hidden; }
.brand-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 42%; background: linear-gradient(#a8e4de55, #a8e4de11); border-top: 2px solid var(--accent); }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--text); background: var(--panel2); }
.spacer { flex: 1; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pill b { color: var(--gold); }

main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }

/* ---------- controls */
button, .btn {
  font: 600 14px var(--sans); border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s, transform .05s;
}
button:hover, .btn:hover { background: var(--panel2); border-color: #34416a; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.primary:hover { background: #c1efe9; border-color: transparent; }
.ghost { background: transparent; }
.danger { color: var(--danger); }
.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.big { padding: 14px 22px; font-size: 16px; border-radius: 12px; }

label { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; font: 15px/1.45 var(--sans); color: var(--text); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #a8e4de22; }
.field { margin-bottom: 18px; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--bg2); color: var(--muted); padding: 7px 14px; border-radius: 999px; font-size: 14px; cursor: pointer; }
.chip.on { border-color: var(--accent); color: var(--text); background: #a8e4de14; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font-weight: 600; font-size: 14px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--panel2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 10px 30px #0008; max-width: calc(100vw - 32px);
}
.toast.err { border-color: #7a3b38; color: var(--danger); }

/* ---------- auth */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; min-height: calc(100vh - 200px); }
.auth-hero h1 { font-size: clamp(34px, 5vw, 56px); }
.auth-hero h1 em { color: var(--accent); }
.auth-hero p { font-size: 17px; color: var(--muted); max-width: 440px; }
.phones { display: flex; gap: 14px; margin-top: 28px; }
.phones img { width: 120px; border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 18px 40px #0009; }
.phones img:nth-child(2) { transform: translateY(18px); }
.tabs { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 4px; margin-bottom: 20px; }
.tabs button { flex: 1; border: none; background: transparent; color: var(--muted); }
.tabs button.on { background: var(--panel2); color: var(--text); }

/* ---------- library */
.head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.vcard { text-decoration: none; color: inherit; display: block; }
.thumb { aspect-ratio: 9/16; border-radius: 14px; overflow: hidden; background: linear-gradient(170deg, #22305a, #0c1326 60%, #1a1f33); border: 1px solid var(--line); position: relative; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { font-family: var(--serif); font-size: 18px; color: #ffffffb0; padding: 18px; text-align: center; }
.vcard:hover .thumb { border-color: #3a4a78; }
.vcard .t { margin-top: 10px; font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge { position: absolute; top: 10px; left: 10px; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: #0b1020cc; border: 1px solid var(--line); color: var(--muted); }
.badge.done { color: var(--ok); }
.badge.failed { color: var(--danger); }
.badge.rendering, .badge.queued { color: var(--gold); }
.bar { height: 6px; border-radius: 6px; background: var(--bg2); overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .6s; }
.thumb .bar { position: absolute; left: 12px; right: 12px; bottom: 12px; }
.empty { text-align: center; padding: 70px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 20px; }

/* ---------- new video */
.new { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.topic { font-size: 18px; min-height: 96px; }
.looks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.look { border: 2px solid transparent; border-radius: 14px; padding: 0; background: none; overflow: hidden; display: block; text-align: left; cursor: pointer; }
.look img { width: 100%; aspect-ratio: 9/16; object-fit: cover; display: block; border-radius: 12px; }
.look span { display: block; padding: 6px 2px 2px; font-weight: 600; font-size: 12px; line-height: 1.25; color: var(--muted); }
.look.on { border-color: var(--accent); }
.look.on span { color: var(--text); }
.voice-row { display: flex; gap: 8px; }
.voice-row select { flex: 1; }
details summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; margin-bottom: 14px; }

/* ---------- editor */
.editor { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.scene { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.scene .n { font-family: var(--serif); font-size: 18px; color: var(--faint); text-align: center; padding-top: 6px; }
.scene .say { font-size: 16px; min-height: 52px; }
.scene .screen { margin-top: 10px; display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: start; }
.scene .tools { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }
.scene .kind-fields { display: grid; gap: 8px; }
.scene .kind-fields .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.score { display: flex; align-items: center; gap: 14px; }
.ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font: 600 20px var(--serif); background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg2) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--panel); }
.ring b { position: relative; }
.issues { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.issues li { padding-left: 18px; position: relative; color: var(--muted); }
.issues li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.issues li.hard { color: var(--danger); }
.issues li.hard::before { background: var(--danger); }
.mini-looks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mini-looks .look img { border-radius: 9px; }
.mini-looks .look span { font-size: 11.5px; padding-top: 5px; }
.saving { font-size: 12.5px; color: var(--faint); }

/* ---------- watch */
.watch { display: grid; grid-template-columns: minmax(260px, 400px) 1fr; gap: 36px; align-items: start; }
.player { width: 100%; aspect-ratio: 9/16; border-radius: 18px; background: #000; border: 1px solid var(--line); display: block; }
.copybox { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; font-size: 14.5px; }
.stack { display: grid; gap: 18px; }
.progress-card { text-align: center; padding: 40px 24px; }
.progress-card .bar { height: 10px; margin: 18px auto 10px; max-width: 360px; }

/* ---------- admin */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.table-wrap { overflow-x: auto; }

@media (max-width: 900px) {
  .auth, .new, .editor, .watch { grid-template-columns: 1fr; }
  .side { position: static; }
  .auth-hero .phones { display: none; }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .nav { margin-left: 0; order: 3; width: 100%; }
  main { padding: 22px 16px 60px; }
  .scene { grid-template-columns: 1fr; }
  .scene .n { text-align: left; padding: 0; }
  .scene .screen { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
