/* Àgora · inteligencia-artificial.cat
   Clara per defecte, en línia amb la portada (#f7f8fc), amb tema fosc automàtic.
   L'eix apocalíptic–integrat governa els colors de les opinions: brasa (apocalíptic) → pissarra (entremig) → or (integrat). */

@font-face { font-family: "Alegreya"; font-weight: 400 900; font-style: normal; font-display: swap; src: url("fonts/alegreya-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Alegreya"; font-weight: 400 900; font-style: normal; font-display: swap; src: url("fonts/alegreya-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+A720-A7FF; }
@font-face { font-family: "Alegreya"; font-weight: 400 900; font-style: italic; font-display: swap; src: url("fonts/alegreya-latin-wght-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url("fonts/alegreya-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-2193; }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url("fonts/alegreya-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F; }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-display: swap; src: url("fonts/alegreya-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url("fonts/alegreya-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+2190-2193; }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url("fonts/alegreya-sans-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F; }

:root {
  --bg: #f7f8fc; --bg-2: #eef0f8; --surface: #ffffff; --surface-2: #f1f3fa;
  --text: #15183a; --dim: #3d4166; --faint: #5a5d7d;
  --rule: #dfe2f0; --rule-strong: #b9bed9;
  --ink: #1f3a8a; --ink-strong: #162c6e; --on-ink: #ffffff;
  --punt: #c8361d;
  --apo: #c4471f; --mid: #6b7193; --int: #b0861a;
  --bubble: #ffffff; --bubble-me: #e3e9fb; --felix: #fbf4e2;
  --serif: "Alegreya", "Iowan Old Style", Georgia, serif;
  --sans: "Alegreya Sans", "Gill Sans", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 10px 30px -18px rgba(21, 24, 58, .35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0d1230; --bg-2: #0a0e26; --surface: #141a40; --surface-2: #1a2150;
  --text: #ecebf5; --dim: #c3c5dc; --faint: #a3a6c2;
  --rule: #262e5e; --rule-strong: #3d4782;
  --ink: #8fa7ff; --ink-strong: #b4c4ff; --on-ink: #0b1030;
  --punt: #ff6a4d; --apo: #ef7650; --mid: #9ba1c6; --int: #e2b64e;
  --bubble: #161d47; --bubble-me: #23306c; --felix: #2a2a3e;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .7); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0d1230; --bg-2: #0a0e26; --surface: #141a40; --surface-2: #1a2150;
  --text: #ecebf5; --dim: #c3c5dc; --faint: #a3a6c2;
  --rule: #262e5e; --rule-strong: #3d4782;
  --ink: #8fa7ff; --ink-strong: #b4c4ff; --on-ink: #0b1030;
  --punt: #ff6a4d; --apo: #ef7650; --mid: #9ba1c6; --int: #e2b64e;
  --bubble: #161d47; --bubble-me: #23306c; --felix: #2a2a3e;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .7); color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--serif); font-size: 17px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 em, h2 em { font-weight: 500; }
p { margin: 0 0 .8em; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 16px; }
.sans { font-family: var(--sans); }
.dim { color: var(--dim); } .faint { color: var(--faint); }
.hint { font-family: var(--sans); font-size: .88rem; color: var(--faint); }
.skip { position: absolute; left: 1rem; top: -60px; background: var(--ink); color: var(--on-ink); padding: .5rem 1rem; border-radius: 6px; z-index: 99; font-family: var(--sans); }
.skip:focus { top: .6rem; }

/* Capçalera */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; align-items: center; gap: .8rem 1rem; min-height: 62px; flex-wrap: wrap; }
.crumb { margin-right: auto; display: flex; align-items: baseline; gap: .55rem; min-width: 0; }
.crumb a.site { font-family: var(--sans); font-size: .9rem; color: var(--faint); text-decoration: none; white-space: nowrap; }
.crumb a.site:hover { color: var(--ink); }
.crumb .brand { font-weight: 800; font-size: 1.35rem; text-decoration: none; color: var(--text); }
.crumb .brand em { font-weight: 500; }
.tabs { display: flex; gap: .2rem; }
.tab { border: 1px solid transparent; background: none; border-radius: 999px; padding: .4rem .85rem; font-family: var(--sans); font-weight: 500; color: var(--dim); text-decoration: none; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--text); border-color: var(--rule-strong); background: var(--surface); }
.me { display: flex; align-items: center; gap: .45rem; font-family: var(--sans); font-size: .95rem; border: 1px solid var(--rule); border-radius: 999px; padding: .2rem .75rem .2rem .2rem; background: var(--surface); text-decoration: none; color: var(--text); }
@media (max-width: 760px) {
  .tabs { order: 3; width: 100%; overflow-x: auto; padding-bottom: .5rem; scrollbar-width: none; }
  .crumb a.site { display: none; }
}

/* Avatars */
.av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); display: inline-grid; place-items: center; font-family: var(--sans); font-weight: 700; color: #fff; font-size: .9rem; overflow: hidden; }
.av.sm { width: 26px; height: 26px; font-size: .75rem; } .av.lg { width: 96px; height: 96px; font-size: 2rem; }

/* Botons i camps */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border-radius: 999px; border: 1px solid var(--ink); background: transparent; color: var(--ink); padding: .55rem 1.15rem; font-family: var(--sans); font-weight: 700; min-height: 44px; text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-strong); }
.btn.small { min-height: 36px; padding: .3rem .85rem; font-size: .92rem; }
.btn.ghost { border-color: var(--rule-strong); color: var(--text); }
.btn.danger { border-color: var(--punt); color: var(--punt); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; font-family: var(--sans); }
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field > label, .lbl { font-family: var(--sans); font-weight: 700; font-size: .95rem; }
.inp { width: 100%; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 10px; padding: .7rem .85rem; font-family: var(--sans); font-size: 1rem; }
textarea.inp { resize: vertical; min-height: 4.5rem; line-height: 1.45; }
.inp:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 20%, transparent); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.okmsg { color: var(--int-ink, var(--text)); font-family: var(--sans); font-size: .95rem; margin: .2rem 0 .4rem; padding: .5rem .7rem; border-radius: 8px; background: color-mix(in srgb, var(--int) 18%, transparent); }
.err { color: var(--punt); font-family: var(--sans); font-size: .92rem; min-height: 1.2em; margin: .2rem 0 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-family: var(--sans); margin-bottom: .7rem; }
.check input { width: 20px; height: 20px; margin-top: .15rem; flex: none; accent-color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 1.25rem; }
.notice { border-left: 3px solid var(--punt); background: color-mix(in srgb, var(--punt) 8%, var(--surface)); padding: .9rem 1rem; border-radius: 0 10px 10px 0; font-family: var(--sans); }
.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 160%); background: var(--text); color: var(--bg); padding: .7rem 1.15rem; border-radius: 999px; font-family: var(--sans); font-weight: 700; transition: transform .35s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.on { transform: translate(-50%, 0); }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-family: var(--sans); font-size: .78rem; font-weight: 700; color: #fff; white-space: nowrap; }
.empty { padding: 2.2rem 1rem; text-align: center; font-family: var(--sans); color: var(--dim); }
.narrow { max-width: 720px; margin: 0 auto; padding-block: 2rem 4rem; }
.page-title { font-size: clamp(2rem, 1.5rem + 2.4vw, 3.2rem); font-weight: 800; margin-bottom: 1rem; }

/* Entrada */
.gate { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2.5rem; align-items: center; padding-block: 3rem 4rem; }
@media (max-width: 900px) { .gate { grid-template-columns: 1fr; padding-block: 1.5rem 3rem; } }
.gate h1 { font-size: clamp(2.3rem, 1.6rem + 3.4vw, 4.2rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 1rem; }
.gate .lede { font-size: 1.2rem; color: var(--dim); max-width: 52ch; }
.axis-demo { margin-top: 1.6rem; }
.axis-demo .strip { height: 14px; border-radius: 999px; background: linear-gradient(90deg, var(--apo), var(--mid), var(--int)); }

/* L'eix */
.axis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
@media (max-width: 480px) { .axis { gap: 3px; } .axis button { font-size: .74rem; padding: .45rem .15rem; hyphens: auto; overflow-wrap: anywhere; } }
.axis button { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 10px; padding: .55rem .3rem; font-family: var(--sans); font-size: .86rem; line-height: 1.2; min-height: 54px; }
.axis button[aria-pressed="true"] { color: #fff; border-color: transparent; font-weight: 700; }
.axis-ends { display: flex; justify-content: space-between; font-family: var(--sans); font-size: .82rem; color: var(--faint); }
.strip-people { position: relative; height: 56px; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--apo) 22%, transparent), color-mix(in srgb, var(--mid) 12%, transparent), color-mix(in srgb, var(--int) 22%, transparent)); margin: .5rem 0 .3rem; }
.strip-people a { position: absolute; transform: translate(-50%, -50%); line-height: 0; }
.strip-people .av { width: 32px; height: 32px; border: 2px solid var(--surface); }

/* Sales */
.lobby-head { padding-block: 2rem 1.2rem; display: grid; gap: .5rem; }
.lobby-head h1 { font-size: clamp(2rem, 1.5rem + 2.4vw, 3.2rem); font-weight: 800; max-width: 20ch; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; padding-bottom: 3rem; }
.room-card { display: grid; gap: .55rem; align-content: start; text-align: left; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 1.1rem; text-decoration: none; color: var(--text); min-width: 0; transition: border-color .2s, box-shadow .2s; }
.room-card:hover { border-color: var(--rule-strong); box-shadow: var(--shadow); }
.room-card h3 { font-size: 1.25rem; }
.cover { position: relative; aspect-ratio: 3 / 2; border-radius: 12px; overflow: hidden; background: var(--rule); }
.room-card .cover { margin: -.35rem -.35rem .2rem; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-ph { position: absolute; inset: 0; background: linear-gradient(120deg, color-mix(in srgb, var(--apo) 55%, hsl(var(--h) 40% 50%)), color-mix(in srgb, var(--int) 55%, hsl(var(--h) 40% 60%))); opacity: .55; }
.cover.banner { aspect-ratio: auto; height: clamp(90px, 18vw, 170px); margin-bottom: .8rem; }
.cover.mini { width: 72px; aspect-ratio: 3 / 2; border-radius: 6px; }
.small-up { font-size: .85rem; cursor: pointer; }
.room-card .q { font-family: var(--sans); font-size: .95rem; color: var(--dim); margin: 0; }
.room-card .last { font-family: var(--sans); font-size: .9rem; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.room-meta { display: flex; gap: .8rem; flex-wrap: wrap; font-family: var(--sans); font-size: .85rem; color: var(--faint); }
.live { color: var(--punt); font-weight: 700; }
.bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--bg-2); }
.bar span { height: 100%; }

/* Sala */
.room { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 390px); gap: 16px; padding-block: 1rem; height: calc(100dvh - 62px - env(safe-area-inset-top, 0px)); min-height: 560px; }
@media (max-width: 960px) { .room { grid-template-columns: 1fr; height: auto; } }
.chat { display: grid; grid-template-rows: auto 1fr auto; background: var(--bg-2); border: 1px solid var(--rule); border-radius: 18px; min-height: 0; overflow: hidden; }
@media (max-width: 960px) { .chat { height: calc(100dvh - 120px); min-height: 520px; } }
.chat-head { padding: .85rem 1rem; border-bottom: 1px solid var(--rule); background: var(--surface); display: grid; gap: .25rem; }
.chat-head h1 { font-size: 1.4rem; }
.chat-head .q { font-family: var(--sans); font-size: .95rem; color: var(--dim); margin: 0; }
.back { font-family: var(--sans); font-size: .9rem; text-decoration: none; }
.msgs { overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; min-height: 0; overscroll-behavior: contain; }
.msg { display: flex; gap: .55rem; max-width: 88%; align-items: flex-end; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bub { background: var(--bubble); border: 1px solid var(--rule); border-radius: 16px 16px 16px 4px; padding: .5rem .8rem .45rem; min-width: 0; box-shadow: 0 1px 0 var(--rule); }
.msg.mine .bub { background: var(--bubble-me); border-radius: 16px 16px 4px 16px; }
.msg.felix .bub { background: var(--felix); border-color: color-mix(in srgb, var(--int) 55%, var(--rule)); }
.who { font-family: var(--sans); font-size: .8rem; font-weight: 700; display: flex; gap: .45rem; align-items: baseline; flex-wrap: wrap; }
.who a { color: inherit; text-decoration: none; }
.who a:hover { text-decoration: underline; }
.who time { color: var(--faint); font-weight: 400; }
.txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.02rem; }
.msg.hidden .txt { font-style: italic; color: var(--faint); }
.mod-tools button { background: none; border: 0; padding: 0; font-family: var(--sans); font-size: .78rem; color: var(--faint); text-decoration: underline; }
.typing { font-family: var(--sans); font-size: .86rem; color: var(--faint); padding: 0 1rem .35rem; min-height: 1.35em; }
.composer { border-top: 1px solid var(--rule); padding: .75rem; display: grid; gap: .5rem; background: var(--surface); }
.composer-row { display: flex; gap: .45rem; align-items: flex-end; }
.composer textarea { min-height: 48px; max-height: 170px; border-radius: 22px; padding: .7rem 1rem; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none; }
.round svg { width: 21px; height: 21px; }
.send { background: var(--ink); color: var(--on-ink); }
.mic { background: var(--surface-2); color: var(--text); border: 1px solid var(--rule-strong); }
.mic[aria-pressed="true"] { background: var(--punt); color: #fff; border-color: var(--punt); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--punt) 45%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
.status { font-family: var(--sans); font-size: .9rem; color: var(--dim); min-height: 1.2em; margin: 0; }
.warn { border: 1px solid var(--punt); border-radius: 12px; padding: .7rem .85rem; font-family: var(--sans); font-size: .95rem; display: grid; gap: .45rem; background: color-mix(in srgb, var(--punt) 6%, var(--surface)); }
.side { display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; overflow: hidden; }
.side-tabs { display: flex; border-bottom: 1px solid var(--rule); }
.side-tabs button { flex: 1; background: none; border: 0; padding: .85rem .4rem; font-family: var(--sans); font-weight: 700; color: var(--dim); border-bottom: 2px solid transparent; }
.side-tabs button[aria-selected="true"] { color: var(--text); border-color: var(--punt); }
.side-body { overflow-y: auto; padding: 1rem; min-height: 0; }
.op { display: grid; grid-template-columns: auto 1fr; gap: .65rem; padding: .75rem 0; border-top: 1px solid var(--rule); }
.op:first-of-type { border-top: 0; }
.op b a { color: inherit; text-decoration: none; }
.op p { margin: .2rem 0 0; font-size: .98rem; }
.synth h3 { font-size: 1.12rem; margin: 1.1rem 0 .4rem; }
.synth ul { padding-left: 1.1rem; margin: 0; }
.synth li { margin-bottom: .35rem; }
.node-chip { border: 1px solid var(--rule-strong); border-radius: 12px; padding: .6rem .75rem; margin-bottom: .5rem; }
.history { font-family: var(--sans); font-size: .88rem; color: var(--faint); margin-top: 1rem; }

/* Graf */
.graph-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; padding-block: 1rem 2rem; }
@media (max-width: 960px) { .graph-wrap { grid-template-columns: 1fr; } }
.graph-box { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; overflow: hidden; }
#graph { width: 100%; height: 72vh; min-height: 540px; display: block; touch-action: none; }
#graph text { font-family: var(--sans); pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.graph-tools { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; gap: .4rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: none; border-radius: 999px; padding: .3rem .85rem; font-family: var(--sans); font-weight: 500; color: var(--dim); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.legend { display: grid; gap: .45rem; font-family: var(--sans); font-size: .9rem; color: var(--dim); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .45rem; vertical-align: -1px; }
.grad { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--apo), var(--mid), var(--int)); }

/* Perfil i moderació */
.avatar-edit { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.scroll-x { overflow-x: auto; }
table.mod { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .95rem; }
table.mod th, table.mod td { text-align: left; padding: .6rem .45rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.stats { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; font-family: var(--sans); margin: 1rem 0 2rem; }
.stats b { display: block; font-family: var(--serif); font-size: 2rem; line-height: 1; }
.prose h2 { font-size: 1.4rem; margin: 1.8rem 0 .6rem; }
.prose ul { padding-left: 1.2rem; }
.person-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Lectura sense entrar (13.10.2026) */
.join { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); }
.join p { margin: 0; font-family: var(--sans); font-size: .95rem; color: var(--dim); max-width: 60ch; }
.composer .join { margin: .2rem 0; }
.gate-rooms { padding-block: 1rem 3rem; }
.gate-rooms h2 { font-size: 1.6rem; margin: 0 0 .3rem; }
.gate-rooms > p { margin: 0 0 1rem; }
.me.me-join { padding-inline: .9rem; font-weight: 600; }
