/* ==========================================================================
   Signal Verse AR — iPhone 17 Pro Max prototype
   Device shell · iOS chrome · Screen transitions · In-app component kit
   Base canvas: 440 × 956 pt (iPhone 17 Pro Max logical resolution)
   ========================================================================== */

/* ==========================================================================
   1. DEVICE SHELL
   ========================================================================== */

.device-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding-block: var(--space-4);
}

.device {
  --dw: 464px;          /* frame outer width  */
  --dh: 980px;          /* frame outer height */
  --ds: 1;              /* scale, set by JS   */
  --frame: 12px;
  position: relative;
  width: calc(var(--dw) * var(--ds));
  height: calc(var(--dh) * var(--ds));
  flex-shrink: 0;
}

.device__frame {
  position: absolute;
  top: 0; left: 0;
  width: var(--dw);
  height: var(--dh);
  transform: scale(var(--ds));
  transform-origin: top left;
  border-radius: 68px;
  padding: var(--frame);
  background:
    linear-gradient(150deg, #4A4E55 0%, #17191D 22%, #2C2F34 48%, #0E0F11 74%, #3A3E45 100%);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.16) inset,
    0 -2px 0 rgba(0, 0, 0, 0.5) inset,
    0 40px 90px rgba(17, 17, 17, 0.32),
    0 12px 30px rgba(17, 17, 17, 0.18);
}
:root[data-theme="dark"] .device__frame { box-shadow: 0 2px 0 rgba(255,255,255,0.14) inset, 0 -2px 0 rgba(0,0,0,0.6) inset, 0 40px 100px rgba(0,0,0,0.7); }

/* Titanium band highlight */
.device__frame::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 65px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  pointer-events: none;
  z-index: 4;
}

.device__screen {
  position: relative;
  width: 440px;
  height: 956px;
  border-radius: 56px;
  overflow: hidden;
  background: var(--app-bg, #F7F8FA);
  isolation: isolate;
  transform: translateZ(0);
}

/* Physical buttons */
.device__btn {
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #55595F, #2A2D32);
}
.device__btn--silent { left: -3px; top: 168px; height: 32px; }
.device__btn--vup    { left: -3px; top: 226px; height: 62px; }
.device__btn--vdown  { left: -3px; top: 302px; height: 62px; }
.device__btn--power  { right: -3px; top: 250px; height: 100px; }
.device__btn--camera { right: -3px; top: 380px; height: 40px; }

/* Dynamic Island */
.island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 124px;
  height: 36px;
  border-radius: var(--r-pill);
  background: #000;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-inline: 12px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  transition: width 520ms var(--ease-spring), height 520ms var(--ease-spring), border-radius 400ms var(--ease-out);
}
.island::after {
  content: "";
  position: absolute;
  right: 16px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, #2E3238, #0B0C0E 70%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
}
.island__content { opacity: 0; transition: opacity var(--dur-base) var(--ease-out); display: flex; align-items: center; gap: 8px; }
.island.is-expanded { width: 268px; height: 44px; }
.island.is-expanded::after { display: none; }
.island.is-expanded .island__content { opacity: 1; }
.island svg { width: 15px; height: 15px; }

/* Status bar */
.statusbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 34px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--app-text, #111);
  pointer-events: none;
  transition: color var(--dur-base) var(--ease-standard);
}
.statusbar--light { color: #fff; }
.statusbar__right { display: flex; align-items: center; gap: 6px; }
.statusbar svg { display: block; }

/* Home indicator */
.homebar {
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 148px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--app-text, #111);
  opacity: 0.28;
  z-index: 58;
  pointer-events: none;
  transition: background-color var(--dur-base) var(--ease-standard);
}
.homebar--light { background: #fff; opacity: 0.55; }

/* ==========================================================================
   2. APP THEME TOKENS (scoped to the device screen)
   ========================================================================== */

.device__screen {
  --app-bg: #F2F3F7;
  --app-surface: #FFFFFF;
  --app-surface-2: #F7F8FA;
  --app-text: #111111;
  --app-text-2: #6B7280;
  --app-text-3: #A1A6AF;
  --app-sep: rgba(17, 17, 17, 0.08);
  --app-fill: rgba(120, 120, 128, 0.12);
  --app-accent: #0A84FF;
  --app-green: #30D158;
  --app-cyan: #64D2FF;
  --app-amber: #FF9F0A;
  --app-red: #FF453A;
  --app-purple: #BF5AF2;
  --app-blur: saturate(180%) blur(24px);
  --app-nav: rgba(242, 243, 247, 0.82);
  --app-shadow: 0 8px 28px rgba(17, 17, 17, 0.09);
  --app-shadow-sm: 0 2px 8px rgba(17, 17, 17, 0.06);
  color: var(--app-text);
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.device__screen[data-app-theme="dark"] {
  --app-bg: #000000;
  --app-surface: #1C1C1E;
  --app-surface-2: #2C2C2E;
  --app-text: #FFFFFF;
  --app-text-2: #98989F;
  --app-text-3: #6C6C70;
  --app-sep: rgba(255, 255, 255, 0.12);
  --app-fill: rgba(120, 120, 128, 0.24);
  --app-nav: rgba(28, 28, 30, 0.78);
  --app-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  --app-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   3. SCREEN ROUTER + TRANSITIONS
   ========================================================================== */

.app-root {
  position: absolute;
  inset: 0;
  background: var(--app-bg);
  overflow: hidden;
  transition: background-color var(--dur-base) var(--ease-standard);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--app-bg);
  will-change: transform, opacity;
  overflow: hidden;
}

/* push (navigate forward) */
.screen--enter-push { animation: scr-push-in 420ms var(--ease-out) both; }
.screen--exit-push  { animation: scr-push-out 420ms var(--ease-out) both; }
/* pop (navigate back) */
.screen--enter-pop  { animation: scr-pop-in 420ms var(--ease-out) both; }
.screen--exit-pop   { animation: scr-pop-out 420ms var(--ease-out) both; }
/* modal sheet */
.screen--enter-modal { animation: scr-modal-in 480ms var(--ease-out) both; z-index: 20; }
.screen--exit-modal  { animation: scr-modal-out 380ms var(--ease-in-out) both; z-index: 20; }
/* fade / crossfade root swaps */
.screen--enter-fade { animation: scr-fade-in 460ms var(--ease-out) both; }
.screen--exit-fade  { animation: scr-fade-out 320ms var(--ease-out) both; }
/* zoom (immersive AR entry) */
.screen--enter-zoom { animation: scr-zoom-in 620ms var(--ease-out) both; }
.screen--exit-zoom  { animation: scr-zoom-out 420ms var(--ease-out) both; }

@keyframes scr-push-in   { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes scr-push-out  { from { transform: translateX(0); filter: brightness(1); } to { transform: translateX(-28%); filter: brightness(0.86); } }
@keyframes scr-pop-in    { from { transform: translateX(-28%); filter: brightness(0.86); } to { transform: translateX(0); filter: brightness(1); } }
@keyframes scr-pop-out   { from { transform: translateX(0); } to { transform: translateX(100%); } }
@keyframes scr-modal-in  { from { transform: translateY(100%); border-radius: 44px 44px 0 0; } to { transform: translateY(0); border-radius: 0; } }
@keyframes scr-modal-out { from { transform: translateY(0); } to { transform: translateY(100%); border-radius: 44px 44px 0 0; } }
@keyframes scr-fade-in   { from { opacity: 0; transform: scale(1.015); } to { opacity: 1; transform: none; } }
@keyframes scr-fade-out  { from { opacity: 1; } to { opacity: 0; transform: scale(0.99); } }
@keyframes scr-zoom-in   { from { opacity: 0; transform: scale(1.14); filter: blur(12px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes scr-zoom-out  { from { opacity: 1; } to { opacity: 0; transform: scale(0.94); filter: blur(8px); } }

/* Scrollable body region inside a screen */
.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding-bottom: 40px;
}
.scroll::-webkit-scrollbar { display: none; }
.scroll--tabbed { padding-bottom: 116px; }
.scroll--flush { padding-bottom: 0; }

/* ==========================================================================
   4. iOS NAVIGATION BAR
   ========================================================================== */

.navbar {
  position: relative;
  z-index: 30;
  flex-shrink: 0;
  padding-top: 60px;
  background: var(--app-nav);
  -webkit-backdrop-filter: var(--app-blur);
  backdrop-filter: var(--app-blur);
  border-bottom: 0.5px solid transparent;
  transition: border-color var(--dur-base) linear, background-color var(--dur-base) linear;
}
.navbar.is-condensed { border-bottom-color: var(--app-sep); }

.navbar__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
}
.navbar__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.navbar.is-condensed .navbar__title { opacity: 1; transform: none; }
.navbar__title--always { opacity: 1; transform: none; }

.navbar__large {
  padding: 2px 24px 10px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
  transform-origin: left center;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.navbar.is-condensed .navbar__large { opacity: 0; transform: translateY(-8px) scale(0.94); height: 0; padding-block: 0; overflow: hidden; }

.navbar__action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 17px;
  color: var(--app-accent);
  padding: 6px 4px;
  border-radius: 10px;
  transition: opacity var(--dur-fast) linear, transform var(--dur-fast) var(--ease-spring);
  justify-self: start;
}
.navbar__action:active { opacity: 0.4; transform: scale(0.94); }
.navbar__action--right { justify-self: end; }
.navbar__action svg { width: 20px; height: 20px; }
.navbar__action--icon { width: 36px; height: 36px; justify-content: center; padding: 0; }

/* ==========================================================================
   5. TAB BAR
   ========================================================================== */

.tabbar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(var(--tabs, 4), 1fr);
  padding: 8px 8px 26px;
  background: var(--app-nav);
  -webkit-backdrop-filter: var(--app-blur);
  backdrop-filter: var(--app-blur);
  border-top: 0.5px solid var(--app-sep);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  padding: 6px 0 2px;
  min-height: 52px;          /* keeps every label on one baseline beside the FAB */
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--app-text-3);
  transition: color var(--dur-fast) var(--ease-standard);
}
.tab svg { width: 26px; height: 26px; transition: transform var(--dur-base) var(--ease-spring); }
.tab.is-active { color: var(--app-accent); }
.tab.is-active svg { transform: scale(1.06) translateY(-1px); }
.tab:active svg { transform: scale(0.88); }
.tab__badge {
  /* Anchored to the tab, sitting on the icon's top-right corner. */
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 5px;
  min-width: 17px; height: 17px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--app-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  pointer-events: none;
}

/* Centre scan button */
.tab--scan { position: relative; }
.tab--scan .tab__fab {
  width: 46px; height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--app-accent), var(--app-cyan));
  color: #fff;
  box-shadow: 0 6px 16px rgba(10, 132, 255, 0.4);
  transition: transform var(--dur-base) var(--ease-spring);
  margin-bottom: 2px;
}
.tab--scan:active .tab__fab { transform: scale(0.9); }
.tab--scan svg { width: 24px; height: 24px; }

/* ==========================================================================
   6. IN-APP COMPONENT KIT
   ========================================================================== */

.px { padding-inline: 24px; }
.px-sm { padding-inline: 16px; }
.mt-app-1 { margin-top: 8px; }
.mt-app-2 { margin-top: 16px; }
.mt-app-3 { margin-top: 24px; }
.mt-app-4 { margin-top: 32px; }
.app-center { text-align: center; }

.app-h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
.app-h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.app-h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; }
.app-h4 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.app-body { font-size: 17px; line-height: 1.45; }
.app-sub { font-size: 15px; color: var(--app-text-2); line-height: 1.45; }
.app-cap { font-size: 13px; color: var(--app-text-2); line-height: 1.4; }
.app-micro { font-size: 11px; color: var(--app-text-3); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.app-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--app-text-3);
  margin-bottom: 10px;
  padding-inline: 4px;
}

/* --- Buttons --- */
.ios-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 16px;
  background: var(--app-accent);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.28);
  transition: transform 140ms var(--ease-spring), opacity 140ms linear, background-color var(--dur-base) var(--ease-standard);
}
.ios-btn:active { transform: scale(0.965); opacity: 0.9; }
.ios-btn svg { width: 20px; height: 20px; }
.ios-btn--secondary {
  background: var(--app-fill);
  color: var(--app-accent);
  box-shadow: none;
}
.ios-btn--outline {
  background: transparent;
  color: var(--app-accent);
  border: 1.5px solid var(--app-accent);
  box-shadow: none;
}
.ios-btn--plain { background: transparent; color: var(--app-accent); box-shadow: none; min-height: 44px; }
.ios-btn--green { background: var(--app-green); box-shadow: 0 6px 18px rgba(48, 209, 88, 0.3); }
.ios-btn--dark  { background: var(--app-text); color: var(--app-bg); box-shadow: none; }
.ios-btn--danger { background: transparent; color: var(--app-red); box-shadow: none; }
.ios-btn--sm { min-height: 40px; font-size: 15px; border-radius: 12px; padding: 0 14px; width: auto; }
.ios-btn--pill { border-radius: var(--r-pill); }
.ios-btn[disabled] { opacity: 0.4; pointer-events: none; }
.ios-btn--loading { pointer-events: none; }

.ios-btn-row { display: flex; gap: 10px; }
.ios-btn-row > * { flex: 1; }

/* --- Cards --- */
.ios-card {
  border-radius: 20px;
  background: var(--app-surface);
  padding: 18px;
  box-shadow: var(--app-shadow-sm);
  transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-out);
}
.ios-card--tap:active { transform: scale(0.982); }
.ios-card--flat { box-shadow: none; background: var(--app-fill); }
.ios-card--grad {
  background: linear-gradient(140deg, var(--app-accent), #0068D6 58%, var(--app-cyan));
  color: #fff;
  box-shadow: 0 12px 30px rgba(10, 132, 255, 0.32);
}
.ios-card--grad .app-sub,
.ios-card--grad .app-cap { color: rgba(255,255,255,0.82); }
.ios-card--grad .app-micro { color: rgba(255,255,255,0.7); }

/* --- Grouped list (iOS inset table) --- */
.list-group {
  border-radius: 16px;
  background: var(--app-surface);
  overflow: hidden;
  box-shadow: var(--app-shadow-sm);
}
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
  position: relative;
  transition: background-color 120ms linear;
  text-align: left;
  width: 100%;
}
.list-row:active { background: var(--app-fill); }
.list-row + .list-row::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 0;
  height: 0.5px;
  background: var(--app-sep);
}
.list-row--nosep + .list-row::before { display: none; }
.list-row__icon {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--app-accent);
  color: #fff;
}
.list-row__icon svg { width: 17px; height: 17px; }
.list-row__icon--green  { background: var(--app-green); }
.list-row__icon--amber  { background: var(--app-amber); }
.list-row__icon--red    { background: var(--app-red); }
.list-row__icon--purple { background: var(--app-purple); }
.list-row__icon--cyan   { background: var(--app-cyan); }
.list-row__icon--grey   { background: var(--app-text-3); }
/* Rows are built from spans so the whole row can be a <button>. */
.list-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-row__title { display: block; font-size: 17px; letter-spacing: -0.015em; }
.list-row__sub { display: block; font-size: 13px; color: var(--app-text-2); margin-top: 1px; }
.list-row__value { font-size: 17px; color: var(--app-text-2); flex-shrink: 0; }
.list-row__chev { flex-shrink: 0; width: 8px; height: 13px; color: var(--app-text-3); opacity: 0.7; }

/* --- Inputs --- */
.ios-field { position: relative; }
.ios-input {
  width: 100%;
  min-height: 54px;
  padding: 20px 16px 8px;
  border-radius: 14px;
  background: var(--app-surface);
  border: 1.5px solid transparent;
  font-size: 17px;
  color: var(--app-text);
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) linear;
}
.ios-input::placeholder { color: transparent; }
.ios-input:focus { border-color: var(--app-accent); }
.ios-field__label {
  position: absolute;
  left: 16px; top: 17px;
  font-size: 17px;
  color: var(--app-text-3);
  pointer-events: none;
  transform-origin: left top;
  transition: transform var(--dur-base) var(--ease-out), color var(--dur-base) linear;
}
.ios-input:focus + .ios-field__label,
.ios-input:not(:placeholder-shown) + .ios-field__label {
  transform: translateY(-11px) scale(0.72);
  color: var(--app-text-2);
}
.ios-input:focus + .ios-field__label { color: var(--app-accent); }
.ios-field__trail {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--app-text-3);
  padding: 6px;
}
.ios-field__trail svg { width: 20px; height: 20px; }
.ios-field.is-invalid .ios-input { border-color: var(--app-red); }
.ios-field__msg { font-size: 13px; color: var(--app-red); margin-top: 6px; padding-inline: 6px; }

.ios-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding-inline: 10px;
  border-radius: 11px;
  background: var(--app-fill);
  color: var(--app-text-3);
  font-size: 17px;
}
.ios-search svg { width: 16px; height: 16px; }

/* OTP boxes */
.otp-row { display: flex; gap: 10px; justify-content: center; }
.otp-box {
  width: 54px; height: 64px;
  border-radius: 14px;
  background: var(--app-surface);
  border: 1.5px solid transparent;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
.otp-box.is-filled { border-color: var(--app-accent); transform: scale(1.04); }
.otp-box.is-active::after {
  content: "";
  width: 2px; height: 28px;
  background: var(--app-accent);
  animation: caret 1.05s steps(1) infinite;
  border-radius: 2px;
}
@keyframes caret { 50% { opacity: 0; } }

/* Numeric keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.key {
  height: 58px;
  border-radius: 16px;
  background: var(--app-surface);
  font-size: 26px;
  font-weight: 500;
  display: grid;
  place-items: center;
  box-shadow: var(--app-shadow-sm);
  transition: transform 120ms var(--ease-spring), background-color 120ms linear;
}
.key:active { transform: scale(0.94); background: var(--app-fill); }
.key--plain { background: transparent; box-shadow: none; }
.key svg { width: 24px; height: 24px; }

/* --- Segmented control --- */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 2px;
  border-radius: 10px;
  background: var(--app-fill);
  position: relative;
}
.segmented__thumb {
  position: absolute;
  top: 2px; bottom: 2px;
  border-radius: 8px;
  background: var(--app-surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
  transition: transform var(--dur-base) var(--ease-out), width var(--dur-base) var(--ease-out);
}
.segmented__btn {
  position: relative;
  z-index: 1;
  padding: 7px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--app-text-2);
  transition: color var(--dur-base) linear;
}
.segmented__btn.is-active { color: var(--app-text); }

/* --- Switch --- */
.ios-switch {
  position: relative;
  width: 51px; height: 31px;
  border-radius: var(--r-pill);
  background: var(--app-fill);
  flex-shrink: 0;
  transition: background-color var(--dur-base) var(--ease-out);
}
.ios-switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform var(--dur-base) var(--ease-spring);
}
.ios-switch[aria-checked="true"] { background: var(--app-green); }
.ios-switch[aria-checked="true"]::after { transform: translateX(20px); }

/* --- Progress --- */
.bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--app-fill);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--app-accent), var(--app-cyan));
  width: 0;
  transition: width 900ms var(--ease-out);
}
.bar--green .bar__fill { background: linear-gradient(90deg, var(--app-green), #7BE495); }
.bar--thin { height: 5px; }
.bar--light { background: rgba(255,255,255,0.24); }
.bar--light .bar__fill { background: #fff; }

.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring__track { stroke: var(--app-fill); fill: none; }
.ring__value {
  fill: none;
  stroke: url(#ringGrad);
  stroke-linecap: round;
  transition: stroke-dashoffset 1100ms var(--ease-out);
}
.ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.ring__label b { display: block; font-weight: 700; letter-spacing: -0.03em; }
.ring__label span { display: block; color: var(--app-text-2); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1px; }

/* --- Chips / pills --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--app-fill);
  font-size: 12px;
  font-weight: 600;
  color: var(--app-text-2);
  white-space: nowrap;
}
.chip--accent { background: rgba(10,132,255,0.14); color: var(--app-accent); }
.chip--green  { background: rgba(48,209,88,0.16);  color: #1E9E42; }
.chip--amber  { background: rgba(255,159,10,0.16); color: #B26A00; }
.chip--red    { background: rgba(255,69,58,0.16);  color: var(--app-red); }
.chip--locked { background: var(--app-fill); color: var(--app-text-3); }
.device__screen[data-app-theme="dark"] .chip--green { color: var(--app-green); }
.device__screen[data-app-theme="dark"] .chip--amber { color: var(--app-amber); }
.chip svg { width: 12px; height: 12px; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }

/* --- Avatar --- */
.ios-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--app-accent), var(--app-cyan));
  color: #fff;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(10,132,255,0.3);
}
.ios-avatar--sm { width: 40px; height: 40px; font-size: 16px; box-shadow: none; }
.ios-avatar--lg { width: 92px; height: 92px; font-size: 34px; }

/* --- Empty state --- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 32px;
  text-align: center;
}
.empty__icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--app-fill);
  color: var(--app-text-3);
}
.empty__icon svg { width: 28px; height: 28px; }

/* --- Toast / alert inside device --- */
.app-toast {
  position: absolute;
  left: 16px; right: 16px;
  top: 66px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  font-size: 15px;
  font-weight: 500;
  animation: app-toast-in 460ms var(--ease-spring);
}
.app-toast.is-leaving { animation: app-toast-out 300ms var(--ease-out) forwards; }
.app-toast svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--app-green); }
@keyframes app-toast-in  { from { opacity: 0; transform: translateY(-24px) scale(0.94); } }
@keyframes app-toast-out { to   { opacity: 0; transform: translateY(-14px) scale(0.96); } }

.app-alert {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(0,0,0,0.28);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in var(--dur-base) linear;
}
.app-alert__panel {
  width: 270px;
  border-radius: 20px;
  background: var(--app-surface);
  overflow: hidden;
  text-align: center;
  animation: pop-in 340ms var(--ease-spring);
  box-shadow: var(--app-shadow);
}
.app-alert__body { padding: 20px 18px 16px; }
.app-alert__title { font-size: 17px; font-weight: 600; }
.app-alert__msg { font-size: 13px; color: var(--app-text-2); margin-top: 4px; line-height: 1.4; }
.app-alert__actions { display: flex; border-top: 0.5px solid var(--app-sep); }
.app-alert__actions > * {
  flex: 1;
  padding: 12px 6px;
  font-size: 17px;
  color: var(--app-accent);
  transition: background-color 120ms linear;
}
.app-alert__actions > *:active { background: var(--app-fill); }
.app-alert__actions > * + * { border-left: 0.5px solid var(--app-sep); }
.app-alert__actions .is-bold { font-weight: 600; }
.app-alert__actions .is-danger { color: var(--app-red); }

/* Action sheet */
.action-sheet {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  background: rgba(0,0,0,0.28);
  animation: fade-in var(--dur-base) linear;
}
.action-sheet__group {
  border-radius: 16px;
  overflow: hidden;
  background: var(--app-surface);
  margin-bottom: 8px;
  animation: sheet-up 400ms var(--ease-out);
}
.action-sheet__item {
  width: 100%;
  padding: 16px;
  font-size: 19px;
  color: var(--app-accent);
  border-bottom: 0.5px solid var(--app-sep);
  transition: background-color 120ms linear;
}
.action-sheet__item:last-child { border-bottom: none; }
.action-sheet__item:active { background: var(--app-fill); }
.action-sheet__item--strong { font-weight: 600; }
.action-sheet__item--danger { color: var(--app-red); }
.action-sheet__hint { padding: 12px 16px; font-size: 13px; color: var(--app-text-2); text-align: center; border-bottom: 0.5px solid var(--app-sep); }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } }

/* ==========================================================================
   7. SPLASH / ONBOARDING
   ========================================================================== */

.app-splash {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: #06070A;
  color: #fff;
  overflow: hidden;
}
.app-splash__mesh {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(40% 40% at 30% 28%, rgba(10,132,255,0.6), transparent 70%),
    radial-gradient(38% 38% at 72% 62%, rgba(100,210,255,0.44), transparent 70%),
    radial-gradient(30% 30% at 50% 88%, rgba(48,209,88,0.3), transparent 70%);
  filter: blur(46px);
  animation: float-soft 14s var(--ease-in-out) infinite;
}
.app-splash__mark {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #0A84FF, #64D2FF);
  box-shadow: 0 20px 50px rgba(10,132,255,0.5);
  animation: splash-mark 1.3s var(--ease-spring) both;
}
.app-splash__mark svg { width: 52px; height: 52px; }
.app-splash__name {
  position: relative;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  animation: fade-up 700ms var(--ease-out) 260ms both;
}
.app-splash__tag { position: relative; font-size: 13px; opacity: 0.6; margin-top: -18px; animation: fade-up 700ms var(--ease-out) 380ms both; }
.app-splash__bar {
  position: relative;
  width: 140px; height: 3px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.16);
  overflow: hidden;
}
.app-splash__bar span {
  display: block; height: 100%; width: 0;
  background: #fff;
  border-radius: inherit;
  transition: width 200ms var(--ease-out);
}
.app-splash__status { position: relative; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.5; font-family: var(--font-mono); }

.onboard { flex: 1; display: flex; flex-direction: column; }
.onboard__art {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 380px;
}
.onboard__copy { padding: 0 32px 28px; text-align: center; }
.onboard__title { font-size: 30px; font-weight: 700; letter-spacing: -0.032em; line-height: 1.15; }
.onboard__body { font-size: 16px; color: var(--app-text-2); line-height: 1.5; margin-top: 12px; }
.onboard__dots { display: flex; gap: 7px; justify-content: center; margin: 22px 0; }
.onboard__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--app-fill);
  transition: width var(--dur-base) var(--ease-spring), background-color var(--dur-base) linear;
}
.onboard__dot.is-active { width: 22px; background: var(--app-accent); border-radius: var(--r-pill); }
.onboard__foot { padding: 0 24px 34px; display: flex; flex-direction: column; gap: 8px; }

/* Onboarding illustrations */
.ob-art { position: relative; width: 260px; height: 260px; }
.ob-art__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed var(--app-sep);
  animation: spin 30s linear infinite;
}
.ob-art__ring--2 { inset: 34px; animation-duration: 22s; animation-direction: reverse; border-style: solid; }
.ob-art__core {
  position: absolute;
  inset: 74px;
  border-radius: 34px;
  background: linear-gradient(140deg, var(--app-accent), var(--app-cyan));
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 18px 40px rgba(10,132,255,0.36);
  animation: breathe 5s var(--ease-in-out) infinite;
}
.ob-art__core svg { width: 52px; height: 52px; }
.ob-art__sat {
  position: absolute;
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  display: grid;
  place-items: center;
  color: var(--app-accent);
}
.ob-art__sat svg { width: 22px; height: 22px; }
/* Placed on a 118px orbit around the 260px art box (centre 130,130) at
   12, 4 and 8 o'clock, so the three of them read as one orbiting system. */
.ob-art__sat--1 { top: -11px; left: 107px; animation: float-y 4.5s var(--ease-in-out) infinite; }
.ob-art__sat--2 { top: 166px;  left: 5px;   animation: float-y 5.4s var(--ease-in-out) -1.6s infinite; }
.ob-art__sat--3 { top: 166px;  left: 209px; animation: float-y 6s var(--ease-in-out) -3s infinite; }

/* ==========================================================================
   8. PERMISSIONS
   ========================================================================== */

.perm-hero {
  display: grid;
  place-items: center;
  width: 108px; height: 108px;
  margin: 0 auto;
  border-radius: 32px;
  background: var(--app-fill);
  color: var(--app-accent);
  animation: pop-in 520ms var(--ease-spring) both;
}
.perm-hero svg { width: 52px; height: 52px; }
.perm-hero--camera { background: rgba(10,132,255,0.14); }
.perm-hero--motion { background: rgba(191,90,242,0.14); color: var(--app-purple); }
.perm-hero--bell   { background: rgba(255,159,10,0.16); color: var(--app-amber); }

.perm-point { display: flex; gap: 12px; align-items: flex-start; }
.perm-point__icon {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--app-fill);
  color: var(--app-accent);
  display: grid;
  place-items: center;
}
.perm-point__icon svg { width: 14px; height: 14px; }

/* iOS system permission dialog */
.sys-dialog {
  position: absolute;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(0,0,0,0.3);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fade-in 240ms linear;
}

/* ==========================================================================
   9. SCANNER / CAMERA
   ========================================================================== */

.camera {
  position: absolute;
  inset: 0;
  background: #0A0B0D;
  overflow: hidden;
}
.camera__feed {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 50% at 50% 42%, #2A3038 0%, #14171B 55%, #08090B 100%);
}
.camera__feed::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(700px) rotateX(62deg) scale(2.2) translateY(16%);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(180deg, transparent 26%, #000 78%);
  mask-image: linear-gradient(180deg, transparent 26%, #000 78%);
  animation: grid-drift 14s linear infinite;
}
/* Simulated desk with a printed marker */
.camera__desk {
  /* Sits slightly above the frame's centre: the perspective tilt projects the
     card downward, so a true centre reads as low. */
  position: absolute;
  left: 50%; top: 43%;
  transform: translate(-50%, -50%) perspective(760px) rotateX(48deg);
  width: 236px; height: 236px;
  border-radius: 14px;
  background: linear-gradient(150deg, #F2F3F5, #D5D9DE);
  box-shadow: 0 30px 60px rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  transition: transform 900ms var(--ease-out), opacity 500ms linear;
}
.camera__marker-art {
  width: 156px; height: 156px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 3px;
}
.camera__marker-art i { background: #14171B; border-radius: 2px; }
.camera__marker-art i.o { background: transparent; }

.scan-frame {
  position: absolute;
  left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  width: 252px; height: 252px;
  z-index: 5;
  transition: transform 620ms var(--ease-spring), opacity 400ms linear;
}
.scan-frame__c {
  position: absolute;
  width: 40px; height: 40px;
  border: 3px solid #fff;
  border-radius: 4px;
  transition: border-color 400ms linear;
}
.scan-frame__c:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 14px 0 0 0; }
.scan-frame__c:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 14px 0 0; }
.scan-frame__c:nth-child(3) { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 14px; }
.scan-frame__c:nth-child(4) { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 14px 0; }
.scan-frame.is-locked .scan-frame__c { border-color: var(--app-green); }
.scan-frame.is-locked { transform: translate(-50%, -50%) scale(0.92); }
.scan-line {
  position: absolute;
  left: 10px; right: 10px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #64D2FF, transparent);
  box-shadow: 0 0 18px #0A84FF;
  animation: scan-sweep 2.4s var(--ease-in-out) infinite;
}
.scan-frame.is-locked .scan-line { display: none; }

.camera__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 46%, transparent 30%, rgba(0,0,0,0.62) 100%);
  pointer-events: none;
}
.camera__hint {
  position: absolute;
  left: 24px; right: 24px;
  top: 64%;
  text-align: center;
  color: rgba(255,255,255,0.86);
  font-size: 15px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
  z-index: 6;
}
.camera__controls {
  position: absolute;
  left: 0; right: 0; bottom: 44px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
}
.cam-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.16);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  transition: transform 160ms var(--ease-spring), background-color var(--dur-base) linear;
}
.cam-btn:active { transform: scale(0.9); }
.cam-btn.is-on { background: #fff; color: #111; }
.cam-btn svg { width: 24px; height: 24px; }
.cam-btn--shutter {
  width: 74px; height: 74px;
  background: #fff;
  border: 4px solid rgba(255,255,255,0.4);
  background-clip: padding-box;
  color: var(--app-accent);
}
.cam-btn--shutter svg { width: 30px; height: 30px; }

.scan-success {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(6,8,10,0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  animation: fade-in 260ms linear;
}
.scan-success__ring {
  width: 108px; height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(48,209,88,0.2);
  border: 2px solid var(--app-green);
  color: var(--app-green);
  animation: pop-in 520ms var(--ease-spring);
}
.scan-success__ring svg { width: 52px; height: 52px; }

/* AR detection sequence */
.detect { position: absolute; inset: 0; background: #06070A; color: #fff; overflow: hidden; }
.detect__plane {
  position: absolute;
  left: 50%; top: 56%;
  width: 320px; height: 320px;
  transform: translate(-50%, -50%) perspective(700px) rotateX(64deg);
  background-image:
    linear-gradient(rgba(100,210,255,0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,210,255,0.4) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 72%);
  mask-image: radial-gradient(circle, #000 25%, transparent 72%);
  opacity: 0;
  animation: plane-lock 1.5s var(--ease-out) 300ms forwards;
}
@keyframes plane-lock {
  0%   { opacity: 0; transform: translate(-50%, -50%) perspective(700px) rotateX(64deg) scale(0.6); }
  100% { opacity: 1; transform: translate(-50%, -50%) perspective(700px) rotateX(64deg) scale(1); }
}
.detect__pulse {
  position: absolute;
  left: 50%; top: 52%;
  width: 90px; height: 90px;
  margin: -45px 0 0 -45px;
  border-radius: 50%;
  border: 2px solid rgba(100,210,255,0.7);
  animation: detect-pulse 2s var(--ease-out) infinite;
}
.detect__pulse:nth-child(3) { animation-delay: 0.66s; }
.detect__pulse:nth-child(4) { animation-delay: 1.33s; }
@keyframes detect-pulse {
  from { transform: scale(0.4); opacity: 0.9; }
  to   { transform: scale(2.6); opacity: 0; }
}
.detect__steps {
  position: absolute;
  left: 32px; right: 32px; bottom: 96px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detect__step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  opacity: 0.4;
  transition: opacity var(--dur-base) linear, transform var(--dur-base) var(--ease-out);
  transform: translateX(-6px);
}
.detect__step.is-done { opacity: 1; transform: none; }
.detect__step-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.4);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.detect__step.is-done .detect__step-dot { background: var(--app-green); border-color: var(--app-green); }
.detect__step-dot svg {
  width: 13px; height: 13px;
  color: #06070A;                /* dark tick reads clearly on the green fill */
  stroke-width: 3.4;
  opacity: 0;
  transition: opacity var(--dur-fast) linear;
}
.detect__step.is-done .detect__step-dot svg { opacity: 1; }

/* ==========================================================================
   10. AR WORKBENCH
   ========================================================================== */

.workbench { position: absolute; inset: 0; background: #06070A; color: #fff; overflow: hidden; }
.workbench__scene {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 45% at 50% 34%, rgba(10,132,255,0.28), transparent 66%),
    radial-gradient(50% 40% at 78% 76%, rgba(191,90,242,0.2), transparent 70%),
    #06070A;
}
.workbench__floor {
  position: absolute;
  left: 50%; bottom: -30px;
  width: 520px; height: 340px;
  transform: translateX(-50%) perspective(760px) rotateX(66deg);
  background-image:
    linear-gradient(rgba(100,210,255,0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,210,255,0.22) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 12%, transparent 68%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 12%, transparent 68%);
  animation: grid-drift 16s linear infinite;
}

.wb-hologram {
  /* Centred with left/right rather than translateX, because the float-y
     animation owns `transform` and would otherwise cancel the centring. */
  position: absolute;
  left: 70px; right: 70px;
  top: 190px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,0.07);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.14);
  animation: float-y 6s var(--ease-in-out) infinite;
}
.wb-hologram__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
}
.wb-hologram canvas { width: 100%; height: 128px; display: block; }
.wb-hologram__legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11px; color: rgba(255,255,255,0.6); }
.wb-hologram__legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

.wb-float {
  position: absolute;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 14px 34px rgba(0,0,0,0.42);
  min-width: 96px;
}
.wb-float__label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(255,255,255,0.48); }
.wb-float__value { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
/* Two bands: a/b sit above the hologram, c/d below it, so nothing can collide
   with the plot no matter how long a readout gets. */
.wb-float--a { top: 114px; left: 18px;  animation: float-soft 11s var(--ease-in-out) infinite; }
.wb-float--b { top: 114px; right: 18px; animation: float-soft 13s var(--ease-in-out) -4s infinite; }
.wb-float--c { top: 452px; left: 18px;  animation: float-soft 15s var(--ease-in-out) -8s infinite; }
.wb-float--d { top: 452px; right: 18px; animation: float-soft 12s var(--ease-in-out) -2s infinite; }

/* Bottom control dock */
.wb-dock {
  position: absolute;
  left: 12px; right: 12px; bottom: 26px;
  z-index: 20;
  padding: 16px;
  border-radius: 26px;
  background: rgba(20,22,26,0.66);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
  transition: transform var(--dur-slow) var(--ease-out);
}
.wb-dock.is-collapsed { transform: translateY(calc(100% - 62px)); }
.wb-dock__grab {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.28);
  margin: -6px auto 12px;
}
.wb-control + .wb-control { margin-top: 14px; }
.wb-control__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  color: rgba(255,255,255,0.66);
  margin-bottom: 8px;
}
.wb-control__head b { font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.wb-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.18);
  outline: none;
}
.wb-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
  transition: transform 140ms var(--ease-spring);
}
.wb-slider::-webkit-slider-thumb:active { transform: scale(1.2); }
.wb-slider::-moz-range-thumb {
  width: 24px; height: 24px; border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}
.wb-slider:focus-visible { outline: 2px solid var(--app-cyan); outline-offset: 4px; }

.wb-tools {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.wb-tool {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.72);
  font-size: 10px;
  font-weight: 600;
  transition: background-color var(--dur-base) linear, color var(--dur-base) linear, transform 140ms var(--ease-spring);
}
.wb-tool svg { width: 20px; height: 20px; }
.wb-tool:active { transform: scale(0.94); }
.wb-tool.is-active { background: var(--app-accent); color: #fff; }

.wb-topbar {
  position: absolute;
  top: 64px; left: 12px; right: 12px;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  background: rgba(20,22,26,0.6);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.wb-pill svg { width: 15px; height: 15px; }
.wb-pill--tap { transition: transform 140ms var(--ease-spring); }
.wb-pill--tap:active { transform: scale(0.92); }

/* Phase 3 packs a face mesh above the plot, so the readouts move out of the
   way and the hologram drops to the lower half. */
.workbench--face .wb-hologram { top: 396px; }
.workbench--face .wb-float--c,
.workbench--face .wb-float--d { display: none; }

/* Face-shape mapping overlay (Phase 3) */
.face-map {
  position: absolute;
  left: 50%; top: 150px;
  transform: translateX(-50%);
  width: 190px; height: 216px;
}
.face-map__outline {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  border: 1.5px solid rgba(100,210,255,0.65);
  box-shadow: 0 0 30px rgba(100,210,255,0.25) inset;
}
.face-map__node {
  position: absolute;
  width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--app-cyan);
  box-shadow: 0 0 10px var(--app-cyan);
  animation: breathe 2.6s var(--ease-in-out) infinite;
}

/* ==========================================================================
   11. LEARNING PHASES / QUIZ
   ========================================================================== */

.phase-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
  transition: transform var(--dur-base) var(--ease-spring), opacity var(--dur-base) linear;
  width: 100%;
  text-align: left;
}
.phase-tile:active { transform: scale(0.98); }
.phase-tile.is-locked { opacity: 0.55; }
.phase-tile.is-locked:active { transform: none; animation: shake 420ms var(--ease-out); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}
.phase-tile__badge {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 700;
  background: var(--app-fill);
  color: var(--app-text-3);
}
.phase-tile.is-open .phase-tile__badge { background: rgba(10,132,255,0.14); color: var(--app-accent); }
.phase-tile.is-done .phase-tile__badge { background: rgba(48,209,88,0.16); color: var(--app-green); }
.phase-tile__badge svg { width: 22px; height: 22px; }

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  background: var(--app-surface);
  border: 1.5px solid transparent;
  text-align: left;
  font-size: 16px;
  line-height: 1.35;
  box-shadow: var(--app-shadow-sm);
  transition:
    border-color var(--dur-base) var(--ease-out),
    background-color var(--dur-base) linear,
    transform 140ms var(--ease-spring);
}
.quiz-option:active { transform: scale(0.985); }
.quiz-option__key {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--app-sep);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--app-text-2);
  transition: all var(--dur-base) var(--ease-out);
}
.quiz-option__key svg { width: 14px; height: 14px; }
.quiz-option.is-selected { border-color: var(--app-accent); }
.quiz-option.is-selected .quiz-option__key { background: var(--app-accent); border-color: var(--app-accent); color: #fff; }
.quiz-option.is-correct { border-color: var(--app-green); background: rgba(48,209,88,0.08); }
.quiz-option.is-correct .quiz-option__key { background: var(--app-green); border-color: var(--app-green); color: #fff; }
.quiz-option.is-wrong { border-color: var(--app-red); background: rgba(255,69,58,0.07); }
.quiz-option.is-wrong .quiz-option__key { background: var(--app-red); border-color: var(--app-red); color: #fff; }
.quiz-option[disabled] { pointer-events: none; }

.quiz-progress { display: flex; gap: 5px; }
.quiz-progress i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--app-fill);
  transition: background-color var(--dur-base) var(--ease-out);
}
.quiz-progress i.is-done { background: var(--app-accent); }
.quiz-progress i.is-wrong { background: var(--app-red); }

.explain {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--app-fill);
  font-size: 14px;
  line-height: 1.45;
  color: var(--app-text-2);
  animation: fade-up 400ms var(--ease-out);
}
.explain b { color: var(--app-text); }

/* Experiment canvas card */
.exp-stage {
  border-radius: 20px;
  background: #06070A;
  padding: 14px;
  box-shadow: var(--app-shadow);
  overflow: hidden;
  position: relative;
}
.exp-stage canvas { width: 100%; height: 160px; display: block; }
.exp-stage__head { display: flex; justify-content: space-between; font-size: 11px; color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.exp-target {
  position: absolute;
  right: 14px; top: 34px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

/* ==========================================================================
   12. CERTIFICATE
   ========================================================================== */

.cert {
  position: relative;
  border-radius: 20px;
  padding: 26px 22px;
  background: linear-gradient(150deg, #FFFFFF 0%, #F4F7FB 60%, #EAF2FF 100%);
  color: #111;
  box-shadow: 0 20px 50px rgba(17,17,17,0.16);
  border: 1px solid rgba(10,132,255,0.16);
  overflow: hidden;
  text-align: center;
}
.cert::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(10,132,255,0.2);
  border-radius: 14px;
  pointer-events: none;
}
.cert::after {
  content: "";
  position: absolute;
  inset: -40% -10% auto;
  height: 80%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(100,210,255,0.28), transparent 70%);
  pointer-events: none;
}
.cert__seal {
  width: 62px; height: 62px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #0A84FF, #64D2FF);
  color: #fff;
  box-shadow: 0 10px 26px rgba(10,132,255,0.4);
  position: relative;
}
.cert__seal svg { width: 30px; height: 30px; }
.cert__kicker { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: #0A84FF; font-weight: 700; }
.cert__name { font-size: 25px; font-weight: 700; letter-spacing: -0.03em; margin-top: 10px; font-family: var(--font-display); }
.cert__course { font-size: 14px; color: #4A4E55; margin-top: 8px; line-height: 1.45; position: relative; }
.cert__rule { height: 1px; background: rgba(10,132,255,0.22); margin: 16px 30px; }
.cert__meta { display: flex; justify-content: space-between; font-size: 10px; color: #6B7280; letter-spacing: 0.04em; position: relative; }
.cert__meta b { display: block; color: #111; font-size: 11px; margin-top: 2px; }

/* ==========================================================================
   13. ACHIEVEMENTS
   ========================================================================== */

.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ach {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: 18px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
  text-align: center;
  transition: transform var(--dur-base) var(--ease-spring);
}
.ach:active { transform: scale(0.96); }
.ach__medal {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #FFB340, #FF9F0A);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255,159,10,0.34);
}
.ach__medal svg { width: 24px; height: 24px; }
.ach__medal--blue  { background: linear-gradient(140deg, #64D2FF, #0A84FF); box-shadow: 0 6px 16px rgba(10,132,255,0.32); }
.ach__medal--green { background: linear-gradient(140deg, #7BE495, #30D158); box-shadow: 0 6px 16px rgba(48,209,88,0.32); }
.ach__medal--purple{ background: linear-gradient(140deg, #D89BFF, #BF5AF2); box-shadow: 0 6px 16px rgba(191,90,242,0.32); }
.ach.is-locked { opacity: 0.44; }
.ach.is-locked .ach__medal { background: var(--app-fill); color: var(--app-text-3); box-shadow: none; }
.ach__name { font-size: 11px; font-weight: 600; line-height: 1.25; }

/* ==========================================================================
   14. PROTOTYPE PAGE CHROME (outside the device)
   ========================================================================== */

.proto-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 268px;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 1180px) {
  .proto-layout { grid-template-columns: minmax(0, 1fr); }
  /* Device first — the rails become reference material below it. */
  .device-stage { order: -1; }
  .proto-rail { position: static !important; max-height: none !important; overflow: visible; }
  .proto-rail .screen-index { max-height: 300px; overflow-y: auto; }
  .proto-rail--right {
    order: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: var(--space-4);
    align-items: start;
  }
  .proto-rail--right .proto-panel + .proto-panel { margin-top: 0; }
}

.proto-rail {
  position: sticky;
  top: 104px;
  max-height: calc(100svh - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 4px;
}

.proto-panel {
  padding: var(--space-5);
  border-radius: var(--r-lg);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.proto-panel + .proto-panel { margin-top: var(--space-4); }
.proto-panel__title {
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-tertiary);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-4);
}

.screen-index { display: flex; flex-direction: column; gap: 1px; }
.screen-index__group {
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-tertiary);
  margin: var(--space-4) 0 var(--space-2);
  font-weight: var(--fw-semibold);
}
.screen-index__group:first-child { margin-top: 0; }
.screen-index__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 7px var(--space-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-footnote);
  color: var(--text-secondary);
  text-align: left;
  width: 100%;
  transition: background-color var(--dur-fast) linear, color var(--dur-fast) linear;
}
.screen-index__btn:hover { background: var(--surface-muted); color: var(--text); }
.screen-index__btn.is-active { background: var(--accent-soft); color: var(--accent); font-weight: var(--fw-semibold); }
.screen-index__btn small { font-family: var(--font-mono); font-size: 10px; opacity: 0.6; }

.proto-meta { display: flex; flex-direction: column; gap: var(--space-3); }
.proto-meta__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--fs-footnote);
}
.proto-meta__row dt { color: var(--text-tertiary); }
.proto-meta__row dd { font-weight: var(--fw-medium); text-align: right; font-family: var(--font-mono); font-size: var(--fs-caption); }

.proto-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface-solid);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

/* Swipe-back affordance */
.edge-hint {
  position: absolute;
  left: 0; top: 20%;
  width: 22px; height: 60%;
  z-index: 45;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(10,132,255,0.16), transparent);
  opacity: 0;
  transition: opacity var(--dur-fast) linear;
}
.edge-hint.is-active { opacity: 1; }

@media (max-width: 520px) {
  .device { --ds: 0.72; }
}
