/* The iPhone look (Classic, from Dec 2026): Apple's colours, true black at night, grouped lists, a floating glass
   tab bar, sheets, toasts, iMessage-style chat and Home widgets. Everything here only applies to body.ios (Classic);
   the other Looks keep their own style. Loaded after hub.css. The behaviours live in ios.js. */

/* -- 1. Apple's colours (iOS system colours), and true black dark mode -- */
:root:has(> body.ios) {
  --ink: #000; --muted: #6c6c70; --line: #c6c6c8; --bg: #f2f2f7; --panel: #fff; --head: #f2f2f7;
  --accent: #007aff; --accent-btn: #007aff; --danger: #ff3b30; --ok: #34c759; --today: #fff4e0; --radius: 22px;
  --fill: rgb(118 118 128 / 12%); --fill-2: rgb(118 118 128 / 20%); --sep: rgb(60 60 67 / 29%);
  --bubble-in: #e9e9eb; --bubble-me: #007aff; --seg-thumb: #fff; --sw-off: #e9e9ea;
  --glass: rgb(250 250 252 / 72%); --glass-edge: rgb(255 255 255 / 75%); --glass-shadow: 0 8px 28px rgb(0 0 0 / 12%), 0 1px 3px rgb(0 0 0 / 6%);
  --shadow: none; --shadow-up: 0 10px 30px rgb(0 0 0 / 12%);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):has(> body.ios) {
    --ink: #fff; --muted: #98989f; --line: #38383a; --bg: #000; --panel: #1c1c1e; --head: #000;
    --accent: #0a84ff; --accent-btn: #0a84ff; --danger: #ff453a; --ok: #30d158; --today: #3a2a10;
    --fill: rgb(118 118 128 / 24%); --fill-2: rgb(118 118 128 / 36%); --sep: rgb(84 84 88 / 65%);
    --bubble-in: #262629; --bubble-me: #0a84ff; --seg-thumb: #636366; --sw-off: #39393d;
    --glass: rgb(30 30 32 / 66%); --glass-edge: rgb(255 255 255 / 14%); --glass-shadow: 0 8px 28px rgb(0 0 0 / 50%);
    --shadow-up: 0 10px 30px rgb(0 0 0 / 50%);
  }
}
:root[data-theme="dark"]:has(> body.ios) {
  --ink: #fff; --muted: #98989f; --line: #38383a; --bg: #000; --panel: #1c1c1e; --head: #000;
  --accent: #0a84ff; --accent-btn: #0a84ff; --danger: #ff453a; --ok: #30d158; --today: #3a2a10;
  --fill: rgb(118 118 128 / 24%); --fill-2: rgb(118 118 128 / 36%); --sep: rgb(84 84 88 / 65%);
  --bubble-in: #262629; --bubble-me: #0a84ff; --seg-thumb: #636366; --sw-off: #39393d;
  --glass: rgb(30 30 32 / 66%); --glass-edge: rgb(255 255 255 / 14%); --glass-shadow: 0 8px 28px rgb(0 0 0 / 50%);
  --shadow-up: 0 10px 30px rgb(0 0 0 / 50%);
}
body.ios .flash.ok { background: color-mix(in srgb, var(--ok) 16%, var(--panel)); color: var(--ink); }
body.ios .flash.error { background: color-mix(in srgb, var(--danger) 16%, var(--panel)); color: var(--ink); }

/* -- 2. Text: 17pt body like the iPhone, large bold titles, (emoji come off titles in ios.js) -- */
body.ios { font-size: calc(17px * var(--ts, 1)); line-height: 1.35; letter-spacing: -.01em; }
body.ios h1 { font-size: calc(34px * var(--ts, 1)); font-weight: 700; letter-spacing: .01em; line-height: 1.12; margin: 2px 0 10px; }
body.ios h2 { font-size: calc(20px * var(--ts, 1)); font-weight: 700; letter-spacing: -.01em; }
body.ios .help { font-size: calc(13px * var(--ts, 1)); }
body.ios .cal-head h1 { font-size: calc(22px * var(--ts, 1)); }
body.ios .hero h1 { font-size: clamp(26px, 7vw, 36px); }
body.ios .kicker { display: none; }  /* its link becomes the back button at the top (ios.js) */
body.ios.no-back .kicker { display: block; }
/* "Match my iPhone": the size comes from the phone's own Text Size setting (ios.js sets --ts from it) */
.ios-probe { font: -apple-system-body; position: absolute; visibility: hidden; pointer-events: none; }

/* -- 3. The top of every page: a slim glass bar; the big title sits in the page and shrinks into the bar -- */
body.ios .top { min-height: 48px; padding: 4px 16px; padding-top: max(4px, env(safe-area-inset-top)); border-bottom: .5px solid transparent;
  transition: border-color .2s; color: var(--ink); }
body.ios .top::before { background: var(--glass); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px); opacity: 0; transition: opacity .2s; }
body.ios.scrolled .top { border-bottom-color: var(--sep); }
body.ios.scrolled .top::before { opacity: 1; }
body.ios .brand img { box-shadow: none; border-radius: 7px; width: 28px; height: 28px; }
body.ios .me-chip { background: transparent; padding: 0; }
body.ios .me-chip .avatar.tiny { width: 34px; height: 34px; }
.ios-back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); text-decoration: none; font-size: calc(17px * var(--ts, 1));
  min-height: 44px; padding-right: 8px; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.ios-back svg { width: 13px; height: 21px; flex: none; margin-right: 4px; }
.ios-title { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 4px); height: 48px; display: flex; align-items: center;
  max-width: 52vw; font-weight: 600; font-size: calc(17px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; }
body.ios.title-up .ios-title { opacity: 1; transform: translate(-50%, 0); }
.ios-add { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--accent); text-decoration: none;
  background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: inset 0 0 0 .5px var(--glass-edge), 0 1px 4px rgb(0 0 0 / 8%);
  font-size: 0; flex: none; }
.ios-add svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  body.ios:not([data-view="home"]) .brand { display: none; }
  body.ios .top { flex-wrap: nowrap; }
  body.ios .me-chip { order: 3; margin-left: 0; }
  body.ios .ios-add { order: 2; margin-left: auto; }
  body.ios .ios-back { order: -3; }
  body.ios:not(:has(.ios-add)) .me-chip { margin-left: auto; }
}
@media (min-width: 641px) { body.ios .top::before { opacity: 1; } body.ios .top { border-bottom-color: var(--sep); } }

/* -- 4. The tab bar: a floating Liquid Glass capsule, with search as its own round button beside it -- */
@media (max-width: 640px) {
  body.ios nav.main { left: 14px; right: 86px; bottom: max(10px, calc(env(safe-area-inset-bottom) - 10px)); padding: 4px;
    border-radius: 999px; border: 0; background: var(--glass); -webkit-backdrop-filter: saturate(1.8) blur(22px); backdrop-filter: saturate(1.8) blur(22px);
    box-shadow: inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow); }
  body.ios nav.main a { border-radius: 999px; padding: 6px 0 4px; gap: 0; font-size: 10px; font-weight: 600; letter-spacing: 0;
    color: var(--ink); transition: background .2s, color .2s; }
  body.ios nav.main a.on, body.ios nav.main a:hover { color: var(--accent); background: none; }
  body.ios nav.main a.on { background: var(--fill); }
  body.ios nav.main .ni { padding: 0; background: none !important; font-size: calc(24px * var(--ts, 1)); line-height: 1.1; }
  body.ios nav.main a.on .ni { --duo: color-mix(in srgb, var(--accent) 30%, transparent); }
  body.ios nav.main .nl { font-size: 10px; }
  body.ios nav.main a .badge { top: 2px; left: calc(50% + 6px); }
  body.ios .top-search { position: fixed; z-index: 30; right: 14px; bottom: max(10px, calc(env(safe-area-inset-bottom) - 10px)); width: 64px; height: 64px;
    border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--glass);
    -webkit-backdrop-filter: saturate(1.8) blur(22px); backdrop-filter: saturate(1.8) blur(22px);
    box-shadow: inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow); }
  body.ios .top-search svg { width: 24px; height: 24px; }
  body.ios:has(.chat-send) .top-search { display: none; }
  body.ios .page { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  body.ios nav.main a:active, body.ios .top-search:active { transform: scale(.94); }
}

/* -- 5. Grouped lists: rounded groups on the grey page, thin lines between rows, no shadows -- */
body.ios .page { padding-top: 6px; }
body.ios .card { border: 0; box-shadow: none; border-radius: var(--radius); padding: 16px; margin: 12px 0 18px; }
body.ios .card h2:first-child { margin-top: 0; }
body.ios .list { gap: 0; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
body.ios .list .entry { border: 0; border-radius: 0; margin: 0; background: transparent; padding: 12px 16px 12px 24px; }
body.ios .list .entry + .entry::after, body.ios .list > * + .entry::after { content: ""; position: absolute; left: 24px; right: 0; top: 0; height: .5px; background: var(--sep); }
body.ios .entry { border: 0; border-radius: 16px; padding: 12px 16px 12px 24px; }
body.ios .entry::before { left: 10px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; }
body.ios a.entry:hover { border-color: transparent; background: var(--fill); }
body.ios .entry .when { font-weight: 600; font-variant-numeric: tabular-nums; }
body.ios .date-head { font-size: calc(13px * var(--ts, 1)); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; margin: 22px 16px 6px; }
body.ios .date-head.today { color: var(--accent); }
body.ios .wday { border: 0; border-radius: var(--radius); padding: 12px 14px; }
body.ios .wday.today { background: var(--panel); box-shadow: inset 0 0 0 2px var(--accent); }
body.ios .tile, body.ios .person-tile { border: 0; box-shadow: none; }
body.ios .person-tile { border-top: 0; }
body.ios .person-tile .avatar { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--c); }
body.ios .tile:hover, body.ios .tile:focus-visible { transform: none; box-shadow: none; background: color-mix(in srgb, var(--ink) 4%, var(--panel)); }
body.ios .set-menu { border: 0; border-radius: var(--radius); }
body.ios .set-row { padding: 11px 16px; border-top: 0; position: relative; }
body.ios .set-menu > * + * .set-row::after, body.ios .set-menu > .set-row + .set-row::after, body.ios .set-menu > * + .set-row::after {
  content: ""; position: absolute; left: 62px; right: 0; top: 0; height: .5px; background: var(--sep); }
body.ios .set-ic { width: 32px; height: 32px; border-radius: 8px; font-size: 18px; }
body.ios .set-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 14px; }
body.ios .set-go { color: color-mix(in srgb, var(--muted) 70%, transparent); font-size: 22px; }
body.ios .set-group { font-size: calc(13px * var(--ts, 1)); letter-spacing: .02em; margin: 24px 16px 7px; font-weight: 400; }
body.ios .month { border: 0; border-radius: var(--radius); background: var(--sep); gap: .5px; }
body.ios .dow, body.ios .cell { background: var(--panel); }
body.ios .cell.weekend { background: var(--panel); }
body.ios .cell.today { background: var(--panel); }
body.ios .cell.today .num { background: var(--danger); color: #fff; }  /* the iPhone calendar's red circle for today */
body.ios .chip { border-radius: 5px; }
body.ios .shop-list .shop-row { border-color: var(--sep); }
body.ios .tea-row { border: 0; background: var(--fill); border-left: 4px solid var(--c); }
body.ios .hero { border-radius: var(--radius); box-shadow: none; }
body.ios .news { border: 0; background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* -- 6. Buttons: filled or tinted, never outlined; plain blue text links; red for deleting -- */
body.ios .btn { border: 0; background: var(--fill); color: var(--accent); font-weight: 600; min-height: 44px; padding: 10px 20px; box-shadow: none;
  transition: opacity .15s, background .15s; }
body.ios .btn:active { transform: none; opacity: .55; }
body.ios .btn.primary { background: var(--accent); color: #fff; box-shadow: none; }
body.ios .btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
body.ios .btn.ghost { background: transparent; }
body.ios .btn.small { min-height: 34px; padding: 6px 14px; }
body.ios .link-btn { color: var(--accent); text-decoration: none; opacity: 1; }
body.ios .link-btn.ios-destructive, body.ios .btn.ios-destructive { color: var(--danger); }
body.ios .flash .link-btn { color: var(--accent); }
body.ios .form label:not(.pick):not(.check):not(.inline):not(.swatch) { font-weight: 400; color: var(--muted); font-size: calc(13px * var(--ts, 1)); text-transform: uppercase; letter-spacing: .02em; margin-top: 16px; }
body.ios .form label.check, body.ios .form label.inline { color: var(--ink); text-transform: none; letter-spacing: -.01em; font-size: calc(17px * var(--ts, 1)); }
body.ios .form input[type=text], body.ios .form input:not([type]), body.ios .form input[type=date], body.ios .form input[type=time],
body.ios .form input[type=password], body.ios .form input[type=number], body.ios .form input[type=url], body.ios .form select, body.ios .form textarea,
body.ios .quick-add input, body.ios input[type=search] {
  background: var(--fill); border: 0; border-radius: 12px; font-size: max(16px, calc(17px * var(--ts, 1))); padding: 11px 14px; color: var(--ink); }
body.ios .form input:focus, body.ios .form select:focus, body.ios .form textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
body.ios .repeat { background: var(--fill); border-radius: 12px; }
/* swipe to delete (ios.js): the row slides left over a red Delete button */
.ios-swipe { position: relative; overflow: hidden; }
.ios-swipe-in { position: relative; z-index: 1; background: inherit; transition: transform .25s cubic-bezier(.2, .8, .2, 1); touch-action: pan-y; }
.ios-swipe.dragging .ios-swipe-in { transition: none; }
.ios-swipe-del { position: absolute; top: 0; right: 0; bottom: 0; width: 88px; border: 0; background: var(--danger); color: #fff; font: inherit;
  font-weight: 600; font-size: 15px; cursor: pointer; }
@media (pointer: coarse) { body.ios .ios-swipe .ios-hide-on-touch { display: none; } }

/* -- 7. Month · Week · Day · List: an iPhone segmented control -- */
body.ios .views { border: 0; background: var(--fill); border-radius: 999px; padding: 3px; gap: 0; overflow: visible; }
body.ios .views a { border: 0; border-radius: 999px; padding: 6px 16px; font-size: calc(14px * var(--ts, 1)); font-weight: 500; color: var(--ink); transition: background .2s; }
body.ios .views a.on { background: var(--seg-thumb); color: var(--ink); font-weight: 600; box-shadow: 0 3px 8px rgb(0 0 0 / 12%), 0 3px 1px rgb(0 0 0 / 4%); }
body.ios .pill { border: 0; background: var(--fill); }
body.ios .pill.on { background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--panel)); }
body.ios .pick > span { border: 0; background: var(--fill); }
body.ios .pick input:checked + span { background: color-mix(in srgb, var(--c, var(--accent)) 20%, var(--panel)); color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--c, var(--accent)); }
body.ios .nav-month .btn { background: transparent; color: var(--accent); }

/* -- 8. Switches (green, like Settings) and round Reminders-style ticks -- */
body.ios input.ios-sw { order: 9; margin-left: auto !important; flex: none; accent-color: var(--ok); }
body.ios label.check:has(> input.ios-sw) { justify-content: space-between; flex-wrap: nowrap; padding: 6px 0; }
body.ios input.ios-sw-draw { -webkit-appearance: none; appearance: none; width: 51px; height: 31px; border-radius: 999px; background: var(--sw-off);
  position: relative; cursor: pointer; transition: background .25s; margin: 0; flex: none; }
body.ios input.ios-sw-draw::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgb(0 0 0 / 15%), 0 3px 1px rgb(0 0 0 / 6%); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
body.ios input.ios-sw-draw:checked { background: var(--ok); }
body.ios input.ios-sw-draw:checked::before { transform: translateX(20px); }
body.ios input.ios-sw-draw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.ios input.ios-tick { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--muted) 70%, transparent);
  margin: 0; flex: none; cursor: pointer; display: inline-grid; place-items: center; transition: background .15s, border-color .15s; }
body.ios input.ios-tick:checked { background: var(--accent); border-color: var(--accent); }
body.ios input.ios-tick:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.2px 2.2px 0; transform: translateY(-1px) rotate(45deg); }
body.ios .shop-box { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--muted) 70%, transparent); background: transparent; color: transparent; }
body.ios .shop-box.on { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 14px; font-weight: 800; }
body.ios .shop-got .shop-text b { color: var(--muted); }
body.ios .shop-tick:active .shop-box { transform: scale(.85); }

/* -- 9. Sheets: adding and changing slide up from the bottom over the page -- */
.ios-sheet-back { position: fixed; inset: 0; z-index: 80; background: rgb(0 0 0 / 0%); transition: background .3s; }
.ios-sheet-back.on { background: rgb(0 0 0 / 38%); }
.ios-sheet { position: fixed; z-index: 81; left: 0; right: 0; bottom: 0; top: max(14px, calc(env(safe-area-inset-top) + 8px)); background: var(--bg);
  border-radius: 14px 14px 0 0; overflow: hidden; transform: translateY(105%); transition: transform .38s cubic-bezier(.2, .9, .25, 1);
  box-shadow: 0 -6px 30px rgb(0 0 0 / 18%); display: flex; flex-direction: column; }
.ios-sheet.on { transform: translateY(0); }
.ios-sheet.dragging { transition: none; }
.ios-sheet-grab { flex: none; height: 22px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.ios-sheet-grab::before { content: ""; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); }
.ios-sheet iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.ios-sheet-wait { position: absolute; inset: 22px 0 auto; display: grid; place-items: center; padding: 40px; }
@media (min-width: 700px) { .ios-sheet { left: 50%; right: auto; width: 620px; top: 6vh; bottom: 6vh; border-radius: 14px; transform: translate(-50%, 110vh); }
  .ios-sheet.on { transform: translate(-50%, 0); } }
html:has(.ios-sheet.on) { overflow: hidden; }
/* the page inside a sheet: no header or tab bar, and its own Cancel · title · Save bar */
body.ios.in-sheet .top, body.ios.in-sheet .fab, body.ios.in-sheet .flashes, body.ios.in-sheet .deco, body.ios.in-sheet .deco-snow,
body.ios.in-sheet .tint, body.ios.in-sheet .splash, body.ios.in-sheet .top-search { display: none !important; }
body.ios.in-sheet main > h1:first-of-type { display: none; }
body.ios.in-sheet .page { padding-top: 0; padding-bottom: 40px; }
.ios-sheetbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 6px 16px 8px; background: var(--bg); }
.ios-sheetbar b { font-size: calc(17px * var(--ts, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
.ios-sheetbar button { border: 0; background: none; font: inherit; font-size: calc(17px * var(--ts, 1)); color: var(--accent); padding: 8px 0; cursor: pointer; }
.ios-sheetbar .go { justify-self: end; font-weight: 600; }
.ios-sheetbar .go[disabled] { opacity: .4; }
.ios-sheetbar button:first-child { justify-self: start; }

/* -- 10. The + button: up at the top right (ios.js moves it); the round floating one goes -- */
body.ios .fab { display: none; }

/* -- 11. Messages ("Saved", "Added milk"): a capsule that drops in at the top, then goes by itself -- */
.ios-toasts { position: fixed; z-index: 90; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); display: grid; gap: 8px;
  justify-items: center; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.ios-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 12px; border-radius: 999px; color: var(--ink);
  background: var(--glass); -webkit-backdrop-filter: saturate(1.8) blur(22px); backdrop-filter: saturate(1.8) blur(22px);
  box-shadow: inset 0 0 0 .5px var(--glass-edge), var(--glass-shadow); font-size: calc(15px * var(--ts, 1)); font-weight: 600;
  animation: ios-toast-in .45s cubic-bezier(.2, 1.3, .4, 1) both; cursor: pointer; }
.ios-toast.out { animation: ios-toast-out .3s ease-in both; }
.ios-toast i { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 14px; font-weight: 800;
  color: #fff; background: var(--accent); }
.ios-toast.ok i { background: var(--ok); }
.ios-toast.error i { background: var(--danger); }
.ios-toast form { margin: 0; }
.ios-toast .btn { min-height: 30px; padding: 4px 12px; font-size: 14px; background: var(--fill); }
@keyframes ios-toast-in { from { opacity: 0; transform: translateY(-140%) scale(.9); } }
@keyframes ios-toast-out { to { opacity: 0; transform: translateY(-140%) scale(.9); } }
body.ios .flash { box-shadow: none; border-radius: 16px; background: var(--panel); color: var(--ink); }
body.ios .flash.tomorrow { background: color-mix(in srgb, #ff9500 16%, var(--panel)); color: var(--ink); }

/* -- 12. Icons: our own drawn ones (Apple's aren't allowed), white on a solid colour square like Settings -- */
body.ios .tile-icon { color: #fff; --duo: rgb(255 255 255 / 28%); border-radius: 12px; }
body.ios .tile:nth-child(6n+1) .tile-icon { background: #007aff; }
body.ios .tile:nth-child(6n+2) .tile-icon { background: #ff9500; }
body.ios .tile:nth-child(6n+3) .tile-icon { background: #34c759; }
body.ios .tile:nth-child(6n+4) .tile-icon { background: #ff2d55; }
body.ios .tile:nth-child(6n+5) .tile-icon { background: #af52de; }
body.ios .tile:nth-child(6n+6) .tile-icon { background: #32ade6; }
body.ios nav.main .ni svg, body.ios .top-search svg { stroke-width: 1.7; }

/* -- 13. Chat like the iPhone's Messages: blue bubbles for yours, grey for everyone else's -- */
body.ios .msg { border: 0; border-radius: 19px; padding: 7px 13px 6px; background: var(--bubble-in); max-width: min(78%, 520px); }
body.ios .msg.mine { border: 0; background: var(--bubble-me); color: #fff; }
body.ios .msg.mine .msg-meta, body.ios .msg.mine .msg-meta * { color: rgb(255 255 255 / 78%); }
body.ios .msg.mine .msg-link, body.ios .msg.mine a { color: #fff; }
body.ios .msg.mine .msg-quote { background: rgb(255 255 255 / 18%); border-left-color: #fff; }
body.ios .msg.mine .msg-quote b, body.ios .msg.mine .msg-quote span { color: rgb(255 255 255 / 85%); }
body.ios .msg-name { color: var(--muted); font-weight: 500; font-size: calc(12px * var(--ts, 1)); }
body.ios .msg-meta { color: var(--muted); }
body.ios .chat-day { background: none; border: 0; font-weight: 600; color: var(--muted); }
body.ios .chat .msg:not(.mine).has-next { border-bottom-left-radius: 6px; }
body.ios .chat .msg:not(.mine).cont { border-top-left-radius: 6px; }
body.ios .chat .msg.mine.has-next { border-bottom-right-radius: 6px; }
body.ios .chat .msg.mine.cont { border-top-right-radius: 6px; }
body.ios .msg.mine .react-open, body.ios .msg.mine .link-btn { color: #fff; }
body.ios .chat-send { background: var(--glass); -webkit-backdrop-filter: saturate(1.8) blur(22px); backdrop-filter: saturate(1.8) blur(22px);
  border-top: .5px solid var(--sep); box-shadow: none; }
body.ios .chat-row { align-items: flex-end; gap: 8px; }
body.ios .chat-row textarea { background: var(--panel); border: .5px solid var(--sep) !important; border-radius: 20px; padding: 8px 44px 8px 14px; min-height: 38px;
  font-size: max(16px, calc(17px * var(--ts, 1))); }
body.ios .chat-row > .btn.primary { width: 32px; height: 32px; min-height: 32px; padding: 0; border-radius: 50%; margin: 0 0 3px -44px; position: relative; z-index: 1;
  font-size: 0; flex: none; }
body.ios .chat-row > .btn.primary svg { width: 18px; height: 18px; }
body.ios .chat-row:not(.has-text) > .btn.primary { opacity: .35; }
body.ios .chat-tool { width: 38px; height: 38px; border: 0; background: var(--fill); color: var(--muted); }

/* -- 14. Home as widgets: rounded squares, two across, each showing what's going on -- */
body.ios .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px !important; }
body.ios .tiles .tile { display: flex !important; flex-direction: column !important; align-items: flex-start !important; justify-content: space-between !important;
  text-align: left !important; aspect-ratio: 1 / 1; min-height: 0; padding: 14px 14px 13px !important; border-radius: 22px; gap: 6px !important; position: relative; overflow: hidden; }
body.ios .tiles .tile .tile-icon { width: 42px !important; height: 42px !important; font-size: 24px; margin: 0 0 auto !important; }
body.ios .tiles .tile .tile-icon svg { width: 26px; height: 26px; }
body.ios .tiles .tile .tile-name { font-size: calc(16px * var(--ts, 1)) !important; font-weight: 700; line-height: 1.2; text-align: left !important; }
body.ios .tiles .tile .tile-sub { display: -webkit-box !important; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font-size: calc(13px * var(--ts, 1)); color: var(--muted); line-height: 1.25; text-align: left !important; }
body.ios .tiles .tile .badge { position: absolute; top: 14px; right: 14px; margin: 0; }
body.ios .tiles .tile:active { transform: scale(.96); }
@media (min-width: 700px) { body.ios .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } }

/* -- 15. How pages move: new pages slide in from the right, going back slides them away; tabs just switch -- */
@media not (prefers-reduced-motion: reduce) {
  html.ios-push::view-transition-old(root) { animation: .38s cubic-bezier(.2, .9, .25, 1) both ios-out-left; }
  html.ios-push::view-transition-new(root) { animation: .38s cubic-bezier(.2, .9, .25, 1) both ios-in-right; }
  html.ios-pop::view-transition-old(root) { animation: .34s cubic-bezier(.2, .9, .25, 1) both ios-out-right; z-index: 2; }
  html.ios-pop::view-transition-new(root) { animation: .34s cubic-bezier(.2, .9, .25, 1) both ios-in-left; }
  html.ios-none::view-transition-old(root), html.ios-none::view-transition-new(root) { animation: none; }
  html.ios-tab::view-transition-old(root) { animation: .12s ease both ios-fade-out; }
  html.ios-tab::view-transition-new(root) { animation: .12s ease both ios-fade-in; }
}
@keyframes ios-out-left { to { transform: translateX(-30%); filter: brightness(.9); } }
@keyframes ios-in-right { from { transform: translateX(100%); } }
@keyframes ios-out-right { to { transform: translateX(100%); } }
@keyframes ios-in-left { from { transform: translateX(-30%); filter: brightness(.9); } }
@keyframes ios-fade-out { to { opacity: 0; } }
@keyframes ios-fade-in { from { opacity: 0; } }
/* swiping from the left edge to go back */
body.ios.edge-drag main, body.ios.edge-drag .top > :not(nav) { transition: none !important; }
.ios-edge-shade { position: fixed; inset: 0; z-index: 9; pointer-events: none; background: linear-gradient(90deg, rgb(0 0 0 / 10%), transparent 30%); opacity: 0; }
/* pull to refresh */
.ios-ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 54px); z-index: 25; width: 30px; height: 30px; margin-left: -15px;
  border-radius: 50%; display: grid; place-items: center; opacity: 0; pointer-events: none; }
.ios-ptr svg { width: 28px; height: 28px; color: var(--muted); }
.ios-ptr.go svg { animation: ios-spin .8s steps(8) infinite; }
@keyframes ios-spin { to { transform: rotate(360deg); } }
body.ios main { transition: transform .3s cubic-bezier(.2, .9, .25, 1); }
body.ios.pulling main { transition: none; }

/* -- 16. Empty pages: a soft grey picture, a clear line, nothing dashed -- */
body.ios .empty[data-art] { border: 0; background: transparent; padding: 44px 24px 36px; font-size: calc(16px * var(--ts, 1)); color: var(--muted); }
body.ios .empty[data-art]::before { font-size: calc(52px * var(--ts, 1)); filter: grayscale(1); opacity: .45; animation: none; margin-bottom: 12px; }
body.ios .empty[data-art] .add-here { color: var(--accent); font-size: calc(15px * var(--ts, 1)); margin-top: 10px; }
body.ios .empty { color: var(--muted); }

/* Fixes after the first look */
/* A view-transition name makes the header a "backdrop root": the glass inside it (and the tab bar) then can't blur the
   page behind. So the header moves with the page, and only the tab bar and the search button stay put. */
body.ios .top { view-transition-name: none; }
@media (max-width: 640px) { body.ios .top-search { view-transition-name: hub-search; } }
::view-transition-group(hub-search), ::view-transition-old(hub-search), ::view-transition-new(hub-search) { animation: none; }
::view-transition-old(hub-search) { display: none; }
body.ios .cell.other { opacity: 1; }
body.ios .cell.other .num { color: color-mix(in srgb, var(--muted) 60%, transparent); }
/* buttons that carry their own colours keep them (the Christmas card's white buttons) */
body.ios .xmas-btn { background: #fff; color: #b91c1c; }
body.ios .santa-home .btn:not(.primary) { background: rgb(255 255 255 / 16%); color: #fff; }
/* icons: white on the widget's colour square; one colour in the tab bar, like the iPhone's own */
body.ios .tile-icon .hi { --ic: #fff; --duo: rgb(255 255 255 / 28%); stroke-width: 2.1; }
body.ios nav.main .hi, body.ios .top-search .hi { --ic: currentColor; --duo: color-mix(in srgb, currentColor 14%, transparent); }
body.ios nav.main a.on .hi { --duo: color-mix(in srgb, var(--accent) 32%, transparent); stroke-width: 2.1; }
body.ios .top-search .hi { width: 24px; height: 24px; }
/* the rest of the hub's boxes: no outlines, just the panel on the grey page (grouped, like Settings) */
body.ios :is(.group-card, .game-card, .person-card, .chat-row-link, .next-box, .star-item, .wx-tab, .sn-row, .pr-end, .tv-now, .play,
  .chat-later-list, .effect-choice, .sn-tabs, .chat-search) { border-color: transparent; box-shadow: none; }
body.ios :is(.group-card, .game-card, .person-card, .chat-row-link, .next-box, .star-item) { border-radius: var(--radius); }
