/* iPhone fit, 2026-10-17 (iPhone audit of app-v3 on the iphone-rig: 15 Pro Home Screen app, safe areas 59/34).
   Loaded last so these win. Each rule names what it fixed. In a Safari tab the insets are 0 and most of this is a no-op. */

/* 1. The scroll edge now covers the status bar. It used to stick below the screen's top padding (sticky insets count the
      scroll container's padding), so on a Dynamic Island phone scrolled text ran under the clock. */
html[data-theme] .screen.v2-edge::before,html[data-theme] #page.v2-edge:not(:has(.v2-pbar))::before{
  height:max(46px,calc(env(safe-area-inset-top) + 18px));margin-bottom:calc(-1 * max(46px,calc(env(safe-area-inset-top) + 18px)));
  background:linear-gradient(to bottom,rgb(var(--edgeRGB)) 0,rgb(var(--edgeRGB)) env(safe-area-inset-top),rgba(var(--edgeRGB),0));
  /* R1-04: a screen laid out as a flex column (the opened orbit) shrank this edge to 0 px, so its map, chips and rows ran
     under the clock with nothing behind them. The status-bar band is now solid too: at .96 the scrolled title still showed
     through as a ghost behind the clock. */
  flex-shrink:0}
@supports (padding:max(0px)){
  html[data-theme] .screen.v2-edge::before{top:calc(-1 * max(12px,calc(env(safe-area-inset-top) - 16px)))}
  html[data-theme] #page.v2-edge:not(:has(.v2-phero)):not(:has(.v2-pbar))::before{top:calc(-1 * max(42px,calc(env(safe-area-inset-top) + 6px)))}
  html[data-theme] #page.v2-edge:has(.v2-phero):not(:has(.v2-pbar))::before{top:calc(-1 * max(22px,env(safe-area-inset-top)))}
  /* the person page's sticky bar (Back, name, •••) stuck below the status bar, leaving a strip where the page showed through */
  html[data-theme] #page:has(.v2-phero){--padT:max(22px,env(safe-area-inset-top))}
  html[data-theme] #page:not(:has(.v2-phero)){--padT:max(42px,calc(env(safe-area-inset-top) + 6px))}
  html[data-theme] #page .v2-pbar{top:calc(-1 * var(--padT));margin-top:calc(-1 * var(--padT));padding-top:calc(var(--padT) + 6px)}
}

/* 2. Top controls clear the status bar. Screens start 16 px into the status bar on purpose (titles have their own top space),
      but a screen whose first row is a Back or Cancel put that button under the clock. */
@supports (padding:max(0px)){
  #community .v2-er{padding-top:max(48px,calc(env(safe-area-inset-top) + 8px))}
  #community .cm{padding-top:max(14px,calc(env(safe-area-inset-top) + 6px))}
  #s-you .v2-topnav,#s-log .tk-nav{margin-top:calc(max(0px,calc(env(safe-area-inset-top) + 6px)) - max(0px,calc(env(safe-area-inset-top) - 16px)))}
}
#community .cm-top .cbtn{width:44px!important;height:44px!important}

/* 3. Bottom controls clear the home indicator */
@supports (padding:max(0px)){
  html[data-theme] #sheet:not(.v2-full){padding-bottom:max(26px,calc(env(safe-area-inset-bottom) + 14px))}
  #v2saved .v2-sv-bar{bottom:max(22px,calc(env(safe-area-inset-bottom) + 4px))}
}
/* Log a talk review: the Save bar stuck 40 px above the bottom (the screen's bottom padding), and the list showed under it */
#s-log .v2-rv .v2-rvact{bottom:-40px}

/* 4. Long names: one line with an ellipsis on buttons ("Write to <name>" grew to four lines), wrap everywhere else
      (a name with no break point ran off the screen on the person page, its sheets and the undo bar) */
#sheet p,#page p,#page .v2-line,#sheet .v2-line{overflow-wrap:break-word}
#app .empty p,#app .empty .pill,#app .v2-kl,#app .v2-psheet .v2-link,#app #sheet .row.between>div p{overflow-wrap:anywhere}
/* ...and a long name no longer pushes a row's switch off the screen (person options: Keep close) */
#sheet .row.between>div:first-child,#page .row.between>div:first-child{min-width:0}
.v2-btn>.v2-bl{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#v2undo>span{flex:1;min-width:0;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}

/* 5. Tap targets: 44 pt (Apple HIG) */
#v2undo button{min-height:44px}
.v2-rcface{width:44px;height:44px;margin:-22px 0 0 -22px}
.link[data-signalset]{min-width:44px;justify-content:center}

/* Toasts wrap to a second line instead of cutting off ("Saved. Something new for Rosa: Resonate may s…", 2026-10-18
   final check). A two-line toast is a rounded card, not a pill. */
html[data-theme] #toast{white-space:normal;text-overflow:clip;text-align:center;line-height:1.3;border-radius:20px;width:max-content;max-width:min(360px,calc(100% - 32px))}

/* Add a person: "Import from your contacts app" wraps at large text instead of running off the sheet (2026-10-19,
   test-regression-v2 text200 at 320/390 px) */
.v2-addp .v2-btn.block{white-space:normal;height:auto;min-height:48px;padding-top:10px;padding-bottom:10px;line-height:1.25;text-align:center}
.v2-addp .v2-btn.block svg{flex:none}

/* R1-15 (2026-10-22): a long name inside a sentence is cut with an ellipsis, not broken mid-word or run off the screen
   (v2NmHTML in base.js cuts names over 16 letters to 14 and an ellipsis, so the words after it stay on the line:
   "Skipped. It’s Wolfeschlegels…’s birthday today"; the Undo bar now shows that reason instead of clipping it).
   This box only keeps the cut name from running off a very narrow line. */
.v2-nmcut{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
#s-signal .td-qq{min-width:0;overflow-wrap:anywhere}
#v2undo>span{overflow-wrap:break-word}
/* R1-15: a floating bottom bar grows with its button at large text sizes (Dynamic Type 200%: "Copy message" ran out of a
   fixed 64 pt bar onto the page under it); at normal sizes it is the same 64 pt bar */
.v2-fpbar:not(.stack):not(.col){height:auto;min-height:64px}
.v2-fpbar:not(.stack):not(.col) .v2-btn.grow{padding-top:6px;padding-bottom:6px}

/* R2-13 (23 Oct): full pages (Add a person, Write, Travel…) live in #sheet, which the status-bar edge above never covered,
   so a scrolled Add a person ran "how you know them" under the clock and the Dynamic Island. Same solid band and fade
   as the screens, in the page's own colour. */
html[data-theme] #sheet.v2-full{--edgeRGB:var(--voidRGB)}
html[data-theme="light"] #sheet.v2-full.cream{--edgeRGB:255,248,240}
html[data-theme] #sheet.v2-full.v2-edge::before{content:"";position:sticky;top:0;display:block;flex-shrink:0;pointer-events:none;z-index:8;
  height:max(46px,calc(env(safe-area-inset-top,0px) + 18px));margin-bottom:calc(-1 * max(46px,calc(env(safe-area-inset-top,0px) + 18px)));
  background:linear-gradient(to bottom,rgb(var(--edgeRGB)) 0,rgb(var(--edgeRGB)) env(safe-area-inset-top,0px),rgba(var(--edgeRGB),0))}
/* R2-13: a new tie's orbit is a Social | Professional control (People's filter), close under the tie's name */
.v2-addp .v2-apseg{margin-top:2px}
/* R2-13: while the keyboard is up on Add a person, the Add bar sits just above it (70-forms.js sets --kb), and the page
   has room to scroll its last field clear of the bar */
html[data-theme] #sheet.v2-full.v2-kb .v2-fp>.v2-fpbar{bottom:calc(var(--kb) + 8px)}
html[data-theme] #sheet.v2-full.v2-kb .v2-fp{padding-bottom:calc(var(--kb) + 16px)}
/* R2-13: setup step 1 scrolls (it now brings the new person's card clear of the button), and its progress bar and "Sign in
   instead" then ran under the clock. Same band, in setup's own ground colour. */
#onboard.v2-edge::before{content:"";position:sticky;top:0;display:block;pointer-events:none;z-index:8;
  height:max(46px,calc(env(safe-area-inset-top,0px) + 18px));margin-bottom:calc(-1 * max(46px,calc(env(safe-area-inset-top,0px) + 18px)));
  background:linear-gradient(to bottom,var(--hl-ground) 0,var(--hl-ground) env(safe-area-inset-top,0px),color-mix(in srgb,var(--hl-ground) 0%,transparent))}
