:root {
  --bg: #f2f1ed;
  --card: #ffffff;
  --ink: #101010;
  --muted: #6f6e68;
  --line: #deddd7;
  --dark: #0b0b0b;
  --accent: #d8b56d;
  --accent-soft: #f4ead4;
  --success: #14804a;
  --danger: #b83232;
  --shadow: 0 24px 65px rgba(18, 18, 15, .09);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% 0%, rgba(216,181,109,.13), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1460px;
  margin: 0 auto;
  padding: 0 32px;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--dark);
  font-weight: 900;
  font-size: 21px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; letter-spacing: .08em; text-transform: uppercase; }
.locked-pill {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  color: #4d4c47;
  font-size: 12px;
  font-weight: 700;
}
.lock-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(20,128,74,.11); }

.app-shell { max-width: 1460px; margin: 0 auto; padding: 24px 32px 64px; }
.intro { max-width: 760px; margin: 16px 0 30px; }
.eyebrow { margin: 0 0 11px; color: #8e6d2d; font-size: 11px; font-weight: 800; letter-spacing: .19em; }
.intro h1 { margin: 0; font-size: clamp(36px, 5vw, 67px); line-height: .98; letter-spacing: -.055em; max-width: 710px; }
.intro > p:last-child { margin: 19px 0 0; max-width: 660px; color: var(--muted); font-size: 16px; line-height: 1.6; }

.workspace { display: grid; grid-template-columns: minmax(340px, 480px) minmax(470px, 1fr); gap: 26px; align-items: start; }
.controls-card, .preview-card { background: var(--card); border: 1px solid rgba(26,26,22,.08); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.controls-card { padding: 25px; }
.control-section + .control-section { border-top: 1px solid var(--line); margin-top: 25px; padding-top: 25px; }
.section-heading { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 17px; }
.step { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--dark); font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.section-heading h2 { margin: 1px 0 4px; font-size: 16px; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.dropzone {
  min-height: 144px;
  border: 1.5px dashed #c9c7be;
  border-radius: var(--radius-lg);
  background: #f9f8f5;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.dropzone:hover, .dropzone.dragging { border-color: #9c7936; background: var(--accent-soft); transform: translateY(-1px); }
.upload-icon { width: 41px; height: 41px; border-radius: 13px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); margin-bottom: 10px; }
.upload-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: 14px; }
.dropzone > span:last-child { color: var(--muted); font-size: 11px; margin-top: 5px; }
.inline-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; }
.text-button { border: 0; background: transparent; color: #6e5423; padding: 7px 2px; font-size: 12px; font-weight: 700; cursor: pointer; }
.text-button.danger { color: var(--danger); }
.text-button:disabled { opacity: .35; cursor: not-allowed; }

.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; color: #3f3e3a; font-size: 12px; font-weight: 750; }
.field-label span { color: #98968e; font-size: 10px; font-weight: 600; }
.text-input, .select-input { width: 100%; height: 45px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 13px; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
.text-input:focus, .select-input:focus { border-color: #ad8a46; box-shadow: 0 0 0 4px rgba(216,181,109,.16); }
.field-group { margin-top: 17px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; background: #efeee9; border-radius: 12px; padding: 4px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 36px; border-radius: 9px; display: grid; place-items: center; text-align: center; font-size: 11px; font-weight: 750; color: #68665f; }
.segmented input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.two-fields { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 17px; }
.select-input { appearance: none; background-image: linear-gradient(45deg,transparent 50%,#555 50%),linear-gradient(135deg,#555 50%,transparent 50%); background-position: calc(100% - 17px) 19px,calc(100% - 12px) 19px; background-size: 5px 5px,5px 5px; background-repeat:no-repeat; }
.switch-row { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 12px 0 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.switch-row span { display: block; }
.switch-row strong { display: block; font-size: 12px; }
.switch-row small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row i { width: 40px; height: 23px; border-radius: 99px; background: #d8d7d1; position: relative; transition: .2s; flex: 0 0 auto; }
.switch-row i::after { content:""; width: 17px; height: 17px; border-radius: 50%; background: #fff; position: absolute; left: 3px; top: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: .2s; }
.switch-row input:checked + i { background: var(--dark); }
.switch-row input:checked + i::after { transform: translateX(17px); }

.qr-card { margin-top: 24px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; background: #faf9f6; }
.qr-status-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #ecebe6; color: #747169; }
.qr-status-icon svg { width: 21px; fill: currentColor; }
.qr-status-icon.success { background: #e4f3ea; color: var(--success); }
.qr-status-icon.warning { background: #fff0d4; color: #98640d; }
.qr-status-icon.error { background: #fbe5e5; color: var(--danger); }
.qr-card strong { display: block; font-size: 12px; }
.qr-card p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.qr-card a { display: block; color: var(--success); font-size: 10px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.mini-button { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 9px; font-size: 10px; font-weight: 750; cursor: pointer; }
.mini-button:disabled { opacity: .4; cursor: not-allowed; }
.privacy-note { display: flex; gap: 8px; margin: 14px 1px 18px; color: #77756e; font-size: 10px; line-height: 1.45; }
.privacy-note svg { flex: 0 0 auto; width: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.primary-button { width: 100%; min-height: 52px; border: 0; border-radius: 15px; background: var(--dark); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 13px; cursor: pointer; box-shadow: 0 13px 24px rgba(0,0,0,.15); transition: transform .18s, opacity .18s; }
.primary-button:hover { transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; transform: none; }
.primary-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.preview-card { padding: 18px; position: sticky; top: 18px; }
.preview-toolbar, .preview-footer { display: flex; justify-content: space-between; align-items: center; min-height: 38px; padding: 0 5px; }
.preview-toolbar > div { display: flex; gap: 8px; align-items: center; }
.preview-toolbar strong { font-size: 12px; }
.preview-toolbar > span { color: var(--muted); font-size: 10px; }
.live-dot { width: 7px; height: 7px; background: var(--success); border-radius: 50%; box-shadow: 0 0 0 4px rgba(20,128,74,.11); }
.canvas-stage { position: relative; overflow: hidden; border-radius: 20px; background: #ddd; min-height: 420px; display: grid; place-items: center; }
#previewCanvas { display: block; width: 100%; height: auto; max-height: min(72vh, 850px); object-fit: contain; background: #d9d6cf; }
.empty-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; pointer-events: none; background: linear-gradient(to bottom, transparent 55%, rgba(0,0,0,.12)); color: #fff; text-shadow: 0 2px 20px rgba(0,0,0,.8); }
.empty-overlay.hidden { display: none; }
.empty-badge { font-size: 9px; font-weight: 900; letter-spacing: .15em; padding: 7px 10px; border: 1px solid rgba(255,255,255,.55); border-radius: 99px; margin-bottom: 10px; backdrop-filter: blur(5px); }
.empty-overlay strong { font-size: 16px; }
.empty-overlay p { margin: 5px 0 0; font-size: 11px; opacity: .85; }
.render-loader { position: absolute; inset: 0; display: flex; gap: 10px; align-items: center; justify-content: center; color: #fff; background: rgba(0,0,0,.38); backdrop-filter: blur(2px); font-size: 12px; font-weight: 750; }
.render-loader span { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview-footer { padding-top: 11px; min-height: 49px; }
.preview-footer strong, .preview-footer span { display: block; }
.preview-footer strong { font-size: 11px; }
.preview-footer span { color: var(--muted); font-size: 9px; margin-top: 3px; }
.zoom-button { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.zoom-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.91); display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal canvas { max-width: 93vw; max-height: 91vh; width: auto; height: auto; box-shadow: 0 20px 70px rgba(0,0,0,.4); }
.modal-close { position: fixed; right: 23px; top: 18px; color: #fff; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); width: 42px; height: 42px; border-radius: 50%; font-size: 28px; cursor: pointer; }
.toast { position: fixed; z-index: 110; left: 50%; bottom: 22px; transform: translate(-50%, 18px); padding: 11px 15px; border-radius: 12px; background: #111; color: #fff; font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-card { position: static; order: -1; }
  #previewCanvas { max-height: none; }
}
@media (max-width: 620px) {
  .topbar { height: 66px; padding: 0 17px; }
  .locked-pill { padding: 0 10px; font-size: 10px; }
  .brand small { display: none; }
  .app-shell { padding: 8px 12px 42px; }
  .intro { margin: 12px 6px 22px; }
  .intro h1 { font-size: 39px; }
  .intro > p:last-child { font-size: 13px; }
  .controls-card, .preview-card { border-radius: 22px; }
  .controls-card { padding: 18px; }
  .preview-card { padding: 11px; }
  .canvas-stage { border-radius: 16px; min-height: 330px; }
  .segmented span { font-size: 10px; }
  .qr-card { grid-template-columns: auto 1fr; }
  .qr-card .mini-button { grid-column: 1 / -1; width: 100%; }
  .modal { padding: 8px; }
}
