/* ============================================================================
   Native-style mobile shell (iOS / Android). Ported from the "Sofaverse 4"
   iOS prototype to vanilla CSS and scoped ENTIRELY under #ios-shell so its
   generic class names (.btn, .msg, .tab, .toast, .type, .meta …) never collide
   with the desktop app. The shell overlays the home inside #selector on phones;
   it hides automatically when an adventure opens (because #selector hides).
   The prototype's fake device bezel is dropped — a real device provides its own,
   and the status-bar / home-indicator gaps come from env(safe-area-inset-*).
   ============================================================================ */
#ios-shell {
  --abyss:#0a0705; --ember:#c98a3e; --ember-br:#e3a955; --ember-dp:#8a5f28;
  --ink:#efe4cd; --ink-dim:#b4a68b; --ink-mute:#7d715c;
  --line:rgba(227,169,85,0.22); --line-br:rgba(227,169,85,0.45);
  --glass:rgba(18,11,6,0.58); --glow:rgba(227,169,85,0.28);
  --gradc:#241507; --btn-ink:#1e1206;
  --disp:'Cinzel',Georgia,serif; --serif:'Cormorant Garamond',Georgia,serif; --mono:'JetBrains Mono',monospace;
  position:absolute; inset:0; z-index:20;
}
#ios-shell.hidden { display:none; }

#ios-shell .scr { position:relative; height:100%; display:flex; flex-direction:column;
  background:var(--abyss); color:var(--ink); font-family:var(--serif); -webkit-font-smoothing:antialiased; overflow:hidden; }
#ios-shell .scr a { color:var(--ember-br); text-decoration:none; }
#ios-shell.noanim .scr *, #ios-shell .scr.noanim * { animation:none !important; transition:none !important; }
#ios-shell .bg { position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(ellipse 120% 55% at 50% 0%, var(--gradc), var(--abyss) 78%); }
#ios-shell .vig { position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(ellipse at center, transparent 48%, rgba(8,5,3,0.28) 100%); }

/* header */
#ios-shell .hd { position:relative; z-index:2; flex:0 0 auto; display:flex; align-items:center; gap:10px;
  padding:calc(env(safe-area-inset-top) + 14px) 18px 12px; border-bottom:1px solid var(--line); }
#ios-shell .d20 { width:34px; height:34px; color:var(--ember-br); filter:drop-shadow(0 0 8px var(--glow)); flex:0 0 auto; }
#ios-shell .d20 svg { width:100%; height:100%; display:block; }
#ios-shell .d20 canvas { width:100%; height:100%; display:block; }
#ios-shell .nm { font-family:var(--disp); font-weight:700; font-size:13px; letter-spacing:0.14em; color:var(--ember-br); }
#ios-shell .sb { font-family:var(--mono); font-size:7px; letter-spacing:0.2em; text-transform:uppercase; color:var(--ink-mute); margin-top:2px; }
#ios-shell .sp { flex:1; }
#ios-shell .anima { display:inline-flex; align-items:center; gap:6px; font-family:var(--mono); font-size:9.5px; letter-spacing:0.08em;
  color:var(--ember-br); border:1px solid var(--line); border-radius:999px; padding:6px 11px; background:var(--glass); cursor:pointer; }
#ios-shell .anima svg { width:11px; height:11px; }
#ios-shell .ava { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; position:relative; cursor:pointer;
  background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); color:var(--btn-ink); font-family:var(--disp); font-weight:700; font-size:13px; text-transform:uppercase; }
#ios-shell .ava .dot { position:absolute; right:-2px; bottom:-2px; width:10px; height:10px; border-radius:50%; border:2px solid var(--abyss); }

/* scroll body */
#ios-shell .bd { position:relative; z-index:1; flex:1; min-height:0; overflow-y:auto; scrollbar-width:none; padding:18px 18px 40px; }
#ios-shell .bd::-webkit-scrollbar { width:0; display:none; }

/* home */
#ios-shell .hero h1 { font-family:var(--disp); font-weight:700; font-size:21px; letter-spacing:0.04em; color:var(--ink); margin:2px 0 4px; text-shadow:0 1px 16px var(--glow); }
#ios-shell .hero h1 em { font-style:normal; color:var(--ember-br); }
#ios-shell .hero p { font-family:var(--serif); font-style:italic; font-size:14.5px; color:var(--ink-dim); margin:0 0 16px; }
#ios-shell .cta { display:flex; gap:9px; margin-bottom:20px; }
#ios-shell .btn { flex:1; display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:13px 10px; border-radius:11px; cursor:pointer;
  font-family:var(--mono); font-size:9.5px; letter-spacing:0.16em; text-transform:uppercase; transition:all .15s ease;
  border:1px solid var(--line); background:var(--glass); color:var(--ink-dim); }
#ios-shell .btn svg { width:13px; height:13px; flex:0 0 auto; }
#ios-shell .btn.primary { border-color:var(--ember-dp); color:var(--btn-ink); background:linear-gradient(180deg,var(--ember-br),var(--ember-dp));
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.18), 0 6px 20px -8px var(--glow); }
#ios-shell .btn:active { transform:scale(0.97); }
#ios-shell .sec-h { display:flex; align-items:baseline; justify-content:space-between; margin:0 0 10px; }
#ios-shell .sec-h h2 { font-family:var(--disp); font-weight:600; font-size:12px; letter-spacing:0.16em; text-transform:uppercase; color:var(--ember); margin:0; }
#ios-shell .sec-h a { font-family:var(--mono); font-size:8.5px; letter-spacing:0.14em; text-transform:uppercase; color:var(--ink-mute); cursor:pointer; }
#ios-shell .banner { border:1px solid var(--line-br); border-radius:13px; padding:16px 17px; background:linear-gradient(120deg,rgba(150,100,40,0.14),var(--glass));
  display:flex; flex-direction:column; gap:7px; box-shadow:0 0 34px -18px var(--glow); margin-bottom:12px; cursor:pointer; }
#ios-shell .type { font-family:var(--mono); font-size:7.5px; letter-spacing:0.18em; text-transform:uppercase; color:var(--ember);
  border:1px solid var(--line); border-radius:5px; padding:3px 6px; align-self:flex-start; }
#ios-shell .banner h3 { font-family:var(--disp); font-weight:700; font-size:17px; letter-spacing:0.03em; color:var(--ink); margin:0; }
#ios-shell .banner .snip { font-family:var(--serif); font-style:italic; font-size:14px; color:var(--ink-dim); margin:0; line-height:1.4; text-wrap:pretty; }
#ios-shell .banner .row { display:flex; align-items:center; gap:10px; margin-top:4px; }
#ios-shell .banner .meta { font-family:var(--mono); font-size:8px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-mute); }
#ios-shell .banner .go { margin-left:auto; flex:0 0 auto; display:inline-flex; align-items:center; gap:7px; padding:9px 14px; border-radius:9px;
  border:1px solid var(--ember-dp); color:var(--btn-ink); background:linear-gradient(180deg,var(--ember-br),var(--ember-dp));
  font-family:var(--mono); font-size:8.5px; letter-spacing:0.14em; text-transform:uppercase; cursor:pointer; }
#ios-shell .daily { border:1px solid var(--line); border-radius:13px; padding:15px 17px; background:var(--glass); display:flex; flex-direction:column; gap:6px; margin-bottom:22px; }
#ios-shell .daily .lbl { display:flex; align-items:center; gap:7px; font-family:var(--mono); font-size:7.5px; letter-spacing:0.18em; text-transform:uppercase; color:var(--ember); }
#ios-shell .daily .lbl svg { width:11px; height:11px; }
#ios-shell .daily h3 { font-family:var(--disp); font-weight:600; font-size:15px; color:var(--ink); margin:0; }
#ios-shell .daily p { font-family:var(--serif); font-style:italic; font-size:13.5px; color:var(--ink-dim); margin:0; line-height:1.35; }
#ios-shell .daily .meta { display:flex; justify-content:space-between; font-family:var(--mono); font-size:8px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-mute); margin-top:4px; }
#ios-shell .daily .meta .st { color:var(--ember-br); }
#ios-shell .tiles { display:flex; gap:11px; overflow-x:auto; scrollbar-width:none; scroll-snap-type:x mandatory; margin:0 -18px 22px; padding:2px 18px 8px; }
#ios-shell .tiles::-webkit-scrollbar { height:0; display:none; }
#ios-shell .tile { flex:0 0 152px; scroll-snap-align:start; border:1px solid var(--line); border-radius:13px; padding:14px 15px 13px; background:var(--glass); cursor:pointer; transition:all .2s ease; }
#ios-shell .tile.hot { border-color:var(--ember-br); box-shadow:0 0 24px -8px var(--glow); transform:translateY(-2px); }
#ios-shell .tile .rn { font-family:var(--disp); font-weight:700; font-size:23px; color:var(--ember-br); text-shadow:0 0 14px var(--glow); line-height:1; }
#ios-shell .tile h3 { font-family:var(--disp); font-weight:600; font-size:11px; letter-spacing:0.08em; text-transform:uppercase; color:var(--ink); margin:9px 0 4px; }
#ios-shell .tile p { font-family:var(--serif); font-style:italic; font-size:12.5px; color:var(--ink-dim); margin:0; line-height:1.3; }
#ios-shell .empty { font-family:var(--serif); font-style:italic; font-size:14px; color:var(--ink-mute); padding:18px 4px; text-align:center; }

/* friends */
#ios-shell .me { display:flex; align-items:center; gap:11px; padding:4px 0 14px; border-bottom:1px solid var(--line); margin-bottom:10px; }
#ios-shell .fav { position:relative; flex:0 0 auto; width:38px; height:38px; border-radius:10px; display:grid; place-items:center;
  border:1px solid var(--line-br); background:var(--glass); font-family:var(--disp); font-size:15px; font-weight:700; color:var(--ember-br); text-transform:uppercase; }
#ios-shell .fav.sm { width:32px; height:32px; font-size:13px; border-radius:9px; }
#ios-shell .fav .dot { position:absolute; right:-3px; bottom:-3px; width:11px; height:11px; border-radius:50%; border:2px solid var(--abyss); background:var(--ink-mute); }
#ios-shell .dot.on { background:#7bbf6a; box-shadow:0 0 8px rgba(123,191,106,0.7); }
#ios-shell .dot.busy { background:var(--ember-br); box-shadow:0 0 8px var(--glow); }
#ios-shell .dot.away { background:#d19a3f; }
#ios-shell .dot.dnd { background:#b4563f; box-shadow:0 0 8px rgba(180,86,63,0.7); }
#ios-shell .me .who { flex:1; min-width:0; }
#ios-shell .me .who b { display:block; font-family:var(--disp); font-size:14px; font-weight:600; color:var(--ink); }
#ios-shell .statrow { display:flex; gap:6px; margin-top:6px; flex-wrap:wrap; }
#ios-shell .statrow button { display:inline-flex; align-items:center; gap:5px; border:1px solid var(--line); border-radius:999px; background:var(--glass);
  padding:5px 9px; font-family:var(--mono); font-size:7px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-mute); cursor:pointer; }
#ios-shell .statrow button i { width:6px; height:6px; border-radius:50%; background:currentColor; }
#ios-shell .statrow button.sel { color:var(--ink); border-color:var(--line-br); background:rgba(150,110,50,0.12); }
#ios-shell .statrow .c-on.sel { color:#7bbf6a; }
#ios-shell .statrow .c-away.sel { color:#d19a3f; }
#ios-shell .statrow .c-dnd.sel { color:#b4563f; }
#ios-shell .glbl { font-family:var(--mono); font-size:8px; letter-spacing:0.18em; text-transform:uppercase; color:var(--ink-mute); margin:14px 0 4px; }
#ios-shell .fr { display:flex; align-items:center; gap:10px; padding:9px 2px; border-bottom:1px solid var(--line); cursor:pointer; }
#ios-shell .fr:active { background:rgba(150,110,50,0.08); }
#ios-shell .fr .nm { flex:1; min-width:0; }
#ios-shell .fr .nm b { display:block; font-family:var(--serif); font-size:15.5px; font-weight:600; color:var(--ink); line-height:1.2; }
#ios-shell .fr .nm span { display:block; font-family:var(--mono); font-size:7.5px; letter-spacing:0.08em; text-transform:uppercase; color:var(--ink-mute); margin-top:2px; }
#ios-shell .fr .nm span.live { color:var(--ember-br); }
#ios-shell .fr.off { opacity:0.45; }
#ios-shell .fr .bub { flex:0 0 auto; width:26px; height:26px; display:grid; place-items:center; border:1px solid var(--line-br); border-radius:8px; color:var(--ember-br); background:none; cursor:pointer; }
#ios-shell .fr .bub svg { width:12px; height:12px; }
#ios-shell .fr .okno { flex:0 0 auto; width:26px; height:26px; display:grid; place-items:center; border:1px solid var(--line-br); border-radius:8px; background:none; cursor:pointer; color:var(--ember-br); margin-left:2px; }
#ios-shell .fr .okno.no { color:#b4563f; border-color:rgba(180,86,63,0.5); }
#ios-shell .fr .okno svg { width:13px; height:13px; }
#ios-shell .fr .unread { flex:0 0 auto; min-width:17px; height:17px; padding:0 5px; display:grid; place-items:center; border-radius:999px;
  font-family:var(--mono); font-size:8.5px; color:var(--btn-ink); background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); }

/* chat view (full-screen slide-over) */
#ios-shell .chatv { position:absolute; inset:0; z-index:6; display:flex; flex-direction:column; background:var(--abyss);
  transform:translateX(103%); transition:transform .3s cubic-bezier(.22,.61,.36,1); }
#ios-shell .chatv.open { transform:none; }
#ios-shell .chatv .chd { flex:0 0 auto; display:flex; align-items:center; gap:10px; padding:calc(env(safe-area-inset-top) + 12px) 14px 11px; border-bottom:1px solid var(--line); background:var(--glass); }
#ios-shell .chatv .back { display:inline-flex; align-items:center; gap:4px; background:none; border:0; color:var(--ember-br);
  font-family:var(--mono); font-size:9px; letter-spacing:0.12em; text-transform:uppercase; cursor:pointer; padding:6px 8px 6px 0; }
#ios-shell .chatv .back svg { width:14px; height:14px; }
#ios-shell .chatv .chd .t { flex:1; min-width:0; }
#ios-shell .chatv .chd .t b { display:block; font-family:var(--disp); font-size:14px; font-weight:600; color:var(--ink); }
#ios-shell .chatv .chd .t span { display:block; font-family:var(--mono); font-size:7.5px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ember-br); margin-top:2px; }
#ios-shell .clog { flex:1; min-height:0; overflow-y:auto; scrollbar-width:none; padding:16px 14px; display:flex; flex-direction:column; gap:9px; }
#ios-shell .clog::-webkit-scrollbar { width:0; display:none; }
#ios-shell .cday { align-self:center; font-family:var(--mono); font-size:7.5px; letter-spacing:0.16em; text-transform:uppercase; color:var(--ink-mute); }
#ios-shell .msg { max-width:82%; padding:9px 12px; border-radius:12px; font-family:var(--serif); font-size:15.5px; line-height:1.4; color:var(--ink); text-wrap:pretty; }
#ios-shell .msg.them { align-self:flex-start; border:1px solid var(--line); background:var(--glass); border-bottom-left-radius:4px; }
#ios-shell .msg.me2 { align-self:flex-end; border:1px solid var(--ember-dp); background:rgba(180,130,60,0.16); border-bottom-right-radius:4px; }
#ios-shell .msg .tm { display:block; font-family:var(--mono); font-size:7px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-mute); margin-top:4px; }
#ios-shell .typing { align-self:flex-start; display:flex; gap:4px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--glass); }
#ios-shell .typing i { width:5px; height:5px; border-radius:50%; background:var(--ink-mute); animation:ios-tdot 1.2s infinite; }
#ios-shell .typing i:nth-child(2) { animation-delay:.15s; }
#ios-shell .typing i:nth-child(3) { animation-delay:.3s; }
@keyframes ios-tdot { 0%,60%,100%{opacity:.3;transform:translateY(0);} 30%{opacity:1;transform:translateY(-3px);} }
#ios-shell .cin { flex:0 0 auto; display:flex; align-items:flex-end; gap:8px; padding:10px 12px calc(env(safe-area-inset-bottom) + 14px); border-top:1px solid var(--line); }
#ios-shell .cin textarea { flex:1; resize:none; height:40px; max-height:90px; padding:10px 12px; border-radius:10px; background:var(--glass); border:1px solid var(--line);
  outline:none; font-family:var(--serif); font-size:16px; color:var(--ink); line-height:1.3; }
#ios-shell .cin textarea::placeholder { color:var(--ink-mute); font-style:italic; }
#ios-shell .cin textarea:focus { border-color:var(--line-br); }
#ios-shell .cin .send { flex:0 0 auto; width:40px; height:40px; display:grid; place-items:center; border-radius:10px; cursor:pointer;
  border:1px solid var(--ember-dp); color:var(--btn-ink); background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); }
#ios-shell .cin .send svg { width:15px; height:15px; }

/* hub */
#ios-shell .spot-m { border:1px solid var(--line-br); border-radius:13px; padding:17px; background:linear-gradient(115deg,rgba(150,100,40,0.16),var(--glass) 65%); margin-bottom:16px; box-shadow:0 0 34px -18px var(--glow); }
#ios-shell .spot-m .kick { display:inline-flex; align-items:center; gap:6px; font-family:var(--mono); font-size:7.5px; letter-spacing:0.2em; text-transform:uppercase; color:var(--ember-br); margin-bottom:7px; }
#ios-shell .spot-m .kick i { width:6px; height:6px; border-radius:50%; background:var(--ember-br); box-shadow:0 0 7px var(--glow); animation:ios-blip 1.8s infinite; }
@keyframes ios-blip { 0%,100%{opacity:1;} 50%{opacity:.35;} }
#ios-shell .spot-m h3 { font-family:var(--disp); font-weight:700; font-size:18px; color:var(--ink); margin:0 0 5px; }
#ios-shell .spot-m p { font-family:var(--serif); font-style:italic; font-size:13.5px; color:var(--ink-dim); margin:0 0 12px; line-height:1.4; }
#ios-shell .chips-m { display:flex; gap:7px; overflow-x:auto; scrollbar-width:none; margin:0 -18px 14px; padding:0 18px; }
#ios-shell .chips-m::-webkit-scrollbar { height:0; display:none; }
#ios-shell .chip { flex:0 0 auto; font-family:var(--mono); font-size:8px; letter-spacing:0.14em; text-transform:uppercase; color:var(--ink-dim);
  border:1px solid var(--line); border-radius:999px; padding:7px 12px; background:var(--glass); cursor:pointer; }
#ios-shell .chip.on { color:var(--btn-ink); background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); border-color:var(--ember-dp); }
#ios-shell .adv-m { display:flex; align-items:center; gap:11px; border:1px solid var(--line); border-radius:12px; padding:12px 13px; background:var(--glass); margin-bottom:9px; cursor:pointer; }
#ios-shell .adv-m .art { flex:0 0 auto; width:44px; height:44px; border-radius:10px; display:grid; place-items:center; border:1px solid var(--line); color:var(--ember-br); }
#ios-shell .adv-m .art svg { width:20px; height:20px; }
#ios-shell .adv-m .t { flex:1; min-width:0; }
#ios-shell .adv-m .t b { display:block; font-family:var(--disp); font-size:13.5px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#ios-shell .adv-m .t span { display:block; font-family:var(--mono); font-size:7.5px; letter-spacing:0.08em; text-transform:uppercase; color:var(--ink-mute); margin-top:3px; }
#ios-shell .adv-m .t span em { font-style:normal; color:var(--ember-br); }

/* settings */
#ios-shell .set-h2 { font-family:var(--disp); font-weight:600; font-size:11px; letter-spacing:0.16em; text-transform:uppercase; color:var(--ember); margin:16px 0 2px; }
#ios-shell .srow { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 2px; border-bottom:1px solid var(--line); }
#ios-shell .srow .t { font-family:var(--serif); font-size:15.5px; color:var(--ink); }
#ios-shell .srow .d { display:block; font-style:italic; font-size:12.5px; color:var(--ink-mute); margin-top:1px; }
#ios-shell .sw { appearance:none; -webkit-appearance:none; width:40px; height:23px; flex:0 0 auto; border-radius:999px; border:1px solid var(--line-br);
  background:var(--glass); position:relative; cursor:pointer; transition:all .18s ease; margin:0; }
#ios-shell .sw::before { content:""; position:absolute; top:3px; left:4px; width:15px; height:15px; border-radius:50%; background:var(--ink-mute); transition:all .18s ease; }
#ios-shell .sw:checked { background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); border-color:var(--ember-dp); }
#ios-shell .sw:checked::before { left:19px; background:var(--btn-ink); }
#ios-shell .themes-m { display:flex; gap:9px; padding:10px 0 4px; flex-wrap:wrap; }
#ios-shell .th { flex:1 1 44%; border:1px solid var(--line); border-radius:11px; padding:11px 12px; cursor:pointer; display:flex; flex-direction:column; gap:8px; background:var(--glass); }
#ios-shell .th.sel { border-color:var(--ember-br); box-shadow:0 0 20px -10px var(--glow); }
#ios-shell .th .nm2 { font-family:var(--disp); font-size:11px; font-weight:600; letter-spacing:0.06em; color:var(--ink); }
#ios-shell .th .dots { display:flex; gap:5px; }
#ios-shell .th .dots i { width:12px; height:12px; border-radius:50%; border:1px solid rgba(128,128,128,0.3); }
#ios-shell .signout { margin:22px 0 6px; width:100%; padding:13px; border-radius:11px; cursor:pointer; border:1px solid rgba(180,86,63,0.5);
  background:rgba(180,86,63,0.1); color:#d98a6a; font-family:var(--mono); font-size:10px; letter-spacing:0.18em; text-transform:uppercase; }

/* toast + tabbar */
#ios-shell .toast { position:absolute; left:50%; bottom:calc(env(safe-area-inset-bottom) + 92px); transform:translateX(-50%); z-index:8;
  padding:10px 18px; border-radius:999px; border:1px solid var(--line-br); background:var(--abyss); color:var(--ink);
  font-family:var(--serif); font-style:italic; font-size:14.5px; box-shadow:0 10px 30px -10px rgba(0,0,0,0.7); white-space:nowrap; animation:ios-toastin .25s ease; }
@keyframes ios-toastin { from{opacity:0;transform:translateX(-50%) translateY(8px);} to{opacity:1;transform:translateX(-50%) translateY(0);} }
#ios-shell .tabbar { position:relative; z-index:3; flex:0 0 auto; display:flex; border-top:1px solid var(--line); background:var(--glass);
  -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px); padding:8px 6px calc(env(safe-area-inset-bottom) + 10px); }
#ios-shell .tab { flex:1; position:relative; display:flex; flex-direction:column; align-items:center; gap:4px; background:none; border:0; cursor:pointer;
  padding:5px 0 6px; color:var(--ink-mute); font-family:var(--mono); font-size:7px; letter-spacing:0.14em; text-transform:uppercase; transition:color .14s ease; }
#ios-shell .tab svg { width:20px; height:20px; }
#ios-shell .tab.act { color:var(--ember-br); filter:drop-shadow(0 0 8px var(--glow)); }
#ios-shell .tab:active { transform:scale(0.94); }
#ios-shell .tab .tbadge { position:absolute; top:2px; right:calc(50% - 18px); min-width:14px; height:14px; padding:0 4px; border-radius:999px;
  display:grid; place-items:center; font-size:7.5px; color:var(--btn-ink); background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); }

/* ============================================================================
   Settings v5.1 — grouped iOS list + bottom sheets + per-engine detail screens.
   Ported from the Sofaverse 5.1 reference, scoped under #ios-shell.
   ============================================================================ */
#ios-shell .gl { border:1px solid var(--line); border-radius:13px; background:var(--glass); overflow:hidden; margin:8px 0 4px; }
#ios-shell .glr { display:flex; align-items:center; gap:10px; padding:13px 14px; border-bottom:1px solid var(--line); cursor:pointer; min-height:44px; }
#ios-shell .gl .glr:last-child { border-bottom:0; }
#ios-shell .glr:active { background:rgba(150,110,50,0.08); }
#ios-shell .glr .lt { flex:1; min-width:0; font-family:var(--serif); font-size:15.5px; color:var(--ink); }
#ios-shell .glr .lt .d { display:block; font-style:italic; font-size:12px; color:var(--ink-mute); margin-top:1px; }
#ios-shell .glr .val { font-family:var(--mono); font-size:8.5px; letter-spacing:0.08em; text-transform:uppercase; color:var(--ink-mute); text-align:right; }
#ios-shell .glr .chev { width:14px; height:14px; color:var(--ink-mute); flex:0 0 auto; }
#ios-shell .glr.danger { justify-content:center; }
#ios-shell .glr.danger .lt { flex:0 0 auto; color:#c05a3e; font-family:var(--mono); font-size:10px; letter-spacing:0.18em; text-transform:uppercase; }
#ios-shell .glnote { font-family:var(--serif); font-style:italic; font-size:12.5px; color:var(--ink-mute); margin:6px 4px 0; line-height:1.4; text-wrap:pretty; }

#ios-shell .sheetwrap { position:absolute; inset:0; z-index:7; }
#ios-shell .sheetwrap .dim { position:absolute; inset:0; background:rgba(0,0,0,0.45); }
#ios-shell .sheet { position:absolute; left:0; right:0; bottom:0; border-radius:18px 18px 0 0; border:1px solid var(--line-br); border-bottom:0; background:var(--abyss); padding:12px 16px calc(env(safe-area-inset-bottom) + 24px); max-height:80%; overflow-y:auto; animation:ios-sheetup .28s cubic-bezier(.22,.61,.36,1); }
@keyframes ios-sheetup { from { transform:translateY(40%); opacity:0; } to { transform:none; opacity:1; } }
#ios-shell .sheet .grab { width:36px; height:4px; border-radius:2px; background:var(--ink-mute); opacity:.5; margin:0 auto 12px; }
#ios-shell .sheet h4 { font-family:var(--disp); font-size:13px; letter-spacing:0.14em; text-transform:uppercase; color:var(--ember-br); margin:0 0 8px; text-align:center; }
#ios-shell .sheet .opt { display:flex; align-items:center; gap:11px; padding:13px 8px; border-bottom:1px solid var(--line); cursor:pointer; font-family:var(--serif); font-size:16.5px; color:var(--ink); min-height:46px; }
#ios-shell .sheet .opt:last-of-type { border-bottom:0; }
#ios-shell .sheet .opt:active { background:rgba(150,110,50,0.08); }
#ios-shell .opt .dots2 { display:flex; gap:5px; flex:0 0 auto; }
#ios-shell .opt .dots2 i { width:13px; height:13px; border-radius:50%; border:1px solid rgba(128,128,128,0.3); }
#ios-shell .opt .osub { display:block; font-family:var(--mono); font-size:7.5px; letter-spacing:0.08em; text-transform:uppercase; color:var(--ink-mute); margin-top:2px; font-style:normal; }
#ios-shell .opt .ck { color:var(--ember-br); font-size:16px; flex:0 0 auto; }
#ios-shell .opt .oflex { flex:1; }

/* Engine context-window slider (mobile) */
#ios-shell .iosl-row{flex-direction:column;align-items:stretch;gap:11px;cursor:default}
#ios-shell .iosl-top{display:flex;align-items:baseline;justify-content:space-between}
#ios-shell .iosl-val{font-family:var(--mono);font-size:9px;letter-spacing:0.06em;color:var(--ember-br)}
#ios-shell .iosl{width:100%;-webkit-appearance:none;appearance:none;height:4px;border-radius:999px;background:rgba(227,169,85,0.2);outline:none;margin:2px 0}
#ios-shell .iosl::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:22px;border-radius:50%;background:linear-gradient(180deg,var(--ember-br),var(--ember-dp));border:1px solid var(--ember-dp);box-shadow:0 0 12px -3px var(--glow)}
#ios-shell .iosl::-moz-range-thumb{width:22px;height:22px;border-radius:50%;background:var(--ember-br);border:1px solid var(--ember-dp)}
#ios-shell .iosl-ends{display:flex;justify-content:space-between;font-family:var(--mono);font-size:8px;letter-spacing:0.06em;color:var(--ink-mute)}

/* ============================================================================
   Nav drawer (opened from the header d20) + 5-slot tab bar with raised center
   action + desktop-bridge return pill.
   ============================================================================ */
/* header brand = drawer trigger */
#ios-shell .hd .brand { display:inline-flex; align-items:center; gap:10px; background:none; border:0; padding:0; margin:0;
  color:inherit; text-align:left; cursor:pointer; -webkit-tap-highlight-color:transparent; }
#ios-shell .hd .brand:active .d20 { transform:scale(0.92); }
#ios-shell .hd .brand .d20 { transition:transform .12s ease; }

/* raised center "New" tab */
#ios-shell .tab.newtab { overflow:visible; color:var(--ink-mute); gap:2px; }
#ios-shell .tab.newtab .nb { width:46px; height:46px; margin-top:-26px; border-radius:50%;
  display:grid; place-items:center; color:var(--btn-ink);
  background:linear-gradient(180deg,var(--ember-br),var(--ember-dp));
  border:1px solid var(--ember-dp);
  box-shadow:0 6px 22px -6px var(--glow), inset 0 1px 0 rgba(255,255,255,0.22); }
#ios-shell .tab.newtab .nb svg { width:20px; height:20px; }
#ios-shell .tab.newtab:active .nb { transform:scale(0.94); }

/* drawer */
#ios-shell .drawerwrap { position:absolute; inset:0; z-index:9; pointer-events:none; }
#ios-shell .drawerwrap .ddim { position:absolute; inset:0; background:rgba(0,0,0,0.5); opacity:0; transition:opacity .28s ease; }
#ios-shell .drawerwrap.open { pointer-events:auto; }
#ios-shell .drawerwrap.open .ddim { opacity:1; }
#ios-shell .drawer { position:absolute; left:0; top:0; bottom:0; width:min(82%,calc(320px + env(safe-area-inset-left,0px)));
  display:flex; flex-direction:column;
  background:var(--abyss); border-right:1px solid var(--line-br); box-shadow:24px 0 60px -30px rgba(0,0,0,0.8);
  padding:calc(env(safe-area-inset-top) + 16px) 14px calc(env(safe-area-inset-bottom) + 14px) calc(env(safe-area-inset-left,0px) + 14px);
  overflow-y:auto; scrollbar-width:none;
  transform:translateX(-103%); transition:transform .3s cubic-bezier(.22,.61,.36,1); }
#ios-shell .drawer::-webkit-scrollbar { width:0; display:none; }
#ios-shell .drawerwrap.open .drawer { transform:none; }
#ios-shell .drawer .dhd { display:flex; align-items:baseline; gap:8px; padding:2px 6px 12px; border-bottom:1px solid var(--line); margin-bottom:6px; }
#ios-shell .drawer .dhd .nm { font-family:var(--disp); font-weight:700; font-size:14px; letter-spacing:0.14em; color:var(--ember-br); }
#ios-shell .drawer .dhd .sb { font-family:var(--mono); font-size:7px; letter-spacing:0.2em; text-transform:uppercase; color:var(--ink-mute); }
#ios-shell .drawer .dclose { margin-left:auto; align-self:center; width:26px; height:26px; display:grid; place-items:center;
  background:none; border:1px solid var(--line); border-radius:8px; color:var(--ink-mute); cursor:pointer; }
#ios-shell .drawer .dclose svg { width:12px; height:12px; }
#ios-shell .dsec { font-family:var(--mono); font-size:7.5px; letter-spacing:0.2em; text-transform:uppercase; color:var(--ink-mute); margin:14px 6px 5px; }
#ios-shell .drow { display:flex; align-items:center; gap:11px; width:100%; text-align:left; padding:11px 10px; border:0; border-radius:10px;
  background:none; color:var(--ink-dim); cursor:pointer; -webkit-tap-highlight-color:transparent; position:relative; }
#ios-shell .drow svg { width:16px; height:16px; flex:0 0 auto; color:var(--ink-mute); }
#ios-shell .drow .dl { flex:1; min-width:0; font-family:var(--serif); font-size:15.5px; color:var(--ink); }
#ios-shell .drow .ds { display:flex; align-items:center; gap:5px; font-family:var(--mono); font-size:7.5px; letter-spacing:0.08em;
  text-transform:uppercase; color:var(--ink-mute); margin-top:2px; }
#ios-shell .drow .ds svg { width:9px; height:9px; }
#ios-shell .drow:active { background:rgba(150,110,50,0.1); }
#ios-shell .drow.act { background:rgba(150,110,50,0.12); }
#ios-shell .drow.act::before { content:""; position:absolute; left:0; top:9px; bottom:9px; width:3px; border-radius:2px;
  background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); box-shadow:0 0 8px var(--glow); }
#ios-shell .drow.act svg, #ios-shell .drow.act .dl { color:var(--ember-br); }
#ios-shell .drow .dbadge { flex:0 0 auto; min-width:17px; height:17px; padding:0 5px; display:grid; place-items:center; border-radius:999px;
  font-family:var(--mono); font-size:8.5px; color:var(--btn-ink); background:linear-gradient(180deg,var(--ember-br),var(--ember-dp)); }
/* (account footer removed — the drawer is Adventure / System / Admin only,
   scrolling as one list; profile lives on the header avatar, sign-out in
   Settings ▸ Account) */

/* floating "back to app" pill — shown while a desktop screen (Library) is
   bridged in with the shell hidden. Body-level, so NOT scoped under the shell. */
#ios-return { position:fixed; left:50%; transform:translateX(-50%); bottom:calc(env(safe-area-inset-bottom) + 16px); z-index:5000;
  display:inline-flex; align-items:center; gap:8px; padding:11px 18px; border-radius:999px; cursor:pointer;
  border:1px solid #8a5f28; color:#1e1206; background:linear-gradient(180deg,#e3a955,#8a5f28);
  font-family:'JetBrains Mono',monospace; font-size:9.5px; letter-spacing:0.14em; text-transform:uppercase;
  box-shadow:0 12px 34px -10px rgba(227,169,85,0.5); }
#ios-return svg { width:13px; height:13px; }

/* account menu sheet (top-right avatar — mirrors the web avatar menu) */
#ios-shell .sheet .me { border-bottom:1px solid var(--line); padding:2px 0 12px; margin-bottom:4px; }
#ios-shell .sheet .atier { display:block; font-family:var(--mono); font-size:8px; letter-spacing:0.12em; text-transform:uppercase; color:var(--ink-mute); margin-top:3px; }
#ios-shell .sheet .opt > svg { width:15px; height:15px; color:var(--ink-mute); flex:0 0 auto; }
#ios-shell .sheet .opt .chev { width:14px; height:14px; color:var(--ink-mute); flex:0 0 auto; }
#ios-shell .sheet .opt.adanger, #ios-shell .sheet .opt.adanger > svg { color:#c05a3e; }
