:root {
  --bg: #10100e;
  --panel: #181713;
  --panel-soft: #211f19;
  --ink: #f4dec0;
  --muted: #bba382;
  --accent: #d37127;
  --accent-2: #ef9b45;
  --line: rgba(211, 113, 39, 0.72);
  --green: #54b861;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #0d0d0c;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid rgba(211, 113, 39, 0.65);
  background: linear-gradient(180deg, #2a241b, #171511);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent-2);
  color: #fff3df;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  height: 100vh;
}

.sidebar,
.properties {
  background: #141310;
  border-right: 1px solid #332517;
  padding: 18px;
  overflow-y: auto;
}

.properties {
  border-right: 0;
  border-left: 1px solid #332517;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid #3a2b1b;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--accent);
  color: var(--accent-2);
  font-weight: 800;
  letter-spacing: 1px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  line-height: 1.2;
  color: #fff0d2;
}

h2 {
  margin-bottom: 10px;
  color: var(--accent-2);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.brand p,
.hint,
.topbar span,
.empty-props {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tool-group {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.size-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.size-form input,
.size-form select {
  width: 100%;
  border: 1px solid #40311f;
  background: #0d0d0b;
  color: var(--ink);
  border-radius: 6px;
  padding: 8px;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px !important;
}

.checkbox-line input {
  width: auto;
}

.hint {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #40311f;
  background: #181611;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: 62px 1fr;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid #332517;
  background: #11100e;
}

.topbar > div:first-child {
  display: grid;
  gap: 3px;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.zoom-control button {
  min-height: 30px;
  padding: 4px 8px;
}

.canvas-wrap {
  overflow: auto;
  padding: 28px;
  cursor: grab;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #0b0b0a;
  background-size: 28px 28px;
}

.canvas-wrap.panning {
  cursor: grabbing;
  user-select: none;
}

.canvas-stage {
  position: relative;
  min-width: 1px;
  min-height: 1px;
  margin: 0 auto;
}

.menu-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 1400px;
  height: 2000px;
  transform-origin: top left;
  background-color: var(--page-bg-color, var(--bg));
  background-image: var(--page-bg-image, radial-gradient(circle at 28% 22%, rgba(95, 86, 72, 0.18), transparent 24%), radial-gradient(circle at 70% 76%, rgba(211, 113, 39, 0.16), transparent 26%), linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 22%));
  background-size: var(--page-bg-size, auto);
  background-position: center;
  background-repeat: no-repeat;
  border: var(--page-border, 2px solid var(--accent));
  box-shadow: 0 22px 70px var(--shadow);
  overflow: hidden;
}

.menu-canvas::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: var(--page-inner-border, 1px solid rgba(211, 113, 39, 0.4));
  pointer-events: none;
}

.menu-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 92%, rgba(255, 255, 255, 0.08), transparent 14%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
  opacity: 0.42;
  pointer-events: none;
}

.frame-single::before,
.frame-none::before {
  display: none;
}

.frame-gold {
  box-shadow: 0 22px 70px var(--shadow), inset 0 0 0 3px rgba(244, 222, 192, 0.18);
}

.frame-thick {
  box-shadow: 0 22px 70px var(--shadow), inset 0 0 0 7px rgba(211, 113, 39, 0.18);
}

.bg-color::after,
.bg-image::after {
  opacity: 0.25;
}

.menu-node {
  position: absolute;
  min-width: 28px;
  min-height: 24px;
  color: var(--ink);
  border: 1px solid transparent;
  outline: 0;
  user-select: none;
  touch-action: none;
}

.menu-node.selected {
  border-color: #62a8ff;
  box-shadow: 0 0 0 1px rgba(98, 168, 255, 0.55);
}

.menu-node.locked {
  border-color: rgba(244, 222, 192, 0.36);
}

.menu-node.locked.selected {
  border-color: #f1d08a;
  box-shadow: 0 0 0 1px rgba(241, 208, 138, 0.62);
}

.menu-node.locked::after {
  content: "LOCK";
  position: absolute;
  right: 4px;
  top: 4px;
  padding: 2px 5px;
  border: 1px solid rgba(241, 208, 138, 0.55);
  background: rgba(0, 0, 0, 0.62);
  color: #f1d08a;
  font: 10px Arial, sans-serif;
  letter-spacing: 1px;
  pointer-events: none;
}

.menu-node.dragging {
  cursor: grabbing;
}

.node-content {
  width: 100%;
  height: 100%;
  outline: 0;
  overflow: hidden;
  white-space: pre-wrap;
}

.node-title .node-content {
  color: var(--accent-2);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.node-item .node-content strong {
  display: block;
  margin-bottom: 5px;
  color: #fff1d0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.node-item .node-content span {
  color: var(--accent-2);
  float: right;
  font-weight: 700;
}

.node-price .node-content {
  color: #fff0cf;
  text-align: right;
  font-weight: 800;
}

.node-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.node-panel .node-content {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(211, 113, 39, 0.9);
  background: rgba(9, 9, 8, 0.58);
}

.node-line .node-content {
  height: 100%;
  border-top: 2px solid var(--line);
}

.node-icon .node-content {
  display: grid;
  place-items: center;
  color: var(--accent-2);
  font-weight: 900;
}

.style-accent .node-content {
  color: var(--accent-2);
}

.style-muted .node-content {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.style-boxed .node-content {
  border: 1px solid var(--line);
  padding: 16px;
  background: rgba(12, 12, 11, 0.45);
}

.style-pill .node-content {
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  background: rgba(211, 113, 39, 0.12);
  border-radius: 999px;
  color: #fff0cf;
  font-weight: 800;
}

.style-frame-light .node-content {
  border: 1px solid rgba(244, 222, 192, 0.72);
  background: rgba(8, 8, 7, 0.18);
  padding: 10px;
}

.style-frame-double .node-content {
  border: 2px solid rgba(211, 113, 39, 0.85);
  box-shadow: inset 0 0 0 7px rgba(244, 222, 192, 0.12);
  background: rgba(8, 8, 7, 0.28);
  padding: 12px;
}

.style-frame-dark .node-content {
  border: 1px solid rgba(211, 113, 39, 0.72);
  background: rgba(0, 0, 0, 0.55);
  padding: 12px;
}

.resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid #62a8ff;
  background: #111;
  border-radius: 50%;
  cursor: nwse-resize;
  display: none;
}

.selected:not(.locked) .resize-handle {
  display: block;
}

.props-form {
  display: grid;
  gap: 13px;
}

.props-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.props-form input,
.props-form textarea,
.props-form select {
  width: 100%;
  border: 1px solid #40311f;
  background: #0d0d0b;
  color: var(--ink);
  border-radius: 6px;
  padding: 8px;
}

.props-form textarea {
  resize: vertical;
}

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

.button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.danger {
  border-color: #8c3026;
  color: #ffbbb4;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar,
  .properties {
    border: 0;
  }

  .tool-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  body {
    background: #fff;
    overflow: visible;
  }

  .sidebar,
  .properties,
  .topbar {
    display: none;
  }

  .app-shell,
  .workspace,
  .canvas-wrap {
    display: block;
    padding: 0;
    height: auto;
    overflow: visible;
    background: transparent;
  }

  .canvas-stage {
    width: auto !important;
    height: auto !important;
    margin: 0;
  }

  .menu-canvas {
    position: relative;
    transform: none !important;
    margin: 0;
    box-shadow: none;
  }

  .menu-node.selected {
    border-color: transparent;
    box-shadow: none;
  }

  .resize-handle {
    display: none !important;
  }
}
