/* Monster Evo — "monster workshop meets field notebook" */
/* Night Jungle (v223): the site's look by default; the old cream-paper look is the light theme
   (html[data-theme="light"], the ☀ button in the top bar). */
:root {
  --paper: #0d1719;
  --paper-2: #162a2d;
  --card: #142528;
  --ink: #eef5ea;
  --ink-soft: #bcd0c3;
  --ink-faint: #92ab9f;
  --line: #24403f;
  --line-strong: #376059;
  --moss: #6fbf4a;
  --moss-dark: #a5e06e;
  --leaf: #b6f36b;
  --leaf-soft: #1c3a24;
  --sun: #ffc94d;
  --sun-soft: #3a3016;
  --berry: #ff7f9d;
  --berry-soft: #3d1c29;
  --sky: #74c2ec;
  --sky-soft: #15303f;
  --clay: #f0955f;
  --violet: #b48cff;
  --glow: 182, 243, 107;
  --focus: #ffd46a;
  --shadow: 0 0 0 1px rgba(182, 243, 107, .10), 0 12px 30px rgba(0, 0, 0, .40);
  --radius: 18px;
  --radius-s: 12px;
  --font-display: "Fredoka", ui-rounded, "SF Pro Rounded", "Varela Round", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --paper: #fbf5e8;
  --paper-2: #f3e8d2;
  --card: #fffaf0;
  --ink: #2d2433;
  --ink-soft: #5d5264;
  --ink-faint: #8a7f8f;
  --line: #e4d6ba;
  --line-strong: #cdb993;
  --moss: #4f8a3f;
  --moss-dark: #2f5e27;
  --leaf: #8cc063;
  --leaf-soft: #e3f0cf;
  --sun: #f2c53d;
  --sun-soft: #fdf1c7;
  --berry: #b04766;
  --berry-soft: #f8dde4;
  --sky: #4d9fcf;
  --sky-soft: #dcecf6;
  --clay: #d9774a;
  --focus: #1f6fd1;
  --shadow: 0 2px 0 rgba(45, 36, 51, .08), 0 8px 24px rgba(92, 66, 26, .08);
  --radius: 18px;
  --radius-s: 12px;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --violet: #8a5fc0;
  --glow: 79, 138, 63;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  background-image: radial-gradient(circle at 12% 8%, rgba(242, 197, 61, .10), transparent 40%), radial-gradient(circle at 90% 90%, rgba(79, 138, 63, .08), transparent 45%);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3vw + 1rem, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .8em; }
a { color: var(--moss-dark); text-decoration-thickness: 2px; text-underline-offset: 3px; }
/* (links that are buttons keep their button colours: green text on a green button vanished) */
:root:not([data-theme="light"]) a:where(:not(.btn)) { color: var(--leaf); }
:root[data-theme="dark"] a:where(:not(.btn)) { color: var(--leaf); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: .88em; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; background: url(/favicon.svg) center/contain no-repeat; transition: transform .3s; }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-name b { font-weight: 900; color: var(--moss); display: inline-block; transform: rotate(-5deg) translateY(-1px); transform-origin: 10% 85%; transition: transform .3s; }
/* The O of "Evo" is a one-eyed monster, drawn the size of a lowercase o and sitting on the baseline (logo G, v221). */
.brand-o { width: .98em; height: .94em; margin-left: -.14em; vertical-align: -.08em; }
.brand:has(.brand-o) .brand-mark { display: none; }
@media (max-width: 600px) { .brand:has(.brand-o) .brand-mark { display: block; } }
.brand:hover .brand-name b { transform: rotate(-10deg) scale(1.12) translateY(-1px); } /* (hover: Evo tips further back and grows a little) */
:root:not([data-theme="light"]) .brand-name b { color: var(--leaf); }
:root[data-theme="dark"] .brand-name b { color: var(--leaf); }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.mainnav a {
  padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--ink-soft);
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
}
.mainnav a:hover { background: var(--paper-2); color: var(--ink); }
@media (min-width: 1100px) { .mainnav { display: grid; grid-template-columns: repeat(5, auto); justify-content: start; gap: 2px 2px; } .mainnav a { padding: 7px 10px; text-align: left; white-space: nowrap; } } /* two tidy rows */
.mainnav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.topbar-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; font-size: 1rem;
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn[aria-pressed="true"] { background: var(--paper-2); }
.badge { position: absolute; top: -6px; right: -6px; background: var(--berry); color: #fff; font: 700 11px/1 var(--font-body); padding: 4px 6px; border-radius: 999px; min-width: 20px; }
.acct-link { position: relative; }
.badge.dot { top: -7px; right: -7px; min-width: 18px; padding: 3px 5px; }
@media (max-width: 600px) { .drafts a { width: 68px; font-size: .68rem; } .acct-name { display: none; }   .brand-name { display: none; } .page-head p { font-size: .88rem; margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; } .icon-btn { width: 34px; height: 34px; } }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .topbar-tools { margin-left: auto; }
  .mainnav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .mainnav a { white-space: nowrap; font-size: .9rem; }
  .brand-name { font-size: 1.05rem; }
}

#banner:empty { display: none; }
#banner { padding: 10px 20px; background: var(--sun-soft); border-bottom: 2px solid var(--sun); font-weight: 600; }
#banner.error { background: var(--berry-soft); border-color: var(--berry); }
main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 80px; outline: none; }
main:focus, main:focus-visible { outline: none; }
.grid > *, .world-layout > *, .designer > *, .compare-cols > * { min-width: 0; }
@media (max-width: 600px) { main { padding: 16px 12px 60px; } }

/* ------------------------------------------------------------------ building blocks */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.tight { padding: 12px; }
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
/* My Monsters: small tiles, three to a row on a phone (client/views/dashboard.js) */
.grid.cards.compact { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px 8px; }
/* (The portrait's empty sky is trimmed: the monster stands at the bottom and tall horns may rise into the gap above.) */
.creature-card.tile .portrait { aspect-ratio: 188 / 136; position: relative; }
.creature-card.tile .portrait svg { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; aspect-ratio: 188 / 166; }
.creature-card.tile { gap: 2px; min-width: 0; }
.creature-card.tile .name { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creature-card.tile .small { line-height: 1.25; }
.dash-tabs { margin: 4px 0 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; scroll-margin-top: 110px; }
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs button { flex: none; }
@media (max-width: 560px) {
  /* My Monsters on a phone: a short greeting with the two buttons side by side, and all four tabs in view. */
  [data-route="home"] .page-head { gap: 8px; margin-bottom: 4px; }
  [data-route="home"] .page-head h1 { font-size: 1.45rem; margin: 0; }
  [data-route="home"] .page-head p { display: none; }
  [data-route="home"] .page-head .row { flex-wrap: nowrap; gap: 8px; }
  [data-route="home"] .page-head .btn { padding: 6px 12px; min-height: 38px; font-size: .9rem; }
  .tabs.dash-tabs { gap: 4px; }
  .tabs.dash-tabs button { padding: 6px 10px; font-size: .86rem; min-height: 38px; }
  .dash-tabs .n { display: none; } /* (the counts are in each tab's heading) */
  /* Events as two short lines: what happened, then when (the monster's name is already in the sentence). */
  .event-list li { display: grid; grid-template-columns: 24px 34px minmax(0, 1fr); gap: 0 8px; padding: 6px 8px; }
  .event-list li > .ev-icon { grid-column: 1; grid-row: 1 / span 2; width: auto; }
  .event-list li > .mini { grid-column: 2; grid-row: 1 / span 2; }
  .event-list li > .mini .name { display: none; }
  .event-list li > .mini .portrait { width: 34px; height: 30px; }
  .event-list li > span:not(.ev-icon):not(.ev-time) { grid-column: 3; font-size: .92rem; line-height: 1.3; }
  .event-list li > .ev-time { grid-column: 3; margin-left: 0; font-size: .74rem; }
}
.dash-panel { display: grid; gap: 14px; align-content: start; }
.dash-panel > .section-title:first-child { margin-top: 0; }
.recap .recap-more > summary { cursor: pointer; font-weight: 700; color: var(--moss-dark); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--ink-soft); max-width: 60ch; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 10px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--paper-2); color: var(--ink-soft); border: 1.5px solid var(--line); }
.pill.alive { background: var(--leaf-soft); color: var(--moss-dark); border-color: var(--leaf); }
.chip.on { background: var(--sun-soft); border-color: var(--ink); }
.pill.warn { background: var(--sun-soft); color: var(--ink); border-color: var(--sun, #e0b040); }
.pill.dead { background: var(--paper-2); color: var(--ink-soft); }
.pill.frozen { background: #e6f0fa; color: #2c4a66; border-color: #9fbcd8; }
.frozen-worlds > summary { cursor: pointer; margin: 28px 0 12px; list-style-position: outside; }
.frozen-worlds > summary h2 { font-size: 1.35rem; }
.archive-note { background: #eef4fa; border: 1px solid #c3d6ea; border-radius: 12px; padding: 12px 14px; }
.archive-note summary { cursor: pointer; font-weight: 700; }
:root:not([data-theme="light"]) .pill.frozen { background: #1d2c3b; color: #bcd4ec; border-color: #3d5873; } :root:not([data-theme="light"]) .archive-note { background: #17222e; border-color: #2e4459; }
:root[data-theme="dark"] .pill.frozen { background: #1d2c3b; color: #bcd4ec; border-color: #3d5873; }
:root[data-theme="dark"] .archive-note { background: #17222e; border-color: #2e4459; }
.pill.warn { background: var(--sun-soft); border-color: var(--sun); color: #6b5100; }
.pill.bad { background: var(--berry-soft); border-color: var(--berry); color: var(--berry); }
.pill.good { background: var(--leaf-soft); border-color: var(--leaf); color: var(--moss-dark); }
.pill.info { background: var(--sky-soft); border-color: var(--sky); color: #1f5f86; }
:root:not([data-theme="light"]) .pill.warn { color: var(--sun); } :root:not([data-theme="light"]) .pill.info { color: var(--sky); }

.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 14px; border: 2.5px solid var(--b); background: var(--card); color: var(--ink);
  font: 800 .98rem/1.1 var(--font-display); cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 0 var(--b); transition: transform .08s, box-shadow .08s; min-height: 44px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--b); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--b); }
.btn.primary { background: var(--sun); color: #2d2433; }
.btn.go { background: var(--leaf); color: #1d2a16; }
.btn.danger { background: var(--berry-soft); --b: var(--berry); color: var(--berry); }
.btn.ghost { box-shadow: none; border-color: var(--line-strong); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .88rem; border-radius: 11px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.linkish { background: none; border: none; color: var(--moss-dark); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: var(--card); border: 2px solid var(--line-strong); border-radius: 12px; padding: 9px 12px; min-height: 44px; width: 100%;
}
label { font-weight: 700; font-size: .92rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.seg { display: inline-flex; border: 2px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: var(--card); flex-wrap: wrap; }
.seg button { border: none; background: none; padding: 8px 14px; font: 700 .92rem var(--font-display); color: var(--ink-soft); cursor: pointer; min-height: 40px; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font: 700 .92rem var(--font-display); cursor: pointer; color: var(--ink-soft); min-height: 40px; }
.tabs button[aria-selected="true"] { background: var(--moss); border-color: var(--moss-dark); color: #fff; }

.meter { height: 12px; background: var(--paper-2); border-radius: 999px; overflow: hidden; border: 1.5px solid var(--line); }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--leaf); transition: width .25s; }
.meter.energy > span { background: var(--sun); }
.meter.stamina > span { background: var(--sky); }
.meter.health > span { background: var(--berry); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--paper-2); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font: 800 1.35rem/1.1 var(--font-display); }
.stat span { font-size: .8rem; color: var(--ink-soft); }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 10px; border-bottom: 1.5px solid var(--line); vertical-align: middle; }
table.tbl th { font: 800 .8rem var(--font-display); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.empty { text-align: center; padding: 34px 16px; color: var(--ink-soft); border: 2.5px dashed var(--line-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--card) 60%, transparent); }
.empty .big { font-size: 2.2rem; display: block; margin-bottom: 4px; }
.notice { padding: 10px 14px; border-radius: 12px; background: var(--sky-soft); border: 2px solid var(--sky); }
.notice.warn { background: var(--sun-soft); border-color: var(--sun); }
.notice.bad { background: var(--berry-soft); border-color: var(--berry); }
.notice.good { background: var(--leaf-soft); border-color: var(--leaf); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); padding: 30px; justify-content: center; }
.loading::before { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--moss); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 50; max-width: min(380px, calc(100vw - 32px)); }
.toast { position: relative; padding-right: 36px !important; }
.toast .x { position: absolute; top: 6px; right: 8px; border: none; background: none; font-size: 1.1rem; cursor: pointer; color: var(--ink-soft); }
.toast ul { margin: 4px 0 0; padding-left: 18px; font-size: .9rem; }
@media (max-width: 600px) { .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; } .toast { padding: 8px 12px; font-size: .9rem; } }
.toast { background: var(--card); border: 2.5px solid var(--ink); border-radius: 16px; padding: 12px 14px; box-shadow: 0 4px 0 var(--ink); animation: toast-in .25s ease-out; }
.toast b { display: block; font-family: var(--font-display); }
.toast a { font-weight: 700; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ------------------------------------------------------------------ creature portraits */
.portrait { display: block; width: 100%; aspect-ratio: 188 / 166; }
.portrait svg { width: 100%; height: 100%; display: block; overflow: visible; }
.creature-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; position: relative; transition: transform .15s; }
.creature-card:hover { transform: translateY(-3px); }
.creature-card .portrait { background: radial-gradient(ellipse at 50% 85%, var(--leaf-soft), transparent 70%); border-radius: 14px; }
.creature-card .name { font: 800 1.05rem var(--font-display); }
.creature-card.dead .portrait { background: radial-gradient(ellipse at 50% 85%, var(--paper-2), transparent 70%); }
.mini { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.mini .portrait { width: 44px; height: 39px; flex: none; }
.mini .name { font-weight: 700; }

/* Idle life: breathing and blinking. Everything is disabled under reduced motion. */
.cw-anim .cw-body { transform-box: fill-box; transform-origin: 50% 100%; animation: cw-breathe 3.2s ease-in-out infinite; }
.cw-anim .cw-lid { transform-box: fill-box; transform-origin: 50% 0; animation: cw-blink 5.5s infinite; }
.cw-anim .cw-lid.cw-lid-droop { animation: none; }
.cw-anim .cw-tail { transform-box: fill-box; transform-origin: 100% 100%; animation: cw-wag 2.6s ease-in-out infinite; }
.cw-anim .cw-ears { transform-box: fill-box; transform-origin: 50% 100%; animation: cw-ear 4s ease-in-out infinite; }
.cw-anim .cw-act-walk .cw-leg-l { transform-box: fill-box; transform-origin: 50% 0; animation: cw-step .5s ease-in-out infinite alternate; }
.cw-anim .cw-act-walk .cw-leg-r { transform-box: fill-box; transform-origin: 50% 0; animation: cw-step .5s ease-in-out infinite alternate-reverse; }
.cw-anim .cw-act-walk { animation: cw-hop .5s ease-in-out infinite alternate; }
.cw-anim .cw-act-eat .cw-mouth { transform-box: fill-box; transform-origin: 50% 0; animation: cw-munch .35s ease-in-out infinite alternate; }
.cw-anim .cw-pouch-call { transform-box: fill-box; transform-origin: 50% 30%; animation: cw-pouch .5s ease-in-out infinite alternate; }
.cw-anim .cw-rings path { animation: cw-ring 1s ease-out infinite; }
.cw-anim .cw-rings path:nth-child(2) { animation-delay: .15s; }
.cw-anim .cw-rings path:nth-child(3) { animation-delay: .3s; }
.cw-anim .cw-zzz { animation: cw-float 2.2s ease-in-out infinite; }
.cw-anim .cw-act-attack { animation: cw-lunge .45s ease-in-out infinite alternate; }
.cw-anim .cw-sweat { animation: cw-float 1.2s ease-in-out infinite; }
.cw-is-dead .cw-creature { filter: grayscale(.55) opacity(.85); }
.cw-anim.cw-is-dead .cw-halo { animation: cw-float 3s ease-in-out infinite; }
@keyframes cw-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, .975); } }
/* A chief's family flag flutters a little (portraits only: map pictures are still). */
.cw-anim .cw-flag-cloth { transform-box: fill-box; transform-origin: 100% 50%; animation: cw-flutter 2.6s ease-in-out infinite; }
@keyframes cw-flutter { 0%, 100% { transform: skewY(0deg) scaleX(1); } 50% { transform: skewY(-3deg) scaleX(.96); } }
@media (prefers-reduced-motion: reduce) { .cw-anim .cw-flag-cloth { animation: none; } }
@keyframes cw-blink { 0%, 92%, 100% { transform: scaleY(0); } 95% { transform: scaleY(1); } }
@keyframes cw-wag { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes cw-ear { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(2deg); } }
@keyframes cw-step { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
@keyframes cw-hop { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes cw-munch { from { transform: scaleY(1); } to { transform: scaleY(.7); } }
@keyframes cw-pouch { from { transform: scale(1); } to { transform: scale(1.35); } }
@keyframes cw-ring { from { opacity: 0; } 30% { opacity: 1; } to { opacity: 0; } }
@keyframes cw-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes cw-lunge { from { transform: translateX(0); } to { transform: translateX(5px); } }
.cw-react { animation: cw-react .42s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes cw-react { 0% { transform: scale(1); } 40% { transform: scale(1.08, .92); } 100% { transform: scale(1); } }

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------------ welcome / dashboard */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; margin: 10px 0 30px; }
.hero h1 { font-size: clamp(2rem, 4vw + 1rem, 3.4rem); }
.hero .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 46ch; }
.parade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; align-items: end; }
.parade .portrait:nth-child(2) { transform: scale(1.15) translateY(-10px); }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }
.loop-steps { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font: 800 .95rem var(--font-display); color: var(--ink-soft); margin: 12px 0; }
.loop-steps span { background: var(--card); border: 2px solid var(--line); padding: 4px 12px; border-radius: 999px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--paper-2); }
.checklist li.done { background: var(--leaf-soft); }
.checklist .tick { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--line-strong); display: grid; place-items: center; font-size: .8rem; flex: none; background: var(--card); }
.checklist li.done .tick { background: var(--moss); border-color: var(--moss-dark); color: #fff; }
.recap { border: 2.5px solid var(--ink); background: linear-gradient(135deg, var(--sun-soft), var(--card) 60%); }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.event-list li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--paper-2); }
.event-list li > span:not(.ev-icon):not(.ev-time) { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.event-list .ev-icon { font-size: 1.2rem; width: 28px; text-align: center; flex: none; }
.event-list .ev-time { margin-left: auto; font-size: .8rem; color: var(--ink-faint); white-space: nowrap; }

/* ------------------------------------------------------------------ designer */
.designer { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(340px, 1.05fr); gap: 20px; align-items: start; }
.stage-col { position: sticky; top: 76px; }
.stage {
  position: relative; border-radius: 26px; border: 2.5px solid var(--ink); overflow: hidden;
  background: radial-gradient(ellipse at 50% 92%, rgba(79,138,63,.35), transparent 55%), repeating-linear-gradient(0deg, transparent 0 23px, rgba(45,36,51,.05) 23px 24px), repeating-linear-gradient(90deg, transparent 0 23px, rgba(45,36,51,.05) 23px 24px), linear-gradient(#fff8e6, #f6e7c4);
  box-shadow: 0 5px 0 var(--ink);
}
:root:not([data-theme="light"]) .stage { background: radial-gradient(ellipse at 50% 92%, rgba(140,192,99,.25), transparent 55%), repeating-linear-gradient(0deg, transparent 0 23px, rgba(255,255,255,.04) 23px 24px), repeating-linear-gradient(90deg, transparent 0 23px, rgba(255,255,255,.04) 23px 24px), linear-gradient(#2e2a36, #24212b); }
.stage .portrait { max-height: 46vh; margin: 0 auto; padding: 10px 6% 0; }
.stage-label { position: absolute; left: 12px; top: 10px; font: 800 .8rem var(--font-display); background: var(--card); border: 2px solid var(--ink); padding: 2px 10px; border-radius: 999px; }
.stage-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 10px; border-top: 2px dashed rgba(45,36,51,.2); }
.stage-note { font-size: .8rem; text-align: center; color: var(--ink-soft); padding: 0 12px 10px; min-height: 1.4em; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.compare figure { margin: 0; text-align: center; font: 700 .8rem var(--font-display); color: var(--ink-soft); }
.points { display: flex; align-items: center; gap: 12px; }
.points .big { font: 900 2.2rem/1 var(--font-display); min-width: 3ch; }
.points .meter { flex: 1; height: 16px; }
.points.over .big { color: var(--berry); }
.points-pill { position: fixed; right: 16px; z-index: 25; padding: 6px 14px; border-radius: 999px; background: var(--card); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font: 700 .95rem var(--font-display); color: var(--ink); }
.points-pill b { font-size: 1.15rem; }
.points-pill.over { border-color: var(--berry); box-shadow: 0 3px 0 var(--berry); }
.points-pill.over b { color: var(--berry); }
.points-pill[hidden] { display: none; }
.attr { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1.5px dashed var(--line); }
.attr .ico { font-size: 1.35rem; grid-row: span 2; text-align: center; }
.attr .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.attr .top b { font-family: var(--font-display); }
.attr .val { font: 800 .95rem var(--font-display); color: var(--moss-dark); white-space: nowrap; }
.attr .cost { font-size: .78rem; color: var(--ink-faint); white-space: nowrap; }
.attr .detail { grid-column: 2 / 4; font-size: .82rem; color: var(--ink-soft); }
.attr .limit { grid-column: 2 / 4; font-size: .82rem; color: var(--berry); font-weight: 700; }
.pips { display: flex; gap: 3px; }
.pips i { width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--line-strong); background: var(--card); }
.pips i.on { background: var(--moss); border-color: var(--moss-dark); }
input[type="range"] { width: 100%; accent-color: var(--moss); height: 28px; cursor: pointer; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--card); outline: 2px solid var(--line-strong); cursor: pointer; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); }
.archetype { font: 700 1rem var(--font-display); background: var(--sun-soft); border: 2px solid var(--sun); padding: 8px 12px; border-radius: 12px; }
.caps-table { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.caps-table dt { font-weight: 800; font-family: var(--font-display); }
.caps-table dd { margin: 0; color: var(--ink-soft); }
.drafts { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.drafts a { flex: none; width: 110px; text-align: center; text-decoration: none; color: inherit; font: 700 .8rem var(--font-display); border-radius: 12px; padding: 4px; border: 2px solid transparent; }
.drafts a[aria-current="true"] { border-color: var(--ink); background: var(--card); }
.drafts a .line-badge { display: block; font: 700 .68rem var(--font-body, system-ui); margin-top: 1px; }
.drafts a .line-badge.alive { color: var(--moss-dark, #3f7a2e); }
.drafts a .line-badge.gone { color: var(--ink-soft, #7a6f80); }
.drafts a.extinct .portrait { filter: grayscale(1); opacity: .55; }
:root:not([data-theme="light"]) .drafts a .line-badge.alive { color: var(--leaf); }
:root[data-theme="dark"] .drafts a .line-badge.alive { color: var(--leaf); }
@media (max-width: 860px) {
  .designer { grid-template-columns: minmax(0, 1fr); }
  .stage-wrap, .stage-col > * { min-width: 0; }
  /* One column: the preview column dissolves so only the compact stage is pinned while the
     sliders scroll beneath it; the summary card and notes scroll with the page. */
  .stage-col { display: contents; }
  .stage-wrap { position: sticky; top: 104px; z-index: 5; }
  .stage .portrait { max-height: 17vh; padding-top: 4px; }
  .stage-tools { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 6px 8px; gap: 6px; scrollbar-width: thin; }
  .stage-tools .btn { padding: 4px 10px; min-height: 34px; font-size: .8rem; flex: none; }
  .stage-note:empty { display: none; }
}
@media (max-width: 860px) and (max-height: 620px) {
  .stage-wrap { position: static; } /* short screens (phones sideways): nothing pinned at all */
}

/* ------------------------------------------------------------------ world */
.world-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
@media (max-width: 980px) { .world-layout { grid-template-columns: 1fr; } }
.world-canvas-wrap { position: relative; border-radius: 16px; overflow: hidden; border: 1.5px solid var(--line-strong); box-shadow: 0 1px 2px rgba(30, 25, 20, .08), 0 8px 22px rgba(30, 25, 20, .10); background: #bfe3a0; touch-action: none; }
/* A soft vignette and top light over the map: drawn by the browser over the canvas, so it costs the map nothing per frame. */
.world-canvas-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: radial-gradient(ellipse 90% 85% at 50% 45%, transparent 70%, rgba(25, 30, 15, .12) 100%); }
.world-canvas-wrap canvas { display: block; width: 100%; height: min(70vh, 640px); cursor: grab; }
.world-canvas-wrap canvas:active { cursor: grabbing; }
.world-canvas-wrap canvas[hidden] { display: none; }
.world-canvas-wrap canvas.monster-view { cursor: grab; touch-action: none; background: #cfe3ee; }
.world-hud { position: absolute; z-index: 2; left: 10px; top: 10px; right: 10px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.world-hud > * { pointer-events: auto; }
.hud-chip { background: color-mix(in srgb, var(--card) 92%, transparent); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font: 800 .8rem var(--font-display); }
.world-controls { position: absolute; z-index: 2; right: 10px; bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.world-controls .icon-btn { border-color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .8rem; color: var(--ink-soft); margin-top: 8px; }
.map-key { margin-top: 8px; }
.map-key > summary { cursor: pointer; font-weight: 700; font-size: .9rem; padding: 4px 2px; list-style-position: inside; }
.map-key > summary:focus-visible { outline: 2px solid var(--sky, #3f7fae); outline-offset: 2px; border-radius: 6px; }
.map-key[open] > summary { margin-bottom: 2px; }
.chart-shade { fill: var(--sun); }
.legend i.shade-key { background: var(--sun); opacity: .55; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; border: 1.5px solid rgba(0,0,0,.25); }
.legend .legend-swatch { width: 22px; height: 22px; border-radius: 6px; vertical-align: -6px; margin-right: 5px; border: 1.5px solid rgba(0,0,0,.25); object-fit: cover; }
.side-panel { display: flex; flex-direction: column; gap: 12px; }
.status-bars { display: grid; grid-template-columns: 78px 1fr 58px; gap: 6px 8px; align-items: center; font-size: .85rem; }
.status-bars .num { text-align: right; font-family: var(--font-mono); font-size: .8rem; }
.feed { max-height: 320px; overflow-y: auto; }

/* ------------------------------------------------------------------ training */
.scenario-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.scenario { text-align: left; border: 2.5px solid var(--line); background: var(--card); border-radius: 16px; padding: 12px; cursor: pointer; font: inherit; color: inherit; }
.scenario[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); background: var(--sun-soft); }
.scenario[disabled] { opacity: .5; cursor: not-allowed; }
.scenario .t { font: 800 1rem var(--font-display); display: block; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-strong); }
.chart text { fill: var(--ink-soft); font: 11px var(--font-body); }
.compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .compare-cols { grid-template-columns: 1fr; } }
.replay canvas { width: 100%; height: auto; aspect-ratio: 1; display: block; border-radius: 14px; border: 2px solid var(--ink); background: #bfe3a0; }
.replay canvas[hidden] { display: none; }
.replay canvas.monster-view { aspect-ratio: 16 / 10 !important; background: #cfe3ee; cursor: grab; touch-action: none; }
.replay .controls [aria-pressed=true] { background: var(--ink); color: var(--paper, #fff); }
.replay .controls { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.replay input[type="range"] { flex: 1; }
.tips { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tips li { padding: 10px 12px; border-radius: 12px; background: var(--paper-2); border-left: 5px solid var(--sky); }
.tips li.result { border-left-color: var(--moss); font-weight: 600; }
.activation { display: grid; grid-template-columns: 1fr; gap: 2px; font-size: .72rem; font-family: var(--font-mono); max-height: 380px; overflow-y: auto; }
.activation .bar { display: grid; grid-template-columns: 110px 1fr 44px; gap: 6px; align-items: center; }
.activation .track { height: 8px; background: var(--paper-2); border-radius: 4px; position: relative; overflow: hidden; }
.activation .fill { position: absolute; top: 0; bottom: 0; background: var(--moss); }
.activation .fill.neg { background: var(--berry); }

/* ------------------------------------------------------------------ graveyard */
.graves { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.grave { text-decoration: none; color: inherit; text-align: center; position: relative; padding: 14px 12px 12px; border-radius: 90px 90px 16px 16px; border: 2.5px solid var(--line-strong); background: linear-gradient(var(--card), var(--paper-2)); box-shadow: 0 4px 0 var(--line-strong); transition: transform .15s; }
.grave:hover { transform: translateY(-3px); }
.grave .portrait { max-width: 120px; margin: 0 auto; }
.grave .name { font: 800 1.05rem var(--font-display); display: block; }
.grave .epitaph { font-size: .82rem; color: var(--ink-soft); font-style: italic; }
.grave .flower { position: absolute; bottom: -8px; right: 14px; font-size: 1.3rem; }

/* ------------------------------------------------------------------ profile */
.profile-head { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 24px; align-items: center; }
@media (max-width: 760px) { .profile-head { grid-template-columns: 1fr; } }
.profile-portrait { border-radius: 26px; border: 2.5px solid var(--ink); background: radial-gradient(ellipse at 50% 90%, var(--leaf-soft), var(--card) 70%); box-shadow: 0 5px 0 var(--ink); padding: 8px; }
.memorial .profile-portrait { background: radial-gradient(ellipse at 50% 90%, var(--paper-2), var(--card) 70%); }
.memorial-banner { background: linear-gradient(90deg, var(--paper-2), var(--card)); border: 2px solid var(--line-strong); border-radius: 16px; padding: 14px 16px; font-family: var(--font-display); }
.lifebar { position: relative; height: 14px; background: var(--paper-2); border-radius: 999px; border: 1.5px solid var(--line); }
.lifebar span { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, var(--leaf), var(--sun)); border-radius: 999px; }
.lifebar .mark { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--ink-soft); border-radius: 2px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line-strong); margin-left: 10px; }
.timeline li { position: relative; padding: 4px 0 12px 20px; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: 9px; width: 15px; height: 15px; border-radius: 50%; background: var(--card); border: 3px solid var(--moss); }
.timeline li.died::before { border-color: var(--ink-soft); background: var(--paper-2); }
.timeline li.kill::before { border-color: var(--berry); }
.timeline li.child::before, .timeline li.born::before { border-color: var(--sun); }
.timeline .when { font-size: .78rem; color: var(--ink-faint); display: block; }
.ribbon { display: inline-flex; gap: 6px; align-items: center; background: var(--sun-soft); border: 2px solid var(--sun); border-radius: 10px; padding: 4px 10px; font: 700 .85rem var(--font-display); }

/* ------------------------------------------------------------------ leaderboards */
.board { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.board td, .board th { padding: 8px 10px; text-align: left; }
.board tbody tr { background: var(--card); box-shadow: var(--shadow); cursor: pointer; }
.board tbody tr:hover { background: var(--sun-soft); }
.board tbody td:first-child { border-radius: 14px 0 0 14px; }
.board tbody td:last-child { border-radius: 0 14px 14px 0; }
.board .rank { font: 900 1.5rem var(--font-display); width: 56px; text-align: center; }
.board .rank.r1 { color: #b8860b; } .board .rank.r2 { color: #7d8a96; } .board .rank.r3 { color: #a0612d; }
.board .score { font: 800 1.1rem var(--font-display); white-space: nowrap; }
.board tr.mine { outline: 3px solid var(--moss); }
.board .who a { font: 800 1.05rem var(--font-display); text-decoration: none; color: inherit; }
@media (max-width: 640px) { .board .hide-sm { display: none; } }

/* ------------------------------------------------------------------ vault */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 16px; padding: 22px 18px 10px; border-radius: 22px; background: linear-gradient(180deg, #5c3d26 0 8px, #7a5436 8px 14px, transparent 14px), linear-gradient(#3b2a33, #2b2029); position: relative; }
.shelf::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: #7a5436; border-radius: 0 0 22px 22px; }
.jar { border: none; background: none; cursor: pointer; padding: 0; color: #f7efe3; font: inherit; text-align: center; position: relative; }
.jar svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.jar .label { font: 800 .82rem var(--font-display); display: block; margin-top: 4px; }
.jar .sub { font-size: .72rem; opacity: .8; display: block; }
.jar .fav { position: absolute; top: 2px; right: 8px; font-size: 1.1rem; }
.jar .sub.expiring { color: #ffcf7a; opacity: 1; } /* (amber that reads on the dark shelf) */
.jar:hover svg, .jar:focus-visible svg { transform: translateY(-4px); transition: transform .2s; }
.jar .bubble { animation: bubble 3.6s linear infinite; }
.jar .brainbob { animation: bob 5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 50%; }
.jar.offscreen .bubble, .jar.offscreen .brainbob { animation-play-state: paused; }
@keyframes bubble { from { transform: translateY(0); opacity: 0; } 15% { opacity: .8; } to { transform: translateY(-70px); opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--card); border-left: 3px solid var(--ink); z-index: 60; overflow-y: auto; padding: 20px; box-shadow: -10px 0 40px rgba(0,0,0,.2); animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.scrim { position: fixed; inset: 0; background: rgba(29, 22, 33, .35); z-index: 55; }
.brain-graph svg { width: 100%; height: auto; background: var(--paper-2); border-radius: 12px; }

/* ------------------------------------------------------------------ lineage tree */
.tree-scroll { overflow: auto; border: 2px solid var(--line); border-radius: 18px; background: var(--card); padding: 14px; position: relative; }
.tree-gen { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 30px; position: relative; z-index: 1; min-width: max-content; }
.tree-gen .gen-label { flex: none; width: 72px; margin-left: -14px; padding-left: 14px; font: 800 .8rem var(--font-display); color: var(--ink-soft); padding-top: 18px; position: sticky; left: -14px; z-index: 2; background: var(--card); align-self: stretch; } /* stays in view when a wide generation is scrolled sideways */
.tree-node { flex: none; width: 92px; text-align: center; text-decoration: none; color: inherit; font: 700 .75rem var(--font-display); border-radius: 12px; padding: 4px; background: var(--card); border: 2px solid transparent; }
.tree-node.dead { opacity: .7; }
.tree-node.focus { border-color: var(--ink); background: var(--sun-soft); }
.tree-links { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; }
.tree-more { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ auth */
.auth-card { max-width: 440px; margin: 30px auto; }
form.stack .btn { align-self: flex-start; }
.error-text { color: var(--berry); font-weight: 700; }

/* Selected monster: senses and fights */
.senses, .fight-log { margin-top: 8px; font-size: .9rem; }
.senses .faint { font-size: .78rem; margin-top: 2px; }
.fight-log ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: .85rem; }
.icon-btn[data-mode="all"] { background: var(--sun); }
.points-line { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }

/* Training: pick a starting brain from the Brain Vault */
.vault-picker { display: grid; gap: 8px; margin-top: 10px; }
.vault-picker input[type="search"] { flex: 1 1 200px; min-width: 0; }
.vault-pick-list { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; padding: 2px; }
.vault-pick { display: grid; gap: 2px; text-align: left; padding: 8px 12px; border: 2px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; font: inherit; }
.vault-pick .vp-name { font-weight: 800; }
.vault-pick[aria-selected="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--sun); }
.vault-pick:disabled { opacity: .55; cursor: not-allowed; }
.notice:empty { display: none; }
.scenario[aria-disabled="true"] { opacity: .75; cursor: help; border-style: dashed; }
.scenario .lock-note { display: block; font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin-top: 4px; }

/* Families down to their last monster */
.last-of-line { border-color: var(--danger, #b04766); }
.lol-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px dashed var(--line-strong); }
.lifebar .mark.frail { background: #b04766; }
.meter.life > span { background: #9b7fd1; }
.like-box { font-size: .9rem; padding: 8px 10px; border-radius: 10px; background: var(--sun-soft); }

.call-voices { margin: 6px 0 4px; display: grid; gap: 4px; }
.voice-line { display: flex; gap: 8px; align-items: baseline; }
.mini-table { border-collapse: collapse; font-size: .9rem; min-width: 100%; }
.mini-table th, .mini-table td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); white-space: nowrap; }
.mini-table thead th { font-weight: 600; color: var(--ink-soft); font-size: .8rem; }

/* How to play */
.howto-compact { margin: 16px 0; }
.howto-compact > summary { cursor: pointer; }
.howto-mini { list-style: none; counter-reset: step; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.howto-mini li { counter-increment: step; display: flex; gap: 8px; align-items: baseline; }
.howto-mini li::before { content: counter(step); font: 800 .8rem var(--font-display); color: var(--ink-soft); min-width: 1ch; }
.howto-mini .ic { font-size: 1.1rem; }
.howto-steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; }
.howto-steps li { display: flex; gap: 16px; align-items: flex-start; }
.howto-steps h2 { margin: 0; font-size: 1.2rem; }
.howto-num { font-size: 2rem; line-height: 1; flex: 0 0 auto; width: 48px; height: 48px; display: grid; place-items: center; background: var(--paper-2); border-radius: 14px; }
.howto-tips { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.howto-tips li { display: flex; gap: 10px; }
.howto-goal { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft, rgba(90,160,110,.12)); font-weight: 600; }
.howto-goal-card { margin-bottom: 16px; border-left: 4px solid var(--accent, #4a9a64); display: grid; gap: 8px; }
.howto-goal-card h2 { margin: 0; }
.howto-mini .faint { display: block; }

.founder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.founder-grid figure { text-align: center; }
.founder-grid .portrait, .founder-grid svg { max-width: 140px; margin: 0 auto; }

/* World map: find monsters by diet */
.diet-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 4px; }
.diet-bar-label { font: 800 .85rem var(--font-display); color: var(--ink-soft); margin-right: 2px; }
.diet-pair { display: inline-flex; align-items: stretch; }
.diet-chip { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 5px 12px; font: 700 .9rem var(--font-display); cursor: pointer; }
.diet-pair .diet-chip { border-radius: 999px 0 0 999px; border-right-width: 1px; }
.diet-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 2px var(--diet, var(--ink)); }
.diet-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--diet); display: inline-block; }
.diet-next { border: 2px solid var(--line); border-left-width: 1px; background: var(--card); color: var(--ink); border-radius: 0 999px 999px 0; padding: 0 12px; font: 800 1.1rem var(--font-display); cursor: pointer; }
.diet-next:disabled { opacity: .4; cursor: default; }
.diet-chip:focus-visible, .diet-next:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
/* Final tests after training: checklist and live real-world results */
.final-tests { display: grid; gap: 10px; }
.ft-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ft-steps li { display: flex; gap: 8px; align-items: baseline; }
.ft-ic { width: 1.4em; text-align: center; font-weight: 700; }
.ft-done .ft-ic { color: var(--leaf, #4a9a64); }
.ft-now { font-weight: 700; }
.ft-todo { color: var(--muted, #7a7066); }
.ft-worlds td:first-child { white-space: nowrap; }
.hud-filter { pointer-events: auto; cursor: pointer; background: var(--sun, #f2c53d); color: var(--ink, #2d2433); }

/* Two worlds: the starter world and the Wildlands (graduates) */
.world-tabs { display: flex; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.world-tab { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: inherit; text-decoration: none; min-width: 0; flex: 1 1 220px; }
.world-tab .faint { font-size: 0.82rem; }
.world-tab[aria-current="page"] { border-color: var(--sun); background: var(--sun-soft); }
.notice.grad { background: var(--sun-soft); border-color: var(--line-strong); }
.pill.grad { background: var(--sun-soft); color: var(--ink); border-color: var(--sun); }
.world-group { margin: 14px 0 6px; }
.world-group h3 { margin: 0; }
@media (max-width: 600px) {
  .world-tabs { flex-wrap: nowrap; gap: 6px; }
  .world-tab { flex: 1 1 0; padding: 6px 10px; }
  .world-tab .faint { display: none; }
}

/* Wildlands dangers */
.hud-chip.hud-night { background: #1b2140; color: #e8ecff; border-color: #3b4370; }
.hud-chip.hud-fire { background: #ffd9b0; color: #6b2400; border-color: #e8481a; }
.hud-chip.hud-gas { background: #eef0b8; color: #4a4a10; border-color: #b8b030; }
.hud-chip.hud-apex { background: #3a0c0c; color: #ffd6d0; border-color: #c81e1e; }
.notice.apex-note { background: #fbe3e0; border-color: #c81e1e; color: #3a0c0c; font-size: 0.92rem; }
:root:not([data-theme="light"]) .notice.apex-note { background: #3a1414; color: #ffd6d0; }

/* Trophies */
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rare-alive { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.rare-chip { padding: 6px 10px; border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 12px; background: var(--card, transparent); min-width: 0; }
.rare-chip:hover { border-color: currentColor; }
.rare-chip .name { overflow-wrap: anywhere; }
.trophy { --tier: var(--line-strong); display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; }
.trophy.tier-bronze { --tier: #c27a3e; } .trophy.tier-silver { --tier: #9aa5b1; } .trophy.tier-gold { --tier: #e2a915; } .trophy.tier-platinum { --tier: #5fc4dc; }
.trophy.won { border-color: var(--tier); box-shadow: var(--shadow); }
.trophy:not(.won) .trophy-badge { filter: grayscale(1); opacity: .45; }
.trophy-badge { position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem;
  background: radial-gradient(circle at 35% 30%, #fff8, transparent 60%), var(--tier); border: 3px solid color-mix(in srgb, var(--tier) 70%, #000); }
.trophy.tier-platinum.won .trophy-badge { animation: trophy-shine 3s ease-in-out infinite; }
@keyframes trophy-shine { 50% { box-shadow: 0 0 14px 2px var(--tier); } }
@media (prefers-reduced-motion: reduce) { .trophy.tier-platinum.won .trophy-badge { animation: none; } }
.trophy-medal { position: absolute; right: -6px; bottom: -6px; font-size: 1.05rem; }
.trophy-text { min-width: 0; }
.trophy-text b { font-family: var(--font-display); }
.trophy-tier { margin-left: 8px; font: 800 .7rem var(--font-display); text-transform: uppercase; letter-spacing: .04em; color: color-mix(in srgb, var(--tier) 75%, var(--ink)); }
.trophy-text p { margin: 4px 0 0; }
.trophy-text .small { font-size: .8rem; }
.trophy-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; text-decoration: none; color: inherit; margin: 10px 0; }
.trophy-mini-row { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.trophy-mini { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1rem; border: 2px solid var(--tier); background: color-mix(in srgb, var(--tier) 22%, var(--card)); }
.trophy-mini.tier-bronze { --tier: #c27a3e; } .trophy-mini.tier-silver { --tier: #9aa5b1; } .trophy-mini.tier-gold { --tier: #e2a915; } .trophy-mini.tier-platinum { --tier: #5fc4dc; }
.return-ticket { border-color: var(--sun); background: linear-gradient(135deg, var(--sun-soft), var(--card) 60%); margin: 10px 0; }
/* Bones, market, Wildlands traits */
.bones-badge { font-variant-numeric: tabular-nums; }
.bones-table { width: 100%; border-collapse: collapse; }
.bones-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.bones-table td.num { text-align: right; white-space: nowrap; font-weight: 700; }
.ledger { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.ledger .plus { color: var(--moss-dark); font-weight: 700; } .ledger .minus { color: var(--berry); font-weight: 700; }
.shop-item.owned { border-color: var(--leaf); }
.swatch-mini { display: inline-block; width: 44px; height: 18px; border-radius: 6px; margin-top: 6px; border: 2px solid var(--line); }
.market-card .portrait { max-width: 150px; margin: 0 auto; }
.small { font-size: .85rem; }
.wild-panel { margin: 10px 0; }
.trait-opts { display: grid; gap: 6px; }
.trait-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: baseline; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 10px; }
.trait-opt .faint { grid-column: 2; }
.trait-opt.locked { opacity: .75; }
.swatch.locked { position: relative; opacity: .55; }
.swatch.locked::after { content: '🔒'; position: absolute; right: -4px; bottom: -6px; font-size: .75rem; }
.market-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
/* Trophy-group rewards (trophy cabinet) */
.reward-card { border-style: dashed; background: var(--card); }
.reward-card.earned { border-style: solid; border-color: var(--sun); background: linear-gradient(135deg, var(--sun-soft), var(--card) 60%); }
.reward-card select { max-width: 100%; }

/* Hall of Fame */
.hall-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.hall-tab { padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line, #d9cfb8); background: var(--card, #fffaf0); text-decoration: none; color: inherit; font-weight: 600; }
.hall-tab[aria-current="page"] { background: #2d2433; color: #fff; border-color: #2d2433; }
.hall-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .hall-layout { grid-template-columns: 1fr; } }
.hall-kill { border-left: 6px solid #b0342a; }
.hall-kill.hall-rimewyrm { border-left-color: #3a9fd6; }
.hall-kill.hall-gravemaw { border-left-color: #ff7a1a; background: linear-gradient(90deg, rgba(255,122,26,.08), transparent 40%), var(--card, #fffaf0); }
.hall-kill-head { display: flex; gap: 14px; align-items: center; }
.hall-apex .portrait { width: 96px; height: 85px; }
.hall-apex-icon { font-size: 48px; }
.hall-helpers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 8px 0; }
.hall-helper { display: inline-flex; align-items: center; }
.hall-replay:not(:empty) { margin-top: 10px; }
.hall-board { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
/* The killer's portrait sits in the sentence: keep it text-sized so the line does not break around it. */
.hall-kill .mini .portrait { width: 30px; height: 27px; }
.hall-kill .mini { gap: 4px; vertical-align: middle; }
@media (max-width: 520px) {
  .hall-kill-head { align-items: flex-start; }
  .hall-apex .portrait { width: 64px; height: 57px; }
  .hall-apex-icon { font-size: 36px; }
  .hall-kill h3 { font-size: 1.05rem; }
}

/* Brain type (classic or modular) */
.brain-kind { margin: 8px 0; }
.seg { display: inline-flex; border: 2px solid var(--ink, #2d2433); border-radius: 999px; overflow: hidden; }
.seg-btn { border: 0; background: transparent; padding: 6px 14px; font-weight: 700; cursor: pointer; color: inherit; min-height: 36px; }
.seg-btn.on { background: var(--ink, #2d2433); color: #fff; }
.mod-summary summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.gene-list { display: grid; gap: 4px; margin: 6px 0; }
.gene { display: grid; grid-template-columns: minmax(0, 1fr) 90px 44px; gap: 8px; align-items: center; font-size: .92em; }
.meter.small { height: 8px; }
.mod-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: .92em; }
.part-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 6px 0; }

/* ------------------------------------------------------------------ family tabs (evolution, language, look, shape) */
.band-strip { display: flex; height: 22px; border-radius: 8px; overflow: hidden; border: 1.5px solid var(--line); font: 700 .72rem var(--font-body); color: #fff; }
.band-strip span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.milestones { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.milestones li { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 12px; background: var(--paper-2); border-left: 4px solid var(--line-strong); }
.milestones li.good { border-left-color: var(--moss); }
.milestones li.bad { border-left-color: var(--berry); }
.milestones li.neutral { border-left-color: var(--sky); }
.milestones .m-icon { font-size: 1.15rem; flex: none; }
.cause-bars { display: grid; gap: 5px; }
.cause-bar { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr) 3.2em; gap: 8px; align-items: center; font-size: .9rem; }
.cause-bar .cause-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cause-track { height: 10px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.cause-track i { display: block; height: 100%; background: var(--line-strong); border-radius: 99px; }
.cause-bar.main .cause-track i { background: var(--berry); }
.cause-bar.main .cause-name { font-weight: 700; }
.cause-bar.old .cause-track i { background: var(--moss); }
.cause-bar .cause-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft, inherit); }
@media (max-width: 520px) { .cause-bar { grid-template-columns: minmax(0, 9em) minmax(0, 1fr) 3em; font-size: .84rem; } }
.advice-tips li { border-left-color: var(--sun, var(--line-strong)); }
#coach-camp.picked { box-shadow: 0 0 0 3px var(--sun-soft, rgba(233,178,58,.3)); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 14px; }
.chart-wide { max-width: 760px; }
.chart-grid h4, .card h4 { margin: 4px 0; }
.chips { gap: 6px; flex-wrap: wrap; }
.chip { border: 2px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 5px 12px; font: 700 .82rem var(--font-body); cursor: pointer; min-height: 34px; }
.chip[aria-pressed="true"] { background: var(--sun-soft); color: var(--ink); border-color: var(--ink); }
.call-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.call-card p { margin: 6px 0; }
.call-meaning { font: 800 1.2rem var(--font-display); }
.listen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.urge { display: grid; grid-template-columns: 7.5em 1fr 3em; gap: 8px; align-items: center; margin: 4px 0; font-size: .88rem; }
.meter.small { height: 9px; }
.meter.small > span { display: block; height: 100%; }
.look-pair { display: flex; gap: 16px; flex-wrap: wrap; }
.look-pair figure { margin: 0; flex: 1 1 180px; text-align: center; }
.look-portrait { width: 160px; max-width: 100%; margin: 0 auto; }
.species-name { font: 700 1rem var(--font-display); color: var(--moss-dark); margin: 2px 0; }
.coach-runs { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
:root:not([data-theme="light"]) .species-name { color: var(--leaf); }
:root[data-theme="dark"] .species-name { color: var(--leaf); }

/* ---------------------------------------------------------------- the Daily Arena */
.stack.tight { gap: 6px; }
.arena-today { display: flex; gap: 18px; align-items: center; background: linear-gradient(120deg, var(--card) 55%, var(--arena-tint, var(--leaf-soft))); }
.arena-today h2 { margin: 0; font-size: 1.6rem; }
.arena-today p { margin: 0; }
.arena-kicker { font: 800 .75rem var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.arena-theme-icon { font-size: 3.4rem; line-height: 1; width: 88px; height: 88px; flex: none; display: grid; place-items: center; border-radius: 26px; background: var(--paper-2); border: 2px solid var(--line); transform: rotate(-4deg); }
.arena-today.theme-lean { --arena-tint: var(--sun-soft); }
.arena-today.theme-maze { --arena-tint: #d9ead0; }
.arena-today.theme-marsh { --arena-tint: var(--sky-soft); }
.arena-today.theme-night { --arena-tint: #dcdcf4; }
.arena-today.theme-dreadmaw, .arena-today.theme-pack { --arena-tint: var(--berry-soft); }
:root:not([data-theme="light"]) .arena-today.theme-maze { --arena-tint: #22301f; } :root:not([data-theme="light"]) .arena-today.theme-night { --arena-tint: #23233a; }
:root[data-theme="dark"] .arena-today.theme-maze { --arena-tint: #22301f; }
:root[data-theme="dark"] .arena-today.theme-night { --arena-tint: #23233a; }
@media (max-width: 600px) { .arena-today { flex-direction: column; align-items: flex-start; } .arena-theme-icon { width: 64px; height: 64px; font-size: 2.4rem; } }

.arena-lineup { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 600px) { .arena-lineup { grid-template-columns: 1fr; } }
.arena-fighter { display: flex; align-items: center; gap: 10px; min-width: 0; }
.arena-fighter .portrait { width: 64px; flex: none; }
.arena-fighter.s .portrait { width: 46px; }
.arena-fighter-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.arena-fighter-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arena-lineup > .arena-fighter { background: var(--paper-2); border-radius: var(--radius-s); padding: 8px 10px; }
.arena-slot { position: relative; min-height: 64px; border: 2px dashed var(--line-strong); border-radius: var(--radius-s); display: flex; align-items: center; justify-content: center; padding: 6px 10px; background: none; font: inherit; color: inherit; text-align: left; }
.arena-slot.filled { border-style: solid; border-color: var(--sun); background: var(--sun-soft); cursor: pointer; justify-content: flex-start; }
.arena-slot-x { position: absolute; top: 4px; right: 8px; font-size: .8rem; color: var(--ink-faint); }
.arena-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.arena-option { border: 2px solid var(--line); background: var(--card); border-radius: var(--radius-s); padding: 6px 10px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.arena-option:hover:not(:disabled) { border-color: var(--moss); }
.arena-option:disabled { opacity: .45; cursor: default; }
.arena-option[aria-pressed="true"] { opacity: 1; border-color: var(--sun); background: var(--sun-soft); }
.arena-record { display: flex; gap: 10px; flex-wrap: wrap; }
.arena-stat { display: flex; flex-direction: column; padding: 8px 14px; border-radius: var(--radius-s); background: var(--paper-2); min-width: 96px; }
.arena-stat b { font: 800 1.35rem var(--font-display); }
.arena-stat span { font-size: .78rem; color: var(--ink-soft); }
.btn.big { font-size: 1.05rem; padding: 12px 22px; }

.arena-matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.arena-match-row { display: grid; grid-template-columns: 96px 1fr auto auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.arena-match-row:last-child { border-bottom: none; }
@media (max-width: 600px) { .arena-match-row { grid-template-columns: auto 1fr auto; } .arena-match-row > .faint { display: none; } }

.arena-standings { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.arena-standings li { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; }
.arena-standings li.me { background: var(--sun-soft); }
.arena-rank { font: 800 1rem var(--font-display); text-align: center; }
.arena-who { display: flex; flex-direction: column; min-width: 0; }
.arena-minis { display: flex; }
.arena-minis .portrait.tiny { width: 30px; margin-left: -6px; }
.arena-pts b { font: 800 1.15rem var(--font-display); }
@media (max-width: 600px) { .arena-minis { display: none; } .arena-standings li { grid-template-columns: 36px 1fr auto; } }

.arena-board { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin-bottom: 12px; }
.arena-stage { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; margin-bottom: 16px; }
.arena-stage .arena-board { grid-template-columns: 1fr; margin: 0; }
.arena-stage .arena-vs { display: none; }
.arena-stage .arena-replay { max-width: 720px; width: 100%; justify-self: center; }
@media (max-width: 900px) { .arena-stage { grid-template-columns: 1fr; } .arena-stage .arena-board { order: -1; grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .arena-stage .arena-board { grid-template-columns: 1fr 1fr; gap: 8px; }
  .arena-stage .arena-side { padding: 8px; }
  .arena-stage .arena-fighter { gap: 6px; }
  .arena-stage .arena-fighter.s .portrait { width: 30px; }
  .arena-stage .arena-fighter-text span { display: none; }
  .arena-stage .arena-fighter-text b { font-size: .8rem; }
  .arena-stage .arena-fighter { flex-wrap: wrap; }
  .arena-stage .arena-hp { width: 100%; height: 6px; }
  .arena-stage .arena-big-score { font-size: 1.5rem; }
  .arena-stage .arena-team-name { font-size: .85rem; }
}
.arena-side { border: 3px solid var(--team); border-radius: var(--radius); background: var(--card); padding: 10px 12px; box-shadow: var(--shadow); }
.arena-side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.arena-team-name { font: 800 1rem var(--font-display); color: var(--team); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arena-big-score { font: 900 2rem var(--font-display); color: var(--team); font-variant-numeric: tabular-nums; }
.arena-vs { align-self: center; font: 900 1.3rem var(--font-display); color: var(--ink-faint); }
.arena-hp { display: block; width: 64px; height: 8px; border-radius: 4px; background: var(--paper-2); overflow: hidden; flex: none; }
.arena-hp i { display: block; height: 100%; background: var(--leaf); transition: width .2s; }
.arena-hp.out { background: var(--berry-soft); }
.arena-hp.out i { width: 0 !important; }
.arena-side .arena-fighter:has(.arena-hp.out) { opacity: .45; }
@media (max-width: 700px) { .arena-board { grid-template-columns: 1fr; } .arena-vs { display: none; } .arena-hp { width: 44px; } }
.arena-replay .replay canvas { border-radius: var(--radius); }
.arena-wait { text-align: center; }
.arena-clash { font-size: 3rem; animation: arena-clash 1s ease-in-out infinite alternate; }
@keyframes arena-clash { from { transform: rotate(-12deg) scale(.95); } to { transform: rotate(12deg) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .arena-clash { animation: none; } }
.arena-result.won { border-color: var(--leaf); }
.arena-result.lost { border-color: var(--berry); }
.arena-result h2 { margin: 0; }
.arena-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.arena-table th, .arena-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.arena-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.arena-table tr.out td:first-child { text-decoration: line-through; text-decoration-color: var(--ink-faint); }
.arena-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.table-wrap { overflow-x: auto; }

/* Workshop: the weapon picker (one weapon, or none) */
.weapon-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.weapon-opt { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: baseline; text-align: left; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: inherit; font: inherit; cursor: pointer; }
.weapon-opt .faint { grid-column: 1 / -1; line-height: 1.35; }
.weapon-opt .pts { font-size: .8rem; font-weight: 700; color: var(--ink-faint); }
.weapon-opt[aria-pressed="true"] { border-color: var(--moss); background: var(--leaf-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--moss) 30%, transparent); }
.weapon-opt.locked { opacity: .55; cursor: not-allowed; }

/* ---- highlights reel */
.reel .reel-stage { max-width: 560px; }
.reel .reel-stage canvas { max-height: 360px; }
.reel .reel-caption { font-size: 1rem; margin: 6px 0; }
.reel .reel-chip[aria-pressed="true"] { background: var(--sun-soft); border-color: var(--ink); }

/* ---- live action mode */
.live-caption { position: absolute; left: 10px; right: 10px; bottom: 54px; z-index: 3; pointer-events: none; text-align: center;
  background: rgba(24,18,30,.74); color: #fff; font: 800 .95rem var(--font-display); padding: 7px 12px; border-radius: 12px; }
.reel .reel-poster { display: grid; place-items: center; gap: 6px; min-height: 120px; padding: 14px; border-radius: 14px; text-align: center;
  background: linear-gradient(160deg, var(--sun-soft), var(--paper-2)); color: var(--ink); font: 700 1rem var(--font-display); }
.reel .reel-stars { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.reel .reel-star { display: grid; justify-items: center; gap: 2px; flex: none; color: var(--ink); text-decoration: none; }
.reel .reel-star .portrait, .reel .reel-star svg { width: 100%; height: auto; }
.reel .reel-star .name { font: 700 .78rem var(--font-display); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reel .reel-story { display: flex; align-items: center; gap: 14px; min-height: 140px; padding: 16px; border-radius: 14px;
  background: linear-gradient(160deg, var(--sun-soft), var(--paper-2)); animation: reel-in .35s ease-out; }
.reel .reel-story-title { font: 800 1.1rem var(--font-display); }
@keyframes reel-in { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 480px) { .reel .reel-story { flex-direction: column; text-align: center; } }

/* Training, live: the herd of candidate brains and the best brain lighting up (client/lib/trainingLive.js). */
.herd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.herd-tile { position: relative; border: 2.5px solid var(--clan); border-radius: 12px; padding: 3px 3px 5px; background: var(--card);
  box-shadow: 0 0 calc(14px * var(--glow)) calc(3px * var(--glow)) color-mix(in srgb, var(--clan) 70%, transparent); transition: opacity .4s; }
.herd-tile.dropped { opacity: .42; border-style: dashed; }
.herd-tile.bred { animation: herd-pulse 2.4s ease-in-out infinite; }
@keyframes herd-pulse { 50% { box-shadow: 0 0 calc(20px * var(--glow)) calc(5px * var(--glow)) color-mix(in srgb, var(--clan) 80%, transparent); } }
.herd-face svg { width: 100%; height: auto; display: block; }
.herd-bar { height: 4px; border-radius: 4px; background: var(--paper-2); overflow: hidden; margin-top: 2px; }
.herd-bar > span { display: block; height: 100%; background: var(--clan); }
.herd-crown { position: absolute; top: -9px; left: -6px; font-size: 15px; }
.herd-kids { position: absolute; top: -8px; right: -6px; font-size: 11px; font-weight: 800; background: var(--clan); color: #fff; border-radius: 999px; padding: 0 5px; }
.clan-strip svg { width: 100%; height: 54px; display: block; border-radius: 8px; }
.brain-live svg { width: 100%; height: auto; background: #1d1a24; border-radius: 12px; }
.brain-live .live-node { fill: #5a5268; }
.brain-live .live-node.lit { fill: #fff6c8; filter: drop-shadow(0 0 3px #ffe27a); }
.brain-live .live-cap { fill: #cfc6dc; font-size: 11px; }
.brain-live .live-link { animation: live-flicker 3s ease-in-out infinite; }
.brain-live .live-link.dead { animation: none; }
@keyframes live-flicker { 50% { stroke-opacity: .2; } }
.live-bar { display: grid; grid-template-columns: minmax(0, 11em) 1fr; gap: 8px; align-items: center; font-size: .9em; }
.gene-track { position: relative; height: 8px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--line); }
.gene-track i { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%); }
.gene-track .gene-start { background: #9a93a6; }
.gene-track .gene-now { background: var(--leaf); box-shadow: 0 0 6px var(--leaf); }
.train-live .gene { grid-template-columns: minmax(0, 1fr) 110px auto; }
.train-live .gene b { white-space: nowrap; min-width: 6.5em; text-align: right; }
.gene-moved > span:first-child { font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .herd-tile.bred, .brain-live .live-link { animation: none; } }
.live-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.shift-track { position: relative; height: 12px; display: block; margin-right: 44px; }
.shift-track::before { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1.5px; background: var(--line-strong); }
.shift-track i { position: absolute; top: 2px; height: 8px; border-radius: 4px; }
.shift-track i.up { left: 50%; background: var(--leaf); }
.shift-track i.down { right: 50%; background: #c2566f; }
.shift-track b { position: absolute; right: -44px; top: -3px; }
.live-bar.off, .gene-list.off { opacity: .5; }
.train-live .live-bar { grid-template-columns: minmax(0, 11em) 1fr auto; }
.gen-controls { align-items: center; gap: 8px; flex-wrap: wrap; }
.gen-slider { flex: 1 1 160px; min-width: 120px; accent-color: var(--leaf); }
.gen-label { white-space: nowrap; }
.module-glow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; background: #1d1a24; border-radius: 12px; padding: 10px; }
.module-card { border: 1.5px solid #3d3745; border-radius: 10px; padding: 6px; }
.module-card.off { opacity: .45; }
.module-name { color: #e8e0f0; font-size: .85em; font-weight: 700; margin-bottom: 4px; }
.module-cells { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.module-cells i { aspect-ratio: 1; border-radius: 50%; background: #fff3b0; box-shadow: 0 0 4px #ffd75e; }
.module-cells i.lit { animation: live-twinkle 3s ease-in-out infinite; }
@keyframes live-twinkle { 50% { filter: brightness(.55); } }
@media (prefers-reduced-motion: reduce) { .module-cells i.lit { animation: none; } }
.clan-strip.clickable { cursor: pointer; }
button.module-card { font: inherit; text-align: left; background: transparent; cursor: pointer; }
.module-card.picked { border-color: #ffd75e; box-shadow: 0 0 10px #ffd75e66; }
.module-card:hover { border-color: #8a7fa0; }
.brain-live .live-lab { fill: #8c84a0; font-size: 8.5px; }
.brain-live .live-lab.lit { fill: #fff3c4; }
/* A sense that never fires for this body or in this place: dimmed, its reason on hover. */
.brain-live .quiet { opacity: .32; }
.brain-live .quiet .live-lab { font-style: italic; }
.gene.gene-edit { grid-template-columns: minmax(0, 1fr) minmax(110px, 180px) 52px; }
.gene-slide { position: relative; display: block; }
.gene-slider { width: 100%; accent-color: var(--leaf); }
.gene-saved { position: absolute; bottom: -3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--ink-faint, #9a93a6); pointer-events: none; }
.preset-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }

/* 📜 A family's story: a timeline of moments, each with its monster. */
.story-line { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 0; position: relative; }
.story-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 12px 0; position: relative; }
.story-item + .story-item { border-top: 1px dashed var(--line); }
.story-art { width: 64px; height: 64px; border-radius: 16px; background: var(--paper-2); display: grid; place-items: center; overflow: hidden; }
.story-art svg { width: 60px; height: 60px; }
.story-icon { font-size: 1.9rem; }
.story-body h4 { margin: 0 0 4px; font-size: 1.05rem; }
.story-body p { margin: 0 0 6px; }
.story-when { margin: 0 0 2px !important; }
.story-item.k-extinct .story-art { filter: grayscale(.8); }
.story-item.k-rare .story-art, .story-item.k-apex .story-art { box-shadow: 0 0 0 3px var(--sun-soft); }
.story-item.k-close_call .story-art { box-shadow: 0 0 0 3px var(--berry-soft); }
.story-item.k-comeback .story-art, .story-item.k-moved .story-art { box-shadow: 0 0 0 3px var(--leaf-soft); }
.story-stars { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.story-star { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 14px; background: var(--paper-2); color: inherit; text-decoration: none; }
.story-star svg { width: 52px; height: 52px; flex: none; }
@media (max-width: 520px) { .story-item { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; } .story-art { width: 48px; height: 48px; border-radius: 12px; } .story-art svg { width: 46px; height: 46px; } }

/* Brain details (scores, networks, sliders, training sizes): hidden in the simple view. */
html.simple .adv { display: none !important; }
.simple-only { display: none; }
html.simple .simple-only { display: block; }

/* Menu groups (Records, More): a small menu under the button, placed in the viewport by app.js. */
.navgroup { display: contents; }
.navbtn { padding: 7px 12px; border-radius: 999px; border: 0; background: none; cursor: pointer; color: var(--ink-soft); font-family: var(--font-display); font-weight: 700; font-size: .95rem; white-space: nowrap; }
.navbtn:hover, .navbtn[aria-expanded="true"] { background: var(--paper-2); color: var(--ink); }
.navbtn.current { background: var(--ink); color: var(--paper); }
.navbtn:focus-visible, .navmenu a:focus-visible { outline: 3px solid var(--sky, #3f7fae); outline-offset: 2px; }
.navmenu { position: fixed; z-index: 60; min-width: 190px; padding: 6px; display: grid; gap: 2px; background: var(--card); border: 1.5px solid var(--line-strong); border-radius: 14px; box-shadow: 0 10px 28px rgba(30, 25, 20, .18); }
.navmenu[hidden] { display: none; }
.navmenu a { padding: 9px 12px !important; border-radius: 10px !important; text-align: left; white-space: nowrap; color: var(--ink) !important; background: none !important; }
.navmenu a:hover { background: var(--paper-2) !important; }
.navmenu a[aria-current="page"] { background: var(--ink) !important; color: var(--paper) !important; }
@media (min-width: 1100px) { .mainnav { display: flex !important; flex-wrap: nowrap; } }

/* First steps: the card on My Monsters and the slim bar under the menu. */
.quest-card { border-color: var(--sun); box-shadow: 0 0 0 3px var(--sun-soft); }
.quest-progress { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin: 10px 0 12px; }
.quest-progress i { display: block; height: 100%; background: var(--moss); border-radius: 99px; }
.quest-steps { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.quest-steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 10px; border-radius: 12px; }
.quest-steps li .tick { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); font-size: 1rem; }
.quest-steps li.done { opacity: .7; }
.quest-steps li.done .tick { background: var(--moss); color: #fff; font-weight: 800; }
.quest-steps li.now { background: var(--sun-soft); }
.linklike { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
#quest-bar { background: var(--sun-soft); border-bottom: 1.5px solid var(--sun); }
.quest-bar-in { max-width: 1320px; margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .92rem; }
.quest-bar-step { font-family: var(--font-display); font-weight: 800; white-space: nowrap; }
.quest-bar-text { flex: 1 1 320px; min-width: 0; }
.quest-bar-x { width: 30px; height: 30px; margin-left: auto; }
@media (max-width: 600px) { .quest-bar-text { flex-basis: 100%; order: 3; font-size: .86rem; } }

/* ---- Phones */
@media (max-width: 400px) { .navbtn span[aria-hidden] { display: none; } .mainnav a, .navbtn { padding: 6px 5px !important; font-size: .8rem !important; } }
.so-icon { display: none; }
.more-ctl, .sel-chip { display: none; }
@media (max-width: 600px) {
  .nav-my { display: none; }
  .mainnav { gap: 0; justify-content: space-between; }
  .mainnav a, .navbtn { padding: 6px 6px; font-size: .82rem; }
  .qlabel { display: none; }
  .so-text { display: none; }
  .so-icon { display: inline; }
  .signout { padding: 6px 10px; }
  .qhint { display: none; }
  .quest-bar-in { flex-wrap: nowrap; padding: 6px 12px; gap: 8px; }
  .quest-bar-step { font-size: .82rem; }
  .quest-bar-text { flex: 1 1 auto; order: 0; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .quest-bar-in .btn { padding: 4px 10px; min-height: 32px; font-size: .8rem; white-space: nowrap; }
  .quest-bar-x { width: 28px; height: 28px; margin-left: 0; flex: none; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .tabs button { flex: none; white-space: nowrap; padding: 6px 12px; min-height: 36px; font-size: .86rem; }
  /* Map: the everyday buttons in one row; ⋯ opens the rest above them. */
  .world-controls { left: 8px; right: 8px; bottom: 8px; gap: 5px; }
  .world-controls .icon-btn { width: 36px; height: 36px; }
  .world-controls .extra { display: none; }
  .world-controls.open .extra { display: inline-grid; }
  /* (Opened, the extra buttons sit above the row: over everything, and the ⓘ chip steps aside.) */
  .world-controls.open { z-index: 5; }
  .world-controls.open ~ .sel-chip { display: none !important; }
  .more-ctl { display: inline-grid; }
  /* The thinking caption goes to the top of the map, clear of the buttons. */
  .world-canvas-wrap .live-caption { top: 74px; bottom: auto; font-size: .8rem; padding: 5px 10px; }
  .sel-chip:not([hidden]) { display: block; position: absolute; z-index: 3; left: 8px; bottom: 52px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 6px 12px; border-radius: 999px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); font: 800 .82rem var(--font-display); cursor: pointer; }
}

/* A world event's shared goal on the map (its progress counted in the world). */
.hud-goal { display: inline-flex; align-items: center; gap: 4px; background: var(--sun-soft); border-color: var(--sun); }
.hud-goal.met { background: var(--leaf-soft, var(--moss-soft)); border-color: var(--moss); }
.hud-goal.failed { background: var(--berry-soft); border-color: var(--berry); }
.goal-bar { display: inline-block; width: 46px; height: 7px; border-radius: 99px; background: rgba(45,36,51,.15); overflow: hidden; vertical-align: middle; }
.goal-bar i { display: block; height: 100%; background: var(--moss); }
.hud-goal.failed .goal-bar i { background: var(--berry); }

/* (Phone fixes from the playtest tour.) A select never widens the page; a wrapped segmented group keeps its corners. */
select { max-width: 100%; }
@media (max-width: 600px) { .seg { border-radius: 14px; flex-wrap: wrap; } }
/* Top 10 on a phone: a narrower rank and picture, the name wraps, the score's unit under its number. */
@media (max-width: 600px) {
  .board { table-layout: fixed; }
  .board td, .board th { padding: 6px 5px; }
  .board .rank { width: 38px; font-size: 1.1rem; }
  .board td:nth-child(2) { width: 46px !important; } .board td:nth-child(2) > div { width: 42px !important; }
  .board .who { overflow-wrap: anywhere; font-size: .9rem; }
  .board .score { width: 78px; white-space: normal; font-size: .95rem; text-align: right; }
  .board .score .faint { display: block; font-size: .72rem; }
}

/* A card a link pointed at (?focus=…) glows once. */
.flash { animation: flash-card 1.6s ease-out 1; }
@keyframes flash-card { 0%, 30% { box-shadow: 0 0 0 4px var(--sun, #f2c53d); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; outline: 3px solid var(--sun, #f2c53d); } }
/* Cards a link scrolls to stay clear of the sticky menu (and the guide bar). */
.card[id], section[id] { scroll-margin-top: 110px; }
/* Placing a food lure: the map takes a tap on a tile instead of a monster. */
.world-canvas-wrap canvas.placing { cursor: crosshair; }

/* Placing a food lure: what to do, over the top of the map. */
.place-chip:not([hidden]) { position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); top: 44px; width: max-content; max-width: min(560px, calc(100% - 16px));
  background: var(--card); color: var(--ink); border: 2px solid var(--sun); border-radius: 12px; padding: 6px 10px; font-size: .85rem; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
@media (max-width: 600px) { .place-chip:not([hidden]) { top: 78px; font-size: .8rem; } }
/* Admin health: a number past its warning line. */
.stat.bad { background: var(--berry-soft, #f6e0e6); outline: 2px solid var(--berry, #b04766); }

/* On a phone's map page, updates pop up at the top: at the bottom they covered the map's buttons. */
@media (max-width: 600px) { html[data-route="world"] .toasts { top: 8px; bottom: auto; } }

/* ---- family chiefs (client/lib/chiefPanel.js) */
.chief-panel { display: grid; gap: 6px; }
.chief-now { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.chief-now .chief-portrait { width: 96px; flex: none; }
.flag-pic { display: inline-flex; line-height: 0; }
.flag-editor { border-top: 1px dashed var(--line, #e3d9c2); padding-top: 10px; }
.flag-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #2d2433; padding: 0; cursor: pointer; }
.flag-swatch.on { outline: 3px solid #2d2433; outline-offset: 2px; }
.flag-editor .chip .flag-pic { margin-right: 4px; vertical-align: middle; }
.chief-powers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.chief-power { display: grid; gap: 2px; justify-items: start; text-align: left; padding: 8px 10px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--line); border-left: 6px solid var(--gem, var(--sun)); background: var(--card); color: var(--ink); font: inherit; }
.chief-power:hover, .chief-power:focus-visible { border-color: var(--ink); border-left-color: var(--gem, var(--sun)); }
.chief-power.on { background: var(--sun-soft); }
.chief-power .ico { font-size: 1.3rem; line-height: 1; }
.chief-power .small { color: var(--ink-soft); }
.chief-choose { gap: 8px; align-items: center; }
.chief-choose select { max-width: 100%; min-height: 38px; }
.chief-list { margin: 6px 0 0; padding-left: 1.4em; display: grid; gap: 4px; }
.chief-line { color: var(--ink); margin-top: 2px; }
@media (max-width: 480px) { .chief-now { align-items: flex-start; } .chief-now .chief-portrait { width: 72px; } .chief-choose select { flex: 1 1 100%; } }

/* ---- family goals (client/lib/goalsPanel.js) */
.goals-panel, .goals-glance { display: grid; gap: 8px; }
.goal-item { display: flex; gap: 8px; align-items: center; }
.goal-item .goal-row { flex: 1; }
.goal-row { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.goal-ico { font-size: 1.35rem; line-height: 1.2; flex: none; width: 1.6em; text-align: center; }
.goal-main { display: grid; gap: 3px; flex: 1; min-width: 0; }
.goal-label { overflow-wrap: anywhere; }
.goal-meter { height: 9px; }
.goal-meter > span { background: var(--moss); }
.gg-family { display: grid; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.gg-family:first-of-type { border-top: 0; padding-top: 0; }
.goal-done-list { margin: 6px 0 0; padding-left: 1.2em; display: grid; gap: 2px; }

/* ---- the notice board (client/views/board.js) */
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.news-item { display: grid; grid-template-columns: 26px auto minmax(0, 1fr); gap: 2px 8px; align-items: center; padding: 7px 10px; border-radius: 12px; background: var(--paper-2); }
.news-item.mine { background: var(--sun-soft); }
.news-item > .news-ico { font-size: 1.15rem; text-align: center; }
.news-item > .mini .name { display: none; }
.news-item > .mini .portrait { width: 38px; height: 34px; }
.news-item .news-body { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.news-item:not(:has(.mini)) { grid-template-columns: 26px minmax(0, 1fr); }
.board-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .board-cols { grid-template-columns: minmax(0, 1fr); } }
.board-family { display: flex; gap: 10px; align-items: center; }
.board-family .bf-face { width: 64px; flex: none; }
.board-glance { display: grid; gap: 8px; }
.plain-list { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.diet-chip.everything-chip { margin-left: auto; }
.diet-chip.everything-chip[aria-pressed="true"] { background: var(--sun-soft); border-color: var(--ink); }
@media (max-width: 600px) { .diet-chip.everything-chip { margin-left: 0; } }
/* Today's summary, pinned first in the notices (and its card on My Monsters). */
.event-list li.day-note { border-left: 4px solid #f2c53d; }
.day-card p { line-height: 1.55; }
/* Training: pick a goal on the brain (client/views/train.js, client/lib/brain3d.js). */
.train-pick { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 18px; margin-top: 12px; align-items: start; }
@media (max-width: 760px) { .train-pick { grid-template-columns: 1fr; } }
.train-brain { position: sticky; top: 70px; }
@media (max-width: 760px) { .train-brain { position: static; } }
.brain3d-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brain3d { cursor: pointer; border-radius: 24px; background: radial-gradient(circle at 50% 45%, var(--sun-soft, #fff4cf), transparent 70%); }
.brain3d-caption { text-align: center; max-width: 300px; display: flex; flex-direction: column; gap: 2px; font-size: .92rem; }
.brain3d-caption b { font: 800 1.02rem var(--font-display); }
.brain3d-caption span { color: var(--ink-soft); }
.goal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.goal { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 2.5px solid var(--line); background: var(--card); border-radius: 16px; padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; min-height: 64px; }
.goal b { display: block; font: 800 1rem var(--font-display); }
.goal .faint { display: block; line-height: 1.3; }
.goal-icon { font-size: 1.6rem; line-height: 1; flex: none; }
.goal[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); background: var(--sun-soft); }
.goal:hover { border-color: var(--line-strong); }
.goal-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--paper-2, rgba(0,0,0,.035)); }
.arena-brief details { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line, rgba(0,0,0,.1)); }
.arena-brief summary { cursor: pointer; }
.arena-brief .brief-h { margin: 10px 0 2px; }
.arena-brief ul, .arena-brief ol { margin: 2px 0 0; padding-left: 20px; }
.arena-brief li { margin: 2px 0; }
.arena-brief p { margin: 2px 0; }
.challenges > summary { cursor: pointer; font-weight: 700; }
.challenge-list { display: flex; flex-wrap: wrap; gap: 6px; }
.challenge-list .chip-btn { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font: 700 .9rem var(--font-display); cursor: pointer; color: inherit; }
.challenge-list .chip-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--sun-soft); }
.challenge-list .chip-btn[disabled] { opacity: .45; cursor: not-allowed; }
.more-options { margin-top: 14px; border-top: 2px dashed var(--line); padding-top: 10px; }
.more-options > summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); }
.run-brain { display: flex; justify-content: center; }
.result-headline { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; border: 2.5px solid var(--line); }
.result-headline.better { background: #e6f4dc; border-color: #7fb069; }
.result-headline.same { background: var(--paper-2, #f6efe0); }
.result-headline.worse { background: #fbe9e4; border-color: #d98b7a; }
.result-headline .big { font: 800 1.6rem var(--font-display); line-height: 1.1; }
.result-headline .big .arrow { opacity: .55; margin: 0 6px; }
@media (max-width: 600px) { .result-headline { grid-template-columns: 1fr; } }
.goal[aria-disabled="true"] { opacity: .6; border-style: dashed; cursor: help; }

/* ================================================================== Night Jungle (v223)
   The site's default look: a midnight jungle with leaves at the edges and eyes that blink in the
   dark (#jungle in index.html), glowing buttons and glassy cards. html[data-theme="light"] keeps
   the old cream-paper look. */
:root:not([data-theme="light"]) body {
  background: var(--paper);
  background-image: radial-gradient(ellipse at 75% -10%, rgba(29, 74, 62, .85), transparent 55%), radial-gradient(ellipse at 0% 100%, rgba(32, 70, 44, .55), transparent 45%), radial-gradient(ellipse at 100% 100%, rgba(52, 36, 90, .45), transparent 45%);
  background-attachment: fixed;
}
#jungle { display: none; }
:root:not([data-theme="light"]) #jungle { display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#jungle .leaves { position: absolute; bottom: 0; width: min(46vw, 560px); height: auto; }
#jungle .leaves.left { left: 0; }
#jungle .leaves.right { right: 0; transform: scaleX(-1); }
#jungle .fly { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #ffd46a; box-shadow: 0 0 6px 2px rgba(255, 212, 106, .55); opacity: .7; animation: fly 9s ease-in-out infinite; }
@keyframes fly { 0%, 100% { transform: translate(0, 0); opacity: .2; } 50% { transform: translate(14px, -18px); opacity: .9; } }
/* Eyes in the dark: a pair peeks out, blinks now and then, and fades back into the leaves. */
#jungle .eyes { position: absolute; display: flex; gap: var(--gap, 7px); opacity: 0; animation: peek var(--t, 16s) ease-in-out var(--d, 0s) infinite; }
#jungle .eyes i { width: var(--w, 9px); height: calc(var(--w, 9px) * .62); border-radius: 50%; background: radial-gradient(circle at 50% 45%, #fff7cf 0 18%, var(--c, #ffc94d) 22% 70%, transparent 74%); box-shadow: 0 0 10px 2px color-mix(in srgb, var(--c, #ffc94d) 55%, transparent); animation: blink var(--b, 4.7s) linear var(--d, 0s) infinite; transform-origin: 50% 50%; }
#jungle .eyes.slant i:first-child { transform: rotate(14deg); } #jungle .eyes.slant i:last-child { transform: rotate(-14deg); }
@keyframes peek { 0%, 12% { opacity: 0; } 20%, 78% { opacity: .95; } 86%, 100% { opacity: 0; } }
@keyframes blink { 0%, 90%, 100% { scale: 1 1; } 93%, 96% { scale: 1 .08; } }
@media (prefers-reduced-motion: reduce) { #jungle .eyes, #jungle .eyes i, #jungle .fly { animation: none; } #jungle .eyes { opacity: .7; } }
html.reduce-motion #jungle .eyes, html.reduce-motion #jungle .eyes i, html.reduce-motion #jungle .fly { animation: none; }
html.reduce-motion #jungle .eyes { opacity: .7; }
main, #quest-bar, #banner, #toasts { position: relative; z-index: 1; }

:root:not([data-theme="light"]) .topbar { background: rgba(13, 23, 25, .82); border-bottom: 1px solid rgba(var(--glow), .28); box-shadow: 0 1px 24px rgba(var(--glow), .10); }
:root:not([data-theme="light"]) .brand-name b { text-shadow: 0 0 14px rgba(var(--glow), .5); }
:root:not([data-theme="light"]) .brand-o circle:nth-of-type(1) { stroke: #0d1719; }
:root:not([data-theme="light"]) .mainnav a { color: var(--ink-soft); }
:root:not([data-theme="light"]) .mainnav a:hover { background: rgba(var(--glow), .08); color: var(--ink); }
:root:not([data-theme="light"]) .mainnav a[aria-current="page"] { background: rgba(var(--glow), .14); color: #e3ffc4; box-shadow: inset 0 0 0 1px rgba(var(--glow), .45); }
:root:not([data-theme="light"]) .icon-btn { background: rgba(255, 255, 255, .04); border-color: rgba(var(--glow), .22); color: var(--ink); }

:root:not([data-theme="light"]) .card { background: linear-gradient(160deg, #183033, #122225); border: 1px solid rgba(var(--glow), .18); }
:root:not([data-theme="light"]) .stat { background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(var(--glow), .12); }
:root:not([data-theme="light"]) .empty { border-color: rgba(var(--glow), .3); background: rgba(13, 23, 25, .5); }

:root:not([data-theme="light"]) .btn { --b: rgba(var(--glow), .5); background: rgba(255, 255, 255, .04); color: #e3ffc4; border-width: 2px; box-shadow: none; }
:root:not([data-theme="light"]) .btn:hover { background: rgba(var(--glow), .10); box-shadow: 0 0 18px rgba(var(--glow), .25); transform: translateY(-1px); }
:root:not([data-theme="light"]) .btn:active { transform: translateY(1px); box-shadow: none; }
:root:not([data-theme="light"]) .btn.primary { background: var(--leaf); border-color: var(--leaf); color: #0d1719; box-shadow: 0 0 22px rgba(var(--glow), .40); }
:root:not([data-theme="light"]) .btn.primary:hover { background: #c9f98c; box-shadow: 0 0 30px rgba(var(--glow), .6); }
:root:not([data-theme="light"]) .btn.go { background: var(--sun); border-color: var(--sun); color: #0d1719; box-shadow: 0 0 22px rgba(255, 201, 77, .35); }
:root:not([data-theme="light"]) .btn.danger { background: rgba(255, 127, 157, .08); border-color: rgba(255, 127, 157, .6); color: #ffd0dc; }
:root:not([data-theme="light"]) .btn.ghost { border-color: rgba(255, 255, 255, .18); color: var(--ink); }
:root:not([data-theme="light"]) .linkish, :root:not([data-theme="light"]) .recap .recap-more > summary { color: var(--leaf); }

:root:not([data-theme="light"]) input[type="text"], :root:not([data-theme="light"]) input[type="email"], :root:not([data-theme="light"]) input[type="password"], :root:not([data-theme="light"]) input[type="search"], :root:not([data-theme="light"]) input[type="number"], :root:not([data-theme="light"]) select, :root:not([data-theme="light"]) textarea { background: #0f1e21; border-color: #2f524c; }
:root:not([data-theme="light"]) .seg { background: rgba(255, 255, 255, .03); border-color: rgba(var(--glow), .25); }
:root:not([data-theme="light"]) .seg button[aria-pressed="true"], :root:not([data-theme="light"]) .seg button[aria-selected="true"] { background: rgba(var(--glow), .18); color: #e3ffc4; box-shadow: inset 0 0 0 1px rgba(var(--glow), .5); }
:root:not([data-theme="light"]) .tabs button { background: rgba(255, 255, 255, .03); border-color: rgba(var(--glow), .2); }
:root:not([data-theme="light"]) .tabs button[aria-selected="true"] { background: var(--leaf); border-color: var(--leaf); color: #0d1719; box-shadow: 0 0 16px rgba(var(--glow), .35); }
:root:not([data-theme="light"]) .meter { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .08); }
:root:not([data-theme="light"]) .meter > span { box-shadow: 0 0 10px rgba(var(--glow), .5); }

:root:not([data-theme="light"]) .notice { background: rgba(116, 194, 236, .08); border: 1px solid rgba(116, 194, 236, .45); }
:root:not([data-theme="light"]) .notice.warn { background: rgba(255, 201, 77, .08); border-color: rgba(255, 201, 77, .5); }
:root:not([data-theme="light"]) .notice.bad { background: rgba(255, 127, 157, .08); border-color: rgba(255, 127, 157, .5); }
:root:not([data-theme="light"]) .notice.good { background: rgba(var(--glow), .07); border-color: rgba(var(--glow), .45); }
:root:not([data-theme="light"]) .notice.apex-note { background: #3a1414; border-color: #e0524f; color: #ffd6d0; }
:root:not([data-theme="light"]) #banner { background: rgba(255, 201, 77, .1); border-bottom-color: rgba(255, 201, 77, .5); }
:root:not([data-theme="light"]) .hud-chip.hud-fire { background: #4a2410; color: #ffd9b0; }
:root:not([data-theme="light"]) .hud-chip.hud-gas { background: #3a3a14; color: #f2f2b8; }
:root:not([data-theme="light"]) .hall-tab[aria-current="page"] { background: var(--leaf); color: #0d1719; border-color: var(--leaf); }
:root:not([data-theme="light"]) .result-headline.better { background: rgba(var(--glow), .08); border-color: rgba(var(--glow), .5); }
:root:not([data-theme="light"]) .result-headline.worse { background: rgba(255, 127, 157, .08); border-color: rgba(255, 127, 157, .5); }
:root:not([data-theme="light"]) h1 { text-shadow: 0 0 30px rgba(var(--glow), .12); }
:root:not([data-theme="light"]) .brand { color: var(--ink); }
:root:not([data-theme="light"]) #jungle .leaves path:first-child { stroke: rgba(var(--glow), .10); stroke-width: 2; }
