/* ===== Polices auto-hébergées (aucun appel à un service tiers) ===== */
@import url('/fonts/cormorant-garamond/600.css');
@import url('/fonts/cormorant-garamond/500-italic.css');
@import url('/fonts/inter/400.css');
@import url('/fonts/inter/500.css');
@import url('/fonts/inter/600.css');
@import url('/fonts/jetbrains-mono/400.css');
@import url('/fonts/jetbrains-mono/500.css');

:root {
  --bg: #0a0f14; --panel: #0d151c; --panel2: #111a22; --sea: #0b1620;
  --line: rgba(212,169,90,.2); --line-strong: rgba(212,169,90,.4); --hair: rgba(141,154,165,.14);
  --text: #e8e4da; --head: #f2ede2; --muted: #8d9aa5; --soft: #a9b3bb; --body: #c3cbd1;
  --brass: #d4a95a; --brass-hi: #e8c27e; --teal: #4fd1c5; --red: #f2777a; --violet: #b69cff; --blue: #6ea8fe;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { min-height: 100dvh; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brass); }
a:hover { color: var(--brass-hi); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Structure ===== */
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
#view { flex: 1; padding: calc(18px + var(--safe-t)) 18px calc(var(--nav-h) + var(--safe-b) + 18px); display: flex; flex-direction: column; gap: 16px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin: 0; }
h1, .title { font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1; color: var(--head); margin: 4px 0 0; }
h1 em, .title em { font-style: italic; font-weight: 500; color: var(--brass); }
h2.section { font-family: var(--mono); font-weight: 500; font-size: 10px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin: 6px 0 0; }
p.lead { margin: 0; font-size: 14px; line-height: 1.55; color: var(--soft); }
.muted { color: var(--muted); }

/* ===== Boutons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 18px; border-radius: 6px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brass); color: var(--head); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--bg); font-weight: 600; font-size: 15px; box-shadow: 0 0 22px rgba(212,169,90,.25); }
.btn.primary:hover { background: var(--brass-hi); color: var(--bg); }
.btn.danger { border-color: rgba(242,119,122,.6); color: var(--red); }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; justify-content: space-between; font-size: 16px; }
.btn.small { min-height: 40px; padding: 0 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .5px; }
.btn .sub { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; font-weight: 500; opacity: .85; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--soft); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ===== Formulaires ===== */
.field { display: flex; flex-direction: column; gap: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.field input, .field select, .field textarea { font-family: var(--sans); font-size: 16px; letter-spacing: 0; text-transform: none; padding: 13px 14px; border: 1px solid rgba(212,169,90,.28); border-radius: 6px; background: var(--panel2); color: var(--head); }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brass); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--body); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--brass); flex: none; }
.code-inputs { display: flex; gap: 10px; justify-content: center; }
.code-inputs input { width: 58px; height: 66px; text-align: center; font-family: var(--mono); font-size: 28px; padding: 0; border: 1px solid rgba(212,169,90,.35); border-radius: 6px; background: var(--panel2); color: var(--head); }
.devcode { border: 1px dashed var(--brass); border-radius: 6px; padding: 10px; text-align: center; font-size: 13px; color: var(--soft); }
.devcode strong { font-family: var(--mono); font-size: 22px; letter-spacing: 6px; color: var(--brass); }

/* ===== Panneaux ===== */
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.panel.pad { padding: 16px; }
.panel.shame { border-color: rgba(242,119,122,.45); background: #140d10; }
.res { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.res > div { padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.res > div + div { border-left: 1px solid rgba(212,169,90,.14); }
.res .k { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: var(--muted); }
.res .v { font-family: var(--mono); font-size: 16px; font-weight: 500; color: var(--head); }
.res .r { font-family: var(--mono); font-size: 10px; color: var(--teal); }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--hair); }
.row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row .name { font-weight: 600; font-size: 15px; color: var(--head); }
.row .desc { font-size: 12.5px; color: var(--soft); line-height: 1.4; }
.tag { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--brass); }
.bar { height: 2px; background: rgba(141,154,165,.18); }
.bar > i { display: block; height: 2px; background: var(--brass); }
.btn-cost { min-height: 46px; min-width: 100px; padding: 4px 10px; border: 1px solid rgba(212,169,90,.4); border-radius: 6px; background: transparent; color: var(--brass); font-family: var(--mono); font-size: 11px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.btn-cost small { color: var(--muted); font-size: 9px; letter-spacing: .5px; }
.btn-cost:disabled { opacity: .45; cursor: not-allowed; }
.btn-cost.on { background: rgba(212,169,90,.12); color: var(--head); }

/* ===== Onglets / puces ===== */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--hair); scrollbar-width: none; }
.tabs button { flex: none; min-height: 44px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--head); font-weight: 600; border-bottom-color: var(--brass); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 34px; padding: 0 10px; border-radius: 4px; border: 1px solid rgba(141,154,165,.3); background: transparent; color: var(--soft); font-family: var(--mono); font-size: 10px; letter-spacing: 1px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { border-color: var(--brass); color: var(--head); background: rgba(212,169,90,.08); }
.rar { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; }
.rar.commun { color: var(--soft); } .rar.rare { color: var(--blue); } .rar.epique { color: var(--violet); } .rar.legendaire { color: var(--brass); } .rar.absurde { color: var(--red); }

/* ===== Navigation ===== */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(10,15,20,.96); backdrop-filter: blur(8px); border-top: 1px solid rgba(212,169,90,.16); padding-bottom: var(--safe-b); }
.nav-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: var(--nav-h); text-decoration: none; font-family: var(--mono); font-size: 9px; letter-spacing: 1.2px; color: var(--muted); border-top: 2px solid transparent; }
.nav a[aria-current="page"] { color: var(--brass); border-top-color: var(--brass); }
.nav svg { width: 20px; height: 20px; }

/* ===== Modales & toasts ===== */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(4,8,12,.8); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); padding: 22px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
@media (min-height: 700px) { .modal-bg { align-items: center; } }
.toasts { position: fixed; bottom: calc(var(--nav-h) + 14px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 6px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(13,21,28,.97); font-size: 13px; color: var(--head); box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: tin .2s ease-out; }
.toast.err { border-color: rgba(242,119,122,.6); }
.toast.ok { border-color: rgba(79,209,197,.5); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* ===== Écran d'accueil (connexion) ===== */
.auth { min-height: 100dvh; padding: calc(48px + var(--safe-t)) 24px calc(28px + var(--safe-b)); display: flex; flex-direction: column; gap: 22px; position: relative; overflow: hidden; }
.auth .brand h1 { font-size: 54px; line-height: .95; }
.auth .grow { flex: 1; min-height: 24px; }
.auth form { display: flex; flex-direction: column; gap: 14px; position: relative; }
.auth .foot { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); border-top: 1px solid var(--hair); padding-top: 14px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 3px; background: var(--teal); margin-right: 8px; vertical-align: middle; }
.auth-bg { position: absolute; inset: 0; pointer-events: none; }

/* ===== Succès ===== */
.track { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.track::before { content: ''; position: absolute; left: 8%; right: 8%; top: 4px; height: 1px; background: rgba(141,154,165,.25); }
.track .fill { position: absolute; left: 8%; top: 4px; height: 1px; background: var(--brass); }
.track span { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.track span::before { content: ''; width: 9px; height: 9px; border-radius: 5px; border: 1px solid #5b6873; background: var(--bg); box-shadow: 0 0 0 3px var(--bg); }
.track span.on { color: var(--brass); }
.track span.on::before { background: var(--brass); border-color: var(--brass); }

/* ===== Notice ===== */
.chapter { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--hair); }
.chapter .n { font-family: var(--mono); font-size: 12px; color: var(--brass); padding-top: 4px; }
.chapter h3 { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--head); }
.chapter p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--body); }

/* ===== Combat : salle d'attente ===== */
.radar-ring { flex: none; width: 120px; height: 120px; border-radius: 60px; border: 1px solid var(--line-strong); position: relative; margin: 6px auto; }
.radar-ring::after { content: ''; position: absolute; inset: 0; border-radius: 60px; background: conic-gradient(from 0deg, rgba(79,209,197,.28), transparent 25%); animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.radar-ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 26px; color: var(--head); z-index: 1; }

/* ===== Bataille ===== */
#battle { position: fixed; inset: 0; z-index: 40; background: var(--sea); touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
#battle-canvas { position: absolute; inset: 0; }
#battle-canvas canvas { display: block; }
.hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--mono); color: var(--text); padding: calc(10px + var(--safe-t)) max(12px, env(safe-area-inset-right)) calc(12px + var(--safe-b)) max(12px, env(safe-area-inset-left)); }
.hud > * { pointer-events: auto; }
.hud-card { position: absolute; top: calc(10px + var(--safe-t)); left: max(12px, env(safe-area-inset-left)); width: 210px; padding: 8px 10px; border: 1px solid rgba(212,169,90,.22); border-radius: 6px; background: rgba(10,15,20,.82); display: flex; flex-direction: column; gap: 5px; }
.hud-card .nm { font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--head); font-family: var(--serif); }
.segs { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
.segs i { height: 4px; background: rgba(141,154,165,.25); }
.segs i.on { background: var(--teal); }
.segs.low i.on { background: var(--red); }
.hud-line { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.hud-top { position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.timer { font-size: 13px; padding: 3px 9px; border-radius: 4px; background: rgba(10,15,20,.85); color: var(--head); }
.event { padding: 6px 12px; border: 1px solid rgba(242,119,122,.55); border-radius: 4px; background: rgba(20,13,16,.88); font-size: 10px; letter-spacing: 1.5px; color: var(--red); white-space: nowrap; }
.radar { position: absolute; top: calc(10px + var(--safe-t)); right: max(12px, env(safe-area-inset-right)); width: 96px; height: 96px; border-radius: 48px; border: 1px solid rgba(212,169,90,.3); background: rgba(10,15,20,.82); }
.feed { position: absolute; top: calc(116px + var(--safe-t)); right: max(12px, env(safe-area-inset-right)); width: min(260px, 45vw); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.feed span { font-size: 10px; padding: 3px 6px; border-radius: 3px; background: rgba(10,15,20,.82); color: var(--soft); text-align: right; animation: tin .2s; }
.feed span.t-kill { color: var(--head); } .feed span.t-shame { color: var(--red); } .feed span.t-event { color: var(--red); } .feed span.t-troll { color: var(--violet); } .feed span.t-gold { color: var(--brass); }
.stick { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: calc(16px + var(--safe-b)); width: 128px; height: 128px; border-radius: 64px; border: 1px solid rgba(212,169,90,.35); background: rgba(10,15,20,.55); touch-action: none; }
.stick .knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 26px; background: rgba(242,237,226,.88); transition: transform .08s; }
.stick .n { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--brass); }
.center-ctrls { position: absolute; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.trolls { display: flex; gap: 6px; }
.troll { position: relative; width: 48px; height: 48px; border-radius: 4px; border: 1px solid var(--violet); background: rgba(10,15,20,.88); color: var(--text); font-family: var(--mono); font-size: 9px; letter-spacing: .5px; cursor: pointer; padding: 2px; line-height: 1.1; }
.troll b { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--violet); color: var(--bg); font-size: 9px; display: flex; align-items: center; justify-content: center; }
.troll:disabled { border-color: rgba(141,154,165,.25); color: #5b6873; text-decoration: line-through; }
.sails { display: flex; border: 1px solid rgba(212,169,90,.3); border-radius: 4px; background: rgba(10,15,20,.85); overflow: hidden; }
.sails button { min-height: 38px; padding: 0 12px; border: 0; background: transparent; color: var(--soft); font-family: var(--mono); font-size: 10px; letter-spacing: 1px; cursor: pointer; }
.sails button.on { background: var(--brass); color: var(--bg); }
.fire-ctrls { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: calc(14px + var(--safe-b)); display: flex; align-items: flex-end; gap: 10px; }
.cannon { position: relative; width: 90px; height: 90px; border-radius: 45px; border: 0; background: rgba(10,15,20,.88); cursor: pointer; padding: 0; color: var(--brass); font-family: var(--mono); font-size: 10px; letter-spacing: 1px; touch-action: manipulation; }
.cannon.star { color: var(--teal); }
.cannon.ready { box-shadow: 0 0 22px rgba(212,169,90,.4); }
.cannon.star.ready { box-shadow: 0 0 22px rgba(79,209,197,.35); }
.cannon svg { position: absolute; inset: 0; }
.cannon span { position: relative; }
.board-btn { width: 60px; height: 60px; border-radius: 30px; border: 1px solid rgba(141,154,165,.4); background: rgba(10,15,20,.85); color: var(--soft); font-family: var(--mono); font-size: 8px; letter-spacing: 1px; cursor: pointer; margin-bottom: 46px; }
.board-btn.ready { border-color: var(--red); color: var(--head); box-shadow: 0 0 18px rgba(242,119,122,.4); }
.flash { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 12px 18px; border: 1px solid var(--violet); border-radius: 4px; background: rgba(10,15,20,.92); box-shadow: 0 0 40px rgba(182,156,255,.35); font-size: 12px; letter-spacing: 1.5px; color: #e8dcff; text-align: center; pointer-events: none; }
.blind { position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,240,200,.85), rgba(255,215,140,.6)); pointer-events: none; }
.quit { position: absolute; top: calc(10px + var(--safe-t)); left: calc(232px + env(safe-area-inset-left)); width: 40px; height: 40px; border: 1px solid rgba(141,154,165,.3); border-radius: 6px; background: rgba(10,15,20,.82); color: var(--soft); cursor: pointer; }
.sunk-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.sunk-banner .title { font-size: 46px; color: var(--red); text-shadow: 0 0 30px rgba(242,119,122,.5); }
@media (orientation: portrait) {
  .hud-card { width: 170px; }
  .feed { top: calc(118px + var(--safe-t)); }
  .center-ctrls { bottom: calc(152px + var(--safe-b)); }
  .quit { left: calc(192px + env(safe-area-inset-left)); }
}
body.lefty .stick { left: auto; right: max(18px, env(safe-area-inset-right)); }
body.lefty .fire-ctrls { right: auto; left: max(14px, env(safe-area-inset-left)); flex-direction: row-reverse; }

/* ===== Fin de partie ===== */
.end { position: fixed; inset: 0; z-index: 50; background: rgba(6,10,14,.985); overflow: auto; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); }
.end-inner { max-width: 760px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 24px; }
.end-inner > div { flex: 1 1 300px; display: flex; flex-direction: column; gap: 12px; }
.end h1 { font-size: 64px; text-shadow: 0 0 36px rgba(212,169,90,.5); }
.end h1.lose { color: var(--red); text-shadow: 0 0 36px rgba(242,119,122,.4); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid > div { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(212,169,90,.14); }
.stat-grid > div:nth-child(-n+3) { border-top: 0; }
.stat-grid > div:not(:nth-child(3n+1)) { border-left: 1px solid rgba(212,169,90,.14); }
.stat-grid .k { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: var(--muted); }
.stat-grid .v { font-family: var(--mono); font-size: 20px; color: var(--head); }

/* ===== Pages légales ===== */
body.legal { background: var(--bg); }
.legal-wrap { max-width: 760px; margin: 0 auto; padding: calc(24px + var(--safe-t)) 20px 60px; line-height: 1.6; }
.legal-wrap h1 { font-size: clamp(32px, 7vw, 46px); margin: 6px 0 14px; }
.legal-wrap h2 { font-family: var(--serif); font-size: 30px; color: var(--head); margin: 40px 0 6px; border-top: 1px solid var(--line); padding-top: 24px; }
.legal-wrap h3 { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--brass); margin: 22px 0 6px; font-weight: 500; }
.legal-wrap p, .legal-wrap li { color: var(--body); font-size: 15px; }
.legal-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal-wrap th, .legal-wrap td { text-align: left; padding: 8px; border-bottom: 1px solid var(--hair); vertical-align: top; color: var(--body); }
.legal-wrap th { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); font-weight: 500; }
.legal-wrap .back { font-size: 14px; }
.legal-wrap .toc { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; }

/* ===== Badge de navigation ===== */
.nav a { position: relative; }
.nav .badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: var(--bg); font-size: 9px; font-weight: 600; display: flex; align-items: center; justify-content: center; letter-spacing: 0; }
.nav-inner { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nav a { font-size: 8.5px; letter-spacing: .8px; }
body.no-scroll { overflow: hidden; }

/* ===== Amis ===== */
.add-friend { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline .btn { min-height: 46px; }
.presence { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); font-weight: 500; margin-left: 6px; white-space: nowrap; }
.presence::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 3px; background: #5b6873; margin-right: 5px; vertical-align: 1px; }
.presence.on { color: var(--teal); } .presence.on::before { background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.presence.battle { color: var(--brass); } .presence.battle::before { background: var(--brass); }
.friend-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.friend-actions .link-btn { font-size: 12px; padding: 4px 0; }

/* ===== Joystick : repère du cap visé ===== */
.stick .hd { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 5px; background: var(--brass); box-shadow: 0 0 10px rgba(212,169,90,.8); pointer-events: none; }

/* ===== Didacticiel ===== */
.tuto { position: fixed; inset: 0; z-index: 90; background: radial-gradient(ellipse at 50% 0%, #10202b 0%, var(--bg) 65%); overflow: auto; overscroll-behavior: contain; }
.tuto-inner { max-width: 560px; min-height: 100%; margin: 0 auto; padding: calc(18px + var(--safe-t)) 20px calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px; }
.tuto-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tuto-dots { display: flex; gap: 5px; flex: 1; }
.tuto-dots i { flex: 1; height: 3px; border-radius: 2px; background: rgba(141,154,165,.22); }
.tuto-dots i.done { background: rgba(212,169,90,.55); }
.tuto-dots i.on { background: var(--brass); box-shadow: 0 0 8px rgba(212,169,90,.6); }
.tuto-body { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.tuto h1 { font-size: 38px; }
.tuto-p p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; color: var(--body); }
.tuto-p b { color: var(--head); font-weight: 600; }
.tuto-p .tip { font-size: 13px; color: var(--soft); border-left: 2px solid var(--brass); padding-left: 12px; }
.tuto-p .task { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--brass-hi); border: 1px dashed rgba(212,169,90,.5); border-radius: 6px; padding: 10px 12px; }
.tuto-p .task.ok { color: var(--teal); border-color: rgba(79,209,197,.6); border-style: solid; }
.tuto-p .task.bad { color: var(--red); border-color: rgba(242,119,122,.6); }
.tlist { margin: 0 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.5; color: var(--body); }
.tlist b { color: var(--head); }
.tuto-demo { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--sea); min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 10px 10px 14px; gap: 10px; overflow: hidden; }
.tuto-sea { width: 100%; max-width: 340px; height: auto; }
.tuto-demo .stick.demo-stick { position: relative; left: auto; bottom: auto; flex: none; }
.demo-fire { display: flex; gap: 14px; }
.demo-fire .cannon { width: 84px; height: 84px; border: 1px solid currentColor; }
.tuto-demo .sails.demo-sails button { min-height: 46px; padding: 0 16px; }
.tuto .ball { animation: shot .38s linear forwards; }
@keyframes shot { to { transform: translateY(var(--dy)); opacity: .3; } }
.tuto .hit { animation: hit .45s ease-out; }
@keyframes hit { 30% { opacity: .2; } 60% { opacity: 1; } 80% { opacity: .4; } }
.tuto-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.tuto-nav .btn { min-height: 54px; }

/* ===== Téléphone à l'horizontale (écrans de gestion) ===== */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --rail: calc(76px + env(safe-area-inset-left, 0px)); }
  .nav { top: 0; right: auto; width: var(--rail); border-top: 0; border-right: 1px solid rgba(212,169,90,.16); padding: var(--safe-t) 0 var(--safe-b) env(safe-area-inset-left, 0px); display: flex; align-items: center; }
  .nav-inner { display: flex; flex-direction: column; width: 100%; }
  .nav a { min-height: 0; flex: 1; padding: 6px 0; border-top: 0; border-left: 2px solid transparent; }
  .nav a[aria-current="page"] { border-left-color: var(--brass); }
  .nav svg { width: 18px; height: 18px; }
  .nav .badge { top: 2px; }
  #app { max-width: none; }
  body:has(#nav:not([hidden])) #app { padding-left: var(--rail); }
  #view { display: block; columns: 2 340px; column-gap: 32px; max-width: 1000px; width: 100%; margin: 0 auto;
    padding: calc(14px + var(--safe-t)) max(20px, env(safe-area-inset-right)) calc(20px + var(--safe-b)) 22px; }
  #view > * { break-inside: avoid; margin-bottom: 14px; }
  #view > .list, #view > .tabs ~ * { break-inside: auto; }
  #view .row { break-inside: avoid; }
  #view > .head, #view > h2.section, #view > div:first-child { break-after: avoid; }
  .toasts { bottom: calc(14px + var(--safe-b)); left: calc(50% + var(--rail) / 2); }
  h1, .title { font-size: 28px; }
  .modal-bg { align-items: center; padding: 10px; }
  .modal { max-height: 94dvh; max-width: 640px; }
  /* Connexion : marque à gauche, formulaire à droite */
  .auth { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; align-items: center; padding: calc(18px + var(--safe-t)) max(28px, env(safe-area-inset-right)) calc(18px + var(--safe-b)) max(28px, env(safe-area-inset-left)); }
  .auth > .grow { display: none; }
  .auth .brand { grid-column: 1; grid-row: 1 / span 2; }
  .auth form { grid-column: 2; grid-row: 1; }
  .auth .foot { grid-column: 1 / -1; }
  .auth .brand h1 { font-size: 46px; }
  /* Didacticiel : texte à gauche, démo à droite */
  .tuto-inner { max-width: 980px; padding: calc(12px + var(--safe-t)) max(24px, env(safe-area-inset-right)) calc(12px + var(--safe-b)) max(24px, env(safe-area-inset-left)); gap: 12px; }
  .tuto-body { flex-direction: row; align-items: flex-start; gap: 28px; }
  .tuto-text { flex: 1.2; }
  .tuto-demo { flex: 1; min-height: 0; position: sticky; top: 0; flex-direction: row; justify-content: center; align-items: center; }
  .tuto-demo .tuto-sea { max-width: 220px; }
  .tuto-demo .stick.demo-stick { width: 112px; height: 112px; }
  .demo-fire { flex-direction: column; }
  .tuto h1 { font-size: 30px; }
  .tuto-sea { max-height: 170px; }
  .tuto-nav { max-width: 420px; margin-left: auto; width: 100%; }
  /* Fin de partie */
  .end h1 { font-size: 48px; }
}
