:root {
  color-scheme: dark;
  font-family: 'Inter', system-ui, sans-serif;
  background: #171323;
  color: #f7f2ff;
}

* { box-sizing: border-box; }

html, body { margin: 0; width: 100%; height: 100%; }

body.creator-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.creator-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(0.75rem, 2vw, 1.75rem);
  background: linear-gradient(110deg, #20182f, #121b27);
  border-bottom: 1px solid #b69de243;
}

.creator-header a {
  color: #e2d7f4;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.creator-header a:hover { color: #ffffff; }

.creator-header h1 {
  margin: 0;
  font-family: 'Orbitron', 'Inter', sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.creator-header h1 span { color: #9addc0; }

.creator-separate { text-align: right; }

.creator-tabs {
  display: flex;
  flex: none;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.55rem clamp(0.75rem, 2vw, 1.75rem);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  background: #221b30;
  border-bottom: 1px solid #b69de248;
}

.creator-tabs button {
  flex: none;
  min-height: 44px;
  padding: 0.6rem 1rem;
  border: 1px solid #b69de254;
  border-radius: 12px;
  background: #30273c;
  color: #eee5fa;
  font: 700 0.83rem 'Inter', system-ui, sans-serif;
  white-space: nowrap;
  scroll-snap-align: start;
  cursor: pointer;
}

.creator-tabs button:hover { border-color: #b69de2; background: #3e314f; }

.creator-tabs button[aria-selected="true"] {
  color: #231633;
  border-color: #e8bad7;
  background: linear-gradient(120deg, #c1a8e6, #f2b3aa);
  box-shadow: 0 3px 14px #b69de248;
}

.creator-header a:focus-visible,
.creator-tabs button:focus-visible,
.creator-error a:focus-visible {
  outline: 3px solid #9addc0;
  outline-offset: 2px;
}

.creator-workspace {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #1a1624;
}

.creator-workspace [hidden] { display: none !important; }

.creator-workspace section[role="tabpanel"] {
  position: absolute;
  inset: 0;
}

.creator-workspace iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.creator-loader,
.creator-error {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: #201b2d;
  color: #f6edff;
  font-weight: 700;
}

.creator-error { display: block; padding-top: min(25vh, 10rem); }
.creator-error a { display: block; margin-top: 1rem; color: #9addc0; }

@media (max-width: 640px) {
  .creator-header {
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    padding: 0.5rem 0.75rem;
  }

  .creator-header h1 { order: -1; width: 100%; text-align: center; }
  .creator-header a { font-size: 0.72rem; }
  .creator-tabs { padding: 0.45rem 0.65rem; gap: 0.35rem; }
  .creator-tabs button { padding: 0.55rem 0.75rem; }
}

@media (max-width: 920px) and (pointer: coarse) {
  /* Proyector3D uses the browser's root scroller instead of an iframe scroller.
     This restores immediate swipes and native pull-to-refresh in Chrome/Brave. */
  body.creator-proyector-scroll { display: block; height: auto; min-height: 100dvh; overflow: visible; }
  .creator-proyector-scroll .creator-workspace { min-height: calc(100dvh - 155px); }
  .creator-proyector-scroll #creatorPanelProyector { position: relative; inset: auto; }
  .creator-proyector-scroll #creatorPanelProyector iframe { min-height: calc(100dvh - 155px); }
}
