/* Search Bar Maker. Palette adapted from a dark tool-launcher recipe, warmed up. */
:root {
  --bg: #0b0b0a;
  --surface: #131311;
  --surface-2: #1a1a17;
  --line: #2a2925;
  --line-soft: #201f1c;
  --text: #f1eee8;
  --text-2: #b4afa6;
  --text-3: #7f7a71;
  --accent: #5cc4ff;
  --accent-ink: #04131c;
  --r-s: 6px;
  --r-m: 12px;
  --r-l: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(11, 11, 10, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand-mark {
  position: relative; width: 26px; height: 26px; border-radius: var(--r-s);
  background: var(--surface-2); border: 1px solid var(--line);
}
.brand-mark i {
  position: absolute; left: 6px; top: 6px; width: 10px; height: 10px;
  border: 2px solid var(--accent); border-radius: 50%;
}
.brand-mark b {
  position: absolute; left: 15px; top: 16px; width: 6px; height: 2px;
  background: var(--accent); transform: rotate(45deg); border-radius: 1px;
}
.pay-link {
  color: var(--text-2); text-decoration: none; font-size: 14px;
  padding: 6px 12px; border-radius: var(--r-s); border: 1px solid var(--line);
  transition: color .18s var(--ease), border-color .18s var(--ease);
  white-space: nowrap;
}
.pay-link:hover { color: var(--text); border-color: var(--text-3); }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 64px; }

.intro { padding: clamp(28px, 6vw, 56px) 0 clamp(20px, 4vw, 36px); max-width: 640px; }
.intro h1 {
  font: 650 clamp(30px, 6.2vw, 52px)/1.04 var(--display);
  letter-spacing: -.03em; margin: 0 0 14px; text-wrap: balance;
}
.intro p { margin: 0; color: var(--text-2); font-size: clamp(15px, 2vw, 17px); max-width: 52ch; }

.workbench { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .workbench { grid-template-columns: minmax(320px, 400px) 1fr; gap: 40px; align-items: start; }
  .stage { position: sticky; top: 76px; }
}

/* Stage + phone */
.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.stage-tabs { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.stage-note { margin: 0; color: var(--text-3); font-size: 13px; text-align: center; min-height: 1.5em; }

.phone {
  --w: min(320px, 78vw);
  width: var(--w);
  aspect-ratio: 390 / 844;
  padding: calc(var(--w) * .035);
  border-radius: calc(var(--w) * .16);
  background: linear-gradient(160deg, #3a3833, #191816 40%, #2b2a26);
  box-shadow: 0 0 0 1px #3d3b36, 0 30px 60px -20px rgba(0, 0, 0, .7);
}
.screen {
  position: relative; width: 100%; height: 100%;
  border-radius: calc(var(--w) * .13);
  overflow: hidden; background: #000;
  container-type: inline-size;
}
.wall { position: absolute; inset: 0; transition: background .25s var(--ease); }
.wall.lock { background:
  radial-gradient(120% 70% at 20% 10%, #c96f3b 0%, transparent 60%),
  radial-gradient(120% 80% at 90% 90%, #2c4b6e 0%, transparent 60%),
  linear-gradient(180deg, #5a3a2a, #1a2433); }
.wall.home { background:
  radial-gradient(110% 70% at 80% 0%, #3f6f6a 0%, transparent 60%),
  radial-gradient(120% 80% at 0% 100%, #6d4b2f 0%, transparent 65%),
  linear-gradient(180deg, #24312f, #1b1712); }
.island {
  position: absolute; left: 50%; top: 2.6%; width: 31%; height: 3.6%;
  transform: translateX(-50%); background: #000; border-radius: 99px; z-index: 5;
}
/* Logical iOS points are 390 wide; 1pt = 100cqw/390 */
#render { position: absolute; inset: 0; z-index: 3; }
.home-grid {
  position: absolute; left: 6.5%; right: 6.5%; top: 9%;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 5.5cqw 7cqw;
  opacity: 0; transition: opacity .2s var(--ease);
}
.home-grid.on { opacity: 1; }
.home-grid span { aspect-ratio: 1; border-radius: 23%; background: rgba(255, 255, 255, .16); }

.el { position: absolute; }
.el-label { white-space: nowrap; overflow: hidden; display: flex; align-items: center; line-height: 1; }
.tap { cursor: pointer; }
.tap:active { filter: brightness(1.15); }

.spot {
  position: absolute; inset: 0; z-index: 8; opacity: 0; pointer-events: none;
  background: rgba(20, 20, 20, .35);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: opacity .2s var(--ease);
}
.spot.on { opacity: 1; pointer-events: auto; }
.spot-field {
  position: absolute; left: 5%; right: 5%; top: 7%; height: 9.5cqw;
  border-radius: 3cqw; background: rgba(255, 255, 255, .2);
  color: rgba(255, 255, 255, .7); font-size: 4.1cqw;
  display: flex; align-items: center; padding-left: 3.5cqw;
  transform: translateY(-8px); transition: transform .22s var(--ease);
}
.spot.on .spot-field { transform: none; }

/* Panel */
.panel { display: grid; gap: 16px; min-width: 0; }
.group {
  margin: 0; padding: 18px; min-width: 0;
  border: 1px solid var(--line-soft); border-radius: var(--r-l);
  background: var(--surface);
  display: grid; gap: 14px;
}
.group legend {
  float: left; width: 100%; padding: 0; margin-bottom: 2px;
  font-weight: 600; font-size: 15px; letter-spacing: -.01em;
}
.group legend + * { clear: both; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { color: var(--text-2); font-size: 13px; display: flex; justify-content: space-between; }
.field output { color: var(--text-3); font-variant-numeric: tabular-nums; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=text], select {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s);
  transition: border-color .15s var(--ease);
}
input[type=text]:focus, select:focus { border-color: var(--accent); outline: none; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.field.color input {
  width: 100%; height: 40px; padding: 4px; border-radius: var(--r-s);
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
}
.field.color input::-webkit-color-swatch-wrapper { padding: 0; }
.field.color input::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 22px; margin: 0; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.check input:disabled + span { color: var(--text-3); }

.segs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s); }
.seg {
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  padding: 7px 12px; border-radius: 4px; font-size: 14px; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.stage-tabs .seg { border-radius: 9px; }
.seg.on { background: #2b2a26; color: var(--text); }

.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.preset {
  position: relative; display: grid; gap: 8px; padding: 10px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-m);
  cursor: pointer; color: var(--text-2); font-size: 13px;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.preset:hover { color: var(--text); }
.preset.on { border-color: var(--accent); color: var(--text); }
.preset .sw { height: 26px; border-radius: 6px; background: linear-gradient(135deg, #8a5636, #2d4562); position: relative; overflow: hidden; }
.preset .sw i { position: absolute; left: 10%; right: 10%; top: 50%; height: 12px; transform: translateY(-50%); }
.preset.locked { opacity: .6; }
.preset.locked::after {
  content: "Pro"; position: absolute; top: 6px; right: 6px; font-size: 11px; line-height: 1;
  padding: 3px 5px; border-radius: 4px; background: var(--bg); color: var(--accent);
}

.pro { border-color: #23343f; background: linear-gradient(180deg, #121a1f, var(--surface) 60%); }
.pro-copy { margin: 0; color: var(--text-2); font-size: 14px; max-width: 56ch; }
.pro-extras { display: grid; gap: 10px; }
.apps-ids { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.apps-ids input { height: 34px; font: 12px var(--mono); }
.pro-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pro.unlocked .pro-actions { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 16px; border-radius: var(--r-s);
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  text-decoration: none; border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #7fd1ff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text-3); }

/* Export */
.export { margin-top: 40px; display: grid; gap: 16px; }
.export-head { display: grid; gap: 14px; }
.export-head h2 { margin: 0; font: 650 24px/1.2 var(--display); letter-spacing: -.02em; }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.field.inline { width: 170px; }
.code {
  margin: 0; max-height: 340px; overflow: auto; padding: 16px;
  background: #080807; border: 1px solid var(--line-soft); border-radius: var(--r-m);
  font: 12px/1.55 var(--mono); color: #cfc9be; white-space: pre;
}
.howto { padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--r-l); }
.howto h3 { margin: 0 0 8px; font-size: 16px; }
.howto ol { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; }
.howto code { font: 13px var(--mono); color: var(--text); }
.muted { margin: 0; color: var(--text-3); font-size: 13px; }
.foot { padding: 0 16px 32px; text-align: center; color: var(--text-3); font-size: 13px; }
.foot a { color: inherit; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  padding: 10px 16px; border-radius: var(--r-m);
  background: rgba(30, 30, 27, .9); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
.apps-ids[hidden] { display: none; }
