body.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--surface); }
.muted { color: var(--muted); font-size: 13px; }

/* sidebar */
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; background: #fff; border-right: 1px solid var(--line); z-index: 40; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 6px; }
.side-close { display: none; }
.new-btn { width: 100%; }
.side-label { font: 700 11.5px var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 8px 8px 0; }
.recent { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.recent a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; font-size: 14px; color: var(--ink-2); }
.recent a:hover { background: var(--surface); }
.recent a.on { background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; }
.recent a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent a span:last-child { color: var(--muted); font-size: 12px; flex: none; }
.side-empty { color: var(--muted); font-size: 13.5px; padding: 4px 10px; margin: 0; }
.side-bottom { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.side-bottom a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.side-bottom a:hover { background: var(--surface); color: var(--blue); }
.side-bottom svg, .btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scrim { display: none; }

/* main */
.main { overflow-x: clip; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; min-height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 14px 24px; min-height: 64px; }
.menu-btn { display: none; }
.topbar-title { font: 700 17px var(--display); letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.stat b { color: var(--ink); font: 700 14px var(--display); }
.stat.hl { background: var(--blue-soft); border-color: #cfe0f3; }
.stat.hl b { color: var(--blue); }

/* start view */
.start { flex: 1; width: min(860px, 100% - 32px); margin: 0 auto; padding: 6vh 0 64px; text-align: center; position: relative; }
.start::before { content: ""; position: absolute; inset: -10% -30% auto; height: 420px; z-index: -1; background: radial-gradient(50% 60% at 50% 30%, rgb(127 179 245 / .3), transparent 70%); }
.start h1 { font-size: clamp(38px, 6vw, 66px); letter-spacing: -.045em; }
.start .sub { color: var(--muted); font-size: 18px; margin: 14px 0 0; }
.start .composer-card { margin-top: 34px; }
.dropzone { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px auto 0; max-width: 780px; padding: 16px; border: 1.5px dashed #c7d5e6; border-radius: 16px; color: var(--muted); font-size: 14px; cursor: pointer; background: rgb(255 255 255 / .6); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--blue-bright); background: var(--blue-soft); color: var(--blue-deep); }
.dropzone b { color: var(--ink); }
.dropzone svg { width: 22px; height: 22px; stroke: var(--blue); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.start .chips { margin-top: 22px; }
.start .chip { font-size: 14px; padding: 8px 14px; }

/* editor */
.editor { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; padding: 0 24px 24px; min-height: 0; height: calc(100dvh - 64px); }
.stage { padding: 0; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font: 600 13.5px var(--font); cursor: pointer; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { border-color: var(--blue-bright); color: var(--blue); }
.tab.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.player { position: relative; flex: 1; min-height: 280px; border-radius: 20px; background: var(--ink); overflow: hidden; display: grid; place-items: center; box-shadow: var(--shadow); }
.player video { width: 100%; height: 100%; object-fit: contain; background: var(--ink); position: absolute; inset: 0; }
.player .empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; color: #b5c3d6; text-align: center; padding: 24px; background: radial-gradient(60% 60% at 50% 40%, rgb(63 127 208 / .35), transparent 70%), var(--ink); }
.player .empty p { max-width: 340px; margin: 0; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .15); border-top-color: var(--blue-glow); animation: rot .9s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.stage-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; }
.status { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; min-width: 0; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-bright); animation: pulse 1.2s ease-in-out infinite; flex: none; }
.status.err { border-color: #f2caca; color: var(--err); }
.status.err .dot { background: var(--err); animation: none; }
@keyframes pulse { 50% { opacity: .25; } }
.stage-foot .btn { margin-left: auto; }

.chat { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.chat-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.chat-head strong { font: 700 16px var(--display); }
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.messages .bubble { white-space: pre-wrap; }
.messages .bubble.ai { background: var(--surface); border: 1px solid var(--line); }
.messages .bubble.tool { color: var(--muted); }
.messages .bubble.tool::before { color: var(--blue-bright); }
.hint p { color: var(--muted); margin: 0 0 10px; font-size: 14px; }
.hint .chip { display: block; width: 100%; text-align: left; margin-bottom: 8px; font-size: 14px; border-radius: 14px; }
.chat-composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-composer textarea { flex: 1; resize: none; max-height: 140px; border-radius: 22px; padding: 11px 16px; line-height: 1.4; }
.chat-composer textarea:focus { border-color: var(--blue-bright); }

@media (max-width: 1100px) { .editor { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  body.menu-open .side { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgb(10 22 38 / .35); z-index: 30; }
  .side-close, .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .stats { width: 100%; justify-content: flex-start; }
  .editor { grid-template-columns: 1fr; height: auto; padding: 0 16px 16px; }
  .player { min-height: 0; aspect-ratio: 16/9; flex: none; }
  .chat { min-height: 70vh; }
  .start { padding-top: 24px; }
  .start .composer-row { align-items: flex-end; }
}

/* Beta access gate */
.gate{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:16px;background:rgba(10,22,38,.45);backdrop-filter:blur(8px)}
.gate-card{width:min(420px,100%);background:#fff;border-radius:24px;padding:32px;display:grid;gap:14px;box-shadow:0 30px 80px -20px rgba(10,22,38,.45)}
.gate-card .logo-mark{width:36px;height:36px}
.gate-card h2{font-size:24px;margin:0}
.gate-card p{margin:0;color:var(--muted,#5b6b80);font-size:15px}
.gate-card input{border:1px solid #d6e0ec;border-radius:12px;padding:12px 14px;font:inherit;font-size:16px}
.gate-card input:focus{outline:2px solid var(--blue);border-color:transparent}
.gate-msg{color:#c0392b!important;min-height:1em}
