:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0c0d0e;
  color: #f3f5f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #0b0d0f 0%, #151412 48%, #081215 100%);
}

button,
input,
select {
  font: inherit;
  min-width: 0;
}

.shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  margin: 0 auto;
  max-width: 1180px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  color: #7fd7de;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.96;
  margin: 0;
}

.tool-grid {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
}

.controls,
.preview-panel {
  background: rgb(17 19 22 / 0.82);
  border: 1px solid rgb(255 255 255 / 0.09);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.32);
}

.controls {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 18px;
}

label {
  color: #aeb7bd;
  display: grid;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 650;
  min-width: 0;
}

input,
select {
  background: #0d1012;
  border: 1px solid #30363a;
  border-radius: 6px;
  color: #f6f8f9;
  max-width: 100%;
  min-height: 42px;
  padding: 0 12px;
  width: 100%;
}

input[type="file"] {
  align-content: center;
  padding: 9px 10px;
}

input[type="color"] {
  padding: 4px;
  width: 50px;
}

input[type="range"] {
  accent-color: #00d4ff;
  padding: 0;
}

.dimensions,
.actions {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-width: 0;
}

.section-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

button {
  background: #20282d;
  border: 1px solid #3b454b;
  border-radius: 6px;
  color: #f8fbfc;
  cursor: pointer;
  font-weight: 750;
  min-height: 42px;
  min-width: 0;
  padding: 0 16px;
}

button:hover {
  background: #283238;
}

.primary {
  background: #e8faff;
  border-color: #e8faff;
  color: #061014;
}

.primary:hover {
  background: #bff5ff;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 560px;
  overflow: hidden;
  position: sticky;
  top: 28px;
}

.preview-meta {
  align-items: center;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  color: #c4ced3;
  display: flex;
  font-size: 0.86rem;
  justify-content: space-between;
  padding: 14px 16px;
}

.screen-frame {
  align-items: center;
  background: #050607;
  display: grid;
  min-height: 0;
  padding: 20px;
  place-items: center;
}

.stage {
  aspect-ratio: var(--stage-ratio, 16 / 9);
  max-height: 100%;
  max-width: 100%;
  position: relative;
  width: 100%;
}

#preview {
  background: #111;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 8px;
  box-shadow: 0 18px 52px rgb(0 0 0 / 0.42);
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.section-overlay {
  inset: 0;
  position: absolute;
}

.section-box {
  background: transparent;
  border: 1px solid rgb(232 250 255 / 0.42);
  border-radius: 0;
  color: inherit;
  cursor: grab;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  position: absolute;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.section-box::before {
  background: rgb(0 0 0 / 0.26);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.section-box.active {
  border-color: #e8faff;
  box-shadow: 0 0 0 2px rgb(0 212 255 / 0.36), inset 0 0 0 1px rgb(232 250 255 / 0.18);
}

.section-box.has-image::before {
  background: transparent;
}

.section-box:active {
  cursor: grabbing;
}

.section-box img {
  max-width: none;
  pointer-events: none;
  position: absolute;
  user-select: none;
}

.section-label {
  background: rgb(5 6 7 / 0.72);
  border-radius: 4px;
  color: #f6fbfc;
  font-size: 0.72rem;
  font-weight: 750;
  left: 8px;
  line-height: 1;
  padding: 5px 7px;
  pointer-events: none;
  position: absolute;
  top: 8px;
  user-select: none;
}

@media (max-width: 860px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    display: grid;
  }

  .preview-panel {
    min-height: 420px;
    position: static;
  }
}

@media (max-width: 480px) {
  .dimensions,
  .actions {
    grid-template-columns: 1fr;
  }

  .section-actions {
    grid-template-columns: 1fr;
  }
}