/* Story Video Studio: warm, friendly, readable. Colours are tokens; dark mode redefines them. */
:root {
  --bg: #fff8ef; --panel: #ffffff; --soft: #fff1e0; --ink: #2b2420; --muted: #74695f; --line: #efe2d2;
  --accent: #e2572e; --accent-2: #c94a24; --accent-ink: #ffffff; --accent-soft: #fde5da;
  --teal: #1d837d; --teal-soft: #dcf1ef;
  --ok: #2c7a3f; --ok-bg: #e5f4e8; --warn: #8f6200; --warn-bg: #fdf1d6; --err: #b42318; --err-bg: #fde8e6;
  --shadow: 0 1px 2px rgba(60, 35, 10, .06), 0 6px 20px rgba(60, 35, 10, .07);
  --radius: 16px;
  --head: "Baloo 2", "Noto Sans Tamil", "Nirmala UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", "Noto Sans Tamil", "Nirmala UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714; --panel: #24201c; --soft: #2d2722; --ink: #f1ebe4; --muted: #b1a597; --line: #3b342d;
    --accent: #f07a50; --accent-2: #f59472; --accent-ink: #1c0d06; --accent-soft: #43271c;
    --teal: #5cc4bc; --teal-soft: #193a37;
    --ok: #7fd08e; --ok-bg: #1c3222; --warn: #eec061; --warn-bg: #3a2f13; --err: #f59a91; --err-bg: #42201d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); }
h1, h2, h3, .brand, .btn, button { font-family: var(--head); }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 8px; }
h2 { font-size: 1.35rem; margin: 32px 0 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1.1rem; margin: 0 0 4px; }
a { color: var(--accent-2); }
.muted { color: var(--muted); }
.icon { flex: none; vertical-align: -0.2em; }
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 56px; }
.foot { text-align: center; font-size: .85rem; padding: 0 16px 32px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; }
nav a:not(.btn):hover { color: var(--accent-2); }

/* buttons */
.btn, button { font-size: 1.02rem; font-weight: 600; cursor: pointer; border: 0; border-radius: 999px; padding: 11px 22px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center;
  gap: 8px; justify-content: center; transition: transform .08s, background .15s; min-height: 44px; }
.btn:hover, button:hover { background: var(--accent-2); }
.btn:active, button:active { transform: scale(.98); }
.btn.small, button.small { padding: 6px 14px; font-size: .95rem; min-height: 36px; }
.btn.big, button.big { padding: 14px 28px; font-size: 1.15rem; }
.btn.ghost, button.ghost { background: transparent; color: var(--accent-2); box-shadow: inset 0 0 0 2px var(--accent); }
.btn.ghost:hover, button.ghost:hover { background: var(--accent-soft); }
button.link { background: none; color: var(--muted); padding: 0; min-height: 0; font-family: var(--body); font-weight: 600; }
button[disabled] { opacity: .7; cursor: progress; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 8px; }
.spinner { width: 1em; height: 1em; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
form.inline { display: inline; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

/* forms */
label { display: block; margin: 16px 0 6px; font-weight: 600; }
.hint { font-size: .9rem; color: var(--muted); margin: 4px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel);
  color: var(--ink); font: inherit; transition: border-color .15s; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { font-weight: 500; display: inline-flex; align-items: center; gap: 8px; margin: 4px 18px 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.counter { float: right; font-size: .85rem; color: var(--muted); font-weight: 400; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }

/* panels and cards */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 14px 0; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel); box-shadow: var(--shadow); }
.card img { width: 100%; border-radius: 10px; display: block; aspect-ratio: 16/9; object-fit: cover; background: var(--soft); }
.card .ph { aspect-ratio: 16/9; border-radius: 10px; background: var(--soft); display: grid; place-items: center;
  color: var(--muted); font-size: .9rem; text-align: center; padding: 10px; border: 2px dashed var(--line); }
.card h3 { margin-top: 10px; }
.card form { margin-top: 8px; }

/* messages */
.toasts { display: grid; gap: 8px; margin-bottom: 8px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); }
.flash span { flex: 1; color: var(--ink); }
.flash.error { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash .close { background: none; color: inherit; padding: 0 4px; min-height: 0; font-size: 1.3rem; line-height: 1; }

/* step bar */
.stepper { display: flex; list-style: none; padding: 0; margin: 18px 0; gap: 0; counter-reset: s; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative;
  font-size: .82rem; color: var(--muted); text-align: center; min-width: 0; }
.stepper li::before { content: ""; position: absolute; top: 17px; right: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.now::before { background: var(--teal); }
.stepper .dot { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel); border: 2px solid var(--line); color: var(--muted); }
.stepper li.done .dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.stepper li.now .dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper li.now { color: var(--ink); font-weight: 700; }
.stepper.compact { margin: 8px 0 0; }
.stepper.compact .dot { width: 24px; height: 24px; }
.stepper.compact .dot .icon { width: 13px; height: 13px; }
.stepper.compact li::before { top: 11px; }
@media (max-width: 560px) { .stepper .lbl { display: none; } .stepper li.now .lbl { display: block; position: absolute; top: 42px; white-space: nowrap; } .stepper { margin-bottom: 34px; } }

/* "what's next" box */
.next { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius);
  background: var(--soft); border: 1px solid var(--line); margin: 6px 0 18px; }
.next.yours { background: var(--accent-soft); border-color: transparent; }
.next.done { background: var(--ok-bg); }
.next.failed { background: var(--err-bg); }
.next .txt { flex: 1 1 280px; }
.next h2 { margin: 0 0 2px; font-size: 1.3rem; }
.next p { margin: 0; color: var(--muted); }
.pulse { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: var(--accent); flex: none; }
.pulse.busy { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 10px var(--accent-soft); } }

/* status pill */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600;
  background: var(--warn-bg); color: var(--warn); }
.badge.yours { background: var(--accent-soft); color: var(--accent-2); }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: var(--err-bg); color: var(--err); }

/* home */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; padding: 28px 0 8px; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero-art { aspect-ratio: 4/3; border-radius: 24px; background:
  radial-gradient(circle at 25% 30%, #ffd27a 0 14%, transparent 15%),
  radial-gradient(circle at 70% 65%, #9fd8cf 0 20%, transparent 21%),
  radial-gradient(circle at 80% 20%, #f8a68a 0 9%, transparent 10%),
  linear-gradient(160deg, var(--accent-soft), var(--teal-soft)); display: grid; place-items: center; color: var(--accent); box-shadow: var(--shadow); }
.hero-art .icon { width: 96px; height: 96px; opacity: .9; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 28px; }
.how .card { text-align: left; }
.how .num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-2); margin-bottom: 8px; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero-art { display: none; } }

/* choose a way to start */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 8px 0 4px; }
.choice { position: relative; display: block; margin: 0; padding: 18px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
.choice input { position: absolute; opacity: 0; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 3px solid var(--teal); }
.choice .ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-2); margin-bottom: 8px; }
.choice strong { font-family: var(--head); font-size: 1.15rem; display: block; }

/* picture drop zone */
.drop { position: relative; display: block; margin: 0; font-weight: 400; border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; background: var(--soft);
  cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop .icon { color: var(--accent); }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.previews figure { margin: 0; position: relative; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.previews figcaption { font-size: .75rem; color: var(--muted); text-align: center; }
.range-out { font-family: var(--head); font-size: 1.1rem; color: var(--accent-2); }

/* your own characters: one picture + name + who they are per row */
.cast-rows { display: grid; gap: 12px; margin: 12px 0; }
.cast-row { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.cast-row[hidden] { display: none; }
.cast-pic { position: relative; flex: none; width: 84px; height: 84px; margin: 0; border-radius: 50%; overflow: hidden; cursor: pointer;
  border: 2px dashed var(--accent); background: var(--panel); display: grid; place-items: center; text-align: center;
  font-size: .75rem; font-weight: 600; color: var(--accent-2); }
.cast-pic input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cast-pic img { width: 100%; height: 100%; object-fit: cover; }
.cast-pic:has(img:not([hidden])) { border-style: solid; }
.cast-fields { flex: 1; display: grid; gap: 8px; min-width: 0; }
select { appearance: auto; }

/* voices & music */
.voice-list { display: grid; gap: 12px; }
.voice-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.voice-head .who { flex: 1; min-width: 160px; }
.avatar.sm { width: 40px; height: 40px; font-size: 1.1rem; flex: none; }
.voice-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.voice-pick select { flex: 1 1 260px; width: auto; }
.voice-pick audio, .music audio { height: 36px; max-width: 100%; }
.own-voice { margin-top: 10px; }
.own-voice summary { font-weight: 600; color: var(--accent-2); font-size: .95rem; }
.own-voice form { margin-top: 8px; display: grid; gap: 8px; }
.music { margin-top: 16px; }
.music .check { margin-right: 10px; }

/* channel analysis */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 10px 0 4px; }
.stat .big { font-family: var(--head); font-size: 1.5rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
ul.tick { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.tick li { padding-left: 22px; position: relative; }
ul.tick li::before { content: ""; position: absolute; left: 4px; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.idea { display: flex; flex-direction: column; gap: 4px; }
.idea p { margin: 4px 0; }
.idea .btn { margin-top: auto; align-self: flex-start; }
.bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--teal); border-radius: 3px; }

.thumb-card { color: inherit; text-decoration: none; }
.thumb-card:hover { border-color: var(--accent); }

/* video shape cards: little frames showing 16:9, 9:16 and both */
.shapes .choice { padding: 14px 16px; }
.shape-box { display: flex; gap: 6px; align-items: flex-end; height: 44px; margin-bottom: 8px; }
.shape-box.wide::before, .shape-box.tall::before, .shape-box.both i { content: ""; display: block; border: 2.5px solid var(--accent);
  border-radius: 5px; background: var(--accent-soft); }
.shape-box.wide::before { width: 64px; height: 36px; }
.shape-box.tall::before { width: 25px; height: 44px; }
.shape-box.both i:first-child { width: 56px; height: 32px; }
.shape-box.both i:last-child { width: 22px; height: 40px; }

/* video editor */
.players { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 6px 0 4px; }
.players video { width: 100%; max-height: 420px; background: #000; border-radius: 10px; display: block; }
.shape-box.square::before { content: ""; display: block; width: 40px; height: 40px; border: 2.5px solid var(--accent);
  border-radius: 5px; background: var(--accent-soft); }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.look { padding: 10px; text-align: center; }
.look .swatch { display: block; height: 54px; border-radius: 10px; margin-bottom: 8px; }
.look strong { font-size: .98rem; }

/* the story agent's note on a plan (what changed / what to decide): friendly, not a warning */
.agent-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--teal-soft); color: var(--teal); margin-top: 10px; }
.agent-note strong { color: var(--ink); font-size: .92rem; }
.agent-note p { margin: 2px 0 0; color: var(--ink); }

/* job cards */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.job-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; color: inherit; text-decoration: none; transition: transform .12s; }
.job-card:hover { transform: translateY(-2px); }
.job-card .thumb { aspect-ratio: 16/9; background: linear-gradient(160deg, var(--accent-soft), var(--teal-soft)); display: grid; place-items: center; color: var(--accent); }
.job-card .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.job-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.job-card .cta { margin-top: auto; padding-top: 8px; font-weight: 700; color: var(--accent-2); display: flex; align-items: center; gap: 6px; }
.empty { text-align: center; padding: 48px 20px; }
.empty .icon { color: var(--accent); width: 56px; height: 56px; }

/* plan review */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.person { display: flex; flex-direction: column; gap: 6px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-size: 1.6rem;
  font-weight: 700; color: #fff; object-fit: cover; }
.card img.avatar { width: 64px; height: 64px; aspect-ratio: 1; border-radius: 50%; }
.scene-list.panel { padding: 4px 20px; }
.pick { position: relative; overflow: hidden; }
.pick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.person .facts { font-size: .92rem; color: var(--muted); }
.person .facts b { color: var(--ink); font-weight: 600; }
.scene-list { list-style: none; padding: 0; margin: 0; }
.scene-list li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.scene-list li:last-child { border-bottom: 0; }
.scene-no { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--teal-soft);
  color: var(--teal); font-family: var(--head); font-weight: 700; }
.scene-list .lines { margin-top: 6px; display: grid; gap: 4px; }
.line b { color: var(--teal); }
.thumb-sm { width: 104px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; margin-left: auto; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); padding: 6px 14px;
  min-height: 34px; font-family: var(--body); font-weight: 500; font-size: .9rem; }
.chip:hover { background: var(--soft); }
.approve-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* price */
.price { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.price .total-box { text-align: center; padding: 22px; border-radius: var(--radius); background: var(--soft); }
.price .amount { font-family: var(--head); font-size: 2.4rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
@media (max-width: 700px) { .price { grid-template-columns: 1fr; } }
.reassure { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: .9rem; color: var(--muted); text-align: left; }
.reassure li { display: flex; gap: 8px; }
.reassure .icon { color: var(--ok); }

/* tables (price items, admin) */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total-row td { border-bottom: 0; font-weight: 700; font-size: 1.1rem; }
.table-wrap { overflow-x: auto; }
.total { font-size: 1.3rem; font-weight: 700; font-family: var(--head); }
pre.log { white-space: pre-wrap; word-break: break-word; font-size: .8rem; max-height: 70vh; overflow: auto;
  background: var(--bg); padding: 12px; border-radius: 10px; border: 1px solid var(--line); }

/* downloads */
.files { display: grid; gap: 10px; }
.file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--soft); color: var(--ink); text-decoration: none; }
.file:hover { background: var(--accent-soft); }
.file .what { flex: 1; }
.file small { display: block; color: var(--muted); }

/* sign in */
.auth { max-width: 440px; margin: 24px auto; }
.auth .panel { padding: 28px; }
details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 8px; }
