:root {
  --bg: #0e0b16;
  --bg-alt: #161222;
  --card: #1b1630;
  --card-2: #221c3a;
  --border: #2e2650;
  --purple: #9147ff;
  --purple-bright: #b06bff;
  --purple-dim: #6d3fc4;
  --text: #f1eefc;
  --text-dim: #a89fc9;
  --green: #4fe0a0;
  --red: #ff6b81;
  --yellow: #ffc857;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(80, 30, 180, 0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  background: radial-gradient(circle at 20% -10%, #2a1a52 0%, var(--bg) 45%);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
}

a { color: var(--purple-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Nav ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: 0.3px; }
.nav .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent-fill); box-shadow: 0 0 16px var(--purple); }
.nav .links { display: flex; gap: 22px; align-items: center; }
.nav .links a { color: var(--text-dim); font-weight: 600; font-size: 14.5px; }
.nav .links a:hover { color: var(--text); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font-weight: 700; font-size: 14.5px; padding: 11px 20px; transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent-fill); color: white; box-shadow: 0 6px 24px rgba(125, 63, 242, 0.4); }
.btn-primary:hover { background: var(--accent-fill-hover); box-shadow: 0 10px 30px rgba(125, 63, 242, 0.55); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--purple); }
.btn-danger { background: rgba(255,107,129,0.12); color: var(--red); border: 1px solid rgba(255,107,129,0.35); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---------- Hero ---------- */
.hero { padding: 90px 0 60px; text-align: center; }
.badge-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: rgba(145,71,255,0.12); border: 1px solid rgba(145,71,255,0.35); color: var(--purple-bright);
  font-size: 13px; font-weight: 700; margin-bottom: 22px;
}
.hero h1 { font-size: 52px; line-height: 1.08; margin: 0 0 20px; font-weight: 800; letter-spacing: -0.5px; }
.hero h1 .grad { color: var(--purple-bright); }
.hero p.sub { font-size: 19px; color: var(--text-dim); max-width: 680px; margin: 0 auto 34px; line-height: 1.55; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; margin-bottom: 60px; }

/* ---------- Demo visual (moderator panel next to stream output) ---------- */
.demo-visual {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 22px;
  box-shadow: var(--shadow); max-width: 980px; margin: 0 auto;
}
.demo-visual .panel-side, .demo-visual .stream-side { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #100c1e; }
.demo-visual .frame-label { font-size: 12px; color: var(--text-dim); padding: 8px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.demo-visual .frame-label .live { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }
.mock-canvas { position: relative; aspect-ratio: 16/9; background: linear-gradient(135deg, #1a1430, #241a3f); }
.mock-item { position: absolute; border: 2px dashed var(--purple-bright); border-radius: 8px; background: rgba(145,71,255,0.12); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--purple-bright); font-weight: 700; }
.mock-handle { position: absolute; width: 9px; height: 9px; background: var(--purple-bright); border-radius: 50%; }
.mock-stream { position: relative; aspect-ratio: 16/9; background: linear-gradient(160deg, #0b0716, #1c1030 60%, #2a1650); }
.mock-stream .webcam { position: absolute; left: 10%; bottom: 8%; width: 34%; height: 46%; border-radius: 10px; background: #2b2145; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 11px; }
.mock-stream .sticker { position: absolute; top: 12%; right: 10%; width: 30%; padding: 10px; border-radius: 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); text-align: center; font-size: 24px; }
.mock-stream .chat-hint { position: absolute; bottom: 6%; right: 6%; font-size: 10px; color: var(--text-dim); }

/* ---------- Feature grid ---------- */
.section { padding: 70px 0; }
.section h2 { font-size: 32px; text-align: center; margin: 0 0 12px; font-weight: 800; }
.section p.lead { text-align: center; color: var(--text-dim); max-width: 620px; margin: 0 auto 46px; font-size: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.feature-card .icon { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-fill); display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 16px; }
.feature-card h3 { margin: 0 0 8px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--text-dim); font-size: 14.5px; line-height: 1.55; }

/* ---------- How it works ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.step-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px; }
.step-card .num { font-size: 13px; font-weight: 800; color: var(--purple-bright); margin-bottom: 10px; }
.step-card h4 { margin: 0 0 6px; font-size: 15.5px; }
.step-card p { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }

/* ---------- Pricing ---------- */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
.price-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 30px 26px; display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--purple); background: linear-gradient(180deg, rgba(145,71,255,0.12), var(--card)); box-shadow: var(--shadow); transform: scale(1.02); }
.price-card .plan-name { font-weight: 800; font-size: 19px; margin-bottom: 4px; }
.price-card .plan-tagline { color: var(--text-dim); font-size: 13.5px; margin-bottom: 20px; min-height: 40px; }
.price-card .price { font-size: 40px; font-weight: 800; margin-bottom: 4px; }
.price-card .price span { font-size: 15px; color: var(--text-dim); font-weight: 600; }
.price-card ul { list-style: none; padding: 0; margin: 22px 0 26px; flex: 1; }
.price-card ul li { padding: 7px 0; font-size: 14px; color: var(--text-dim); display: flex; gap: 10px; }
.price-card ul li::before { content: "✓"; color: var(--green); font-weight: 800; }
.demo-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,200,87,0.14); border: 1px solid rgba(255,200,87,0.4); color: var(--yellow); padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; margin: 0 auto 26px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 34px 0; color: var(--text-dim); font-size: 13.5px; }
.footer .row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.footer .links a { color: var(--text-dim); margin-right: 18px; }

/* ---------- Auth forms ---------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 36px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; margin: 0 0 6px; }
.auth-card p.hint { color: var(--text-dim); font-size: 13.5px; margin: 0 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field input, .field select {
  width: 100%; min-height: 44px; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text); font-size: 14.5px;
}
.field input:focus, .field select:focus { border-color: var(--purple); }
.role-toggle { display: flex; gap: 8px; margin-bottom: 20px; }
.role-toggle button {
  flex: 1; padding: 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-alt);
  color: var(--text-dim); font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.role-toggle button.active { border-color: var(--purple); color: var(--text); background: rgba(145,71,255,0.14); }
.alert { padding: 11px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: rgba(255,107,129,0.12); border: 1px solid rgba(255,107,129,0.35); color: var(--red); }
.alert-success { background: rgba(79,224,160,0.12); border: 1px solid rgba(79,224,160,0.35); color: var(--green); }
.alert-info { background: rgba(145,71,255,0.12); border: 1px solid rgba(145,71,255,0.35); color: var(--purple-bright); }

/* ---------- App shell (dashboard / mod panel) ---------- */
.app-nav {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 24px;
  border-bottom: 1px solid var(--border); background: var(--bg-alt);
}
.app-nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.app-nav .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-fill); }
.app-nav .user-chip { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-dim); }
.plan-chip { background: rgba(145,71,255,0.14); border: 1px solid rgba(145,71,255,0.35); color: var(--purple-bright); padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; }

.app-body { max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 22px; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card p.hint { color: var(--text-dim); font-size: 13.5px; margin: 0 0 18px; }

.usage-bar { height: 8px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; margin: 8px 0; }
.usage-bar .fill { height: 100%; background: var(--accent-fill); border-radius: 999px; }
.usage-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); margin-bottom: 2px; }

.overlay-url-box { display: flex; gap: 10px; align-items: center; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-family: monospace; font-size: 13px; word-break: break-all; }

table.mod-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mod-table th { text-align: left; color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.mod-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
.status-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-pill.pending { background: rgba(255,200,87,0.14); color: var(--yellow); }
.status-pill.accepted { background: rgba(79,224,160,0.14); color: var(--green); }
.status-pill.revoked { background: rgba(255,107,129,0.14); color: var(--red); }

/* ---------- Moderator canvas editor ---------- */
.editor-shell { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.canvas-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.canvas-viewport {
  position: relative; width: 100%; aspect-ratio: 1920/2240; background:
    repeating-conic-gradient(#241d3d 0% 25%, #1b1630 0% 50%) 0 0/24px 24px;
  border-radius: 10px; overflow: visible; border: 1px solid var(--border);
}
.canvas-frame { position: absolute; inset: 0; border: 2px solid rgba(145,71,255,0.5); border-radius: 8px; pointer-events: none; }
.zone-frame { position: absolute; left: 0; width: 100%; border-radius: 8px; pointer-events: none; box-sizing: border-box; }
.zone-frame.zone-live { border: 2px solid rgba(255,92,201,0.55); background: rgba(255,92,201,0.03); }
.zone-frame.zone-stage { border: 2px dashed rgba(145,71,255,0.45); background: rgba(145,71,255,0.03); }
.zone-label { position: absolute; top: -22px; left: 0; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.zone-label.live { background: var(--live-fill); color: white; }
.zone-label.stage { background: var(--purple); color: white; }
.stage-item-dim { opacity: 0.9; }
.stage-item {
  position: absolute; cursor: move; border: 2px solid transparent; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.stage-item.selected { border-color: var(--purple-bright); box-shadow: 0 0 0 3px rgba(145,71,255,0.25); }
.stage-item.hidden-item { opacity: 0.28; outline: 2px dashed var(--red); }
.stage-item img, .stage-item video { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.stage-item .audio-badge { font-size: 34px; }
.resize-handle {
  position: absolute; width: 12px; height: 12px; background: var(--purple-bright); border: 2px solid white;
  border-radius: 50%; cursor: nwse-resize;
}
.rotate-handle {
  position: absolute; width: 12px; height: 12px; background: var(--accent-fill); border: 2px solid white;
  border-radius: 50%; cursor: grab; top: -28px; left: calc(50% - 6px);
}
.item-label-tag {
  position: absolute; top: -22px; left: 0; font-size: 10.5px; background: var(--purple); color: white;
  padding: 2px 7px; border-radius: 5px; font-weight: 700; white-space: nowrap;
}
.side-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.side-panel h3 { margin: 0 0 12px; font-size: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.field-row label { font-size: 11.5px; color: var(--text-dim); display: block; margin-bottom: 4px; }
.field-row input[type="number"] { width: 100%; padding: 7px 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg-alt); color: var(--text); }
.tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.tray-item {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; position: relative;
}
.tray-item img, .tray-item video { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.tray-item.off .off-tag { position: absolute; bottom: 2px; right: 2px; background: var(--red); color: white; font-size: 8px; padding: 1px 4px; border-radius: 4px; }
.dropzone { border: 1.5px dashed var(--border); border-radius: 10px; padding: 18px; text-align: center; color: var(--text-dim); font-size: 13px; cursor: pointer; }
.dropzone:hover { border-color: var(--purple); color: var(--text); }
.volume-slider { width: 100%; }
.mini-controls { display: flex; gap: 6px; margin-top: 8px; }
.mini-controls button { flex: 1; padding: 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg-alt); color: var(--text); cursor: pointer; font-size: 13px; }
.mini-controls button:hover { border-color: var(--purple); }

.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 999; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 8px 10px 16px; font-size: 13.5px; box-shadow: var(--shadow); max-width: 340px; display: flex; align-items: center; gap: 10px; }
.toast .toast-msg { flex: 1; }
.toast .toast-action { font-weight: 700; white-space: nowrap; }
.toast .toast-x { border: 0; background: transparent; color: inherit; opacity: .6; font-size: 18px; line-height: 1; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; }
.toast .toast-x:hover { opacity: 1; }
.toast.out { opacity: 0; transition: opacity .3s; }
.toast.error { border-color: rgba(255,107,129,0.5); }
.toast.success { border-color: rgba(79,224,160,0.5); }

.legal-body { max-width: 760px; margin: 0 auto; padding: 60px 24px; line-height: 1.7; color: var(--text-dim); }
.legal-body h1 { color: var(--text); margin-bottom: 6px; }
.legal-body h2 { color: var(--text); font-size: 18px; margin-top: 32px; }
.legal-body .updated { font-size: 13px; margin-bottom: 30px; }

@media (max-width: 860px) {
  .grid-3, .grid-2, .steps, .pricing-grid, .demo-visual { grid-template-columns: 1fr; }
  .editor-shell { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
  .price-card.featured { transform: none; }
}

/* ---------- Twitch ---------- */
.btn-twitch { width: 100%; background: #9146ff; color: #fff; border: 0; box-shadow: 0 6px 22px rgba(145, 70, 255, .35); }
.btn-twitch:hover { background: #7f3ae6; }
.btn-twitch svg { width: 18px; height: 18px; }
.btn-twitch[disabled] { opacity: .45; cursor: not-allowed; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 12px; margin: 18px 0; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.twitch-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(145, 70, 255, .25); border-top-color: #9146ff; margin: 0 auto 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.twitch-note { font-size: 12px; color: var(--text-dim); margin-top: 8px; text-align: center; }

img[src^="/img/logo-mark"] { border-radius: 0 !important; object-fit: contain; }
.nav .brand { color: #b9a2ff; font-family: var(--font-brand); }

/* ---------- Accesibilidad: foco visible y movimiento reducido ---------- */
:focus-visible { outline: 2px solid var(--purple-bright); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
