:root {
  color-scheme: light;
  --bg: #edf1f4;
  --panel: #fbfcfd;
  --ink: #182026;
  --muted: #65727d;
  --line: #d8e0e6;
  --accent: #0c7c8c;
  --accent-strong: #075e69;
  --shadow: 0 18px 55px rgba(22, 31, 38, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  background:
    linear-gradient(135deg, transparent 48%, #111 49% 53%, transparent 54%),
    linear-gradient(135deg, #20a6b7, #e6b94a);
  border: 2px solid #152129;
  transform: rotate(-12deg);
  box-shadow: 8px 8px 0 rgba(12, 124, 140, 0.18);
}

h1 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0;
}

p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.controls {
  display: grid;
  gap: 22px;
}

.field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.field input,
.field select {
  grid-column: 1 / -1;
}

output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

select,
input[type="file"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input[type="range"] {
  accent-color: var(--accent);
}

.file-field input {
  padding-top: 9px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-top: 4px;
}

.selected-panel {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.selected-panel[hidden] {
  display: none;
}

.selected-panel strong,
.selected-panel span {
  display: block;
}

.selected-panel strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.selected-panel span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  border-color: #a9b8c3;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(24, 32, 38, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 32, 38, 0.04) 1px, transparent 1px),
    #f5f7f8;
  background-size: 34px 34px;
}

.toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 70px;
  padding: 18px 26px;
  border-bottom: 1px solid rgba(216, 224, 230, 0.85);
  background: rgba(251, 252, 253, 0.82);
  backdrop-filter: blur(14px);
}

.toolbar strong,
.toolbar span {
  display: block;
}

.toolbar strong {
  font-size: 1rem;
}

.toolbar span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

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

#wallSvg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  touch-action: none;
}

.screen-frame {
  fill: rgba(8, 12, 14, 0.96);
  filter: url("#screenShadow");
}

.is-editing [data-panel-id] {
  cursor: grab;
}

.is-editing [data-panel-id].is-dragging {
  cursor: grabbing;
}

.screen-inner {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
}

.screen-inner.is-selected {
  stroke: rgba(244, 200, 79, 0.95);
  stroke-width: 3;
}

.snap-guide {
  stroke: #f4c84f;
  stroke-width: 2;
  stroke-dasharray: 8 7;
  pointer-events: none;
}

.screen-label {
  fill: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px;
  }

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

  .actions,
  .file-field {
    grid-column: 1 / -1;
  }

  .toolbar {
    min-height: 62px;
    padding: 14px 18px;
    gap: 12px;
  }

}

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