:root {
  --bg: #0b0b12;
  --panel: #12121b;
  --card: #181824;
  --card-2: #1f1f2e;
  --line: #262636;
  --text: #f2f2f7;
  --muted: #a3a3b8;
  --faint: #6e6e85;
  --a1: #7c5cff;
  --a3: #36c9ff;
  --grad: linear-gradient(90deg, var(--a1), var(--a3));
  --side-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em;
}

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; padding: 12px; gap: 12px; }

.side {
  position: sticky; top: 12px;
  width: var(--side-w); height: calc(100vh - 24px);
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 20px;
  padding: 18px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.side .logo { padding: 0 6px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }

.nav-label {
  margin: 18px 8px 8px;
  font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: var(--card); color: var(--text); }
.nav-item.muted { cursor: default; }
.nav-item.muted:hover { background: none; color: var(--muted); }

.tag {
  margin-left: auto; font-style: normal; font-size: .68rem; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; background: var(--card-2); color: var(--a3);
}

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.tool-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--card); border: 1px solid transparent;
  color: var(--muted); font-weight: 500;
}
.tool-btn:hover { color: var(--text); }
.tool-btn.active { color: var(--text); border-color: var(--a1); background: rgba(124, 92, 255, .12); }

.side-card {
  padding: 16px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(124, 92, 255, .22), rgba(54, 201, 255, .08));
  border: 1px solid var(--line);
  font-size: .88rem; color: var(--muted);
}
.side-card strong { color: var(--text); }
.side-cta {
  display: block; margin-top: 12px; padding: 9px; border-radius: 10px; text-align: center;
  background: var(--text); color: var(--bg); font-weight: 600;
}

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 8px 16px;
}
.logo-mobile { display: none; }
.crumb { font-weight: 500; }
.crumb > span { color: var(--faint); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: .82rem; white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--a3); box-shadow: 0 0 0 0 rgba(54, 201, 255, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(54, 201, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(54, 201, 255, 0); } }

.btn-grad {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 24px -8px rgba(124, 92, 255, .7);
}
.btn-grad:hover { filter: brightness(1.08); }

.btn-ghost, .btn-light {
  display: inline-flex; align-items: center; padding: 10px 16px; font-weight: 600; white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}
.btn-ghost { color: var(--text); background: var(--card-2); }
.btn-ghost:hover { background: #29293c; }
.btn-light { color: var(--bg); background: var(--text); }
.btn-light:hover { background: #fff; }

/* ---------- Workspace ---------- */
.workspace { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 12px; align-items: start; }

.panel {
  position: sticky; top: 12px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--card); border-radius: 12px; }
.tab { flex: 1; padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.tab[aria-selected="true"] { background: var(--card-2); color: var(--text); }

.card { padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.card-title { font-weight: 600; margin-bottom: 10px; }
.card-title small { color: var(--faint); font-weight: 400; }

.model { display: flex; align-items: center; gap: 12px; }
.model-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff;
}
.model-text { display: flex; flex-direction: column; line-height: 1.3; }
.model-text small { color: var(--faint); font-size: .78rem; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px 12px; border: 1.5px dashed var(--line); border-radius: 12px;
  color: var(--faint); font-size: .88rem; text-align: center;
}
.drop svg { width: 24px; height: 24px; }

textarea {
  width: 100%; resize: vertical; min-height: 96px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 0;
  padding: 10px 12px; font: inherit; font-size: .92rem; outline: 0;
}
textarea:focus { border-color: var(--a1); }

.btn-create { width: 100%; padding: 14px; font-size: 1rem; }
.panel-note { font-size: .82rem; color: var(--faint); text-align: center; padding: 0 6px 4px; }
.panel-note.flash { color: var(--a3); }

/* ---------- Stage ---------- */
.stage {
  min-width: 0;
  padding: clamp(20px, 3vw, 36px);
  background:
    radial-gradient(60% 50% at 20% 0%, rgba(124, 92, 255, .22), transparent 70%),
    radial-gradient(50% 40% at 90% 10%, rgba(54, 201, 255, .12), transparent 70%),
    var(--panel);
  border: 1px solid var(--line); border-radius: 18px;
}

h1 {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.9rem, 4.2vw, 3.4rem); line-height: 1.08; letter-spacing: -.03em; font-weight: 700;
}
.h-spark { width: .9em; height: .9em; color: var(--a3); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: .85rem;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
}
.chip svg { width: 14px; height: 14px; color: var(--a3); }

.lead { max-width: 640px; margin-top: 16px; color: var(--muted); font-size: clamp(.98rem, 1.6vw, 1.1rem); }

.notify {
  display: flex; gap: 8px; max-width: 520px; margin-top: 24px;
  padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg);
}
.notify:focus-within { border-color: var(--a1); }
.notify input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; padding: 0 12px; }
.notify input::placeholder { color: var(--faint); }
.notify button { padding: 12px 20px; border-radius: 10px; background: var(--grad); color: #fff; font-weight: 600; white-space: nowrap; }
.notify button:disabled { opacity: .6; cursor: default; }
.notify.pulse { animation: ring 1.2s ease-out; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(124, 92, 255, .7); } 100% { box-shadow: 0 0 0 14px rgba(124, 92, 255, 0); } }

.notify-msg { min-height: 1.6em; margin-top: 10px; font-size: .9rem; color: var(--muted); }
.notify-msg.ok { color: #6ee7b7; }
.notify-msg.err { color: #fca5a5; }

.feature { margin-top: 28px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.feature video, .feature img { display: block; width: 100%; max-height: 70vh; object-fit: cover; }

.gallery { margin-top: 36px; }
.gallery h2 { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: 1.15rem; color: var(--muted); margin-bottom: 16px; }
.grid { columns: 2 240px; column-gap: 12px; }
.tile { break-inside: avoid; margin-bottom: 12px; border-radius: 14px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.tile img, .tile video { display: block; width: 100%; height: auto; }

footer { text-align: center; padding: 24px 16px 8px; color: var(--faint); font-size: .85rem; }

.hp, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }

.bottom-nav { display: none; }

/* ---------- Angled corners (clip-path) ----------
   clip-path cuts away normal borders, so each box is painted in two layers:
   the box itself is filled with the border colour, and a ::before layer, 1px smaller
   and cut the same way, is filled with the real background on top of it. */
.side, .panel, .stage, .card, .side-card, .notify, .tabs, .chip, .badge {
  --cut: 14px;
  --cut-border: var(--line);
  --cut-bg: var(--panel);
  --shape: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  position: relative;
  isolation: isolate;
  border: 0;
  border-radius: 0;
  background: var(--cut-border);
  clip-path: var(--shape);
}
.side::before, .panel::before, .stage::before, .card::before, .side-card::before,
.notify::before, .tabs::before, .chip::before, .badge::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  background: var(--cut-bg);
  clip-path: var(--shape);
  pointer-events: none;
}

.side, .panel { --cut: 20px; --cut-border: linear-gradient(160deg, rgba(124, 92, 255, .55), var(--line) 35%, var(--line) 70%, rgba(54, 201, 255, .45)); }
.stage {
  --cut: 26px;
  --cut-border: linear-gradient(135deg, rgba(124, 92, 255, .7), var(--line) 30%, var(--line) 75%, rgba(54, 201, 255, .6));
  --cut-bg:
    radial-gradient(60% 50% at 20% 0%, rgba(124, 92, 255, .22), transparent 70%),
    radial-gradient(50% 40% at 90% 10%, rgba(54, 201, 255, .12), transparent 70%),
    var(--panel);
}
.card { --cut: 12px; --cut-bg: var(--card); }
.side-card { --cut: 14px; --cut-border: rgba(124, 92, 255, .5); --cut-bg: linear-gradient(160deg, #241d45, #141a2a); }
.tabs { --cut: 10px; --cut-bg: var(--card); }
.notify { --cut: 12px; --cut-bg: var(--bg); }
.notify:focus-within { --cut-border: var(--grad); }
.chip, .badge { --cut: 7px; --cut-bg: var(--card); }
.badge { --cut-bg: var(--bg); }

/* Buttons: solid fills, so a plain cut is enough */
.btn-grad, .notify button, .side-cta, .tab, .tool-btn, .model-icon {
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}
.btn-grad { box-shadow: none; }
.model-icon { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
.tool-btn.active { border: 0; background: linear-gradient(90deg, rgba(124, 92, 255, .35), rgba(54, 201, 255, .15)); }

/* Media: 1px gradient frame around a cut image/video */
.tile, .feature {
  --cut: 18px;
  --shape: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  padding: 1px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, rgba(124, 92, 255, .8), var(--line) 40%, var(--line) 65%, rgba(54, 201, 255, .7));
  clip-path: var(--shape);
  transition: filter .2s;
}
.tile img, .tile video, .feature img, .feature video { clip-path: var(--shape); }
.feature { --cut: 26px; }
.tile:hover { filter: brightness(1.12); }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  :root { --side-w: 76px; }
  .side { padding: 16px 10px; align-items: center; }
  .side .logo span, .nav-label, .side-card, .tag { display: none; }
  .nav-item, .tool-btn { flex-direction: column; gap: 4px; font-size: .7rem; padding: 10px 6px; justify-content: center; text-align: center; }
  .side-nav { align-items: stretch; width: 100%; gap: 6px; }
  .tool-grid { grid-template-columns: 1fr; margin-top: 10px; }
  .nav-item[data-nav="gallery"] { margin-top: 10px; }
  .workspace { grid-template-columns: 1fr; }
  .panel { position: static; order: 2; }
  .stage { order: 1; }
}

/* ---------- Phone ---------- */
@media (max-width: 680px) {
  .shell { padding: 0; gap: 0; }
  .side { display: none; }
  .main-wrap { padding: 0 12px 84px; }
  .topbar { position: sticky; top: 0; z-index: 10; padding: 12px 0; background: rgba(11, 11, 18, .88); backdrop-filter: blur(10px); }
  .logo-mobile { display: inline-flex; }
  .crumb, .badge { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .btn-notify { display: none; }
  .btn-ghost, .btn-light { padding: 8px 12px; font-size: .9rem; }
  .stage { padding: 20px 16px; }
  .notify { flex-direction: column; }
  .notify input { padding: 10px 12px; }
  .grid { columns: 1; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(18, 18, 27, .95); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; font-size: .72rem; color: var(--muted); }
  .bn-item.active { color: var(--text); }
  .bn-item.active svg { color: var(--a3); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dot, .notify.pulse { animation: none; }
}
