/* Nexi Studio — black velvet + gold, matches the Nexi brand.
   Layout: slim top bar (brand · nav · extension status), step rail, one working view, login chips bottom-right. */
:root {
  --bg: #0f0d0c; --panel: #191613; --panel-2: #221e1a; --line: #352f28; --line-2: #4a4238;
  --text: #f1ece2; --muted: #a59d90; --faint: #7a7368;
  --gold: #d4af37; --gold-2: #f0d77a; --gold-ink: #1a1408;
  --ok: #6fcf8e; --warn: #e8b04b; --bad: #ff8a7a; --info: #7fb2ff;
  --r: 10px; --r-lg: 14px;
  --font: "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  --display: "Prompt", "Sarabun", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-2); }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 12px max(20px, 3vw); background: rgba(15,13,12,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: .2px; }
.mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--gold); color: var(--gold-ink); font-size: 16px; }
.topnav { display: flex; gap: 18px; font-size: 15px; }
.topnav a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.topnav a.on { color: var(--text); border-color: var(--gold); }
.topnav a.soon { opacity: .55; cursor: default; }
.conn { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
.dot, .sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.conn.ok .dot { background: var(--ok); } .conn.ok { color: var(--text); }
.conn.bad .dot { background: var(--bad); }

.banner { margin: 16px max(20px, 3vw) 0; padding: 14px 16px; border: 1px solid var(--warn); border-radius: var(--r); background: rgba(232,176,75,.08); display: flex; flex-direction: column; gap: 2px; }
.banner span { color: var(--muted); font-size: 15px; }

main { max-width: 1120px; margin: 0 auto; padding: 24px max(20px, 3vw) 120px; }
.steps { list-style: none; margin: 0 0 24px; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.steps li button { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.steps li button .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--panel-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.steps li.on button { color: var(--text); border-color: var(--gold); }
.steps li.on button .n { background: var(--gold); color: var(--gold-ink); }
.steps li.done button .n { background: var(--line-2); color: var(--text); }

h1 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0 0 4px; text-wrap: balance; }
.lead { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.grid { display: grid; gap: 14px; }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.label { font-size: 14px; color: var(--muted); margin: 0 0 6px; display: block; }
.hint { font-size: 13px; color: var(--faint); margin: 6px 0 0; }
textarea, input[type=text], select { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
textarea { resize: vertical; min-height: 96px; }
textarea:focus, input:focus, select:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.type { text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; position: relative; }
.type .ico { font-size: 26px; line-height: 1; }
.type h3 { margin: 4px 0 0; font-size: 18px; font-family: var(--display); font-weight: 500; }
.type p { margin: 0; color: var(--muted); font-size: 15px; }
.type.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.type.soon { opacity: .5; cursor: not-allowed; }
.tag { position: absolute; top: 14px; right: 14px; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 140px; padding: 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; display: flex; align-items: center; gap: 12px; text-align: left; }
.seg button.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.seg .shape { border: 2px solid var(--muted); border-radius: 3px; flex: none; }
.seg button.on .shape { border-color: var(--gold); }
.seg small { display: block; color: var(--muted); font-size: 13px; }

.range { display: flex; align-items: center; gap: 12px; }
.range input { flex: 1; accent-color: var(--gold); }
.range b { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.btn { padding: 11px 20px; border-radius: var(--r); border: 1px solid var(--gold); background: var(--gold); color: var(--gold-ink); font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--gold-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.ghost { padding: 9px 16px; border-radius: var(--r); border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer; }
.ghost:hover { border-color: var(--gold); }
a.ghost, a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

.scene { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.scene:last-child { border-bottom: 0; }
.scene .no { font-variant-numeric: tabular-nums; color: var(--faint); padding-top: 2px; }
.scene .title { margin: 0; font-weight: 500; }
.scene .sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.board { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.board.wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.thumb { aspect-ratio: 9/16; border-radius: 8px; background: var(--panel-2); display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.board.wide .thumb { aspect-ratio: 16/9; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; align-self: flex-start; background: var(--panel-2); color: var(--muted); }

.row-gap { display: flex; gap: 10px; flex-wrap: wrap; }
.working { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.working .err, .err { color: var(--bad); margin: 0; }
.faint { color: var(--faint); font-variant-numeric: tabular-nums; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.scenes .fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.scenes .f-title { font-weight: 500; }
.scenes .f-action { min-height: 60px; font-size: 14px; color: var(--muted); }
.subrow { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.subrow input { flex: 1; }
.tools { display: flex; gap: 4px; }
.icon { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.icon:hover:not(:disabled) { border-color: var(--gold); color: var(--text); }
.icon:disabled { opacity: .35; cursor: default; }
.add { margin-top: 12px; }
.tname { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.peek { margin-top: 16px; }
.peek summary { cursor: pointer; color: var(--muted); }
.peek ol { margin: 10px 0 0; padding-left: 20px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.steps li button:disabled { opacity: .45; cursor: not-allowed; }

.sumrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sumrow .lead { margin: 0; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 12px 0; }
.bar > div { height: 100%; background: var(--gold); transition: width .4s; }
.note { padding: 10px 14px; border: 1px solid var(--warn); border-radius: var(--r); background: rgba(232,176,75,.08); margin: 0 0 12px; }
.pill.ok { background: rgba(111,207,142,.15); color: var(--ok); }
.pill.info { background: rgba(127,178,255,.14); color: var(--info); }
.pill.bad { background: rgba(255,138,122,.14); color: var(--bad); }
.pill b { font-weight: 500; font-variant-numeric: tabular-nums; }
.tile.run { border-color: rgba(127,178,255,.5); }
.tile.fail { border-color: rgba(255,138,122,.45); }
.thumb.running { background: var(--panel-2); }
video.thumb { width: 100%; object-fit: cover; background: #000; display: block; }
.mini { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.mini > div { height: 100%; background: var(--info); }
.slow { margin: 0; font-size: 12px; color: var(--warn); line-height: 1.4; }
.terr { margin: 0; font-size: 12px; color: var(--bad); line-height: 1.4; }
.ghost.small { padding: 5px 10px; font-size: 13px; align-self: flex-start; }

/* projects, characters, long films */
.plist { display: flex; flex-direction: column; gap: 10px; }
.proj { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.proj.on { border-color: var(--gold); }
.proj .hint { margin: 2px 0 0; }
.chars { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.char { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 10px; align-items: start; }
.char .no { color: var(--faint); padding-top: 8px; font-variant-numeric: tabular-nums; }
.char .fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.char .row-gap input { flex: 1; min-width: 140px; }
details.en summary { cursor: pointer; font-size: 13px; color: var(--faint); }
details.en[open] summary { margin-bottom: 6px; }
details.en input, details.en textarea { margin-top: 4px; font-size: 13px; color: var(--muted); }
.scenes .f-action.th { color: var(--text); font-size: 15px; }
.chips { display: flex; flex-direction: column; gap: 4px; }
.chiplabel { font-size: 12px; color: var(--faint); min-width: 42px; align-self: center; }
.castrow { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; }
.chip.on { border-color: var(--gold); color: var(--gold-ink); background: var(--gold); }
.numrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.numrow input[type=number] { width: 88px; }
.numrow label { display: flex; align-items: center; gap: 6px; }
.grow { flex: 1; min-width: 200px; }
.more { margin-top: 16px; }
.jump { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.jump input { width: 72px; padding: 6px 8px; }
.tile.flash { box-shadow: 0 0 0 3px var(--gold); }
.hint.right { text-align: right; }
.ghost.small.danger, .ghost.danger { border-color: rgba(255,138,122,.6); color: var(--bad); }

/* cutter (same look and handling as NexiClip's yellow-box cutter) */
body.noscroll { overflow: hidden; }
.cutter { position: fixed; inset: 0; z-index: 20; background: rgba(8,7,6,.86); display: grid; place-items: center; padding: 16px; }
.cut-box { width: min(980px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cut-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cut-box > * { flex-shrink: 0; } /* the timeline has only absolute children and would be squeezed to 0 height */
.cut-video { width: 100%; max-height: 44vh; background: #000; border-radius: 10px; }
.tl { position: relative; height: 64px; border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; touch-action: none; user-select: none; }
.tlthumbs { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .85; }
.tllayer, .tlmarks { position: absolute; inset: 0; pointer-events: none; }
.tlseg { position: absolute; top: 0; bottom: 0; }
.tlseg.del { background: repeating-linear-gradient(45deg, rgba(239,68,68,.55) 0 8px, rgba(127,29,29,.65) 8px 16px); }
.tlmark { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--gold); }
.tlmark i { position: absolute; top: 2px; left: 3px; font-style: normal; font-size: 11px; background: rgba(0,0,0,.65); color: var(--gold-2); padding: 0 4px; border-radius: 4px; }
.tlsel { position: absolute; top: 0; bottom: 0; border: 3px solid #fbbf24; border-radius: 8px; background: rgba(251,191,36,.18); pointer-events: none; z-index: 2; }
.tlsel.restore { border-color: #22d3ee; background: rgba(34,211,238,.15); }
.tlhandle { position: absolute; top: 0; bottom: 0; width: 18px; background: #fbbf24; cursor: ew-resize; z-index: 3; box-shadow: 0 0 0 2px #0a0e1a; }
.tlhandle::after { content: ""; position: absolute; left: 7px; top: 20px; bottom: 20px; width: 4px; border-radius: 2px; background: #78350f; }
.tlhandle.l { border-radius: 6px 0 0 6px; }
.tlhandle.r { margin-left: -18px; border-radius: 0 6px 6px 0; }
.tlplay { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px #fff; pointer-events: none; z-index: 4; }
.tlctl { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost.danger { border-color: rgba(255,138,122,.6); color: var(--bad); }
.tlnum { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.tlnum label { display: flex; align-items: center; gap: 6px; }
.tlnum input { width: 84px; padding: 6px 8px; font-variant-numeric: tabular-nums; background: var(--panel-2); border: 1px solid #fbbf24; border-radius: 8px; color: var(--text); }
.n-where { font-size: 13px; color: var(--faint); }
.cut-info { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.cut-warn { margin: 0; color: var(--bad); font-size: 14px; }
.tile .row-gap { gap: 6px; }
.tile.off { opacity: .5; }
.badge { font-size: 12px; color: var(--gold-2); }
.film { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 18px; align-items: start; }
.film.wide { grid-template-columns: minmax(0, 1fr); }
.film video { width: 100%; background: #000; border-radius: 10px; }
.film .stats { color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 640px) { .film { grid-template-columns: 1fr; } }

.sites { position: fixed; right: max(16px, 2vw); bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 6; }
.site { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.site .sname { font-weight: 500; }
.site .sstate { color: var(--muted); min-width: 92px; }
.site.ok .sdot { background: var(--ok); }
.site.warn .sdot { background: var(--warn); }
.site button { padding: 4px 12px; font-size: 13px; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 10px; }
  .topnav { order: 3; width: 100%; }
  .scene { grid-template-columns: 26px minmax(0, 1fr); }
  .scene .tools { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* reference photos (0.6.0) */
.photo { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 96px; }
.photo .ghost.small { width: 100%; text-align: center; }
.photo img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--gold); }
.photo .ph { width: 56px; height: 56px; border-radius: 8px; border: 1px dashed var(--line); color: var(--muted); font-size: 11px; display: grid; place-items: center; text-align: center; }
.ghost.small { padding: 6px 10px; font-size: 13px; }
.mt8 { margin-top: 8px; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 560px) { .char { grid-template-columns: 24px minmax(0, 1fr) auto; } .char .photo { grid-column: 2; flex-direction: row; width: auto; } }

/* membership (0.8.0) */
.login { max-width: 460px; margin: 48px auto; display: flex; flex-direction: column; gap: 10px; }
.login input { font-size: 20px; letter-spacing: 2px; text-transform: uppercase; }
.lic { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-left: auto; margin-right: 12px; }
.linkish { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 4px; font-size: 13px; text-decoration: underline; }
