:root {
  --bg: #0b0710;
  --sheet: #15101d;
  --sheet-2: #1d1727;
  --field: #0e0a16;
  --line: #2a2238;
  --txt: #f3eefb;
  --muted: #9a90b3;
  --c1: #ff6b5e;
  --c2: #ff3d9a;
  --c3: #a64bff;
  --grad: linear-gradient(120deg, var(--c1), var(--c2) 48%, var(--c3));
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--txt);
  background:
    radial-gradient(900px 600px at 85% -8%, rgba(255, 61, 154, .20), transparent 58%),
    radial-gradient(820px 560px at -8% 108%, rgba(166, 75, 255, .18), transparent 55%),
    var(--bg);
  overflow-x: hidden;
}

.app {
  max-width: 480px;
  margin-inline: auto;
  padding: max(22px, env(safe-area-inset-top)) 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.identity { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.logo { width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 26px -8px var(--c2);
}
.logo svg { width: 22px; height: 22px; }
.identity__text { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.identity__name { font-family: "Syne", sans-serif; font-weight: 800; font-size: clamp(15px, 5vw, 22px); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity__tag { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 12px; flex: none; }

.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #36d399; box-shadow: 0 0 10px #36d399;
  transition: background .2s, box-shadow .2s;
}
.status-dot.is-offline { background: #6b6480; box-shadow: none; }

/* ---------- buttons ---------- */
.iconbtn {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  border: 1px solid var(--line); background: var(--sheet-2); color: var(--txt);
  display: grid; place-items: center; cursor: pointer; transition: transform .15s, border-color .15s;
}
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn:active { transform: scale(.94); }
.iconbtn:hover { border-color: var(--c2); }
.iconbtn--field { width: 50px; height: 50px; background: var(--field); }

.btn {
  border: 1px solid var(--line); background: var(--sheet-2); color: var(--txt);
  font-family: inherit; font-weight: 700; font-size: 14px; letter-spacing: .3px;
  padding: 14px; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.98); }
.btn:hover { border-color: var(--c2); }
.btn--primary {
  border: none; color: #fff; background: var(--grad);
  box-shadow: 0 10px 28px -10px var(--c2);
}
.btn--primary:hover { box-shadow: 0 14px 34px -10px var(--c2); }

/* ---------- phone preview ---------- */
.phone {
  width: 248px; height: 430px; margin-inline: auto; padding: 11px; position: relative;
  border-radius: 42px;
  background: linear-gradient(160deg, #241c33, #0c0814);
  box-shadow:
    0 40px 70px -30px rgba(0, 0, 0, .9),
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 0 0 2px rgba(255, 255, 255, .04);
}
.phone__notch {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 3;
  width: 84px; height: 22px; border-radius: 12px; background: #0a0610;
}
.phone__screen { position: relative; width: 100%; height: 100%; border-radius: 32px; overflow: hidden; background: #000; }
#led { display: block; width: 100%; height: 100%; }
.phone__scan {
  position: absolute; inset: 0; pointer-events: none; opacity: .45; mix-blend-mode: overlay;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .04) 0 1px, transparent 1px 3px);
}
.phone__vignette { position: absolute; inset: 0; pointer-events: none; border-radius: 32px; box-shadow: inset 0 0 80px rgba(0, 0, 0, .6); }

/* ---------- actions row ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---------- control sheet ---------- */
.sheet {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 60px -34px rgba(0, 0, 0, .9);
}
.tabs { display: flex; position: relative; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; padding: 16px 0; border: none; background: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 14px; letter-spacing: .4px;
  color: var(--muted); transition: color .18s; position: relative; z-index: 2;
}
.tab.is-active { color: var(--txt); }
.tab__ink {
  position: absolute; bottom: 0; height: 3px; width: 33.333%; border-radius: 3px;
  background: var(--grad); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
}

.pane { padding: 20px; }
.pane[hidden] { display: none; }
.pane.is-active { animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.label { margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.label--mt { margin-top: 22px; }

/* text field */
.field { display: flex; gap: 10px; }
.field input {
  flex: 1; min-width: 0; padding: 14px; border-radius: 13px;
  background: var(--field); border: 1px solid var(--line); color: var(--txt);
  font-family: inherit; font-weight: 700; font-size: 17px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--c2); box-shadow: 0 0 0 3px rgba(255, 61, 154, .16); }

.voice { margin-top: 14px; }
select {
  width: 100%; padding: 13px; border-radius: 12px; font-family: inherit; font-weight: 600; font-size: 14px;
  background: var(--field); border: 1px solid var(--line); color: var(--txt); outline: none;
}

/* segmented control */
.seg { display: flex; flex-wrap: wrap; gap: 7px; }
.seg__btn {
  flex: 1; min-width: 50px; padding: 11px 4px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line); background: var(--field); color: var(--muted);
  font-family: inherit; font-weight: 700; font-size: 14px; transition: .15s;
}
.seg__btn.is-active { color: #fff; border-color: transparent; background: var(--grad); box-shadow: 0 6px 18px -8px var(--c2); }

/* fonts */
.fonts { display: flex; flex-wrap: wrap; gap: 8px; }
.font {
  flex: 1; min-width: 62px; padding: 13px 4px; border-radius: 12px; cursor: pointer; line-height: 1;
  border: 1px solid var(--line); background: var(--field); color: var(--muted); font-size: 19px; transition: .15s;
}
.font small { display: block; margin-top: 6px; font-family: "Manrope", sans-serif; font-weight: 700; font-size: 10px; letter-spacing: .6px; color: inherit; }
.font.is-active { border-color: var(--c2); background: rgba(255, 61, 154, .12); color: var(--txt); }

/* swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .14); transition: transform .14s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.is-active { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .14); }
.swatch--pick { position: relative; display: grid; place-items: center; background: conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red); }
.swatch--pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch--pick svg { width: 16px; height: 16px; color: #000; filter: drop-shadow(0 0 1px #fff); }

/* slider */
.slider { display: flex; align-items: center; gap: 14px; }
.slider input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 6px; outline: none;
  background: var(--grad);
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; cursor: pointer;
  box-shadow: 0 0 0 4px rgba(255, 61, 154, .22), 0 3px 6px rgba(0, 0, 0, .5);
}
.slider input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: none; border-radius: 50%; background: #fff; cursor: pointer; }
.slider__val { font-family: "Space Mono", monospace; font-weight: 700; font-size: 13px; min-width: 34px; text-align: right; color: var(--c2); }

/* toggle switch */
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.toggle span { font-weight: 600; font-size: 15px; }
.switch {
  width: 50px; height: 28px; border-radius: 20px; cursor: pointer; position: relative; border: 1px solid var(--line);
  background: var(--field); transition: .2s; padding: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--muted); transition: .2s;
}
.switch.is-on { background: var(--grad); border-color: transparent; }
.switch.is-on::after { left: 24px; background: #fff; }

.credit { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; }

/* ---------- present mode ---------- */
.present { position: fixed; inset: 0; z-index: 999; background: #000; }
.present[hidden] { display: none; }
.present__stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
#ledFull { background: #000; transform-origin: center center; will-change: transform; }
.present__ui {
  position: fixed; top: 0; left: 0; width: 100%; display: flex; justify-content: space-between; z-index: 2; transition: opacity .3s;
  padding:
    calc(env(safe-area-inset-top, 0px) + 28px)
    calc(env(safe-area-inset-right, 0px) + 16px)
    16px
    calc(env(safe-area-inset-left, 0px) + 16px);
}
.present__ui.is-hidden { opacity: 0; pointer-events: none; }
.present__btn {
  width: 50px; height: 50px; border-radius: 14px; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: rgba(21, 16, 29, .7); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(8px);
}
.present__btn svg { width: 22px; height: 22px; }
.present__hint { position: fixed; bottom: 18px; width: 100%; text-align: center; z-index: 2; transition: opacity .3s;
  color: rgba(255, 255, 255, .4); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
.present__hint.is-hidden { opacity: 0; }

/* ---------- share dialog ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: 20px; background: var(--sheet); color: var(--txt);
  padding: 24px; max-width: 360px; width: calc(100% - 40px);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9);
}
.dialog::backdrop { background: rgba(5, 3, 8, .6); backdrop-filter: blur(4px); }
.dialog__title { font-family: "Syne", sans-serif; font-weight: 800; margin: 0 0 10px; font-size: 20px; }
.dialog__body { color: var(--muted); margin: 0 0 16px; line-height: 1.5; font-size: 14px; }
.dialog__row { display: flex; gap: 8px; margin-bottom: 14px; }
.dialog__row input {
  flex: 1; min-width: 0; padding: 12px; border-radius: 11px; font-family: "Space Mono", monospace; font-size: 13px;
  background: var(--field); border: 1px solid var(--line); color: var(--txt); outline: none;
}
.dialog__row input[type="email"] { font-family: "Manrope", sans-serif; font-size: 15px; }
.dialog__row input:focus { border-color: var(--c2); box-shadow: 0 0 0 3px rgba(255, 61, 154, .16); }
.dialog__actions { display: flex; gap: 8px; }
.dialog__actions .btn { flex: 1; }
.dialog__check { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 14px; color: var(--muted); cursor: pointer; }
.dialog__check input { width: 18px; height: 18px; accent-color: var(--c2); cursor: pointer; }
.dialog__close { width: 100%; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--sheet-2); border: 1px solid var(--line); color: var(--txt);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 1001;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .8);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
