@font-face{font-family:Selecta;src:url(fonts/Selecta-Regular.otf) format('opentype');font-weight:400;font-display:swap}
@font-face{font-family:Selecta;src:url(fonts/Selecta-Medium.otf) format('opentype');font-weight:500;font-display:swap}
@font-face{font-family:Selecta;src:url(fonts/Selecta-Bold.otf) format('opentype');font-weight:700;font-display:swap}
@font-face{font-family:Kalice;src:url(fonts/Kalice-Regular.woff2) format('woff2');font-weight:400;font-display:swap}

:root{
  --paper:#0e0f13;
  --ink:#f4f2ec;
  --glass:rgba(255,255,255,.07);
  --glass-line:rgba(255,255,255,.14);
  --accent:#a9bdf0;                 /* Wabi mistwater */
  --frame-w:393px;   /* iPhone 15/16 Pro logical points (iOS 17-era Pro) */
  --frame-h:852px;
  --radius:55px;     /* true device corner radius */
  --font-ui:Selecta,-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  --font-display:Kalice,Georgia,serif;
  --font-app:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",system-ui,sans-serif;
  font-family:var(--font-ui);
}

*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  background:
    radial-gradient(120% 90% at 50% -10%, #1a1c26 0%, #0b0c10 55%, #070709 100%);
  color:var(--ink);
  display:grid;
  place-items:center;
  min-height:100dvh;
  overflow:hidden;
  padding:22px;
}

#app{
  display:flex;flex-direction:column;align-items:center;gap:18px;
}

/* ---------- phone frame ---------- */
.frame{
  position:relative;
  width:var(--frame-w);height:var(--frame-h);
  max-width:calc(100vw - 28px);
  max-height:calc(100dvh - 120px);
  aspect-ratio:393/852;
  border-radius:var(--radius);
  overflow:hidden;
  background:#000;
  box-shadow:
    0 0 0 10px #17181d,
    0 0 0 12px #2a2c34,
    0 40px 90px -30px rgba(0,0,0,.9),
    0 10px 30px -10px rgba(0,0,0,.6);
  isolation:isolate;
}
.screen{
  position:absolute;inset:0;
  overflow:hidden;
  background:var(--screen-bg,#faf8f4);
  color:var(--screen-ink,#14151a);
  font-family:var(--font-app);   /* mock apps keep the native system look */
}
.veil{
  position:absolute;inset:0;
  width:100%;height:100%;
  pointer-events:none;
  z-index:5;
}
.statusbar{
  position:absolute;top:0;left:0;right:0;height:52px;
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 30px 0;
  font-size:14px;font-weight:600;
  color:var(--sb-ink,#14151a);
  z-index:6;pointer-events:none;
  mix-blend-mode:var(--sb-blend,normal);
  opacity:var(--sb-opacity,1);
}
.sb-icons{display:flex;gap:6px;align-items:center}
.sb-icons i{display:block;background:currentColor;border-radius:2px}
.sb-icons .sig{width:17px;height:11px;-webkit-mask:linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0);
  clip-path:polygon(0 70%,20% 70%,20% 100%,0 100%, 27% 45%,47% 45%,47% 100%,27% 100%, 54% 22%,74% 22%,74% 100%,54% 100%, 80% 0,100% 0,100% 100%,80% 100%)}
.sb-icons .wifi{width:16px;height:12px;border-radius:2px;
  -webkit-mask:radial-gradient(circle at 50% 100%, #000 32%, transparent 33%);mask:radial-gradient(circle at 50% 100%, #000 32%, transparent 33%)}
.sb-icons .batt{width:24px;height:12px;border-radius:3px;position:relative;background:none;border:1.5px solid currentColor;opacity:.9}
.sb-icons .batt::after{content:"";position:absolute;inset:2px;right:7px;background:currentColor;border-radius:1px}
.sb-icons .batt::before{content:"";position:absolute;right:-3px;top:3px;bottom:3px;width:2px;background:currentColor;border-radius:2px}

/* ---------- dock (quick controls) ---------- */
.dock{
  display:flex;align-items:center;gap:10px;
  max-width:calc(100vw - 28px);
  flex-wrap:wrap;justify-content:center;
}
.apps{display:flex;gap:6px;background:var(--glass);border:1px solid var(--glass-line);
  border-radius:16px;padding:5px;backdrop-filter:blur(14px)}
.apps button{
  border:0;background:transparent;color:var(--ink);
  font:inherit;font-size:12.5px;font-weight:600;
  padding:7px 12px;border-radius:11px;cursor:pointer;opacity:.62;
  transition:opacity .16s, background .16s;white-space:nowrap;
}
.apps button:hover{opacity:.9}
.apps button.on{opacity:1;background:rgba(255,255,255,.14)}
.btn{
  display:inline-flex;align-items:center;gap:7px;
  border:1px solid var(--glass-line);background:var(--glass);color:var(--ink);
  font:inherit;font-size:12.5px;font-weight:600;
  padding:9px 14px;border-radius:14px;cursor:pointer;backdrop-filter:blur(14px);
  transition:background .16s,transform .1s;
}
.btn:hover{background:rgba(255,255,255,.14)}
.btn:active{transform:scale(.96)}
.btn.icon{padding:9px}

/* ---------- settings sheet ---------- */
.sheet{position:fixed;inset:0;z-index:40;display:grid;place-items:end center}
.sheet[hidden]{display:none}
.sheet-scrim{position:absolute;inset:0;background:rgba(0,0,0,.4);backdrop-filter:blur(2px)}
.sheet-body{
  position:relative;width:min(440px,94vw);
  max-height:82dvh;overflow:auto;
  margin-bottom:max(14px,env(safe-area-inset-bottom));
  background:linear-gradient(180deg, rgba(32,33,41,.60), rgba(16,17,22,.70));
  border:1px solid rgba(255,255,255,.13);
  border-radius:26px;
  backdrop-filter:blur(36px) saturate(1.5);
  -webkit-backdrop-filter:blur(36px) saturate(1.5);
  padding:18px 20px 22px;
  box-shadow:0 30px 80px -20px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.09);
  animation:sheetUp .32s cubic-bezier(.2,.9,.2,1);
}
@keyframes sheetUp{from{transform:translateY(24px);opacity:0}to{transform:translateY(0);opacity:1}}
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.sheet-head h2{font-family:var(--font-display);font-size:21px;font-weight:400;letter-spacing:.005em}
.sheet-close{border:0;background:var(--glass);color:var(--ink);width:30px;height:30px;border-radius:50%;cursor:pointer;font-size:13px}
.sheet section{padding:12px 0;border-top:1px solid rgba(255,255,255,.07)}
.sheet section:first-of-type{border-top:0}
.row-label{display:block;font-size:11.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;opacity:.6;margin-bottom:9px}
/* collapsible control groups */
.grp-head{width:100%;display:flex;align-items:center;justify-content:space-between;
  background:none;border:0;color:var(--accent);font-family:var(--font-ui);
  font-size:12.5px;font-weight:600;letter-spacing:.03em;cursor:pointer;
  padding:15px 0 9px;margin-top:6px;border-top:1px solid rgba(255,255,255,.1)}
.grp:first-of-type .grp-head{border-top:0;margin-top:0;padding-top:4px}
.grp-head .chev{transition:transform .28s ease;opacity:.65;font-size:10px}
.grp.collapsed .grp-head .chev{transform:rotate(-90deg)}
.grp-body{overflow:hidden;transition:max-height .34s ease,opacity .22s ease;max-height:1600px}
.grp.collapsed .grp-body{max-height:0;opacity:0}
.grp-body section:first-child{border-top:0;padding-top:4px}

.swatches{display:flex;gap:9px;flex-wrap:wrap}
.swatch{width:44px;height:34px;border-radius:11px;cursor:pointer;border:2px solid transparent;position:relative;transition:transform .12s}
.swatch:hover{transform:translateY(-2px)}
.swatch.on{border-color:#fff}
.swatch span{position:absolute;inset:0;display:grid;place-items:end center;font-size:9px;font-weight:600;padding-bottom:2px;color:rgba(255,255,255,.85);text-shadow:0 1px 2px rgba(0,0,0,.5)}

.sheet .seg{display:flex;gap:4px;background:rgba(0,0,0,.3);border-radius:12px;padding:4px}
.sheet .seg button{flex:1;border:0;background:transparent;color:var(--ink);font:inherit;font-size:12.5px;font-weight:600;padding:8px;border-radius:9px;cursor:pointer;opacity:.6;white-space:nowrap}
.sheet .seg button.on{opacity:1;background:rgba(255,255,255,.15)}
.sheet .seg.wrap{flex-wrap:wrap}
.sheet .seg.wrap button{flex:1 1 28%}

.sliders{display:flex;flex-direction:column;gap:14px}
.slider{display:grid;grid-template-columns:1fr auto;gap:4px 10px;align-items:center}
.slider label{font-size:12.5px;font-weight:550;opacity:.85}
.slider output{font-size:11.5px;opacity:.6;font-variant-numeric:tabular-nums}
.slider input[type=range]{grid-column:1/-1;-webkit-appearance:none;appearance:none;width:100%;height:22px;background:transparent;cursor:pointer}
.slider input[type=range]::-webkit-slider-runnable-track{height:5px;border-radius:5px;background:rgba(255,255,255,.16)}
.slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;margin-top:-7px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.4)}

.toggles{display:flex;flex-wrap:wrap;gap:12px 18px}
.chk{display:inline-flex;align-items:center;gap:7px;font-size:12.5px;font-weight:550;opacity:.85;cursor:pointer}
.chk input{width:16px;height:16px;accent-color:var(--accent)}

/* full-bleed on real phones */
@media (max-width:640px), (pointer:coarse){
  body{padding:0;overflow:auto}
  .frame{
    width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;
    border-radius:0;box-shadow:none;aspect-ratio:auto;
  }
  #app{gap:0}
  .dock{position:fixed;left:0;right:0;bottom:0;z-index:20;
    padding:10px 10px calc(10px + env(safe-area-inset-bottom));
    background:linear-gradient(transparent, rgba(0,0,0,.5) 40%);}
}

/* desktop — settings live as a persistent RIGHT SIDEBAR (not an overlay), so the
   phone screen and the controls are both visible at once */
@media (min-width:1024px) and (pointer:fine){
  body{ padding-right:372px; }                 /* reserve the right strip for the sidebar */
  .sheet{ position:fixed; inset:0 0 0 auto; z-index:30; display:block; place-items:initial; }
  .sheet[hidden]{ display:block; }             /* always open on desktop */
  .sheet-scrim{ display:none; }                /* no dimming of the phone */
  .sheet-body{
    position:fixed; top:16px; right:16px; bottom:16px; left:auto;
    width:340px; max-height:none; height:calc(100dvh - 32px);
    overflow-y:auto; margin:0; border-radius:22px; animation:none;
  }
  .sheet-close{ display:none; }                /* a persistent sidebar isn't closable */
  #gear{ display:none; }                        /* …so the gear toggle is redundant */
}

/* cover mode — chrome hidden for screenshots */
body.cover .dock, body.cover .statusbar{display:none}
body.cover .sheet{display:none}
