* { box-sizing: border-box; }
:root {
  --bg: #060812;
  --panel: rgba(255,255,255,0.05);
  --panel-2: rgba(255,255,255,0.03);
  --stroke: rgba(255,255,255,0.12);
  --text: #f5f7ff;
  --muted: rgba(255,255,255,0.68);
  --accent: #7fa2ff;
  --accent-2: #7ef0d1;
  --danger: #ff6f84;
  --ok: #8ef2d0;
  --warning: #ffd166;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0,0,0,0.35);
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 640px at 78% 10%, rgba(127,162,255,.16), transparent 60%),
    radial-gradient(880px 640px at 8% 86%, rgba(14,184,166,.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body.output-mode {
  overflow: hidden;
  background: #03050a;
}

a { color: inherit; text-decoration: none; }
button, input, select {
  font: inherit;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 18px;
}

.shell--landing {
  max-width: 1100px;
  padding-top: 32px;
}

.card {
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 900px;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.buttonRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.button,
button.button,
.buttonLike {
  appearance: none;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.07);
  color: #fff;
  border-radius: 999px;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 700;
}

.button.secondary {
  background: rgba(255,255,255,.03);
}

.button.danger {
  border-color: rgba(255,111,132,.45);
  background: rgba(255,111,132,.12);
}

.button.ok {
  border-color: rgba(142,242,208,.35);
  background: rgba(142,242,208,.12);
}

.stack {
  display: grid;
  gap: 12px;
}

.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.25fr .9fr;
}

.grid-3 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: #fff;
  border-radius: 14px;
  padding: 10px 12px;
}

.inlineFields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

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

.small {
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  padding: 8px 11px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,.04);
}

.badge.ok { color: var(--ok); border-color: rgba(142,242,208,.3); }
.badge.danger { color: var(--danger); border-color: rgba(255,111,132,.3); }
.badge.warning { color: var(--warning); border-color: rgba(255,209,102,.3); }

.panelTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panelTitle h2,
.panelTitle h3 {
  margin: 0;
  font-size: 20px;
}

.tableLike {
  display: grid;
  gap: 10px;
}

.screenCard {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  background: rgba(255,255,255,.03);
}

.screenCardHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.screenMeta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.screenLinkGrid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.screenLink {
  display: grid;
  place-items: center;
  min-height: 66px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
}

.masterWall {
  position: relative;
  width: 100%;
  min-height: 82vh;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,.1);
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)),
    radial-gradient(circle at center, rgba(255,255,255,.03), rgba(255,255,255,0) 65%);
  overflow: hidden;
}

.masterFrame {
  position: absolute;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  overflow: hidden;
  background: #000;
  box-shadow: 0 16px 50px rgba(0,0,0,.35);
}

.masterFrame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.masterFrameLabel {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
}

.notice {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: var(--muted);
}

.outputCanvas,
.outputHud {
  position: fixed;
  inset: 0;
}

.outputCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #000;
}

.outputHud {
  pointer-events: none;
}

.outputHud .hudBox {
  position: absolute;
  left: 12px;
  top: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.45);
  color: rgba(255,255,255,.86);
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
  border: 1px solid rgba(255,255,255,.09);
  backdrop-filter: blur(10px);
}

.outputHud .identify {
  position: absolute;
  right: 18px;
  top: 18px;
  min-width: 86px;
  min-height: 86px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  border-radius: 22px;
  background: rgba(255,72,108,.68);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 18px 40px rgba(255,72,108,.25);
}

.outputPattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

@media (max-width: 1100px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.shell-master {
  max-width: 1800px;
}

.masterGrid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 480px);
}

.masterSidebar {
  align-self: start;
}

.masterHero {
  padding-bottom: 16px;
}

.masterToolbarRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.compactField {
  min-width: 180px;
}

.masterWall--floorplan {
  min-height: 78vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)),
    #0b0f18;
}

.floorPatch {
  position: absolute;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.44);
  font-size: 12px;
  letter-spacing: .04em;
  background: rgba(255,255,255,.02);
  pointer-events: none;
}

.floorPatch--bar { left: 57%; top: 49%; width: 28%; height: 24%; }
.floorPatch--stage { left: 46%; top: 12%; width: 18%; height: 18%; background: rgba(164,31,124,.18); }
.floorPatch--bath-top { left: 76%; top: 2%; width: 14%; height: 18%; }
.floorPatch--bath-right { left: 84%; top: 39%; width: 10%; height: 18%; }
.floorPatch--stairs-left { left: 30%; top: 6%; width: 14%; height: 13%; }
.floorPatch--stairs-right { left: 84%; top: 2%; width: 12%; height: 15%; }
.floorPatch--closet { left: 12%; top: 49%; width: 14%; height: 18%; }
.floorPatch--entrance { left: 2%; top: 62%; width: 12%; height: 18%; }

.masterFrame {
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.masterFrame.is-drop-target {
  border-color: rgba(126,240,209,.72);
  box-shadow: 0 0 0 2px rgba(126,240,209,.26), 0 18px 40px rgba(0,0,0,.45);
  transform: translateY(-2px);
}

.masterFrameClear,
.masterFrameMediaTag {
  position: absolute;
  z-index: 4;
  border-radius: 999px;
  font-size: 11px;
}

.masterFrameClear {
  right: 8px;
  top: 8px;
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.55);
  color: #fff;
}

.masterFrameMediaTag {
  left: 8px;
  bottom: 8px;
  padding: 5px 9px;
  background: rgba(0,0,0,.62);
  color: rgba(255,255,255,.84);
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.libraryList {
  display: grid;
  gap: 12px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 4px;
}

.libraryGroup {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}

.libraryGroupHeader {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.libraryItems {
  display: grid;
  gap: 8px;
}

.libraryItem {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  cursor: grab;
}

.libraryItem:active {
  cursor: grabbing;
}

.libraryItemTitle {
  font-weight: 700;
  word-break: break-word;
}

.outputMediaStage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.outputMediaLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  will-change: opacity, transform;
}

.outputMediaNode {
  position: absolute;
  display: block;
  max-width: none;
  max-height: none;
  pointer-events: none;
  background: #000;
}

@media (max-width: 1280px) {
  .masterGrid {
    grid-template-columns: 1fr;
  }
}

/* Master wall spatial refresh */
.shell-master {
  max-width: 1920px;
}

.masterGrid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: start;
}

.masterSidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding-right: 4px;
}

.masterMainCard {
  overflow: hidden;
}

.masterToolbarRow .notice {
  flex: 1 1 360px;
}

.wrapOnMobile {
  flex-wrap: wrap;
}

.masterWall--floorplan {
  min-height: min(74vh, 900px);
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)),
    radial-gradient(circle at 38% 72%, rgba(111,196,255,.08), rgba(111,196,255,0) 32%),
    radial-gradient(circle at 72% 26%, rgba(126,240,209,.08), rgba(126,240,209,0) 25%),
    #090d15;
}

.floorPatch {
  border-radius: 18px;
  color: rgba(255,255,255,.48);
  background: rgba(255,255,255,.028);
}

.floorPatch--room { left: 12%; top: 16%; width: 75%; height: 60%; }
.floorPatch--bar { left: 56%; top: 57%; width: 26%; height: 20%; }
.floorPatch--stage { left: 43%; top: 10%; width: 16%; height: 16%; background: rgba(164,31,124,.24); }
.floorPatch--bath-top { left: 80%; top: 3%; width: 15%; height: 17%; }
.floorPatch--bath-right { left: 83%; top: 39%; width: 12%; height: 16%; }
.floorPatch--stairs-left { left: 24%; top: 4%; width: 18%; height: 14%; }
.floorPatch--stairs-right { left: 84%; top: 3%; width: 12%; height: 16%; }
.floorPatch--closet { left: 8%; top: 48%; width: 14%; height: 19%; }
.floorPatch--entrance { left: 1.5%; top: 60%; width: 12%; height: 18%; }

.masterFrame {
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 18px 45px rgba(0,0,0,.42);
}

.masterFrame iframe {
  background: #000;
}

.masterFrameLabel,
.masterFrameMeta,
.masterFrameClear,
.masterFrameMediaTag {
  backdrop-filter: blur(10px);
}

.masterFrameLabel {
  left: 6px;
  top: 6px;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 800;
}

.masterFrameMeta {
  position: absolute;
  left: 6px;
  top: 28px;
  z-index: 3;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(0,0,0,.52);
  color: rgba(255,255,255,.84);
  font-size: 10px;
  max-width: calc(100% - 54px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.masterFrameClear {
  right: 6px;
  top: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}

.masterFrameMediaTag {
  left: 6px;
  right: 6px;
  bottom: 6px;
  max-width: none;
  font-size: 10px;
  padding: 4px 7px;
}

.masterFrame[data-orientation="vertical"] .masterFrameMediaTag,
.masterFrame[data-orientation="vertical"] .masterFrameMeta {
  max-width: calc(100% - 12px);
}

.libraryList {
  max-height: 36vh;
  overflow: auto;
}

.libraryItem {
  position: relative;
}

.libraryItem::after {
  content: 'Arrastrar o clic derecho';
  font-size: 10px;
  color: rgba(255,255,255,.44);
}

.stickyCard {
  position: relative;
}

.contextMenu {
  position: fixed;
  z-index: 80;
}

.contextMenuCard {
  width: 300px;
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(7,10,18,.94);
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}

.contextMenuHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.contextMenuClose {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: #fff;
  font-size: 18px;
}

@media (max-width: 1440px) {
  .masterGrid {
    grid-template-columns: minmax(0, 1fr) 380px;
  }
}

@media (max-width: 1180px) {
  .masterGrid {
    grid-template-columns: 1fr;
  }

  .masterSidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .masterWall--floorplan {
    min-height: 68vh;
  }
}
