/* uniDev app demo kit: device frame (iOS / Android), screens, sheets, toasts.
   Each app sets its own tokens (--bg, --ink, --accent, --font...) on :root. */

:root {
  --W: 390px;
  --H: 844px;
  --top: 54px;
  --bottom: 34px;
  --r-btn: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
[data-os="android"] {
  --top: 40px;
  --bottom: 22px;
  --r-btn: 999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #e7e5df;
  font-family: var(--font, Inter, system-ui, sans-serif);
  color: var(--ink, #111);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.ic { width: 22px; height: 22px; flex: none; display: inline-block; vertical-align: middle; }
.ic svg { width: 100%; height: 100%; display: block; }

/* ── Stage and device ── */
.stage {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding-bottom: 64px;
  background:
    radial-gradient(60% 50% at 50% 40%, rgba(255, 255, 255, 0.7), transparent 70%),
    #e7e5df;
}
.device {
  position: relative;
  width: calc(var(--W) + 24px);
  height: calc(var(--H) + 24px);
  padding: 12px;
  border-radius: 68px;
  background: #0d0d0f;
  box-shadow:
    inset 0 0 0 2px #2c2c30,
    inset 0 0 0 5px #0d0d0f,
    0 0 0 1px #000,
    0 60px 120px -40px rgba(20, 18, 10, 0.45);
  transform: scale(var(--s, 1));
  flex: none;
}
[data-os="android"] .device {
  width: calc(var(--W) + 18px);
  height: calc(var(--H) + 18px);
  padding: 9px;
  border-radius: 46px;
  background: #202124;
  box-shadow: inset 0 0 0 1px #3a3b3f, 0 0 0 1px #000, 0 60px 120px -40px rgba(20, 18, 10, 0.45);
}
.screen {
  position: relative;
  width: var(--W);
  height: var(--H);
  border-radius: 56px;
  overflow: hidden;
  background: var(--bg, #fff);
  isolation: isolate;
}
[data-os="android"] .screen { border-radius: 37px; }

/* Status bar */
.sbar {
  position: absolute;
  inset: 0 0 auto;
  height: var(--top);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 32px 0 44px;
  font: 600 16px/1 -apple-system, "SF Pro Text", Inter, system-ui, sans-serif;
  color: var(--sbar, #000);
  pointer-events: none;
  transition: color 0.3s;
}
.sbar .ics { display: flex; gap: 6px; align-items: center; }
.sbar svg { height: 12px; width: auto; fill: currentColor; }
.cam {
  position: absolute;
  left: 50%;
  top: 11px;
  width: 124px;
  height: 36px;
  border-radius: 20px;
  background: #000;
  translate: -50% 0;
  z-index: 95;
  pointer-events: none;
}
[data-os="android"] .sbar { padding: 0 22px; font: 500 14px/1 Roboto, "Google Sans", Inter, system-ui, sans-serif; }
[data-os="android"] .cam { top: 13px; width: 13px; height: 13px; border-radius: 50%; }
.homebar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 136px;
  height: 5px;
  border-radius: 3px;
  background: var(--sbar, #000);
  translate: -50% 0;
  z-index: 95;
  opacity: 0.9;
  pointer-events: none;
  transition: background 0.3s;
}
[data-os="android"] .homebar { width: 108px; height: 4px; bottom: 8px; }
.sbar.light, .light-bar .sbar { --sbar: #fff; }
.sbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity 0.25s;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
.scrolled .sbar::before { opacity: 1; }
.light-bar.scrolled .sbar::before { opacity: 0; }

/* Native phone (no frame) and embedded in the uniDev site */
.native .stage, .embed .stage { display: block; padding: 0; background: var(--bg); }
.native .device, .embed .device {
  width: 100vw; height: 100dvh; padding: 0; border-radius: 0; background: none; box-shadow: none; transform: none;
}
.native .screen, .embed .screen { width: 100%; height: 100%; border-radius: 0; }
.native .sbar, .native .cam, .native .homebar, .embed .cam { display: none; }
.native { --top: max(env(safe-area-inset-top), 16px); --bottom: max(env(safe-area-inset-bottom), 12px); }
.native .ctl, .embed .ctl { display: none; }

/* ── Screens ── */
.app { position: absolute; inset: 0; }
.scr {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: var(--bg);
  padding-top: var(--top);
  padding-bottom: calc(var(--bottom) + 24px);
  visibility: hidden;
}
.scr::-webkit-scrollbar { display: none; }
.scr.on { visibility: visible; }
.scr.has-tabs { padding-bottom: calc(var(--bottom) + 96px); }

/* App bar: iOS centres the title, Android leans it left */
.bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
}
.bar h1, .bar .title { font-size: 17px; font-weight: 650; text-align: center; letter-spacing: -0.01em; }
[data-os="android"] .bar { grid-template-columns: 44px 1fr auto; }
[data-os="android"] .bar h1, [data-os="android"] .bar .title { text-align: left; font-size: 20px; font-weight: 500; padding-left: 8px; }
.iconbtn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  transition: background 0.2s, transform 0.15s;
}
.iconbtn:active { transform: scale(0.92); }
.back .ic-android { display: none; }
[data-os="android"] .back .ic-ios { display: none; }
[data-os="android"] .back .ic-android { display: inline-block; }

/* Press feedback on everything tappable */
.tap { transition: transform 0.18s var(--ease), background 0.2s, box-shadow 0.2s; }
.tap:active { transform: scale(0.97); }
.ripple { position: relative; overflow: hidden; }
.ripple-dot {
  position: absolute; border-radius: 50%; background: currentColor; opacity: 0.18;
  pointer-events: none; transform: scale(0);
}

/* ── Sheets ── */
.scrim {
  position: absolute; inset: 0; z-index: 70; background: rgba(8, 8, 12, 0.45);
  opacity: 0; visibility: hidden;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 71;
  max-height: 90%; overflow-y: auto; scrollbar-width: none;
  background: var(--sheet, #fff);
  color: var(--sheet-ink, inherit);
  border-radius: 30px 30px 0 0;
  padding: 26px 20px calc(var(--bottom) + 18px);
  transform: translateY(105%);
  visibility: hidden;
  touch-action: none;
}
.sheet::before {
  content: ""; position: absolute; top: 10px; left: 50%; width: 38px; height: 5px; border-radius: 3px;
  background: currentColor; opacity: 0.18; translate: -50% 0;
}
.sheet h2 { font-size: 20px; letter-spacing: -0.02em; margin-bottom: 4px; }
.sheet .sub { font-size: 14px; opacity: 0.6; margin-bottom: 18px; }

/* ── Toast ── */
.toast {
  position: absolute; left: 16px; right: 16px; top: calc(var(--top) + 8px); z-index: 80;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 18px;
  background: rgba(20, 20, 24, 0.92); color: #fff; font-size: 14px; font-weight: 550;
  backdrop-filter: blur(12px);
  visibility: hidden;
}

/* ── Desktop controls around the phone ── */
.ctl {
  position: fixed; left: 50%; bottom: 18px; translate: -50% 0; z-index: 10;
  display: flex; align-items: center; gap: 8px; padding: 6px;
  border-radius: 999px; background: #fff; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25);
  font: 600 13px/1 Inter, system-ui, sans-serif; color: #1a1a1a;
}
.ctl .seg { display: flex; background: #efede8; border-radius: 999px; padding: 3px; }
.ctl .seg button { padding: 9px 14px; border-radius: 999px; font-weight: 600; color: #555; }
.ctl .seg button[aria-pressed="true"] { background: #1a1a1a; color: #fff; }
.ctl a { padding: 10px 14px; border-radius: 999px; color: inherit; text-decoration: none; }
.ctl a:hover { background: #efede8; }
.ctl a.buy { background: #1a1a1a; color: #fff; }

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

/* Embedded and scrolled out of view (set by phone.js): hold every CSS animation. */
html.is-off *, html.is-off *::before, html.is-off *::after { animation-play-state: paused !important; }
