/* =========================================================
   ROGUE//Z pour iPhone — couche de style iOS (chargée après app.css)
   Police système (SF Pro), grands titres, listes groupées façon Réglages,
   barre d'onglets en verre, feuilles avec poignée, interrupteurs et
   contrôles segmentés iOS. Identité ROGUE//Z : dégradé #ff6b2c → #ff6b2c.
   ========================================================= */

:root {
  --bg: #000000; --bg2: #1c1c1e; --bg3: #2c2c2e;
  --card: #1c1c1e; --card2: #2c2c2e; --card-solid: #1c1c1e;
  --fill: rgba(118,118,128,.24); --fill2: rgba(118,118,128,.18); --press: rgba(255,255,255,.08);
  --line: rgba(84,84,88,.55); --line2: rgba(84,84,88,.85);
  --text: #ffffff; --soft: rgba(235,235,245,.82); --muted: rgba(235,235,245,.6); --dim: rgba(235,235,245,.32);
  --red: #ff3d7f; --orange: #ff6b2c; --amber: #ffc93d; --cyan: #3dd9ff; --green: #3dd9ff; --violet: #9d7bff; --blue: #3dd9ff;
  --tint: #ff6b2c;
  --glass: rgba(28,28,30,.72);
  --shadow: none;
  --r: 14px; --r2: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  --top-h: 48px; --tab-h: 62px;
  --spring: cubic-bezier(.32,.72,0,1);
}
[data-theme="light"] {
  --bg: #f2f2f7; --bg2: #ffffff; --bg3: #e5e5ea;
  --card: #ffffff; --card2: #f2f2f7; --card-solid: #ffffff;
  --fill: rgba(118,118,128,.12); --fill2: rgba(118,118,128,.08); --press: rgba(0,0,0,.06);
  --line: rgba(60,60,67,.22); --line2: rgba(60,60,67,.36);
  --text: #000000; --soft: rgba(60,60,67,.85); --muted: rgba(60,60,67,.6); --dim: rgba(60,60,67,.3);
  --red: #ff3b30; --orange: #e5601a; --amber: #c99a00; --cyan: #0a84c6; --green: #28a745; --violet: #a24fd6; --blue: #007aff;
  --tint: #e5601a;
  --glass: rgba(249,249,251,.78);
  --shadow: none;
}

html, body { max-width: 100%; overflow-x: hidden; font: 17px/1.35 var(--font); letter-spacing: -.2px; }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, [contenteditable] { -webkit-user-select: text; user-select: text; }
body::before { background: radial-gradient(520px 320px at 100% -8%, rgba(255,107,44,.18), transparent 62%), var(--bg); }
[data-theme="light"] body::before { background: radial-gradient(520px 320px at 100% -8%, rgba(255,107,44,.12), transparent 62%), var(--bg); }
:focus-visible { outline-color: var(--tint); }
.haptic-proxy { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* ---------- Typographie : grands titres iOS ---------- */
.scr-head { padding-top: 2px; }
.scr-title { font: 700 34px/1.12 var(--font); letter-spacing: .3px; text-transform: none; transform-origin: 0 50%; transform: scale(var(--lt-scale, 1)); }
.hero-title { font-size: 30px; }
.sec-title { font: 700 21px/1.2 var(--font); letter-spacing: .2px; text-transform: none; color: var(--text); margin-top: 10px; }
.group-head { margin: 10px 16px -8px; font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: uppercase; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .4px; }
.empty h3, .confirm h2, .sheet-head h2 { font-family: var(--font); font-weight: 700; text-transform: none; letter-spacing: .2px; }
.sheet-head h2, .confirm h2 { font-size: 22px; line-height: 1.2; }
.empty h3 { font-size: 19px; }
.tile b { font: 700 18px/1.15 var(--font); text-transform: none; letter-spacing: 0; }
.foot-note { padding: 4px 16px 8px; }

/* ---------- Barre de navigation ---------- */
.topbar { height: calc(var(--top-h) + var(--st)); padding: var(--st) calc(8px + var(--sr)) 0 calc(8px + var(--sl)); gap: 6px; background: transparent; box-shadow: none; }
.topbar.scrolled, .topbar.hairline { background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 .5px 0 var(--line); }
.tb-logo { width: 30px; height: 30px; margin-left: 6px; }
.tb-title { position: absolute; left: 50%; bottom: 0; height: var(--top-h); display: flex; align-items: center; justify-content: center; max-width: calc(100% - 210px); transform: translate(-50%, 4px); font: 600 17px/1 var(--font); letter-spacing: -.2px; text-transform: none; pointer-events: none; }
.topbar.scrolled .tb-title { transform: translate(-50%, 0); }
.tb-title:empty { display: none; }
.tb-server { margin-left: auto; min-height: 34px; max-width: 42vw; padding: 0 10px 0 11px; background: var(--fill); border: 0; font-size: 14px; font-weight: 600; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); border: 0; }
.icon-btn .ic { width: 20px; height: 20px; }
.tb-profile { color: var(--tint); }
.tb-back { width: auto; min-width: 44px; height: 44px; padding: 0 8px 0 0; border-radius: 12px; display: inline-flex; gap: 0; background: transparent; color: var(--tint); font-size: 17px; }
.tb-back .ic { width: 26px; height: 26px; stroke-width: 2.4; }
.tb-back-label { font-weight: 400; }
.tb-back:active { opacity: .5; transform: none; }
@media (max-width: 359px) { .tb-back-label { display: none; } .tb-server { max-width: 38vw; } }

/* Bandeau réseau (hors ligne / données du …) */
.offline-bar { top: calc(var(--top-h) + var(--st) + 4px); max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; padding: 7px 14px; font-size: 13px; font-weight: 600; background: var(--glass); color: var(--text); border: .5px solid var(--line2); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 6px 24px -10px rgba(0,0,0,.6); }
.offline-bar::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--amber); vertical-align: 1px; }
body.offline .offline-bar::before { background: var(--red); }
body.stale .offline-bar { transform: translate(-50%, 6px); opacity: 1; visibility: visible; }

/* ---------- Vue ---------- */
.view { padding-top: calc(var(--top-h) + var(--st)); padding-bottom: calc(var(--tab-h) + var(--sb) + 30px); overscroll-behavior-y: auto; }
.pad { padding: 4px calc(16px + var(--sr)) 0 calc(16px + var(--sl)); }
.view .pad { padding-left: 16px; padding-right: 16px; }
.stack { gap: 16px; }

/* ---------- Cartes et listes groupées (style Réglages) ---------- */
.card { border: 0; box-shadow: none; border-radius: var(--r); background: var(--card); }
.card.list { padding: 0; }
.list .row { padding: 10px 16px; min-height: 52px; }
.list .row + .row { border-top: 0; position: relative; }
.list .row + .row::after { content: ""; position: absolute; top: 0; right: 0; left: 60px; height: 1px; background: var(--line); transform: scaleY(.5); transform-origin: 0 0; pointer-events: none; }
.list .row-stack + .row::after, .list .row + .row-stack::after { left: 16px; }
.row-txt b { font-weight: 400; font-size: 17px; }
.row-txt small { font-size: 13px; }
.row-ic { width: 30px; height: 30px; border-radius: 8px; color: #fff; background: var(--a); }
.row-ic .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.tone-muted.row-ic, .row-ic.tone-muted { background: #8e8e93; }
.row-go { color: var(--dim); width: 16px; height: 16px; stroke-width: 2.6; }
button.row, a.row { transition: background .2s; }
button.row:active, a.row:active, .choice:active { background: var(--press); transition: none; }
button.card:active, .tile:active, .fab-item:active { transform: scale(.98); }
.row-stack { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 12px !important; padding-bottom: 12px !important; }
.hint { border: 0; background: var(--card); border-radius: 12px; font-size: 13px; }
.dash-link { border: 0; background: var(--card); color: var(--tint); font-size: 16px; font-weight: 400; border-radius: 12px; }
.empty { border: 0; background: var(--card); }
.hero, .tile, .profile-hero, .faction-hero { border: 0 !important; box-shadow: none !important; }
.chip { background: var(--fill); border: 0; color: var(--text); font-weight: 600; }
.chip.on { background: var(--text); color: var(--bg); }
.chip.on small { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.badge { font-weight: 600; letter-spacing: 0; }

/* ---------- Boutons ---------- */
.btn { min-height: 50px; border-radius: 14px; font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: 999px; }
.btn-primary { box-shadow: 0 8px 22px -12px rgba(255,107,44,.8); }
.btn-ghost { background: var(--fill); border: 0; color: var(--text); }
.btn-tinted { background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); }
.btn:active { transform: scale(.97); filter: brightness(.92); }
.link-btn { color: var(--tint); font-weight: 400; font-size: 15px; }

/* ---------- Contrôle segmenté iOS ---------- */
.seg { padding: 2px; border-radius: 9px; background: var(--fill); border: 0; }
.seg-btn { min-height: 32px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text); transition: background .25s var(--spring), box-shadow .25s; }
.seg-btn.on { background: #636366; color: #fff; font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }
[data-theme="light"] .seg-btn.on { background: #fff; color: #000; }
.seg-btn:active:not(.on) { opacity: .6; }

/* ---------- Interrupteurs iOS ---------- */
.switch { width: 55px; }
.switch-ui { width: 51px; height: 31px; border-radius: 31px; background: rgba(120,120,128,.32); }
.switch-ui::after { top: 2px; left: 2px; width: 27px; height: 27px; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06); }
.switch input:checked + .switch-ui { background: var(--green); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:active + .switch-ui::after { width: 33px; }
.switch input:checked:active + .switch-ui::after { transform: translateX(14px); }

/* ---------- Champs ---------- */
.field input, .field select, .field textarea, .search { border: 0; background: var(--fill); border-radius: 10px; }
.field input:focus, .field select:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 35%, transparent); }
.field > span, .field legend { font-weight: 400; color: var(--muted); font-size: 13px; text-transform: uppercase; }

/* ---------- Barre d'onglets en verre (flottante) ---------- */
.tabbar { left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); bottom: calc(max(var(--sb), 10px) + 2px); height: var(--tab-h); border-radius: 31px; background: var(--glass); border: .5px solid var(--line2);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); box-shadow: 0 10px 36px -12px rgba(0,0,0,.55); max-width: 520px; padding: 0 4px; }
.tab { min-height: 54px; padding-top: 7px; gap: 2px; margin: 0 2px; border-radius: 24px; font-size: 10px; font-weight: 600; letter-spacing: .1px; color: var(--muted); transition: color .2s, background .3s var(--spring); }
.tab .ic { width: 25px; height: 25px; }
.tab.on { color: var(--tint); background: var(--fill2); }
.tab.on .ic { transform: none; stroke: currentColor; stroke-width: 2.3; }
.tab:active .ic { transform: scale(.88); }
.tab-pill { display: none; }
.fab { width: 46px; height: 46px; margin-top: 0; border: 0; border-radius: 50%; box-shadow: 0 8px 20px -8px rgba(255,107,44,.9), inset 0 1px 0 rgba(255,255,255,.3); }
.fab .ic { width: 24px; height: 24px; stroke-width: 2.6; }

/* ---------- Feuilles (sheets) ---------- */
.sheet-backdrop { background: rgba(0,0,0,.4); backdrop-filter: none; -webkit-backdrop-filter: none; }
.sheet { left: calc(6px + var(--sl)); right: calc(6px + var(--sr)); bottom: 0; border-radius: 22px 22px 0 0; border: 0; background: var(--bg2); box-shadow: 0 -10px 40px -16px rgba(0,0,0,.6); transition: transform .5s var(--spring); max-height: calc(100% - var(--st) - 24px); }
[data-theme="light"] .sheet { background: #f2f2f7; }
.sheet-grab { height: 22px; }
.sheet-grab span { width: 36px; height: 5px; border-radius: 3px; background: rgba(127,127,127,.45); }
.sheet-x { top: 14px; right: 14px; width: 30px; height: 30px; color: var(--muted); }
.sheet-x .ic { width: 16px; height: 16px; stroke-width: 2.8; }
.sheet-body { padding: 2px 16px 22px; }
.choice { border: 0; background: var(--card); border-radius: 12px; }
[data-theme="light"] .choice, [data-theme="light"] .sheet .card, [data-theme="light"] .fab-item { background: #fff; }
.choice.on { box-shadow: inset 0 0 0 2px var(--tint); background: var(--card); }
.fab-item { border: 0; background: var(--card2); border-radius: 16px; }
.sheet .card { background: var(--card2); }
.confirm-ic { border-radius: 50%; }

/* ---------- Toast (HUD iOS) ---------- */
.toast { border: .5px solid var(--line2); background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 999px; font-size: 15px; font-weight: 600; bottom: calc(var(--tab-h) + max(var(--sb), 10px) + 20px); }
.ptr { background: var(--glass); border: .5px solid var(--line2); }

/* ---------- Connexion ---------- */
.login { align-items: end; overscroll-behavior: contain; }
.login-card { border-radius: 28px; border: .5px solid var(--line2); background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); gap: 12px; }
.login-text { font-size: 15px; }
.login-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: scaleY(.5); }
.code-form { display: grid; gap: 10px; animation: rise .35s var(--spring) both; }
.code-label { font-size: 13px; color: var(--muted); text-align: center; }
.code-field { display: flex; gap: 8px; min-width: 0; }
.code-field input { flex: 1; min-width: 0; min-height: 50px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--fill); color: var(--text); font-size: 16px; outline: none; }
.code-field input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 40%, transparent); }
.code-field .btn { flex: none; padding: 0 16px; }
.login-hint { font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- Écran « ouvre sur ton iPhone » ---------- */
.gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow-y: auto; padding: calc(var(--st) + 24px) 16px calc(var(--sb) + 24px); background: radial-gradient(600px 400px at 100% 0, rgba(255,107,44,.2), transparent 60%), var(--bg); }
.gate-card { width: 100%; max-width: 420px; display: grid; gap: 14px; justify-items: center; text-align: center; padding: 28px 22px; border-radius: 28px; background: var(--card); }
.gate-logo { width: 96px; height: 96px; }
.gate-title { font: 400 36px/1.02 var(--display); text-transform: uppercase; letter-spacing: .4px; }
.gate-card p { color: var(--soft); font-size: 15px; }
.gate-desktop, .gate-android { display: grid; gap: 12px; width: 100%; }
.gate-url { font: 600 17px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text) !important; padding: 12px; border-radius: 12px; background: var(--fill); overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }

/* ---------- Bandeau d'installation (Safari) ---------- */
.install-hint { position: fixed; z-index: 50; left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); bottom: calc(var(--tab-h) + max(var(--sb), 10px) + 14px); max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 10px; border-radius: 20px;
  background: var(--glass); border: .5px solid var(--line2); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); box-shadow: 0 10px 30px -12px rgba(0,0,0,.6); transform: translateY(20px); opacity: 0; transition: transform .45s var(--spring), opacity .3s; }
.install-hint.show { transform: none; opacity: 1; }
.install-hint img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.install-hint-txt { flex: 1; min-width: 0; display: grid; }
.install-hint-txt b { font-size: 15px; font-weight: 600; }
.install-hint-txt small { color: var(--muted); font-size: 12.5px; }
.install-hint-x { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); flex: none; }
.install-hint-x .ic { width: 16px; height: 16px; }
body.has-sheet .install-hint, #login:not([hidden]) ~ .install-hint { bottom: calc(max(var(--sb), 10px) + 10px); }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-radius: 14px; overflow: hidden; background: var(--card2); }
[data-theme="light"] .install-steps { background: #fff; }
.install-steps li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; font-size: 15px; position: relative; }
.install-steps li + li::before { content: ""; position: absolute; top: 0; left: 56px; right: 0; height: 1px; background: var(--line); transform: scaleY(.5); }
.step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--grad); color: #fff; font-size: 13px; font-weight: 700; }
.step-ic { color: var(--blue); display: grid; }
.step-ic .ic { width: 24px; height: 24px; }

/* ---------- Bloc-notes ---------- */
.notes-card { padding: 0; }
.notes-text { display: block; width: 100%; min-height: 46vh; padding: 14px 16px; border: 0; border-radius: var(--r); background: transparent; color: var(--text); font: 17px/1.45 var(--font); resize: vertical; outline: none; }
.notes-state span { flex: 1; }

/* ---------- Paysage, petits écrans, iPad ---------- */
@media (max-width: 359px) {
  .scr-title { font-size: 30px; }
  .tab span { font-size: 9.5px; }
  .tabbar { left: calc(8px + var(--sl)); right: calc(8px + var(--sr)); }
  .code-field { flex-wrap: wrap; }
  .code-field .btn { flex: 1 1 100%; }
}
@media (orientation: landscape) and (max-height: 500px) {
  :root { --top-h: 44px; --tab-h: 52px; }
  .tab { min-height: 46px; padding-top: 4px; }
  .tab span { display: none; }
  .login { align-items: center; }
  .login-logo { display: none; }
  .login-bg { inset: 0; }
}
@media (min-width: 720px) {
  .scr-title { font-size: 38px; }
  .view .pad { padding-left: 24px; padding-right: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .scr-title { transform: none; }
}

/* Barre « Enregistrer » au-dessus des onglets */
.savebar { bottom: calc(var(--tab-h) + max(var(--sb), 10px) + 14px); border-radius: 22px; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
