/* SLASHBUILD on iPhone and iPad — the native shell's looks (ios.js).
   index.html's head marks <html> before first paint:
     .ios         iPhone or iPad, in Safari or installed
     .ipad        an iPad (which also says "Macintosh" in its user agent)
     .standalone  opened from the Home Screen: full screen, no Safari around it
   Nothing in this file applies to a desktop browser except the Settings pane. */

/* =============================================================== the island
   A black pill drawn over the hardware Dynamic Island, the same size, so the
   two read as one; ios.js sets its size per state and the spring carries it.
   Text is SF, the system's own — the island is a system surface — and the
   brand is in the slash and its gold cursor. */
.sb-island {
  --isl-spring: var(--ease-spring);
  --isl-dur: 560ms;
  --isl-sf: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  position: fixed; z-index: 2147483600; left: 50%; top: var(--isl-top, 11px);
  width: var(--isl-w, 126px); height: var(--isl-h, 38px);
  transform: translateX(-50%);
  border-radius: var(--isl-r, 19px);
  background: #000; color: #FFFFFF;
  font: 600 15px/1.25 var(--isl-sf); letter-spacing: -.01em;
  overflow: hidden; contain: layout paint style;
  opacity: 0; pointer-events: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  transition:
    width var(--isl-dur) var(--isl-spring), height var(--isl-dur) var(--isl-spring),
    border-radius var(--isl-dur) var(--isl-spring),
    opacity .16s ease calc(var(--isl-dur) * .5);
}
.sb-island[data-state="compact"], .sb-island[data-state="full"] {
  opacity: 1; pointer-events: auto; cursor: pointer;
  transition:
    width var(--isl-dur) var(--isl-spring), height var(--isl-dur) var(--isl-spring),
    border-radius var(--isl-dur) var(--isl-spring), opacity 0s;
}
.sb-island:active { filter: brightness(1.35); }
/* away from the hardware island it floats, so it needs its own edge */
.sb-island[data-kind="float"], .sb-island[data-kind="bar"][data-state="full"] {
  box-shadow: 0 18px 50px rgba(0, 0, 0, .34), 0 0 0 .5px rgba(255, 255, 255, .12);
}
.sb-island[data-kind="float"] { scale: .9; transition: width var(--isl-dur) var(--isl-spring), height var(--isl-dur) var(--isl-spring), scale var(--isl-dur) var(--isl-spring), opacity .2s ease; }
.sb-island[data-kind="float"][data-state="full"] { scale: 1; }
.sb-island[data-kind="bar"] { font-size: 12px; }

/* ---- compact: something beside the camera on each side ---- */
.isl-compact {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between;
  opacity: 0; filter: blur(3px);
  transition: opacity .14s ease, filter .14s ease;
}
.sb-island[data-state="compact"] .isl-compact { opacity: 1; filter: none; transition: opacity .26s ease .16s, filter .26s ease .16s; }
.isl-lead, .isl-trail { flex: none; display: grid; place-items: center; width: 22px; height: 100%; }
.isl-mid { display: none; }
.sb-island[data-kind="bar"] .isl-compact { justify-content: flex-start; gap: 7px; padding: 0 9px 0 6px; }
.sb-island[data-kind="bar"] .isl-lead, .sb-island[data-kind="bar"] .isl-trail { width: auto; margin: 0; }
.sb-island[data-kind="bar"] .isl-mid {
  display: block; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 600 12px/1 var(--isl-sf); color: rgba(255, 255, 255, .92);
}
.sb-island[data-kind="bar"] .isl-mark { height: 12px; }
.sb-island[data-kind="bar"] .isl-ico, .sb-island[data-kind="bar"] .isl-ring { width: 14px; height: 14px; }

.isl-mark { display: block; height: 17px; width: auto; color: #FFFFFF; overflow: visible; }
.isl-slash { height: 16px; }
.isl-mark .isl-cursor { fill: #F5C518; }
.working .isl-cursor { animation: isl-blink 1.06s steps(1, end) infinite; }
@keyframes isl-blink { 50% { opacity: 0; } }
.isl-ico { display: block; width: 19px; height: 19px; }
.isl-ring { display: block; width: 19px; height: 19px; transform: rotate(-90deg); }
.isl-ring circle { fill: none; stroke-width: 3; }
.isl-ring .trk { stroke: rgba(255, 255, 255, .2); }
.isl-ring .val { stroke: #F5C518; stroke-linecap: round; transition: stroke-dasharray .45s ease; }
.isl-time { font: 600 11.5px/1 var(--isl-sf); color: #F5C518; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.isl-block { display: block; width: 8px; height: 13px; background: #F5C518; animation: isl-blink 1.06s steps(1, end) infinite; }
.isl-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: #FF453A; box-shadow: 0 0 8px rgba(255, 69, 58, .8); }

/* ---- full: the event card, or what it carries, opened up ---- */
.isl-full {
  position: absolute; left: 0; top: 0; box-sizing: border-box;
  padding: var(--isl-pad, 14px) 18px 16px;
  opacity: 0; filter: blur(6px); transform: scale(.94); transform-origin: 50% 0;
  transition: opacity .12s ease, filter .12s ease, transform .2s ease;
}
.sb-island[data-state="full"] .isl-full {
  opacity: 1; filter: none; transform: none;
  transition: opacity .28s ease .12s, filter .28s ease .12s, transform var(--isl-dur) var(--isl-spring) .04s;
}
.isl-row { display: flex; align-items: center; gap: 12px; min-height: 42px; }
.isl-badge {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 14px; background: rgba(255, 255, 255, .1);
}
.isl-badge .isl-mark { height: 22px; }
.isl-badge .isl-ico, .isl-badge .isl-ring { width: 26px; height: 26px; }
.isl-txt { flex: 1; min-width: 0; }
.isl-title { font: 600 16px/1.25 var(--isl-sf); color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.isl-detail {
  margin-top: 2px; font: 500 13.5px/1.35 var(--isl-sf); color: rgba(235, 235, 245, .62);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.isl-detail:empty { display: none; }
.isl-when {
  flex: none; align-self: flex-start; margin-top: 3px;
  font: 600 13px/1 var(--isl-sf); color: #F5C518; font-variant-numeric: tabular-nums;
}
.isl-bar { position: relative; height: 5px; margin: 14px 2px 1px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.isl-bar i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #8E2A3C, #F5C518);
  transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .5s ease;
}
.isl-bar.busy i { width: 36%; transform: none; animation: isl-busy 1.35s cubic-bezier(.45, .05, .55, .95) infinite; }
@keyframes isl-busy { from { transform: translateX(-105%); } to { transform: translateX(285%); } }
.isl-acts { display: flex; gap: 8px; margin-top: 14px; }
.isl-acts[hidden] { display: none; }
.isl-acts button {
  flex: 1; height: 42px; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 15px/1 var(--isl-sf); color: #FFFFFF; background: rgba(255, 255, 255, .14);
  -webkit-tap-highlight-color: transparent; transition: transform .2s var(--ease-spring), opacity .12s ease;
}
.isl-acts button.primary { background: #F5C518; color: #000; }
.isl-acts button:active { transform: scale(.96); opacity: .8; transition-duration: .06s; }
@media (prefers-reduced-motion: reduce) {
  .sb-island { --isl-dur: 1ms; }
  .working .isl-cursor, .isl-block, .isl-bar.busy i { animation: none; }
}

/* ============================================================ native touch
   No grey flash on taps, no selecting the app's own buttons and headings, no
   link callouts on chrome, no double-tap zoom — while the words people may
   want to copy (Claude's replies, inputs, code) still select as usual. */
html.ios { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* An app's labels and headings don't select under a held finger the way a web
   page's do (the Copy / Look Up bar is the most browser thing an iPhone shows).
   What people do copy keeps it: what they type, Claude's replies, code, ids. */
html.ios body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
html.ios :where(input, textarea, [contenteditable="true"], [contenteditable=""], .feed, .feed *, pre, code, .mono, .selectable) {
  -webkit-user-select: text; user-select: text; -webkit-touch-callout: default;
}
html.ios :where(button, .btn, a, input, select, textarea, label, [role="button"], .pcard, .cat-head) { touch-action: manipulation; }
/* a press-and-hold is the menu, not a drag */
html.ios :where(.pcard, .cat-head, img) { -webkit-user-drag: none; }
/* a panel scrolled to its end stays put rather than dragging the page with it */
html.ios :where(.m-sheet, .chat .feed, #chat-feed, .settings-body, .ctx-menu, .dd-menu, .cust-list, .design-list, .modal) { overscroll-behavior: contain; }

/* the quick-update card a held finger opens (updates.js) — no keyboard to
   hold Shift on or press ⌘⏎ with, so its keyboard hints step aside */
html.ios .upq-hint, html.ios .upq-send kbd { display: none; }
/* the press: a card sinks while it is held, the way a home-screen icon does */
html.ios .lp-press { transform: scale(.965) !important; transition: transform .5s cubic-bezier(.2, .7, .25, 1) !important; }
/* and when its menu opens, everything but it dims and blurs behind the menu */
#sb-spot {
  position: fixed; inset: 0; z-index: 59; pointer-events: none;
  background: rgba(12, 12, 12, .26);
  backdrop-filter: blur(9px) saturate(1.15); -webkit-backdrop-filter: blur(9px) saturate(1.15);
  -webkit-mask-image: linear-gradient(#000, #000), linear-gradient(#000, #000);
  -webkit-mask-size: var(--w, 0) var(--h, 0), 100% 100%;
  -webkit-mask-position: var(--x, 0) var(--y, 0), 0 0;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .28s ease;
}
#sb-spot.on { opacity: 1; }

/* ---- the right-click menu, as an iOS context menu ---- */
html.ios .ctx-menu {
  min-width: 250px; max-width: min(300px, calc(100vw - 24px)); padding: 0;
  max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border: 0; border-radius: 14px;
  background: rgba(246, 246, 246, .84);
  backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .1);
  transform-origin: 20% 0; animation: ios-menu-in .34s var(--ease-spring) both;
}
html.ios .ctx-menu.closing { animation: ios-menu-out .18s ease both; }
@keyframes ios-menu-in { from { opacity: 0; transform: scale(.55); } }
@keyframes ios-menu-out { to { opacity: 0; transform: scale(.92); } }
html.ios .ctx-title {
  padding: 12px 16px 9px; text-align: center; white-space: normal;
  font: 600 13px/1.3 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; color: rgba(60, 60, 67, .62);
}
html.ios .ctx-lab {
  padding: 9px 16px 5px; border-top: .5px solid rgba(60, 60, 67, .26);
  font: 400 13px/1.3 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; letter-spacing: 0; text-transform: none;
  color: rgba(60, 60, 67, .62);
}
html.ios .ctx-none { padding: 4px 16px 10px; font-size: 14px; }
html.ios .ctx-item {
  min-height: 46px; padding: 11px 16px; border-radius: 0; gap: 10px;
  border-top: .5px solid rgba(60, 60, 67, .26);
  font: 400 17px/1.2 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; color: #000;
  transition: background .1s ease;
}
html.ios .ctx-item:hover { background: transparent; color: #000; }
html.ios .ctx-item:active { background: rgba(0, 0, 0, .1); transform: none; }
html.ios .ctx-item.is-on { color: #000; font-weight: 600; }
html.ios .ctx-item.danger, html.ios .ctx-item.danger:hover { color: #FF3B30; background: transparent; }
html.ios .ctx-tick { width: 16px; height: 16px; color: #000; }
html.ios .ctx-sep { height: 8px; margin: 0; background: rgba(0, 0, 0, .07); }

/* ======================================================= home-screen app
   Opened from the Home Screen the page runs under the status bar and the
   island: every header keeps its controls below them, and the canvas color
   fills whatever a bounce reveals. */
html.standalone .home-head { padding-top: calc(12px + env(safe-area-inset-top)); }
html.standalone body:has(#view-home:not([hidden]) #home-sites:not([hidden])) { background-color: #000; }
html.standalone body:has(#view-home:not([hidden]) #home-sites:not([hidden]))::before { display: none; }
html.standalone .modal-back {
  padding-top: max(20px, calc(env(safe-area-inset-top) + 8px));
  padding-bottom: max(20px, calc(env(safe-area-inset-bottom) + 8px));
}
html.standalone #view-editor .topbar { padding-top: max(8px, env(safe-area-inset-top)); }
/* the editor is one fixed screen: it never rubber-bands as a page */
html.standalone:has(body.editing), html.standalone body.editing { overscroll-behavior: none; }

/* ================================================= install card (Safari) */
#sb-install {
  position: fixed; z-index: 2147483000;   /* over everything but the island — it is one tap to put away */ left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 440px; margin: 0 auto; padding: 16px 16px 14px;
  border: 1px solid var(--line); border-radius: 20px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(26px) saturate(1.6); -webkit-backdrop-filter: blur(26px) saturate(1.6);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .9);
  transform: translateY(calc(100% + 40px)); transition: transform .55s var(--ease-out);
}
#sb-install.on { transform: none; }
#sb-install[hidden] { display: none; }
.sbi-x {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: rgba(26, 26, 26, .07); color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.sbi-top { display: flex; gap: 13px; align-items: center; padding-right: 28px; }
.sbi-top img { flex: none; width: 54px; height: 54px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.sbi-top b { display: block; font: 700 16px/1.25 var(--sans); color: var(--ink); }
.sbi-top span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.sbi-steps { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line-soft); display: grid; gap: 9px; }
.sbi-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--ink); }
.sbi-n {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 0;
  border-radius: 50%; background: var(--cta-grad); color: #fff; font: 700 12px/1 var(--sans);
}
.sbi-key { display: inline-block; padding: 0 7px; border-radius: 6px; background: rgba(26, 26, 26, .08); font-weight: 800; letter-spacing: .05em; }
.sbi-share { width: 16px; height: 16px; vertical-align: -3px; color: #0A84FF; }
.sbi-go { width: 100%; justify-content: center; margin-top: 14px; padding: 12px 18px; font-size: 14px; }

/* ================================================ Settings → iPhone & iPad */
.ph-install { display: flex; gap: 20px; align-items: center; margin: 4px 0 22px; }
.ph-qr { flex: none; width: 148px; height: 148px; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-rest); }
.ph-qr:empty { display: none; }
.ph-qr svg { display: block; width: 100%; height: 100%; }
.ph-steps { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.ph-steps b { font-weight: 700; }
.set-sec h4.ph-h { margin: 18px 0 4px; font: 700 13.5px var(--display); color: var(--ink); }
#ph-code {
  flex: 1; min-width: 0; font: 600 18px var(--mono); letter-spacing: .18em; text-transform: uppercase;
}
.ph-msg { margin: 8px 2px 0; font-size: 12.5px; line-height: 1.5; }
.ph-msg.ok { color: var(--ok); }
.ph-msg.err { color: var(--danger-ink); }
.ph-dev { display: flex; align-items: center; gap: 11px; }
.ph-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-deep); }
.ph-ico svg { width: 17px; height: 17px; }
.ph-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ph-name b { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.ph-name b em { font-style: normal; font-weight: 600; font-size: 11px; color: var(--accent-deep); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.ph-name span { font-size: 12px; color: var(--muted); }
.ph-shake { margin: 6px 0 4px; }
.ph-shake .sec-switch { position: relative; min-width: 0; }
.ph-shake .sec-switch-txt b { font-size: 13.5px; }
.ph-shake .sec-switch-txt span { font-size: 12px; white-space: normal; line-height: 1.45; }
@media (max-width: 560px) { .ph-install { flex-direction: column; align-items: flex-start; } }
