:root {
  --bg: #07070d;
  --panel: #0f0f1a;
  --panel-2: #161625;
  --line: #262640;
  --text: #e8e8f4;
  --muted: #8b8ba8;
  --accent: #00f0ff;
  --accent-2: #ff2bd6;
  --danger: #ff3b5c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: 100dvh;
}

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(ellipse at center, #11111f 0%, var(--bg) 70%);
}

.canvas-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, .6);
}

canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.hud {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .55);
  font: 12px/1.3 ui-monospace, Consolas, monospace;
  color: #cfd;
  pointer-events: none;
}

.banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .7);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.panel {
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 14px 14px 40px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.side-btn {
  margin-left: auto;
  padding: 4px 9px;
  font-size: 12px;
}

.app.panel-left { grid-template-columns: 340px 1fr; }
.app.panel-left .panel {
  order: -1;
  border-left: 0;
  border-right: 1px solid var(--line);
}

.lvl {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.lvl:first-child { border-top: 0; }
.lvl label { margin: 4px 0; }

.lvl-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
}

.lvl-always {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 0 auto;
  font-weight: 400;
  color: var(--text);
}

.lvl-imgs { display: grid; gap: 4px; margin-top: 4px; }

.lvl-img {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b0b14;
  font-size: 12px;
}

.lvl-img-name { flex: 1; }
.lvl-img img { width: 30px; height: 30px; object-fit: contain; }
.lvl-img-none { color: var(--muted); font-size: 11px; }
.lvl-img .file-btn, .lvl-img button { padding: 3px 8px; font-size: 11px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.lib-cat {
  margin: 10px 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
}

.lib-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.lib-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b0b14;
  font-size: 12px;
}

.lib-item.user { grid-column: 1 / -1; }

.lib-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-item button {
  flex: none;
  padding: 2px 7px;
  font-size: 11px;
}

.lib-play { color: var(--accent); }
.lib-del { color: var(--danger); }

.lib-pitch {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  font-size: 11px;
}

.file-btn.upload {
  display: block;
  margin-top: 10px;
  color: var(--accent);
}

/* ---- minhas configs ---- */
#presetName { margin-top: 0; }
.row > input { flex: 2; min-width: 0; }

.preset {
  display: flex;
  gap: 8px;
  margin: 6px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0b14;
}
.preset.current { border-color: var(--accent); }
.preset img, .preset-nothumb {
  flex: none;
  width: 45px;
  height: 80px;
  border-radius: 5px;
  object-fit: cover;
  background: #161625;
}
.preset-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.preset-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-info span { color: var(--muted); font-size: 11px; }
.preset-actions { display: flex; gap: 4px; margin-top: auto; }
.preset-actions button { padding: 3px 7px; font-size: 11px; }
.preset-actions button:first-child { flex: 1; }

/* ---- redes sociais ---- */
.acct {
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b0b14;
}

.acct-head, .acct-user, .pub-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.acct-user { margin: 8px 0; }
.acct-user img { width: 28px; height: 28px; border-radius: 50%; }
.acct button { width: 100%; margin-top: 8px; }

.acct-logo {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.acct-logo.instagram { background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7); }
.acct-logo.google { background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); border-radius: 50%; }

.login-btn { font-weight: 600; }
.login-btn.instagram { background: linear-gradient(90deg, #6228d7, #ee2a7b, #f9a334); border: 0; color: #fff; }
.login-btn.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
button:disabled { opacity: .45; cursor: not-allowed; }

.social-msg { min-height: 1.2em; margin: 6px 0; font-size: 12px; color: var(--accent); }
.social-msg.err, .hint.err { color: var(--danger); }
.hint.warn { color: #fff01f; }

.pub-preview {
  display: block;
  width: 100%;
  max-height: 260px;
  margin-top: 6px;
  border-radius: 8px;
  background: #000;
}

textarea {
  width: 100%;
  margin-top: 3px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0b0b14;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.sub-row { display: flex; align-items: center; justify-content: space-between; }
button.mini { padding: 2px 8px; font-size: 11px; }

.pub {
  margin: 6px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0b14;
  font-size: 12px;
}
.pub a { color: var(--accent); }
.pub-when { margin-left: auto; color: var(--muted); }
.pub-text { margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  border: 1px solid var(--line);
}
.pill.published { border-color: #39ff14; color: #39ff14; }
.pill.error { border-color: var(--danger); color: var(--danger); }
.pill.queued, .pill.processing, .pill.uploading { border-color: #fff01f; color: #fff01f; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.chip {
  padding: 2px 7px;
  border-radius: 6px;
  background: #161625;
  color: var(--muted);
}
.chip b { color: var(--text); }

.legal a { color: var(--muted); }

.tag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 1px 8px;
}

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

.transport .rec { grid-column: 1 / -1; }

.status {
  min-height: 1.4em;
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

details {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  padding: 0 12px;
  background: var(--panel-2);
}

summary {
  cursor: pointer;
  margin: 0 -12px;
  padding: 9px 12px;
  font-weight: 600;
  user-select: none;
}

details[open] { padding-bottom: 12px; }

label {
  display: block;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

label output {
  float: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

input[type=range] { width: 100%; accent-color: var(--accent); }

select, input[type=text], input[type=number] {
  width: 100%;
  margin-top: 3px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0b0b14;
  color: var(--text);
  font: inherit;
}

input[type=color] {
  display: block;
  width: 100%;
  height: 30px;
  margin-top: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b0b14;
  padding: 2px;
}

button, .file-btn {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1c1c30;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: center;
}

button:hover, .file-btn:hover { border-color: var(--accent); }
button.primary { background: #00303a; border-color: var(--accent); }
button.rec { background: #3a0018; border-color: var(--danger); }
button.rec.on { background: var(--danger); color: #fff; }
button.danger { border-color: var(--danger); color: var(--danger); }
button.ghost { background: transparent; width: 100%; }
button.active { background: var(--accent); color: #001014; border-color: var(--accent); font-weight: 600; }

.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 4px;
}

.row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  margin: 8px 0;
}

.row > label { flex: 1; margin: 0; }
.row > button, .row > .file-btn { flex: 1; }

.sub {
  margin-top: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
}

.hint { color: var(--muted); font-size: 12px; }
.keys { margin-top: 12px; }

.img-preview {
  display: block;
  max-width: 80px;
  max-height: 80px;
  margin: 6px 0;
  background: repeating-conic-gradient(#222 0 25%, #333 0 50%) 0 0 / 12px 12px;
  border-radius: 6px;
}

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
  }
  .stage { height: 72dvh; padding: 8px 16px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .app.panel-left { grid-template-columns: 1fr; }
  .app.panel-left .panel { order: 0; border-right: 0; }
  .side-btn { display: none; }
}
