/* Elemath Academy: the Bio Card (starglyph-cards.js draws the HTML). Lavish Leaf Inc, all rights reserved.
   Every rule starts with .bc so nothing here touches the rest of the game.
   One layout for every creature: header (role banner, rarity, name), then a rail of marks at the left, the picture in the middle, the element
   column at the right, a strip of level, Health, Damage, and bonus under the picture, and a footer.
   What the creature is shows in the card's background (.bc-bg-*): its own tint, its own pattern, and its own words on the picture.
   How rare it is shows in the frame (.bc-r-*): plain, double line, cut corners, cut corners with a double line, cut corners with a thick dashed frame.
   The frame is never yellow, on purpose (see "Keeping clear of the famous creature-collecting series" in STARGLYPH.md). */

/* ---------- the six backgrounds: tint + pattern (each sets every variable, so one nested inside another never borrows) ----------
   Palette version 4 (2026-11-21): light parchment tints, a darker frame, and a dark accent for labels; text is ink (#2b2233). */
.bc-bg-real { --bc-bg: #e6f3e8; --bc-frame: #3f7a55; --bc-line: #3f7a55; --bc-accent: #2e5e40; --bc-pat: none; --bc-pat-size: auto; }
.bc-bg-extinct { --bc-bg: #f1e8d6; --bc-frame: #8a6a3e; --bc-line: #8a6a3e; --bc-accent: #6b4f22; --bc-pat-size: auto;
  --bc-pat: repeating-linear-gradient(176deg, rgba(255, 255, 255, .5) 0 2px, transparent 2px 13px, rgba(107, 79, 34, .1) 13px 15px, transparent 15px 27px); }
.bc-bg-imagined { --bc-bg: #eee6f7; --bc-frame: #6a4f9a; --bc-line: #6a4f9a; --bc-accent: #55387f; --bc-pat-size: 43px 47px, 61px 53px, 29px 37px;
  --bc-pat: radial-gradient(circle at 20% 30%, rgba(106, 79, 154, .35) 0 1px, transparent 1.6px), radial-gradient(circle at 70% 65%, rgba(171, 152, 181, .5) 0 1.2px, transparent 1.9px), radial-gradient(circle at 45% 85%, rgba(106, 79, 154, .25) 0 .8px, transparent 1.4px); }
.bc-bg-guardian { --bc-bg: #e6ebf3; --bc-frame: #4f5f7a; --bc-line: #4f5f7a; --bc-accent: #3d4a5c; --bc-pat-size: auto;
  --bc-pat: repeating-linear-gradient(45deg, rgba(61, 74, 92, .08) 0 1px, transparent 1px 12px), repeating-linear-gradient(-45deg, rgba(61, 74, 92, .08) 0 1px, transparent 1px 12px); }
.bc-bg-monster { --bc-bg: #f7e3e7; --bc-frame: #8c3441; --bc-line: #8c3441; --bc-accent: #7a2c3a; --bc-pat-size: auto;
  --bc-pat: repeating-linear-gradient(115deg, rgba(140, 52, 65, .08) 0 5px, transparent 5px 22px); }
.bc-bg-legend { --bc-bg: #e5edf8; --bc-frame: linear-gradient(135deg, #067d7c, #3971e4, #6a4f9a, #8c3441, #067d7c, #3971e4); --bc-line: #3971e4; --bc-accent: #2a4f8a; --bc-pat-size: auto;
  --bc-pat: repeating-conic-gradient(from 0deg at 50% 36%, rgba(57, 113, 228, .07) 0 6deg, transparent 6deg 18deg); }

/* ---------- the card ---------- */
.bc { box-sizing: border-box; position: relative; display: flex; padding: 3px; border-radius: 14px; background: var(--bc-frame, #8a7f92); color: #2b2233; font: 400 12px/1.25 'Andika', system-ui, -apple-system, 'Segoe UI', sans-serif; text-align: left; }
.bc *, .bc-legend * { box-sizing: border-box; }
.bc-in { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 7px; border-radius: 11px; background: var(--bc-pat, none), var(--bc-bg, #fffaf0); background-size: var(--bc-pat-size, auto); }
.bc-small { width: 190px; max-width: 100%; min-height: 270px; }
.bc-full { width: 100%; max-width: 420px; font-size: 13px; }
.bc-full .bc-in { padding: 10px; gap: 8px; }
.bc[data-act] { cursor: pointer; }
.bc[data-act]:focus-visible { outline: 3px solid #8a5a34; outline-offset: 2px; }
.bc-i { display: block; flex: none; }
.bc-w { display: none; }
.bc-full .bc-w { display: block; }

/* ---------- rarity: the frame ---------- */
.bc-r-uncommon .bc-in, .bc-r-epic .bc-in { box-shadow: inset 0 0 0 2px var(--bc-bg), inset 0 0 0 3.5px var(--bc-line); }
.bc-r-rare, .bc-r-epic, .bc-r-legendary { border-radius: 4px; clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% calc(100% - 11px), calc(100% - 11px) 100%, 11px 100%, 0 calc(100% - 11px), 0 11px); }
.bc-r-rare .bc-in, .bc-r-epic .bc-in, .bc-r-legendary .bc-in { border-radius: 2px; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px); }
.bc-r-legendary { padding: 5px; }
.bc-r-legendary .bc-in { outline: 1.5px dashed var(--bc-line); outline-offset: -5px; }

/* ---------- header: role banner (its own shape for each role), rarity, name ---------- */
.bc-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 18px; }
.bc-role { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 8px 0 6px; border-radius: 9px; background: var(--bc-accent, #3d4a5c); color: #fffaf0; font: 700 10.5px/1 'Fredoka', 'Andika', sans-serif; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.bc-role-guardian { border-radius: 2px; padding-right: 13px; clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%); }
.bc-role-monster { border-radius: 0; padding: 0 11px; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.bc-role-legend { border-radius: 0; padding: 0 12px; clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 50%, calc(100% - 7px) 100%, 7px 100%, 0 50%); }
.bc-rar { display: inline-flex; align-items: center; gap: 6px; color: var(--bc-accent, #3d4a5c); min-width: 0; }
.bc-rar .bc-w { font: 700 12px/1 'Fredoka', 'Andika', sans-serif; }
.bc-name { font: 700 14px/1.15 'Fredoka', 'Andika', sans-serif; min-height: 2.3em; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.bc-gl-word { color: #7a5e02; }
.bc-full .bc-head { min-height: 24px; }
.bc-full .bc-role { height: 24px; font-size: 12.5px; gap: 5px; padding: 0 12px 0 9px; border-radius: 12px; }
.bc-full .bc-role-guardian { border-radius: 2px; padding-right: 17px; }
.bc-full .bc-role-monster, .bc-full .bc-role-legend { border-radius: 0; padding: 0 15px; }
.bc-full .bc-name { font-size: 22px; min-height: 0; display: block; }

/* ---------- the middle: rail, picture, element column ---------- */
.bc-mid { display: grid; grid-template-columns: 26px minmax(0, 1fr) 34px; gap: 5px; height: 118px; }
.bc-full .bc-mid { grid-template-columns: 60px minmax(0, 1fr) 98px; gap: 6px; height: auto; min-height: 232px; }
.bc-rail, .bc-wheel { display: flex; flex-direction: column; align-items: center; background: rgba(255, 255, 255, .6); border-radius: 8px; min-width: 0; }
.bc-rail { gap: 5px; padding: 4px 0; color: #2b2233; }
.bc-id { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 100%; }
.bc-full .bc-rail { gap: 7px; padding: 7px 2px; }
.bc-full .bc-id .bc-w { font-size: 10px; line-height: 1.1; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.bc-st-LC { color: #2e6e05; } .bc-st-NT { color: #556200; } .bc-st-VU { color: #7a5000; } .bc-st-EN { color: #9a3a0a; } .bc-st-CR, .bc-st-EW { color: #8c3441; }
.bc-st-EX { color: #6b4f22; } .bc-st-IM { color: #55387f; } .bc-st-DO, .bc-st-NE, .bc-st-DD { color: #5a4e63; }

.bc-art { position: relative; display: flex; min-width: 0; overflow: hidden; padding: 3px 3px 16px; border: 1px solid rgba(43, 34, 51, .18); border-radius: 9px; background: #fffaf0; }
.bc-art { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--bc-el, #8a7f92) 38%, transparent), transparent 72%), #fffaf0; }
.bc-pic { flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.bc-pic svg, .bc-pic img { max-width: 100%; max-height: 100%; }
.bc-pic > svg, .bc-pic > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bc-full .bc-pic > svg, .bc-full .bc-pic > img { height: auto; max-height: 200px; }
.bc-noart { color: rgba(43, 34, 51, .5); }
.bc-fam { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 14px; overflow: hidden; background: rgba(255, 250, 240, .92); color: var(--bc-accent, #3d4a5c); font: 800 8.5px/14px 'Andika', system-ui, sans-serif; letter-spacing: .04em; text-align: center; text-transform: uppercase; white-space: nowrap; }
.bc-full .bc-art { padding-bottom: 22px; }
.bc-full .bc-fam { height: 20px; font-size: 11px; line-height: 20px; letter-spacing: .08em; }
.bc-gl { position: absolute; top: 3px; right: 3px; z-index: 2; color: #7a5e02; filter: drop-shadow(0 0 3px rgba(252, 218, 124, .95)); }
.bc-gleam .bc-art::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, .55) 42%, rgba(161, 178, 254, .3) 50%, rgba(171, 152, 181, .28) 56%, transparent 68%); }

.bc-wheel { gap: 3px; padding: 4px 1px; }
.bc-el-main, .bc-el-it { display: inline-flex; flex-direction: column; align-items: center; line-height: 0; }
.bc-el-main svg, .bc-el-it svg { display: block; flex: none; }
.bc .crest, .bc-legend .crest { filter: none; vertical-align: baseline; }
.bc-el-grp { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.bc-el-pair { display: flex; gap: 1px; }
.bc-el-strong > .bc-i { color: #2e6e05; } .bc-el-weak > .bc-i { color: #8c3441; }
.bc-weapon { font: 800 8.5px/1.1 'Andika', system-ui, sans-serif; text-align: center; overflow-wrap: anywhere; }
.bc-full .bc-wheel { gap: 8px; padding: 8px 5px; align-items: stretch; }
.bc-full .bc-el-main { gap: 3px; }
.bc-full .bc-el-main .bc-w { font: 700 13px/1.1 'Fredoka', 'Andika', sans-serif; }
.bc-full .bc-el-grp { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; border-top: 1px solid rgba(43, 34, 51, .16); padding-top: 6px; }
.bc-full .bc-el-grp > .bc-w { flex: 1 1 0; min-width: 0; font-size: 10px; font-weight: 800; line-height: 1.1; }
.bc-full .bc-el-pair { flex: 1 0 100%; flex-direction: column; align-items: flex-start; gap: 3px; }
.bc-full .bc-el-it { flex-direction: row; gap: 5px; }
.bc-full .bc-el-it .bc-w { font-size: 11px; line-height: 1.1; }
.bc-full .bc-weapon { flex: 1 0 100%; font-size: 12px; text-align: left; }

/* ---------- the strip under the picture: level, Health, Damage, bonus ---------- */
.bc-stats { display: flex; align-items: center; justify-content: space-around; gap: 4px; min-height: 24px; padding: 3px 4px; border-radius: 8px; background: rgba(255, 255, 255, .6); }
.bc-stats:empty { visibility: hidden; }
.bc-stat { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.bc-stat b { font: 700 12px/1 'Fredoka', 'Andika', sans-serif; }
.bc-lv .bc-i { color: #2a56b8; } .bc-hp .bc-i { color: #8c3441; } .bc-at .bc-i { color: #9a4a0a; } .bc-bonus .bc-i { color: #2e6e05; }
.bc-bonus-pair { display: inline-flex; align-items: center; gap: 1px; padding: 1px 3px; border: 1px solid rgba(43, 34, 51, .35); border-radius: 7px; }
.bc-bonus-pair i { font: 800 9px/1 'Andika', system-ui, sans-serif; }
.bc-full .bc-stats { flex-wrap: wrap; gap: 8px 6px; padding: 8px; }
.bc-full .bc-stat { flex: 1 1 28%; flex-wrap: wrap; justify-content: center; gap: 2px 5px; white-space: normal; }
.bc-full .bc-stat b { font-size: 17px; }
.bc-full .bc-stat > .bc-w { flex: 1 0 100%; font-size: 11px; font-weight: 700; text-align: center; color: #5a4e63; }
.bc-full .bc-bonus { flex: 1 1 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 8px; border-top: 1px solid rgba(43, 34, 51, .16); padding-top: 7px; }
.bc-full .bc-bonus > .bc-w { flex: 1 1 auto; text-align: left; font-size: 12px; }
.bc-full .bc-bonus-pair { gap: 3px; padding: 3px 6px; border-radius: 10px; }
.bc-full .bc-bonus-pair i { font-size: 12px; }

/* ---------- the science (full card) ---------- */
.bc-note { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .6); font-size: 12.5px; line-height: 1.35; }
.bc-note .bc-i { margin-top: 1px; color: var(--bc-accent, #3d4a5c); }
.bc-facts { display: grid; gap: 4px; margin: 0; font-size: 13px; line-height: 1.35; }
.bc-facts > div { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 8px; }
.bc-facts dt { color: var(--bc-accent, #3d4a5c); font-weight: 700; }
.bc-facts dd { margin: 0; }
.bc-fact { margin: 0; padding: 8px 10px; border-left: 4px solid var(--bc-accent, #3d4a5c); border-radius: 8px; background: rgba(255, 255, 255, .6); font-size: 13px; line-height: 1.4; }

/* ---------- footer: scientific name, home, card number ---------- */
.bc-foot { display: flex; flex-direction: column; gap: 1px; margin-top: auto; min-width: 0; color: #5a4e63; font-size: 10.5px; }
.bc-sci { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bc-no { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-height: 14px; color: #665b70; }
.bc-count { color: #2b2233; font: 700 13px/1 'Fredoka', 'Andika', sans-serif; }
.bc-full .bc-foot { gap: 2px; font-size: 12px; }
.bc-full .bc-sci { white-space: normal; font-size: 13px; }

/* ---------- the unknown card ---------- */
.bc-unknown .bc-in { filter: grayscale(.65); }
.bc-unknown .bc-art { border-style: dashed; }
.bc-unknown .bc-name { color: #665b70; }
.bc-sil { display: block; }

/* ---------- "How to read a Bio Card" ---------- */
.bc-key summary { cursor: pointer; padding: 4px 0; color: var(--bc-accent, #3d4a5c); font: 700 13px/1.2 'Fredoka', 'Andika', sans-serif; }
.bc-key[open] summary { margin-bottom: 6px; }
.bc-legend { display: grid; gap: 10px; color: #2b2233; font: 400 12px/1.25 'Andika', system-ui, -apple-system, 'Segoe UI', sans-serif; text-align: left; }
.bc-legend h4 { margin: 0 0 4px; font: 700 13px/1.2 'Fredoka', 'Andika', sans-serif; color: #2b2233; }
.bc-legend ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px 10px; margin: 0; padding: 0; list-style: none; }
.bc-legend li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.bc-legend li.bc-wide { grid-column: 1 / -1; }
.bc-legend .bc-el-it { flex: none; }
.bc-swatch { flex: none; width: 36px; height: 24px; border: 2px solid var(--bc-line, #8a7f92); border-radius: 5px; background: var(--bc-pat, none), var(--bc-bg, #fffaf0); background-size: var(--bc-pat-size, auto); }
