/* HOUSE FAMILY TREES — page-specific styles, layered over the site theme.
   The page is now a single parchment sheet you turn from house to house with
   arrows, like the White Book: a header BAND (sigil + name + words) pinned to
   the top of the sheet, the blood laid out below it, a page-count in the foot,
   and big arrows on the short sides. */

.trees-body {
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(201,161,90,0.10), transparent 60%),
    linear-gradient(180deg, #1a140e, #0d0a07);
}

/* the two compact topbar buttons that replace the old sidebar */
.trees-topbtn {
  background: rgba(201,161,90,0.08); border: 1px solid rgba(201,161,90,0.3);
  color: var(--gold-bright); border-radius: 6px; cursor: pointer;
  font-family: "Cinzel", serif; font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 8px 13px; margin-left: 8px;
  transition: background 0.18s, border-color 0.18s;
}
.trees-topbtn:hover { background: rgba(201,161,90,0.18); border-color: var(--gold); }
.trees-topbtn .progress-eye { font-size: 0.9em; opacity: 0.8; }

/* ---------------- the two-column page: rail on the left, sheet on the right ---------------- */
.trees-layout { flex: 1; min-height: 0; display: flex; align-items: stretch; }

/* the houses, a table of lineages down the left */
.tree-rail {
  flex: 0 0 236px; display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(32,24,15,0.6), rgba(16,12,8,0.55));
  border-right: 1px solid rgba(201,161,90,0.22);
  padding: 14px 12px 12px; box-sizing: border-box;
}
.tree-rail-head {
  font-family: "Cinzel", serif; font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold); opacity: 0.85;
  padding: 0 6px 10px; margin-bottom: 8px; border-bottom: 1px solid rgba(201,161,90,0.16);
}
.tree-rail-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding-right: 4px; }
.tree-rail-note {
  font-family: "EB Garamond", serif; font-style: italic; font-size: 0.74rem;
  line-height: 1.45; color: #8a7a5c; padding: 10px 6px 0; margin: 8px 0 0;
  border-top: 1px solid rgba(201,161,90,0.14);
}
/* rail buttons: the picker look, re-dressed for the dark rail */
.tree-rail .tree-pick {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; cursor: pointer;
  padding: 8px 10px; border-radius: 8px; color: #e7dcc4;
  background: rgba(240,230,210,0.03); border: 1px solid rgba(201,161,90,0.16);
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s, transform 0.12s;
}
.tree-rail .tree-pick:hover { background: rgba(201,161,90,0.12); border-color: var(--hc, #a98a54); box-shadow: inset 3px 0 0 var(--hc, transparent); transform: translateX(1px); }
.tree-rail .tree-pick.active { background: rgba(201,161,90,0.17); border-color: var(--hc, #a98a54); box-shadow: inset 3px 0 0 var(--hc, transparent); }
.tree-rail .tree-pick img { width: 26px; height: 30px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.tree-rail .tree-pick-star { width: 26px; text-align: center; font-size: 1.2rem; color: var(--gold); flex: 0 0 auto; }
.tree-rail .tree-pick-text { min-width: 0; }
.tree-rail .tree-pick-text b { display: block; font-family: "Cinzel", serif; font-size: 0.82rem; letter-spacing: 0.04em; font-weight: 600; color: #ece3cf; }
.tree-rail .tree-pick-text i { display: block; font-family: "EB Garamond", serif; font-style: italic; font-size: 0.76rem; color: #9a8a68; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-rail .tree-pick-all { margin-top: 4px; }

/* the parchment sheet, filling the rest of the page */
.tree-parchment {
  position: relative; flex: 1; min-width: 0; margin: 18px;
  display: flex; flex-direction: column;
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,161,90,0.22);
  background: #e3d0a4;
}
/* everything on the sheet lives in this surface and zooms as ONE piece */
.tree-surface { position: relative; width: max-content; min-width: 100%; box-sizing: border-box; }

/* the crest + name + words, printed at the head of the sheet (they zoom too) */
.tree-crest { width: 76px; height: 86px; margin-bottom: 8px; display: flex; align-items: flex-end; }
.tree-crest img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 2px 5px rgba(70,45,15,0.45)); }
.tree-crest-all { font-size: 50px; color: #7a4a1a; align-items: center; }
.tree-house-name { font-family: "Cinzel", serif; font-weight: 700; letter-spacing: 0.05em; font-size: 2.5rem; line-height: 1.04; margin: 0; }
.tree-house-words { font-family: "EB Garamond", serif; font-style: italic; font-size: 1.24rem; color: #6a5638; margin-top: 4px; }

/* floating zoom controls, so a reader need not scroll-zoom to fit */
.tree-zoombar {
  position: absolute; right: 22px; bottom: 22px; z-index: 5;
  display: flex; gap: 4px; padding: 4px;
  background: rgba(20,16,11,0.82); border: 1px solid rgba(201,161,90,0.32); border-radius: 9px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.tree-zoombtn {
  width: 34px; height: 34px; border: none; border-radius: 6px; cursor: pointer;
  background: rgba(201,161,90,0.10); color: var(--gold-bright);
  font-family: "Cinzel", serif; font-size: 1.05rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background 0.16s;
}
.tree-zoombtn:hover { background: rgba(201,161,90,0.26); }

/* ---------------- the sheet: a page of an old book ----------------
   Each house dresses the page in its own way (variables below): the dragons'
   page is scorched, the trout's is water-stained, the wolves' runs cold. A
   fibrous paper grain, foxing blooms and a heavy inner shadow sell the vellum. */
.tree-sheet { flex: 1; min-height: 0; }
.trees-stage {
  --paper: #e3d0a4;
  --bloom: rgba(120, 86, 44, 0.20);
  --edge: rgba(74, 48, 18, 0.55);
  --high: rgba(255, 250, 232, 0.55);
  --conn: 12px;   /* vertical gap between generations; taller = more vertical */
  cursor: grab; overflow: auto; position: relative;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"),
    radial-gradient(circle at 22% 30%, var(--bloom), transparent 9%),
    radial-gradient(circle at 82% 22%, var(--bloom), transparent 11%),
    radial-gradient(circle at 68% 78%, var(--bloom), transparent 10%),
    radial-gradient(circle at 14% 74%, var(--bloom), transparent 8%),
    radial-gradient(ellipse at 30% 20%, var(--high), transparent 55%),
    radial-gradient(ellipse at 50% 118%, var(--edge), transparent 60%),
    linear-gradient(160deg, rgba(255,252,240,0.14), rgba(90,60,25,0.12));
  background-attachment: local, fixed, fixed, fixed, fixed, fixed, fixed, fixed;
  box-shadow: inset 0 0 150px var(--edge), inset 0 0 40px rgba(60,40,15,0.25);
  user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: contain;
}
.trees-stage.dragging { cursor: grabbing; }

/* per-house paper: paper tone, foxing bloom colour and burnt/stained edges */
/* the dragon line is ~14 generations deep — give it a tall, narrow spine
   (more vertical drop between generations) so it reads down the page, not across */
.trees-stage[data-house="targaryen"] { --paper:#e4c99a; --bloom:rgba(96,22,12,0.22); --edge:rgba(46,12,6,0.62); --conn: 46px; }
.trees-stage[data-house="stark"]     { --paper:#dcd7c6; --bloom:rgba(70,92,110,0.18); --edge:rgba(48,60,74,0.5); }
.trees-stage[data-house="tully"]     { --paper:#d8dcc9; --bloom:rgba(38,80,124,0.20); --edge:rgba(34,66,104,0.48); }
.trees-stage[data-house="lannister"] { --paper:#e7d3a0; --bloom:rgba(150,30,34,0.18); --edge:rgba(120,58,10,0.5); }
.trees-stage[data-house="velaryon"]  { --paper:#d6d8ce; --bloom:rgba(30,104,116,0.18); --edge:rgba(24,72,82,0.48); }
.trees-stage[data-house="hightower"] { --paper:#e0d8c6; --bloom:rgba(70,78,86,0.18); --edge:rgba(60,66,74,0.5); }
.trees-stage[data-house="baratheon"] { --paper:#e6d6a6; --bloom:rgba(122,98,26,0.20); --edge:rgba(70,50,10,0.55); }
.trees-stage[data-house="arryn"]     { --paper:#dbdcd0; --bloom:rgba(56,92,128,0.18); --edge:rgba(44,74,108,0.46); }
.trees-stage[data-house="martell"]   { --paper:#ecd39a; --bloom:rgba(196,110,20,0.20); --edge:rgba(122,66,8,0.5); }
.trees-stage[data-house="tyrell"]    { --paper:#dfdcae; --bloom:rgba(64,110,42,0.18); --edge:rgba(46,84,28,0.48); }
.trees-stage[data-house="greyjoy"]   { --paper:#d3cfc2; --bloom:rgba(70,58,92,0.20); --edge:rgba(40,32,58,0.55); }

/* the crest, words, blurb and segment headings are all part of the one surface */
.tree-intro { position: relative; z-index: 2; padding: 30px 60px 2px; }
.trees-canvas { position: relative; z-index: 1; padding: 8px 70px 90px; width: max-content; min-width: 100%; }
.trees-canvas img { -webkit-user-drag: none; user-drag: none; }
.tree-blurb { max-width: 940px; margin: 12px 0 6px 2px; font-size: 1.18rem; line-height: 1.55; color: #5a4a2e; }

.tree-all-head { text-align: center; margin: 4px 0 22px; }
.tree-all-head .tree-house-title { font-family: "Cinzel", serif; font-weight: 700; color: #5a3010; font-size: 2rem; }
.tree-all-head .tree-house-sub { font-family: "EB Garamond", serif; font-style: italic; color: #6a5638; font-size: 1.05rem; }

/* a coloured divider that opens each house in the combined view */
.tree-house-divider {
  display: flex; align-items: center; gap: 16px; margin: 48px 0 20px;
  padding-bottom: 8px; border-bottom: 2px solid;
}
.tree-house-divider img { width: 66px; height: 76px; object-fit: contain; filter: drop-shadow(0 2px 5px rgba(70,45,15,0.4)); }
.tree-house-divider .thd-name { font-family: "Cinzel", serif; font-size: 1.5rem; font-weight: 700; letter-spacing: 0.08em; }
.tree-house-divider .thd-words { font-family: "EB Garamond", serif; font-style: italic; color: #6a5638; font-size: 0.98rem; }

.tree-segment { margin-bottom: 26px; }
.tree-segment-title {
  font-family: "Cinzel", serif; font-size: 1.6rem; font-weight: 600; letter-spacing: 0.14em;
  color: #7a4a10; text-transform: uppercase; margin: 14px 0 6px 4px;
}
.tree-segment-note {
  font-family: "EB Garamond", serif; font-style: italic; color: #6a563a;
  font-size: 1.3rem; line-height: 1.5; margin: 0 0 6px 4px; max-width: 960px;
}
.tree-gap {
  font-family: "EB Garamond", serif; font-style: italic; color: #7a6a4c;
  margin: 20px 0 20px 4px; letter-spacing: 0.08em;
}

/* ---------------- the tree itself (nested lists with drawn connectors) ----------------
   Classic CSS org-chart: each <ul> is a row of children; ::before/::after on the
   <li>s draw the elbow rails, and a stem drops from every parent's <ul>. */
.ftree, .ftree ul { list-style: none; margin: 0; padding: 0; }
.ftree { display: inline-block; }

.ftree ul {
  display: flex; justify-content: center; position: relative;
  padding-top: var(--conn);
}
.ftree li {
  position: relative; padding: var(--conn) 1px 0; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}

/* the two halves of the horizontal rail above each child */
.ftree li::before, .ftree li::after {
  content: ""; position: absolute; top: 0; right: 50%;
  width: 50%; height: var(--conn); border-top: 1px solid rgba(110, 74, 34, 0.6);
}
.ftree li::after {
  right: auto; left: 50%; border-left: 1px solid rgba(110, 74, 34, 0.6);
}
/* only-child: just a straight stem, no rail */
.ftree li:only-child::before, .ftree li:only-child::after { display: none; }
.ftree li:only-child { padding-top: var(--conn); }
/* tidy the ends of each rail */
.ftree li:first-child::before, .ftree li:last-child::after { border: 0 none; }
.ftree li:last-child::before {
  border-right: 1px solid rgba(110, 74, 34, 0.6); border-radius: 0 6px 0 0;
}
.ftree li:first-child::after { border-radius: 6px 0 0 0; }

/* stem dropping from a parent down to its children's rail */
.ftree ul::before {
  content: ""; position: absolute; top: 0; left: 50%;
  width: 0; height: var(--conn); border-left: 1px solid rgba(110, 74, 34, 0.6);
}

/* the root of each tree hangs from nothing */
.ftree > li { padding-top: 0; }
.ftree > li::before, .ftree > li::after { display: none; }

/* ---------------- node cards ---------------- */
.tn {
  background: linear-gradient(178deg, #f6efda, #eaddbe);
  border: 1px solid #a98a54; border-top: 3px solid #7a1420; border-radius: 5px;
  box-shadow: 0 2px 6px rgba(60, 40, 15, 0.4);
  padding: 6px 6px 6px; width: 106px; box-sizing: border-box; text-align: center;
  position: relative;
}
.tn { cursor: pointer; transition: box-shadow .12s, transform .12s; }
.tn:hover { box-shadow: 0 0 0 2px #b8923a, 0 5px 14px rgba(0,0,0,0.6); transform: translateY(-1px); z-index: 3; }
.tn.selected { box-shadow: 0 0 0 2px #c9141f, 0 5px 14px rgba(0,0,0,0.6); }
.tn.bastard { border-style: dashed; background: linear-gradient(175deg, #e6dcc4, #d5c8a6); }
.tn-face {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  border: 2px solid #8a7444; margin: 0 auto 4px; display: block;
  background: #cbbb92;
}
.tn-face-blank {
  width: 42px; height: 42px; border-radius: 50%; margin: 0 auto 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #9a865a; background: #cbbb92;
  font-family: "Cinzel", serif; font-size: 0.88rem; color: #6a5a3a;
}
.tn-name { font-family: "Cinzel", serif; font-size: 0.94rem; letter-spacing: 0.02em; color: #322818; line-height: 1.2; font-weight: 600; }
.tn-name .crown { color: #a07d1f; margin-right: 2px; }
.tn-title { font-family: "EB Garamond", serif; font-style: italic; font-size: 0.86rem; color: #6f5d38; margin-top: 2px; line-height: 1.28; }
.tn-note { font-family: "EB Garamond", serif; font-size: 0.8rem; color: #837252; margin-top: 3px; font-style: italic; line-height: 1.3; }
.tn-sp { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.tn-sp-chip {
  font-family: "EB Garamond", serif; font-size: 0.82rem; color: #55471d;
  background: rgba(122, 96, 48, 0.12); border: 1px solid rgba(122, 96, 48, 0.28);
  border-radius: 10px; padding: 1px 8px; display: inline-block;
}
button.tn-sp-chip { cursor: pointer; }
button.tn-sp-chip:hover { background: rgba(122, 96, 48, 0.28); }
.tn-sp-chip .sp-mark { color: #a07d1f; }

/* ---------------- sidebar progress box ---------------- */
.progress-box {
  margin: 10px 0 4px; padding: 9px 11px; border-radius: 7px;
  background: rgba(122, 96, 48, 0.10); border: 1px solid rgba(122, 96, 48, 0.3);
}
.progress-label { font-family: "Cinzel", serif; font-size: 0.76rem; letter-spacing: 0.04em; color: #4a3f2e; line-height: 1.35; }
.progress-eye { margin-right: 3px; }
.progress-change {
  margin-top: 6px; background: none; border: none; cursor: pointer; padding: 0;
  font-family: "EB Garamond", serif; font-style: italic; font-size: 0.82rem;
  color: #8a6a30; text-decoration: underline;
}
.progress-change:hover { color: #6a4f1c; }

/* ---------------- spoiler gate modal ---------------- */
.spoiler-gate {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 11, 14, 0.82); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.spoiler-gate.hidden { display: none; }
.gate-card {
  background: linear-gradient(180deg, #efe4c8, #e6d8b6);
  border: 1px solid #8a7444; border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
  max-width: 560px; width: 100%; padding: 28px 32px 30px; text-align: center;
  position: relative;
}
.gate-close {
  position: absolute; top: 10px; right: 14px; background: none; border: none;
  font-size: 1.7rem; line-height: 1; color: #8a7444; cursor: pointer; padding: 2px 6px;
}
.gate-close:hover { color: #3a3020; }
.gate-kicker { font-family: "EB Garamond", serif; font-style: italic; color: #9a7a3a; letter-spacing: 0.08em; font-size: 0.95rem; }
.gate-title { font-family: "Cinzel", serif; font-size: 1.5rem; letter-spacing: 0.06em; color: #3a3020; margin: 4px 0 10px; }
.gate-note { font-family: "EB Garamond", serif; font-size: 1rem; color: #6a5a3a; line-height: 1.5; margin: 0 auto 20px; max-width: 460px; }
.gate-cols { display: flex; gap: 20px; justify-content: center; }
.gate-col { flex: 1; }
.gate-col-head { font-family: "Cinzel", serif; font-size: 0.9rem; letter-spacing: 0.08em; color: #7a6030; margin-bottom: 10px; }
.gate-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.gate-chip {
  font-family: "Cinzel", serif; font-size: 0.82rem; letter-spacing: 0.03em;
  padding: 7px 11px; border-radius: 7px; cursor: pointer; color: #3a3020;
  background: rgba(122, 96, 48, 0.14); border: 1px solid rgba(122, 96, 48, 0.4);
}
.gate-chip:hover { background: #b8923a; color: #1c1810; border-color: #b8923a; }
/* the place you have already chosen reads as a filled, darker chip */
.gate-chip.sel { background: #5a3f14; color: #f2e8ce; border-color: #3a2a0e; box-shadow: inset 0 0 0 1px rgba(255,240,200,0.25); }
.gate-all.sel { box-shadow: inset 0 0 0 2px #d9b45a; background: #815f22; }
.gate-all {
  margin-top: 22px; width: 100%; padding: 11px; cursor: pointer;
  font-family: "Cinzel", serif; font-size: 0.86rem; letter-spacing: 0.05em;
  color: #f0e6cc; background: #6a4f1c; border: 1px solid #4a3712; border-radius: 8px;
}
.gate-all:hover { background: #815f22; }

/* ---------------- the character card (right side, like the maps) ---------------- */
.char-card.tree-card {
  position: fixed; top: 76px; right: 18px; bottom: 18px;
  width: 322px; max-height: calc(100vh - 94px);
  z-index: 40;
}
.tree-card-title { font-family: "EB Garamond", serif; font-style: italic; text-align: center; color: #7a6844; font-size: 0.9rem; margin: -2px 0 12px; }
.tree-card .tc-crown { color: #a07d1f; margin-right: 3px; }
.tc-house {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(122,96,48,0.3);
}
.tc-house img { width: 26px; height: 30px; object-fit: contain; }
.tc-house-text { font-family: "Cinzel", serif; font-size: 0.72rem; letter-spacing: 0.06em; color: #5a4c30; }
.tc-house-text i { display: block; font-family: "EB Garamond", serif; font-style: italic; letter-spacing: 0; color: #8a7a5c; font-size: 0.82rem; }
.tc-note { font-family: "EB Garamond", serif; font-size: 0.98rem; line-height: 1.5; color: #4a3f2e; margin: 0 0 14px; }
.tc-kin { margin-top: 4px; }
.tc-kin-row { display: flex; gap: 8px; margin-bottom: 7px; font-family: "EB Garamond", serif; font-size: 0.92rem; line-height: 1.4; }
.tc-kin-row > b {
  flex: 0 0 74px; text-align: right; font-family: "Cinzel", serif; font-weight: 500;
  font-size: 0.66rem; letter-spacing: 0.05em; text-transform: uppercase; color: #8a7444; padding-top: 3px;
}
.tc-kin-row > span { flex: 1; color: #3a3020; }
.tc-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.tc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: 8px; text-decoration: none;
  border: 1px solid #b79a5e; background: rgba(160, 120, 40, 0.10);
  color: #5a4718; font-family: "Cinzel", serif; font-size: 0.82rem; letter-spacing: 0.03em;
  transition: background 0.14s, border-color 0.14s;
}
.tc-btn:hover { background: rgba(160, 120, 40, 0.22); border-color: #8a6a2c; }
.tc-link { color: #7a5a1c; cursor: pointer; text-decoration: underline dotted; }
.tc-link:hover { color: #5a3f0c; }
.tc-sep { color: #a89878; }

/* ---------------- bottom hint ---------------- */
/* the hint floats over the foot of the parchment, not the whole window */
.tree-hint {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 4; pointer-events: none;
  font-family: "EB Garamond", serif; font-style: italic; font-size: 0.84rem;
  color: #cdbb93; background: rgba(20, 22, 28, 0.8); border: 1px solid rgba(184,146,53,0.3);
  padding: 5px 16px; border-radius: 20px; letter-spacing: 0.03em;
  transition: opacity .5s;
}
.tree-hint.gone { opacity: 0; }

/* ---------------- the house picker overlay ---------------- */
.tree-picker {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 8, 5, 0.72); padding: 20px;
  animation: tree-pick-in 0.25s ease both;
}
.tree-picker.hidden { display: none; }
@keyframes tree-pick-in { from { opacity: 0; } to { opacity: 1; } }
.tree-picker-inner {
  position: relative; width: min(760px, 94vw); max-height: 86vh; overflow-y: auto;
  background: linear-gradient(180deg, #efe3c4, #e3d3ab);
  border: 1px solid #a98a54; border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6); padding: 26px 26px 22px; text-align: center;
}
.tree-picker-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  font-size: 1.5rem; line-height: 1; color: #7a6038; cursor: pointer;
}
.tree-picker-kicker { font-family: "EB Garamond", serif; font-style: italic; color: #9a7a3a; letter-spacing: 0.08em; }
.tree-picker-title { font-family: "Cinzel", serif; font-size: 1.5rem; letter-spacing: 0.06em; color: #3a3020; margin: 4px 0 18px; }
.tree-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 9px; }
.tree-pick {
  display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 9px; color: #4a3f2e;
  background: rgba(255,250,235,0.5); border: 1px solid rgba(122,96,48,0.28);
  transition: border-color 0.16s, background 0.16s, transform 0.16s, box-shadow 0.16s;
}
.tree-pick:hover { transform: translateY(-2px); background: rgba(255,250,235,0.85); border-color: var(--hc, #a98a54); box-shadow: inset 3px 0 0 var(--hc, transparent); }
.tree-pick.active { border-color: var(--hc, #a98a54); box-shadow: inset 3px 0 0 var(--hc, transparent); background: rgba(255,250,235,0.9); }
.tree-pick img { width: 30px; height: 34px; object-fit: contain; flex: 0 0 auto; }
.tree-pick-star { width: 30px; text-align: center; font-size: 1.3rem; color: #8a1420; flex: 0 0 auto; }
.tree-pick-text { min-width: 0; }
.tree-pick-text b { display: block; font-family: "Cinzel", serif; font-size: 0.86rem; letter-spacing: 0.05em; font-weight: 600; }
.tree-pick-text i { display: block; font-family: "EB Garamond", serif; font-style: italic; font-size: 0.8rem; color: #8a7a5c; }
.tree-pick-all { grid-column: 1 / -1; justify-content: center; background: rgba(122,96,48,0.12); }
.tree-picker-note { font-family: "EB Garamond", serif; font-size: 0.82rem; color: #7a6844; margin: 16px 0 0; }

/* the rail toggle only matters on narrow screens, where the rail is a drawer */
.trees-topbtn#tree-rail-toggle { display: none; }

/* ---------------- narrow screens: the rail becomes a left drawer ---------------- */
@media (max-width: 820px) {
  .trees-topbtn#tree-rail-toggle { display: inline-block; }
  .tree-rail {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 30; width: 268px; flex-basis: 268px;
    transform: translateX(-100%); transition: transform 0.24s ease;
    box-shadow: 12px 0 40px rgba(0,0,0,0.5);
  }
  .trees-layout.rail-open .tree-rail { transform: translateX(0); }
  .tree-parchment { margin: 10px; }
  .tree-intro { padding: 18px 22px 2px; }
  .trees-canvas { padding: 8px 24px 80px; }
  .tree-house-name { font-size: 1.9rem; }
  .char-card.tree-card { width: auto; left: 10px; right: 10px; }
}
/* ---------------- sidebar: All Houses button + coloured active accents ---------------- */
.house-roll-btn.all-houses {
  margin: 4px 0 2px; font-weight: 600;
  border: 1px solid rgba(122, 96, 48, 0.4); background: rgba(122, 96, 48, 0.08);
}
.house-roll-btn.all-houses .all-dot { font-size: 1.2rem; color: #8a1420; width: 26px; text-align: center; }
.house-roll-btn.all-houses:hover { background: rgba(122, 96, 48, 0.18); }
.house-roll-btn.active {
  background: rgba(122, 96, 48, 0.16);
  border-color: var(--hc, rgba(122, 96, 48, 0.35));
  box-shadow: inset 3px 0 0 var(--hc, transparent);
}
/* ---------------- married couples shown side by side (like the reference) ---------------- */
.couple { display: flex; align-items: flex-start; justify-content: center; }
.couple > .tn { flex: 0 0 auto; }
/* the marriage bar sits level with the portraits (a fixed drop from the top),
   so it joins the couple across the faces no matter how tall their cards run */
.m-bar { flex: 0 0 auto; width: 14px; height: 3px; border-radius: 2px; align-self: flex-start; margin-top: 27px; }
.tn-spouse { opacity: 0.96; }

/* the fate line in a card reads a touch dimmer than a proper bio */
.tc-note.tc-fate { color: #7a6a4a; }

/* ---------------- marriage-line legend (like the reference key) ---------------- */
.m-legend {
  position: absolute; left: 16px; bottom: 42px; z-index: 4;
  background: rgba(244, 236, 214, 0.92); border: 1px solid #a98a54; border-radius: 8px;
  padding: 7px 11px 8px; box-shadow: 0 3px 10px rgba(60,40,15,0.35);
  font-family: "EB Garamond", serif; font-size: 0.78rem; color: #4a3a20;
}
.m-legend-title { font-family: "Cinzel", serif; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: #7a4a10; margin-bottom: 5px; }
.m-legend div { display: flex; align-items: center; gap: 7px; line-height: 1.6; }
.ml-swatch { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.ml-dash { width: 18px; height: 11px; border: 1px dashed #8a6a3a; border-radius: 3px; display: inline-block; }