:root {
  --bg: #070b12;
  --bg-soft: rgba(12, 17, 29, 0.9);
  --card: rgba(255, 255, 255, 0.05);
  --card-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(170, 186, 255, 0.12);
  --line-strong: rgba(255, 209, 102, 0.18);
  --text: #f3f6ff;
  --muted: #98a5c3;
  --accent: #ff9b3d;
  --accent-2: #ffd166;
  --accent-3: #58e6ae;
  --danger: #ff5d73;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Manrope", sans-serif;
}

body.panel-body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 155, 61, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(88, 230, 174, 0.08), transparent 18%),
    linear-gradient(135deg, #060911 0%, #0b1220 50%, #0f1729 100%);
}

.shell {
  width: min(1460px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.hero-card,
.section-card,
.editor-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02)),
    var(--bg-soft);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-card {
  position: sticky;
  top: 16px;
  height: fit-content;
  border-radius: 28px;
  padding: 22px;
}

.section-card {
  border-radius: 28px;
  padding: 20px;
}

.editor-card,
.room-card,
.tip-card,
.upload-zone,
.item-card {
  border-radius: 24px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

h3 {
  margin-bottom: 0;
  font-size: 24px;
}

.hero-copy,
.section-subtitle,
.tip-card,
.empty-editor,
.item-meta,
.scene-meta,
.upload-subtitle {
  color: var(--muted);
}

.hero-copy,
.section-subtitle,
.empty-editor {
  line-height: 1.65;
}

.section-subtitle {
  margin: 8px 0 0;
  font-size: 14px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-pill.live {
  background: rgba(255, 209, 102, 0.12);
  border-color: rgba(255, 209, 102, 0.34);
}

.status-pill.secure {
  background: rgba(88, 230, 174, 0.1);
  border-color: rgba(88, 230, 174, 0.3);
}

.status-pill.sync {
  background: rgba(170, 186, 255, 0.1);
  border-color: rgba(170, 186, 255, 0.24);
}

.status-pill.hidden {
  color: #ffc8d0;
  background: rgba(255, 93, 115, 0.12);
  border-color: rgba(255, 93, 115, 0.18);
}

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

.status-tile {
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-tile strong {
  font-size: 14px;
}

.status-tile span {
  font-size: 13px;
  line-height: 1.45;
}

.tip-card {
  margin-top: 16px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.approval-waiting {
  display: grid;
  place-items: center;
  margin: 14px 0 8px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.approval-waiting img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.tip-card ol {
  margin: 0;
  padding-left: 18px;
}

.tip-card li + li {
  margin-top: 8px;
}

.hero-actions,
.quick-actions,
.section-head,
.editor-header,
.preview-head,
.room-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-actions,
.quick-actions,
.room-actions {
  flex-wrap: wrap;
}

.hero-card > .hero-actions,
.hero-card .tip-card .hero-actions,
.hero-card .tip-card .quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hero-card .hero-actions .button,
.hero-card .quick-actions .button {
  width: 100%;
}

.hero-card .hero-actions.single-action {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #15110a;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
}

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

.button.ghost {
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.button.danger {
  color: white;
  background: linear-gradient(135deg, #d93a5a 0%, var(--danger) 100%);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 10, 22, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(520px, 100%);
  border-radius: 28px;
  padding: 20px;
  border: 1px solid var(--line);
  background: rgba(10, 18, 38, 0.95);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-close {
  flex-shrink: 0;
}

.modal-card .hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.modal-card .hero-actions .button {
  width: 100%;
}

.modal-card .field {
  margin-top: 8px;
}

.modal-card .field input {
  min-height: 52px;
  border-radius: 18px;
}

.rooms-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.room-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.room-actions .button {
  min-width: 108px;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 132px;
  padding: 22px;
  margin-top: 14px;
  text-align: center;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 155, 61, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.upload-zone.dragover {
  border-color: rgba(255, 209, 102, 0.9);
  background:
    linear-gradient(135deg, rgba(255, 155, 61, 0.16), rgba(255, 255, 255, 0.05)),
    rgba(255, 255, 255, 0.06);
}

.upload-zone input {
  display: none;
}

.upload-title {
  display: block;
  font-size: 18px;
  font-weight: 800;
}

.url-adder {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.quick-builder {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.quick-builder .button {
  min-width: 180px;
}

.preview-shell {
  margin-top: 14px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-head {
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

.preview-hint {
  color: var(--accent-2);
}

.preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, rgba(8, 12, 22, 0.96), rgba(15, 22, 40, 0.9));
  background-size: 40px 40px, 40px 40px, cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.preview-canvas-frame {
  position: absolute;
  border: 2px solid rgba(255, 209, 102, 0.9);
  background: rgba(255, 255, 255, 0.03);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.preview-items-layer {
  position: absolute;
  inset: 0;
}

.preview-item {
  position: absolute;
  padding: 0;
  background: transparent;
  appearance: none;
  transform-origin: center center;
  cursor: grab;
  border: 2px solid transparent;
  transition:
    left 0.18s ease,
    top 0.18s ease,
    width 0.18s ease,
    height 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.preview-item.selected {
  border-color: rgba(255, 209, 102, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18);
}

.preview-item.dragging {
  cursor: grabbing;
  z-index: 9999 !important;
  transition: none;
}

.preview-item img,
.preview-item video,
.preview-item iframe {
  width: 100%;
  height: 100%;
  display: block;
}

.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #101520;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.resize-handle.nw {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.resize-handle.ne {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.resize-handle.sw {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.resize-handle.se {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.scene-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.scene-layout.editor-collapsed {
  grid-template-columns: 1fr;
}

.items-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

.item-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.item-card:hover {
  border-color: rgba(255, 209, 102, 0.22);
}

.item-card.selected {
  border-color: rgba(255, 209, 102, 0.5);
  background: rgba(255, 209, 102, 0.08);
}

.thumb {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
}

.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.embed-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--accent-2);
  background: linear-gradient(135deg, rgba(255, 155, 61, 0.18), rgba(255, 255, 255, 0.04));
}

.item-name {
  margin-bottom: 4px;
  font-weight: 700;
}

.item-meta {
  font-size: 14px;
}

.editor-card {
  min-height: 540px;
  padding: 18px;
}

.editor-form {
  display: grid;
  gap: 10px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.field span,
.field strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(8, 14, 29, 0.94);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.field textarea {
  resize: vertical;
  min-height: 88px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(255, 209, 102, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.12);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.overlay-body {
  background: transparent;
  overflow: hidden;
}

.overlay-stage {
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.overlay-item {
  position: absolute;
  transform-origin: center center;
  transition:
    left 0.22s ease,
    top 0.22s ease,
    width 0.22s ease,
    height 0.22s ease,
    opacity 0.22s ease,
    transform 0.22s ease;
}

.overlay-item img,
.overlay-item video {
  width: 100%;
  height: 100%;
  display: block;
}

.dynamic-card {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px 18px;
  border-radius: 18px;
  text-align: center;
  line-height: 1.1;
  overflow: hidden;
}

.dynamic-card .dynamic-inner {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  justify-items: center;
  align-content: center;
}

.dynamic-card .dynamic-label {
  font-size: 0.3em;
  opacity: 0.82;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dynamic-card .dynamic-value {
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.missing-room {
  position: fixed;
  left: 20px;
  bottom: 20px;
  padding: 12px 16px;
  border-radius: 16px;
  color: white;
  background: rgba(0, 0, 0, 0.72);
}

.hidden {
  display: none !important;
}

body[data-page="home"].home-mode-guest .shell,
body[data-page="home"].home-mode-pending .shell {
  width: min(920px, calc(100% - 28px));
  min-height: 100vh;
  padding: 24px 0;
  grid-template-columns: minmax(320px, 1fr);
  justify-content: center;
  align-content: center;
}

body[data-page="home"].home-mode-guest .hero-card,
body[data-page="home"].home-mode-pending .hero-card {
  position: relative;
  top: auto;
  max-width: 920px;
  margin: 0 auto;
}

body[data-page="home"].home-mode-guest .shell,
body[data-page="home"].home-mode-pending .shell {
  max-width: 920px;
  min-height: calc(100vh - 40px);
  grid-template-columns: 1fr;
  align-content: center;
  justify-content: center;
}

body[data-page="home"].home-mode-guest .workspace,
body[data-page="home"].home-mode-pending .workspace {
  display: none;
}

body[data-page="home"].home-mode-guest .hero-card {
  max-width: 780px;
}

body[data-page="home"].home-mode-guest .hero-card h1,
body[data-page="home"].home-mode-pending .hero-card h1 {
  max-width: 620px;
}

body[data-page="home"].home-mode-pending .hero-card > :not(#accountCard) {
  display: none !important;
}

body[data-page="home"].home-mode-pending #accountCard {
  display: block !important;
  max-width: 540px;
  margin: 0 auto;
}

body[data-page="home"].home-mode-pending #accountCard .hero-actions,
body[data-page="home"].home-mode-pending #accountCard .hero-actions.single-action {
  display: none !important;
}

body[data-page="home"].home-mode-pending #accountCard h2 {
  margin-bottom: 10px;
}

body[data-page="home"].home-mode-pending #accountApprovalNote {
  margin-bottom: 0;
}

.preview-item iframe {
  pointer-events: none;
}

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

  .hero-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1460px);
    padding-top: 10px;
  }

  .section-card,
  .hero-card,
  .editor-card,
  .modal-card {
    border-radius: 22px;
    padding: 18px;
  }

  .grid-two,
  .item-card,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .item-card {
    text-align: left;
  }

  .preview-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .url-adder {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero-card > .hero-actions,
  .hero-card .tip-card .hero-actions,
  .hero-card .tip-card .quick-actions,
  .modal-card .hero-actions,
  .quick-actions,
  .url-adder,
  .grid-two {
    grid-template-columns: 1fr;
  }

  .quick-builder .button,
  .room-actions .button {
    width: 100%;
    min-width: 0;
  }
}
