/* Drishya — a calm, dark workspace. Colour is reserved for media, selection and the playhead. */
:root {
  --bg: #0e0f13; --bg2: #14161c; --panel: #181b22; --panel2: #1e222b; --line: #272c37; --line2: #323846;
  --text: #e7e9ee; --text2: #a5abb8; --text3: #6d7484;
  --accent: #f5a524; --accent2: #ffcf70; --sel: #f5a524; --play: #ff4d5e; --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
  --vclip: #3a5bd9; --vclip2: #2d47ad; --aclip: #18a37f; --aclip2: #12795f; --tclip: #9b4ddb; --tclip2: #7a37b4; --gclip: #c2416c; --gap: #20242c;
  --radius: 8px; --shadow: 0 10px 30px rgba(0,0,0,.45);
  --font: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { background: rgba(245,165,36,.35); }
.hidden { display: none !important; }
.muted { color: var(--text2); } .dim { color: var(--text3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.f { fill: currentColor; stroke: none; }

/* ---------- buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); white-space: nowrap; }
.btn:hover { border-color: #46506a; background: #232835; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1b1404; font-weight: 650; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
.ibtn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text2); }
.ibtn:hover { background: var(--panel2); color: var(--text); }
.ibtn.on { color: var(--accent); background: rgba(245,165,36,.12); border-color: rgba(245,165,36,.3); }
.ibtn.sm { width: 24px; height: 24px; border-radius: 5px; }
.ibtn.sm svg.i { width: 14px; height: 14px; }
input[type=text], input[type=number], input[type=search], select, textarea { background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; min-width: 0; }
textarea { resize: vertical; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 18px; min-width: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--line2); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--text); margin-top: -4.5px; border: 2px solid var(--bg); }
input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line2); border-radius: 5px; background: none; }
kbd { font-family: var(--mono); font-size: 11px; background: var(--panel2); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text2); }

/* ---------- app frame ---------- */
#app { display: grid; height: 100vh; grid-template-rows: 44px var(--top-h, 58%) 5px 1fr; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--bg2); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 750; letter-spacing: .2px; margin-right: 6px; }
.brand .logo { width: 22px; height: 22px; }
.pname { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; width: 220px; color: var(--text); font-weight: 600; }
.pname:hover, .pname:focus { border-color: var(--line2); background: var(--bg); }
.topbar .sp { flex: 1; }
.saved { font-size: 12px; color: var(--text3); }
.upper { display: grid; grid-template-columns: var(--lib-w, 300px) 5px 1fr 5px var(--insp-w, 320px); min-height: 0; }
.panel { background: var(--panel); min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.split-v { cursor: col-resize; background: var(--bg); }
.split-h { cursor: row-resize; background: var(--bg); }
.split-v:hover, .split-h:hover, .split-v.drag, .split-h.drag { background: var(--accent); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); flex: none; }
.tab { border: 0; background: transparent; color: var(--text2); padding: 5px 9px; border-radius: 6px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.on { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--accent); }
.pbody { flex: 1; overflow: auto; min-height: 0; }
.empty { padding: 30px 20px; text-align: center; color: var(--text3); }

/* ---------- library ---------- */
.libtools { display: flex; gap: 6px; padding: 8px; align-items: center; }
.libtools input[type=search] { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; padding: 8px; }
.item { position: relative; border-radius: 7px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); cursor: grab; user-select: none; }
.item:hover { border-color: var(--line2); }
.item.sel { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.item .th { position: relative; aspect-ratio: 16/9; background: #0a0b0e center/cover no-repeat; display: grid; place-items: center; color: var(--text3); }
.item .th canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.item .meta { display: flex; gap: 6px; padding: 5px 7px; font-size: 11.5px; align-items: center; }
.item .meta b { font-weight: 550; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .dur { position: absolute; right: 5px; bottom: 5px; font: 10.5px var(--mono); background: rgba(0,0,0,.7); padding: 1px 5px; border-radius: 4px; }
.item .used { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); opacity: .8; }
.item .skim { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--play); pointer-events: none; }
.item .warn { position: absolute; left: 5px; top: 5px; background: var(--bad); color: #000; font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.drop { margin: 10px; padding: 26px 14px; border: 1.5px dashed var(--line2); border-radius: 10px; text-align: center; color: var(--text2); }
.drop.over, body.dragging .drop { border-color: var(--accent); color: var(--text); background: rgba(245,165,36,.06); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; padding: 8px; }
.card { border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); padding: 10px; cursor: grab; user-select: none; display: flex; flex-direction: column; gap: 6px; min-height: 76px; }
.card:hover { border-color: #46506a; }
.card .prev { height: 44px; border-radius: 5px; display: grid; place-items: center; font-weight: 800; overflow: hidden; }
.card small { color: var(--text2); }
.sec { padding: 10px 10px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); font-weight: 650; }

/* ---------- viewer ---------- */
.viewer { background: #08090b; }
.vhead { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text2); }
.vhead select { padding: 2px 6px; font-size: 12px; }
.stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; }
.stage canvas.screen { max-width: 100%; max-height: 100%; background: #000; box-shadow: 0 0 0 1px #1d2029; }
.stage .safe { position: absolute; pointer-events: none; border: 1px dashed rgba(255,255,255,.35); }
.stage .ov { position: absolute; pointer-events: none; }
.stage .badge { position: absolute; top: 8px; left: 8px; font: 11px var(--mono); background: rgba(0,0,0,.6); padding: 2px 6px; border-radius: 4px; color: var(--text2); }
.stage .handles { position: absolute; border: 1px solid var(--accent); pointer-events: none; }
.stage .handles i { position: absolute; width: 10px; height: 10px; background: var(--accent); border: 1px solid #000; pointer-events: auto; cursor: nwse-resize; }
.transport { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line); }
.tc { font: 600 15px var(--mono); letter-spacing: .5px; padding: 3px 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); min-width: 128px; text-align: center; cursor: text; }
.tc.dur { font-size: 12px; color: var(--text3); min-width: 0; background: none; border: 0; }
.playbtn { width: 38px; height: 38px; border-radius: 50%; background: var(--text); color: #000; border: 0; display: grid; place-items: center; }
.playbtn:hover { background: #fff; }
.meters { display: flex; gap: 2px; height: 26px; align-items: flex-end; margin-left: 8px; }
.meters i { display: block; width: 5px; height: 100%; background: linear-gradient(to top, #22c55e 0 60%, #eab308 60% 85%, #ef4444 85%); clip-path: inset(var(--m, 100%) 0 0 0); border-radius: 1px; opacity: .9; }

/* ---------- inspector ---------- */
.insp .pbody { padding: 4px 0 20px; }
.group { border-bottom: 1px solid var(--line); padding: 8px 12px 10px; }
.group > h4 { margin: 2px 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.group > h4 .sp { flex: 1; }
.row { display: grid; grid-template-columns: 92px 1fr 64px 22px; align-items: center; gap: 6px; min-height: 28px; }
.row label { color: var(--text2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row input[type=number] { width: 64px; padding: 3px 6px; text-align: right; font: 12px var(--mono); }
.row .kf { width: 20px; height: 20px; display: grid; place-items: center; border: 0; background: none; color: var(--text3); padding: 0; }
.row .kf svg { width: 12px; height: 12px; }
.row .kf.has { color: var(--accent); }
.row .kf.at { color: var(--accent); }
.row .kf.at svg { fill: var(--accent); }
.row.wide { grid-template-columns: 92px 1fr; }
.row.check { grid-template-columns: 92px 1fr; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text2); padding: 3px 9px; border-radius: 5px; font-size: 12px; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: 0 0 0 1px var(--line2); }
.fxcard { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; background: var(--bg2); }
.fxcard > header { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 12.5px; }
.fxcard > header .sp { flex: 1; }
.fxcard > div { padding: 6px 8px; }
.fxcard.off { opacity: .55; }
.wheels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wheel { text-align: center; font-size: 11px; color: var(--text2); }
.wheel canvas { width: 100%; aspect-ratio: 1; border-radius: 50%; cursor: crosshair; touch-action: none; }
.insp-head { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.insp-head .sw { width: 34px; height: 34px; border-radius: 6px; flex: none; }
.insp-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- timeline ---------- */
.tl { display: grid; grid-template-rows: 38px 1fr; background: var(--panel); min-height: 0; }
.tlbar { display: flex; align-items: center; gap: 4px; padding: 0 8px; border-bottom: 1px solid var(--line); }
.tlbar .sep { width: 1px; height: 20px; background: var(--line2); margin: 0 4px; }
.tlbar input[type=range] { width: 120px; }
.tlmain { display: grid; grid-template-columns: var(--head-w, 150px) 1fr; min-height: 0; position: relative; }
.heads { background: var(--bg2); border-right: 1px solid var(--line); overflow: hidden; position: relative; }
.heads .inner { position: absolute; left: 0; right: 0; }
.th-row { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 2px; padding: 0 6px; border-bottom: 1px solid var(--line); font-size: 12px; }
.th-row b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.th-row.main b { color: var(--text); }
.th-row .ibtn.sm.on { color: var(--accent); }
.ruler-pad { height: 26px; border-bottom: 1px solid var(--line); }
.lanes { position: relative; overflow: hidden; outline: none; }
.ruler { position: absolute; left: 0; right: 0; top: 0; height: 26px; background: var(--bg2); border-bottom: 1px solid var(--line); cursor: text; z-index: 3; }
.ruler canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tracks { position: absolute; left: 0; right: 0; top: 26px; bottom: 0; overflow: hidden; }
.tracks .scroll { position: absolute; top: 0; left: 0; }
.lane { position: absolute; left: 0; border-bottom: 1px solid rgba(255,255,255,.03); }
.lane.main { background: rgba(255,255,255,.025); }
.clip { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; overflow: hidden; background: var(--vclip2); border: 1px solid rgba(255,255,255,.12); cursor: default; user-select: none; color: #fff; }
.clip.audio { background: var(--aclip2); }
.clip.title { background: var(--tclip2); }
.clip.gen { background: var(--gclip); }
.clip.gap { background: repeating-linear-gradient(135deg, var(--gap) 0 6px, #1b1f26 6px 12px); border-style: dashed; color: var(--text3); }
.clip.sel { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.clip.off { opacity: .4; filter: grayscale(1); }
.clip .lbl { position: absolute; left: 6px; top: 2px; right: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.7); z-index: 2; pointer-events: none; }
.clip canvas.film { position: absolute; left: 0; top: 0; height: 100%; pointer-events: none; opacity: .85; }
.clip canvas.wave { position: absolute; left: 0; bottom: 0; height: 45%; pointer-events: none; }
.clip.audio canvas.wave { height: 78%; }
.clip .edge { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 3; }
.clip .edge.l { left: 0; } .clip .edge.r { right: 0; }
.clip .edge:hover { background: rgba(245,165,36,.55); }
.clip .fx-dot { position: absolute; right: 5px; top: 3px; font-size: 9px; background: rgba(0,0,0,.55); border-radius: 3px; padding: 0 3px; z-index: 2; }
.clip .kfs { position: absolute; left: 0; right: 0; bottom: 2px; height: 8px; pointer-events: none; z-index: 2; }
.clip .kfs i { position: absolute; width: 6px; height: 6px; background: var(--accent); transform: translateX(-3px) rotate(45deg); }
.clip .vol { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid rgba(255,255,255,.7); z-index: 2; pointer-events: none; }
.trans { position: absolute; top: 6px; bottom: 6px; border-radius: 5px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.4); z-index: 4; cursor: pointer; display: grid; place-items: center; font-size: 10px; }
.trans.sel { border-color: var(--sel); background: rgba(245,165,36,.3); }
.trans:hover { background: rgba(255,255,255,.28); }
.playhead { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--play); z-index: 6; pointer-events: none; }
.playhead::before { content: ''; position: absolute; top: 0; left: -6px; border: 6px solid transparent; border-top: 9px solid var(--play); }
.skimline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid rgba(255,140,60,.75); z-index: 5; pointer-events: none; }
.marker { position: absolute; top: 2px; width: 10px; height: 12px; margin-left: -5px; clip-path: polygon(0 0, 100% 0, 100% 65%, 50% 100%, 0 65%); z-index: 4; cursor: pointer; }
.rangebox { position: absolute; top: 0; bottom: 0; background: rgba(245,165,36,.1); border-left: 1px solid var(--accent); border-right: 1px solid var(--accent); pointer-events: none; z-index: 1; }
.dropghost { position: absolute; border: 2px dashed var(--accent); border-radius: 6px; background: rgba(245,165,36,.12); pointer-events: none; z-index: 7; }
.insertline { position: absolute; width: 3px; margin-left: -1px; background: var(--accent); z-index: 7; pointer-events: none; border-radius: 2px; }
.snapline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed #fff; z-index: 7; pointer-events: none; opacity: .8; }
.hscroll { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; z-index: 8; }
.hscroll i { position: absolute; top: 2px; height: 6px; border-radius: 3px; background: #3a4150; }
.vscroll { position: absolute; top: 26px; right: 0; bottom: 10px; width: 10px; z-index: 8; }
.vscroll i { position: absolute; left: 2px; width: 6px; border-radius: 3px; background: #3a4150; }
.lanes.blade, .lanes.blade .clip { cursor: crosshair; }
.lanes.range .clip { cursor: text; }
.lanes.hand { cursor: grab; }

/* ---------- popups ---------- */
.menu { position: fixed; z-index: 100; min-width: 200px; background: #1f232c; border: 1px solid var(--line2); border-radius: 9px; box-shadow: var(--shadow); padding: 5px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 9px; border: 0; background: none; color: var(--text); text-align: left; padding: 6px 9px; border-radius: 6px; font-size: 12.5px; }
.menu button:hover { background: #2a303c; }
.menu button kbd { margin-left: auto; }
.menu hr { border: 0; border-top: 1px solid var(--line2); margin: 4px 2px; }
.menu button:disabled { opacity: .4; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 90; }
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 15px; flex: 1; }
.modal .body { padding: 16px 18px; display: grid; gap: 12px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.field { display: grid; gap: 5px; }
.field > span { font-size: 12px; color: var(--text2); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.progress { height: 8px; border-radius: 4px; background: var(--bg2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #262b36; border: 1px solid var(--line2); padding: 9px 14px; border-radius: 9px; box-shadow: var(--shadow); z-index: 120; font-size: 13px; max-width: 80vw; }
.toast.bad { border-color: var(--bad); }
.tip { position: fixed; z-index: 130; background: #2a2f3a; border: 1px solid var(--line2); padding: 4px 8px; border-radius: 6px; font-size: 12px; pointer-events: none; white-space: nowrap; }

/* ---------- home (projects) ---------- */
.home { height: 100vh; overflow: auto; background: radial-gradient(1200px 500px at 20% -10%, rgba(245,165,36,.09), transparent), var(--bg); }
.home .wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }
.home header { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.home header .brand { font-size: 20px; }
.home h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin: 26px 0 12px; }
.newgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.newcard { border: 1px solid var(--line2); background: var(--panel); border-radius: 12px; padding: 14px; text-align: left; display: grid; gap: 10px; }
.newcard:hover { border-color: var(--accent); }
.newcard .shape { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; margin: 0 auto; }
.newcard b { font-size: 13px; } .newcard small { color: var(--text2); }
.plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pcard { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; }
.pcard:hover { border-color: var(--line2); }
.pcard .poster { aspect-ratio: 16/9; background: #0a0b0e center/cover; display: grid; place-items: center; color: var(--text3); }
.pcard .info { padding: 10px 12px; }
.pcard .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .info small { color: var(--text3); }
.pcard .more { position: absolute; right: 6px; top: 6px; background: rgba(0,0,0,.6); }
.hero-tag { color: var(--text2); max-width: 640px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
