/* NOX mobile — mêmes six thèmes que NOX sur PC (couleurs de ui/themes.css, images de outils/mobile-themes.py). */
:root,
[data-theme='encre'] {
  --bg: #000000; --panel: #050507; --card: #0d0d11; --line: #1c1c22; --text: #ececf2; --muted: #8a8a98;
  --accent: #d8c7ff; --accent-text: #0a0a0f; --input: #050507; --img: .6; --decor: .8;
}
[data-theme='nox'] {
  --bg: #06080e; --panel: #0a0d16; --card: #10141f; --line: #1b2131; --text: #e8eefc; --muted: #8b97b6;
  --accent: #6fc3ff; --accent-text: #04101c; --input: #070a12; --img: .6;
}
[data-theme='minuit'] {
  --bg: #0a0b16; --panel: #0f1020; --card: #161830; --line: #23264a; --text: #efeaf4; --muted: #9a98b8;
  --accent: #d9344f; --accent-text: #ffffff; --input: #090a14; --img: .55;
}
[data-theme='foret'] {
  --bg: #080f0b; --panel: #0c1510; --card: #122017; --line: #1f3326; --text: #e4efe6; --muted: #8fa894;
  --accent: #7fcf8e; --accent-text: #07120a; --input: #070e0a; --img: .55;
}
[data-theme='sanglant'] {
  --bg: #0a0708; --panel: #100b0d; --card: #171013; --line: #2b1d21; --text: #f4eeea; --muted: #a3908f;
  --accent: #e5283f; --accent-text: #ffffff; --input: #0a0608; --img: .55;
}
[data-theme='pandala'] {
  --bg: #f1ead9; --panel: #f8f3e8; --card: #fbf8f0; --line: #d8cfb8; --text: #1e1a16; --muted: #6e6353;
  --accent: #b8332f; --accent-text: #ffffff; --input: #fbf8f0; --img: .75; --decor: .6;
}
* { box-sizing: border-box; }
/* Le fond est sur html seulement : celui de body passerait par-dessus le décor (z-index négatif). */
html { background: var(--bg); }
html, body { margin: 0; min-height: 100%; color: var(--text); font: 15px/1.45 Inter, 'Segoe UI', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Décor : ambiance voilée, décor qui pend du haut, décor qui monte du bas (derrière tout le contenu). */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop img { position: absolute; left: 0; width: 100%; }
.scene { inset: 0; height: 100%; object-fit: cover; opacity: var(--img); }
.veil { position: absolute; inset: 0; background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 80%, transparent) 30%, color-mix(in srgb, var(--bg) 45%, transparent) 75%, color-mix(in srgb, var(--bg) 25%, transparent) 100%); }
.decor { opacity: var(--decor); }
.decor.haut { top: 0; -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent); mask-image: linear-gradient(to bottom, #000 35%, transparent); }
.decor.bas { bottom: 0; -webkit-mask-image: linear-gradient(to top, #000 35%, transparent); mask-image: linear-gradient(to top, #000 35%, transparent); }

.app { max-width: 640px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom)); }
.app.full { padding: 0; height: 100dvh; display: flex; flex-direction: column; }
h1 { margin: 0; font: 700 26px 'Space Grotesk', 'Segoe UI', sans-serif; }
.logo { font: 700 24px 'Space Grotesk', 'Segoe UI', sans-serif; letter-spacing: .02em; }
.logo span, h1 span { color: var(--accent); }
.top { display: flex; align-items: center; gap: 8px; }
.top .grow { flex: 1; min-width: 0; }
.btn { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.icon { width: 44px; padding: 0; }
.btn:disabled { opacity: .5; }
.card { background: color-mix(in srgb, var(--card) 90%, transparent); border: 1px solid var(--line); border-radius: 14px; }
.muted { color: var(--muted); font-size: 12px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 10px; }
.sec h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sec a { font-size: 13px; }
.pc { margin-top: 18px; padding: 14px; display: flex; gap: 12px; align-items: center; min-height: 96px; background-size: cover; background-position: right center; }
.pc .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.pc .dot.on { background: #3ccf8e; }
.rows .row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 56px; color: var(--text); }
.rows .row + .row { border-top: 1px solid var(--line); }
.row .t { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .grow { flex: 1; min-width: 0; }
.badge { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; color: #14110f; }
.ext { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 4px; }
.grp { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 8px; }
.search { margin-top: 14px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--input); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); outline: none; }
.chips { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); white-space: nowrap; flex-shrink: 0; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.tile { display: block; padding: 14px; color: var(--text); min-height: 96px; }
.tile h3 { margin: 0; font-size: 15px; }
.tile p { margin: 8px 0 0; font-size: 13px; opacity: .85; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.tile.pinned { border-color: var(--accent); }
.fab { position: fixed; right: 18px; bottom: calc(96px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; border: 0; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* Barre du bas : décor visible à travers, liseré et repère d'accent comme le menu du PC. */
.nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(70px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr); background: color-mix(in srgb, var(--panel) 78%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 5; }
.nav[hidden] { display: none; }
.nav::before { content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent); opacity: .7; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); }
.nav a.on { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }

/* Écrans plein cadre : conversation, note. */
.bar { display: flex; align-items: center; gap: 6px; padding: calc(10px + env(safe-area-inset-top)) 8px 10px; border-bottom: 1px solid var(--accent); background: linear-gradient(90deg, color-mix(in srgb, var(--panel) 75%, transparent) 40%, color-mix(in srgb, var(--panel) 60%, var(--accent) 12%)); }
.bar .grow { flex: 1; min-width: 0; }
.bar .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text); background: none; border: 0; }
.info { margin: 12px 14px 0; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 12px; }
.log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; border-radius: 16px; padding: 10px 13px; }
.msg.me { align-self: flex-end; background: color-mix(in srgb, var(--accent) 22%, var(--card)); border-radius: 16px 16px 4px 16px; }
.msg.ai { align-self: flex-start; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; }
.msg.text { align-self: stretch; max-width: none; white-space: pre-wrap; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); }
.who { font-size: 11px; color: var(--muted); margin-bottom: 3px; letter-spacing: .04em; text-transform: uppercase; }
.msg code { font: 12.5px 'Cascadia Code', Consolas, monospace; background: color-mix(in srgb, var(--text) 10%, transparent); padding: 1px 4px; border-radius: 4px; }
.msg pre { margin: 6px 0; padding: 8px 10px; background: #101118; color: #cfd3df; border-radius: 8px; overflow-x: auto; }
.msg pre code { background: none; padding: 0; }
.msg .h { display: block; margin-top: 4px; }
.msg .li { display: block; padding-left: 14px; position: relative; }
.msg .li::before { content: '•'; position: absolute; left: 3px; color: var(--accent); }
.tools { align-self: flex-start; font-size: 12px; color: var(--muted); }
.editor { flex: 1; display: flex; flex-direction: column; margin: 4px 14px 12px; padding: 16px; border-radius: 16px; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); }
.editor input { border: 0; background: none; outline: none; font: 700 22px 'Space Grotesk', 'Segoe UI', sans-serif; padding: 0; }
.editor textarea { flex: 1; margin-top: 14px; border: 0; background: none; outline: none; resize: none; font-size: 15px; line-height: 1.6; padding: 0; }
.foot { display: flex; gap: 8px; align-items: center; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 85%, transparent); }
.foot .grow { flex: 1; }
.login { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login input { height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--input); outline: none; }
.login input:focus, .search:focus-within { border-color: var(--accent); }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.themes button { padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 13px; }
.themes button.on { border-color: var(--accent); color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 13px; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
