:root {
  --bg: #f6f0e6;
  --bg2: #efe6d8;
  --card: #fffaf3;
  --ink: #1c1410;
  --ink2: #5b4d44;
  --ink3: #9a8b80;
  --line: #e6dccd;
  --accent: #dc6530;
  --accent2: #ee7a3f;
  --accent-soft: #fbe3d4;
  --ok: #2f8a5b;
  --ok-soft: #dcefe3;
  --warn: #b7791f;
  --warn-soft: #fbefd6;
  --bad: #c0392b;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 10px 30px -12px rgba(60, 40, 20, .18);
  --sans: Inter, "Hind Siliguri", system-ui, sans-serif;
  --display: "Inter Tight", "Hind Siliguri", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #fbe7d6 0%, transparent 60%), var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  padding-bottom: 120px;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(246, 240, 230, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(230, 220, 205, .7);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand b { font-family: var(--display); font-size: 17px; display: block; line-height: 1.1; }
.brand small { color: var(--ink3); font-size: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(var(--accent2), var(--accent)); color: #fff;
  font-family: var(--serif); font-size: 26px; box-shadow: 0 6px 16px -6px rgba(220, 101, 48, .7);
}
.top-actions { display: flex; gap: 10px; align-items: center; }
.cost-pill {
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
}

/* buttons */
.btn, .ghost, .chip-btn {
  border: 0; cursor: pointer; border-radius: 999px; font-weight: 600;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.btn {
  padding: 12px 22px; color: #fff;
  background: linear-gradient(var(--accent2), var(--accent));
  box-shadow: 0 8px 20px -8px rgba(220, 101, 48, .8), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.ghost { padding: 10px 18px; background: var(--card); border: 1px solid var(--line); }
.ghost:hover { background: #fff; }
.ghost.small { padding: 7px 12px; font-size: 13px; }
.chip-btn { padding: 6px 11px; font-size: 12.5px; background: var(--bg2); }
.chip-btn:hover { background: var(--accent-soft); }
.chip-btn.on { background: var(--ink); color: #fff; }

/* layout */
main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.hero { text-align: center; padding: 56px 0 30px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
h1 {
  font-family: var(--display); font-weight: 800; letter-spacing: -.035em;
  font-size: clamp(38px, 6vw, 68px); line-height: 1.02; margin: 14px 0 14px;
}
h1 em, h2 em { font-family: var(--serif); font-weight: 400; font-style: italic; color: var(--accent); letter-spacing: -.01em; }
h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.025em; font-size: 28px; margin: 0 0 6px; }
h3 { font-family: var(--display); font-weight: 700; font-size: 17px; margin: 0 0 8px; }
.lead { color: var(--ink2); font-size: 17px; max-width: 620px; margin: 0 auto; }
.muted { color: var(--ink3); }
.small-text { font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.grid { display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.section { margin: 26px 0; }

/* new project card */
.new-card { max-width: 720px; margin: 0 auto; padding: 26px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink2); }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent2); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.seg { display: inline-flex; background: var(--bg2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px -2px rgba(0,0,0,.15); }

/* projects list */
.projects { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pcard { cursor: pointer; padding: 0; overflow: hidden; transition: transform .15s; }
.pcard:hover { transform: translateY(-3px); }
.pthumb { aspect-ratio: 16 / 10; background: linear-gradient(135deg, #f3dcc8, #e9d6c2); display: grid; place-items: center; font-size: 34px; overflow: hidden; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; }
.pbody { padding: 14px 16px; }
.pbody b { display: block; font-family: var(--display); }

/* dropzone */
.drop {
  border: 2px dashed #e2c9b4; border-radius: var(--radius); background: rgba(255, 250, 243, .7);
  padding: 38px 20px; text-align: center; cursor: pointer; transition: .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #fff6ee; }
.drop .big { font-size: 38px; }

/* status */
.status {
  display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 16px;
  background: var(--accent-soft); color: #7a3613; font-weight: 600; margin: 14px 0;
}
.status.error { background: #f9dcd6; color: var(--bad); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(220,101,48,.25); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: rgba(220,101,48,.18); border-radius: 9px; overflow: hidden; flex: 1; min-width: 80px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .4s; }

/* word cards */
.word-card h3 { font-size: 26px; letter-spacing: -.02em; }
.word-card h3 small { font-family: var(--sans); font-size: 13px; color: var(--ink3); font-weight: 500; margin-left: 6px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--ink3); font-weight: 600; }
.kv dd { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--bg2); }
.tag.syn { background: #e2eefb; color: #1d5b94; }
.tag.ant { background: #f9e2dc; color: #9b3b22; }
.fact { background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: #7b5413; }
.script-box { font-size: 15.5px; min-height: 260px; }

/* scenes */
.scenes { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.scenes.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.scene { padding: 0; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.scene.approved { outline: 3px solid var(--ok); outline-offset: -1px; }
.scene .media { position: relative; background: #2a211c; aspect-ratio: 9 / 16; display: grid; place-items: center; color: #b9a99c; font-size: 13px; overflow: hidden; }
.scenes.wide .scene .media { aspect-ratio: 16 / 9; }
.scene .media img, .scene .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene .num {
  position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(28,20,16,.72); color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}
.scene .badge {
  position: absolute; top: 10px; right: 10px; z-index: 2; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); color: #7b5413;
}
.scene .badge.ok { background: var(--ok-soft); color: var(--ok); }
.scene .body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.scene .say { font-size: 13px; color: var(--ink2); font-style: italic; }
.scene textarea { min-height: 70px; font-size: 12.5px; padding: 8px 10px; border-radius: 10px; }
.scene .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dup { font-size: 12px; font-weight: 600; color: #7b5413; background: var(--warn-soft); padding: 6px 9px; border-radius: 10px; }
.err { font-size: 12px; color: var(--bad); }
.overlay-spin { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(28,20,16,.45); z-index: 3; }

.toolbar { position: sticky; top: 70px; z-index: 10; padding: 14px 18px; margin-bottom: 18px; }
.final-video { width: 100%; max-height: 72vh; border-radius: 18px; background: #000; display: block; margin: 0 auto; }

/* floating dock (bottom nav) */
.dock {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30;
  display: flex; gap: 4px; padding: 6px; border-radius: 22px;
  background: rgba(255, 250, 243, .9); backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: 0 18px 40px -16px rgba(60, 40, 20, .35);
}
.dock button {
  border: 0; background: transparent; cursor: pointer; border-radius: 16px;
  padding: 8px 14px; display: grid; justify-items: center; gap: 2px; min-width: 70px;
  font-size: 11.5px; font-weight: 700; color: var(--ink2);
}
.dock button .ic { font-size: 18px; line-height: 1; }
.dock button.on { background: linear-gradient(var(--accent2), var(--accent)); color: #fff; }
.dock button:disabled { opacity: .35; cursor: not-allowed; }
.dock button.done:not(.on) { color: var(--ok); }

/* settings */
dialog { border: 0; border-radius: 26px; padding: 0; width: min(560px, 94vw); background: var(--card); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(28,20,16,.35); backdrop-filter: blur(4px); }
dialog .inner { padding: 26px; max-height: 86vh; overflow: auto; }

.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 14px;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.5);
}
@media (max-width: 640px) {
  .dock button { min-width: 54px; padding: 8px 8px; }
  .kv { grid-template-columns: 1fr; }
}

/* browser version */
body.locked .top-actions, body.locked .dock { display: none !important; }
#mvLink, #importLink { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
