/* panel/genealogy.css — Genealogy / tree structure and level medals.
   Part of the split style.css. Keep the load order in includes/layout.php. */

.medal-stack { width: min(340px, 100%); display: grid; gap: 8px; }

.medal {
  padding: 10px 14px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 20px 40px rgba(0,0,0,.18);
}

.medal b { font-family: var(--sans); letter-spacing: .18em; font-size: 13px; }

.medal h2 { font-size: 22px; margin: 2px 0; }

.medal p { margin: 0; opacity: .85; }

.medal-gold { background: linear-gradient(160deg, #f6e7c2, #b8863a 55%, #6d4b16); color: #2a160c; }

.medal-silver { background: linear-gradient(160deg, #f7f9fb, #c5ced6 50%, #6d7884); color: #1b242c; margin-left: 36px; }

.medal-diamond { background: linear-gradient(160deg, #331419, #0c1c24 60%, #1a1a1a); color: #f4efe4; margin-left: 12px; border-color: rgba(231,211,163,.4); }

.genealogy-panel { min-width: 0; overflow: hidden; }

.tree-pick { margin-top: 4px; }

.tree-pick select { min-width: 260px; }

.level-columns {
  display: flex;
  gap: 14px;
  align-items: stretch;
  overflow-x: auto;
  padding: 2px 2px 10px;
}

.level-col {
  flex: 1 0 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(103, 31, 43, .28);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.level-col h3 {
  margin: 0;
  padding: 12px 14px;
  background: #310e14;
  color: #f8f1de;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.level-col-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding: 12px;
}

.level-card .tree-photo {
  width: 52px;
  height: 52px;
  border: 2px solid #c9a15a;
}

.tree-summary { margin: 0 0 10px; color: #6e5d52; font-size: 13px; }

.tree-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.orgtree-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  min-width: 100%;
  padding: 4px 8px 12px;
}

.tree-ancestors {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.tree-ancestor-stem {
  width: 2px;
  height: 16px;
  background: var(--gold);
}

.orgtree, .orgtree ul, .orgtree li { list-style: none; margin: 0; padding: 0; }

.orgtree {
  --tree-gap: 16px;
  --tree-line: var(--gold);
  display: flex;
  justify-content: center;
  width: max-content;
  min-width: 100%;
}

.orgtree ul {
  display: flex;
  justify-content: center;
  position: relative;
  padding-top: var(--tree-gap);
}

.orgtree li {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: var(--tree-gap) 8px 0;
}

.orgtree ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: var(--tree-gap);
  border-left: 2px solid var(--tree-line);
}

.orgtree li::before,
.orgtree li::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50%;
  height: var(--tree-gap);
  border-top: 2px solid var(--tree-line);
}

.orgtree li::before { right: 50%; }

.orgtree li::after {
  left: 50%;
  border-left: 2px solid var(--tree-line);
}

.orgtree li:first-child::before { border-top-color: transparent; }

.orgtree li:last-child::after { border-top-color: transparent; }

.orgtree li:only-child { padding-top: 0; }

.orgtree li:only-child::before,
.orgtree li:only-child::after { display: none; }

.orgtree > li { padding-top: 0; }

.orgtree > li::before,
.orgtree > li::after { display: none; }

.tree-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 96px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  position: relative;
  z-index: 1;
  line-height: 1.2;
}

a.tree-node:hover .tree-photo { box-shadow: 0 0 0 3px var(--gold-2); }

a.tree-node:focus-visible { outline: 2px solid var(--maroon); outline-offset: 3px; border-radius: 8px; }

.orgtree > li > .tree-node .tree-photo { box-shadow: 0 0 0 3px var(--gold-2); }

.tree-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 2px solid var(--gold);
  background: #fff;
}

.tree-node strong,
.tree-node span {
  display: block;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-node strong {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--maroon-deep);
}

.tree-node span { font-size: 11px; color: #3a2e28; }

.tree-more {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--maroon);
  position: relative;
  z-index: 1;
}

.desk-body .panel.tree-board {
  margin-top: 0;
  padding: 22px 20px 28px;
  background: linear-gradient(180deg, #fffdf8 0%, #faf4f5 100%);
  border: 1px solid rgba(103, 31, 43, .28);
  border-radius: 16px;
}

.tree-board .tree-summary {
  margin: 0 0 16px;
  text-align: center;
  font-size: 15px;
  color: #694148;
}

.tree-board .tree-scroll {
  background: #fff;
  border: 1px solid rgba(103, 31, 43, .16);
  border-radius: 14px;
}

.tree-board .orgtree-wrap { padding: 28px 36px 32px; }

.tree-board .orgtree { --tree-gap: 36px; --tree-line: #671f2b; }

.tree-board .orgtree li { padding: var(--tree-gap) 22px 0; }

.tree-board .tree-node { width: auto; min-width: 150px; }

.tree-board .tree-photo {
  width: 96px;
  height: 96px;
  border: 3px solid #671f2b;
  box-shadow: 0 0 0 5px #fff, 0 10px 20px rgba(49, 14, 20, .12);
}

.tree-board .orgtree > li > .tree-node .tree-photo {
  box-shadow: 0 0 0 5px #fff, 0 0 0 8px var(--gold), 0 12px 24px rgba(49, 14, 20, .16);
}

.tree-board .tree-node strong,
.tree-board .tree-node span { max-width: 168px; }

.tree-board .tree-node strong { margin-top: 10px; font-size: 16px; letter-spacing: .03em; }

.tree-board .tree-node span { margin-top: 2px; font-size: 14px; white-space: normal; }

.tree-board .tree-more { margin-top: 8px; font-size: 13px; font-weight: 700; }

.team-business-head h2 { margin: 0 0 4px; font-size: 18px; }

.desk-member .panel > .stat-grid.team-business {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 10px;
}

.team-total td { font-weight: 700; color: var(--maroon-deep); }

.team-level-panel { margin-top: 14px; }

.team-level-panel > h2 { margin: 0 0 8px; font-size: 18px; }

@media (max-width: 1100px) {
    .desk-member .panel > .stat-grid.team-business { grid-template-columns: 1fr 1fr; }
    .medal-silver, .medal-diamond { margin-left: 0; }
}

@media (max-width: 760px) {
    .desk-member .panel > .stat-grid.team-business { grid-template-columns: 1fr; }
    .medal-silver, .medal-diamond { margin-left: 0; }
}

.client-dash .team-level-panel {
  margin-top: 0;
  padding: 18px 18px 10px;
  border-radius: 20px;
  border: 1px solid rgba(184, 137, 58, .35);
  background: linear-gradient(180deg, #fffdf8 0%, #fbf7ee 100%);
  box-shadow: 0 12px 28px rgba(48, 18, 12, .05);
}

/* ---------- Compact genealogy (Option A): summary strip + slim level columns ----------
   Markup: render_level_columns() in includes/tree.php. Site colours: maroon, gold, ivory. */
.gen-sum {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 6px;
}
.gen-stat {
  min-width: 0;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid rgba(201, 150, 46, .5);
  border-radius: 10px;
}
.gen-stat span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #8a5e12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gen-stat strong {
  display: block;
  font-size: 17px;
  line-height: 1.25;
  color: #5c0d1d;
  font-variant-numeric: tabular-nums;
}
.gen-stat-top { border-color: #c9962e; background: #fffaf0; }
.gen-stat-top span { color: #7a1428; font-weight: 700; }
.gen-ic { flex: none; width: 15px; height: 15px; }
.gen-stat-top .gen-ic-crown { color: #c9962e; width: 17px; height: 17px; }
.gen-hint { margin: 0 0 8px; font-size: 12.5px; }

.gen-cols {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  align-items: start;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
}
.gen-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(122, 20, 40, .25);
  border-radius: 12px;
  overflow: hidden;
}
.gen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 7px 10px;
  background: linear-gradient(90deg, #5c0d1d, #7a1428);
  color: #fff6dc;
  font-size: 14px;
  font-weight: 700;
  border-bottom: 2px solid #c9962e;
}
.gen-head > span { display: inline-flex; align-items: center; gap: 6px; }
.gen-head .gen-ic-tree { color: #e6c069; }
.gen-head i {
  font-style: normal;
  background: #e6c069;
  color: #5c0d1d;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11.5px;
  white-space: nowrap;
}
.gen-list {
  display: flex;
  flex-direction: column;
  max-height: min(64vh, 560px);
  overflow-y: auto;
}
.gen-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-top: 1px solid #f3e7d0;
  color: inherit;
  text-decoration: none;
}
.gen-row:first-child { border-top: 0; }
.gen-row:hover, .gen-row:focus-visible { background: #fbf5ea; outline: none; }
.gen-row:hover .gen-av { background: #7a1428; color: #fff6dc; }
.gen-av {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fbf5ea;
  border: 2px solid #c9962e;
  color: #7a1428;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
.gen-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gen-amt {
  flex: none;
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: #5c0d1d;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gen-who b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  color: #5c0d1d;
}
.gen-who small {
  font-size: 12px;
  color: #6b4a3a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gen-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9a8a8c; }
.gen-dot-active { background: #2f8a4e; }
.gen-dot-blocked { background: #b3261e; }

@media (max-width: 720px) {
  .gen-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gen-stat-top { grid-column: 1 / -1; }
  .gen-stat strong { font-size: 15px; }
  .gen-cols { grid-auto-columns: minmax(78vw, 1fr); }
}

/* ===== Card tree (genealogy) ===== */
.ct-panel { padding: 20px; }

.ct-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--maroon-deep) 0%, var(--maroon) 100%);
  color: #fff;
}

.ct-head-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ct-head-id { font-size: 12px; letter-spacing: .12em; color: var(--gold-2); font-weight: 700; }
.ct-head-who strong { font-size: 20px; line-height: 1.2; }
.ct-up { margin-top: 4px; font-size: 12px; color: var(--gold-2); text-decoration: none; font-weight: 600; }
.ct-up:hover { text-decoration: underline; }

.ct-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.ct-stats div {
  min-width: 92px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(231, 215, 174, .35);
  text-align: center;
}
.ct-stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-2); }
.ct-stats dd { margin: 2px 0 0; font-size: 17px; font-weight: 700; }

.ct-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid rgba(103, 31, 43, .14);
  background:
    radial-gradient(circle, rgba(103, 31, 43, .07) 1px, transparent 1px) 0 0 / 18px 18px,
    #fffdf8;
}

.ct-wrap { width: max-content; min-width: 100%; padding: 28px 24px 32px; }

.ctree, .ctree ul, .ctree li { list-style: none; margin: 0; padding: 0; }
/* Tree runs left to right: the sponsor on the left, their members in a column to the right */
.ctree { --gap: 24px; --line: var(--gold); display: flex; justify-content: flex-start; }
.ctree ul {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding-left: var(--gap);
}
.ctree li {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  padding: 6px 0 6px var(--gap);
}
.ctree > li { padding: 0; }

/* Line from the sponsor to the column of members */
.ctree ul::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: var(--gap);
  margin-top: -2px;
  border-top: 2px solid var(--line);
}

/* Each member's branch off that column */
.ctree li::before,
.ctree li::after {
  content: "";
  position: absolute;
  left: 0;
  box-sizing: border-box;
}
.ctree li::before {
  top: 0;
  width: var(--gap);
  height: 50%;
  border-left: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
}
.ctree li::after {
  top: 50%;
  height: 50%;
  border-left: 2px solid var(--line);
}
.ctree li:first-child::before { border: 0 none; }
.ctree li:first-child::after {
  top: calc(50% - 2px);
  width: var(--gap);
  height: calc(50% + 2px);
  border-top: 2px solid var(--line);
  border-top-left-radius: 12px;
}
.ctree li:last-child::after { border: 0 none; }
.ctree li:last-child::before { border-bottom-left-radius: 12px; }
/* A single member: one straight line, in line with the other columns */
.ctree li:only-child::before {
  top: calc(50% - 2px);
  height: 0;
  border: 0 none;
  border-top: 2px solid var(--line);
  border-radius: 0;
}
.ctree li:only-child::after,
.ctree > li::before,
.ctree > li::after { display: none; }

.ct-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 210px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(103, 31, 43, .16);
  border-top: 4px solid #b9a99a;
  background: #fff;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(49, 14, 20, .08);
  position: relative;
  z-index: 1;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ct-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(49, 14, 20, .14); }
.ct-card:focus-visible { outline: 2px solid var(--maroon); outline-offset: 3px; }
.ct-card.is-active { border-top-color: #2e8b57; }
.ct-card.is-inactive { border-top-color: #b9a99a; }
.ct-card.is-blocked { border-top-color: #c0392b; }

.ct-card.is-root {
  width: 240px;
  background: linear-gradient(135deg, #fff8e8 0%, #fff 70%);
  border: 2px solid var(--gold);
  border-top-width: 5px;
}

.ct-photo {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 2px solid var(--gold);
  background: #fff;
}

.ct-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ct-body > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-id { font-size: 13px; letter-spacing: .04em; color: var(--maroon); }
.ct-name { font-size: 13px; font-weight: 600; }
.ct-pack { font-size: 11px; color: #7a6558; }

.ct-more {
  flex: none;
  margin-left: 8px;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--maroon);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  position: relative;
  z-index: 1;
}
.ct-more:hover { background: var(--maroon-deep); }

.ct-hint { margin: 8px 0 0; font-size: 12px; }

/* ===== Lotus mandala tree ===== */
.lotus-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.lotus-hint { flex: 1 1 260px; min-width: 0; margin: 0; font-size: 13px; color: #6e5d52; }
.lotus-btn {
  flex: none;
  padding: 6px 12px;
  border: 1px solid var(--gold);
  border-radius: 7px;
  background: #fff;
  color: var(--maroon);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.lotus-btn:hover, .lotus-btn:focus-visible { background: var(--gold-2); outline: none; }
.lotus-stage {
  padding: 14px 10px 10px;
  border: 1px solid rgba(103, 31, 43, .14);
  border-radius: 14px;
  background:
    radial-gradient(circle, rgba(103, 31, 43, .07) 1px, transparent 1px) 0 0 / 18px 18px,
    #fffdf8;
}
.lotus-art { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; }
.lotus-art text { text-anchor: middle; pointer-events: none; }
.lotus-ring { fill: none; stroke: var(--gold); stroke-width: 1; stroke-dasharray: 3 6; }
.lotus-stem { stroke: var(--gold); stroke-width: 1.5; }
.lotus-petal { cursor: pointer; outline: none; }
.lotus-petal ellipse { fill: #fff8e8; stroke: var(--gold); stroke-width: 2; transition: fill .15s ease; }
.lotus-petal.is-inactive ellipse { stroke: #9a8b80; }
.lotus-petal.is-blocked ellipse { stroke: #c0392b; }
.lotus-petal:hover ellipse, .lotus-petal:focus-visible ellipse { fill: var(--gold-2); }
.lotus-petal:focus-visible ellipse { stroke: var(--maroon); stroke-width: 3; }
.lotus-name { fill: var(--maroon-deep); font-size: 13.5px; font-weight: 700; }
.lotus-id { fill: #6e5d52; font-size: 10.5px; }
.lotus-init { display: none; fill: var(--maroon); font-size: 25px; font-weight: 700; }
.lotus-badge { fill: var(--maroon); }
.lotus-badge-n { fill: #fff; font-size: 12.5px; font-weight: 700; }
.lotus-core { fill: var(--maroon-deep); stroke: var(--gold); stroke-width: 4; }
.lotus-core-name { fill: #fff; font-size: 16px; font-weight: 700; }
.lotus-core-id { fill: var(--gold-2); font-size: 11.5px; }
.lotus-empty { margin: 6px 0 0; text-align: center; }
.lotus-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 8px 0 0; font-size: 12px; color: #6e5d52; }
.lotus-key span { display: inline-flex; align-items: center; gap: 5px; }
.lotus-key span::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--gold); background: #fff8e8; }
.lotus-key .is-inactive::before { border-color: #9a8b80; }
.lotus-key .is-blocked::before { border-color: #c0392b; }
.lotus-list { display: none; }

/* Phones: big initials on the petals, with a readable list of the same members below */
@media (max-width: 640px) {
  .lotus-stage { padding: 8px 4px; }
  .lotus-name, .lotus-id { display: none; }
  .lotus-init { display: block; }
  .lotus-badge { r: 20px; }
  .lotus-badge-n { font-size: 17px; transform: translateY(1.5px); transform-box: fill-box; }
  .lotus-core-name { font-size: 19px; }
  .lotus-core-id { font-size: 13px; }
  .lotus-list {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    border: 1px solid rgba(122, 20, 40, .25);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
  }
  .lotus-btn { flex: 1 1 auto; text-align: center; }
}

/* ===== Gold necklace tree ===== */
.neck-art { display: block; width: 100%; max-width: 780px; height: auto; margin: 0 auto; }
.neck-art text { text-anchor: middle; pointer-events: none; }
/* One gem colour per level: ruby, emerald, sapphire, amethyst, topaz, turquoise */
.neck-c0 { --gem: #c2185b; }
.neck-c1 { --gem: #0b8458; }
.neck-c2 { --gem: #1e62d0; }
.neck-c3 { --gem: #7b3fc4; }
.neck-c4 { --gem: #b95300; }
.neck-c5 { --gem: #087f91; }
/* Jewellery display: polished gold on dark velvet. Gold and stone fills are set in the SVG itself. */
.lotus-stage.neck-stage {
  border-color: #b98a2c;
  background: radial-gradient(ellipse at 50% 38%, #6d1a2c 0%, #471021 52%, #260710 100%);
}
.neck-strand { fill: none; stroke: #6b4306; stroke-width: 6.5; stroke-linecap: round; }
.neck-link { fill: none; stroke: #eebf3e; stroke-width: 4.6; stroke-dasharray: 8 3; }
.neck-shine { fill: none; stroke: #fff6c8; stroke-width: 1.3; stroke-dasharray: 4 7; }
.neck-chain { stroke: #6b4306; stroke-width: 6.5; }
.neck-chain-link { stroke: #eebf3e; stroke-width: 4.6; stroke-dasharray: 6 3; }
.neck-shadow { fill: #120306; opacity: .42; }
.neck-setting { stroke: #6b4306; stroke-width: .8; transition: stroke-width .15s ease; }
.neck-stone { stroke: #7a4f08; stroke-width: 1; }
.neck-glint { fill: #fff; opacity: .6; pointer-events: none; }
.neck-bead, .neck-more { cursor: pointer; outline: none; }
.neck-bead text {
  fill: #fff;
  font-size: 10.5px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(20, 5, 8, .6);
  stroke-width: 2px;
}
.neck-bead.is-inactive text { fill: #3f362f; stroke: rgba(255, 255, 255, .55); }
.neck-bead.is-blocked .neck-setting { stroke: #ff4b45; stroke-width: 2.5; }
.neck-bead:hover .neck-setting, .neck-bead:focus-visible .neck-setting,
.neck-more:hover .neck-setting, .neck-more:focus-visible .neck-setting { stroke: #fff6c8; stroke-width: 3.5; }
.neck-more text { fill: #4a1a06; font-size: 11.5px; font-weight: 700; }
.neck-pill { fill: var(--gem, var(--maroon)); stroke: #f2c94c; stroke-width: 1.5; }
.neck-level { fill: #fff; font-size: 13px; font-weight: 700; }
.neck-pendant { stroke: #6b4306; stroke-width: 1.2; stroke-linejoin: round; }
.neck-facet { stroke: rgba(255, 226, 138, .55); stroke-width: .8; stroke-linejoin: round; }
.neck-sparkle { fill: #fff; opacity: .28; }
.neck-core-name, .neck-core-id { paint-order: stroke; stroke: rgba(50, 4, 18, .75); stroke-width: 2.5px; }
.neck-core-name { fill: #fff; font-size: 14px; font-weight: 700; }
.neck-core-id { fill: #ffe9a8; font-size: 10px; }
.neck-stage .lotus-key { color: #f8e8c6; }
.neck-stage .lotus-empty { color: #f8e8c6; }
.neck-key .is-active::before { background: #d3124f; border-color: #f2c94c; }
.neck-key .is-inactive::before { background: #d6d1ca; border-color: #f2c94c; }
.neck-key .is-blocked::before { background: #2a2326; border-color: #ff4b45; }
.neck-list { display: none; }

/* Phones: the necklace stays as the picture, with a readable, tappable list of its members below */
@media (max-width: 640px) {
  .neck-level { font-size: 15px; }
  .neck-bead text, .neck-more text { font-size: 14px; }
  .neck-core-name { font-size: 17px; }
  .neck-core-id { font-size: 11px; }
  .neck-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
  .neck-group { border: 1px solid rgba(122, 20, 40, .25); border-radius: 12px; background: #fff; overflow: hidden; }
  .neck-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    background: var(--gem, var(--maroon));
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
  }
  .neck-group > summary::-webkit-details-marker { display: none; }
  .neck-group > summary i { font-style: normal; font-size: 12px; color: #fff; font-weight: 600; }
  .neck-list-more {
    display: block;
    padding: 9px 12px;
    border-top: 1px solid #f3e7d0;
    color: var(--maroon);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
  }
}

/* ===== Royal mix necklace ===== Gold and stone fills are set in the SVG itself. */
/* Level buttons: Level 1 to 4, 5 to 8 ... 17 & 18 */
.royal-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
  scroll-margin-top: 92px;
}
.royal-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 54px;
  padding: 7px 6px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #fff;
  color: var(--maroon);
  text-align: center;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.royal-tab strong { color: inherit; font-size: 14px; font-weight: 700; line-height: 1.2; }
.royal-tab span { color: #5c4a40; font-size: 12px; line-height: 1.2; }
.royal-tab:hover { background: #fbeecb; color: var(--maroon); }
.royal-tab:focus-visible { outline: 2px solid var(--maroon); outline-offset: 2px; }
.royal-tab.is-empty { background: #fbf7f0; }
.royal-tab.is-on, .royal-tab.is-on:hover { border-color: var(--maroon); background: var(--maroon); color: #fff; }
.royal-tab.is-on span { color: #ffe9a8; }
@media (max-width: 640px) {
  .royal-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .royal-tab { min-height: 50px; padding: 6px 3px; }
  .royal-tab strong { font-size: 13px; }
  .royal-tab span { font-size: 11px; }
}
.royal-art { display: block; width: 100%; max-width: 760px; height: auto; margin: 0 auto; }
.royal-art text { text-anchor: middle; pointer-events: none; }
.royal-jewel { filter: drop-shadow(0 3px 2.5px rgba(10, 2, 4, .55)); }
.royal-member { cursor: pointer; outline: none; }
.royal-rim { stroke: #7d5208; stroke-width: .8; transition: stroke-width .15s ease; }
.royal-member:hover .royal-rim, .royal-member:focus-visible .royal-rim { stroke: #fff6c8; stroke-width: 3; }
.royal-member.is-blocked .royal-rim { stroke: #ff4b45; stroke-width: 2; }
.royal-i {
  fill: #fff;
  font-size: 9.5px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(20, 5, 8, .6);
  stroke-width: 2px;
}
.royal-member.is-inactive .royal-i { fill: #3f362f; stroke: rgba(255, 255, 255, .6); }
.royal-name, .royal-pack, .royal-name-m, .royal-pack-m { paint-order: stroke; stroke: rgba(38, 7, 16, .9); stroke-width: 3px; stroke-linejoin: round; }
.royal-name, .royal-name-m { fill: #fff; font-size: 11px; font-weight: 700; }
.royal-pack, .royal-pack-m { fill: #ffdf85; font-size: 10px; font-weight: 600; }
.royal-name-m, .royal-pack-m { display: none; }
.royal-more text { fill: #4a1a06; font-size: 10.5px; font-weight: 700; }
.royal-pill { stroke: #e9b836; stroke-width: 1.3; }
.royal-level { fill: #fff; font-size: 12.5px; font-weight: 700; }
.royal-core-name, .royal-core-id { paint-order: stroke; stroke: rgba(50, 4, 18, .75); }
.royal-core-name { fill: #fff; font-size: 13.5px; font-weight: 700; stroke-width: 2.5px; }
.royal-core-id { fill: #ffe9a8; font-size: 9.5px; stroke-width: 2px; }

@media (max-width: 640px) {
  .royal-i { font-size: 12.5px; }
  .royal-name, .royal-pack { display: none; }
  .royal-name-m { display: block; font-size: 13.5px; }
  .royal-pack-m { display: block; font-size: 12px; }
  .royal-more text { font-size: 13px; }
  .royal-level { font-size: 14px; }
  .royal-core-name { font-size: 14.5px; }
  .royal-core-id { font-size: 9.5px; }
}

/* ===== Level-wise tables ===== */
.lv-panel { margin-top: 16px; padding: 20px; }
.lv-panel > h2 { margin: 0 0 12px; font-size: 18px; }
.lv-tables { display: flex; flex-direction: column; gap: 12px; }

.lv-block {
  border: 1px solid rgba(103, 31, 43, .16);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.lv-block > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #faf4f5;
  cursor: pointer;
  list-style: none;
}
.lv-block > summary::-webkit-details-marker { display: none; }
.lv-block > summary::after { content: "\25BE"; color: var(--maroon); transition: transform .15s ease; }
.lv-block:not([open]) > summary::after { transform: rotate(-90deg); }
.lv-pill {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--maroon);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.lv-meta { margin-right: auto; font-size: 13px; color: #6e5d52; font-weight: 600; }

.lv-table th, .lv-table td { padding: 8px 10px; white-space: nowrap; }
.lv-table tbody tr:nth-child(even) td { background: #fdfaf3; }
.lv-table .num { text-align: right; }
.lv-table td.lv-who strong,
.lv-table td.lv-who span { display: block; }
.lv-table td.lv-who strong { color: var(--maroon); letter-spacing: .03em; }
.lv-table td.lv-who span { margin-top: 2px; font-size: 12px; color: #5a4a40; }
.lv-table tfoot td { font-weight: 700; color: var(--maroon-deep); border-top: 2px solid var(--gold-2); background: #fff8e8; }

@media (max-width: 760px) {
  .ct-panel, .lv-panel { padding: 12px; }
  .ct-head { padding: 14px; gap: 12px; }
  .ct-head-who strong { font-size: 18px; }
  .ct-stats { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ct-stats div { min-width: 0; padding: 8px; }
  .ct-stats div:last-child { grid-column: 1 / -1; }
  .ct-stats dd { font-size: 16px; overflow-wrap: anywhere; }
}

/* Phones: same left-to-right tree with smaller cards. Swipe sideways to see the next level. */
@media (max-width: 640px) {
  .ct-wrap { padding: 14px 10px 16px; }
  .ctree { --gap: 14px; }
  .ctree li { padding-top: 4px; padding-bottom: 4px; }
  .ct-card { width: 172px; box-sizing: border-box; padding: 8px; gap: 8px; }
  .ct-card.is-root { width: 180px; }
  .ct-photo { flex-basis: 34px; width: 34px; height: 34px; }
  .ct-more { margin-left: 6px; }
  .ct-hint { font-size: 11px; }

  /* Level tables become one card per member */
  .lv-block > summary { padding: 10px 12px; flex-wrap: wrap; }
  .lv-table, table.data.lv-table tbody, table.data.lv-table tfoot, table.data.lv-table tr, table.data.lv-table td { display: block; width: 100%; box-sizing: border-box; }
  table.data.lv-table thead { display: none; }
  table.data.lv-table tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px 12px 12px 44px;
    border-bottom: 1px solid rgba(103, 31, 43, .12);
  }
  table.data.lv-table tbody tr:nth-child(even) td:not(.lv-sno) { background: none; }
  table.data.lv-table tbody tr:nth-child(even) { background: #fdfaf3; }
  table.data.lv-table td { padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; }
  table.data.lv-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8a766a;
  }
  table.data.lv-table td.lv-sno {
    position: absolute;
    left: 10px;
    top: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--maroon);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
  }
  table.data.lv-table td.lv-sno::before { display: none; }
  table.data.lv-table .num { text-align: left; }
  table.data.lv-table td.num { font-weight: 700; color: var(--maroon-deep); }
  table.data.lv-table tfoot tr { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; background: #fff8e8; }
  table.data.lv-table tfoot td { width: auto; border: 0; background: none; }
  table.data.lv-table tfoot td::before { display: none; }
}
