:root {
  --ink: #f5fbf7;
  --muted: rgba(226, 240, 232, 0.66);
  --quiet: rgba(226, 240, 232, 0.42);
  --line: rgba(218, 244, 226, 0.16);
  --panel: rgba(8, 35, 39, 0.9);
  --panel-soft: rgba(255, 255, 255, 0.06);
  --accent: #d1ebc6;
  --accent-ink: #173426;
  --radius: 18px;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; background: #071c20; }

body {
  color: var(--ink);
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) max(16px, env(safe-area-inset-left, 0px));
  background: radial-gradient(circle at 72% 12%, rgba(57, 121, 91, 0.3), transparent 34rem), linear-gradient(145deg, #071c20, #0b3031 54%, #152438);
}

.topbar, .workspace { width: min(1180px, 100%); margin: 0 auto; }

.topbar {
  min-height: 46px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.back-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.brand { font-weight: 760; letter-spacing: -0.02em; }
.status-chip { justify-self: end; color: var(--muted); font-size: 12px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
  gap: 14px;
  align-items: start;
}

.preview-section, .controls {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.2);
}

.preview-section { padding: clamp(16px, 3vw, 28px); }
.controls { padding: clamp(18px, 3vw, 28px); }

.preview-heading, .section-heading, .blur-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow { margin: 0 0 7px; color: #a7c8b6; font-size: 11px; font-weight: 800; letter-spacing: 0.16em; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(21px, 3vw, 30px); letter-spacing: -0.04em; }
h2 { font-size: 18px; letter-spacing: -0.02em; }
.output-size, .section-heading > span { color: var(--muted); font-size: 12px; white-space: nowrap; }

.preview-frame {
  position: relative;
  width: min(100%, 650px);
  max-width: 100%;
  margin: 20px auto 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  background: #10282c;
}

#mockupCanvas { display: block; width: 100%; max-width: 100%; height: auto; }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 9px; color: rgba(255, 255, 255, 0.76); pointer-events: none; }
.empty-mark { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(209, 235, 198, 0.55); border-radius: 50%; color: var(--accent); font-size: 28px; line-height: 1; }
.empty-state strong { font-size: 14px; }
.empty-state[hidden], .preview-badge[hidden] { display: none; }
.preview-badge { position: absolute; right: 12px; top: 12px; padding: 6px 9px; border-radius: 999px; background: rgba(5, 21, 24, 0.62); color: var(--accent); font-size: 11px; }

.section-heading { margin-bottom: 14px; }
.section-heading p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.upload-card { min-width: 0; position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-soft); cursor: pointer; }
.upload-card:hover, .upload-card:focus-within { border-color: rgba(209, 235, 198, 0.58); }
.upload-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-thumb { position: relative; display: grid; min-height: 122px; place-items: center; overflow: hidden; border-radius: 11px; background: rgba(255, 255, 255, 0.08); color: var(--accent); }
.upload-thumb span { font-size: 25px; }
.upload-thumb img { display: block; width: 100%; height: 100%; min-height: 122px; object-fit: cover; }
.upload-copy { display: grid; gap: 4px; }
.upload-copy strong { font-size: 13px; }
.upload-copy small { color: var(--muted); font-size: 11px; }

.blur-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-soft); }
.blur-head strong { font-size: 15px; }
.switch { position: relative; display: inline-flex; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.17); transition: background .18s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.blur-slider { display: block; width: 100%; margin: 15px 0 0; accent-color: var(--accent); }
.blur-slider:disabled { opacity: 0.32; }

.actions { display: grid; grid-template-columns: 112px 1fr; gap: 10px; margin-top: 14px; }
.actions button { min-height: 48px; padding: 0 16px; border: 0; border-radius: 14px; font-weight: 760; }
.reset-button { border: 1px solid var(--line) !important; background: transparent; color: var(--muted); }
.generate-button { background: var(--accent); color: var(--accent-ink); }
.generate-button:disabled { background: rgba(255, 255, 255, 0.13); color: var(--quiet); cursor: not-allowed; }
.footnote { margin-top: 14px; color: var(--quiet); font-size: 11px; text-align: center; }

@media (max-width: 760px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .topbar { grid-template-columns: 1fr auto 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .preview-section, .controls { border-radius: 20px; }
  .preview-section { padding: 14px; }
  .controls { padding: 16px; }
  .preview-frame { margin-top: 14px; }
}

@media (max-width: 390px) {
  .upload-thumb, .upload-thumb img { min-height: 104px; }
  .actions { grid-template-columns: 96px 1fr; }
}
