:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #151d33;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #2563eb;
  --border: #334155;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #1e293b, var(--bg));
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.app-shell {
  width: min(1360px, 100% - 2rem);
  margin: 0 auto;
  min-height: 100vh;
  padding: 1rem 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: start;
}

.preview-panel,
.controls-panel {
  background: color-mix(in oklab, var(--panel) 90%, black);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}

.preview-panel h1 {
  margin: 0;
  font-size: 1.4rem;
}

.preview-panel p {
  margin-top: 0.4rem;
  color: var(--muted);
}

.preview-stage {
  margin-top: 0.75rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #d5d7dc, #bcc0c8);
  border: 1px solid #aeb4bf;
  display: grid;
  place-items: center;
  padding: clamp(0.65rem, 1vw, 1rem);
}

.phone-frame {
  border-radius: 42px;
  padding: clamp(7px, 1.1vw, 10px);
  background: linear-gradient(155deg, #0f131c, #030507);
  border: 2px solid #1d2433;
  box-shadow: 0 20px 45px rgb(0 0 0 / 0.35), 0 10px 18px rgb(0 0 0 / 0.45);
}

.canvas-wrap {
  border-radius: 36px;
  overflow: hidden;
  aspect-ratio: 9/19.5;
  width: min(100%, clamp(270px, 45vw, 430px));
  background: #0f172a;
  position: relative;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  --status-height: 6%;
  --notch-width: 36%;
  --notch-height: 4.2%;
  --safe-top: 10%;
  --safe-bottom: 7%;
}

.lockscreen-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: rgb(236 253 255 / 0.95);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 1.25rem 1rem 0.6rem;
  pointer-events: none;
  text-shadow: 0 2px 8px rgb(2 6 23 / 0.45);
}

.status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.clock-block {
  margin-top: 2.1rem;
  text-align: center;
}

.clock-block p {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 620;
}

.clock-block h2 {
  margin: 0.2rem 0 0;
  line-height: 0.95;
  font-size: clamp(4rem, 12vw, 6.6rem);
  font-weight: 300;
  letter-spacing: -0.04em;
}

.bottom-actions {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 0 1rem 1.55rem;
}

.bottom-actions button {
  border: 0;
  border-radius: 999px;
  width: 2.9rem;
  height: 2.9rem;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: rgb(15 23 42 / 0.55);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
}

.home-bar {
  width: 36%;
  max-width: 150px;
  height: 0.3rem;
  border-radius: 999px;
  margin: 0 auto;
  background: rgb(255 255 255 / 0.92);
}

.status-zone {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--status-height);
  border-bottom: 1px dashed rgb(255 255 255 / 0.45);
  background: rgb(2 6 23 / 0.18);
}

.notch-mask {
  position: absolute;
  left: 50%;
  top: 1.1%;
  transform: translateX(-50%);
  width: var(--notch-width);
  height: var(--notch-height);
  border-radius: 0 0 18px 18px;
  border: 1px solid rgb(255 255 255 / 0.5);
  border-top: 0;
  background: rgb(15 23 42 / 0.45);
}

.safe-zone {
  position: absolute;
  left: 7%;
  right: 7%;
  border: 1px dashed rgb(147 197 253 / 0.8);
  border-radius: 10px;
}

.safe-zone-top {
  top: var(--safe-top);
  height: 15%;
}

.safe-zone-bottom {
  bottom: var(--safe-bottom);
  height: 15%;
}

.preview-overlay[data-profile='iphone-pro-max'] {
  --status-height: 6%;
  --notch-width: 36%;
  --notch-height: 4.2%;
  --safe-top: 10%;
  --safe-bottom: 6.5%;
}

.preview-overlay[data-profile='iphone-pro'] {
  --status-height: 6%;
  --notch-width: 34%;
  --notch-height: 4%;
  --safe-top: 10%;
  --safe-bottom: 6.5%;
}

.preview-overlay[data-profile='android-tall'] {
  --status-height: 5%;
  --notch-width: 20%;
  --notch-height: 2.8%;
  --safe-top: 8.4%;
  --safe-bottom: 5.2%;
}

.preview-overlay[data-profile='android-tall'] .notch-mask {
  border-radius: 12px;
}

.inline-control {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.inline-control input[type='checkbox'] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
  padding: 0;
}

.quick-actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.controls-panel {
  display: grid;
  gap: 0.8rem;
  align-content: start;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.control-group {
  display: grid;
  gap: 0.3rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0;
  padding: 0.6rem 0.7rem 0.7rem;
}

legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.export-targets {
  gap: 0.35rem;
}

.target-option {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
}

.target-option input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.export-status {
  min-height: 1.2rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.export-status[data-tone='warning'] {
  color: #fbbf24;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
}

input,
select,
button {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  color: var(--text);
  background: #0f172a;
}

input[type='color'] {
  padding: 0.15rem;
  min-height: 2.4rem;
}

button {
  cursor: pointer;
  background: var(--accent);
  border-color: #3b82f6;
  font-weight: 600;
}

button.secondary {
  background: transparent;
}

button.export {
  margin-top: 0.5rem;
  min-height: 2.8rem;
}

.stops-list {
  display: grid;
  gap: 0.5rem;
}

.stop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: end;
}

.stop-row label {
  display: grid;
  gap: 0.2rem;
}

.custom-size {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(920px, 100% - 1rem);
    grid-template-columns: 1fr;
    padding: 0.5rem 0;
  }

  .controls-panel {
    max-height: none;
    overflow: visible;
  }

  .canvas-wrap {
    width: min(100%, 420px);
  }

  .stop-row {
    grid-template-columns: 1fr;
  }
}
