/* Färgerna är hämtade ur byns bilder: Hjälmarens blå, den gula färjan, vass och solnedgång. */
:root {
  --bg: #f5f2ea;
  --card: #ffffff;
  --ink: #17283a;
  --muted: #5f6b74;
  --line: #e2ddd0;
  --brand: #1d4466;
  --brand-ink: #ffffff;
  --brand-soft: #e4edf4;
  --accent: #f2b630;
  --accent-ink: #2a1d00;
  --reed: #3f7a3a;
  --danger: #b3412f;
  --fel: #fdecd8;
  --onskemal: #e2f0fb;
  --klagomal: #f6e2ef;
  --radius: 16px;
  --wrap: 880px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1820;
    --card: #182531;
    --ink: #e8edf1;
    --muted: #9aa8b4;
    --line: #283746;
    --brand: #7fb2dc;
    --brand-ink: #0b1620;
    --brand-soft: #1d3346;
    --reed: #8fc98a;
    --fel: #3a2d1d;
    --onskemal: #1d2f3c;
    --klagomal: #36222f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 110px; /* sidhuvudet stannar överst – ankarlänkar ska inte hamna under det */ }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
img { max-width: 100%; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .2em 0 .4em; letter-spacing: -.015em; }
h2 { font-size: 1.35rem; margin: 1.8em 0 .7em; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; margin: .2em 0; }

/*
 * Sidhuvud: ljus list som stannar överst. Logga till vänster och menyn till höger på datorn,
 * menyn som egen rad med kortare namn på mobilen. Samma bredd som innehållet.
 */
.top {
  position: sticky; top: 0; z-index: 500;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top::before { content: ''; display: block; height: 4px; background: linear-gradient(90deg, var(--brand) 0 70%, var(--accent) 70%); }
.top-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 10px 16px;
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "brand nav"; align-items: center; gap: 8px 20px;
}
.top a { text-decoration: none; }
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; color: var(--ink) !important; font-size: 1.12rem; letter-spacing: -.01em; white-space: nowrap; }
.brand b { color: var(--brand); }
.brand .logo { border-radius: 50%; }
.brand small { font-size: .7rem; background: var(--brand-soft); color: var(--brand); padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.nav { grid-area: nav; display: flex; justify-content: flex-end; gap: 0; min-width: 0; }
.nav a { position: relative; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: .95rem; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--brand-soft); }
.nav a[aria-current="page"] { color: var(--brand); }
.nav a[aria-current="page"]::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 3px; border-radius: 3px; background: var(--accent); }
.nav-short { display: none; }
@media (max-width: 760px) {
  .top-inner { grid-template-columns: 1fr; grid-template-areas: "brand" "nav"; padding: 8px 16px 0; gap: 4px; }
  .brand { font-size: 1.02rem; }
  .brand .logo { width: 30px; height: 30px; }
  /* Kortare namn och jämnt fördelade, så att hela menyn får plats på en rad. */
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .nav { justify-content: space-between; margin: 0 -8px; padding-bottom: 4px; }
  .nav a { padding: 8px 6px; font-size: .9rem; }
  .nav a[aria-current="page"]::after { left: 6px; right: 6px; }
}
/* Admin: den mörka listen behålls, så att det syns att man är i adminläget. */
.top-admin { position: static; background: #1d4466; backdrop-filter: none; border-bottom: 4px solid var(--accent); }
.top-admin::before { display: none; }
.top-admin .top-inner { max-width: none; display: flex; flex-wrap: wrap; justify-content: space-between; }
.top-admin a, .top-admin .brand, .top-admin .brand b { color: #fff !important; }
.top-admin .brand small { background: rgba(255,255,255,.2); color: #fff; }
.top-admin nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .95rem; }
.top-admin nav a { opacity: .9; }
.nav-btn { background: none; border: 0; color: #fff; font: inherit; padding: 0; cursor: pointer; opacity: .9; }
.center { text-align: center; }

main { max-width: var(--wrap); margin: 0 auto; padding: 20px 16px 40px; }

/* Sidfot */
.foot { background: var(--card); border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.foot-inner { max-width: var(--wrap); margin: 0 auto; padding: 26px 16px 34px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px 40px; }
.foot-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 1rem; margin: 0 0 6px; }
.foot-brand b { color: var(--brand); }
.foot-about p:last-child { margin: 0; }
.foot-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; align-content: start; }
.foot-links a { color: var(--ink); text-decoration: none; }
.foot-links a:hover { color: var(--brand); text-decoration: underline; }
@media (max-width: 640px) { .foot-inner { grid-template-columns: 1fr; } }

/* Startsidans huvuddel: bilden överst med rubriken på, texten och knapparna under – ett sammanhållet kort. */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 8px; box-shadow: 0 6px 24px rgba(20,40,60,.08); }
.hero-media { position: relative; }
.hero-media img { display: block; width: 100%; height: 340px; object-fit: cover; object-position: center 62%; }
.hero-media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(10,25,40,.72)); }
.hero-title { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0 24px 20px; color: #fff; }
.hero-title h1 { font-size: 2.1rem; margin: 0; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.hero-title .eyebrow { color: #ffd77a; }
.hero-body { padding: 20px 24px 24px; display: grid; grid-template-columns: 1fr auto; gap: 16px 28px; align-items: center; }
.hero-body .lead { margin: 0; }
.hero-body .hero-actions { flex-wrap: nowrap; }
.hero-body .hero-actions .btn { flex: none; }
@media (max-width: 760px) {
  .hero-body { grid-template-columns: 1fr; }
  .hero-body .hero-actions { flex-wrap: wrap; }
  .hero-body .hero-actions .btn { flex: 1 1 200px; }
}

/* Tre steg under huvudbilden */
.how { list-style: none; counter-reset: how; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.how li { counter-increment: how; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.how li::before {
  content: counter(how); grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: .95rem;
}
.how strong { font-size: 1rem; }
.how span { color: var(--muted); font-size: .88rem; line-height: 1.4; }
@media (max-width: 760px) { .how { grid-template-columns: 1fr; gap: 8px; } .how li { padding: 12px 14px; } }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem !important; font-weight: 700; color: var(--reed); margin: 0 0 4px !important; }
@media (max-width: 640px) {
  .hero-media img { height: 220px; }
  .hero-title { padding: 0 16px 14px; }
  .hero-title h1 { font-size: 1.55rem; }
  .hero-body { padding: 16px; }
}
.btn.cta { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 #c9901a; }

.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); font-size: .85rem; text-align: center;
  transition: transform .12s, box-shadow .12s;
}
.quick-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
@media (max-width: 560px) { .quick-grid { grid-template-columns: repeat(3, 1fr); } }

.card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.card-head h1 { margin: .1em 0; }
.card-head p { margin: 0; }
.cat-icon { flex: none; }

.photo-head {
  height: 170px; border-radius: var(--radius); background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: 18px; margin-bottom: 16px; position: relative; overflow: hidden;
}
.photo-head::before { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(10,25,40,.7)); }
.photo-head h1 { position: relative; color: #fff; margin: 0; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.lead { font-size: 1.1rem; }

.banner {
  display: block; margin: 36px 0 14px; border-radius: var(--radius); background-size: cover; background-position: center 60%;
  position: relative; overflow: hidden; color: #fff; text-decoration: none; min-height: 120px;
}
.banner span { position: relative; display: block; padding: 50px 20px 18px; background: linear-gradient(transparent, rgba(10,25,40,.8)); font-size: 1.05rem; }

.empty { text-align: center; color: var(--muted); }
.empty img { max-width: 160px; width: 50%; height: auto; opacity: .9; }
.thanks-art { max-width: 280px; width: 80%; height: auto; }

.horizon { height: 70px; max-width: var(--wrap); margin: 20px auto 0; background: url('/assets/img/horisont.svg') center bottom / contain no-repeat; }
@media (prefers-color-scheme: dark) { .horizon { opacity: .55; } }
.map-pin { border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.35); }

.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600;
  padding: 11px 20px; border-radius: 12px;
}
.btn:hover { filter: brightness(1.08); }
.btn.big { font-size: 1.15rem; padding: 16px 28px; border-radius: 14px; }
.btn.small { font-size: .9rem; padding: 7px 12px; border-radius: 10px; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.btn.danger { background: var(--danger); color: #fff; }
.link { background: none; border: 0; color: var(--brand); font: inherit; padding: 4px 0; cursor: pointer; text-decoration: underline; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card.narrow { max-width: 420px; margin: 20px auto; }
.card.center { text-align: center; }
.card.notice { border: 2px solid var(--accent); }
.emoji { font-size: 3rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.flash { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; background: var(--brand-soft); }
.flash.error { background: #f8dcd6; color: #5c1d12; }
.flash.info { background: #fff3d6; color: #4a3a10; }
@media (prefers-color-scheme: dark) {
  .flash.error { background: #4a211a; color: #f8dcd6; }
  .flash.info { background: #3b3120; color: #fff3d6; }
}

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; }
.form label > span { font-weight: 600; }
input, textarea, select {
  font: inherit; color: inherit; background: var(--bg); width: 100%;
  border: 2px solid var(--line); border-radius: 12px; padding: 11px 13px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; }
.letter-edit { font-family: Georgia, "Times New Roman", serif; line-height: 1.6; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; display: grid; gap: 12px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex !important; align-items: center; gap: 8px; }
.check input { width: auto; }
.hp { position: absolute; left: -9999px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline { display: inline; }

.photo { display: grid; gap: 8px; }
.photo-btn { display: block !important; cursor: pointer; }
.photo-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-label {
  display: block; text-align: center; padding: 22px; border: 2px dashed var(--brand);
  border-radius: 14px; color: var(--brand); font-weight: 600; background: var(--brand-soft);
}
.photo-preview, .attached { border-radius: 12px; max-height: 340px; object-fit: contain; display: block; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--brand-soft); }
.k-fel { background: var(--fel); }
.k-onskemal { background: var(--onskemal); }
.k-klagomal { background: var(--klagomal); }
.status { font-size: .8rem; color: var(--muted); margin-left: 6px; }
.s-atgardad { color: var(--brand); font-weight: 700; }

.list { display: grid; gap: 12px; }
.item { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; color: inherit; text-decoration: none; }
.item-media { position: relative; flex: none; width: 92px; height: 92px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; }
.item-media img:not(.item-icon) { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; }
.item-media img:not(.item-icon) + .item-icon { position: absolute; right: -6px; bottom: -6px; border: 2px solid var(--card); border-radius: 50%; }
.link-item > img { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; flex: none; }
.item-body { flex: 1; min-width: 0; }
.item h3 a { color: inherit; text-decoration: none; }
.item p { margin: 2px 0; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.voices { font-size: .9rem; color: var(--muted); }
.link-item:hover { outline: 2px solid var(--brand); }
.done { padding-left: 1.2em; }
.count { background: var(--accent); color: #2a1a00; border-radius: 99px; padding: 0 10px; font-size: 1rem; vertical-align: middle; }

.voices-box { text-align: center; background: var(--brand-soft); border-radius: 14px; padding: 18px; margin: 18px 0; }
.voices-box p { margin: 4px 0; }
.big-number { font-size: 2rem; font-weight: 800; }
.timeline { padding-left: 1.2em; color: var(--muted); }
.letter { font-family: Georgia, serif; white-space: normal; background: var(--bg); padding: 14px; border-radius: 12px; }
blockquote { margin: 0; padding: 10px 14px; background: var(--bg); border-left: 4px solid var(--brand); border-radius: 0 10px 10px 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.reject { margin-top: 14px; }
.reject summary { cursor: pointer; color: var(--danger); }
.reject[open] { display: grid; gap: 10px; }
.prose li { margin-bottom: 8px; }

.map { height: 320px; border-radius: var(--radius); border: 1px solid var(--line); margin: 0 0 14px; z-index: 0; }
.where { display: grid; gap: 8px; }
.where-label { font-weight: 600; }
.pick-map { height: 280px; margin: 0; cursor: crosshair; border: 2px dashed var(--brand); }
.pick-map.has-point { border-style: solid; }
.where-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.map-pin.faded { filter: grayscale(.4); }
.small-map { height: 220px; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table select { padding: 6px 8px; width: auto; }
@media (max-width: 560px) {
  .table { display: block; overflow-x: auto; }
  .hero h1 { font-size: 1.6rem; }
}

/* Bidrag */
.small-hero { padding-top: 10px; }
.small-hero h1 { font-size: 1.8rem; }
.grants { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.grant { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.grant h3 { margin: 0; }
.grant p { margin: 0; }
.grant-giver { font-size: .85rem; color: var(--muted); }
.grant-reason { background: var(--brand-soft); padding: 8px 10px; border-radius: 10px; font-size: .95rem; }
.grant dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .85rem; margin: 4px 0; }
.grant dt { color: var(--muted); }
.grant dd { margin: 0; }
.grant .actions { margin-top: auto; padding-top: 6px; }
.lvl-eu { background: #dfe7fb; }
.lvl-stat { background: #e6f2e2; }
.lvl-kommun { background: var(--fel); }
.lvl-stiftelse { background: var(--klagomal); }
@media (prefers-color-scheme: dark) {
  .lvl-eu { background: #1f2a44; }
  .lvl-stat { background: #22351f; }
}
.pre { white-space: pre-wrap; }

/* Nyheter */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; margin: 1.8em 0 .7em; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .9rem; text-decoration: none; font-weight: 600; }
.section-head a:hover { text-decoration: underline; }
.latest-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.latest-list > a { text-decoration: none; color: inherit; }
.latest-list > a:hover .news { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.news { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; height: 100%; }
.news-meta time { white-space: nowrap; }
/* Etikett och datum på var sin rad i de små korten, så att alla kort ser likadana ut. */
.news.compact .news-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0 0 4px; }
.news h3 { margin: 2px 0 4px; font-size: 1.05rem; }
.news p { margin: 0 0 6px; }
.news.compact h3 { font-size: .95rem; margin-bottom: 0; }
.news-meta { font-size: .8rem; color: var(--muted); }
.news-list { display: grid; gap: 10px; }
.news:target { outline: 3px solid var(--accent); }
.year { color: var(--muted); font-size: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.nk-beslut { background: #f8e3c3; }
.nk-nyhet { background: var(--brand-soft); }
.nk-trafik { background: #fde0da; }
.nk-evenemang { background: #e8def5; }
@media (prefers-color-scheme: dark) {
  .nk-beslut { background: #4a3a1e; } .nk-trafik { background: #4a2622; } .nk-evenemang { background: #3a2b52; }
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.filters a { padding: 6px 14px; border-radius: 99px; background: var(--card); text-decoration: none; color: var(--ink); font-size: .9rem; }
.filters a.active { background: var(--brand); color: var(--brand-ink); }

.suggestion { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.suggestion .news { padding: 0; }
.idea h2 { margin-top: 0; }
.proposal-link { text-decoration: none; color: inherit; display: block; }
.proposal:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.proposal .card-head { margin-bottom: 4px; }
.proposal h3 { font-size: 1rem; }
.badge.sent { background: #dcefd8; color: #1f5a28; font-weight: 700; letter-spacing: .02em; }
@media (prefers-color-scheme: dark) { .badge.sent { background: #1f3a22; color: #b9e3b2; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex !important; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--bg); border: 2px solid var(--line); cursor: pointer; font-size: .9rem; }
.chip input { width: auto; margin: 0; }
.chip:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 10px 0 24px; }
.path { display: block; background: var(--card); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); border: 2px solid transparent; }
.path:hover { border-color: var(--brand); }
.path .emoji { font-size: 2rem; }
/* Kort med bild överst (startsidans "Gör byn bättre tillsammans") */
.path-img { padding: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); transition: transform .12s, box-shadow .12s; }
.path-img:hover { border-color: var(--line); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,40,60,.1); }
/* Inzoomat utsnitt, så att de två korten visar olika delar av bilden. */
.path-pic { display: block; height: 130px; background-size: 190% auto; }
.path-text { display: grid; gap: 4px; padding: 14px 18px 16px; }
.path-text strong { font-size: 1.1rem; }
.path-text span { color: var(--muted); font-size: .92rem; }
.path-text em { font-style: normal; font-weight: 600; color: var(--brand); font-size: .92rem; margin-top: 4px; }
.done-title { margin: 22px 0 6px; font-size: 1rem; color: var(--muted); }
.path h3 { margin: 6px 0; }
.path p { margin: 0; color: var(--muted); font-size: .92rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; } }
.flow { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.flow li { position: relative; }
.flow a { display: grid; gap: 4px; height: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); color: inherit; text-decoration: none; font-size: .88rem; }
.flow a span { color: var(--muted); }
.flow a:hover { border-color: var(--brand); }
.flow li.on a { border: 2px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -7px; top: 50%; transform: translate(50%, -50%); color: var(--muted); font-size: .8rem; }
@media (max-width: 760px) { .flow li::after { display: none; } }
.btn.ghost.liked { background: color-mix(in srgb, #d6455a 12%, transparent); box-shadow: inset 0 0 0 2px #d6455a; color: #b3263b; }
@media (prefers-color-scheme: dark) { .btn.ghost.liked { color: #ff9aa8; } }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn { flex: 1 1 200px; text-align: center; }
.assoc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.assoc { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.assoc h3 { font-size: 1rem; margin: 0 0 4px; }
.assoc p { margin: 4px 0; }
.toc { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; }
.toc a { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
[hidden] { display: none !important; }
.village-map { height: 560px; }
@media (max-width: 640px) { .village-map { height: 420px; } }
.place-pin span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 2px solid #1d4466; box-shadow: 0 1px 4px rgba(0,0,0,.35); font-size: 16px; }
.place-pin.approx span { border-style: dashed; border-color: #d4881a; opacity: .85; }
.place-pin.inactive span { opacity: .4; }
.place-pin { position: relative; }
.place-pin i { position: absolute; right: -6px; bottom: -5px; font-style: normal; font-size: 11px; line-height: 1; }
.place-pin.st-bekraftad span { border-color: #2f7a4a; }
.bykarta-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: .5em 0; }
.fact { border-top: 1px solid var(--line); padding: 8px 0; }
.fact summary { cursor: pointer; }
.fact.off summary { opacity: .55; }
.fact-form { margin-top: 8px; }
.likes-admin { border-bottom: 1px solid var(--line); margin-bottom: 12px; padding-bottom: 6px; }
.likes-admin .actions { align-items: center; }
.likes-input { width: 5em !important; padding: 6px 8px; }
.job { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.job.off .job-head { opacity: .6; }
.job h3 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.job-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 8px 0; }
.job-form label { display: grid; gap: 2px; }
.job-form select { width: auto; padding: 7px 9px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; text-align: center; }
.stats p { margin: 0; }
.meter { height: 12px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--reed); border-radius: 99px; }
.meter span.warn { background: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 6px 0 22px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar span { width: 100%; max-width: 28px; background: var(--brand); border-radius: 4px 4px 0 0; }
.bar small { position: absolute; bottom: -18px; font-size: .7rem; color: var(--muted); }
.idea-grants { padding-left: 1.1em; display: grid; gap: 8px; }
.idea-grants .btn { margin-left: 6px; }

/* Admin: vägar */
.road-list { display: grid; gap: 8px; }
.road-row { display: grid; grid-template-columns: 2fr 70px 2fr 3fr auto; gap: 8px; align-items: center; background: var(--card); padding: 8px; border-radius: 12px; }
.road-row input, .road-row select { padding: 7px 9px; }
@media (max-width: 760px) { .road-row { grid-template-columns: 1fr 1fr; } }

/* Väntläge medan brevet skrivs */
.busy {
  position: fixed; inset: 0; background: rgba(20,30,25,.75); color: #fff; z-index: 1000;
  display: grid; place-items: center; text-align: center; padding: 16px; font-size: 1.2rem;
}
.busy .pen { font-size: 3rem; animation: write 1s ease-in-out infinite alternate; }
@keyframes write { from { transform: translateX(-12px) rotate(-8deg); } to { transform: translateX(12px) rotate(8deg); } }

/* Bidrag och avdrag hemma (/privat.php) */
.search-row { display: flex; gap: 8px; margin: 0 0 12px; }
.search-row input { flex: 1; min-width: 0; }
.grant.gone { opacity: .75; border-style: dashed; }
/* Stiftelselistan */
.stift-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.stift-list details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.stift-list summary { cursor: pointer; }
.stift-snippet { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.stift-list details[open] .stift-snippet { display: none; }
.stift-purpose { margin: 8px 0; font-size: .95rem; overflow-wrap: anywhere; }

/* Privata bidrag – AI-tips */
.ai-answer { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line, #ddd); }
.ai-answer h3 { margin: 16px 0 6px; }
.ai-tips { padding-left: 1.3em; margin: 0; }
.ai-tip { margin-bottom: 14px; }
.ai-tip p { margin: 4px 0; }
.ai-tip .stift-list { margin-top: 6px; }
.ai-ask textarea { width: 100%; }
/* ---------- Tidsresan i Hampetorp (spel.php) ---------- */
.spel { margin: 14px 0 18px; }
.spel-stage { position: relative; background: #1c1208; border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 28px rgba(20,12,4,.25); }
.spel-frame { position: relative; width: 100%; aspect-ratio: 3 / 2; margin: 0 auto; }
.spel-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
.spel-frame.menu { aspect-ratio: auto; min-height: 420px; }
.spel-frame.menu canvas { display: none; }
.spel-ui { position: absolute; inset: 0; overflow: auto; color: #f6ead2; padding: clamp(14px, 3vw, 28px); background: radial-gradient(ellipse at top, #3a2814, #1c1208 70%); }
.spel-frame.menu .spel-ui { position: relative; inset: auto; min-height: 420px; }
.spel-ui.hidden { display: none; }
.spel-ui h2 { color: #ffe08a; margin: .1em 0 .35em; font-size: clamp(1.3rem, 3.6vw, 2rem); }
.spel-ui p { margin: .4em 0; line-height: 1.45; }
.spel-ui a { color: #ffe08a; }
.spel-ui .btn.ghost { color: #f6ead2; box-shadow: inset 0 0 0 2px rgba(246,234,210,.6); }
.spel-ui .btn.spel-primary { background: var(--accent); color: var(--accent-ink); font-size: 1.1rem; padding: 12px 22px; }
.spel-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: #d8b878; font-weight: 700; }
.spel-small { font-size: .85rem; opacity: .85; }
.spel-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.spel-quit { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 18px; cursor: pointer; }
.spel-quit[hidden] { display: none; }
.spel-bar { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.spel-start { margin: calc(-1 * clamp(14px, 3vw, 28px)); min-height: 420px; background-size: cover; background-position: center; display: flex; align-items: flex-end; filter: sepia(.25); }
.spel-start-inner { width: 100%; padding: clamp(18px, 4vw, 36px); background: linear-gradient(transparent, rgba(28,18,8,.92) 30%); }
.spel-start h2 { font-size: clamp(1.8rem, 6vw, 3rem); margin: 0; }
.spel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.spel-total { color: #ffe08a; font-weight: 800; }
.spel-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.spel-stop { position: relative; min-height: 112px; border: 0; border-radius: 12px; background-size: cover; background-position: center; color: #fff; text-align: left; padding: 10px; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer; overflow: hidden; font: inherit; transition: transform .12s; }
.spel-stop::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(28,18,8,.1), rgba(28,18,8,.88)); }
.spel-stop > span { position: relative; }
.spel-stop:hover:not(:disabled) { transform: translateY(-2px); }
.spel-stop.locked { filter: grayscale(1) brightness(.45); cursor: default; }
.spel-stop.klar { box-shadow: inset 0 0 0 3px #f2b630; }
.spel-stop-year { font-size: .75rem; color: #ffe08a; font-weight: 700; }
.spel-stop-title { font-weight: 800; line-height: 1.2; }
.spel-stop-stars { color: #f2b630; letter-spacing: 2px; }
.spel-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(12px, 3vw, 26px); align-items: start; }
.spel-intro figure { margin: 0; }
.spel-intro img { width: 100%; border-radius: 10px; display: block; filter: sepia(.2); }
.spel-intro figcaption { font-size: .78rem; opacity: .75; margin-top: 4px; }
.spel-how { background: rgba(255,224,138,.12); border-left: 4px solid #f2b630; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.spel-rotate { display: none; font-size: .82rem; opacity: .8; }
.spel-result { text-align: center; max-width: 620px; margin: 0 auto; }
.spel-result .spel-btns { justify-content: center; }
.spel-bigstars { font-size: clamp(2.4rem, 8vw, 3.6rem); color: #f2b630; margin: 0; letter-spacing: 6px; line-height: 1.1; }
.spel-fact { display: flex; gap: 14px; text-align: left; background: rgba(255,255,255,.07); border-radius: 12px; padding: 12px; margin-top: 12px; align-items: center; }
.spel-fact img { width: 110px; height: 80px; object-fit: cover; border-radius: 8px; flex: none; filter: sepia(.2); }
.spel-fact strong { color: #ffe08a; }
.spel-fact p { margin: .2em 0 0; }
.spel-unlock { color: #bff5a0; font-weight: 700; }
.spel-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.spel-photo { border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.07); color: inherit; font: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; }
.spel-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; filter: sepia(.2); }
.spel-photo > span { padding: 6px 8px; font-size: .78rem; line-height: 1.3; }
.spel-photo.locked { cursor: default; min-height: 150px; justify-content: center; align-items: center; text-align: center; opacity: .6; }
.spel-lock { font-size: 1.8rem; }
.spel-lightbox { text-align: center; }
.spel-lightbox img { max-width: 100%; max-height: 62vh; border-radius: 10px; }
.spel-lightbox .spel-btns { justify-content: center; }
.spel-stage:fullscreen { display: flex; align-items: center; justify-content: center; border-radius: 0; }
.spel-stage:fullscreen .spel-frame { width: min(100vw, 150vh); }
.spel-stage:fullscreen .spel-frame.menu { width: min(100vw, 900px); max-height: 100vh; overflow: auto; }
.spel-stage:-webkit-full-screen { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.spel-stage:-webkit-full-screen .spel-frame { width: min(100vw, 150vh); }
@media (max-width: 640px) {
  .spel-intro { grid-template-columns: 1fr; }
  .spel-intro figure img { max-height: 170px; object-fit: cover; }
  .spel-fact img { width: 80px; height: 64px; }
  .spel-ui .btn.spel-primary { width: 100%; }
}
@media (orientation: portrait) and (max-width: 640px) { .spel-rotate { display: block; } }
.spel-teaser .path-pic { filter: sepia(.35); }
/* ---------- Sommaren 1939 (aventyr.php) ---------- */
.av { margin: 14px 0 18px; }
.av-stage { position: relative; height: min(78vh, 680px); min-height: 460px; border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 28px rgba(20,12,4,.25); background: #e8dcc0; }
.av-map { position: absolute; inset: 0; }
.av-map .leaflet-tile-pane { filter: sepia(.45) saturate(.8) brightness(1.03); }
.av-top { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 500; display: flex; gap: 8px; align-items: flex-start; pointer-events: none; }
.av-top > * { pointer-events: auto; }
.av-goal { flex: 1; background: rgba(28,18,8,.86); color: #f6ead2; border-radius: 12px; padding: 8px 12px; box-shadow: 0 3px 12px rgba(0,0,0,.2); min-width: 0; }
.av-chapter { display: block; font-size: .72rem; color: #e8c879; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.av-goal-text { display: block; line-height: 1.3; }
.av-tools { display: flex; gap: 6px; }
.av-btn { border: 0; border-radius: 12px; background: rgba(28,18,8,.86); color: #f6ead2; padding: 9px 11px; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.av-btn:hover { background: #3a2814; }
.av-toast { position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 20px); z-index: 600; background: rgba(28,18,8,.9); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; max-width: 90%; text-align: center; }
.av-toast.on { opacity: 1; transform: translate(-50%, 0); }
.av-dialog { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 700; display: flex; gap: 12px; align-items: flex-start; background: #fbf5e6; color: #2a1d0e; border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 26px rgba(0,0,0,.3); border: 2px solid #c9a35a; max-width: 760px; margin: 0 auto; cursor: pointer; }
.av-dialog[hidden] { display: none; }
.av-dialog.narrator { background: #2a1d0e; color: #f6ead2; border-color: #6a4a22; font-style: italic; }
.av-portrait { flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: #e8d7a0; display: grid; place-items: center; font-size: 34px; border: 2px solid #c9a35a; }
.av-portrait img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.3); }
.av-say { flex: 1; min-width: 0; }
.av-who { margin: 0; font-weight: 800; }
.av-who small { display: block; font-weight: 500; font-size: .78rem; opacity: .7; }
.av-text { margin: .3em 0 .5em; line-height: 1.45; font-size: 1.02rem; }
.av-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.av-choice { border: 0; border-radius: 10px; padding: 8px 12px; font: inherit; font-weight: 700; cursor: pointer; background: #1d4466; color: #fff; text-align: left; }
.av-choice.next { background: var(--accent); color: var(--accent-ink); margin-left: auto; }
.av-overlay { position: absolute; inset: 0; z-index: 800; background: rgba(20,12,4,.55); display: grid; place-items: center; padding: 12px; overflow: auto; }
.av-overlay[hidden] { display: none; }
.av-card { background: #fbf5e6; color: #2a1d0e; border-radius: 16px; padding: clamp(14px, 3vw, 24px); max-width: 560px; width: 100%; max-height: 100%; overflow: auto; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.av-card h2 { margin: .1em 0 .3em; color: #6a3a14; }
.av-card p { line-height: 1.45; }
.av-card a { color: #1d4466; }
.av-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: #9a6a2a; font-weight: 800; margin: 0; }
.av-date { font-size: 1.15rem; font-weight: 700; color: #6a4a22; }
.av-small, .av-credit { font-size: .82rem; opacity: .8; }
.av-credit { margin-top: 2px; }
.av-cardimg { width: 100%; max-height: min(200px, 24vh); object-fit: cover; border-radius: 10px; filter: sepia(.25); }
.av-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.av-card .btn.primary { background: var(--accent); color: var(--accent-ink); }
.av-card .btn.ghost { color: #1d4466; box-shadow: inset 0 0 0 2px #1d4466; }
.av-stats { list-style: none; padding: 0; margin: 8px 0; text-align: left; display: inline-block; }
.av-stats li { padding: 2px 0; }
.av-mems { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; text-align: left; }
.av-mem { border: 0; border-radius: 10px; padding: 0; background: #efe3c4; color: inherit; font: inherit; font-size: .8rem; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; }
.av-mem img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; filter: sepia(.25); }
.av-mem > span:last-child { padding: 6px 8px; line-height: 1.25; font-weight: 600; }
.av-mem-icon { display: grid; place-items: center; aspect-ratio: 4 / 3; font-size: 2rem; background: #e2d2a8; }
.av-mem.locked { cursor: default; opacity: .55; }
.av-game { max-width: 620px; }
.av-game canvas { width: 100%; aspect-ratio: 3 / 2; border-radius: 10px; touch-action: none; user-select: none; -webkit-user-select: none; display: block; background: #ddd; }
.av-hint { font-weight: 600; background: #f2e2b8; border-radius: 8px; padding: 6px 10px; }
.av-gstatus { font-weight: 800; margin: 6px 0 0; }
.av-win { font-size: 1.3rem; font-weight: 800; color: #2f7a2a; margin: 4px 0; width: 100%; }
.av-lose { font-weight: 700; color: #a33a22; margin: 4px 0; width: 100%; }
.av-pin { display: grid !important; place-items: center; background: #fbf5e6; border: 2px solid #6a3a14; border-radius: 50%; font-size: 18px; box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: pointer; }
.av-pin.av-seen { border-color: #2f7a2a; }
.av-pin.av-target { border: 3px solid #e0402e; animation: av-pulse 1.2s infinite; z-index: 900 !important; }
@keyframes av-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,64,46,.7); } 50% { box-shadow: 0 0 0 12px rgba(224,64,46,0); } }
.av-me span { display: block; font-size: 30px; line-height: 40px; text-align: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); transform: scaleX(-1); }
.av-me.flip span { transform: none; }
.av-mail span { display: block; font-size: 22px; text-align: center; animation: av-bob 1s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.av-mail.extra span { filter: hue-rotate(160deg) drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
@keyframes av-bob { 50% { transform: translateY(-5px); } }
@media (max-width: 600px) {
  .av-stage { height: 80vh; min-height: 480px; border-radius: 12px; }
  .av-top { flex-direction: column; }
  .av-tools { align-self: flex-end; }
  .av-portrait { width: 48px; height: 48px; font-size: 26px; }
  .av-text { font-size: .95rem; }
}
/* Sommaren 1939: årstider, sidouppdrag, uppdragslista och dagbok */
.av-stage.host .av-map .leaflet-tile-pane { filter: sepia(.6) saturate(1.15) hue-rotate(-12deg) brightness(.97); }
.av-stage.vinter .av-map .leaflet-tile-pane { filter: grayscale(.85) brightness(1.18) contrast(.9); }
.av-stage.vinter::after { content: ""; position: absolute; inset: 0; z-index: 450; pointer-events: none; opacity: .75;
  background-image: radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%), radial-gradient(2px 2px at 80px 120px, #fff 50%, transparent 51%), radial-gradient(3px 3px at 150px 60px, #fff 50%, transparent 51%), radial-gradient(2px 2px at 200px 170px, #fff 50%, transparent 51%), radial-gradient(3px 3px at 260px 20px, #fff 50%, transparent 51%);
  background-size: 300px 200px; animation: av-snow 9s linear infinite; }
@keyframes av-snow { from { background-position: 0 0; } to { background-position: -60px 200px; } }
@media (prefers-reduced-motion: reduce) { .av-stage.vinter::after { animation: none; } .av-pin.av-target, .av-mail span, .av-side span { animation: none; } }
.av-side span { display: block; font-size: 20px; text-align: center; animation: av-bob 1.2s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.av-quests { list-style: none; padding: 0; margin: 6px 0 10px; text-align: left; }
.av-quests li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #e2d2a8; flex-wrap: wrap; }
.av-quests li span { font-weight: 700; flex: 1; min-width: 140px; }
.av-quests li small { opacity: .7; }
.av-diary { text-align: left; padding-left: 1.3em; line-height: 1.45; }
.av-diary li { margin-bottom: 8px; }
/* Sommaren 1939: gamla bilder på kartan, i dialoger, minispel och bildarkiv */
.av-photo span { display: inline-flex; align-items: center; gap: 2px; background: #fbf5e6; border: 2px solid #6a3a14; border-radius: 8px; padding: 0 4px; font-size: 13px; line-height: 20px; box-shadow: 0 2px 4px rgba(0,0,0,.35); cursor: pointer; white-space: nowrap; }
.av-photo span b { font-size: 11px; color: #6a3a14; }
.av-photo.all span { border-color: #2f7a2a; background: #e8f5df; }
.av-snap { position: absolute; left: 10px; bottom: 34px; z-index: 600; border: 3px solid #fbf5e6; border-radius: 10px; padding: 0; overflow: hidden; width: 110px; height: 82px; background: #2a1d0e; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.35); transform: rotate(-3deg); }
.av-snap[hidden] { display: none; }
.av-snap img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.3); }
.av-snap span { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 5px; }
.av-dialog { flex-wrap: wrap; }
.av-scene { flex-basis: 100%; margin: 0 0 4px; display: flex; gap: 8px; align-items: flex-end; }
.av-scene img { max-height: 120px; max-width: 70%; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); filter: sepia(.25); transform: rotate(-1.5deg); }
.av-scene figcaption { font-size: .72rem; opacity: .75; font-style: normal; }
.av-photo-big { max-width: 100%; max-height: 52vh; border-radius: 10px; filter: sepia(.15); box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.av-left { text-align: left; }
.av-archive { text-align: left; max-height: 58vh; overflow: auto; margin: 8px 0; }
.av-arch { border-bottom: 1px solid #e2d2a8; padding: 6px 0; }
.av-arch-head { margin: 0 0 4px; font-weight: 800; }
.av-arch-head small { font-weight: 600; opacity: .6; }
.av-arch-row { display: flex; flex-wrap: wrap; gap: 6px; }
.av-thumb { width: 72px; height: 56px; border: 0; padding: 0; border-radius: 6px; overflow: hidden; background: #e2d2a8; display: grid; place-items: center; cursor: pointer; }
.av-thumb img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.25); }
.av-thumb.locked { cursor: default; opacity: .6; font-size: 1.2rem; }
.av-ghead { display: flex; gap: 10px; align-items: center; text-align: left; }
.av-ghead .av-hint { flex: 1; margin: 0; }
.av-gphoto { margin: 0; flex: 0 0 120px; }
.av-gphoto img { width: 120px; height: 84px; object-fit: cover; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); filter: sepia(.25); }
.av-gphoto figcaption { font-size: .68rem; line-height: 1.2; opacity: .75; max-height: 2.5em; overflow: hidden; }
.av .link { background: none; border: 0; color: #1d4466; text-decoration: underline; cursor: pointer; font: inherit; padding: 2px 0; }
@media (max-width: 600px) {
  .av-scene img { max-height: 80px; }
  .av-gphoto { flex-basis: 84px; } .av-gphoto img { width: 84px; height: 60px; } .av-gphoto figcaption { display: none; }
  .av-snap { width: 86px; height: 64px; }
}
/* Tidsresan: bildremsa med gamla bilder på introskärmen */
.spel-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.spel-strip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; filter: sepia(.25); }
.av .leaflet-top, .av .leaflet-bottom { z-index: 400; } /* dialoger och kort ska ligga över kartans knappar */

/* Sommaren 1939: kartram, kompass, framstegsmätare, målets namn och nya minispel */
.av-stage { border: 6px solid #6a4a22; box-shadow: 0 8px 28px rgba(20,12,4,.3), inset 0 0 0 2px #c9a35a; }
.av-stage::before { content: ""; position: absolute; inset: 0; z-index: 440; pointer-events: none; box-shadow: inset 0 0 60px rgba(60,35,10,.35); }
.av-progress { height: 5px; background: rgba(255,255,255,.18); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.av-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f2c230, #ffe08a); border-radius: 3px; transition: width .6s; }
.av-compass { position: absolute; right: 14px; bottom: 74px; z-index: 450; width: 46px; height: 46px; border-radius: 50%; background: rgba(251,245,230,.85); border: 2px solid #6a3a14; display: grid; place-items: center; font-size: 22px; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.av-compass span { position: absolute; top: -2px; font: 800 10px system-ui; color: #6a3a14; }
.leaflet-tooltip.av-tip-target { background: #e0402e; color: #fff; border: 0; font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.leaflet-tooltip.av-tip-target::before { border-top-color: #e0402e; }
.av-me span { animation: av-ride .5s ease-in-out infinite alternate; }
@keyframes av-ride { from { margin-top: 0; } to { margin-top: -3px; } }
.av-game canvas { box-shadow: inset 0 0 0 3px #c9a35a; }
.av-win small { display: inline-block; font-size: .75rem; color: #6a4a22; margin-left: 6px; }
@media (max-width: 600px) { .av-compass { bottom: 60px; width: 38px; height: 38px; font-size: 18px; } .av-stage { border-width: 4px; } }
/* Admin → Bergmans memoarer */
.memoir-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.memoir-tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.memoir-tabs a[aria-current] { background: var(--accent); color: #fff; border-color: var(--accent); }
.memoir-text { max-width: 760px; line-height: 1.65; }
.memoir-text h2 { margin-top: 1.4em; }
.memoir-part + .memoir-part { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 8px; }
.memoir-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 10px 0; }
.memoir-gallery figure { margin: 0; }
.memoir-gallery img { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; display: block; }
.memoir-gallery figcaption { margin-top: 4px; }
.memoir-people li { margin: 0 0 6px; }.memoir-map-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
#memoir-map.map-full { position: fixed; inset: 0; height: auto; z-index: 1000; border-radius: 0; margin: 0; }
#memoir-map:fullscreen { height: 100%; }
.memoir-more { margin: 8px 0; }
.memoir-more summary { cursor: pointer; }.register-tools { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.register-tools label { display: grid; gap: 2px; }
.register-group { margin: 1.2em 0 .3em; font-size: 1rem; }
.register-row { border-top: 1px solid var(--line); padding: 6px 0; }
.register-row summary { cursor: pointer; }
.register-body { padding: 4px 0 8px 26px; }
.register-body blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); }
.register-hits li { margin-bottom: 6px; }
.register-pics { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.register-pics img { height: 90px; }
.memoir-place { white-space: nowrap; margin-right: 6px; }
.memoir-place a { margin-left: 2px; text-decoration: none; }

/* Admin → Familjen */
.fam-pedigree { display: grid; gap: 8px; overflow-x: auto; }
.fam-gen { display: grid; grid-template-columns: 150px repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; align-items: center; }
.fam-gen-label { grid-column: 1; }
.fam-box { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--card); font-size: .9rem; }
.fam-box.empty { color: var(--muted, #888); border-style: dashed; text-align: center; }
.fam-desc, .fam-desc ul { list-style: none; padding-left: 18px; margin: 4px 0; }
.fam-desc > li { padding-left: 0; }
.fam-list { columns: 2 280px; padding-left: 18px; }
.fam-list li { break-inside: avoid; margin-bottom: 2px; }
.fam-timeline { padding-left: 18px; }
.fam-timeline li { margin-bottom: 4px; }
.fam-group { border-top: 1px solid var(--line); padding: 6px 0; }
.fam-popup { max-height: 220px; overflow: auto; padding-left: 16px; }
#family-map.map-full { position: fixed; inset: 0; height: auto; z-index: 1000; border-radius: 0; margin: 0; }
.fam-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.fam-filter a[aria-current] { font-weight: 700; text-decoration: none; }
.fam-verdict { font-size: .75rem; font-weight: 700; padding: .15em .6em; border-radius: 999px; vertical-align: middle; border: 1px solid currentColor; }
.fam-verdict.ok { color: #2f7a4a; }
.fam-verdict.warn { color: #9a6a00; }
.fam-verdict.bad { color: var(--danger); }
.fam-warn { color: var(--danger); }
.fam-chain { border-top: 1px solid var(--line); padding: 8px 0; }
.fam-chain summary { cursor: pointer; }
.fam-chain ol { margin: 8px 0 0; padding-left: 24px; }
.fam-chain li { margin: 2px 0; }
.fam-weak { background: color-mix(in srgb, var(--danger) 10%, transparent); border-radius: 4px; }
.fam-wrong { border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); padding: 8px 12px; margin: 8px 0; border-radius: 4px; }
.fam-fixed s { color: var(--muted); }
.fam-belagt { border-top: 1px solid var(--border, #ddd); padding-top: 8px; margin-top: 8px; }
.fam-belagt:first-of-type { border-top: 0; }
.fam-belagt h3 { margin-bottom: 2px; }
.forr-search { display: block; margin: 16px 0; }
.forr-search input { width: 100%; }
.forr-card { border-top: 1px solid var(--border, #ddd); padding: 12px 0; }
.forr-card h2 { font-size: 1.15rem; margin: 0 0 8px; }
.forr-fig { margin: 0; }
.forr-fig img { width: 100%; max-width: 560px; height: auto; border-radius: 6px; display: block; }
.forr-fig figcaption { font-size: .9em; margin-top: 4px; max-width: 560px; }
.forr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 8px; }
.forr-pop img { width: 200px; height: auto; display: block; border-radius: 4px; margin-bottom: 4px; }
.sgg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 8px 0; }
.sgg { margin: 0; }
.sgg img { width: 100%; height: auto; border-radius: 4px; display: block; }
.sgg figcaption { font-size: .85em; margin-top: 4px; }

/* Admin → Familjen (sanningsfliken): antavla som rutor med föräldrarna till höger, nivå på varje länk */
.niva { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; vertical-align: middle; }
.niva-sedd { color: #1f6b3a; background: #e3f3e6; }
.niva-avskrift { color: #3d6b1f; background: #edf5e0; }
.niva-index { color: #8a5d00; background: #fdf3dc; border-style: dashed; }
.niva-uppgift { color: var(--brand); background: var(--brand-soft); }
@media (prefers-color-scheme: dark) {
  .niva-sedd { color: #9fe0b2; background: #1b3a25; }
  .niva-avskrift { color: #c3e39f; background: #2a3a1b; }
  .niva-index { color: #f0cd7a; background: #3a2f14; }
}
.ft-levels { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
.ft-scroll { overflow-x: auto; padding: 4px 2px 10px; }
.ft-node { display: flex; align-items: center; gap: 0; }
.ft-parents { display: flex; flex-direction: column; padding-left: 32px; position: relative; }
.ft-parents::before { content: ""; position: absolute; left: 0; top: 50%; width: 16px; border-top: 2px solid var(--line); }
.ft-parents > .ft-node { position: relative; padding: 3px 0; }
.ft-parents > .ft-node::before { content: ""; position: absolute; left: -16px; top: 50%; width: 16px; border-top: 2px solid var(--line); }
.ft-parents > .ft-node::after { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; border-left: 2px solid var(--line); }
.ft-parents > .ft-node:first-child::after { top: 50%; }
.ft-parents > .ft-node:last-child::after { bottom: 50%; }
.ft-parents > .ft-node:only-child::after { display: none; }
.ft-branch { width: min(96vw, 1600px); margin-left: 50%; transform: translateX(-50%); }
.ft-card { flex: 0 0 auto; width: 190px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; background: var(--card); display: flex; flex-direction: column; gap: 2px; position: relative; }
.ft-card .niva { align-self: flex-start; }
.ft-badges { display: flex; flex-wrap: wrap; gap: 3px 4px; align-items: center; padding-right: 16px; }
.ft-who { font-size: .7rem; color: var(--muted); }
.niva-ancestry { color: var(--muted); background: transparent; border-style: dotted; }
a.niva { text-decoration: none; cursor: pointer; }
a.niva:hover, a.niva:focus-visible { filter: brightness(.92); box-shadow: 0 0 0 2px currentColor; }
.ft-level-list { border-top: 1px solid var(--line); padding: 6px 0; }
.ft-level-list summary { cursor: pointer; }
.ft-level-list ul { margin: 6px 0 0; padding-left: 18px; }
#kyrkboken:target, .ft-rel:target, #kallor:target { box-shadow: 0 0 0 3px #2f7a4a66; border-radius: 8px; }
.ft-sib { font-size: .78rem; margin-top: 2px; }
.ft-sib summary { cursor: pointer; color: var(--muted); list-style: none; }
.ft-sib summary::-webkit-details-marker { display: none; }
.ft-sib summary::before { content: "＋ "; }
.ft-sib[open] summary::before { content: "－ "; }
.ft-sib ul { margin: 4px 0 2px; padding: 4px 0 0; list-style: none; border-top: 1px dashed var(--line); display: grid; gap: 3px; text-align: left; }
.ft-sib .niva { font-size: .62rem; padding: 0 5px; }
/* Familjen: berättelser på rutorna och i rutan som öppnas */
.ft-card-points { margin: 3px 0 0; padding-left: 14px; font-size: .74rem; line-height: 1.3; color: var(--ink, inherit); }
.ft-card-points li { margin: 1px 0; }
.ft-story-btn { align-self: flex-start; margin-top: 3px; font: inherit; font-size: .76rem; font-weight: 600; color: var(--brand); background: var(--brand-soft); border: 1px solid transparent; border-radius: 99px; padding: 1px 8px; cursor: pointer; }
.ft-story-btn:hover, .ft-story-btn:focus-visible { border-color: var(--brand); }
.ft-dialog { width: min(760px, 94vw); max-height: 88vh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: inherit; box-shadow: 0 18px 50px #0004; }
.ft-dialog::backdrop { background: #0006; }
.ft-dialog-close { position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; z-index: 1; }
.ft-dialog-body { padding: 14px 20px 18px; overflow: auto; max-height: 86vh; }
.ft-dialog-body h2 { margin-top: 0; }
.ft-points { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.ft-points li { display: flex; gap: 10px; align-items: flex-start; padding-left: 14px; position: relative; }
.ft-points li::before { content: "•"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.ft-point-img { flex: 0 0 auto; order: 2; margin-left: auto; }
.ft-point-img img { width: 88px; height: 66px; object-fit: cover; border-radius: 6px; display: block; border: 1px solid var(--line); }
.ft-src { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.ft-read-h { font-size: 1rem; margin: 14px 0 6px; }
.ft-read { border-top: 1px solid var(--line); padding: 6px 0; }
.ft-read summary { cursor: pointer; font-weight: 600; }
.ft-read p { max-width: 68ch; }

/* Familjen → Spelet: berättelsen spelas i en mörk scen med bakgrundsbild, HUD, kapitelkort och minispel (assets/familj-spel.js) */
.spel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.spel-person img { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 8px; transition: transform .2s; }
.spel-person img:hover { transform: scale(1.02); }
.spel-person h2 { font-size: 1.1rem; margin: 0 0 4px; }
.spel-typ { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; margin-right: 6px; }
.spel-sant { color: #1f6b3a; background: #e3f3e6; }
.spel-delvis { color: #8a5d00; background: #fdf3dc; }
.spel-dikt { color: #6b3f9a; background: #f1e8fb; }
.spel-edit label { display: block; margin-bottom: 6px; }
.spel-edit textarea, .spel-edit input, .spel-edit select { width: 100%; }
.spel-manus { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; line-height: 1.45; }
.spel-edit-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.spel-facts li { margin-bottom: 6px; }
.spel-help td { vertical-align: top; }
.spel-edit .btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.vn-root { --vn-ink: #f4efe4; --vn-dim: #c9c2b2; position: relative; overflow: hidden; border-radius: 18px; background: #14161c; color: var(--vn-ink); height: min(88vh, 900px); min-height: 560px;
  display: flex; flex-direction: column; box-shadow: 0 20px 50px #0004; isolation: isolate; width: min(96vw, 1180px); margin-left: 50%; transform: translateX(-50%); }
.vn-root > .vn-hud { position: relative; z-index: 1200; background: #14161cf0; min-height: 64px; box-sizing: border-box; }
.vn { position: absolute; left: 0; right: 0; top: 64px; bottom: 0; z-index: 1100; display: flex; flex-direction: column; overflow: hidden; background: #14161c; animation: vn-in .35s; }
.vn[hidden] { display: none; }
.sw-world { position: relative; flex: 1; min-height: 0; }
.sw-map { position: absolute; inset: 0; background: #dfe8d8; outline: none; }
.sw-goal { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
  background: #14161ce6; color: var(--vn-ink); padding: 8px 14px; border-radius: 14px; box-shadow: 0 6px 18px #0006; max-width: 92%; font-size: .92rem; }
.sw-goal b { color: #ffd36b; }
.sw-prompt { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 1000; }
.sw-prompt .btn { font-size: 1rem; box-shadow: 0 6px 18px #0006; }
.sw-help { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 999; background: #14161ce6; color: var(--vn-ink); padding: 10px 16px; border-radius: 14px; font-size: .92rem; max-width: 90%; text-align: center; }
.sw-help kbd { background: #ffffff22; border-radius: 5px; padding: 1px 6px; font-family: inherit; }
.sw-arrow { position: absolute; z-index: 1000; font-size: 2rem; color: #ffd36b; text-shadow: 0 2px 6px #000a; pointer-events: none; }
.sw-snap { position: absolute; right: 14px; bottom: 14px; z-index: 1001; width: min(300px, 80%); background: #f4efe4; color: #2b2418; border-radius: 14px; padding: 8px; box-shadow: 0 10px 30px #0008; cursor: pointer; animation: vn-in .4s; }
.sw-snap img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px; display: block; }
.sw-snap p { margin: 6px 4px 0; font-size: .85rem; }
.sw-travel { position: absolute; inset: 0; z-index: 1050; display: grid; place-content: center; text-align: center; background: #14161cb0; color: var(--vn-ink); font-size: 1.2rem; animation: vn-in .4s; }
.sw-travel-i { font-size: 4rem; animation: sw-ride 1s ease-in-out infinite alternate; }
@keyframes sw-ride { from { transform: translateX(-30px); } to { transform: translateX(30px); } }
.sw-me span { font-size: 36px; display: block; filter: drop-shadow(0 3px 3px #0008); transition: transform .1s; }
.sw-me.flip span { transform: scaleX(-1); }
.sw-me.gar span { animation: sw-bob .32s ease-in-out infinite alternate; }
.sw-me.flip.gar span { animation-name: sw-bob-flip; }
@keyframes sw-bob { to { transform: translateY(-4px) rotate(-3deg); } }
@keyframes sw-bob-flip { from { transform: scaleX(-1); } to { transform: scaleX(-1) translateY(-4px) rotate(3deg); } }
.sw-find span { font-size: 22px; display: block; animation: sw-glim 1.6s ease-in-out infinite; filter: drop-shadow(0 2px 2px #0007); }
@keyframes sw-glim { 50% { transform: scale(1.18); filter: drop-shadow(0 0 6px #fff); } }
.sw-fig { text-align: center; }
.sw-fig span { font-size: 30px; display: block; filter: drop-shadow(0 3px 3px #0008); }
.sw-fig b { display: inline-block; white-space: nowrap; font-size: .72rem; background: #14161cd9; color: #f4efe4; padding: 1px 6px; border-radius: 6px; transform: translateX(-25%); }
.sw-fig i { position: absolute; top: -12px; right: -10px; font-style: normal; font-size: 16px; animation: sw-glim 1.4s infinite; }
.sw-fig.pratat { opacity: .75; }
.sw-goal-pin { text-align: center; }
.sw-goal-pin span { font-size: 40px; display: block; animation: sw-star 1.2s ease-in-out infinite; filter: drop-shadow(0 0 8px #ffd36b); }
.sw-goal-pin b { display: inline-block; white-space: nowrap; font-size: .8rem; background: #ffd36b; color: #2b2418; padding: 2px 8px; border-radius: 8px; transform: translateX(-30%); box-shadow: 0 3px 8px #0006; }
@keyframes sw-star { 50% { transform: scale(1.2) rotate(8deg); } }
.sw-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; text-align: left; }
.sw-album img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; }
.sw-album figcaption { font-size: .82rem; margin-top: 4px; }
.sw-stick { position: absolute; left: 18px; bottom: 26px; z-index: 1001; width: 112px; height: 112px; border-radius: 50%; background: #14161c66; border: 2px solid #ffffff55; touch-action: none; display: none; box-shadow: 0 6px 18px #0005; }
.sw-knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: #ffd36bdd; box-shadow: 0 3px 10px #0007; pointer-events: none; }
@media (pointer: coarse) { .sw-stick { display: block; } .sw-help { bottom: 150px; } .sw-prompt { bottom: 150px; } }
.sw-dest span { display: block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid #ffd36b; box-shadow: 0 0 0 2px #14161c88; animation: sw-dest 1s ease-out infinite; }
@keyframes sw-dest { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.3); opacity: .2; } }
.sw-snap-more { color: #1d4466; font-weight: 600; }
.sw-snap-x { position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #14161c; color: #fff; font-size: .95rem; cursor: pointer; box-shadow: 0 3px 8px #0006; z-index: 1; }
.sw-snap-x:hover { background: #a33; }
.sw-album-item { cursor: zoom-in; }
.sw-album-item:hover img { filter: brightness(1.08); }
.sw-lb { position: absolute; inset: 0; z-index: 1500; background: #000c; display: grid; place-items: center; padding: 12px; animation: vn-in .25s; }
.sw-lb[hidden] { display: none; }
.sw-lb-box { width: min(980px, 100%); max-height: 100%; overflow-y: auto; background: #14161c; color: var(--vn-ink); border-radius: 16px; padding: 12px 14px 14px; box-shadow: 0 20px 60px #000; }
.sw-lb-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.sw-lb-stage { position: relative; display: flex; align-items: center; justify-content: center; background: #0b0c10; border-radius: 10px; min-height: 200px; }
.sw-lb-img { max-width: 100%; max-height: 62vh; display: block; margin: 0 auto; border-radius: 6px; cursor: zoom-in; }
.sw-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px; background: #ffffff22; color: #fff; font-size: 2rem; cursor: pointer; }
.sw-lb-nav:hover { background: #ffd36b55; }
.sw-lb-nav.prev { left: 6px; } .sw-lb-nav.next { right: 6px; }
.sw-lb-cap { margin: 8px 2px; font-size: .95rem; line-height: 1.45; }
.sw-lb-src { color: var(--vn-dim); font-size: .82rem; }
.sw-lb-cap a { color: #ffd36b; font-size: .85rem; }
.sw-lb-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; }
.sw-lb-thumb { flex: 0 0 auto; width: 74px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: none; cursor: pointer; opacity: .7; }
.sw-lb-thumb.on { border-color: #ffd36b; opacity: 1; }
.sw-lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sw-lb-om { margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: #ffffff0d; }
.sw-lb-om summary { cursor: pointer; font-weight: 600; color: #ffd36b; }
.sw-lb-om p { margin: 6px 0; font-size: .92rem; line-height: 1.5; }
.sw-lb-om a { color: #ffd36b; }
/* Målad grafik i spelet (bin/spel-grafik.php) */
.sw-spr { width: 44px; height: 44px; display: block; margin: 0 auto; }
.sw-find .sw-spr { width: 34px; height: 34px; }
.sw-spr-s { width: 20px; height: 20px; vertical-align: middle; }
.sw-goal-pin .sw-spr { width: 50px; height: 50px; }
.sw-dlg::before, .sw-dlg::after { content: ""; position: absolute; width: 58px; height: 58px; background: url(/assets/spel-grafik/ram.png) no-repeat center / contain; pointer-events: none; z-index: 2; }
.sw-dlg::before { left: -10px; top: -12px; }
.sw-dlg::after { right: -10px; bottom: -12px; transform: rotate(180deg); }
.sw-lb-box { position: relative; }
.sw-lb-box::before { content: ""; position: absolute; left: -8px; top: -8px; width: 64px; height: 64px; background: url(/assets/spel-grafik/ram.png) no-repeat center / contain; pointer-events: none; }
/* Om platsen i spelet (registrets uppgifter) */
.sw-om { margin-top: 8px; display: grid; gap: 6px; }
.sw-om-h { margin: 4px 0 0; font-size: 1.15rem; color: #ffd36b; }
.sw-om a { color: #ffd36b; }
.sw-om-syms { margin: 0; font-size: .85rem; color: #e9e2cf; }
.sw-om-sec { padding: 8px 12px; border-radius: 10px; background: #ffffff0d; }
.sw-om-sec > summary { cursor: pointer; font-weight: 700; color: #ffd36b; }
.sw-om-people { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.sw-om-people li { overflow: hidden; line-height: 1.35; }
.sw-om-face { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; float: left; margin-right: 10px; }
.sw-om-rel { margin-left: 6px; font-size: .75rem; padding: .1em .5em; border-radius: 999px; background: #ffd36b22; color: #ffd36b; }
.sw-om-src { font-size: .78rem; color: #cfc6ad; }
.sw-om-time { list-style: none; padding: 0 0 0 10px; margin: 8px 0 0; border-left: 2px solid #ffffff33; }
.sw-om-time li { margin: 4px 0; font-size: .9rem; line-height: 1.4; }
.sw-om-time li.fam b { color: #ffb36b; }
.sw-om-doc { margin: 8px 0; padding: 6px 10px; border-left: 3px solid #ffd36b55; }
.sw-om-doc > summary { cursor: pointer; font-weight: 600; }
.sw-om-text p { margin: 6px 0; line-height: 1.55; font-size: .93rem; }
.sw-om-text h4 { margin: 10px 0 4px; color: #ffd36b; font-size: .95rem; }
.sw-om-text ul { margin: 4px 0 8px; padding-left: 1.2em; font-size: .9rem; }
/* Berättelsen ute på kartan */
.sw-dlg { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1040; width: min(820px, 94%); max-height: 46%; display: flex; flex-direction: column;
  background: #14161cee; color: var(--vn-ink); border: 1px solid #ffffff2a; border-radius: 18px; box-shadow: 0 16px 40px #000a; animation: vn-in .3s; }
.sw-dlg-log { padding: 14px 20px 4px; overflow-y: auto; min-height: 3.2em; }
.sw-dlg-log .vn-line { margin-bottom: 6px; }
.sw-dlg-log .vn-fraga { margin-top: 0; }
.sw-dlg-log .vn-facit { margin: 6px 0; }
.sw-dlg-ctl { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 6px 16px 14px; }
.sw-dlg-ctl .vn-choices { width: 100%; }
.sw-dlg-ctl .vn-next { min-width: 0; }
.sw-dlg-end { text-align: center; font-family: Georgia, serif; font-style: italic; color: #ffd36b; margin: 2px 0 6px; }
.sw-bubble { position: absolute; z-index: 1030; transform: translate(-50%, -100%); max-width: min(340px, 70%); background: #fffdf6; color: #2b2418; border-radius: 16px; padding: 8px 12px;
  box-shadow: 0 8px 22px #0007; font-size: .98rem; line-height: 1.4; pointer-events: none; animation: sw-pop .25s ease-out; }
.sw-bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -9px; border: 9px solid transparent; border-bottom: 0; border-top-color: #fffdf6; }
.sw-bubble b { display: block; font-size: .75rem; color: #8a6d2b; text-transform: uppercase; letter-spacing: .05em; }
@keyframes sw-pop { from { opacity: 0; transform: translate(-50%, -90%) scale(.9); } }
.sw-actor { text-align: center; }
.sw-actor span { font-size: 30px; display: block; filter: drop-shadow(0 3px 3px #0008); animation: vn-in .4s; }
.sw-actor b { display: inline-block; white-space: nowrap; font-size: .7rem; background: #14161cd9; color: #f4efe4; padding: 1px 6px; border-radius: 6px; transform: translateX(-25%); }
.sw-banner { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); z-index: 1045; text-align: center; color: #fff; pointer-events: none; text-shadow: 0 3px 14px #000c; display: grid; gap: 2px; }
.sw-banner.in { animation: sw-banner-in .7s ease-out; } .sw-banner.ut { opacity: 0; transition: opacity .7s; }
.sw-banner-n { font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; }
.sw-banner strong { font-family: Georgia, serif; font-size: 3.4rem; color: #ffd36b; line-height: 1; }
.sw-banner em { font-family: Georgia, serif; font-size: 2rem; font-style: normal; font-weight: 700; }
@keyframes sw-banner-in { from { opacity: 0; transform: translate(-50%, 20px) scale(.95); } }
.sw-photo { position: absolute; top: 60px; right: 14px; z-index: 1035; margin: 0; width: min(260px, 40%); background: #f4efe4; padding: 6px 6px 4px; border-radius: 6px; box-shadow: 0 12px 30px #0009; transform: rotate(2deg); cursor: zoom-in; transition: width .3s; animation: vn-in .5s; }
.sw-photo.stor { width: min(560px, 80%); cursor: zoom-out; }
.sw-photo img { width: 100%; display: block; border-radius: 3px; }
.sw-photo figcaption { font-size: .78rem; color: #4a3f2c; text-align: center; padding-top: 3px; font-family: Georgia, serif; }
.sw-modal { position: absolute; inset: 0; z-index: 1060; display: grid; place-items: center; background: #0008; padding: 14px; }
.sw-modal-box { width: min(760px, 100%); max-height: 100%; overflow-y: auto; background: #14161cf2; border-radius: 18px; padding: 10px 14px; box-shadow: 0 20px 50px #000b; }
.sw-modal-box .vn-controls { background: none; padding: 8px 0 4px; }
@media (max-width: 600px) { .sw-banner strong { font-size: 2.4rem; } .sw-banner em { font-size: 1.4rem; } .sw-photo { width: 34%; top: 54px; } .sw-dlg { max-height: 55%; } }
.vn-talk { text-align: center; padding: 20px 0 6px; }
.vn-talk-i { font-size: 4rem; display: block; }
.vn-talk h2 { font-family: Georgia, serif; margin: 4px 0 0; }
.vn-bg { position: absolute; inset: -20px; background: #23262f center / cover no-repeat; filter: blur(14px) brightness(.38) saturate(.8); transform: scale(1.06); transition: background-image .6s; z-index: -1; }
.vn-hud { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 18px; background: linear-gradient(#0009, #0000); }
.vn-portrait { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid #ffffff55; }
.vn-who { display: flex; flex-direction: column; line-height: 1.2; }
.vn-who span { font-size: .8rem; color: var(--vn-dim); }
.vn-stats { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.vn-stat { background: #ffffff1a; border: 1px solid #ffffff22; border-radius: 99px; padding: 3px 10px; font-size: .85rem; white-space: nowrap; }
.vn-stat.pop { animation: vn-pop .6s; }
.vn-stat.big { font-size: 1rem; padding: 6px 14px; }
@keyframes vn-pop { 40% { transform: scale(1.25); background: #ffd36b55; } }
.vn-icon { font: inherit; font-size: 1.1rem; background: #ffffff14; border: 1px solid #ffffff2a; color: inherit; border-radius: 10px; padding: 4px 8px; cursor: pointer; opacity: .6; }
.vn-icon.on { opacity: 1; background: #ffd36b33; border-color: #ffd36b88; }
.vn-stage { flex: 1; overflow-y: auto; min-height: 0; padding: 8px 28px 16px; scroll-behavior: smooth; }
.vn-log { max-width: 720px; margin: 0 auto; }
.vn-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 14px 18px 18px; background: linear-gradient(#0000, #000a); }
.vn-next { min-width: 200px; font-size: 1.05rem; }
.vn .btn.ghost { color: var(--vn-ink); box-shadow: inset 0 0 0 2px #ffffff66; }
.vn-line { font-size: 1.12rem; line-height: 1.6; margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; animation: vn-in .35s ease-out; }
@keyframes vn-in { from { opacity: 0; transform: translateY(6px); } }
.vn-mark { flex: 0 0 auto; font-size: .8rem; display: none; }
.vn-src { font-size: .72rem; color: #d9c79a; margin-left: 4px; text-decoration: underline dotted; white-space: nowrap; }
.vn-truth .vn-mark { display: inline-flex; align-items: baseline; flex-direction: column; min-width: 1.2em; }
.vn-truth .vn-line .vn-mark .vn-src { display: none; }
.vn-truth .vn-line.vn-sant .vn-text { text-decoration: underline 2px #6fcf8a66; text-underline-offset: 5px; }
.vn-truth .vn-line.vn-delvis .vn-text { text-decoration: underline 2px #e8b84a66; text-underline-offset: 5px; text-decoration-style: dashed; }
.vn-truth .vn-line.vn-dikt .vn-text { color: #d9c9f0; }
.vn-truth .vn-sant .vn-mark { color: #6fcf8a; } .vn-truth .vn-delvis .vn-mark { color: #e8b84a; } .vn-truth .vn-dikt .vn-mark { color: #b99ae6; }
.vn-truth .vn-line:hover .vn-mark .vn-src { display: inline; position: absolute; transform: translateY(1.4em); background: #000c; padding: 2px 6px; border-radius: 6px; z-index: 2; }
.vn-replik .vn-text { font-style: italic; }
.vn-vem { font-weight: 700; color: #ffd36b; margin-right: 6px; white-space: nowrap; }
.vn-vem::after { content: ":"; }
.vn-du { margin: 4px 0 10px 24px; padding: 8px 12px; border-left: 3px solid #ffd36b; background: #ffd36b14; border-radius: 0 10px 10px 0; animation: vn-in .3s; }
.vn-fraga { font-size: 1.2rem; font-weight: 700; margin: 16px 0 6px; color: #ffd36b; animation: vn-in .3s; }
.vn-choices { display: grid; gap: 8px; width: min(640px, 100%); }
.vn-choice { font: inherit; font-size: 1.02rem; text-align: left; padding: 12px 16px; border-radius: 12px; border: 1px solid #ffffff33; background: #ffffff12; color: inherit; cursor: pointer; transition: background .15s, transform .15s; }
.vn-choice:hover, .vn-choice:focus-visible { background: #ffd36b2e; border-color: #ffd36b; transform: translateX(4px); }
.vn-real { margin: 6px 0 14px; padding: 10px 14px; border-radius: 12px; background: #f4efe4; color: #2b2418; font-size: .95rem; animation: vn-in .4s; }
.vn-real .vn-src { color: #7a5a18; }
.vn-real-ok { background: #1f3a28; color: #b9f0c8; }
.vn-photo { margin: 6px 0 16px; text-align: center; }
.vn-photo img { max-width: 100%; max-height: 300px; border-radius: 10px; border: 6px solid #f4efe4; box-shadow: 0 10px 30px #0008; transform: rotate(-1deg); }
.vn-card { text-align: center; padding: 60px 10px; animation: vn-in .8s; }
.vn-card-n { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--vn-dim); margin: 0; }
.vn-card-ar { font-size: 3.4rem; font-weight: 800; margin: 4px 0; color: #ffd36b; font-family: Georgia, serif; }
.vn-card h2 { font-size: 2rem; margin: 0 0 6px; font-family: Georgia, serif; }
.vn-card-plats { color: var(--vn-dim); font-style: italic; }
.vn-intro { text-align: center; max-width: 620px; margin: 0 auto; padding: 10px 0 20px; }
.vn-hero { width: 100%; max-height: 300px; object-fit: cover; border-radius: 14px; box-shadow: 0 12px 30px #0008; }
.vn-intro h2 { font-family: Georgia, serif; font-size: 1.9rem; margin: 14px 0 6px; }
.vn-kicker { color: var(--vn-dim); font-size: .85rem; margin: 10px 0 0; }
.vn-lead { font-size: 1.1rem; line-height: 1.6; }
.vn-statsrow { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.vn-legend { display: flex; justify-content: center; gap: 6px; }
.vn-leg { padding: 2px 8px; border-radius: 99px; background: #ffffff14; }
.vn-leg.vn-sant { color: #6fcf8a; } .vn-leg.vn-delvis { color: #e8b84a; } .vn-leg.vn-dikt { color: #b99ae6; }
.vn-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.vn-facit { margin: 18px 0 8px; padding: 10px 14px; border-radius: 12px; background: #ffffff0d; border: 1px solid #ffffff1f; font-size: .92rem; }
.vn-facit summary { cursor: pointer; font-weight: 600; color: #ffd36b; }
.vn-facit li { margin: 4px 0; }
.vn-facit li.vn-sant { color: #c8f0d4; } .vn-facit li.vn-delvis { color: #f3dca4; }
.vn-epilog { text-align: left; margin: 10px auto; max-width: 560px; }
.vn-toasts { position: absolute; top: 74px; right: 16px; display: grid; gap: 6px; pointer-events: none; z-index: 1300; }
.vn-toast { background: #ffd36b; color: #2b2418; font-weight: 700; padding: 6px 12px; border-radius: 10px; box-shadow: 0 6px 16px #0006; animation: vn-in .3s; transition: opacity .5s, transform .5s; }
.vn-toast.ut { opacity: 0; transform: translateY(-8px); }

.vn-game { margin: 14px 0; padding: 14px 16px; border-radius: 16px; background: #f4efe4; color: #2b2418; box-shadow: 0 10px 30px #0007; animation: vn-in .4s; }
.vn-game h3 { margin: 0 0 8px; font-family: Georgia, serif; }
.vn-game-typ { margin: 0; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: #8a6d2b; }
.vn-game-body { text-align: center; }
.vn-result { font-size: 1.05rem; margin: 6px 0; }
.vn-result.ok strong { color: #1f6b3a; } .vn-result.miss strong { color: #a33; }
.mg-hud { font-weight: 700; margin: 0 0 8px; }
.mg-canvas { width: 100%; max-width: 680px; border-radius: 12px; display: block; margin: 0 auto; touch-action: none; cursor: pointer; }
.mg-ouch { animation: spel-skak .25s; }
@keyframes spel-skak { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.mg-bar { position: relative; height: 30px; border-radius: 99px; background: #d9d2c2; margin: 10px auto 14px; max-width: 520px; overflow: hidden; transition: background .1s; }
.mg-bar.ok { background: #bfe6c9; } .mg-bar.fel { background: #f2c0c0; }
.mg-zone { position: absolute; top: 0; bottom: 0; background: #4caf6a; border-radius: 8px; }
.mg-marker { position: absolute; top: -4px; bottom: -4px; width: 6px; margin-left: -3px; background: #2b2418; border-radius: 3px; }
.mg-icon { font-size: 3rem; line-height: 1; }
.mg-icon.hug { animation: mg-hug .25s; }
@keyframes mg-hug { 50% { transform: rotate(-35deg) scale(1.15); } }
.mg-big { font: inherit; font-size: 1.5rem; font-weight: 800; padding: 14px 34px; border-radius: 16px; border: 0; background: #1d4466; color: #fff; cursor: pointer; box-shadow: 0 5px 0 #0f2a40; }
.mg-big:active { transform: translateY(4px); box-shadow: 0 1px 0 #0f2a40; }
.mg-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 680px; margin: 8px auto 0; }
.mg-lane { font-size: 1.6rem; padding: 10px; border-radius: 12px; border: 0; background: #20263a; color: #ffd36b; cursor: pointer; }
.mg-lane:active { background: #3a4466; }
.mg-kund { display: flex; align-items: center; gap: 12px; justify-content: center; min-height: 70px; }
.mg-kund.ny { animation: vn-in .3s; } .mg-kund.glad .mg-kund-i { animation: vn-pop .5s; }
.mg-kund-i { font-size: 3rem; }
.mg-prat { background: #fff; border-radius: 14px; padding: 10px 14px; font-size: 1.05rem; box-shadow: 0 3px 10px #0002; position: relative; }
.mg-tal { height: 8px; border-radius: 99px; background: #d9d2c2; max-width: 320px; margin: 8px auto 12px; overflow: hidden; }
.mg-tal span { display: block; height: 100%; width: 100%; background: #e0a43a; transition: width .1s linear; }
.mg-hylla { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; padding: 10px; border-radius: 12px; background: #8b6a43; box-shadow: inset 0 -8px 0 #6d522f; }
.mg-hylla.fel { animation: spel-skak .2s; }
.mg-vara { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; border: 0; background: #f4efe4; cursor: pointer; }
.mg-vara:hover { background: #fff; transform: translateY(-2px); }
.mg-vara-i { font-size: 1.8rem; }
.mg-minne { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 520px; margin: 0 auto; }
.mg-kort { aspect-ratio: 1; border-radius: 10px; border: 0; padding: 0; overflow: hidden; cursor: pointer; background: #1d4466 radial-gradient(#ffffff22 2px, transparent 2px) 0 0 / 14px 14px; }
.mg-kort img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.mg-kort.upp img { opacity: 1; }
.mg-kort.par { box-shadow: 0 0 0 3px #4caf6a; }
/* Nya minispel */
.mg-spika { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 360px; margin: 6px auto; padding: 12px; border-radius: 12px; background: #a07a4f; box-shadow: inset 0 -6px 0 #7a5530; }
.mg-hal { aspect-ratio: 1.3; border: 0; border-radius: 50%; background: radial-gradient(#4a3420 40%, #6d5030 72%); cursor: pointer; position: relative; overflow: hidden; touch-action: none; }
.mg-hal span { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 0); font-size: 2rem; transition: top .12s; }
.mg-hal.upp span { top: 18%; }
.mg-hal.slag { background: radial-gradient(#ffd36b 30%, #6d5030 72%); }
.mg-hal.miss { animation: spel-skak .15s; }
.mg-pair { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.mg-half { min-width: 140px; touch-action: none; }
.mg-big.tryck, .mg-half.tryck { transform: translateY(4px); box-shadow: 0 1px 0 #0f2a40; }
.mg-dans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 420px; margin: 6px auto; }
.mg-pad-k { font: inherit; font-size: 1.8rem; padding: 14px 0; border-radius: 14px; border: 0; color: #fff; cursor: pointer; opacity: .6; transition: opacity .1s, transform .1s; }
.mg-pad-0 { background: #c0392b; } .mg-pad-1 { background: #2e86c1; } .mg-pad-2 { background: #27ae60; } .mg-pad-3 { background: #d4ac0d; }
.mg-pad-k.lys { opacity: 1; transform: scale(1.08); box-shadow: 0 0 18px currentColor; }
#spel .mg-icon { transition: transform .15s; }
.mg-sum { font-weight: 700; font-size: 1.05rem; margin: 6px 0; }
.mg-sum.fel { color: #a33; animation: spel-skak .25s; }
.mg-mynt { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mg-coin { width: 64px; height: 64px; border-radius: 50%; border: 3px solid #8a6d2b; background: radial-gradient(#f4d77a, #c9a03c); font-weight: 800; font-size: .78rem; color: #4a3a12; cursor: pointer; }
.mg-coin:active { transform: scale(.92); }
.mg-coin.sedel { border-radius: 8px; width: 78px; height: 48px; background: linear-gradient(#cfe3c5, #9fc28d); border-color: #4f6e3f; color: #23361a; }
.mg-gauge { position: relative; height: 30px; max-width: 460px; margin: 10px auto 14px; border-radius: 99px; background: linear-gradient(90deg, #4f8fd6, #d9d2c2 35%, #d9d2c2 75%, #d64b3a); overflow: hidden; }
.mg-gauge-ok { position: absolute; left: 40%; width: 30%; top: 0; bottom: 0; background: #4caf6a99; }
.mg-gauge-n { position: absolute; top: -4px; bottom: -4px; width: 6px; margin-left: -3px; background: #2b2418; border-radius: 3px; }
.mg-veva { width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(#d9d2c2 30%, #a59b86 31%, #a59b86 34%, #e9e2d0 35%); position: relative; touch-action: none; cursor: grab; box-shadow: inset 0 0 0 6px #8b6a43; }
.mg-veva-arm { position: absolute; left: 50%; top: 50%; width: 70px; height: 12px; margin-top: -6px; background: #5a4430; border-radius: 6px; transform-origin: 0 50%; }
.mg-veva-knopp { position: absolute; right: -14px; top: -10px; width: 32px; height: 32px; border-radius: 50%; background: #ffd36b; box-shadow: 0 3px 8px #0006; }
.mg-port { width: 120px; height: 170px; border-radius: 6px; background: #3f7cac; overflow: hidden; position: relative; box-shadow: inset 0 0 0 4px #5a4430; }
.mg-port-dorr { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, #8b6a43 0 18px, #7a5530 18px 20px); transition: transform .1s; }
.mg-planka { position: relative; height: 220px; max-width: 560px; margin: 6px auto; border-radius: 10px; background: repeating-linear-gradient(0deg, #c49a66 0 36px, #b58a55 36px 40px); box-shadow: inset 0 -6px 0 #8b6a43; touch-action: none; }
.mg-spik { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 0; background: none; cursor: pointer; touch-action: none; }
.mg-spik-h { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: radial-gradient(#e8e8e8, #777); box-shadow: 0 2px 3px #0007; }
.mg-spik-ring { position: absolute; inset: 2px; border-radius: 50%; --p: 0; background: conic-gradient(#ffd36b calc(var(--p) * 360deg), transparent 0); opacity: .85; -webkit-mask: radial-gradient(transparent 55%, #000 57%); mask: radial-gradient(transparent 55%, #000 57%); }
.mg-spik.drar .mg-spik-h { transform: translateY(-3px) scale(1.1); }
.mg-spik.ute { animation: mg-ut .25s forwards; }
@keyframes mg-ut { to { transform: translateY(-40px) rotate(40deg); opacity: 0; } }
@media (max-width: 600px) { .vn-stage { padding: 6px 14px 12px; } .vn-line { font-size: 1.02rem; } .vn-card-ar { font-size: 2.6rem; } .mg-minne { grid-template-columns: repeat(3, 1fr); } }
/* Familjearkivet → Anettes bok */
.anette-toc { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.anette-text { max-width: 68ch; }
.anette-text p { margin: 0 0 .8em; }
.anette-svar { max-width: 68ch; margin: 0 0 1em; padding: .4em 1em; border-left: 3px solid var(--line); color: var(--muted); }
.anette-svar p { margin: 0 0 .6em; }
.recept-del { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 18px; margin-bottom: .6em; }
.recept-del h4 { margin: .2em 0 .4em; font-size: .95rem; }
.recept-ingr ul { padding-left: 1.1em; margin: 0; }
.recept-steg ol { padding-left: 1.3em; margin: 0; max-width: 68ch; }
.recept-steg li, .recept-ingr li { margin-bottom: .35em; }
@media (max-width: 700px) { .recept-del { grid-template-columns: 1fr; } }
.arkiv-tumme { max-width: 220px; max-height: 160px; margin-top: 6px; border-radius: 4px; }
.arkiv-text { max-width: 80ch; margin: .3em 0 0; }
/* Porträtt på rutorna i släktträdet */
.ft-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; float: right; margin: 0 0 4px 6px; }
.ft-flip { margin: .3em auto .2em; align-self: center; }
form.inline { display: inline; }
form.inline input { width: 9em; padding: 1px 4px; font-size: .8rem; }
.ft-sib-photo { width: 22px; height: 22px; object-fit: cover; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
/* Ättlingar: släktträdet vänt, varje barn en gren nedåt */
.fd-scroll { overflow-x: auto; padding-bottom: 10px; display: flex; }
.fd-scroll > .fd-node { margin: 0 auto; flex: 0 0 auto; }   /* auto-marginal: centrerat när det får plats, annars scrollbart från vänsterkanten */
.fd-node { display: flex; flex-direction: column; align-items: center; position: relative; }
.fd-couple { display: flex; align-items: center; gap: 4px; }
.fd-amp { color: var(--muted); font-weight: 700; }
.fd-card { width: 118px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 5px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; font-size: .78rem; }
.fd-card.fd-partner { opacity: .92; border-style: dashed; }
.fd-photo { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; }
.fd-name { font-weight: 700; line-height: 1.15; }
.fd-not { font-size: .7rem; color: #9a6a00; }
.fd-kids { display: flex; align-items: flex-start; gap: 10px; padding-top: 22px; position: relative; }
.fd-kids > .fd-node::before { content: ""; position: absolute; top: -12px; left: 50%; height: 12px; border-left: 2px solid var(--line); }
.fd-kids > .fd-node::after { content: ""; position: absolute; top: -12px; left: -5px; right: -5px; border-top: 2px solid var(--line); }
.fd-kids > .fd-node:first-child::after { left: 50%; }
.fd-kids > .fd-node:last-child::after { right: 50%; }
.fd-kids > .fd-node:only-child::after { display: none; }
.fd-couple + .fd-kids::before, .fd-couple + .fd-more::before { content: ""; position: absolute; top: 0; left: 50%; height: 10px; border-left: 2px solid var(--line); }
.fd-more { margin-top: 8px; text-align: center; }
.fd-more > summary { cursor: pointer; font-size: .8rem; color: var(--brand); }
.niva-fel { background: #fde8e4; color: var(--danger); }
/* Registret (det ordnade arkivet) */
.reg-sym { margin-left: 3px; font-size: .9em; cursor: help; }
.reg-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.reg-mapcard { position: sticky; top: 10px; }
.reg-map { height: 520px; border-radius: 10px; }
.reg-map-small { height: 260px; margin-top: 10px; }
@media (max-width: 860px) { .reg-split { grid-template-columns: 1fr; } .reg-mapcard { position: static; order: -1; } .reg-map { height: 320px; } }
.reg-rows { list-style: none; padding: 0; margin: 0; }
.reg-rows li { padding: 6px 8px; border-bottom: 1px solid var(--line); border-radius: 6px; }
.reg-rows li.on { background: var(--brand-soft); }
.reg-st { font-size: .85em; }
.reg-people { list-style: none; padding: 0; display: grid; gap: 8px; }
.reg-people li { overflow: hidden; }
.reg-face { width: 34px; height: 34px; object-fit: cover; border-radius: 50%; float: left; margin: 0 8px 0 0; }
.reg-portrait { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; float: right; margin-left: 12px; }
.reg-timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); }
.reg-timeline li { padding: 4px 0 4px 12px; position: relative; }
.reg-timeline li::before { content: ""; position: absolute; left: -7px; top: 10px; width: 11px; height: 11px; border-radius: 50%; background: var(--card); border: 2px solid var(--brand); }
.reg-timeline li.fam::before { background: #b5651d; border-color: #b5651d; }
.reg-text h4 { margin: .8em 0 .3em; font-size: 1rem; }
.reg-list { margin: .2em 0 .8em; padding-left: 1.2em; }
.reg-legend a { margin-right: 10px; white-space: nowrap; }
.reg-filter .row { flex-wrap: wrap; }
.reg-pin span { display: block; width: 14px; height: 14px; border-radius: 50%; background: #1d4466; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.reg-pin.st-osaker span { background: #d4881a; }
.reg-pin.st-bekraftad span, .reg-pin.st-manuell span { background: #2f7a4a; }
.reg-pin.main span, .reg-pin.on span { width: 18px; height: 18px; background: #c0392b; margin: -2px; }
.reg-pin b { position: absolute; left: 14px; top: -8px; font-size: 11px; font-weight: 400; white-space: nowrap; }
.pager { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: .6em 0; }
.pager strong { padding: 0 .3em; border-bottom: 2px solid var(--brand); }
.anette-page h2 { margin-bottom: .6em; }
.anette-thumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.anette-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; display: block; }
.ft-tools { display: flex; justify-content: flex-end; margin: -4px 0 6px; }
.ft-card.has-proof { border-color: #2f7a4a; box-shadow: 0 0 0 1px #2f7a4a33; }
.ft-name { font-weight: 600; line-height: 1.2; }
.ft-meta { font-size: .8rem; color: var(--muted); }
.ft-proof { position: absolute; top: 4px; right: 6px; font-size: .85rem; }
.ft-far .ft-card { border-top: 3px solid #3f7cac; }
.ft-mor .ft-card { border-top: 3px solid #b5651d; }
.ft-me.ft-pick { width: auto; min-width: 260px; max-width: 100%; margin: 0; gap: 4px; }
.ft-pick select { font-weight: 600; color: var(--brand); padding: 4px 8px; width: auto; max-width: 100%; margin: 0; text-align: center; }
.ft-pick .ft-badges { padding-right: 0; justify-content: center; }
.ft-root { display: flex; justify-content: center; }
.ft-me { border-top: 3px solid var(--brand); text-align: center; align-items: center; }
.ft-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.ft-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.ft-facts dt { font-weight: 600; }
.ft-facts dd { margin: 0; }
.ft-check { color: #2f7a4a; }
.ft-proof-img { margin: 0 0 14px; }
.ft-proof-img img { width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); display: block; background: #fff; }
.ft-proof-img figcaption { margin-top: 6px; }
.ft-rel { border-top: 1px solid var(--line); padding-top: 6px; }
.ft-rel:first-of-type { border-top: 0; padding-top: 0; }
.ft-sources li { margin-bottom: 4px; }
.ft-table td { vertical-align: top; }

/* ═══ Mobil (2026-11-03): enhetligt och luftigt på små skärmar ═══
   Menyer och flikar blir en rad som sveps i sidled i stället för att bryta över många rader, långa ord och adresser
   radbryts, sidan kan aldrig bli bredare än skärmen, och kort, rubriker och formulär blir lite tätare. */
body { overflow-x: clip; }
main { overflow-wrap: break-word; }
.arkiv-tabell td, .reg-rows li, .sgg figcaption, .ft-sources li, .fam-timeline li { overflow-wrap: anywhere; }
.top-admin nav a[aria-current] { opacity: 1; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.fam-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
@media (max-width: 760px) {
  body { font-size: 16px; }
  main { padding: 14px 12px 32px; }
  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.18rem; margin: 1.2em 0 .5em; }
  .card { padding: 14px; border-radius: 12px; margin-bottom: 12px; }
  .card h2:first-child, .card > h2 { margin-top: .1em; }
  /* Adminlisten: loggan på en rad, menyn som en svepbar rad under */
  .top-admin .top-inner { display: grid; grid-template-columns: 1fr; padding: 8px 12px 0; gap: 2px; }
  .top-admin nav { flex-wrap: nowrap; overflow-x: auto; gap: 0 16px; padding: 6px 2px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .top-admin nav::-webkit-scrollbar { display: none; }
  .top-admin nav a, .top-admin nav .nav-btn { white-space: nowrap; font-size: .92rem; }
  /* Flikar (Familjen, Arkivet, böckerna): en svepbar rad med mindre knappar */
  .memoir-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin: 0 -12px 12px; padding: 2px 12px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .memoir-tabs::-webkit-scrollbar { display: none; }
  .memoir-tabs a { flex: none; white-space: nowrap; padding: 5px 11px; font-size: .88rem; }
  /* Underflikarna "A · B · C" blir små knappar som också sveps */
  .fam-filter { flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin: 0 -12px 10px; padding: 2px 12px 6px; font-size: 0; scrollbar-width: none; }
  .fam-filter::-webkit-scrollbar { display: none; }
  .fam-filter a, .fam-filter strong { flex: none; white-space: nowrap; font-size: .85rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--card); }
  .fam-filter a[aria-current] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  /* Formulär: en kolumn, knappar som är lätta att träffa */
  .row { grid-template-columns: 1fr; gap: 10px; }
  .form { gap: 10px; }
  .actions { flex-wrap: wrap; }
  .btn.small { padding: 8px 12px; }
  /* Tabeller: tätare, och de kan scrollas i sidled inne i sitt kort */
  .table th, .table td { padding: 8px; font-size: .88rem; }
  .sgg-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .reg-portrait { width: 84px; height: 84px; }
  .notice { font-size: .85rem; }
}@media (max-width: 760px) {
  /* Släktträdet: smalare rutor utan punkttext (berättelserna finns bakom 📖), tätare linjer */
  .ft-card { width: 150px; padding: 5px 7px; font-size: .9rem; }
  .ft-card-points { display: none; }
  .ft-photo { width: 40px; height: 40px; }
  .ft-parents { padding-left: 22px; }
  .ft-parents::before { width: 11px; }
  .ft-parents > .ft-node::before, .ft-parents > .ft-node::after { left: -11px; }
  .ft-parents > .ft-node::before { width: 11px; }
  .ft-me.ft-pick { min-width: 0; width: 100%; }
  .ft-pick select { width: 100%; font-size: .95rem; }
  .ft-scroll { margin: 0 -14px; padding: 4px 14px 12px; }
  .ft-branch > p.small.muted { display: none; }   /* lässtödet tar för mycket plats – samma text står i förklaringen överst */
  .fd-card { width: 104px; }
  .fd-photo { width: 64px; height: 64px; }
}@media (max-width: 760px) {
  /* Släktträdet som indragen lista på mobilen: personen överst, föräldrarna (eller barnen i ättlingavyn) indragna under */
  .ft-scroll { overflow-x: visible; margin: 0; padding: 0; }
  .ft-node { flex-direction: column; align-items: stretch; }
  .ft-card { width: auto; max-width: 100%; }
  .ft-parents { padding-left: 16px; margin-left: 8px; }
  .ft-parents::before { display: none; }
  .ft-parents > .ft-node { padding: 8px 0 0; }
  .ft-parents > .ft-node::before { left: -16px; top: 30px; width: 14px; }
  .ft-parents > .ft-node::after { left: -16px; top: 0; bottom: 0; }
  .ft-parents > .ft-node:first-child::after { top: 0; }
  .ft-parents > .ft-node:last-child::after { bottom: auto; height: 30px; }
  .ft-parents > .ft-node:only-child::after { display: block; bottom: auto; height: 30px; }
}@media (max-width: 760px) {
  /* Kompakta rutor: fotot till vänster, märke, namn och år bredvid */
  .ft-card { display: block; padding: 6px 8px; min-height: 0; }
  .ft-card::after { content: ""; display: block; clear: both; }
  .ft-card .ft-photo { float: left; width: 42px; height: 42px; margin: 0 8px 2px 0; }
  .ft-card .ft-name, .ft-card .ft-meta { display: block; }
  .ft-card .ft-badges { padding-right: 18px; margin-bottom: 1px; }
  .ft-card .ft-story-btn { display: inline-block; margin: 3px 6px 0 0; }
  .ft-card .ft-sib { clear: both; }
  .ft-branch h2 .small, .ft-branch h2 .muted { display: block; font-size: .8rem; font-weight: 500; margin-top: 2px; }
  .ft-tools { display: flex; justify-content: flex-start; margin: 0 0 8px; }
  .ft-tools .btn { font-size: .82rem; padding: 6px 10px; }
  .ft-legend ul.ft-levels { padding-left: 0; }
}
.ft-edit { display: block; white-space: nowrap; margin: 2px 0; }
/* Fält får aldrig bli bredare än sin ruta (grid-celler har annars min-content som minsta bredd) */
.form label, .row > *, .form > * { min-width: 0; }
input, textarea, select { min-width: 0; max-width: 100%; }
@media (max-width: 760px) {
  input, textarea, select { padding: 9px 11px; border-radius: 10px; }
  /* Registrets och arkivets filter: sökrutan över hela bredden, övriga fält två och två */
  .reg-filter .row, .arkiv-sok .row { grid-template-columns: 1fr 1fr; }
  .reg-filter .row > label:first-child, .arkiv-sok .row > label:first-child { grid-column: 1 / -1; }
  .reg-filter label > span, .arkiv-sok label > span { font-size: .82rem; }
  .reg-legend { display: none; }
  .reg-pin b { display: none; }
  .reg-map { height: 260px; }
}@media (max-width: 760px) {
  /* Arkivet: varje fil som ett eget kort i stället för en trång tabell */
  .arkiv-tabell, .arkiv-tabell tbody, .arkiv-tabell tr, .arkiv-tabell td { display: block; width: 100%; }
  .arkiv-tabell tr:first-child:has(th) { display: none; }
  .arkiv-tabell tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .arkiv-tabell td { border: 0; padding: 2px 0; }
  .arkiv-tabell td:nth-child(2), .arkiv-tabell td:nth-child(3) { display: inline-block; width: auto; margin-right: 12px; font-size: .8rem; }
  .arkiv-tabell td br { display: none; }
  .arkiv-tumme { max-width: 100%; max-height: 220px; }
  /* Böckernas innehåll: en svepbar rad */
  .anette-toc { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: 4px 14px; padding: 10px 14px; scrollbar-width: none; }
  .anette-toc::-webkit-scrollbar { display: none; }
  .anette-books { margin-top: -4px; }
}@media (max-width: 760px) {
  /* Inledande förklaringstexter: mindre, så att innehållet kommer högre upp */
  main > p.muted, main > p.small, main > .muted.small { font-size: .84rem; line-height: 1.45; margin: 0 0 10px; }
  /* Bykartans filter: små brickor på en svepbar rad */
  .bykarta-filter { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 8px; padding: 2px 12px 6px; scrollbar-width: none; }
  .bykarta-filter::-webkit-scrollbar { display: none; }
  .bykarta-filter .btn { flex: none; white-space: nowrap; font-size: .8rem; padding: 5px 10px; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
  .bykarta-filter .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .bykarta-filter strong { display: none; }
  /* Ändra släktträdet: färre fält i familjelistan */
  form.inline input[name="varfor"] { display: none; }
  .reg-people li { line-height: 1.5; }
}@media (max-width: 600px) {
  /* Spelet: fyller skärmen nästan helt, målraden över hela bredden, kompaktare panel överst */
  .vn-root { height: calc(100svh - 70px); min-height: 480px; border-radius: 12px; width: calc(100vw - 12px); }
  .vn-hud { padding: 8px 10px; gap: 6px 8px; }
  .sw-goal { left: 8px; right: 8px; transform: none; justify-content: flex-start; gap: 6px 8px; padding: 6px 10px; font-size: .82rem; }
  .sw-goal .btn { padding: 5px 9px; font-size: .78rem; }
  .sw-snap { left: 8px; right: 8px; width: auto; bottom: 110px; }
  .sw-snap img { max-height: 140px; }
  .sw-goal-pin b { font-size: .72rem; }
  .sw-lb-box { padding: 10px; }
  .sw-om-sec { padding: 6px 9px; }
}@media (max-width: 600px) { .sw-world .leaflet-top.leaflet-left { top: 42%; left: auto; right: 4px; } }
/* Berättelsepunkter: texten får krympa bredvid bilden */
.ft-points li > * { min-width: 0; }
.ft-points li > span { flex: 1 1 auto; }
.ft-points li > .ft-point-img { flex: none; max-width: 30%; }
/* Bykartan: redigeringsrutan (håll inne på en plats) */
.village-map { position: relative; }
.bk-edit { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1000; background: var(--card); color: var(--ink); border: 2px solid var(--accent); border-radius: 12px; padding: 10px 12px; box-shadow: 0 8px 24px #0005; }
.bk-edit p { margin: 0 0 8px; font-weight: 600; font-size: .92rem; }
.bk-edit-row { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-editing span { outline: 3px solid var(--accent); outline-offset: 2px; animation: bk-pulse 1s ease-in-out infinite; }
@keyframes bk-pulse { 50% { transform: scale(1.15); } }