/* =========================================================
   El Rebost — estètica de quadern de muntanya
   ========================================================= */
:root {
  --bg: #f2ede3;
  --surface: #fbf8f1;
  --ink: #23211d;
  --muted: #6f685c;
  --rule: #d6cdbb;
  --accent: #2f4a7a;
  --serif: 'Source Serif 4', Georgia, serif;
  --display: 'Libre Baskerville', Georgia, serif;
  --sans: 'Work Sans', system-ui, sans-serif;
  --hand: 'Caveat', cursive;
  --type: 'Special Elite', 'Courier New', monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181715; --surface: #22201d; --ink: #ebe5d8; --muted: #a39b8c; --rule: #3a362f; --accent: #9db1d6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { --bg: #181715; --surface: #22201d; --ink: #ebe5d8; --muted: #a39b8c; --rule: #3a362f; --accent: #9db1d6; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--serif); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px 56px; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img, video { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.005em; }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.grow { flex: 1; }
.right { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; }
.kicker { font-family: var(--sans); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.kicker .ico { width: 13px; height: 13px; }
.link-quiet { color: var(--muted); text-decoration: none; font-family: var(--sans); font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }
.danger { color: #9b3328 !important; }

/* ---- capçalera ---- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-size: 1.15rem; }
.brand svg { width: 30px; height: 20px; }
.topnav { display: flex; gap: 4px; align-items: center; font-family: var(--sans); font-size: .92rem; }
.topnav a:not(.btn) { text-decoration: none; padding: 6px 10px; color: var(--muted); }
.topnav a:not(.btn):hover, .topnav a.active { color: var(--ink); }
.topnav a.active { text-decoration: underline; text-underline-offset: 6px; }
.footer { text-align: center; color: var(--muted); font-size: .88rem; padding: 28px 16px; border-top: 1px solid var(--rule); font-family: var(--sans); }
.tabbar { display: none; }
@media (max-width: 760px) {
  .topnav { display: none; }
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--rule); padding: 6px 2px calc(6px + env(safe-area-inset-bottom)); font-family: var(--sans); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; text-decoration: none; color: var(--muted); }
  .tabbar a .ico { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--ink); font-weight: 600; }
  .tabbar .tab-add .ico { background: var(--ink); color: var(--bg); border-radius: 50%; width: 40px; height: 40px; padding: 9px; margin-top: -14px; }
  body.editing .tabbar { display: none; }
  body.editing { padding-bottom: 0; }
  .footer { display: none; }
}

/* ---- botons i formularis ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--ink); background: transparent; color: var(--ink);
  padding: 9px 16px; border-radius: 3px; font-family: var(--sans); font-size: .92rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .15s, color .15s; }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ink:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { border-color: var(--rule); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn.wide { width: 100%; }
.form { max-width: 640px; margin: 28px auto 0; display: grid; gap: 16px; }
.form.narrow { max-width: 420px; }
.form h1 { font-size: 2rem; }
.fld { display: grid; gap: 5px; font-family: var(--sans); font-size: .88rem; }
.fld > span { font-weight: 500; }
input[type=text], input[type=date], input[type=url], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px; background: var(--surface); font-family: var(--serif); font-size: 1rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-r input { position: absolute; opacity: 0; pointer-events: none; }
.chip-r span { display: inline-block; padding: 5px 11px; border: 1px solid var(--rule); border-radius: 99px; cursor: pointer; font-family: var(--sans); font-size: .85rem; background: var(--surface); }
.chip-r input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-r input:focus-visible + span { outline: 2px solid var(--accent); }
.vis { display: grid; gap: 8px; }
.vis label { cursor: pointer; }
.vis input { position: absolute; opacity: 0; }
.vis span { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 3px; background: var(--surface); }
.vis em { font-style: normal; color: var(--muted); }
.vis input:checked + span { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); }

/* ---- capçaleres de pàgina ---- */
.masthead { padding: 56px 0 36px; border-bottom: 1px solid var(--rule); margin-bottom: 32px; max-width: 820px; }
.masthead h1 { font-size: clamp(2rem, 5.2vw, 3.4rem); margin: 12px 0 16px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; margin: 0 0 20px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tally { font-family: var(--sans); font-size: .85rem; color: var(--muted); margin: 0; }
.page-head { padding: 40px 0 24px; max-width: 820px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 8px 0 10px; }
.sec-title { font-size: 1.4rem; margin: 40px 0 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.empty { text-align: center; padding: 70px 16px; }
.big-serif { font-family: var(--display); font-size: 2.6rem; margin: 0; }
.small-empty { padding: 30px 16px; grid-column: 1 / -1; }
.loading { text-align: center; padding: 80px; color: var(--muted); font-style: italic; }

/* ---- llistes: filtres, targetes, converses ---- */
.home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
@media (max-width: 960px) { .home-cols { grid-template-columns: 1fr; } }
.filters { display: grid; gap: 12px; margin-bottom: 22px; }
.cats { display: flex; gap: 2px 14px; flex-wrap: wrap; font-family: var(--sans); font-size: .9rem; }
.cat { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); border-bottom: 1px solid transparent; }
.cat.on { color: var(--ink); border-bottom-color: var(--ink); }
.search { max-width: 420px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 22px; }
.more { display: flex; justify-content: center; margin-top: 26px; }
.vcard { background: var(--v-bg); color: var(--v-ink); text-decoration: none; display: flex; flex-direction: column; border: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 10px 24px -18px rgba(0,0,0,.35); transition: transform .2s; background-image: var(--v-texture); background-size: var(--v-texture-size); }
.vcard:hover { transform: translateY(-3px) rotate(-.2deg); }
.vcard-img { aspect-ratio: 4/3; overflow: hidden; margin: 10px 10px 0; }
.vcard-img img { width: 100%; height: 100%; object-fit: cover; }
.vcard-body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; align-content: start; }
.vcard .kicker { color: var(--v-accent); }
.vcard h3 { font-family: var(--v-head); font-size: calc(1.25rem * var(--v-head-scale, 1)); margin: 0; color: var(--v-ink); }
.vcard-ex { margin: 0; font-family: var(--v-body); color: var(--v-muted); font-size: calc(.95rem * var(--v-body-scale, 1)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vcard-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-family: var(--sans); font-size: .78rem; color: var(--v-muted); }
.feature { margin-bottom: 40px; }
.vcard.big { flex-direction: row; }
.vcard.big .vcard-img { flex: 1.3; aspect-ratio: auto; min-height: 340px; margin: 12px; }
.vcard.big .vcard-body { flex: 1; padding: 28px; align-content: center; }
.vcard.big h3 { font-size: calc(2rem * var(--v-head-scale, 1)); }
@media (max-width: 720px) { .vcard.big { flex-direction: column; } .vcard.big .vcard-img { min-height: 220px; } }
.talks { display: grid; }
.talk { display: flex; gap: 14px; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.talk h3 { font-size: 1.08rem; margin: 2px 0; }
.talk:hover h3 { text-decoration: underline; }
.talk-side { display: grid; text-align: right; font-family: var(--sans); font-size: .75rem; color: var(--muted); align-content: start; min-width: 70px; }
.talk-side b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; color: var(--ink); }
.side-box { border-top: 2px solid var(--ink); padding-top: 12px; margin-bottom: 32px; }
.side-box h2 { font-size: 1.2rem; }
.side-box .talk { padding: 10px 0; }
.side-box .talk-side { display: none; }
.more-link { display: inline-block; margin-top: 10px; font-family: var(--sans); font-size: .85rem; color: var(--accent); }
.space-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.space-line span { font-family: var(--sans); font-size: .78rem; color: var(--muted); }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--rule); margin-bottom: 22px; font-family: var(--sans); }
.tab { border: 0; background: none; padding: 10px 0; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }

/* ---- espais ---- */
.spaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 20px; }
.space-card { display: grid; grid-template-columns: 110px 1fr; gap: 16px; text-decoration: none; padding: 14px; background: var(--surface); border: 1px solid var(--rule); }
.space-card img, .space-blank { width: 110px; height: 110px; object-fit: cover; }
.space-blank { background: repeating-linear-gradient(135deg, var(--rule) 0 1px, transparent 1px 9px); }
.space-card h3 { font-size: 1.2rem; margin: 4px 0; }
.space-card p { margin: 0 0 6px; font-size: .95rem; }

/* ---- mapa, llocs, persones ---- */
.map-big { height: min(62vh, 560px); border: 1px solid var(--rule); z-index: 0; }
.map-mid { height: 320px; border: 1px solid var(--rule); z-index: 0; margin-bottom: 10px; }
.map-dot span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c, #23211d); color: #fbf8f1;
  font: 600 12px/1 var(--sans); border: 2px solid #fbf8f1; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mpop { display: grid; gap: 4px; width: 200px; font-family: var(--serif); }
.mpop img { width: 100%; height: 110px; object-fit: cover; margin-bottom: 4px; }
.mpop a { font-family: var(--display); font-size: 1.05rem; color: #23211d; }
.mpop span { font: .78rem var(--sans); color: #6f685c; }
.index { columns: 3 220px; column-gap: 40px; margin-top: 36px; }
.index-l { break-inside: avoid; margin-bottom: 18px; }
.index-l h3 { font-size: 1.4rem; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.index-l a { display: flex; align-items: baseline; gap: 6px; text-decoration: none; padding: 2px 0; }
.index-l a i { flex: 1; border-bottom: 1px dotted var(--rule); }
.index-l a em { font-style: normal; font-family: var(--sans); font-size: .8rem; color: var(--muted); }
.index-l a:hover span { text-decoration: underline; }
.wall { columns: 4 160px; column-gap: 8px; }
.wall button { display: block; width: 100%; padding: 0; border: 0; margin-bottom: 8px; cursor: zoom-in; background: none; }
.wall img { width: 100%; }
.people { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.people .person, .person-tag { padding: 3px 10px; border: 1px solid var(--rule); border-radius: 99px; text-decoration: none; font-family: var(--sans); font-size: .85rem; background: var(--surface); }
.people em { font-style: normal; color: var(--muted); }

/* =========================================================
   El vlog: temes (paper, lletra, color)
   ========================================================= */
.vlog, .vcard { --v-bg: #f8f3e6; --v-ink: #2a2620; --v-muted: #6d6556; --v-rule: #ddd2bb; --v-texture: none; --v-texture-size: auto;
  --v-head: var(--display); --v-body: var(--serif); --v-accent: #2f4a7a; }
[data-paper="kraft"] { --v-bg: #d9c6a3; --v-ink: #34281a; --v-muted: #5f4d36; --v-rule: #bfa67e;
  --v-texture: radial-gradient(rgba(80,55,25,.10) 1px, transparent 1.2px); --v-texture-size: 7px 7px; }
[data-paper="quadricula"] { --v-bg: #fbfaf5; --v-ink: #24282c; --v-muted: #5f6870; --v-rule: #cfd8e0;
  --v-texture: linear-gradient(rgba(110,140,170,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(110,140,170,.18) 1px, transparent 1px); --v-texture-size: 22px 22px; }
[data-paper="blanc"] { --v-bg: #ffffff; --v-ink: #1c1c1c; --v-muted: #6b6b6b; --v-rule: #e3e3e3; }
[data-paper="nit"] { --v-bg: #1f2227; --v-ink: #ece6da; --v-muted: #a9a294; --v-rule: #3a3e45;
  --v-texture: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.2px); --v-texture-size: 9px 9px; }
[data-paper="nit"] .stk, [data-paper="nit"].vcard .kicker { filter: brightness(1.5); }
[data-font="manuscrita"] { --v-head: var(--hand); --v-body: var(--hand); --v-head-scale: 1.45; --v-body-scale: 1.35; }
[data-font="maquina"] { --v-head: var(--type); --v-body: var(--type); --v-body-scale: .92; }
[data-font="senzilla"] { --v-head: var(--sans); --v-body: var(--sans); --v-body-scale: .95; }

.vlog { background-color: var(--v-bg); background-image: var(--v-texture); background-size: var(--v-texture-size); color: var(--v-ink);
  font-family: var(--v-body); font-size: calc(1.08rem * var(--v-body-scale, 1)); border: 1px solid var(--rule);
  box-shadow: 0 30px 60px -40px rgba(0,0,0,.45); padding: 0 0 40px; overflow: hidden; }
.v-page { max-width: 860px; margin: 0 auto; }
.v-head { padding: 40px clamp(18px, 6vw, 72px) 10px; }
.v-head .kicker { color: var(--v-accent); }
.v-title { font-family: var(--v-head); font-weight: 400; font-size: calc(clamp(2rem, 5.5vw, 3.2rem) * var(--v-head-scale, 1)); line-height: 1.1; margin: 8px 0 12px; color: var(--v-ink); }
[data-font="classica"] .v-title { font-weight: 700; }
.v-sub { font-size: 1.2em; font-style: italic; color: var(--v-muted); margin: 0 0 14px; }
[data-font="manuscrita"] .v-sub, [data-font="maquina"] .v-sub { font-style: normal; }
.v-meta { font-family: var(--sans); font-size: .82rem; color: var(--v-muted); margin: 0; letter-spacing: .01em; }
.v-meta a { color: var(--v-ink); }
.v-blocks, .ed-blocks { padding: 0 clamp(18px, 6vw, 72px); }
.vb { position: relative; margin: 26px 0; }
.v-tags { padding: 0 clamp(18px, 6vw, 72px); color: var(--v-accent); font-family: var(--sans); font-size: .85rem; }
.v-map { height: 260px; margin: 30px clamp(18px, 6vw, 72px) 0; border: 1px solid var(--v-rule); z-index: 0; }
/* portada */
.v-cover.c-gran img { width: 100%; max-height: 72vh; object-fit: cover; }
.v-cover.c-polaroid { padding: 40px 20px 0; display: flex; justify-content: center; }
.v-cover.c-polaroid img { width: min(78%, 520px); background: #fff; padding: 14px 14px 56px; box-shadow: 0 14px 30px -14px rgba(0,0,0,.5); transform: rotate(-2deg); }
/* blocs */
.b-text p { margin: 0 0 1em; }
.b-text.center { text-align: center; }
.b-heading { font-family: var(--v-head); font-size: calc(1.7rem * var(--v-head-scale, 1)); color: var(--v-ink); margin: 0; }
figure { margin: 0; }
figcaption { font-family: var(--hand); font-size: 1.3rem; color: var(--v-muted); text-align: center; margin-top: 8px; }
.b-photo img, .b-gallery img { cursor: zoom-in; }
.b-photo.s-gran { margin: 0 calc(-1 * clamp(18px, 6vw, 72px)); }
.b-photo.s-gran img { width: 100%; }
.b-photo.s-polaroid .ph { background: #fff; padding: 12px 12px 48px; width: min(86%, 480px); margin: 0 auto; box-shadow: 0 12px 26px -14px rgba(0,0,0,.5); transform: rotate(1.6deg); }
.b-photo.s-marc .ph { border: 10px solid var(--v-bg); outline: 1px solid var(--v-ink); outline-offset: -4px; box-shadow: 0 0 0 1px var(--v-rule); }
.b-photo.s-rodona .ph { width: min(70%, 380px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; overflow: hidden; border: 4px solid var(--v-accent); }
.b-photo.s-rodona img { width: 100%; height: 100%; object-fit: cover; }
.b-photo .ph { position: relative; }
.gal { display: grid; gap: 8px; }
.l-quadricula .gal { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.l-quadricula .gal img, .l-quadricula .gal-it img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.l-collage .gal { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 120px; }
.l-collage .gal > * { grid-column: span 2; }
.l-collage .gal > *:nth-child(5n+1) { grid-column: span 4; grid-row: span 2; }
.l-collage .gal img { width: 100%; height: 100%; object-fit: cover; }
.l-collage.n1 .gal > * { grid-column: span 6; grid-row: span 3; }
.l-collage.n2 .gal > * { grid-column: span 3; grid-row: span 2; }
@media (max-width: 600px) { .l-collage .gal { grid-auto-rows: 80px; } }
.l-tira .gal { grid-auto-flow: column; grid-auto-columns: 46%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.l-tira .gal > * { scroll-snap-align: start; }
.l-tira .gal img { aspect-ratio: 4/5; object-fit: cover; width: 100%; background: #fff; padding: 6px 6px 24px; box-shadow: 0 6px 14px -8px rgba(0,0,0,.4); }
.b-video video { width: 100%; background: #000; }
.ratio { aspect-ratio: 16/9; background: #000; }
.ratio iframe { width: 100%; height: 100%; border: 0; }
.b-quote { margin: 0; padding: 6px 0 6px 22px; border-left: 3px solid var(--v-accent); }
.b-quote p { font-family: var(--v-head); font-size: calc(1.45rem * var(--v-head-scale, 1)); line-height: 1.35; margin: 0 0 6px; font-style: italic; }
[data-font="manuscrita"] .b-quote p, [data-font="maquina"] .b-quote p { font-style: normal; }
.b-quote cite { font-family: var(--sans); font-size: .82rem; font-style: normal; color: var(--v-muted); }
.b-quote cite::before { content: '— '; }
.b-divider { color: var(--v-accent); display: flex; justify-content: center; }
.b-divider svg { width: 200px; height: 24px; }
.b-divider.d-linia { border-top: 1px solid var(--v-rule); }
.b-divider.d-punts::before { content: '·   ·   ·'; white-space: pre; font-size: 1.6rem; letter-spacing: .2em; }
.b-stickers { min-height: 170px; }
/* adhesius */
.stk-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.stk { position: absolute; transform: translate(-50%, -50%); color: var(--v-accent); min-width: 34px; max-width: 70%; pointer-events: none; }
.stk svg { width: 100%; height: auto; display: block; transform: rotate(var(--r, 0deg)); filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); overflow: visible; }
.stk text { font-family: inherit; }

/* ---- pàgina d'un vlog ---- */
.post-wrap { max-width: 860px; margin: 0 auto; }
.crumbs { font-family: var(--sans); font-size: .85rem; color: var(--muted); margin: 20px 0 14px; }
.crumbs a { color: var(--muted); }
.post-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 22px 0; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; }
.react { border: 1px solid var(--rule); background: var(--surface); padding: 6px 12px; border-radius: 99px; cursor: pointer; font-family: var(--sans); font-size: .84rem; }
.react b { font-weight: 600; margin-left: 2px; }
.react.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.comments { border-top: 1px solid var(--rule); padding-top: 22px; }
.comments h2 { font-size: 1.4rem; }
.comment { padding: 12px 0; border-bottom: 1px dashed var(--rule); }
.c-head { margin: 0 0 4px; font-family: var(--sans); font-size: .85rem; display: flex; gap: 8px; align-items: baseline; }
.c-head .person { font-weight: 600; text-decoration: none; }
.c-head .link-btn { margin-left: auto; font-size: .8rem; }
.c-body { margin: 0; white-space: pre-wrap; word-break: break-word; }
.comment-form { display: grid; gap: 8px; margin-top: 18px; }
.letter { background: var(--surface); border: 1px solid var(--rule); padding: clamp(20px, 5vw, 48px); }
.letter h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 8px 0; }
.letter-body { margin-top: 18px; font-size: 1.08rem; }

/* ---- visor de fotos ---- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(12,11,10,.95); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 88vh; object-fit: contain; }
.lightbox button { position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 50%; width: 46px; height: 46px; font-size: 1.6rem; cursor: pointer; display: grid; place-items: center; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 16px; color: #ddd; font-family: var(--sans); font-size: .85rem; }
.lb-count a { color: #fff; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 160%); z-index: 200; background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 3px; font-family: var(--sans); font-size: .92rem; transition: transform .25s; max-width: calc(100vw - 32px); }
#toast.show { transform: translate(-50%, 0); }
@media (max-width: 760px) { #toast { bottom: 80px; } body.editing #toast { bottom: 120px; } }

/* =========================================================
   Editor
   ========================================================= */
body.editing main { max-width: 1320px; }
body.editing .footer { display: none; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; padding-top: 16px; }
.ed-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ed-canvas { max-width: 860px; margin: 0 auto; }
.ed-canvas textarea, .ed-canvas input:not([type=file]) { border: 0; background: transparent; padding: 0; width: 100%; resize: none; border-radius: 0;
  color: inherit; font: inherit; line-height: inherit; overflow: hidden; }
.ed-canvas textarea:focus, .ed-canvas input:focus { outline: none; box-shadow: 0 1px 0 var(--v-accent); }
.ed-canvas ::placeholder { color: var(--v-muted); opacity: .65; }
.ed-title { font-family: var(--v-head) !important; font-size: calc(clamp(2rem, 5.5vw, 3.2rem) * var(--v-head-scale, 1)) !important; line-height: 1.1 !important; }
[data-font="classica"] .ed-title { font-weight: 700 !important; }
.ed-sub { font-size: 1.2em !important; font-style: italic; color: var(--v-muted) !important; margin-bottom: 8px; }
.ed-meta { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.ed-meta em { color: var(--v-accent); font-style: normal; }
.ed-heading { font-family: var(--v-head) !important; font-size: calc(1.7rem * var(--v-head-scale, 1)) !important; }
.ed-cap { font-family: var(--hand) !important; font-size: 1.3rem !important; text-align: center; margin-top: 8px; color: var(--v-muted) !important; }
.b-quote .ed-text { font-family: var(--v-head) !important; font-size: calc(1.45rem * var(--v-head-scale, 1)) !important; font-style: italic; }
.b-quote .ed-cap { text-align: left; font-family: var(--sans) !important; font-size: .85rem !important; }
.ed-url { font-family: var(--sans) !important; font-size: .9rem !important; border-bottom: 1px dashed var(--v-rule) !important; padding: 6px 0 !important; margin-bottom: 10px; }
.ed-block { position: relative; margin: 8px 0; padding: 4px 0; border-radius: 4px; }
.ed-block .vb { margin: 0; }
.ed-bar { display: flex; align-items: center; gap: 4px; font-family: var(--sans); font-size: .75rem; color: var(--v-muted); opacity: 0; transition: opacity .15s; height: 30px; }
.ed-block:hover .ed-bar, .ed-block.sel .ed-bar, .ed-block:focus-within .ed-bar { opacity: 1; }
@media (hover: none) { .ed-block.sel .ed-bar { opacity: 1; } .ed-bar { opacity: .55; } }
.ed-bar button, .ed-bar .handle { background: none; border: 0; padding: 4px; cursor: pointer; color: var(--v-muted); display: grid; place-items: center; border-radius: 3px; }
.ed-bar button:hover { background: color-mix(in srgb, var(--v-ink) 10%, transparent); color: var(--v-ink); }
.ed-bar .handle { cursor: grab; }
.ed-bar .lbl { text-transform: uppercase; letter-spacing: .1em; margin-right: 6px; }
.ed-bar select { width: auto; padding: 2px 6px; font-family: var(--sans); font-size: .75rem; background: transparent; border: 1px solid var(--v-rule); color: var(--v-ink); }
.ed-block.sel { box-shadow: -10px 0 0 -8px var(--v-accent); }
.ed-block.dragging { opacity: .35; }
.ed-block.drop-before::before, .ed-block.drop-after::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: var(--v-accent); border-radius: 2px; }
.ed-block.drop-before::before { top: -6px; }
.ed-block.drop-after::after { bottom: -6px; }
.drop-target { outline: 2px dashed var(--v-accent) !important; outline-offset: 4px; }
.ed-drop { width: 100%; display: grid; justify-items: center; gap: 4px; padding: 28px 16px; border: 1.5px dashed var(--v-rule); background: color-mix(in srgb, var(--v-bg) 70%, #fff 30%);
  color: var(--v-muted); cursor: pointer; font-family: var(--sans); font-size: .85rem; border-radius: 4px; }
.ed-drop b { color: var(--v-ink); font-weight: 500; font-size: .95rem; }
.ed-drop .ico { width: 26px; height: 26px; }
.ed-drop:hover { border-color: var(--v-accent); color: var(--v-ink); }
.ed-drop.slim { padding: 12px; margin-top: 8px; grid-auto-flow: column; justify-content: center; align-items: center; }
.ed-drop.slim .ico { width: 18px; height: 18px; }
.cover-drop { margin: 20px clamp(18px, 6vw, 72px) 0; width: auto; }
.ed-cover-has { position: relative; }
.ed-cover-tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.ed-cover-tools .btn { background: rgba(255,255,255,.9); color: #222; border-color: transparent; }
.gal-it { position: relative; }
.gal-it .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.gal-it .x .ico { width: 14px; height: 14px; }
.up-prog { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 22px; background: rgba(0,0,0,.6); border-radius: 3px; overflow: hidden; display: grid; z-index: 2; }
.up-prog span { grid-area: 1/1; background: var(--v-accent); height: 100%; transition: width .2s; }
.up-prog em { grid-area: 1/1; font: 500 .72rem/22px var(--sans); color: #fff; text-align: center; font-style: normal; }
.ed-stk-zone { display: grid; place-items: center; border: 1.5px dashed var(--v-rule); border-radius: 4px; }
.ed-body .stk { pointer-events: auto; cursor: grab; touch-action: none; }
.ed-body .stk.sel { outline: 1.5px dashed var(--v-accent); outline-offset: 4px; z-index: 5; }
.stk-tools { display: none; position: absolute; left: 50%; top: 100%; transform: translate(-50%, 10px); gap: 2px; background: var(--ink); padding: 3px; border-radius: 4px; z-index: 6; }
.stk.sel .stk-tools { display: flex; }
.stk-tools button { background: none; border: 0; color: var(--bg); width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; padding: 0; border-radius: 3px; }
.stk-tools button:hover { background: rgba(255,255,255,.15); }
.ed-end { padding: 24px clamp(18px, 6vw, 72px) 0; border-top: 1px dashed var(--v-rule); margin-top: 20px; text-align: center; }
.ed-quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--v-rule); background: transparent; color: var(--v-ink); cursor: pointer; border-radius: 99px; font-family: var(--sans); font-size: .82rem; }
.chip-btn:hover { border-color: var(--v-ink); }
.ed-empty { padding: 30px 0; }
/* panell lateral */
.ed-side { position: sticky; top: 72px; background: var(--surface); border: 1px solid var(--rule); max-height: calc(100vh - 90px); display: flex; flex-direction: column; font-family: var(--sans); }
.ed-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--rule); }
.ed-tabs button { background: none; border: 0; padding: 10px 4px; cursor: pointer; display: grid; justify-items: center; gap: 2px; font-size: .74rem; color: var(--muted); border-bottom: 2px solid transparent; }
.ed-tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.ed-panel { display: none; padding: 16px; overflow-y: auto; gap: 12px; }
.ed-panel.on { display: grid; align-content: start; }
.ed-panel h4 { margin: 8px 0 0; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.ed-panel p { margin: 0; }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pal { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--rule); background: var(--bg); cursor: grab; font-size: .85rem; text-align: left; border-radius: 3px; }
.pal:hover { border-color: var(--ink); }
.stk-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tray-stk { aspect-ratio: 1; display: grid; place-items: center; padding: 8px; border: 1px solid var(--rule); background: #f8f3e6; cursor: grab; border-radius: 3px; }
.tray-stk svg { width: 100%; max-height: 100%; }
.tray-stk:hover, .tray-stk.armed { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt-row { display: flex; flex-wrap: wrap; gap: 6px; }
.opt-row button { cursor: pointer; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); }
.opt-row button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.swatch { width: 58px; height: 58px; display: flex; align-items: flex-end; padding: 4px; font-size: .68rem; }
.paper-paper { background: #f8f3e6 !important; color: #2a2620; }
.paper-kraft { background: #d9c6a3 radial-gradient(rgba(80,55,25,.12) 1px, transparent 1.2px) 0 0/6px 6px !important; color: #34281a; }
.paper-quadricula { background: #fbfaf5 linear-gradient(rgba(110,140,170,.25) 1px, transparent 1px) 0 0/10px 10px, linear-gradient(90deg, rgba(110,140,170,.25) 1px, #fbfaf5 1px) 0 0/10px 10px !important; color: #24282c; }
.paper-blanc { background: #fff !important; color: #1c1c1c; }
.paper-nit { background: #1f2227 !important; color: #ece6da; }
.font-opt { display: grid; padding: 6px 10px; text-align: left; min-width: 88px; }
.font-opt b { font-size: 1.4rem; font-weight: 400; }
.font-opt span { font-size: .7rem; color: var(--muted); }
.f-classica b { font-family: var(--display); } .f-manuscrita b { font-family: var(--hand); font-size: 1.8rem; } .f-maquina b { font-family: var(--type); } .f-senzilla b { font-family: var(--sans); }
.ink { width: 34px; height: 34px; border-radius: 50% !important; background: var(--c) !important; border: 3px solid var(--surface) !important; box-shadow: 0 0 0 1px var(--rule); }
.ink.on { box-shadow: 0 0 0 2px var(--ink) !important; }
.txt-opt { padding: 7px 12px; font-size: .82rem; }
.pick-map { height: 200px; z-index: 0; border: 1px solid var(--rule); }
.row-btns { display: flex; gap: 6px; margin-top: 6px; }
.ed-panel input, .ed-panel select { font-family: var(--sans); font-size: .9rem; padding: 8px 10px; }
/* previsualitzar */
.editor.previewing { grid-template-columns: 1fr; }
.editor.previewing .ed-side, .editor.previewing .ed-bar, .editor.previewing .ed-end, .editor.previewing .ed-drop, .editor.previewing .stk-tools,
.editor.previewing .gal-it .x, .editor.previewing .ed-meta em, .editor.previewing .ed-cover-tools, .editor.previewing .ed-stk-zone > span { display: none !important; }
.editor.previewing .ed-stk-zone { border: 0; }
.editor.previewing ::placeholder { color: transparent; }
.editor.previewing .ed-block.sel { box-shadow: none; }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; padding-bottom: 80px; }
  .ed-top { position: sticky; top: 53px; z-index: 40; background: var(--bg); padding: 8px 0; margin: 0; }
  .ed-canvas { margin: 0 -16px; border-left: 0; border-right: 0; }
  .ed-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: none; z-index: 70; border-width: 1px 0 0; box-shadow: 0 -10px 30px -18px rgba(0,0,0,.4);
    padding-bottom: env(safe-area-inset-bottom); }
  .ed-side .ed-panel { max-height: 52vh; }
  .ed-side:not(.open) .ed-panel { display: none; }
  .ed-side:not(.open) .ed-tabs button { border-bottom-color: transparent; color: var(--muted); }
  .ed-tabs { order: 2; border-bottom: 0; border-top: 1px solid var(--rule); }
  .stk-tray { grid-template-columns: repeat(4, 1fr); }
  .palette { grid-template-columns: repeat(3, 1fr); }
  .pal { flex-direction: column; text-align: center; font-size: .75rem; }
  .editor.previewing { padding-bottom: 0; }
}

/* =========================================================
   Tipografies del relat (to editorial)
   ========================================================= */
[data-font="elegant"] { --v-head: 'Playfair Display', Georgia, serif; --v-body: var(--serif); }
[data-font="condensada"] { --v-head: 'Oswald', 'Arial Narrow', sans-serif; --v-body: var(--serif); --v-head-scale: 1.05; }
[data-font="condensada"] .v-title, [data-font="condensada"] .b-heading, [data-font="condensada"].vcard h3 { text-transform: uppercase; letter-spacing: .02em; font-weight: 600 !important; }
[data-font="manuscrita"] { --v-body: var(--serif); --v-body-scale: 1; }
figcaption { font-family: var(--serif); font-style: italic; font-size: .9rem; }
.ed-cap { font-family: var(--serif) !important; font-style: italic; font-size: .9rem !important; }
.b-photo.s-polaroid .ph { transform: none; padding: 10px 10px 34px; }
.v-cover.c-polaroid img { transform: none; padding: 12px 12px 40px; }

/* ---- text enriquit ---- */
.rt p { margin: 0 0 .9em; }
.rt p:last-child { margin-bottom: 0; }
.rt { position: relative; overflow-wrap: anywhere; }
.rt[contenteditable="true"] { outline: none; min-height: 1.6em; cursor: text; }
.rt.is-empty::before { content: attr(data-ph); position: absolute; color: var(--v-muted); opacity: .6; pointer-events: none; }
.box-marc { border: 1.5px solid var(--v-ink); padding: 14px 18px; }
.box-nota { background: var(--bc, #f3ead2); color: #2a2620; padding: 16px 18px; box-shadow: 0 8px 18px -12px rgba(0,0,0,.45); }
.box-fons { background: var(--bc, #f3ead2); color: #2a2620; padding: 14px 18px; border-radius: 2px; }
.box-cinta { background: var(--bc, #fbf8f1); color: #2a2620; padding: 22px 18px 16px; position: relative; box-shadow: 0 6px 16px -12px rgba(0,0,0,.45); }
.box-cinta::before { content: ''; position: absolute; top: -9px; left: 50%; width: 90px; height: 20px; transform: translateX(-50%) rotate(-2deg); background: rgba(205,187,151,.85); }
.box-marc.rt.is-empty::before, .box-nota.rt.is-empty::before { left: 18px; }

/* ---- barra de format ---- */
.rt-bar { position: sticky; top: 57px; z-index: 45; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--rule); font-family: var(--sans); font-size: .85rem; opacity: .45; pointer-events: none; transition: opacity .15s; }
.rt-bar:not(.active) { position: static; }
.rt-bar.active { opacity: 1; pointer-events: auto; box-shadow: 0 8px 20px -16px rgba(0,0,0,.5); }
.rt-bar button { min-width: 30px; height: 30px; border: 0; background: none; cursor: pointer; border-radius: 3px; color: var(--ink); display: inline-grid; place-items: center; padding: 0 6px; font-size: .9rem; }
.rt-bar button:hover { background: var(--bg); }
.rt-bar button.on { background: var(--ink); color: var(--bg); }
.rt-bar select { width: auto; padding: 4px 6px; font-family: var(--sans); font-size: .82rem; height: 30px; }
.rt-bar .sep { width: 1px; height: 20px; background: var(--rule); margin: 0 4px; }
.a-color { border-bottom: 3px solid currentColor; line-height: 1; padding: 0 2px; font-weight: 600; }
.a-mark { background: #f6e27a; color: #222; padding: 0 3px; }
.rt-pop { position: relative; }
.pop { display: none; position: absolute; top: 34px; left: 0; z-index: 5; background: var(--surface); border: 1px solid var(--rule); padding: 6px; gap: 4px; flex-wrap: wrap; width: 180px; box-shadow: 0 10px 24px -14px rgba(0,0,0,.4); }
.pop.open { display: flex; }
.pop button { width: 26px; height: 26px; min-width: 0; border-radius: 50%; background: var(--c) !important; border: 1px solid var(--rule); padding: 0; }
.pop button.none { background: linear-gradient(135deg, transparent 45%, #b33 45% 55%, transparent 55%) !important; }
.pop .custom { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; border: 1px dashed var(--muted); position: relative; }
.pop .custom input { position: absolute; inset: -6px; width: 40px; height: 40px; border: 0; padding: 0; cursor: pointer; }
@media (max-width: 900px) { .rt-bar { top: 104px; overflow-x: auto; flex-wrap: nowrap; } .rt-bar:not(.active) { display: none; } }

/* ---- marcs dels blocs (amplada, posició, gir) ---- */
.frame { position: relative; transform: rotate(var(--fr, 0deg)); }
.frame.pos-c { margin-left: auto; margin-right: auto; }
.frame.pos-r { margin-left: auto; }
.frame.part .b-photo.s-gran { margin: 0; }
.h { display: none; position: absolute; z-index: 8; background: var(--surface); border: 1.5px solid var(--v-accent, var(--accent)); touch-action: none; }
.ed-block.sel > .ed-body > .frame > .h { display: block; }
.ed-block.sel > .ed-body > .frame { outline: 1px dashed var(--v-accent); outline-offset: 6px; }
.frame > .h-e, .frame > .h-w { top: 50%; width: 10px; height: 34px; margin-top: -17px; border-radius: 5px; cursor: ew-resize; }
.frame > .h-e { right: -11px; } .frame > .h-w { left: -11px; }
.h-rot { width: 16px; height: 16px; border-radius: 50%; left: 50%; top: -34px; margin-left: -8px; cursor: grab; }
.h-rot::after { content: ''; position: absolute; left: 6px; top: 15px; width: 1.5px; height: 17px; background: var(--v-accent, var(--accent)); }
.h-se { width: 14px; height: 14px; right: -8px; bottom: -8px; cursor: nwse-resize; border-radius: 2px; }
.h-s, .h-s2 { left: 50%; width: 34px; height: 10px; margin-left: -17px; border-radius: 5px; cursor: ns-resize; }
.h-s { bottom: -6px; } .h-s2 { bottom: -6px; }
@media (hover: none) { .h { transform: scale(1.4); } }
.seg { display: inline-flex; border: 1px solid var(--v-rule); border-radius: 3px; overflow: hidden; margin-left: 4px; }
.seg button { width: 26px; height: 24px !important; border-radius: 0 !important; font-size: .85rem; }
.seg button.on { background: var(--v-ink) !important; color: var(--v-bg) !important; }
.ed-bar .mini { width: auto !important; padding: 2px 8px !important; display: inline-flex !important; gap: 4px; font-size: .75rem; border: 1px solid var(--v-rule) !important; margin-left: 4px; }
.ed-bar input[type=color] { width: 26px; height: 24px; padding: 0; border: 1px solid var(--v-rule); background: none; }

/* ---- marques (adhesius) a l'editor ---- */
.ed-body .stk .h, .ed-body .stk .stk-del { display: none; }
.ed-body .stk.sel .h, .ed-body .stk.sel .stk-del { display: block; }
.stk .h-rot { top: -30px; }
.stk-del { position: absolute; top: -12px; right: -12px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); padding: 3px; cursor: pointer; z-index: 9; }
.stk-del .ico { width: 16px; height: 16px; }

/* ---- pàgina lliure ---- */
.b-free { position: relative; width: 100%; container-type: inline-size; isolation: isolate;
  /* res no es talla: si un element en surt, la pàgina deixa lloc (fitFreePage) i el fons s'hi allarga */
  overflow: visible; margin: var(--free-top, 0px) 0 var(--free-bottom, 0px); }
.b-free:not(.bg-cap)::before, .b-free:not(.bg-cap)::after { content: ''; position: absolute; left: 0; right: 0; background: inherit; z-index: -1; pointer-events: none; }
.b-free:not(.bg-cap)::before { bottom: 100%; height: var(--free-top, 0px); }
.b-free:not(.bg-cap)::after { top: 100%; height: var(--free-bottom, 0px); }
.b-freefig { display: flow-root; } /* que el marge de la pàgina no es fongui amb el del bloc */
.b-freefig > figcaption { margin-top: 10px; }
.fi.fi-photo { margin: 0; }
.fi-cap { position: absolute; left: 0; right: 0; top: 100%; margin: .45em 0 0 !important; padding: 0 2px; font-size: clamp(10px, 1.9cqw, 17px) !important; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.fi-photo.ps-polaroid > .fi-cap { margin-top: .6em !important; }
.b-free.bg-blanc { background: #fff; } .b-free.bg-paper { background: #fbf6ea; } .b-free.bg-kraft { background: #d6c3a0; }
.b-free.bg-fosc { background: #22252a; color: #ece6da; } .b-free.bg-tinta { background: var(--v-accent); color: #fff; }
.fi { position: absolute; transform: rotate(var(--r, 0deg)); }
.fi-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fi-photo.ps-polaroid { background: #fff; padding: 2.5% 2.5% 9%; box-shadow: 0 10px 22px -12px rgba(0,0,0,.5); }
.fi-photo.ps-marc { border: 6px solid var(--v-bg); outline: 1px solid var(--v-ink); }
.fi-photo.ps-rodona img { border-radius: 50%; }
.fi-text { font-size: clamp(8px, 2.25cqw, 40px); line-height: 1.45; }
.ed-free { outline: 1px dashed var(--v-rule); outline-offset: -1px; overflow: visible; }
.ed-free > .h-s { display: block; bottom: -6px; }
.free-hint { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px 14%; margin: 0; color: var(--v-muted); font-family: var(--sans); font-size: .85rem; pointer-events: none; }
.ed-free .fi { cursor: move; touch-action: none; user-select: none; }
.ed-free .fi.editing { cursor: text; user-select: text; }
.ed-free .fi.sel { outline: 1.5px solid var(--v-accent); outline-offset: 3px; z-index: 20; }
.ed-free .fi.sel > .h { display: block; }
.fi > .h-e { right: -9px; top: 50%; width: 10px; height: 28px; margin-top: -14px; border-radius: 5px; cursor: ew-resize; }
.fi-tools { display: none; position: absolute; left: 0; top: calc(100% + 12px); z-index: 25; background: var(--ink); padding: 3px; border-radius: 4px; gap: 2px; white-space: nowrap; transform: rotate(calc(-1 * var(--r, 0deg))); transform-origin: top left; }
.fi.sel:not(.editing) > .fi-tools { display: flex; }
/* a fotos i vídeos, la barra va a sobre: a sota hi ha el peu */
.fi-photo > .fi-tools { top: auto; bottom: calc(100% + 44px); transform-origin: bottom left; align-items: center; }
.ed-free .fi-tools input.fi-cap-in { display: block; flex: none; width: 15em !important; max-width: 46vw; height: auto; font: .75rem var(--sans) !important; padding: 5px 7px !important; border: 0 !important; border-radius: 3px; background: #fffdf8 !important; color: #23211d !important; margin: 0 3px; box-shadow: none; }
.ed-free .fi-cap:empty { display: none; }
.fi-tools button { background: none; border: 0; color: var(--bg); font: .72rem var(--sans); padding: 5px 8px; cursor: pointer; border-radius: 3px; display: inline-flex; align-items: center; }
.fi-tools button:hover { background: rgba(255,255,255,.15); }
.fi-tools .ico { width: 15px; height: 15px; }
.fi-color { display: inline-flex; align-items: center; padding: 0 4px; }
.fi-color input { width: 22px; height: 22px; border: 0; padding: 0; background: none; }

/* ---- fitxa (inspirada en les fitxes tècniques dels blogs d'escalada) ---- */
.b-fitxa { border-top: 2px solid var(--v-ink); border-bottom: 1px solid var(--v-ink); padding: 12px 0 10px; font-family: var(--sans); font-size: .9rem; }
.b-fitxa h3 { font-family: var(--sans); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--v-accent); margin: 0 0 8px; }
.b-fitxa dl { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 18px; margin: 0; }
.b-fitxa dt { color: var(--v-muted); }
.b-fitxa dd { margin: 0; color: var(--v-ink); }
.ed-fitxa-title { font-family: var(--sans) !important; font-size: .72rem !important; letter-spacing: .14em; text-transform: uppercase; color: var(--v-accent) !important; margin-bottom: 8px; }
.frow { display: grid; grid-template-columns: 150px 1fr 26px; gap: 10px; border-bottom: 1px dotted var(--v-rule); padding: 4px 0; align-items: center; }
.frow input[data-rf="l"] { color: var(--v-muted) !important; }
.x-row { background: none; border: 0; color: var(--v-muted); cursor: pointer; padding: 2px; display: grid; place-items: center; }
.ed-fitxa .link-btn { margin-top: 8px; font-family: var(--sans); font-size: .82rem; color: var(--v-accent); }
@media (max-width: 560px) { .b-fitxa dl { grid-template-columns: 1fr; gap: 0 0; } .b-fitxa dd { margin-bottom: 6px; } .frow { grid-template-columns: 110px 1fr 22px; } }

/* ---- etiquetar companys ---- */
.tagger { position: relative; display: grid; gap: 6px; }
.tags-sel { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px solid var(--ink); border-radius: 99px; font-size: .82rem; }
.tag-chip em { font-style: normal; color: var(--muted); }
.tag-chip button { border: 0; background: none; cursor: pointer; padding: 0; display: grid; place-items: center; }
.tag-chip .ico { width: 14px; height: 14px; }
.tag-sug { display: grid; border: 1px solid var(--rule); background: var(--surface); max-height: 220px; overflow: auto; }
.tag-sug button { text-align: left; padding: 8px 10px; background: none; border: 0; border-bottom: 1px solid var(--rule); cursor: pointer; font: inherit; }
.tag-sug button:hover { background: var(--bg); }
.tag-sug em { font-style: normal; color: var(--muted); }
.tag-sug .muted { padding: 8px 10px; }

/* ---- comptes, perfil i xarxa ---- */
.me-link { font-weight: 500; }
.me-mobile { display: none; font-family: var(--sans); font-size: .9rem; text-decoration: none; }
@media (max-width: 760px) { .me-mobile { display: inline; } }
.auth-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 24px; margin-bottom: 20px; }
.form-card { display: grid; gap: 14px; padding: 24px; background: var(--surface); border: 1px solid var(--rule); align-content: start; }
.form-card h2 { font-size: 1.3rem; margin: 0; }
.profile-head { display: flex; gap: 24px; align-items: flex-start; max-width: none; }
.avatar { width: 92px; height: 92px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); font: 400 2rem var(--display); }
@media (max-width: 560px) { .profile-head { flex-direction: column; } .avatar { width: 70px; height: 70px; font-size: 1.5rem; } }
.tab-body { min-height: 120px; }
.net { border: 1px solid var(--rule); background: var(--surface); }
.net svg { width: 100%; height: auto; display: block; }
.net line { stroke: var(--muted); stroke-opacity: .45; transition: stroke-opacity .15s; }
.net circle { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; transition: fill .15s; }
.net .center circle { fill: var(--ink); }
.net text { font: 500 13px var(--sans); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.net a:hover circle, .net a.on circle { fill: var(--accent); stroke: var(--accent); }
.net svg.hl line { stroke-opacity: .12; }
.net svg.hl line.on { stroke: var(--accent); stroke-opacity: .9; }
.net.big { min-height: 300px; }
.btn.on { background: var(--ink); color: var(--bg); }
.letter-body .vb { margin: 0; }


/* =========================================================
   Blocs de guia, inserció ràpida, plantilles, ascensions
   ========================================================= */
/* inserir blocs entre blocs */
.ins { position: relative; height: 14px; margin: -2px 0; display: flex; justify-content: center; align-items: center; }
.ins::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--v-accent); opacity: 0; transition: opacity .15s; }
.ins button { position: relative; z-index: 2; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--v-accent); background: var(--v-bg); color: var(--v-accent); font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s; }
.ins:hover::before, .ins:hover button, .ins:focus-within button { opacity: 1; }
@media (hover: none) { .ins button { opacity: .55; } }
.editor.previewing .ins { display: none; }
.blk-menu { position: fixed; z-index: 120; width: 260px; max-height: 330px; overflow: auto; background: var(--surface); border: 1px solid var(--rule); box-shadow: 0 18px 40px -20px rgba(0,0,0,.5); padding: 4px; font-family: var(--sans); }
.blk-menu button { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; cursor: pointer; font-size: .9rem; color: var(--ink); border-radius: 3px; }
.blk-menu button small { color: var(--muted); font-size: .7rem; }
.blk-menu button.on, .blk-menu button:hover { background: var(--bg); }
.blk-menu p { padding: 8px 10px; margin: 0; }
.icon-only { font-size: 1.1rem; padding: 4px 10px; }
.ed-panel h4 + .palette { margin-top: 0; }

/* plantilles */
.tpl { margin: 10px clamp(18px, 6vw, 72px) 6px; padding: 16px; border: 1px dashed var(--v-rule); }
.tpl-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.tpl-btn { display: grid; gap: 3px; text-align: left; padding: 12px; border: 1px solid var(--v-rule); background: color-mix(in srgb, var(--v-bg) 60%, #fff 40%); cursor: pointer; font-family: var(--sans); color: var(--v-ink); }
.tpl-btn:hover { border-color: var(--v-ink); }
.tpl-btn span { font-size: .78rem; color: var(--v-muted); }
.tpl-btn.ghost { background: transparent; }

/* mapa i ruta */
.b-map h3, .b-pitches h3, .b-refs h3 { font-family: var(--sans); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--v-accent); margin: 0 0 8px; font-weight: 500; }
.map-box { height: 380px; border: 1px solid var(--v-rule); z-index: 0; }
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-family: var(--sans); font-size: .82rem; }
.map-tools select, .map-search { width: auto; padding: 5px 8px; font-size: .82rem; font-family: var(--sans); }
.map-search { flex: 1; min-width: 160px; border: 1px solid var(--v-rule) !important; background: var(--v-bg) !important; padding: 5px 8px !important; }
.map-tools .mini, .topo-tools .mini { padding: 4px 10px; border: 1px solid var(--v-rule); background: transparent; cursor: pointer; font: .78rem var(--sans); color: var(--v-ink); border-radius: 3px; }
.map-stats { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 0 4px; font-family: var(--sans); font-size: .82rem; color: var(--v-muted); }
.map-stats b { color: var(--v-ink); font-size: 1.05rem; font-weight: 600; }
.profile { width: 100%; height: 90px; display: block; }
.pf-fill { fill: color-mix(in srgb, var(--v-accent) 18%, transparent); }
.pf-line { fill: none; stroke: var(--v-accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.profile text { font: 10px var(--sans); fill: var(--v-muted); }
.map-legend { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-family: var(--sans); font-size: .85rem; }
.map-legend li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; }
.map-legend a, .maplinks a { color: var(--v-accent, var(--accent)); font-family: var(--sans); font-size: .82rem; }
.map-actions { margin-top: 8px; font-family: var(--sans); font-size: .82rem; }
.mk { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #1f2a44; color: #fff; font: 700 11px/1 var(--sans); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.mk-aparcament { background: #2f6fd6; } .mk-inici { background: #3d8a4a; } .mk-via { background: #c0532d; } .mk-cim { background: #1b1b1b; }
.mk-refugi { background: #8a6a2c; } .mk-font { background: #2aa3b8; } .mk-rapel { background: #6b4aa0; } .mk-perill { background: #d1352a; } .mk-foto { background: #555; }
.map-mk { background: none; border: 0; }
.pt-list { display: grid; gap: 6px; margin-top: 10px; }
.pt-row { display: grid; grid-template-columns: 26px 150px 1fr 26px; gap: 8px; align-items: center; font-family: var(--sans); }
.pt-row select, .pt-row input { padding: 5px 8px !important; font: .85rem var(--sans) !important; border: 1px solid var(--v-rule) !important; background: var(--v-bg) !important; }
@media (max-width: 560px) { .pt-row { grid-template-columns: 26px 1fr 26px; } .pt-row input { grid-column: 2 / 4; } .map-box { height: 300px; } }

/* croquis */
.topo-wrap { position: relative; line-height: 0; }
.topo-wrap img { width: 100%; display: block; }
.topo-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.topo-svg polyline { fill: none; stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 1.5px rgba(0,0,0,.8)); }
.topo-mark { position: absolute; transform: translate(-50%, -50%); background: rgba(0,0,0,.72); color: #fff; font: 600 12px/1 var(--sans); padding: 4px 6px; border-radius: 3px; white-space: nowrap; line-height: 1.2; }
.ed-topo [data-topowrap] { cursor: crosshair; }
.ed-topo .topo-mark { cursor: pointer; }
.topo-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.topo-tools .seg button { width: auto !important; padding: 0 8px; font: .74rem var(--sans); border: 0; background: none; cursor: pointer; color: var(--v-ink); }
.topo-tools .seg button.on { background: var(--v-ink); color: var(--v-bg); }
.dot-c { width: 20px; height: 20px; border-radius: 50%; background: var(--c); border: 2px solid var(--v-bg); box-shadow: 0 0 0 1px var(--v-rule); cursor: pointer; padding: 0; }
.dot-c.on { box-shadow: 0 0 0 2px var(--v-ink); }

/* llargs */
.b-pitches table, .asc-table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .88rem; }
.b-pitches th, .asc-table th { text-align: left; font-weight: 500; color: var(--v-muted, var(--muted)); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1.5px solid var(--v-ink, var(--ink)); padding: 6px 8px 6px 0; }
.b-pitches td, .asc-table td { border-bottom: 1px dotted var(--v-rule, var(--rule)); padding: 7px 8px 7px 0; vertical-align: top; }
.b-pitches td:first-child { font-weight: 600; width: 46px; }
.ed-pitches input { border-bottom: 1px dashed var(--v-rule) !important; font: .88rem var(--sans) !important; }
.ed-pitches td:nth-child(2) { width: 80px; } .ed-pitches td:nth-child(3) { width: 70px; } .ed-pitches td:last-child { width: 26px; }

/* referències */
.b-refs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.b-refs li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-family: var(--sans); font-size: .92rem; }
.b-refs li a { color: var(--v-ink, var(--ink)); font-weight: 500; }
.b-refs li small { color: var(--v-muted, var(--muted)); }
.ref-kind { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--v-rule, var(--rule)); padding: 1px 6px; color: var(--v-muted, var(--muted)); }
.ref-row { display: grid; grid-template-columns: 110px 1fr 1.3fr 26px; gap: 8px; margin-bottom: 6px; align-items: center; }
.ref-row select, .ref-row input { padding: 5px 8px !important; font: .85rem var(--sans) !important; border: 1px solid var(--v-rule) !important; background: var(--v-bg) !important; }
@media (max-width: 560px) { .ref-row { grid-template-columns: 1fr 26px; } .ref-row select, .ref-row input { grid-column: 1; } }
.ref-form { display: grid; grid-template-columns: 120px 1fr 1.4fr auto; gap: 8px; margin-top: 12px; }
@media (max-width: 640px) { .ref-form { grid-template-columns: 1fr; } }

/* ressenyes */
.b-review { border: 1px solid var(--v-rule); padding: 16px 18px; }
.rv-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stars { color: #b8892b; letter-spacing: 2px; font-size: 1rem; }
.stars i { color: var(--rule); font-style: normal; }
.rv-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0; }
.rv-tags span { font: .76rem var(--sans); padding: 3px 9px; border: 1px solid var(--v-rule, var(--rule)); border-radius: 99px; }
.star-in { display: inline-flex; gap: 2px; }
.star-in button { background: none; border: 0; font-size: 1.7rem; line-height: 1; color: var(--rule); cursor: pointer; padding: 0 2px; }
.star-in button.on { color: #b8892b; }
.tag-t { font: .78rem var(--sans); padding: 4px 10px; border: 1px solid var(--rule); border-radius: 99px; background: var(--surface); cursor: pointer; color: var(--ink); }
.tag-t.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ed-review .tag-t { background: transparent; color: var(--v-ink); border-color: var(--v-rule); }
.ed-review .tag-t.on { background: var(--v-ink); color: var(--v-bg); }
.reviews { display: grid; gap: 12px; }
.review { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.review p { margin: 6px 0 0; }
.review-form { margin-top: 18px; }
.review-form h3 { font-size: 1.1rem; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.maplinks { font-family: var(--sans); font-size: .85rem; }
.maplinks a { color: var(--accent); }
.geo-search { display: flex; gap: 6px; }

/* ascensions */
.post-asc { margin: 10px 0 22px; }
.post-asc h2 { font-size: 1.2rem; }
.asc-table td small { display: block; color: var(--muted); font-size: .78rem; }
.asc-table .asc-notes { font-style: italic; }
.asc-table .nowrap { white-space: nowrap; }
.asc-table { display: block; overflow-x: auto; }
.asc-stats { display: grid; gap: 16px; margin: 6px 0 20px; }
.asc-kinds { display: flex; flex-wrap: wrap; gap: 10px; }
.asc-k { display: grid; padding: 10px 14px; border: 1px solid var(--rule); background: var(--surface); min-width: 110px; font-family: var(--sans); }
.asc-k b { font: 400 1.6rem var(--display); }
.asc-k span { font-size: .8rem; }
.asc-k small { color: var(--muted); font-size: .75rem; }
.asc-years { display: flex; gap: 10px; align-items: flex-end; font-family: var(--sans); font-size: .72rem; }
.asc-years div { display: grid; justify-items: center; gap: 2px; }
.asc-years span { width: 22px; background: var(--ink); display: block; }
.modal { position: fixed; inset: 0; z-index: 150; background: rgba(15,14,12,.55); display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--bg); border: 1px solid var(--rule); width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 22px; display: grid; gap: 12px; }
.modal-card h2 { margin: 0; font-size: 1.4rem; }


/* filtre d'espais del mapa */
.map-filter { display: inline-flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: .88rem; margin-top: 6px; }
.map-filter select { width: auto; min-width: 260px; font-family: var(--sans); }
.pop .maplinks, .mpop .maplinks { font-size: .75rem; }


/* ---- espais: fitxa, membres, invitacions; cercador ---- */
.nav-search { display: inline-flex; align-items: center; padding: 6px 8px !important; }
.nav-search .ico { width: 18px; height: 18px; }
.me-mobile .nav-search { padding: 4px 8px 4px 0 !important; vertical-align: middle; color: var(--ink); }
.space-page { max-width: 980px; margin: 0 auto; }
.space-hero { position: relative; margin: 20px 0 14px; }
.space-hero.has-cover { min-height: 260px; display: flex; align-items: flex-end; color: #fbf8f1; overflow: hidden; }
.space-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.space-hero.has-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,.65)); }
.space-hero-text { position: relative; z-index: 1; padding: 0; }
.space-hero.has-cover .space-hero-text { padding: 22px 24px; }
.space-hero.has-cover .kicker, .space-hero.has-cover a { color: #f2ede3; }
.space-hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 6px 0 4px; }
.space-loc { margin: 0; font-family: var(--sans); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.space-loc .ico { width: 15px; height: 15px; }
.space-facts { display: flex; flex-wrap: wrap; gap: 6px 20px; font-family: var(--sans); font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.space-facts b { color: var(--ink); font-size: 1rem; }
.space-desc { max-width: 70ch; font-size: 1.05rem; }
.space-actions { align-items: center; margin: 16px 0 24px; }
.pill { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 99px; background: var(--ink); color: var(--bg); font: 500 .82rem var(--sans); }
.locked { border: 1px dashed var(--rule); padding: 28px; text-align: center; color: var(--muted); font-family: var(--sans); }
.locked .ico { vertical-align: -3px; }
.members { display: grid; gap: 2px; margin-bottom: 18px; }
.member { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.member small { display: block; color: var(--muted); font: .78rem var(--sans); }
.member .person { font-weight: 600; text-decoration: none; }
.avatar.sm { width: 38px; height: 38px; font-size: .95rem; }
.tab-body h3 { font-size: 1.05rem; margin: 18px 0 6px; }
.invite-box { border: 1px solid var(--rule); background: var(--surface); padding: 16px; display: grid; gap: 10px; }
.invite-box select { width: auto; font-family: var(--sans); font-size: .85rem; padding: 5px 8px; }
.inv-list { display: grid; gap: 6px; }
.inv { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-family: var(--sans); font-size: .82rem; }
.inv code { background: var(--bg); padding: 4px 8px; border: 1px solid var(--rule); overflow-wrap: anywhere; }
.inv small { color: var(--muted); }
.cover-pick { border: 1.5px dashed var(--rule); min-height: 150px; display: grid; place-items: center; cursor: pointer; overflow: hidden; position: relative; color: var(--muted); font-family: var(--sans); background: var(--surface); }
.cover-pick img { width: 100%; max-height: 260px; object-fit: cover; }
.cover-pick .up-note { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,.6); color: #fff; padding: 2px 8px; font-style: normal; font-size: .8rem; }
.notice-box { border-left: 3px solid var(--accent); background: var(--surface); padding: 10px 14px; margin-bottom: 16px; font-family: var(--sans); font-size: .9rem; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 4px; }
.search.big { max-width: 640px; font-size: 1.1rem; padding: 14px 16px; }
.space-card .kicker .ico { width: 12px; height: 12px; }
.space-card p .ico { width: 13px; height: 13px; vertical-align: -2px; }


.vcard-space { font: .74rem var(--sans); color: var(--v-muted); display: inline-flex; align-items: center; gap: 4px; }
.vcard-space .ico { width: 12px; height: 12px; }


/* ---- fotos de perfil ---- */
img.avatar { object-fit: cover; padding: 0; }
.avatar.lg { width: 110px; height: 110px; font-size: 2.2rem; }
.avatar.xs { width: 24px; height: 24px; font-size: .62rem; flex: none; }
.me-link { display: inline-flex !important; align-items: center; gap: 7px; }
.me-link .avatar.xs { vertical-align: middle; }
.avatar-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.comment { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; }
.comment > .avatar { grid-row: span 2; margin-top: 2px; }
.comment > p { grid-column: 2; }
.comment > .c-head:first-child, .comment > .c-body:nth-child(2) { grid-column: 1 / -1; }
/* menú del compte */
.acc-menu { position: fixed; z-index: 130; background: var(--surface); border: 1px solid var(--rule); box-shadow: 0 16px 36px -18px rgba(0,0,0,.45); display: grid; min-width: 220px; padding: 4px; font-family: var(--sans); }
.acc-menu a, .acc-menu button { text-align: left; padding: 10px 12px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; font-size: .92rem; cursor: pointer; }
.acc-menu a:hover, .acc-menu button:hover { background: var(--bg); }
.acc-menu button { border-top: 1px solid var(--rule); color: #9b3328; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .acc-menu button { color: #e58b80; } }
/* peu visible també al mòbil */
@media (max-width: 760px) { .footer { display: block; padding-bottom: 80px; } body.editing .footer { display: none; } }
/* configuració i suggeriments */
.settings { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--rule); }
.settings h2 { font-size: 1.4rem; }
.notify-form { display: grid; gap: 14px; }
.notify-form fieldset { display: grid; gap: 6px; }
.notify-form legend { font: 600 .82rem var(--sans); margin-bottom: 4px; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: .9rem; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--ink); }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; padding-left: 4px; }
.warn { color: #9b5a10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warn { color: #e9b26a; } }
.sugs { display: grid; gap: 12px; }
.sug { border: 1px solid var(--rule); padding: 12px 14px; background: var(--surface); }
.sug.st-fet, .sug.st-descartat { opacity: .6; }
.sug-body { white-space: pre-wrap; margin: 6px 0 10px; }
/* marques personals */
.tray-wrap { position: relative; display: block; }
.tray-wrap .x-row { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; background: var(--surface); border-radius: 50%; padding: 2px; }
.tray-wrap .x-row .ico { width: 14px; height: 14px; }
.tray-stk img { max-width: 100%; max-height: 100%; }
.stk-tray.mine { margin-bottom: 4px; }
.stk-tray.mine:has(p) { display: block; }
.mk-new { border: 1px solid var(--rule); padding: 8px 10px; font-family: var(--sans); font-size: .88rem; }
.mk-new summary { cursor: pointer; font-weight: 500; }
.mk-new[open] { display: grid; gap: 8px; }
.mk-preview { min-height: 40px; display: flex; align-items: center; justify-content: center; background: #f8f3e6; padding: 6px; }
.mk-preview svg { max-width: 100%; max-height: 70px; }
.stk-img img { width: 100%; height: auto; display: block; transform: rotate(var(--r, 0deg)); filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
/* ascensions del dia */
.ed-ascents select { width: 100%; padding: 2px 4px; font: .85rem var(--sans); }
.ed-ascents td:first-child { width: auto; font-weight: 400; }
.asc-save { margin-top: 10px; }
.tpl-mine { position: relative; display: block; }
.tpl-mine .tpl-btn { width: 100%; height: 100%; }
.tpl-mine .x-row { position: absolute; top: 4px; right: 4px; }

/* =========================================================
   Contrast: cap control amb el mateix color que el fons
   ========================================================= */
select, option, optgroup { background-color: var(--surface); color: var(--ink); }
input, textarea { color: var(--ink); }
.vlog { color-scheme: light; }
.vlog[data-paper="nit"] { color-scheme: dark; }
.vlog select, .vlog option, .vlog optgroup { background-color: var(--v-bg); color: var(--v-ink); }
.vlog input, .vlog textarea, .vlog select { color: var(--v-ink); }
.vlog .btn { color: var(--v-ink); border-color: var(--v-ink); }
.vlog .btn-ink { background: var(--v-ink); color: var(--v-bg); }
.vlog .btn:hover { background: var(--v-ink); color: var(--v-bg); }
.ed-cover-tools .btn { color: #222 !important; border-color: transparent !important; }
.ed-bar select, .ed-bar input[type=color] { background-color: var(--v-bg) !important; color: var(--v-ink) !important; }
.ed-panel select, .ed-panel input, .ed-panel textarea, .rt-bar select { background-color: var(--bg); color: var(--ink); }
.rt-bar button { color: var(--ink); }
.react { color: var(--ink); }
.tab, .cat { color: var(--muted); }
.tab.on, .cat.on { color: var(--ink); }
.chip-btn, .ins button, .tpl-btn { color: var(--v-ink); }
.tray-stk { color: inherit; }
.leaflet-container a.leaflet-popup-close-button { color: #333; }
.mpop, .leaflet-popup-content { color: #23211d; }


.star-in button { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.star-in button.on { color: #b8892b; }
.vlog .star-in button { color: color-mix(in srgb, var(--v-muted) 70%, transparent); }
.vlog .star-in button.on { color: #b8892b; }


/* dins del relat, els colors són sempre els del paper triat */
.vlog .link-btn, .vlog .more-link { color: var(--v-accent); }
.vlog[data-paper="nit"] .link-btn { color: var(--v-ink); }
.vlog .kicker, .vlog .muted { color: var(--v-muted); }
.vlog .danger { color: #9b3328 !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .danger { color: #ec9488 !important; } :root:not([data-theme="light"]) .vlog .danger { color: #9b3328 !important; } }


/* ---- compte: correu per confirmar, seguretat, moderació de comptes ---- */
.verify-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; justify-content: space-between; box-sizing: border-box; width: calc(100% - 32px); max-width: 1100px; margin: 14px auto 0; padding: 10px 16px; border: 1px solid #c9a46a; background: #f6ead2; color: #4a3610; font: 14px/1.45 var(--sans); }
.verify-bar .btn { color: #4a3610; border-color: #b08a4c; }
.verify-bar .row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { background: #9b3328; color: #fff; border-color: #9b3328; }
.btn-danger:hover { background: #7f281f; border-color: #7f281f; }
.danger-title { margin-top: 2em; color: #9b3328; }
.adm-users { display: grid; gap: 8px; margin-bottom: 1.5em; }
.adm-user { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.adm-user p { margin: 2px 0 0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .verify-bar { background: #3a2f1c; color: #f0dfbd; border-color: #7a6235; }
  :root:not([data-theme="light"]) .verify-bar .btn { color: #f0dfbd; border-color: #7a6235; }
  :root:not([data-theme="light"]) .danger-title { color: #ec9488; }
}
:root[data-theme="dark"] .verify-bar { background: #3a2f1c; color: #f0dfbd; border-color: #7a6235; }
:root[data-theme="dark"] .verify-bar .btn { color: #f0dfbd; border-color: #7a6235; }
@media (max-width: 640px) { .verify-bar { margin-top: 10px; } }

/* ---- mòbil: més compacte i pràctic ---- */
@media (max-width: 760px) {
  .topbar { padding: 8px 14px; transition: transform .22s ease; }
  body.scroll-down:not(.editing) .topbar { transform: translateY(-100%); }
  .brand svg { width: 26px; height: 17px; }
  main#app { padding-left: 16px; padding-right: 16px; }
  input[type=text], input[type=email], input[type=date], input[type=url], input[type=password], input[type=search], input[type=month], select, textarea { font-size: 16px; } /* iOS no fa zoom */
  .btn { padding: 9px 14px; min-height: 40px; }
  .btn-sm { min-height: 36px; }

  .page-head, .masthead { padding: 20px 0 14px; }
  .page-head h1, .masthead h1 { font-size: 1.75rem; margin: 4px 0 6px; }
  .page-head .lede, .masthead .lede { font-size: .98rem; line-height: 1.5; margin-bottom: 12px; }
  .page-head .cta, .cta { gap: 8px; }
  .page-head .cta .btn, .cta .btn { padding: 8px 12px; font-size: .88rem; }


  .vcard.big .vcard-img { min-height: 0; aspect-ratio: 16/10; margin: 8px 8px 0; }
  .vcard.big .vcard-body { padding: 14px 16px 16px; }
  .vcard.big h3 { font-size: calc(1.5rem * var(--v-head-scale, 1)); }

  /* llistes de relats: files compactes amb miniatura */
  .vgrid { grid-template-columns: 1fr; gap: 10px; }
  .vgrid .vcard { flex-direction: row; align-items: stretch; }
  .vgrid .vcard-img { flex: 0 0 104px; aspect-ratio: auto; margin: 8px 0 8px 8px; }
  .vgrid .vcard-body { padding: 10px 12px; gap: 3px; }
  .vgrid .vcard h3 { font-size: calc(1.08rem * var(--v-head-scale, 1)); }
  .vgrid .vcard-ex { -webkit-line-clamp: 2; font-size: .88rem; }
  .vgrid .vcard-foot { padding-top: 4px; font-size: .74rem; }

  /* filtres, pestanyes i reaccions: una sola línia que llisca */
  .cats, .tabs, .reacts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .cats::-webkit-scrollbar, .tabs::-webkit-scrollbar, .reacts::-webkit-scrollbar { display: none; }
  .cat, .tab, .react { flex: 0 0 auto; white-space: nowrap; }
  .cats { gap: 2px 16px; }
  .tabs { gap: 18px; }
  .post-actions { gap: 8px; }
  .post-actions .reacts { width: calc(100% + 32px); }
  .post-actions .grow { display: none; }

  /* espais: files més petites */
  .space-card { grid-template-columns: 64px 1fr; gap: 12px; padding: 10px; }
  .space-card img, .space-card .space-blank { width: 64px; height: 64px; }
  .space-card h3 { font-size: 1.05rem; }
  .space-card .clamp2 { -webkit-line-clamp: 1; }

  .side-box { margin-bottom: 24px; }
  .home-side { display: grid; gap: 0; }
  .comments h2, .sec-title { font-size: 1.25rem; }
  .comment-form textarea { min-height: 70px; }
}

/* ---- La Plaça: portada editorial ---- */
.paper-head { text-align: center; padding: 26px 0 0; margin-bottom: 30px; }
.dateline { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
  font: 500 .74rem/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dateline span:first-letter { text-transform: uppercase; }
.nameplate { font-family: var(--display); font-weight: 400; font-size: clamp(2.8rem, 8vw, 5.4rem); line-height: 1; letter-spacing: -.01em; margin: 26px 0 12px; }
.epigraph { font-family: var(--serif); font-style: italic; font-size: 1.12rem; color: var(--muted); margin: 0 auto 22px; max-width: 34em; }
.paper-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 0; border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink); padding: 9px 0; font: 500 .82rem var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.paper-actions a { text-decoration: none; color: var(--ink); padding: 2px 18px; border-left: 1px solid var(--rule); }
.paper-actions a:first-child { border-left: 0; }
.paper-actions a:hover { color: var(--accent); }

.front { margin-bottom: 44px; }
.lead { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 34px; align-items: start; padding-bottom: 30px; border-bottom: 1px solid var(--rule); }
.lead:not(:has(.lead-img)) { grid-template-columns: 1fr; max-width: 820px; margin: 0 auto; text-align: center; }
.lead-img img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; }
.lead h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.12; margin: 6px 0 14px; }
.lead h2 a, .col-story h3 a { color: var(--ink); text-decoration: none; }
.lead h2 a:hover, .col-story h3 a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.standfirst { font-size: 1.12rem; line-height: 1.6; margin: 0 0 14px; }
.standfirst::first-letter { float: left; font-family: var(--display); font-size: 3.3em; line-height: .82; padding: 6px 8px 0 0; }
.lead:not(:has(.lead-img)) .standfirst::first-letter { float: none; font-size: inherit; padding: 0; line-height: inherit; }
.byline { font: .76rem/1.4 var(--sans); letter-spacing: .04em; color: var(--muted); margin: 0; }
.columns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 24px; }
.col-story { padding: 0 20px; border-left: 1px solid var(--rule); }
.col-story:first-child { padding-left: 0; border-left: 0; }
.col-story:last-child { padding-right: 0; }
.col-img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; margin-bottom: 10px; }
.col-story .kicker { margin: 0 0 4px; }
.col-story h3 { font-family: var(--display); font-weight: 400; font-size: 1.22rem; line-height: 1.25; margin: 0 0 8px; }
.col-ex { font-size: .95rem; line-height: 1.5; color: var(--muted); margin: 0 0 8px; }
.empty-front { text-align: center; font-style: italic; color: var(--muted); margin: 40px 0; }

.rubric { font: 600 .78rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin: 0 0 14px; padding-top: 8px; border-top: 3px double var(--ink); }
.paper-sec { margin-bottom: 44px; min-width: 0; }
.briefs { list-style: none; margin: 0 0 12px; padding: 0; }
.brief { display: grid; grid-template-columns: 74px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.brief time { font: .72rem/1.9 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.brief p { margin: 0; line-height: 1.5; }
.brief p a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
.brief .person { font-weight: 600; text-decoration: none; }
.brief-extra { color: var(--muted); font-size: .94rem; margin-top: 3px !important; }
.brief-extra q { font-style: italic; quotes: '«' '»'; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brief .stars { font-size: .85rem; }
.more-briefs { font: .85rem var(--sans); }
.home-side .side-col { margin-bottom: 30px; }
.home-side .side-col .talk { padding: 9px 0; }
.place-list { line-height: 1.8; margin: 0 0 8px; }
.place-list a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
.home-side .more-link { font: .8rem var(--sans); letter-spacing: .04em; color: var(--accent); }
.comment-form.locked textarea, .comment-form.locked .right { display: none; }

@media (max-width: 960px) { .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 22px; } .col-story:nth-child(3) { padding-left: 0; border-left: 0; } .col-story:nth-child(2) { padding-right: 0; } }
@media (max-width: 760px) {
  .paper-head { padding-top: 10px; margin-bottom: 22px; }
  .dateline { font-size: .66rem; }
  .dateline .dl-mid, .dateline span:last-child { display: none; }
  .dateline { justify-content: center; }
  .nameplate { font-size: 2.9rem; margin: 16px 0 8px; }
  .epigraph { font-size: 1rem; margin-bottom: 16px; padding: 0 8px; }
  .paper-actions { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; margin: 0 -16px; padding: 9px 16px; font-size: .74rem; }
  .paper-actions::-webkit-scrollbar { display: none; }
  .paper-actions a { flex: 0 0 auto; padding: 2px 12px; }
  .paper-actions a:first-child { padding-left: 0; }
  .lead { grid-template-columns: 1fr; gap: 14px; padding-bottom: 22px; }
  .lead-img { margin: 0 -16px; }
  .lead h2 { font-size: 1.75rem; margin-bottom: 10px; }
  .standfirst { font-size: 1.02rem; }
  .columns { grid-template-columns: 1fr; margin-top: 4px; row-gap: 0; }
  .col-story, .col-story:first-child, .col-story:nth-child(3) { display: grid; grid-template-columns: 1fr 96px; column-gap: 14px; padding: 14px 0; border-left: 0; border-bottom: 1px solid var(--rule); }
  .col-story > * { grid-column: 1; }
  .col-story .col-img { grid-column: 2; grid-row: 1 / span 4; }
  .col-img img { aspect-ratio: 1; margin: 0; }
  .col-story h3 { font-size: 1.12rem; }
  .col-ex { display: none; }
  .brief { grid-template-columns: 1fr; gap: 2px; padding: 10px 0; }
  .brief time { order: 2; line-height: 1.4; }
  .paper-sec { margin-bottom: 32px; }
}

/* ---- mapes: estil sobri ---- */
.map-big, .map-mid, .v-map, .map-box { background: #ece7dc; }
.leaflet-container { font-family: var(--sans); background: #ece7dc; }
.tl-base { filter: sepia(.18) saturate(.85); }
.tl-shade { mix-blend-mode: multiply; }
.leaflet-bar { border: 1px solid var(--rule) !important; box-shadow: none !important; border-radius: 2px !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--ink); border-bottom-color: var(--rule); width: 30px; height: 30px; line-height: 30px; font: 400 18px/30px var(--sans); }
.leaflet-bar a:hover { background: var(--bg); }
.leaflet-bar a:first-child, .leaflet-bar a:last-child { border-radius: 0; }
.leaflet-control-layers { border: 1px solid var(--rule) !important; box-shadow: none !important; border-radius: 2px !important; background: var(--surface); color: var(--ink); }
.leaflet-control-layers-toggle { width: 32px !important; height: 32px !important; background-size: 18px 18px; }
.leaflet-control-layers-expanded { padding: 8px 12px; font: .85rem var(--sans); }
.leaflet-control-layers label { margin: 3px 0; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); font: .62rem var(--sans); padding: 1px 6px; }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-popup-content-wrapper { border-radius: 2px; background: #fbf8f1; box-shadow: 0 8px 24px -10px rgba(0,0,0,.35); border: 1px solid #d6cdbb; }
.leaflet-popup-tip { background: #fbf8f1; box-shadow: none; border: 1px solid #d6cdbb; }
.leaflet-popup-content { margin: 12px 14px; font-family: var(--serif); line-height: 1.4; }
.map-dot span { width: 26px; height: 26px; background: var(--c, #23211d); color: #fbf8f1; font: 600 11px/1 var(--sans); border: 2px solid #fbf8f1; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.map-dot span.solo { width: 14px; height: 14px; margin: 6px; border-width: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-container, :root:not([data-theme="light"]) .map-big, :root:not([data-theme="light"]) .map-mid { background: #262421; } :root:not([data-theme="light"]) .tl-base { filter: none; } :root:not([data-theme="light"]) .tl-shade { mix-blend-mode: screen; } }
:root[data-theme="dark"] .leaflet-container { background: #262421; }
:root[data-theme="dark"] .tl-base { filter: none; }


/* confirmació escrivint una paraula (esborrar relats) */
.modal-back { position: fixed; inset: 0; z-index: 200; background: rgba(15, 14, 12, .55); display: grid; place-items: center; padding: 16px; }
.confirm-modal { width: min(440px, 100%); background: var(--surface); color: var(--ink); border: 1px solid var(--rule); padding: 22px 22px 18px; display: grid; gap: 12px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .5); }
.confirm-modal h2 { font-size: 1.35rem; margin: 0; }
.confirm-modal p { margin: 0; color: var(--muted); }
.confirm-modal input { text-transform: uppercase; letter-spacing: .08em; }
.btn-danger[disabled] { opacity: .45; cursor: not-allowed; }

/* ---- m'agrada, valoracions, preferits i rànquings ---- */
.appraise { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.like-btn { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--rule); color: var(--ink); padding: 7px 14px; border-radius: 999px; font: 500 .9rem var(--sans); cursor: pointer; }
.like-btn .ico { width: 18px; height: 18px; }
.like-btn.on { border-color: #9b3328; color: #9b3328; }
.like-btn.on .ico { fill: currentColor; }
.like-btn b:empty { display: none; }
.like-btn[disabled] { cursor: default; opacity: .75; }
.rate { display: inline-flex; gap: 2px; }
.rate button { background: none; border: 0; padding: 2px; font-size: 1.45rem; line-height: 1; color: var(--rule); cursor: pointer; transition: color .1s; }
.rate:not(.own):hover button { color: #b8892f; }
.rate:not(.own) button:hover ~ button { color: var(--rule); }
.rate button.on { color: #b8892f; }
.rate.own button { cursor: default; }
.rate-info { font: .85rem var(--sans); color: var(--muted); }
.btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn .ico { width: 16px; height: 16px; }
.score { display: inline-flex; gap: 10px; font: .78rem var(--sans); color: var(--muted); }
.score .ico { width: 12px; height: 12px; vertical-align: -1px; margin-right: 3px; }
.sc-rate { color: #9a7424; }
.vcard-foot .score { width: 100%; }

.best-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; }
.best-item { padding: 4px 20px 6px; border-left: 1px solid var(--rule); }
.best-item:first-child { border-left: 0; padding-left: 0; }
.best-label { font: 600 .7rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: #9a7424; margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
.best-label .ico { width: 15px; height: 15px; }
.best-item h3 { font-family: var(--display); font-weight: 400; font-size: 1.2rem; line-height: 1.25; margin: 0 0 6px; }
.best-item h3 a { color: var(--ink); text-decoration: none; }
.best-item h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.rubric-link { float: right; font-weight: 500; letter-spacing: .04em; text-transform: none; color: var(--accent); }

.top-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 22px; }
.tseg { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
.tseg button { background: none; border: 0; border-left: 1px solid var(--rule); padding: 7px 13px; font: 500 .85rem var(--sans); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.tseg button:first-child { border-left: 0; }
.tseg button.on { background: var(--ink); color: var(--bg); }
.tseg .ico { width: 14px; height: 14px; }
.top-filters select { width: auto; min-width: 180px; }
.top-list { list-style: none; margin: 0; padding: 0; border-top: 3px double var(--ink); }
.top-item { display: grid; grid-template-columns: 54px auto 1fr auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.top-item:not(:has(.top-img)) { grid-template-columns: 54px 1fr auto; }
.top-n { font: 400 2.2rem/1 var(--display); color: var(--muted); text-align: center; }
.top-item:nth-child(-n+3) .top-n { color: var(--ink); }
.top-img img { width: 92px; height: 70px; object-fit: cover; display: block; }
.top-item h3 { font-family: var(--display); font-weight: 400; font-size: 1.25rem; margin: 2px 0 4px; }
.top-item h3 a { color: var(--ink); text-decoration: none; }
.top-item .kicker { margin: 0; }
.top-score { margin: 0; text-align: right; display: grid; }
.top-score b { font: 400 1.4rem var(--display); }
.top-score span { font: .74rem var(--sans); color: var(--muted); }
.top-empty { padding: 26px 0; }
@media (max-width: 760px) {
  .best-row { grid-template-columns: 1fr; }
  .best-item, .best-item:first-child { border-left: 0; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .top-filters { gap: 8px; }
  .tseg { overflow-x: auto; max-width: 100%; }
  .tseg button { flex: 0 0 auto; padding: 7px 10px; font-size: .8rem; }
  .top-item, .top-item:not(:has(.top-img)) { grid-template-columns: 34px 1fr auto; gap: 10px; }
  .top-img { display: none; }
  .top-n { font-size: 1.6rem; }
  .top-item h3 { font-size: 1.08rem; }
  .rubric-link { float: none; display: block; margin-top: 4px; }
}

/* estrella de La Collita */
.nav-star .ico { width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }
.rubric .ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.h-star .ico { width: .8em; height: .8em; vertical-align: -.05em; stroke-width: 1.4; margin-right: .1em; }

/* ---- text al costat d'un bloc estret (foto, vídeo vertical…) ---- */
.v-blocks, .ed-blocks { display: flow-root; }
.vb.fl-l, .ed-block.fl-l { float: left; width: var(--fw); margin: 6px 30px 16px 0; }
.vb.fl-r, .ed-block.fl-r { float: right; width: var(--fw); margin: 6px 0 16px 30px; }
.ed-block.fl-l .ed-bar, .ed-block.fl-r .ed-bar { flex-wrap: wrap; row-gap: 2px; }
/* el text, els títols i les cites flueixen al costat; la resta de blocs comencen per sota */
.v-blocks > .vb:not(.vb-text):not(.vb-heading):not(.vb-quote):not(.fl-l):not(.fl-r),
.ed-blocks > .ed-block:not(.ed-t-text):not(.ed-t-heading):not(.ed-t-quote):not(.fl-l):not(.fl-r) { clear: both; }
/* un requadre de text (nota, fons…) es posa al costat sencer, sense passar per sota del bloc */
.vb-text .b-text:not(.box-cap), .ed-t-text .b-text:not(.box-cap) { display: flow-root; }
@media (max-width: 600px) {
  .vb.fl-l, .vb.fl-r, .ed-block.fl-l, .ed-block.fl-r { float: none; width: min(100%, calc(var(--fw) * 1.7)); margin: 22px auto; }
}

/* vídeos a la pàgina lliure */
.fi-video video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.ed-blocks .fi-video video { pointer-events: none; } /* a l'editor es mou i es redimensiona; es reprodueix al relat publicat */
.fi-video.ps-rodona video { border-radius: 50%; }

/* ---- autodesat i esborranys ---- */
.ed-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ed-status:empty { display: none; }
.ed-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--rule); flex: none; }
.ed-status[data-state="ok"]::before { background: #3f8a52; }
.ed-status[data-state="saving"]::before { background: #c99a22; animation: ed-pulse 1s ease-in-out infinite; }
.ed-status[data-state="warn"] { color: #a4661b; }
.ed-status[data-state="warn"]::before { background: #c97a1e; }
.ed-status[data-state="bad"] { color: #b3261e; font-weight: 600; }
.ed-status[data-state="bad"]::before { background: #b3261e; }
@keyframes ed-pulse { 50% { opacity: .3; } }
.ed-note { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.versions-modal { max-width: 520px; }
.ver-list { list-style: none; padding: 0; margin: 14px 0; max-height: 52vh; overflow: auto; }
.ver-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.ver-list li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.draft-list { list-style: none; padding: 0; margin: 18px 0; }
.draft-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--rule); }
.draft-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
a.draft-main:hover b { text-decoration: underline; text-underline-offset: 3px; }
.draft-main b { font-family: var(--display); font-size: 1.15rem; font-weight: 400; overflow-wrap: anywhere; }
.draft-trash { margin-top: 28px; }
.draft-trash summary { cursor: pointer; color: var(--muted); font-size: 14px; }

/* ---- tria d'espais (un relat pot ser a diversos) ---- */
.space-pick { display: flex; flex-direction: column; border: 1px solid var(--rule); background: var(--surface); max-height: 240px; overflow: auto; }
.sp-opt { display: flex; align-items: center; gap: 9px; padding: 8px 10px; cursor: pointer; font-family: var(--sans); font-size: .9rem; }
.sp-opt + .sp-opt { border-top: 1px solid var(--rule); }
.sp-opt input { margin: 0; accent-color: var(--accent); }
.sp-opt span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sp-opt em { font-style: normal; font-size: .75rem; color: var(--muted); }
.sp-opt:has(input:checked) { background: color-mix(in srgb, var(--accent) 8%, transparent); }
#space-hint { display: block; margin-top: 6px; }
.crumb-edit { margin-left: 8px; font-size: .8em; color: var(--muted); }

/* ---- La via pas a pas ---- */
/* tot surt dels colors del paper del relat (també el fosc): cap fons ni color fix sota el text */
.b-beta, a.beta-ref, .ed-beta { --bx: color-mix(in srgb, var(--v-accent, var(--accent)) 70%, var(--v-ink, var(--ink))); }
/* el perfil fa la mateixa mida a l'editor i al relat: el que dibuixes és el que es veu */
.b-beta, .ed-beta { --bpw: 100px; --bph: 64px; }
@media (max-width: 600px) { .b-beta, .ed-beta { --bpw: 72px; --bph: 46px; } }
.b-beta h3 { font-family: var(--sans); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--bx); margin: 0 0 8px; font-weight: 500; }
.beta-grid { display: grid; grid-template-columns: var(--bpw) minmax(0, 1fr); gap: 18px; align-items: start; }
.beta-side { position: sticky; top: 80px; }
.bp-draw { position: relative; width: var(--bpw); height: calc(var(--bph) * var(--n)); }
.bp-draw svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bp-band { fill: transparent; }
.bw-rock { fill: var(--v-rule); opacity: .6; }
.bw-face, .bw-route { fill: none; stroke-linejoin: round; }
.bw-face { stroke: var(--v-ink); stroke-width: 1.5; opacity: .55; }
.bw-route { stroke: var(--v-muted); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 5; }
.bw-route.i3 { stroke: #d39a4c; stroke-width: 2.5; stroke-dasharray: none; }
.bw-route.i4 { stroke: #cf6f36; stroke-width: 3; stroke-dasharray: none; }
.bw-route.i5 { stroke: #c0432b; stroke-width: 3.5; stroke-dasharray: none; }
.bw-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--v-bg); border: 1.5px solid var(--v-ink); pointer-events: none; }
.bp-n { position: absolute; right: 2px; transform: translateY(-50%); font: .68rem var(--sans); color: var(--v-muted); pointer-events: none; transition: color .3s; }
.bp-n.flash { color: var(--bx); font-weight: 700; }
.beta-ground { width: var(--bpw); height: 7px; border-top: 1.5px solid var(--v-ink); opacity: .7; background: repeating-linear-gradient(135deg, var(--v-rule) 0 1.5px, transparent 1.5px 5px); }
.beta-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; }
.bs { scroll-margin: 90px; }
.bs-body { padding: 10px 6px 12px; border-bottom: 1px solid var(--v-rule); transition: background-color .5s; }
.bs:first-child .bs-body { border-bottom: 0; }
.bs:last-child .bs-body { padding-top: 0; }
.bs.flash .bs-body { background-color: color-mix(in srgb, var(--v-accent) 12%, transparent); }
.bs-hd { display: flex; gap: 10px; align-items: baseline; }
.bs-n { flex: none; min-width: 1.1em; font: 400 1.5rem/1 var(--v-head); color: var(--bx); }
.b-beta .bs-t { margin: 0; flex: 1; min-width: 0; font: 600 1rem/1.3 var(--v-head); color: var(--v-ink); }
.bs-meta { flex: none; display: inline-flex; align-items: center; gap: 8px; font: .72rem var(--sans); color: var(--v-muted); white-space: nowrap; }
.bs-int { display: inline-flex; gap: 2px; }
.bs-int i { width: 10px; height: 4px; border-radius: 1px; background: var(--v-rule); }
.bs-int i.on, .bs-ed-int button.on { background: var(--v-muted); }
.bs-int.i3 i.on, .bs-ed-int button.on.i3 { background: #d39a4c; }
.bs-int.i4 i.on, .bs-ed-int button.on.i4 { background: #cf6f36; }
.bs-int.i5 i.on, .bs-ed-int button.on.i5 { background: #c0432b; }
.bs-txt { margin-left: calc(1.1em + 10px); }
.bs-txt:empty { display: none; }
.bs-d { margin: 6px 0 0; line-height: 1.6; color: var(--v-ink); }
.bs-tags { margin: 4px 0 0; font-style: italic; font-size: .88rem; color: var(--v-muted); }
.bs-k { margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--bx); font-style: italic; color: var(--v-ink); }
.bs-back { display: block; margin-top: 8px; border: 0; background: none; padding: 0; cursor: pointer; font: .78rem var(--sans); color: var(--bx); }
.bs-back:hover { text-decoration: underline; }
@media (max-width: 600px) { .beta-grid { gap: 10px; } .bs-txt { margin-left: 0; } .bs-n { font-size: 1.3rem; } }
/* enllaços del text a un tram: subratllat discret i el número del tram */
a.beta-ref { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--bx) 75%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: pointer; border-radius: 2px; transition: background-color .5s; }
a.beta-ref:hover { text-decoration-color: var(--bx); }
a.beta-ref::after { content: attr(data-n); display: inline-grid; place-items: center; min-width: 1.45em; height: 1.45em; padding: 0 .2em; margin-left: .25em; border-radius: 99px; background: var(--bx); color: var(--v-bg, var(--bg)); font: 600 .62em/1 var(--sans); vertical-align: .2em; text-decoration: none; }
a.beta-ref:not([data-n])::after { content: '↗'; background: none; color: var(--bx); min-width: 0; padding: 0; margin-left: .1em; }
a.beta-ref.flash { background-color: color-mix(in srgb, var(--v-accent, var(--accent)) 18%, transparent); }
[contenteditable="true"] a.beta-ref { cursor: text; }
/* barra de format: botó «Pas» */
.rt-bar .rt-ref > button { font: 500 .8rem var(--sans); gap: 4px; display: inline-flex; }
.pop-ref { width: 260px; flex-direction: column; flex-wrap: nowrap; max-height: 300px; overflow: auto; }
.pop-ref .ref-opt { width: auto; height: auto; min-width: 0; border-radius: 3px; background: none !important; border: 0; padding: 7px 8px; text-align: left; display: block; font: .85rem var(--sans); color: var(--ink); }
.pop-ref .ref-opt:hover { background: var(--bg) !important; }
.pop-ref .ref-rm { border-top: 1px solid var(--rule); border-radius: 0; color: var(--muted); }
.ref-empty { font: .82rem var(--sans); color: var(--muted); padding: 6px; }
/* editor */
.ed-beta .ed-fitxa-title { margin-bottom: 4px; }
.bs-ed { border: 1px solid var(--v-rule, var(--rule)); padding: 10px; margin: 8px 0; display: grid; gap: 7px; background: transparent; color: var(--v-ink); }
.bs-ed .bs-n { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font: 600 .75rem var(--sans); }
.bs-ed .tag-chip { border-color: var(--v-rule); color: var(--v-ink); }
.bs-ed .tag-chip button { color: var(--v-muted); }
.ed-canvas .bs-ed select option { color: #222; background: #fff; }
.bs-ed-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bs-ed-top > input:first-of-type { flex: 1 1 200px; min-width: 0; font-weight: 600; }
.bs-ed input, .bs-ed textarea, .bs-ed select { font: .9rem var(--sans); border: 0; border-bottom: 1px dashed var(--v-rule, var(--rule)); background: transparent; padding: 4px 2px; color: inherit; }
.bs-ed textarea { width: 100%; resize: vertical; font-family: var(--v-body, var(--serif)); font-size: .98rem; line-height: 1.5; }
.bs-ed-x { width: 70px; }
.bs-ed-int { display: inline-flex; gap: 3px; }
.bs-ed-int button { width: 16px; height: 10px; padding: 0; border: 0; border-radius: 2px; background: var(--v-rule, var(--rule)); cursor: pointer; }
.bs-ed-move { display: inline-flex; gap: 2px; margin-left: auto; }
.bs-ed-move button:disabled { opacity: .3; cursor: default; }
.bs-ed-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.bs-ed-tags .tag-chip { font-size: .75rem; padding: 1px 3px 1px 9px; }
.bs-ed-tags select { font-size: .8rem; color: var(--v-muted, var(--muted)); }
.beta-prev { margin-top: 10px; }
.beta-prev summary { cursor: pointer; font: .82rem var(--sans); color: var(--v-muted, var(--muted)); }
.beta-prev .b-beta { margin-top: 10px; pointer-events: none; }
.ed-canvas .bs-ed input, .ed-canvas .bs-ed textarea, .ed-canvas .bs-ed select { font: .9rem var(--sans); border: 0; border-bottom: 1px dashed var(--v-rule, var(--rule)); background: transparent; padding: 4px 2px; color: inherit; }
.ed-canvas .bs-ed-top > input:first-of-type { width: auto; flex: 1 1 200px; font-weight: 600; font-size: .98rem; }
.ed-canvas .bs-ed-top > input.bs-ed-x { width: 72px; flex: none; }
.ed-canvas .bs-ed-top > select, .ed-canvas .bs-ed-tags select { width: auto; flex: none; }
.ed-canvas .bs-ed textarea { width: 100%; resize: vertical; font: .98rem/1.5 var(--v-body, var(--serif)); }
.ed-canvas .bs-ed input.bs-ed-k { width: 100%; }

/* ---- editor de la via pas a pas: dibuix del perfil (mateixa mida que al relat) i trams compactes ---- */
.ed-beta-grid { display: grid; grid-template-columns: var(--bpw) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 6px; }
.bp-col { position: sticky; top: 120px; }
.bp-edit { cursor: crosshair; touch-action: none; user-select: none; outline: 1px solid var(--v-rule); }
.bp-edit .bp-band.odd { fill: var(--v-rule); opacity: .22; }
.bp-h { position: absolute; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: var(--v-bg); border: 2px solid var(--bx); cursor: grab; z-index: 1; }
.bp-help { margin: 6px 0 0; font: .68rem/1.35 var(--sans); color: var(--v-muted); }
.bp-col .link-btn { font-size: .72rem; margin-top: 2px; }
.bs-list { display: flex; flex-direction: column-reverse; gap: 8px; }
.bs-list > .link-btn { align-self: flex-start; }
.bs-list .bs-ed { margin: 0; padding: 8px 10px; gap: 5px; }
.ed-canvas .bs-ed-tags input.bs-ed-k { width: auto; flex: 1 1 140px; }
@media (max-width: 600px) { .ed-beta-grid { gap: 10px; } }

/* ---- croquis de la via pas a pas: textura, xapes, reunió, símbols i llegenda ---- */
.bp-draw svg { overflow: visible; }
.bp-hatch { stroke: var(--v-ink); stroke-width: .7; opacity: .16; }
.bw-rock { fill: var(--v-rule); opacity: .5; }
.bw-face { stroke: var(--v-ink); stroke-width: 1.6; opacity: .75; fill: none; stroke-linejoin: round; }
.bw-route { stroke-width: 1.6; stroke-dasharray: 1.5 3.5; }
.bw-route.i3 { stroke-width: 2.2; } .bw-route.i4 { stroke-width: 2.6; } .bw-route.i5 { stroke-width: 3.2; }
.bp-edit .bp-band { fill: var(--v-rule); opacity: .2; }
.sym-line { stroke: var(--v-ink); stroke-width: 1.1; opacity: .8; }
.sym-ring { fill: var(--v-bg); stroke: var(--v-ink); stroke-width: 1.1; }
.sym-hold { fill: var(--v-muted); stroke: var(--v-ink); stroke-width: .5; }
.sym-foot { fill: none; stroke: var(--v-ink); stroke-width: 1; opacity: .8; }
.sym-rest { fill: var(--v-bg); stroke: var(--bx); stroke-width: 1.1; }
.sym-rest-t { fill: var(--bx); font: 700 5.5px var(--sans); text-anchor: middle; }
.sym-crux { fill: #c0432b; }
.sym-crux-t { fill: #fff; font: 800 6.5px var(--sans); text-anchor: middle; }
.sym-anchor { fill: none; stroke: var(--v-ink); stroke-width: 1.2; }
.sym-lbl { fill: var(--v-muted); font: 600 6.5px var(--sans); }
.bp-n { left: 3px; right: auto; }
.beta-legend { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 8px; width: var(--bpw); font: .62rem var(--sans); color: var(--v-muted); }
.beta-legend span { display: inline-flex; align-items: center; gap: 3px; }
@media (max-width: 600px) { .beta-legend { display: none; } }
/* editor: eines del croquis */
.bp-tools { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 6px; width: var(--bpw); }
.bp-tools button { width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--v-ink); cursor: pointer; }
.bp-tools button:hover { border-color: var(--v-rule); }
.bp-tools button.on { border-color: var(--bx); background: color-mix(in srgb, var(--v-accent) 12%, transparent); }
.bp-mh { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; cursor: grab; z-index: 2; }
.bp-mh:hover { box-shadow: 0 0 0 1.5px var(--bx); }

/* ---- quiosc: canviar de diari (espai) a l'inici ---- */
.kiosk { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 2px; margin: 14px 0 -8px; font-family: var(--display); }
.kiosk-l { font: .62rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.kiosk a { padding: 3px 10px; color: var(--muted); text-decoration: none; font-size: .95rem; border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 4px; }
.kiosk a + a { border-left: 1px solid var(--rule); }
.kiosk a:hover { color: var(--ink); }
.kiosk a.on { color: var(--ink); border-bottom-color: var(--ink); }
.kiosk .ico { width: 12px; height: 12px; }
@media (max-width: 700px) {
  .kiosk { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 8px -16px -6px; padding: 0 16px; scrollbar-width: none; }
  .kiosk::-webkit-scrollbar { display: none; }
  .kiosk a { white-space: nowrap; font-size: .88rem; }
}

/* ---- croquis sobre foto: línies amb halo, vies numerades, etiquetes i símbols ---- */
.topo-svg polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; filter: none; }
.topo-svg polyline.halo { stroke: #fff; stroke-width: 7; opacity: .82; }
.topo-svg polyline.ln { stroke-width: 3.5; }
.topo-mark { position: absolute; transform: translate(-50%, -50%); z-index: 1; white-space: nowrap; font: 700 11px/1 var(--sans); letter-spacing: .02em; background: none; padding: 0; border-radius: 0; }
.tm-text { background: var(--mc); color: var(--mt); padding: 5px 9px; border-radius: 99px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.95), 0 2px 5px rgba(0,0,0,.45); }
.tm-reunio { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; background: #fff; color: #1b1b1b; border: 3px solid var(--mc); box-shadow: 0 2px 5px rgba(0,0,0,.5); }
.tm-xapa { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 3px solid #1b1b1b; box-shadow: 0 0 0 1.5px #fff, 0 1px 4px rgba(0,0,0,.5); }
.tm-crux { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: #c0432b; color: #fff; font-size: 13px; box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(0,0,0,.5); }
.tm-crux i { font: 700 11px var(--sans); font-style: normal; }
.tm-rapel { padding: 5px 8px; border-radius: 4px; background: #1b1b1b; color: #fff; box-shadow: 0 0 0 1.5px #fff, 0 2px 5px rgba(0,0,0,.5); }
.topo-num { position: absolute; transform: translate(-50%, 6px); width: 24px; height: 24px; border-radius: 50%; background: var(--mc); color: var(--mt); font: 800 12px/24px var(--sans); text-align: center; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.45); pointer-events: none; z-index: 1; }
.topo-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 10px 0 0; font: .9rem var(--sans); color: var(--v-ink); }
.topo-legend li { display: inline-flex; align-items: center; gap: 7px; }
.topo-legend em { font-style: normal; font-weight: 700; color: var(--v-muted); }
.topo-num-s { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--mc); color: var(--mt); font: 800 11px/20px var(--sans); text-align: center; box-shadow: 0 0 0 1px var(--v-rule); }
/* editor */
.ed-topo .topo-mark { cursor: grab; }
.ed-topo .topo-tools .seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--v-rule); border-radius: 4px; overflow: hidden; }
.ed-topo .topo-tools .seg button { height: 28px; }
.topo-lines { display: grid; gap: 4px; margin-top: 8px; }
.tl-row { display: flex; align-items: center; gap: 8px; }
.ed-canvas .tl-row input { width: auto; flex: 1 1 160px; font: .88rem var(--sans); border-bottom: 1px dashed var(--v-rule); padding: 3px 2px; }
.ed-canvas .tl-row input.tl-g { flex: 0 0 70px; }

/* ---- corrector ortogràfic ---- */
::highlight(corr-ort) { text-decoration: underline wavy #d0392b; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-skip-ink: none; }
::highlight(corr-gram) { text-decoration: underline wavy #2f7bd0; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-skip-ink: none; }
.corr-btn { display: inline-flex; align-items: center; gap: 6px; }
.corr-abc { font: 700 .7rem var(--sans); letter-spacing: .06em; text-decoration: underline wavy #d0392b; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.corr-btn.off .corr-abc { text-decoration: line-through; opacity: .55; }
.corr-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: inline-grid; place-items: center; font: 700 .68rem var(--sans); background: var(--ink); color: var(--bg); }
.corr-n:empty { display: none; }
.corr-pop, .corr-menu { position: absolute; z-index: 300; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); box-shadow: 0 12px 30px -12px rgba(0,0,0,.45); font-family: var(--sans); }
.corr-pop { max-width: 320px; padding: 10px 12px; border-radius: 6px; }
.corr-msg { margin: 0 0 8px; font-size: .84rem; line-height: 1.4; display: flex; gap: 8px; align-items: baseline; }
.corr-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #d0392b; transform: translateY(-1px); }
.corr-dot.gram { background: #2f7bd0; }
.corr-sugs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.corr-sugs button { border: 0; border-radius: 4px; padding: 5px 10px; background: var(--ink); color: var(--bg); font: 600 .9rem var(--sans); cursor: pointer; }
.corr-sugs button:hover { opacity: .85; }
.corr-foot { display: flex; gap: 12px; border-top: 1px solid var(--rule); padding-top: 7px; }
.corr-foot button, .corr-menu button { border: 0; background: none; padding: 0; cursor: pointer; font: .78rem var(--sans); color: var(--muted); }
.corr-foot button:hover, .corr-menu button:hover { color: var(--ink); text-decoration: underline; }
.corr-menu { padding: 10px 12px; border-radius: 6px; display: grid; gap: 9px; min-width: 200px; }
.corr-menu label { display: flex; gap: 8px; align-items: center; font-size: .82rem; }
.corr-menu button { text-align: left; color: var(--ink); font-size: .84rem; }
.corr-menu button:disabled { color: var(--muted); cursor: default; text-decoration: none; }

/* ---- seguir i perfils suggerits ---- */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px 22px; }
.pcards.slim { grid-template-columns: 1fr; gap: 0; }
.pcard { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.pcard-txt { flex: 1; min-width: 0; display: grid; }
.pcard-name { font-weight: 600; text-decoration: none; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-name:hover { text-decoration: underline; }
.pcard small { font-family: var(--sans); font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .btn { flex: none; }
.people-sec { margin-bottom: 28px; }
.people-sec h3 { margin: 0 0 6px; }
.inv-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 12px; padding: 12px; border: 1px solid var(--rule); border-radius: 6px; max-width: 460px; }
.inv-pick .fld { margin: 0; flex: 1; min-width: 180px; }

/* ---- àudio ---- */
.b-audio { margin: 0; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--v-rule, var(--rule)); border-radius: 12px;
  background: color-mix(in srgb, var(--v-ink, var(--ink)) 5%, transparent); color: var(--v-ink, var(--ink)); }
.aud-ic { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--v-accent, var(--ink)); color: var(--v-bg, var(--bg)); }
.aud-ic svg { width: 22px; height: 22px; }
.aud-main { flex: 1; min-width: 0; display: grid; gap: 8px; }
.aud-main audio { width: 100%; height: 40px; }
.aud-cap { margin: 0; font-family: var(--sans); font-size: .95rem; font-weight: 600; line-height: 1.35; }
.b-audio .ed-cap { margin: 0; }
.aud-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aud-rec { display: flex; align-items: center; gap: 10px; padding: 16px; border: 1px dashed var(--v-rule, var(--rule)); border-radius: 12px; font-family: var(--sans); }
.rec-time { font-variant-numeric: tabular-nums; min-width: 3.2em; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #d0392b; animation: recp .9s ease-in-out infinite alternate; }
@keyframes recp { to { opacity: .25; transform: scale(.8); } }
@media (max-width: 600px) { .aud-pick { grid-template-columns: 1fr; } .aud-rec { flex-wrap: wrap; } }

/* ---- historial de canvis ---- */
.post-edited { margin: -4px 0 14px; }
.post-edited .link-btn { font-size: inherit; }
.hist-modal { max-width: 560px; width: calc(100vw - 32px); }
.hist-list { list-style: none; margin: 8px 0 16px; padding: 0; max-height: min(60vh, 520px); overflow-y: auto; }
.hist-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--rule); position: relative; }
.hist-list li:last-child { border-bottom: 0; }
.hist-list p { margin: 0 0 3px; line-height: 1.45; }
.hist-list small { font-family: var(--sans); font-size: .76rem; color: var(--muted); }
.hist-list li.create p { color: var(--muted); }
.hist-w { font-family: var(--sans); font-size: .74rem; padding: 1px 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 8%, transparent); white-space: nowrap; }
.hist-w.up { color: #2c7a3f; } .hist-w.down { color: #b0412e; }

/* ---- moderació: la collita de l'any ---- */
.coll-adm h3 { margin: 22px 0 4px; }
.ca-list { display: grid; gap: 6px; max-height: 420px; overflow-y: auto; padding: 4px 2px; margin: 8px 0 12px; }
.ca-it { border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; }
.ca-it.on { border-color: var(--ink); }
.ca-chk { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ca-chk input { margin-top: 4px; width: auto; }
.ca-chk span { display: grid; }
.ca-chk small { font-family: var(--sans); font-size: .76rem; color: var(--muted); }
.ca-note { margin-top: 8px; width: 100%; }
.coll-adm .row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.coll-adm .row-btns select { width: auto; flex: 1 1 170px; }
.coll-adm .row-btns .btn { white-space: nowrap; }

/* ---- previsualització de l'editor: el relat tal com es publicarà ---- */
.ed-pv-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin: 0 0 18px;
  background: var(--surface, var(--bg)); border-bottom: 1px solid var(--rule); font-family: var(--sans); font-size: .86rem; }

/* ---- a qui li ha agradat ---- */
.likers { margin: -6px 0 12px; color: var(--muted); font-family: var(--sans); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.likers:empty { display: none; }
.likers svg { width: 14px; height: 14px; color: #c0392b; }
.likers .link-btn { font-size: inherit; }
#like-n { cursor: pointer; }
.hist-modal h2 svg { width: 20px; height: 20px; color: #c0392b; vertical-align: -2px; }

/* ---- moderació: tots els comptes ---- */
.acc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.acc-tile { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; display: grid; }
.acc-tile b { font-size: 1.6rem; font-weight: 400; line-height: 1.1; }
.acc-tile span { font-family: var(--sans); font-size: .76rem; color: var(--muted); }
.acc-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.acc-tools input { flex: 1 1 220px; min-width: 0; }
.acc-tools select { flex: 0 1 auto; width: auto; }
.acc-list { list-style: none; padding: 0; margin: 0 0 2em; }
.acc-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.acc-main { min-width: 0; }
.acc-main p { margin: 2px 0 0; overflow-wrap: anywhere; }
.acc-st { display: inline-block; margin-left: 4px; padding: 1px 8px; border: 1px solid var(--rule); border-radius: 99px; font: .72rem var(--sans); color: var(--muted); }
.acc-st.warn { color: var(--warn, #a33); border-color: currentColor; }
@media (max-width: 560px) { .acc-row { grid-template-columns: auto 1fr; } .acc-row .row-btns { grid-column: 2; } }

/* ---- la campaneta ---- */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 6px 8px; color: var(--ink); cursor: pointer; vertical-align: middle; }
.bell[hidden] { display: none; }
.bell .ico { width: 19px; height: 19px; }
.me-mobile .bell { padding: 4px 8px 4px 2px; }
.bell-n { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #b8432f; color: #fff; font: 600 .66rem/17px var(--sans); text-align: center; }
.bell-n[hidden] { display: none; }
.bell-menu { position: fixed; z-index: 130; right: 8px; width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--rule); box-shadow: 0 16px 36px -18px rgba(0,0,0,.45); font-family: var(--sans); }
.bell-head { padding: 10px 14px; border-bottom: 1px solid var(--rule); font-size: .92rem; }
.bell-list { overflow-y: auto; }
.bell-it { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; color: var(--ink); text-decoration: none; font-size: .88rem; line-height: 1.4; border-bottom: 1px solid var(--rule); }
.bell-it:hover { background: var(--bg); }
.bell-it.new { background: color-mix(in srgb, var(--accent, #2f4a7a) 9%, var(--surface)); }
.bell-it .avatar, .bell-dot { flex: 0 0 auto; margin-top: 1px; }
.bell-dot { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--rule); color: var(--muted); }
.bell-dot .ico { width: 14px; height: 14px; }
.bell-txt { min-width: 0; overflow-wrap: anywhere; }
.bell-txt small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.bell-q { display: block; color: var(--muted); font-style: italic; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-empty { padding: 14px; margin: 0; }
.bell-foot { padding: 8px 14px; font-size: .8rem; text-align: right; }
.bell-foot a { color: var(--muted); }

/* ---- visualitzacions ---- */
.views { display: inline-flex; align-items: center; gap: 5px; font: .85rem var(--sans); color: var(--muted); }
.views .ico { width: 17px; height: 17px; }
.views b { font-weight: 600; color: var(--ink); }

.acc-mailall { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule); }
.acc-mailall h2 { font-size: 1.15rem; margin: 0 0 6px; }

/* temps de lectura i superenllaços */
.vcard-read { font-family: var(--sans); font-size: .74rem; color: var(--v-muted); margin: 6px 0 0; letter-spacing: .01em; }
.v-read { font-family: var(--sans); font-size: .8rem; color: var(--v-muted); margin: 0 0 4px; letter-spacing: .02em; }
.share-note { font-family: var(--sans); font-size: .85rem; background: var(--paper-2, #f3eee3); border-left: 3px solid var(--rule); padding: 10px 14px; margin: 12px 0; }
.sh-new { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.sh-new input { flex: 1 1 180px; min-width: 0; }
.sh-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sh-list .grow { flex: 1; }

/* fotos i àudios als comentaris */
.c-media { grid-column: 1 / -1; margin-top: 8px; display: grid; gap: 8px; }
.c-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.c-ph { padding: 0; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: none; cursor: zoom-in; width: 120px; height: 120px; }
.c-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c-media .b-audio { margin: 0; max-width: 420px; }
.c-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.c-tools label { cursor: pointer; }
.c-tools .rec-on { color: #b3261e; border-color: #b3261e; }
.c-att { display: flex; flex-wrap: wrap; gap: 6px; }
.c-att:empty { display: none; }
.c-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); border-radius: 6px; padding: 4px 26px 4px 4px; font: .8rem var(--sans); min-height: 56px; }
.c-chip img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.c-chip.up { opacity: .6; }
.c-chip em { font-style: normal; color: var(--muted); }
.c-chip button { position: absolute; top: 2px; right: 4px; border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--muted); }
@media (max-width: 600px) { .c-ph { width: 96px; height: 96px; } }

/* ---- anuncis: dos bàners verticals (160×600) als costats de La Plaça i dels relats ----
   Només on hi caben sense tocar el contingut; al mòbil i a la tauleta, res. Vegeu ads.js. */
.ad-rail { display: none; position: fixed; top: 88px; z-index: 5; width: 160px; height: 600px; }
.ad-rail.ad-empty { display: none !important; }
.ad-rail.ad-wait { visibility: hidden; }
.ad-rail::before { content: 'Publicitat'; position: absolute; bottom: 100%; left: 0; font: .68rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: 2px; }
/* La Plaça: contingut de 1180 px */
@media (min-width: 1580px) and (min-height: 720px) {
  body[data-route="home"] .ad-rail { display: block; }
  body[data-route="home"] .ad-rail-l { right: calc(50% + 590px + 24px); }
  body[data-route="home"] .ad-rail-r { left: calc(50% + 590px + 24px); }
}
/* un relat: pàgina de 860 px */
@media (min-width: 1280px) and (min-height: 720px) {
  body[data-route="p"]:not(.editing) .ad-rail { display: block; }
  body[data-route="p"] .ad-rail-l { right: calc(50% + 430px + 32px); }
  body[data-route="p"] .ad-rail-r { left: calc(50% + 430px + 32px); }
}
@media print { .ad-rail { display: none !important; } }

/* ---- pàgines fixes (qui som, privadesa) ---- */
.doc { max-width: 720px; margin: 0 auto; }
.doc h2 { font-size: 1.3rem; margin: 32px 0 8px; }
.doc ul { padding-left: 1.2em; }
.doc li { margin: 6px 0; }
.doc code { font-size: .88em; background: var(--surface); padding: 1px 5px; border-radius: 3px; }
