@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 500 700; font-display: swap; src: url("/fonts/fraunces-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 500 700; font-display: swap; src: url("/fonts/fraunces-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/jakarta-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/jakarta-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F6F0EE; --bg-elev: #FFFBFA; --ink: #1E1619; --muted: #7B6E72; --line: rgba(30, 22, 25, 0.08);
  --bubble: #2C2226; --bubble-ink: #FCF6F8;
  --accent: #D23C8C; --accent-ink: #FFF7FB; --accent-soft: #F9DDEB; --accent-deep: #B02C72;
  --grad-a: #EE5DA8; --grad-b: #D63C8D; --accent-glow: rgba(214, 60, 141, 0.30);
  --online: #2F9A62; --card: #FFFBFA; --card-line: rgba(30, 22, 25, 0.08);
  --option: #F8EEF1; --option-ink: #2C2226; --option-line: rgba(30, 22, 25, 0.08);
  --input: #FFFBFA; --input-ph: #9C8E93; --icon: #5E5357;
  --shadow: 0 8px 28px rgba(60, 20, 40, 0.08); --composer-shadow: 0 -8px 24px rgba(60, 20, 40, 0.04);
  --reaction-bg: #FFFBFA; --reaction-line: rgba(30, 22, 25, 0.1);
  --header-bg: rgba(246, 240, 238, 0.86); --error: #B3261E;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #14100F; --bg-elev: #1D1718; --ink: #F6ECEF; --muted: #AA9CA1; --line: rgba(246, 236, 239, 0.1);
  --bubble: #F1E2E7; --bubble-ink: #1E1619;
  --accent: #F27CB9; --accent-ink: #1E1619; --accent-soft: #3B2230; --accent-deep: #F6A3CD;
  --grad-a: #F592C6; --grad-b: #E8559F; --accent-glow: rgba(242, 124, 185, 0.22);
  --online: #5FBF84; --card: #1F1819; --card-line: rgba(246, 236, 239, 0.1);
  --option: #2B2224; --option-ink: #F6ECEF; --option-line: rgba(246, 236, 239, 0.12);
  --input: #1F1819; --input-ph: #8C7E83; --icon: #C7BABF;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35); --composer-shadow: 0 -10px 28px rgba(0, 0, 0, 0.28);
  --reaction-bg: #2B2224; --reaction-line: rgba(246, 236, 239, 0.12);
  --header-bg: rgba(20, 16, 15, 0.86); --error: #FFB4AB;
  color-scheme: dark;
} }
html[data-theme="dark"] {
  --bg: #14100F; --bg-elev: #1D1718; --ink: #F6ECEF; --muted: #AA9CA1; --line: rgba(246, 236, 239, 0.1);
  --bubble: #F1E2E7; --bubble-ink: #1E1619;
  --accent: #F27CB9; --accent-ink: #1E1619; --accent-soft: #3B2230; --accent-deep: #F6A3CD;
  --grad-a: #F592C6; --grad-b: #E8559F; --accent-glow: rgba(242, 124, 185, 0.22);
  --online: #5FBF84; --card: #1F1819; --card-line: rgba(246, 236, 239, 0.1);
  --option: #2B2224; --option-ink: #F6ECEF; --option-line: rgba(246, 236, 239, 0.12);
  --input: #1F1819; --input-ph: #8C7E83; --icon: #C7BABF;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35); --composer-shadow: 0 -10px 28px rgba(0, 0, 0, 0.28);
  --reaction-bg: #2B2224; --reaction-line: rgba(246, 236, 239, 0.12);
  --header-bg: rgba(20, 16, 15, 0.86); --error: #FFB4AB;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); }
body { font-family: "Plus Jakarta Sans", "Noto Color Emoji", "Noto Sans", system-ui, sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
.app { height: 100dvh; max-width: 560px; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; position: relative; overflow: hidden; padding-top: env(safe-area-inset-top); }
html[data-view="boot"] #view-login, html[data-view="boot"] #view-chat,
html[data-view="login"] #view-chat, html[data-view="chat"] #view-login { display: none; }

/* ——— Personnage LOU ——— */
.lou { display: block; overflow: visible; }
.lou-float, .lou-squish, .lou-eyes, .lou-shadow { transform-box: fill-box; transform-origin: 50% 100%; }
.lou-eyes { transform-origin: 50% 50%; animation: lou-blink 4.8s infinite; }
.lou--idle .lou-float, .lou--hero .lou-float { animation: lou-float 3.6s ease-in-out infinite; }
.lou--idle .lou-shadow, .lou--hero .lou-shadow { transform-origin: 50% 50%; animation: lou-shadow 3.6s ease-in-out infinite; }
.lou--think .lou-squish { animation: lou-squish 1.05s cubic-bezier(.45,.05,.55,.95) infinite; }
.lou--think .lou-float { animation: lou-hop 1.05s cubic-bezier(.45,.05,.55,.95) infinite; }
.lou--think .lou-eyes { animation: lou-look 2.1s ease-in-out infinite; }
.lou--still .lou-eyes { animation-duration: 6.5s; }
@keyframes lou-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes lou-shadow { 0%, 100% { transform: scaleX(1); opacity: .16; } 50% { transform: scaleX(.82); opacity: .09; } }
@keyframes lou-blink { 0%, 91%, 97%, 100% { transform: scaleY(1); } 94% { transform: scaleY(.12); } }
@keyframes lou-squish { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(1.08, .9); } 55% { transform: scale(.95, 1.06); } 78% { transform: scale(1.02, .98); } }
@keyframes lou-hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7%); } }
@keyframes lou-look { 0%, 100% { transform: translateX(0) scaleY(1); } 30% { transform: translateX(-9%) scaleY(1); } 46% { transform: translateX(-9%) scaleY(.15); } 52% { transform: translateX(-9%) scaleY(1); } 70% { transform: translateX(6%); } }
@media (prefers-reduced-motion: reduce) { .lou * { animation: none !important; } }

/* ===================== CONNEXION ===================== */
#view-login { flex: 1; display: flex; flex-direction: column; position: relative; overflow: hidden; }
#view-login .glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(232, 72, 156, 0.14), transparent 60%),
              radial-gradient(ellipse 60% 40% at 80% 80%, rgba(246, 160, 200, 0.18), transparent 60%),
              radial-gradient(ellipse 50% 35% at 10% 70%, rgba(214, 60, 141, 0.07), transparent 60%); }
html[data-theme="dark"] #view-login .glow { background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(242, 124, 185, 0.16), transparent 60%), radial-gradient(ellipse 60% 40% at 80% 80%, rgba(176, 44, 114, 0.16), transparent 60%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #view-login .glow { background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(242, 124, 185, 0.16), transparent 60%), radial-gradient(ellipse 60% 40% at 80% 80%, rgba(176, 44, 114, 0.16), transparent 60%); } }
.login-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 28px 36px 12px; position: relative; z-index: 1; overflow-y: auto; }
.hero-mark { width: 120px; height: 120px; margin-top: 46px; filter: drop-shadow(0 12px 22px rgba(214, 60, 141, 0.28)); }
.wordmark { font-family: "Fraunces", "Times New Roman", serif; font-weight: 650; font-size: 48px; letter-spacing: -0.035em; margin-top: 16px; line-height: 1; }
.for-whom { margin-top: 10px; font-size: 15px; font-weight: 550; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.login-lead { margin-top: 18px; text-align: center; font-size: 15.5px; line-height: 1.5; color: var(--muted); max-width: 300px; font-weight: 450; }
.login-form { width: 100%; max-width: 380px; margin-top: 40px; display: flex; flex-direction: column; gap: 12px; }
.code-field { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 18px; border-radius: 16px; background: var(--input); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(30, 22, 25, 0.04); }
.code-field:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.code-field svg { flex: none; color: var(--muted); }
.code-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; font-weight: 500; letter-spacing: .04em; }
.code-field input::placeholder { color: var(--input-ph); letter-spacing: 0; }
.btn-enter { height: 54px; border: 0; border-radius: 16px; background: linear-gradient(180deg, var(--grad-a) 0%, var(--grad-b) 100%); color: #FFF7FB; font-size: 16.5px; font-weight: 650; letter-spacing: -0.01em; box-shadow: 0 8px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2); cursor: pointer; }
html[data-theme="dark"] .btn-enter { color: #1E1619; }
.btn-enter:disabled { opacity: .7; }
.login-error { text-align: center; color: var(--error); font-size: 14px; font-weight: 550; }
.secret-link { margin-top: 8px; text-align: center; font-size: 14.5px; font-weight: 550; line-height: 1.45; }
.secret-link span { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); padding-bottom: 1px; }
.login-foot { margin-top: auto; padding: 24px 0 calc(20px + env(safe-area-inset-bottom)); font-size: 12.5px; font-weight: 550; letter-spacing: 0.04em; color: var(--muted); }

/* ===================== CHAT ===================== */
#view-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.header { height: 62px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px; background: var(--header-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); position: relative; z-index: 4; }
.head-mark { width: 42px; height: 42px; flex: none; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink); display: grid; place-items: center; border-radius: 50%; flex: none; cursor: pointer; }
.icon-btn:active { background: var(--line); }
.who { flex: 1; min-width: 0; }
.who .name { font-size: 17px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.presence { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; font-weight: 550; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--online); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 22%, transparent); }
.presence.thinking { color: var(--accent); }
.presence.thinking .dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); animation: pulse 1.2s ease-in-out infinite; }
.presence.offline .dot { background: var(--muted); box-shadow: none; }
@keyframes pulse { 50% { opacity: .35; } }
.menu { position: absolute; right: 12px; top: 56px; background: var(--card); border: 1px solid var(--card-line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 230px; display: flex; flex-direction: column; }
.menu[hidden] { display: none; }
.menu button { border: 0; background: none; text-align: left; padding: 11px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 550; cursor: pointer; }
.menu button:active { background: var(--option); }

.transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px 14px; display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain; }
.day { align-self: center; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 4px 0 2px; }
.msg-lou { max-width: 100%; animation: rise .28s ease-out; }
.msg-lou .meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.msg-lou .meta .av { width: 24px; height: 24px; flex: none; }
.msg-lou .meta .by { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.msg-lou .body { font-size: 15.5px; line-height: 1.5; font-weight: 450; overflow-wrap: anywhere; user-select: text; }
.msg-lou .body p + p { margin-top: 0.7em; }
.msg-lou .body a { color: var(--accent); }
.msg-lou .body strong { font-weight: 700; }
.reaction { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 3px 8px 4px; border-radius: 999px; background: var(--reaction-bg); border: 1px solid var(--reaction-line); box-shadow: 0 1px 2px rgba(30, 22, 25, 0.05); font-size: 14px; line-height: 1; cursor: pointer; }
.reaction .n { font-size: 11px; font-weight: 650; color: var(--muted); }
.react-bar { display: inline-flex; gap: 2px; margin-top: 8px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--card-line); box-shadow: var(--shadow); }
.react-bar button { border: 0; background: none; font-size: 20px; width: 38px; height: 34px; border-radius: 999px; cursor: pointer; }
.react-bar button:active { background: var(--option); }
.msg-user { align-self: flex-end; max-width: 82%; display: flex; flex-direction: column; align-items: flex-end; animation: rise .22s ease-out; }
.bubble { background: var(--bubble); color: var(--bubble-ink); border-radius: 22px 22px 6px 22px; padding: 11px 16px 12px; font-size: 15.5px; line-height: 1.45; font-weight: 450; box-shadow: 0 1px 2px rgba(30, 22, 25, 0.08); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-state { margin-top: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.msg-state.err { color: var(--error); }
.msg-state button { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 11.5px; text-decoration: underline; cursor: pointer; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.images { display: grid; gap: 6px; margin-top: 10px; grid-template-columns: 1fr; max-width: 320px; }
.images.multi { grid-template-columns: 1fr 1fr; }
.images button { border: 0; padding: 0; background: var(--option); border-radius: 16px; overflow: hidden; cursor: zoom-in; aspect-ratio: 1; box-shadow: var(--shadow); }
.images img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card { background: var(--card); border: 1px solid var(--card-line); border-radius: 20px; padding: 16px 14px 14px; box-shadow: var(--shadow); animation: rise .28s ease-out; }
.card h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.card .hint { margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 500; line-height: 1.35; }
.options { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 8px 14px; border-radius: 14px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; border: 1px solid var(--option-line); background: var(--option); color: var(--option-ink); text-align: center; cursor: pointer; width: 100%; }
.opt.primary { background: linear-gradient(180deg, var(--grad-a) 0%, var(--grad-b) 100%); color: #FFF7FB; border-color: transparent; box-shadow: 0 6px 16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18); font-weight: 650; }
html[data-theme="dark"] .opt.primary { color: #1E1619; }
.card.answered .opt { opacity: .45; cursor: default; }
.card.answered .opt.chosen { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }

.thinking-row { display: flex; align-items: center; gap: 10px; animation: rise .3s ease-out; }
.thinking-row .av { width: 40px; height: 40px; flex: none; }
.thinking-row .lbl { font-size: 14px; font-weight: 600; color: var(--muted); }
.thinking-row .lbl i { font-style: normal; display: inline-block; animation: dots 1.4s infinite; }
.thinking-row .lbl i:nth-child(2) { animation-delay: .2s; } .thinking-row .lbl i:nth-child(3) { animation-delay: .4s; }
.thinking-row .sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.thinking-row .sub button { border: 0; background: none; color: var(--accent); font-weight: 700; text-decoration: underline; cursor: pointer; font-size: 12px; }
@keyframes dots { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ——— Saisie ——— */
.composer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: var(--composer-shadow); position: relative; z-index: 4; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.pill { flex: 1; min-width: 0; min-height: 48px; border-radius: 24px; background: var(--input); border: 1px solid var(--line); display: flex; align-items: center; padding: 0 18px; box-shadow: 0 1px 2px rgba(30, 22, 25, 0.04); }
.pill:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.pill textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; font-size: 15.5px; font-weight: 500; line-height: 1.4; padding: 12px 0; max-height: 132px; }
.pill textarea::placeholder { color: var(--input-ph); }
.send { width: 48px; height: 48px; border: 0; border-radius: 50%; background: linear-gradient(180deg, var(--grad-a) 0%, var(--grad-b) 100%); color: #FFF7FB; display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2); cursor: pointer; transition: transform .12s, opacity .15s; }
html[data-theme="dark"] .send { color: #1E1619; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .send, :root:not([data-theme="light"]) .btn-enter, :root:not([data-theme="light"]) .opt.primary { color: #1E1619; } }
.send:disabled { opacity: .55; box-shadow: none; }
.send:active:not(:disabled) { transform: scale(.94); }

/* ——— Aperçu plein écran ——— */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 8, .97); backdrop-filter: blur(6px); display: flex; flex-direction: column; }
.viewer[hidden] { display: none; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
.icon-btn.light { color: #fff; }
.viewer-dl { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 650; font-size: 14.5px; padding: 9px 14px; border-radius: 999px; background: rgba(255,255,255,.12); }
.viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; padding: 8px 8px calc(24px + env(safe-area-inset-bottom)); touch-action: pinch-zoom; }
/* ombre du personnage seulement en grand (connexion) et pendant la réflexion */
.head-mark .lou-shadow, .msg-lou .av .lou-shadow { display: none; }
.msg-lou .meta .av { width: 26px; height: 26px; margin: -1px 0 -1px -2px; }
