:root {
  --bg: #070a13;
  --panel: #0e1424;
  --panel-alt: #131b30;
  --border: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #6366f1;
  --cyan: #38bdf8;
  --emerald: #34d399;
  --amber: #fbbf24;
  --rose: #fb7185;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top right, #131c38 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  min-height: 100vh;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 13, 24, 0.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.star-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  display: grid; place-items: center; font-weight: 900; font-size: 18px;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.45);
}
.brand-lockup h1 { margin: 0; font-size: 18px; letter-spacing: 0.4px; }
.brand-lockup span { font-size: 11px; color: var(--muted); display: block; }

nav.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
nav.tabs button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: 0.15s ease;
}
nav.tabs button.active, nav.tabs button:hover {
  color: #fff;
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.18);
}

main.container { max-width: 1440px; margin: 0 auto; padding: 20px 24px 60px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.grid-studio {
  display: grid;
  grid-template-columns: 340px 1fr 360px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1180px) { .grid-studio { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.card h2, .card h3 { margin: 0 0 10px; font-size: 15px; }
.sub { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

/* 9:16 Phone Canvas Preview (270 x 480 = exact 1:4 scale of 1080 x 1920) */
.phone-stage-wrap { display: flex; flex-direction: column; align-items: center; }
.phone-canvas {
  position: relative;
  width: 270px;
  height: 480px;
  border-radius: 24px;
  border: 3px solid #334155;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 55%, #172554 100%);
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
}

.subject-silhouette {
  position: absolute;
  left: 30px; width: 165px; top: 120px; height: 190px;
  border: 1px dashed rgba(56, 189, 248, 0.45);
  border-radius: 14px;
  background: radial-gradient(circle at 50% 24%, rgba(99, 102, 241, 0.28), rgba(15, 23, 42, 0.2));
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 10px 8px; font-size: 10px; color: #bae6fd; text-align: center;
}

.safe-overlay { position: absolute; pointer-events: none; font-size: 9px; font-weight: 700; padding: 4px 6px; }
.danger-top {
  top: 0; left: 0; right: 0; height: 67px; /* 269px / 4 */
  background: rgba(244, 63, 94, 0.24); border-bottom: 1px dashed #fb7185; color: #fecdd3;
}
.danger-bottom {
  bottom: 0; left: 0; right: 0; height: 168px; /* 672px / 4 */
  background: rgba(244, 63, 94, 0.26); border-top: 1px dashed #fb7185; color: #fecdd3;
}
.danger-right {
  right: 0; top: 210px; bottom: 0; width: 75px; /* 300px / 4 */
  background: rgba(251, 191, 36, 0.20); border-left: 1px dashed #fbbf24; color: #fef08a;
}
.thirds-grid {
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.14) 1px, transparent 1px);
  background-size: 90px 160px;
}
.universal-safe-box {
  left: 30px; width: 165px; top: 72px; height: 240px; /* x:120..780, y:288..1248 */
  border: 1.5px solid rgba(52, 211, 153, 0.85);
  border-radius: 6px;
  color: #6ee7b7;
}

.canvas-pill {
  position: absolute;
  left: 16px; right: 26px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.toggle-list { width: 100%; margin-top: 12px; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.toggle-list label { display: flex; align-items: center; gap: 7px; cursor: pointer; }

.input-row { display: flex; gap: 8px; margin-bottom: 10px; }
input, select, textarea {
  width: 100%;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
}
button.btn {
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
button.btn-ghost {
  background: var(--panel-alt);
  color: #cbd5e1;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
}
button.btn-ghost:hover { border-color: var(--cyan); color: #fff; }

.timeline-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px;
}
.clip-block {
  min-width: 155px;
  border-radius: 10px;
  padding: 10px;
  background: var(--panel-alt);
  border-left: 4px solid var(--accent);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.clip-block .clip-head { font-size: 10px; color: var(--cyan); font-weight: 700; text-transform: uppercase; }
.clip-block .clip-title { font-size: 12px; font-weight: 600; margin: 4px 0 8px; line-height: 1.3; }
.clip-actions { display: flex; align-items: center; justify-content: space-between; gap: 4px; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(56, 189, 248, 0.15); color: var(--cyan);
}
.badge-green { background: rgba(52, 211, 153, 0.16); color: var(--emerald); }
.badge-amber { background: rgba(251, 191, 36, 0.16); color: var(--amber); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.kpi .label { font-size: 11px; color: var(--muted); }
.kpi .val { font-size: 22px; font-weight: 800; margin-top: 4px; color: #fff; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data-table th, table.data-table td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border);
}
table.data-table th { color: var(--muted); font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.log-list { max-height: 190px; overflow-y: auto; font-size: 12px; color: #cbd5e1; padding-left: 16px; }
.log-list li { margin-bottom: 5px; }
