/* Shild Cloud — the dashboard's design system.
   1. tokens (light, then dark: each chosen, not flipped)   2. base   3. the shell   4. layout
   5. components (cards, badges, buttons, forms, tables…)   6. the game's pictures and the cards built on them
   7. dialogs, the visual selector, menus   8. the pages' own pieces   9. responsive
   The gateway's own pages (app/mu/pages.py) are drawn with the same tokens and components. */

:root {
  color-scheme: light;
  --font: "IBM Plex Sans Arabic", "Inter", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-num: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --radius: 14px; --radius-sm: 10px; --radius-xs: 7px; --radius-lg: 18px;
  --sb: 264px; --top: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --bg: #f4f5f9;
  --surface: #ffffff; --surface-solid: #ffffff; --surface-2: #f6f7fb; --surface-3: #eceef5; --surface-hover: #f1f2f8;
  --border: #e6e8f0; --border-strong: #d2d6e2;
  --text: #141a2e; --text-2: #485167; --muted: #6f7890;
  --accent: #5b47e0; --accent-strong: #4936cb; --accent-2: #7d6df2; --accent-soft: #efecff; --accent-ink: #ffffff;
  --success: #0a8050; --warning: #b9590a; --danger: #d42a3e; --info: #2563eb; --neutral: #5f6880;
  --success-soft: #e4f5ec; --warning-soft: #fdf0e1; --danger-soft: #fdeaed; --info-soft: #e8f0fe; --neutral-soft: #eceef4;
  --success-line: #b5e3cb; --warning-line: #f6d3a8; --danger-line: #f7c2c9; --info-line: #c2d6fb;
  --shadow-xs: 0 1px 2px rgba(20, 26, 46, .05);
  --shadow: 0 1px 2px rgba(20, 26, 46, .04), 0 2px 10px -4px rgba(20, 26, 46, .08);
  --shadow-md: 0 10px 28px -12px rgba(20, 26, 46, .2);
  --shadow-lg: 0 28px 64px -22px rgba(20, 26, 46, .36);
  --ring: 0 0 0 3px rgba(91, 71, 224, .2);
  --s1: #5b47e0; --s2: #e8662c; --s3: #0f9d62; --s4: #d99a00; --s5: #d6558f; --s6: #2563eb; --s7: #7b61c9; --s8: #d42a3e;
  --k-common: #5f6880; --k-rare: #2563eb; --k-epic: #7c3aed; --k-heroic: #a21caf; --k-citadel: #b9590a; --k-shadow: #4338ca;
  --k-doomsday: #be123c; --k-arachne: #0f766e; --k-tartaros: #c2410c;
  --grid: rgba(20, 26, 46, .07);
  --scrim: rgba(16, 20, 38, .48);
  --art-bg: linear-gradient(160deg, #f3f1ff 0%, #e9eefb 100%);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1019;
  --surface: #161a26; --surface-solid: #161a26; --surface-2: #1c2130; --surface-3: #232939; --surface-hover: #1f2534;
  --border: #262c3d; --border-strong: #363e54;
  --text: #e9ecf5; --text-2: #b0b8cb; --muted: #8791a8;
  --accent: #8f7ff7; --accent-strong: #a597ff; --accent-2: #b3a8ff; --accent-soft: rgba(143, 127, 247, .16); --accent-ink: #0d1019;
  --success: #3ecf8e; --warning: #f5a54a; --danger: #f47183; --info: #6ea4ff; --neutral: #98a2b8;
  --success-soft: rgba(62, 207, 142, .14); --warning-soft: rgba(245, 165, 74, .14); --danger-soft: rgba(244, 113, 131, .14);
  --info-soft: rgba(110, 164, 255, .14); --neutral-soft: rgba(152, 162, 184, .14);
  --success-line: rgba(62, 207, 142, .3); --warning-line: rgba(245, 165, 74, .3); --danger-line: rgba(244, 113, 131, .3); --info-line: rgba(110, 164, 255, .3);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px -6px rgba(0, 0, 0, .5);
  --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -22px rgba(0, 0, 0, .85);
  --ring: 0 0 0 3px rgba(143, 127, 247, .3);
  --s1: #8f7ff7; --s2: #f08a55; --s3: #3ecf8e; --s4: #e0b340; --s5: #e57bab; --s6: #6ea4ff; --s7: #a892f0; --s8: #f47183;
  --k-common: #98a2b8; --k-rare: #6ea4ff; --k-epic: #a78bfa; --k-heroic: #d67be6; --k-citadel: #f5a54a; --k-shadow: #8f95f7;
  --k-doomsday: #f47183; --k-arachne: #2dd4bf; --k-tartaros: #fb8a4c;
  --grid: rgba(152, 162, 184, .12);
  --scrim: rgba(3, 5, 10, .62);
  --art-bg: linear-gradient(160deg, #221f3a 0%, #1a2238 100%);
}
/* "system": no choice written — the device's own, when it is dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0d1019;
    --surface: #161a26; --surface-solid: #161a26; --surface-2: #1c2130; --surface-3: #232939; --surface-hover: #1f2534;
    --border: #262c3d; --border-strong: #363e54;
    --text: #e9ecf5; --text-2: #b0b8cb; --muted: #8791a8;
    --accent: #8f7ff7; --accent-strong: #a597ff; --accent-2: #b3a8ff; --accent-soft: rgba(143, 127, 247, .16); --accent-ink: #0d1019;
    --success: #3ecf8e; --warning: #f5a54a; --danger: #f47183; --info: #6ea4ff; --neutral: #98a2b8;
    --success-soft: rgba(62, 207, 142, .14); --warning-soft: rgba(245, 165, 74, .14); --danger-soft: rgba(244, 113, 131, .14);
    --info-soft: rgba(110, 164, 255, .14); --neutral-soft: rgba(152, 162, 184, .14);
    --success-line: rgba(62, 207, 142, .3); --warning-line: rgba(245, 165, 74, .3); --danger-line: rgba(244, 113, 131, .3); --info-line: rgba(110, 164, 255, .3);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px -6px rgba(0, 0, 0, .5);
    --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 70px -22px rgba(0, 0, 0, .85);
    --ring: 0 0 0 3px rgba(143, 127, 247, .3);
    --s1: #8f7ff7; --s2: #f08a55; --s3: #3ecf8e; --s4: #e0b340; --s5: #e57bab; --s6: #6ea4ff; --s7: #a892f0; --s8: #f47183;
    --k-common: #98a2b8; --k-rare: #6ea4ff; --k-epic: #a78bfa; --k-heroic: #d67be6; --k-citadel: #f5a54a; --k-shadow: #8f95f7;
    --k-doomsday: #f47183; --k-arachne: #2dd4bf; --k-tartaros: #fb8a4c;
    --grid: rgba(152, 162, 184, .12);
    --scrim: rgba(3, 5, 10, .62);
    --art-bg: linear-gradient(160deg, #221f3a 0%, #1a2238 100%);
  }
}

/* -- 2. base ------------------------------------------------------------------------------ */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font: 15px/1.6 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
bdi { unicode-bidi: isolate; }
b, strong { font-weight: 600; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0; }
img { max-width: 100%; }
.num, .kpi-value, .badge, td.n, .count { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ic { flex: none; display: inline-block; vertical-align: middle; }
.muted { color: var(--muted); } .t2 { color: var(--text-2); }
.ok { color: var(--success); } .bad, .danger:not(.btn):not(.badge):not(.alert):not(.toast):not(.icon-btn):not(.tl-dot):not(.kpi):not(.nav-count):not(tr) { color: var(--danger); } .warn { color: var(--warning); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
ul.list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: .9rem; }

/* -- 3. the shell ---------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sb) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .22s var(--ease); }
.app.collapsed { --sb: 72px; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface);
  border-inline-end: 1px solid var(--border); z-index: 30; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; height: var(--top); padding: 0 16px; flex: none; border-bottom: 1px solid var(--border); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-2) 100%); box-shadow: 0 6px 16px -8px var(--accent); }
.brand-text { min-width: 0; line-height: 1.25; }
.brand-text b { display: block; font: 700 1.02rem var(--font-num); letter-spacing: -.01em; white-space: nowrap; }
.brand-text span { color: var(--muted); font-size: .74rem; white-space: nowrap; }
.nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { color: var(--muted); font-size: .7rem; font-weight: 600; padding: 14px 10px 6px; white-space: nowrap; }
.nav-label:first-child { padding-top: 4px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: .93rem; white-space: nowrap; transition: background .14s, color .14s; }
.nav a .ic { color: var(--muted); transition: color .14s; }
.nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav a:hover .ic { color: var(--text-2); }
.nav a.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.nav a.active .ic { color: var(--accent); }
.nav a > span { overflow: hidden; text-overflow: ellipsis; }
.nav .nav-count { margin-inline-start: auto; font: 700 .7rem var(--font-num); min-width: 20px; text-align: center; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); font-style: normal; }
.nav .nav-count.danger { background: var(--danger-soft); color: var(--danger); }
.nav .nav-count.success { background: var(--success-soft); color: var(--success); }
.nav .nav-count.info { background: var(--accent); color: var(--accent-ink); }
.sidebar-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.sys-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2);
  font-size: .78rem; color: var(--text-2); }
.sys-mini > span:not(.dot) { white-space: nowrap; margin-inline-end: 4px; }
.collapse-btn { justify-content: center; color: var(--muted); }
.app.collapsed .brand { justify-content: center; padding: 0; }
.app.collapsed .brand-text, .app.collapsed .nav a > span, .app.collapsed .sys-mini > span:not(.dot), .app.collapsed .collapse-btn span { display: none; }
.app.collapsed .nav-label { height: 1px; padding: 0; margin: 8px 10px; background: var(--border); overflow: hidden; color: transparent; }
.app.collapsed .nav-label:first-child { display: none; }
.app.collapsed .nav a { justify-content: center; padding: 8px; }
.app.collapsed .nav .nav-count { position: absolute; top: 3px; inset-inline-end: 3px; min-width: 16px; padding: 0 4px; font-size: .62rem; }
.app.collapsed .sys-mini { justify-content: center; }
.app.collapsed .collapse-btn .ic { transform: scaleX(-1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; min-height: var(--top); padding: 10px 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 1.12rem; line-height: 1.3; }
.topbar .crumb { color: var(--muted); font-size: .74rem; line-height: 1.2; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.search-btn { display: flex; align-items: center; gap: 9px; min-width: 250px; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: .88rem; transition: border-color .15s, background .15s; }
.search-btn:hover { border-color: var(--border-strong); background: var(--surface); color: var(--text-2); }
.search-btn kbd { margin-inline-start: auto; }
kbd { font: 600 .68rem var(--font-num); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); }
.live { display: inline-flex; align-items: center; gap: 8px; height: 38px; font-size: .8rem; color: var(--text-2); padding: 0 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.content { padding: 26px 28px 72px; max-width: 1440px; width: 100%; margin: 0 auto; }
.view { animation: viewIn .28s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.backdrop { display: none; }

/* -- 4. layout ------------------------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px 20px; margin-bottom: 22px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head h2 { margin: 0; font-size: 1.5rem; line-height: 1.3; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 68ch; font-size: .93rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid { display: grid; gap: 18px; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); margin-bottom: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.section { margin-bottom: 18px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; font-size: 1.02rem; font-weight: 700; }
.section-title:first-child { margin-top: 0; }
.section-title small { color: var(--muted); font-weight: 500; font-size: .82rem; }
.section-title .spacer { flex: 1; }

/* -- 5. components --------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 16px 20px 0; }
.card-title { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.card-title > .ic { color: var(--accent); margin-top: 3px; }
.card-title h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.card-title p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.55; max-width: 72ch; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-body { padding: 14px 20px 18px; }
.card.flush .card-body { padding: 10px 0 4px; }
.card.hero { position: relative; overflow: hidden; }
.card.accent { border-color: var(--accent); box-shadow: var(--ring); }

.kpi { position: relative; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); overflow: hidden; min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: .84rem; font-weight: 500; }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.kpi-icon .gi { --gi: 22px; }
.kpi.tone-success .kpi-icon { background: var(--success-soft); color: var(--success); }
.kpi.tone-warning .kpi-icon { background: var(--warning-soft); color: var(--warning); }
.kpi.tone-danger .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi.tone-info .kpi-icon { background: var(--info-soft); color: var(--info); }
.kpi.tone-neutral .kpi-icon { background: var(--neutral-soft); color: var(--neutral); }
.kpi-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; line-height: 1.2; overflow-wrap: anywhere; }
.kpi-value small { font-size: .82rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-sub { margin-top: 4px; color: var(--muted); font-size: .79rem; line-height: 1.5; }
.kpi-spark { position: absolute; inset-inline-end: 14px; bottom: 12px; opacity: .9; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.45; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge.accent { background: var(--accent-soft); color: var(--accent-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--neutral); position: relative; }
.dot.success { background: var(--success); } .dot.warning { background: var(--warning); } .dot.danger { background: var(--danger); } .dot.info { background: var(--info); }
.dot.pulsing::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; color: inherit; opacity: 0; animation: pulse 1.8s infinite; }
.dot.success.pulsing::after { color: var(--success); } .dot.danger.pulsing::after { color: var(--danger); } .dot.warning.pulsing::after { color: var(--warning); } .dot.info.pulsing::after { color: var(--info); }
@keyframes pulse { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.8); opacity: 0; } }
.kind { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--kc, var(--k-common)); background: color-mix(in srgb, var(--kc, var(--k-common)) 12%, transparent); }
.k-common { --kc: var(--k-common); } .k-rare { --kc: var(--k-rare); } .k-epic { --kc: var(--k-epic); } .k-heroic { --kc: var(--k-heroic); }
.k-citadel { --kc: var(--k-citadel); } .k-shadow, .k-5 { --kc: var(--k-shadow); } .k-doomsday { --kc: var(--k-doomsday); }
.k-arachne { --kc: var(--k-arachne); } .k-tartaros, .k-salamander { --kc: var(--k-tartaros); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: .8rem; color: var(--text-2); white-space: nowrap; }
.chip b { color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 7px 15px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .14s, border-color .14s, box-shadow .14s, color .14s; }
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 1px 2px rgba(20, 26, 46, .12); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.success { background: var(--success); color: #fff; border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.success:hover, .btn.danger:hover { filter: brightness(1.06); }
.btn.soft-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.soft { color: var(--accent-strong); background: var(--accent-soft); border-color: transparent; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn.sm { min-height: 32px; padding: 4px 11px; font-size: .83rem; border-radius: 8px; gap: 6px; }
.btn.lg { min-height: 44px; padding: 10px 20px; font-size: .96rem; }
.btn.block { width: 100%; }
.btn .spin, .spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 2px 0; width: 100%; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer; transition: background .14s, color .14s; flex: none; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn[disabled] { opacity: .4; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.field small { color: var(--muted); font-size: .76rem; line-height: 1.5; }
.input, select.input, textarea.input { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); transition: border-color .14s, box-shadow .14s; }
.input:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.num { font-family: var(--font-num); }
.input::placeholder { color: var(--muted); }
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.form-section { padding: 16px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section h4 { margin: 0 0 10px; font-size: .9rem; display: flex; gap: 8px; align-items: center; }
.form-section h4 .ic { color: var(--accent); }
.form-error { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; color: var(--danger); background: var(--danger-soft); font-weight: 600; font-size: .88rem; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.toggle .track i { position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .28); transition: inset-inline-start .2s var(--ease); }
.toggle input:checked + .track { background: var(--success); }
.toggle input:checked + .track i { inset-inline-start: 19px; }
.toggle input:disabled + .track { opacity: .45; }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-3); flex-wrap: wrap; max-width: 100%; }
.segmented button { border: 0; background: transparent; min-height: 32px; padding: 4px 13px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: .85rem; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.segmented .count { font-size: .7rem; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.segmented button.on .count { background: var(--accent-soft); color: var(--accent-strong); }
.tabbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 18px; }
.tabbar p { margin: 0; color: var(--muted); font-size: .82rem; flex: 1; min-width: 200px; }

/* a page's own sections: one in sight at a time */
.tabs { display: flex; gap: 2px; margin: 0 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 0; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
.tabs button:hover { color: var(--text); background: var(--surface-hover); }
.tabs button.on { color: var(--accent-strong); }
.tabs button.on::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tabs button .count { font: 700 .7rem var(--font-num); padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.tabs button.on .count { background: var(--accent-soft); color: var(--accent-strong); }
.tabs button .ic { color: var(--muted); } .tabs button.on .ic { color: var(--accent); }

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fact { display: flex; flex-direction: column; gap: 1px; padding: 7px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; max-width: 100%; }
.fact small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.fact b { font-size: .9rem; overflow-wrap: anywhere; }
.fact.tone-success { border-color: var(--success-line); background: var(--success-soft); } .fact.tone-success b { color: var(--success); }
.fact.tone-warning { border-color: var(--warning-line); background: var(--warning-soft); } .fact.tone-warning b { color: var(--warning); }
.fact.tone-danger { border-color: var(--danger-line); background: var(--danger-soft); } .fact.tone-danger b { color: var(--danger); }
.card-note { color: var(--muted); font-size: .8rem; margin: 10px 0 0; line-height: 1.6; }
.subhead { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: .92rem; font-weight: 700; }
.subhead .ic { color: var(--accent); }

details.fold { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
details.fold summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; font-size: .86rem; padding: 4px 0; }
details.fold summary:hover { color: var(--text); }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary .ic { transition: transform .2s var(--ease); }
details.fold[open] summary .ic { transform: rotate(180deg); }
details.fold .table-wrap { margin-top: 8px; }

/* the advanced settings, folded until asked for */
details.acc { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
details.acc + details.acc { margin-top: 10px; }
details.acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 14px; font-weight: 600; font-size: .9rem; color: var(--text); border-radius: var(--radius-sm); }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: var(--surface-hover); }
details.acc > summary > .ic:first-child { color: var(--accent); }
details.acc > summary small { color: var(--muted); font-weight: 500; font-size: .8rem; }
details.acc > summary .acc-arrow { margin-inline-start: auto; color: var(--muted); transition: transform .2s var(--ease); }
details.acc[open] > summary .acc-arrow { transform: rotate(180deg); }
details.acc > .acc-body { padding: 4px 14px 14px; }
/* a manager's settings: each a button of the same width, in rows that wrap; a note beside one takes the row's rest */
.settings { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.settings > .btn { justify-content: flex-start; flex: 1 1 190px; max-width: 300px; white-space: normal; text-align: start; line-height: 1.4; min-height: 40px; background: var(--surface); }
.settings > .btn .ic { color: var(--muted); }
.settings-group { font-size: .76rem; font-weight: 600; color: var(--muted); margin: 14px 0 8px; flex-basis: 100%; }
.settings-group:first-child { margin-top: 4px; }

.chip-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; cursor: pointer; user-select: none; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: .84rem; transition: background .15s, border-color .15s, color .15s; }
.chip-check span b { color: var(--muted); font-weight: 600; }
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip-check input:checked + span b { color: var(--accent); }
.chip-check input:disabled + span { opacity: .45; cursor: not-allowed; }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease); }
.progress.success i { background: var(--success); } .progress.warning i { background: var(--warning); } .progress.danger i { background: var(--danger); }
.ring .track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.ring .value { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ring.success .value { stroke: var(--success); }
.ring text { font: 700 .66rem var(--font-num); fill: var(--text); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: .75rem; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table th:first-child { border-start-start-radius: 8px; } .table th:last-child { border-start-end-radius: 8px; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.wrap { white-space: normal; min-width: 14rem; }
.table.tight th, .table.tight td { padding: 8px 10px; }
.table tr.muted td { color: var(--muted); }
.table tr.danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
[dir="rtl"] .table tr.danger td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
.table tr.warning { background: var(--warning-soft); }
.table td .gi { vertical-align: middle; margin-inline-end: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; display: flex; gap: 12px; padding: 8px 0; }
.tl-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); z-index: 1; }
.tl-dot.success { color: var(--success); background: var(--success-soft); border-color: transparent; }
.tl-dot.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.tl-dot.warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.tl-dot.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.tl-body { min-width: 0; flex: 1; }
.tl-title { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-weight: 600; font-size: .9rem; }
.tl-meta { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.tl-time { margin-inline-start: auto; color: var(--muted); font-size: .76rem; white-space: nowrap; font-family: var(--font-num); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.status-list li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; transition: background .12s; }
.status-list li:hover { background: var(--surface-2); }
.status-list li > div { min-width: 0; }
.status-list .sl-name { font-weight: 600; } .status-list .sl-sub { color: var(--muted); font-size: .78rem; }
.status-list .sl-end { margin-inline-start: auto; text-align: end; flex: none; }
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.alert > .ic { margin-top: 3px; }
.alert > div { min-width: 0; }
.alert.danger { background: var(--danger-soft); border-color: var(--danger-line); } .alert.danger > .ic { color: var(--danger); }
.alert.warning { background: var(--warning-soft); border-color: var(--warning-line); } .alert.warning > .ic { color: var(--warning); }
.alert.info { background: var(--info-soft); border-color: var(--info-line); } .alert.info > .ic { color: var(--info); }
.alert.success { background: var(--success-soft); border-color: var(--success-line); } .alert.success > .ic { color: var(--success); }
.alert span { font-size: .84rem; color: var(--text-2); }

.hero-status { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; }
.hero-orb { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none; color: var(--neutral); background: var(--neutral-soft); }
.hero-orb.success { background: var(--success-soft); color: var(--success); }
.hero-orb.warning { background: var(--warning-soft); color: var(--warning); }
.hero-orb.danger { background: var(--danger-soft); color: var(--danger); }
.hero-orb.info { background: var(--accent-soft); color: var(--accent); }
.hero-text { flex: 1; min-width: 220px; }
.hero-text h3 { margin: 0; font-size: 1.2rem; line-height: 1.4; }
.hero-text p { margin: 4px 0 0; color: var(--text-2); font-size: .9rem; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 32px 20px; color: var(--muted); }
.empty > .ic { color: var(--muted); opacity: .7; width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--surface-3); box-sizing: border-box; }
.empty b { color: var(--text); font-size: .98rem; }
.empty p { margin: 0; max-width: 46ch; font-size: .86rem; }
.empty .btn { margin-top: 6px; }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.skeleton i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* -- 6. the game's pictures, and the cards built on them ---------------------------------------- */
/* a picture's frame (js/art.js): --gi its width, --gi-h its height when not square */
.gi { --gi: 40px; display: inline-grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; width: var(--gi); height: var(--gi-h, var(--gi)); flex: none; overflow: hidden; position: relative;
  border-radius: calc(var(--gi) * .22); background: var(--surface-3); vertical-align: middle; }
.gi img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; }
.gi-portrait, .gi-scene { background: transparent; border-radius: 0; overflow: visible; }
.gi-portrait img, .gi-scene img { object-fit: contain; filter: drop-shadow(0 6px 8px rgba(20, 26, 46, .16)); }
.gi-bare { background: transparent; border-radius: 0; }
.gi-bare img { object-fit: contain; }
.gi-round { border-radius: 50%; }
.gi-none { background: var(--surface-3); color: var(--muted); font-weight: 700; font-size: calc(var(--gi) * .42); border-radius: calc(var(--gi) * .22); }
/* a line of text with a picture before it */
.with-pic { display: inline-flex; align-items: center; gap: 9px; min-width: 0; vertical-align: middle; }
.with-pic > span:last-child { min-width: 0; }
.with-pic small { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; }
/* pictures overlapping: a kind's few faces */
.gi-stack { display: inline-flex; flex: none; }
.gi-stack .gi { margin-inline-start: -10px; box-shadow: 0 0 0 2px var(--surface); }
.gi-stack .gi:first-child { margin-inline-start: 0; }
.rank { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 5px; font: 700 .66rem var(--font-num);
  background: var(--surface-3); color: var(--text-2); letter-spacing: .02em; }

/* an entity's card: a unit, a captain, a crypt, a monster — a picture, a name, a line or two; chosen by a press */
.ent-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.ent-grid.wide { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ent-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ent { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; text-align: center; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; min-width: 0; font: inherit; color: inherit;
  transition: border-color .14s, box-shadow .14s, transform .14s; }
.ent:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.ent:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ent-art { position: relative; display: grid; place-items: center; height: 112px; padding: 10px; background: var(--art-bg); }
.ent-art .gi { --gi: 92px; }
.ent-art .gi-tile { --gi: 72px; box-shadow: 0 6px 16px -8px rgba(20, 26, 46, .35); }
.ent-art.scene { height: 128px; } .ent-art.scene .gi { --gi: 150px; --gi-h: 104px; }
.ent-body { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px 11px; min-width: 0; }
.ent-name { font-weight: 600; font-size: .88rem; line-height: 1.35; overflow-wrap: anywhere; }
.ent-sub { color: var(--muted); font-size: .74rem; line-height: 1.45; }
.ent-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 3px; }
.ent-tag { font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.ent-corner { position: absolute; top: 7px; inset-inline-start: 7px; z-index: 1; }
.ent-check { position: absolute; top: 7px; inset-inline-end: 7px; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1.5px solid var(--border-strong); color: transparent; transition: background .14s, border-color .14s; font: 700 .72rem var(--font-num); }
.ent.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ent.on .ent-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ent.off, .ent[disabled] { opacity: .5; cursor: not-allowed; }
.ent.off:hover, .ent[disabled]:hover { transform: none; box-shadow: none; border-color: var(--border); }
/* a card laid on its side: the picture first, the words after */
.ent.row { flex-direction: row; align-items: center; text-align: start; gap: 12px; padding: 10px 12px; }
.ent.row .ent-art { height: auto; padding: 0; background: transparent; }
.ent.row .ent-art .gi { --gi: 48px; }
.ent.row .ent-body { padding: 0; flex: 1; }
.ent.row .ent-tags { justify-content: flex-start; }
.ent.row .ent-check { position: static; flex: none; }

/* a choice among a few kinds, each with its picture (a crypt's kind, a training's kind, a hunt's) */
.choice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice { position: relative; display: flex; flex-direction: column; gap: 0; padding: 0; text-align: start; cursor: pointer; overflow: hidden; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font: inherit; color: inherit;
  transition: border-color .14s, box-shadow .14s, transform .14s; }
.choice:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.choice.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.choice-art { position: relative; height: 124px; display: grid; place-items: center; background: var(--art-bg); border-bottom: 1px solid var(--border); }
.choice-art .gi { --gi: 150px; --gi-h: 104px; }
.choice-art .gi-tile { --gi: 76px; --gi-h: 76px; box-shadow: 0 8px 18px -10px rgba(20, 26, 46, .4); }
.choice-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 3px; }
.choice-body b { font-size: .96rem; }
.choice-body span { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.choice .ent-check { top: 9px; inset-inline-end: 9px; }
.choice.on .ent-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choice.k-common .choice-art { background: linear-gradient(160deg, #eef0f6, #e3e7f1); }
.choice.k-rare .choice-art { background: linear-gradient(160deg, #e7effe, #d9e6fd); }
.choice.k-epic .choice-art { background: linear-gradient(160deg, #f1ebff, #e4d9fe); }
.choice.k-tartaros .choice-art { background: linear-gradient(160deg, #fff0e6, #fde0cc); }
:root[data-theme="dark"] .choice[class*="k-"] .choice-art { background: var(--art-bg); }

/* a plan: its picture, its name and state, how far it is, what it does next; the rest of its actions in a menu */
.plans { display: flex; flex-direction: column; gap: 10px; }
.plan-card { position: relative; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); transition: box-shadow .16s, border-color .16s, opacity .16s; }
.plan-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.plan-card.off { background: var(--surface-2); }
.plan-card.off .plan-art, .plan-card.off .plan-main { opacity: .62; }
.plan-card.running { border-color: var(--success-line); box-shadow: 0 0 0 3px var(--success-soft); }
.plan-art { width: 76px; height: 64px; border-radius: 12px; display: grid; place-items: center; background: var(--art-bg); flex: none; overflow: hidden; }
.plan-art .gi { --gi: 72px; --gi-h: 56px; }
.plan-art .gi-tile { --gi: 48px; --gi-h: 48px; }
.plan-card.k-common .plan-art { background: linear-gradient(160deg, #eef0f6, #e3e7f1); }
.plan-card.k-rare .plan-art { background: linear-gradient(160deg, #e7effe, #d9e6fd); }
.plan-card.k-epic .plan-art { background: linear-gradient(160deg, #f1ebff, #e4d9fe); }
.plan-card.k-tartaros .plan-art { background: linear-gradient(160deg, #fff0e6, #fde0cc); }
:root[data-theme="dark"] .plan-card[class*="k-"] .plan-art { background: var(--art-bg); }
.drag-handle { cursor: grab; color: var(--muted); display: grid; place-items: center; width: 24px; height: 40px; border-radius: 8px; touch-action: none; background: none; border: 0; opacity: .55; padding: 0; }
.drag-handle:hover { color: var(--text); background: var(--surface-hover); opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.drag-source { opacity: .35; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; box-shadow: var(--shadow-lg); transform: rotate(-1deg) scale(1.01); opacity: .97; }
.plan-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.plan-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; }
.plan-rank { font: 700 .72rem var(--font-num); color: var(--muted); }
.plan-title { font-weight: 700; font-size: .96rem; }
.plan-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .8rem; align-items: center; }
.plan-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.plan-meta b { color: var(--text-2); font-family: var(--font-num); }
.plan-progress { display: flex; align-items: center; gap: 10px; max-width: 440px; }
.plan-progress .progress { flex: 1; }
.plan-progress span { font: 600 .78rem var(--font-num); color: var(--text-2); white-space: nowrap; }
.plan-tools { display: flex; gap: 6px; align-items: center; }
.plan-note { font-size: .8rem; display: flex; gap: 6px; align-items: flex-start; color: var(--text-2); }
.plan-note .ic { margin-top: 3px; flex: none; }
.plan-note.bad { color: var(--danger); } .plan-note.warn { color: var(--warning); }

/* a training target: the unit, how much of it is done, its turn */
.target-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.target-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color .14s, box-shadow .14s; }
.target-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.target-card.first { border-color: var(--success-line); }
.target-card.off { background: var(--surface-2); }
.target-art { width: 78px; height: 92px; border-radius: 12px; display: grid; place-items: center; background: var(--art-bg); overflow: hidden; }
.target-art .gi { --gi: 74px; --gi-h: 86px; }
.target-art .gi-tile { --gi: 56px; --gi-h: 56px; }
.target-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.target-top { display: flex; align-items: flex-start; gap: 8px; }
.target-top > div { min-width: 0; flex: 1; }
.target-name { font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.target-sub { color: var(--muted); font-size: .76rem; }
.target-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); }
.target-nums b { color: var(--text); font-family: var(--font-num); }
.target-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.target-foot .spacer { flex: 1; }
.target-pick { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 1; }
.check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }

/* an event: its banner, its name and state, the bot's part in it */
.event-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin-bottom: 8px; }
.event-card { position: relative; display: flex; flex-direction: column; text-align: start; padding: 0; overflow: hidden; min-width: 0; cursor: pointer; font: inherit; color: inherit;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .14s, box-shadow .14s, transform .14s; text-decoration: none; }
a.event-card:hover { text-decoration: none; }
.event-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.event-card.live { border-color: var(--success-line); }
.event-banner { position: relative; height: 84px; background: var(--art-bg); overflow: hidden; }
.event-banner > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: right center; }
.event-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, transparent 30%, color-mix(in srgb, var(--surface) 82%, transparent) 100%); }
.event-emblem { position: absolute; z-index: 1; inset-inline-start: 14px; bottom: -22px; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--surface); box-shadow: 0 0 0 3px var(--surface), var(--shadow); }
.event-emblem .gi { --gi: 48px; border-radius: 12px; }
.event-emblem > .ic { color: var(--accent); }
.event-state { position: absolute; z-index: 1; top: 10px; inset-inline-end: 10px; }
.event-info { padding: 30px 16px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.event-info h3 { margin: 0; font-size: 1.02rem; line-height: 1.4; }
.event-info p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.event-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.event-stats b { color: var(--text); font-family: var(--font-num); }
.event-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: .82rem; color: var(--text-2); }
.event-foot .spacer { flex: 1; }
.event-foot .go { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-strong); font-weight: 600; }
/* the game's tournaments on now: small tiles, each with its own icon */
.event-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); margin-bottom: 18px; }
.event-tile { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); min-width: 0; text-align: start; font: inherit; color: inherit; }
.event-tile > .gi, .event-tile > .et-icon { grid-row: 1 / span 3; --gi: 44px; }
.event-tile .et-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
button.event-tile, a.event-tile { cursor: pointer; text-decoration: none; transition: border-color .14s, box-shadow .14s; }
button.event-tile:hover, a.event-tile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.event-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.event-tile.manual { background: var(--surface-2); }
.event-tile .et-name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-tile .et-points { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.event-tile .et-sub { color: var(--muted); font-size: .76rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.event-tile .et-sub .badge { white-space: normal; }
.ev-dot { display: inline-block; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--border-strong); flex: none; vertical-align: middle; }
.ev-dot.now { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.ev-dot.on { background: var(--accent); }
/* one event opened: the way back, its name, its state */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); position: relative; overflow: hidden; }
.detail-head > * { position: relative; z-index: 1; }
.detail-head .dh-art { position: absolute; z-index: 0; inset: 0; opacity: .5; }
.detail-head .dh-art img { width: 100%; height: 100%; object-fit: cover; object-position: left center; }
.detail-head .dh-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, var(--surface) 46%, transparent 100%); }
.detail-head h3 { margin: 0; font-size: 1.15rem; }
.detail-head p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.detail-head .spacer { flex: 1; }

/* a captain in a list: his portrait, his name and what he does */
.hero-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; transition: background .12s; min-width: 0; }
.hero-row:hover { background: var(--surface-2); }
.hero-row .gi { --gi: 42px; border-radius: 12px; }
.hero-row > div { min-width: 0; flex: 1; }
.hero-row b { display: block; font-size: .92rem; }
.hero-row small { color: var(--muted); font-size: .76rem; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 5px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .84rem; font-weight: 600; }
[dir="rtl"] .hero-chip { padding: 4px 5px 4px 12px; }
.hero-chip .gi { --gi: 28px; border-radius: 50%; }
.hero-chip small { color: var(--muted); font-weight: 500; font-family: var(--font-num); }

/* a wizard's steps */
.steps { display: flex; align-items: center; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; counter-reset: step; font-size: .84rem; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; counter-increment: step; }
.steps li::before { content: counter(step); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font: 700 .74rem var(--font-num); }
.steps li:not(:last-child)::after { content: ""; width: 26px; height: 2px; border-radius: 2px; background: var(--border); margin-inline-start: 2px; }
.steps li.on { color: var(--text); } .steps li.on::before { background: var(--accent); color: var(--accent-ink); }
.steps li.done { color: var(--text-2); } .steps li.done::before { background: var(--success-soft); color: var(--success); content: "✓"; }
.steps li.done:not(:last-child)::after { background: var(--success-line); }
/* what was chosen, before it is saved */
.summary { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.summary .gi { flex: none; }
.summary-body { min-width: 0; flex: 1; }
.summary-body b { display: block; }
.summary-body span { color: var(--muted); font-size: .82rem; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 6px 0 0; font-size: .84rem; }
.summary dt { color: var(--muted); } .summary dd { margin: 0; font-weight: 600; }
/* a level picked among a few: chips with numbers */
.level-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.level-chips button { min-width: 44px; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font: 600 .88rem var(--font-num); color: var(--text-2); }
.level-chips button:hover { border-color: var(--accent); color: var(--text); }
.level-chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* a number with its minus and plus */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 38px; border: 0; background: var(--surface-2); cursor: pointer; font: 700 1.05rem var(--font-num); color: var(--text-2); }
.stepper button:hover { background: var(--surface-hover); color: var(--text); }
.stepper input { width: 110px; border: 0; text-align: center; background: transparent; font: 600 .95rem var(--font-num); min-height: 38px; outline: none; }
.stepper:focus-within { border-color: var(--accent); box-shadow: var(--ring); }

/* a search and its filters above a list */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.search { flex: 1 1 220px; min-width: 180px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); height: 100%; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.filter:hover { border-color: var(--border-strong); color: var(--text); }
.filter span { font: 700 .68rem var(--font-num); padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.filter.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.filter.on span { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); color: inherit; }

/* the rest of a card's actions, behind three dots */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary.icon-btn { border-color: var(--border); background: var(--surface); }
details.menu[open] > summary.icon-btn { background: var(--surface-hover); color: var(--text); }
.menu-pop { position: absolute; z-index: 40; top: calc(100% + 6px); inset-inline-end: 0; min-width: 190px; padding: 6px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 1px; animation: popIn .14s var(--ease); }
details.menu.up .menu-pop { top: auto; bottom: calc(100% + 6px); }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-pop button, .menu-pop a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 500; color: var(--text); text-align: start; white-space: nowrap; text-decoration: none; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--surface-hover); }
.menu-pop button .ic { color: var(--muted); }
.menu-pop button.danger { color: var(--danger); } .menu-pop button.danger .ic { color: var(--danger); }
.menu-pop button:disabled { opacity: .45; cursor: not-allowed; }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

/* -- 7. toasts, dialogs, the visual selector, the palette ---------------------------------------- */
.toasts { position: fixed; z-index: 300; bottom: 20px; inset-inline-start: 20px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); transform: translateY(12px); opacity: 0; transition: transform .25s var(--ease), opacity .25s; border-inline-start: 3px solid var(--info); }
.toast.in { transform: none; opacity: 1; } .toast.out { opacity: 0; transform: translateY(8px); }
.toast-icon { color: var(--info); margin-top: 1px; }
.toast.success { border-inline-start-color: var(--success); } .toast.success .toast-icon { color: var(--success); }
.toast.danger { border-inline-start-color: var(--danger); } .toast.danger .toast-icon { color: var(--danger); }
.toast.warning { border-inline-start-color: var(--warning); } .toast.warning .toast-icon { color: var(--warning); }
.toast-text { flex: 1; min-width: 0; font-size: .88rem; overflow-wrap: anywhere; } .toast-text b { display: block; }
.toast .icon-btn { width: 26px; height: 26px; }
.modal-wrap { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 20px; background: var(--scrim);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s; }
.modal-wrap.in { opacity: 1; }
.modal { width: min(620px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.985); transition: transform .22s var(--ease); }
@supports (height: 100dvh) { .modal { max-height: calc(100dvh - 40px); } }
.modal-wrap.in .modal { transform: none; }
.modal.sm { width: min(440px, 100%); } .modal.lg { width: min(880px, 100%); } .modal.xl { width: min(1080px, 100%); }
.modal header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex: none; }
.modal header h2 { margin: 0; font-size: 1.06rem; flex: 1; min-width: 0; line-height: 1.4; }
.modal header h2 small { display: block; color: var(--muted); font-size: .8rem; font-weight: 500; }
.modal-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal footer { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 20px 14px; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex: none; }
.modal footer:empty { display: none; }
.modal footer .foot-note { margin-inline-end: auto; color: var(--text-2); font-size: .84rem; min-width: 0; }
.confirm-text { margin: 0; color: var(--text-2); line-height: 1.75; white-space: pre-line; }
.ask-text { margin: 0 0 12px; color: var(--text-2); line-height: 1.75; font-size: .92rem; }
.ask-now { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: .8rem; color: var(--muted); }

/* the visual selector (js/picker.js): its tools on top, its cards in the middle, what was chosen at the bottom */
.picker .modal-body { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.picker-tools { padding: 14px 20px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; flex: none; }
.picker-tools .toolbar { margin: 0; }
.picker-intro { margin: 0; color: var(--text-2); font-size: .86rem; line-height: 1.6; }
.picker-list { flex: 1; min-height: 160px; overflow-y: auto; padding: 16px 20px 20px; }
.picker-group { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: .84rem; font-weight: 700; color: var(--text-2); }
.picker-group:first-child { margin-top: 0; }
.picker-group span { font: 600 .72rem var(--font-num); color: var(--muted); }
.picker-tray { flex: none; border-top: 1px solid var(--border); padding: 10px 20px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; min-height: 56px; overflow-x: auto; }
.picker-tray .tray-label { flex: none; font-size: .8rem; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.picker-tray .tray-items { display: flex; gap: 8px; align-items: center; min-width: 0; }
.picker-tray .tray-empty { color: var(--muted); font-size: .82rem; }
.tray-item { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .8rem; font-weight: 600;
  white-space: nowrap; flex: none; }
[dir="rtl"] .tray-item { padding: 3px 4px 3px 10px; }
.tray-item .gi { --gi: 28px; border-radius: 50%; }
.tray-item .tray-n { font: 700 .68rem var(--font-num); color: var(--accent-strong); }
.tray-item button { width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--text-2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.tray-item button:hover { background: var(--danger-soft); color: var(--danger); }
.tray-item .tray-move { background: transparent; }
.picker-empty { padding: 30px 10px; }

.palette-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 52vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.palette-list li .ic { color: var(--muted); }
.palette-list li.on { background: var(--accent-soft); } .palette-list li.on .ic { color: var(--accent); }
.palette-list li .pl-sub { color: var(--muted); font-size: .78rem; }
.palette-list li .pl-kind { margin-inline-start: auto; font-size: .7rem; color: var(--muted); }
.palette-group { color: var(--muted); font-size: .72rem; font-weight: 600; padding: 10px 12px 4px; cursor: default !important; }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; font-size: .9rem; }
.shortcuts kbd { margin-inline-start: 4px; }

/* -- 8. the pages' own pieces ------------------------------------------------------------------ */
.tasks { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.task { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow-xs); transition: border-color .16s, box-shadow .16s; min-width: 0; }
.task:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.task-head { display: flex; gap: 12px; align-items: flex-start; }
.task-head > div:nth-child(2) { min-width: 0; flex: 1; }
.task-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); overflow: hidden; }
.task-icon .gi { --gi: 44px; --gi-h: 44px; border-radius: 0; }
.task-icon.hunt { background: color-mix(in srgb, var(--s2) 14%, transparent); color: var(--s2); }
.task-icon.analysis { background: color-mix(in srgb, var(--s3) 14%, transparent); color: var(--s3); }
.task-title { font-weight: 700; line-height: 1.4; }
.task-sub { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.task-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.task-facts div { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.task-facts span { display: block; color: var(--muted); font-size: .72rem; }
.task-facts b { font-size: .86rem; font-family: var(--font-num); overflow-wrap: anywhere; }
.task details { border-top: 1px solid var(--border); padding-top: 10px; }
.task summary { cursor: pointer; color: var(--text-2); font-size: .84rem; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
.task summary::-webkit-details-marker { display: none; }
.task details[open] summary .ic { transform: rotate(180deg); }
.task .timeline { margin-top: 8px; max-height: 260px; overflow-y: auto; }

.chart { position: relative; width: 100%; min-height: 120px; direction: ltr; }
.chart-svg { display: block; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 500 10.5px var(--font-num); }
.chart .crosshair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .crosshair.on { opacity: .6; }
.chart .hover-dot { opacity: 0; stroke: var(--surface); stroke-width: 2; }
.chart .hover-dot.on { opacity: 1; }
.chart .end-dot { stroke: var(--surface); stroke-width: 2; }
.chart .bar { transition: opacity .15s; }
.chart .bar-col.hover .bar { filter: brightness(1.12); }
.chart-empty { display: grid; place-items: center; min-height: 140px; color: var(--muted); font-size: .88rem; border: 1px dashed var(--border-strong); border-radius: 12px; direction: rtl; }
.chart-tip { position: fixed; top: 0; left: 0; z-index: 200; pointer-events: none; opacity: 0; transition: opacity .12s; min-width: 140px;
  padding: 9px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .8rem; direction: rtl; }
.chart-tip.on { opacity: 1; }
.tip-title { color: var(--muted); font-size: .74rem; margin-bottom: 4px; font-family: var(--font-num); }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tip-row b { font-family: var(--font-num); }
.tip-row span { color: var(--text-2); }
.donut { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; direction: rtl; }
.donut-svg { flex: none; direction: ltr; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 16; }
.donut-seg { fill: none; stroke-width: 16; cursor: default; transition: stroke-width .15s; }
.donut-seg:hover { stroke-width: 19; }
.donut-value { font: 700 1.25rem var(--font-num); fill: var(--text); }
.donut-label { font: 500 .66rem var(--font); fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .84rem; min-width: 150px; flex: 1; }
.legend li { display: flex; align-items: center; gap: 9px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-inline-start: auto; font-family: var(--font-num); font-weight: 600; color: var(--text-2); white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--text-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 12px; height: 3px; border-radius: 2px; }
.legend-row i.box { height: 10px; width: 10px; border-radius: 3px; }
.spark { display: block; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .86rem; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hb-bar i { display: block; height: 100%; border-radius: inherit; }
.hb-value { font-family: var(--font-num); font-size: .82rem; }

.log { margin: 0; max-height: 460px; overflow: auto; padding: 14px 16px; border-radius: 12px; background: #10131f; color: #cdd6e4; direction: ltr; text-align: left;
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.log .l-error { color: #f87171; } .log .l-warning { color: #fbbf24; } .log .l-info { color: #93c5fd; } .log .l-time { color: #64748b; }
.log mark { background: rgba(251, 191, 36, .3); color: inherit; border-radius: 3px; }

.event { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.event.dim { opacity: .62; }
.event-rank { text-align: center; min-width: 76px; }
.event-rank b { display: block; font: 700 1.2rem var(--font-num); }
.event-rank span { color: var(--muted); font-size: .72rem; }
.event-body { flex: 1; min-width: 0; }
.event-body h4 { margin: 0; font-size: .98rem; }
.event-body p { margin: 6px 0 0; color: var(--text-2); font-size: .82rem; }

.mon-card { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); position: relative; }
.mon-card.win { border-inline-start: 3px solid var(--success); } .mon-card.lose { border-inline-start: 3px solid var(--danger); }
.mon-card + .mon-card { margin-top: 10px; }
.troops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.troop { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .8rem; white-space: nowrap; }
[dir="rtl"] .troop { padding: 3px 4px 3px 10px; }
.troop .gi { --gi: 24px; border-radius: 50%; }
.troop b { font-family: var(--font-num); }

/* the Throne's table: its views, search and sort above it, its columns sortable */
.th-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.th-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.th-search { flex: 1 1 220px; min-width: 200px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted); }
.th-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.th-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.th-sort { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; }
.th-sort select.input { width: auto; min-height: 36px; padding: 4px 10px; }
.th-table th.sortable { cursor: pointer; user-select: none; }
.th-table th.sortable:hover { color: var(--text); }
.th-table th.sortable.on { color: var(--accent); }
.th-table th .arrow { font-size: .7rem; }
.th-sub { font-size: .76rem; margin-top: 2px; }
.th-why { white-space: normal; max-width: 22rem; font-size: .78rem; margin-top: 2px; }
.th-rich { color: var(--success); }
.th-poor { color: var(--muted); font-weight: 600; }
.th-sent { color: var(--success); font-weight: 600; white-space: nowrap; }
.th-short { color: var(--warning); }
.th-pager { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#thRows.loading { opacity: .55; transition: opacity .15s; }

/* the captains picked by name, in their order */
.lp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lp-list li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.lp-list li .gi { --gi: 38px; border-radius: 11px; }
.lp-rank { width: 24px; height: 24px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); font: 700 .74rem var(--font-num); }
.lp-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lp-acts { display: inline-flex; gap: 2px; }
.lp-acts .icon-btn { width: 30px; height: 30px; }
.lp-acts .icon-btn[disabled] { opacity: .35; cursor: default; }
.lp-empty { padding: 14px; border: 1px dashed var(--border-strong); border-radius: 12px; text-align: center; }
.lp-pool .chip-check span b.num:first-child { color: var(--accent); }

/* the chat page */
.chat-status { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.chat-status .ok-chip { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); background: var(--success-soft); }
.chat-note { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; font-size: .84rem; border: 1px solid var(--border); background: var(--surface); }
.chat-note.warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.chat-note.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.chat-note.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.chat-select-wrap { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.chat-select { min-height: 34px; padding: 4px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); font-size: .84rem; color: var(--text); max-width: 15rem; }
.chat-shell { display: grid; grid-template-columns: minmax(270px, 350px) minmax(0, 1fr); height: calc(100vh - 250px); min-height: 520px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
@supports (height: 100dvh) { .chat-shell { height: calc(100dvh - 250px); } }
.chat-side { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-inline-end: 1px solid var(--border); background: var(--surface-2); }
.chat-side-head { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.chat-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted); }
.chat-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.chat-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.chat-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-filter { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: transparent;
  color: var(--text-2); font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chat-filter span { font: 700 .7rem var(--font-num); padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chat-filter.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.chat-filter.on span { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); color: inherit; }
.chat-list { flex: 1; overflow-y: auto; padding: 6px; min-height: 0; }
.chat-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: center; width: 100%; padding: 10px; border: 0;
  border-radius: 13px; background: transparent; cursor: pointer; text-align: start; transition: background .15s; }
.chat-item + .chat-item { margin-top: 2px; }
.chat-item:hover { background: var(--surface-hover); }
.chat-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .chat-item.active { box-shadow: inset -3px 0 0 var(--accent); }
.chat-item-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chat-item-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-item-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
.chat-item.unread .chat-item-name b { color: var(--text); }
.chat-item-last { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item.unread .chat-item-last { color: var(--text-2); font-weight: 600; }
.chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font: .7rem var(--font-num); color: var(--muted); white-space: nowrap; }
.chat-tag { font-style: normal; font-size: .66rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); flex: none; }
.chat-unread { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 700 .7rem var(--font-num); direction: ltr; }
.chat-unread.quiet { background: var(--neutral-soft); color: var(--text-2); }
/* 15.11: the search inside the messages — the conversations that match by name, then the messages found, each with
   who wrote it, where, when, and its text around the word (marked) */
.chat-found-head { display: flex; align-items: center; gap: 6px; margin: 10px 4px 4px; padding: 0 6px; color: var(--muted); font-size: .74rem; }
.chat-found-head:first-child { margin-top: 2px; }
.chat-found-head b { font-weight: 700; color: var(--text-2); }
.chat-found-head span { font: 700 .68rem var(--font-num); padding: 0 6px; border-radius: 999px; background: var(--surface-2); direction: ltr; }
.chat-found-note { margin: 2px 4px 6px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: .78rem; line-height: 1.7; background: var(--surface-2); }
.chat-hit { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px; background: transparent;
  cursor: pointer; text-align: start; transition: background .15s; }
.chat-hit + .chat-hit { margin-top: 2px; }
.chat-hit:hover { background: var(--surface-hover); }
.chat-hit.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .chat-hit.active { box-shadow: inset -3px 0 0 var(--accent); }
.chat-hit-top { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: .8rem; }
.chat-hit-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-hit-top .chat-tag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
.chat-hit-time { margin-inline-start: auto; flex: none; font: .7rem var(--font-num); color: var(--muted); white-space: nowrap; }
.chat-hit-text { color: var(--text-2); font-size: .8rem; line-height: 1.6; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chat-hit-text mark { background: rgba(251, 191, 36, .42); color: inherit; border-radius: 3px; padding: 0 1px; }
.chat-found-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; font-size: .78rem;
  color: var(--text-2); background: var(--info-soft); border-bottom: 1px solid var(--border); }
.chat-found-bar[hidden] { display: none; }
.chat-found-bar > span { text-align: center; line-height: 1.7; }
.chat-found-bar > span svg { vertical-align: -2px; }
.chat-msg.found .chat-bubble { box-shadow: 0 0 0 2px rgba(251, 191, 36, .9), var(--shadow); }
.chat-admin.found { border: 1px solid rgba(251, 191, 36, .9); }
.chat-avatar { --h: 220; position: relative; flex: none; width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: .02em;
  background: hsl(var(--h) 52% 50%); }
.chat-avatar.sm { width: 38px; height: 38px; border-radius: 13px; font-size: .85rem; }
.chat-kind { position: absolute; bottom: -4px; inset-inline-end: -4px; width: 19px; height: 19px; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface-solid); color: var(--text-2); border: 1px solid var(--border); }
.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-main.idle .chat-head, .chat-main.idle .chat-compose { display: none; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-head-text h3 { margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-text p { margin: 1px 0 0; color: var(--muted); font-size: .78rem; }
.chat-head-actions { display: flex; gap: 6px; }
.chat-back { display: none; }
.chat-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 14px clamp(12px, 3vw, 30px) 18px; display: flex; flex-direction: column; background: var(--bg); }
.chat-welcome, .chat-loading { margin: auto; text-align: center; color: var(--muted); max-width: 34ch; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chat-loading { width: min(420px, 90%); }
.chat-welcome .ic { color: var(--accent); opacity: .8; }
.chat-welcome b { color: var(--text); font-size: 1.05rem; }
.chat-welcome p { margin: 0; font-size: .86rem; line-height: 1.7; }
.chat-more { align-self: center; margin-bottom: 6px; display: flex; flex-direction: column; align-items: center; }
.chat-day { align-self: center; margin: 14px 0 6px; position: sticky; top: 0; z-index: 1; }
.chat-day span { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .72rem; font-weight: 600; color: var(--text-2);
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow); }
.chat-admin { align-self: center; display: flex; gap: 6px; align-items: flex-start; max-width: min(85%, 640px); margin: 8px 0; padding: 7px 12px;
  border-radius: 12px; font-size: .78rem; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: min(78%, 700px); margin-top: 10px; animation: msgIn .22s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.chat-msg.cont { margin-top: 3px; }
.chat-msg.theirs { align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-face, .chat-face-gap { --h: 220; flex: none; width: 30px; height: 30px; border-radius: 10px; }
.chat-face { display: grid; place-items: center; color: #fff; font-size: .72rem; font-weight: 700; background: hsl(var(--h) 52% 50%); }
.chat-bubble { position: relative; min-width: 0; padding: 8px 12px 5px; border-radius: 17px; background: var(--surface-solid); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); }
.chat-msg.theirs:not(.cont) .chat-bubble { border-start-start-radius: 6px; }
.chat-msg.mine .chat-bubble { color: var(--accent-ink); border-color: transparent; background: var(--accent); }
.chat-msg.mine:not(.cont) .chat-bubble { border-start-end-radius: 6px; }
.chat-sender { --h: 220; font-size: .76rem; font-weight: 700; color: hsl(var(--h) 58% 46%); margin-bottom: 2px; }
:root[data-theme="dark"] .chat-sender { color: hsl(var(--h) 70% 70%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .chat-sender { color: hsl(var(--h) 70% 70%); } }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; line-height: 1.65; font-size: .95rem; }
.chat-file { display: flex; align-items: center; gap: 6px; font-size: .84rem; opacity: .9; }
.chat-tr { margin-top: 7px; padding: 6px 10px 7px; border-radius: 11px; background: var(--accent-soft); border-inline-start: 3px solid var(--accent); font-size: .9rem; }
.chat-tr.pending { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .76rem; background: var(--surface-2); border-color: var(--border-strong); }
.chat-tr-text { white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; line-height: 1.65; }
.chat-tr-label { display: flex; align-items: center; gap: 5px; font-size: .68rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.chat-msg.mine .chat-tr { background: color-mix(in srgb, currentColor 14%, transparent); border-color: color-mix(in srgb, currentColor 55%, transparent); }
.chat-msg.mine .chat-tr-label { color: inherit; opacity: .85; }
.chat-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 2px; font: .66rem var(--font-num); color: var(--muted); }
.chat-msg.mine .chat-foot { color: inherit; opacity: .78; }
.chat-tools { display: inline-flex; gap: 2px; margin-inline-end: auto; opacity: 0; transition: opacity .15s; }
.chat-msg:hover .chat-tools, .chat-msg:focus-within .chat-tools { opacity: 1; }
@media (hover: none) { .chat-tools { opacity: .7; } }
.chat-tool { width: 24px; height: 22px; display: inline-grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: inherit; cursor: pointer; }
.chat-tool:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.chat-coord { display: inline-flex; align-items: center; gap: 4px; margin: 0 2px; padding: 1px 8px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--info-soft); color: var(--info); font: 600 .78rem var(--font-num); vertical-align: baseline; }
.chat-msg.mine .chat-coord { background: color-mix(in srgb, currentColor 18%, transparent); color: inherit; }
.chat-chip { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; }
.chat-jump { position: absolute; z-index: 3; inset-inline-end: 22px; bottom: 112px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
  border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: .8rem; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-lg); }
.chat-jump[hidden] { display: none; }
.chat-compose { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-compose-row { display: flex; align-items: flex-end; gap: 10px; }
.chat-input { flex: 1; min-width: 0; min-height: 46px; max-height: 160px; resize: none; padding: 11px 14px; border-radius: 15px; border: 1px solid var(--border-strong);
  background: var(--surface-solid); color: var(--text); outline: none; line-height: 1.55; unicode-bidi: plaintext; text-align: start; }
.chat-input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.chat-input:disabled { opacity: .6; cursor: not-allowed; }
.chat-send { flex: none; width: 46px; height: 46px; border-radius: 13px; border: 0; display: grid; place-items: center; cursor: pointer; color: var(--accent-ink);
  background: var(--accent); transition: transform .1s, filter .15s; }
.chat-send .ic { transform: scaleX(-1); }
.chat-send:hover { filter: brightness(1.07); }
.chat-send:active { transform: translateY(1px); }
.chat-send:disabled { opacity: .5; cursor: not-allowed; }
.chat-send.busy .ic { animation: spin .8s linear infinite; }
.chat-compose-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; font-size: .78rem; color: var(--muted); }
.chat-out { display: inline-flex; align-items: center; gap: 6px; }
.chat-count { font-family: var(--font-num); direction: ltr; unicode-bidi: isolate; }
.chat-count.bad { color: var(--danger); }
.chat-preview { padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); font-size: .86rem; }
.chat-preview[hidden] { display: none; }
.chat-preview-head { display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.chat-preview-head.bad { color: var(--danger); margin: 0; }
.chat-preview-text { white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; }
/* the market posts (04.11): the switch in a clan's or a group's head, its line in the status, its tag in the list */
.chat-mk { display: inline-flex; align-items: center; gap: 6px; }
.chat-mk-icon { font-size: 1rem; line-height: 1; }
.chat-mk .chat-select { max-width: 12rem; }
.chat-tag.mk { background: var(--info-soft); color: var(--info); }
/* 10.11: a conversation the account is no longer in (the clan left): marked, greyed, last in the list */
.chat-tag.left { background: var(--warning-soft); color: var(--warning); }
.chat-item.left { opacity: .62; }
.chat-note.ok { color: var(--success); background: var(--success-soft); border-color: transparent; }
.chat-mk-note { flex-wrap: wrap; }
.chat-mk-text { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.chat-mk-list { margin: 8px 0 0; padding-inline-start: 20px; color: var(--text-2); line-height: 1.7; font-size: .88rem; }
.chat-mk-list li + li { margin-top: 4px; }
/* the switch beside the head's buttons: on a line of their own when the conversation's name would be squeezed out */
.chat-head.with-mk { flex-wrap: wrap; row-gap: 8px; }
.chat-head.with-mk .chat-head-text { flex: 1 1 140px; }
.chat-head.with-mk .chat-head-actions { margin-inline-start: auto; align-items: center; }

/* -- 9. responsive --------------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ent-grid.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); --sb: 284px; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 284px; max-width: 86vw; transform: translateX(110%); transition: transform .26s var(--ease); box-shadow: var(--shadow-lg); height: 100dvh; }
  [dir="ltr"] .sidebar { transform: translateX(-110%); }
  .app.open .sidebar { transform: none; }
  .app.collapsed .brand { justify-content: flex-start; padding: 0 16px; }
  .app.collapsed .brand-text, .app.collapsed .nav a > span, .app.collapsed .sys-mini > span:not(.dot) { display: revert; }
  .app.collapsed .nav-label { height: auto; padding: 14px 10px 6px; margin: 0; background: none; color: var(--muted); }
  .app.collapsed .nav-label:first-child { display: block; padding-top: 4px; }
  .app.collapsed .nav a { justify-content: flex-start; padding: 8px 10px; }
  .app.collapsed .nav .nav-count { position: static; min-width: 20px; padding: 1px 7px; font-size: .7rem; }
  .collapse-btn { display: none !important; }
  .backdrop { position: fixed; inset: 0; z-index: 25; background: var(--scrim); }
  .app.open .backdrop { display: block; }
  .menu-btn { display: inline-grid; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .search-btn { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-btn .label, .search-btn kbd { display: none; }
}
@media (max-width: 860px) {
  .chat-page .page-head p { display: none; }
  .chat-page .page-head { margin-bottom: 12px; }
  .chat-shell { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 200px); min-height: 460px; }
  @supports (height: 100dvh) { .chat-shell { height: calc(100dvh - 200px); } }
  .chat-shell.has-open .chat-side { display: none; }
  .chat-shell:not(.has-open) .chat-main { display: none; }
  .chat-side { border-inline-end: 0; }
  .chat-back { display: inline-grid; }
  .chat-msg { max-width: 90%; }
  .chat-jump { bottom: 120px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar { padding: 8px 14px; gap: 8px; --top: 56px; min-height: 56px; }
  .topbar .crumb, .live .label { display: none; }
  .live { padding: 0 10px; }
  .topbar > div:nth-child(2) { min-width: 0; }
  .topbar h1 { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content { padding: 16px 14px 64px; }
  .page-head { margin-bottom: 16px; }
  .page-head h2 { font-size: 1.28rem; }
  .page-actions { width: 100%; }
  .page-actions > .btn.primary:only-child { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px; } .kpi-value { font-size: 1.28rem; } .kpi-spark { display: none; }
  .card-head { padding: 14px 14px 0; } .card-body { padding: 12px 14px 14px; }
  .plan-card { grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; padding: 12px; }
  .plan-card > .drag-handle { position: absolute; top: 8px; inset-inline-end: 6px; height: 28px; }
  .plan-card > .plan-art { width: 60px; height: 52px; } .plan-art .gi { --gi: 56px; --gi-h: 44px; }
  .plan-tools { grid-column: 1 / -1; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--border); }
  .tasks, .target-grid, .event-grid { grid-template-columns: minmax(0, 1fr); }
  .task-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hbars li { grid-template-columns: minmax(90px, 40%) 1fr auto; }
  .toasts { inset-inline-start: 12px; bottom: 12px; width: calc(100vw - 24px); }
  .event-tiles { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ent-grid, .ent-grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .ent-art { height: 92px; } .ent-art .gi { --gi: 74px; } .ent-art .gi-tile { --gi: 60px; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .choice-art { height: 96px; } .choice-art .gi { --gi: 116px; --gi-h: 80px; }
  .modal-wrap { padding: 0; place-items: end center; }
  .modal, .modal.sm, .modal.lg, .modal.xl { width: 100%; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0; }
  @supports (height: 100dvh) { .modal, .modal.sm, .modal.lg, .modal.xl { max-height: 92dvh; } }
  .modal footer { border-radius: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal footer .btn { flex: 1 1 auto; }
  .modal footer .foot-note { flex-basis: 100%; }
  .picker-tools, .picker-list, .picker-tray { padding-inline: 14px; }
  .steps li span { display: none; } .steps li.on span { display: inline; }
  .settings > .btn { flex-basis: 100%; max-width: none; }
  .th-tools { align-items: stretch; } .th-sort { flex: 1 1 100%; }
  .tabs { margin-inline: -14px; padding-inline: 14px; }
  .chat-mk .toggle > span:last-child { display: none; }
  .chat-mk .chat-select { max-width: 7rem; }
  .detail-head { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { .badge, .kind, .btn, .card, .kpi, .ent, .choice { border: 1px solid CanvasText; } }
@media print { .sidebar, .topbar, .toasts, .page-actions { display: none !important; } .app { display: block; } .content { padding: 0; } }

/* a captain's chip to tick: his portrait before his name (a hunt plan's leaders) */
.chip-check.hero-check span { padding: 4px 12px 4px 4px; gap: 8px; font-weight: 500; }
[dir="rtl"] .chip-check.hero-check span { padding: 4px 4px 4px 12px; }
.chip-check.hero-check .gi { --gi: 28px; }
.alert > div > b:first-child { display: block; font-size: .9rem; }

/* the events' cards: one on now (not the top bar's .live), its emblem over the banner's edge */
.event-card.is-live { border-color: var(--success-line); box-shadow: 0 0 0 3px var(--success-soft); }
.event-banner { overflow: visible; }
.event-banner > img { border-radius: 0; }
.event-card { isolation: isolate; }

/* the overview's managers: a tile each — what it is, whether it works, what it does now */
.mgr-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.mgr { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: inherit; min-width: 0;
  transition: border-color .14s, box-shadow .14s; }
.mgr:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.mgr-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.mgr.on .mgr-icon { background: var(--accent-soft); color: var(--accent); }
.mgr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.mgr-text b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgr-text small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-orb .gi { border-radius: 0; }

/* six numbers in a row: a row of six, then two of three, then three of two — never one left alone */
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1320px) { .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tasks > .empty { grid-column: 1 / -1; }

/* -- 10. the pages' later pieces, each under its page's prefix ------------------------------------------------ */

/* a setting that is on (a switch among a page's settings) wears the accent's tint, not the primary button's fill */
.settings > .btn.primary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); box-shadow: none; }
.settings > .btn.primary:hover { background: var(--accent-soft); border-color: var(--accent-strong); }
.settings > .btn.primary .ic { color: var(--accent); }

/* the builder (bld-): the three resources stand close in a number's card and in a cost's cell */
.bld-res { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 1rem; line-height: 1.6; }
.table td .gi.bld-ic { margin-inline-end: 0; }

/* the research (rs-): the settings' choices (what «فتح الرتب أولاً» covers, what the account fights) as rows — the
   question and its state on one side, the choice on the other */
.rs-opts { flex: 1 1 100%; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rs-opt { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; min-width: 0; max-width: 760px; }
.rs-opt:empty { display: none; }
.rs-opt > div:first-child { flex: 1 1 220px; min-width: 0; }
.rs-opt small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }

/* the reports (rp-): a ranked bar's label with its picture before it (a crypt's building, a monster's face), two
   lines where its column is narrow so a plan's level is never cut; a chart's own name over it */
.rp-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rp-label > span:last-child { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.35; }
.rp-chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 26px; margin-bottom: 8px; }
.rp-chart-head > b { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--text); }

/* the chats (chat2-): the translation's settings under their button — the switch, the language, a line of what it
   does — opening from the head's start so it stays on a phone's screen; a conversation's tag with a picture in it */
.chat2-pop { gap: 12px; padding: 14px; width: min(280px, calc(100vw - 32px)); white-space: normal; cursor: default; inset-inline: 0 auto; }
.chat2-pop .field { gap: 6px; }
.chat2-pop small { line-height: 1.6; font-size: .76rem; }
.chat2-select { width: 100%; max-width: none; }
.chat2-tag { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 640px) { .chat2-lang { display: none; } }

/* the Triumphal Challenge (tr-): five numbers — on a phone's two columns the fifth takes the row */
@media (max-width: 640px) { .tr-kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; } }

/* the analysis (ai-): the verdict on a monster that cannot be won — a badge's look, in words that may take two lines */
.ai-verdict { display: inline-flex; align-items: flex-start; gap: 6px; min-width: 0; padding: 4px 10px; border-radius: 12px; background: var(--danger-soft); color: var(--danger);
  font-size: .76rem; font-weight: 600; line-height: 1.5; }
.ai-verdict .ic { flex: none; margin-top: 3px; }

/* -- 11. after the review on a phone and a laptop ------------------------------------------------------------ */
/* a plan's facts wrap as text (an icon, words and a number in them), never as columns of single words */
.plan-meta > span { display: block; min-width: 0; }
.plan-meta > span > .ic { vertical-align: -2px; margin-inline-end: 4px; }
/* a plan's progress in a word: its percentage first */
.plan-progress .plan-pct { color: var(--text); font-weight: 700; }
/* an event's dot says the bot's part: off while the event runs */
.ev-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
/* a training target: its bar with the percentage beside it, and what holds it back on a line of its own */
.target-bar { display: flex; align-items: center; gap: 10px; }
.target-bar .progress { flex: 1; }
.target-bar b { font: 700 .78rem var(--font-num); color: var(--text-2); min-width: 2.6em; text-align: end; }
.target-note { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--danger-soft);
  color: var(--danger); font-size: .8rem; line-height: 1.5; }
.target-note .ic { flex: none; margin-top: 3px; }
/* the chosen ones kept in sight at the foot of a wizard's step, over the cards that scroll under them */
.picker-tray.sticky { position: sticky; bottom: -18px; z-index: 3; margin: 14px -20px -18px; }
/* a dialog never grows past its screen for what scrolls inside it (a tray of many chosen, a wide table) */
.modal-wrap { grid-template-columns: minmax(0, 1fr); }
.modal { min-width: 0; justify-self: center; }
.modal-body { min-width: 0; }
/* four numbers stand four in a row, or two by two on a narrow page — never three and one left alone */
@media (min-width: 641px) { .kpis:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 641px) and (max-width: 1180px) { .kpis:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  /* a table without a head is a list of facts: its last cell wraps rather than push the table out of its card */
  .table:not(:has(thead)) td:last-child { white-space: normal; min-width: 9rem; }
}

/* -- charts of the game's own pictures (14.11): the Academy's way on the builder's page, the troops' ranks on the
   research's ------------------------------------------------------------------------------------------------- */
/* the Academy's way: what is left in all, then each building under the one that wants it */
.bt-head { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border-radius: var(--radius); background: var(--art-bg); border: 1px solid var(--border); }
.bt-head > .gi { border-radius: 18px; box-shadow: var(--shadow); }
.bt-goal { min-width: 0; flex: 1; }
.bt-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; font-size: 1.06rem; color: var(--text); }
.bt-title .ic, .bt-levels .ic { color: var(--muted); flex: none; }
.bt-for { color: var(--text-2); font-size: .84rem; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.bt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-top: 12px; }
.bt-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bt-stat > span { color: var(--muted); font-size: .72rem; font-weight: 600; }
.bt-stat > b { font: 700 1rem var(--font-num); color: var(--text); display: flex; align-items: center; gap: 6px; }
.bt-stat > small { color: var(--muted); font-size: .72rem; }
.bt-lv { font: 700 .86rem var(--font-num); padding: 2px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.bt-lv.goal { background: var(--accent-soft); color: var(--accent-strong); }
.bt-lv.ok { background: var(--success-soft); color: var(--success); }
.bt-tree, .bt-kids { list-style: none; margin: 0; padding: 0; }
.bt-kids { margin-inline-start: 28px; padding-inline-start: 24px; }
.bt-node { position: relative; padding-top: 10px; }
/* the branch to a building from the one above it: an elbow, and the trunk going on to the next one */
.bt-kids > .bt-node::before { content: ""; position: absolute; inset-inline-start: -24px; top: 0; width: 22px; height: 50px;
  border-inline-start: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong); border-end-start-radius: 12px; }
.bt-kids > .bt-node:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: -24px; top: 50px; bottom: 0; border-inline-start: 2px solid var(--border-strong); }
.bt-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-xs); max-width: 580px; }
.bt-card > .gi { border-radius: 13px; }
.bt-main { min-width: 0; flex: 1; }
.bt-name { font-weight: 700; color: var(--text); }
.bt-levels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.bt-takes { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--text-2); font-size: .78rem; align-items: center; }
.bt-takes > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bt-takes b { color: var(--text); font-weight: 600; }
.bt-warn { margin-top: 6px; color: var(--warning); font-size: .78rem; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.bt-done > .bt-card { background: var(--success-soft); border-color: var(--success-line); box-shadow: none; }
.bt-busy > .bt-card { border-color: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.bt-ready > .bt-card { border-color: var(--accent); box-shadow: var(--ring); }
.bt-seen > .bt-card { border-style: dashed; box-shadow: none; opacity: .75; }
.bt-seen > .bt-card .gi img, .bt-done > .bt-card .gi img { filter: saturate(.75); }

/* the troops' ranks: each group's ranks in a strip, the next one opened below with what it waits for */
.tiers-group { padding: 16px 0; border-top: 1px solid var(--border); }
.tiers-group:first-child { border-top: 0; padding-top: 0; }
.tiers-group:last-child { padding-bottom: 0; }
.tiers-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.tiers-head > .gi { border-radius: 14px; }
.tiers-head h4 { margin: 0; font-size: 1rem; }
.tiers-head p { margin: 2px 0 0; color: var(--text-2); font-size: .84rem; }
.tiers-head > .badge { margin-inline-start: auto; }
.tier-strip { list-style: none; margin: 0; padding: 4px 3px 10px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
.tier { flex: 1 0 86px; min-width: 86px; max-width: 160px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tier-rank { font: 800 1.05rem var(--font-num); color: var(--text-2); letter-spacing: .04em; }
.tier-units { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 30px; width: 100%; }
.tier-units .gi { border-radius: 8px; }
.tier-word { font-size: .74rem; min-height: 1.5rem; display: flex; align-items: center; }
.tier-lock { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tier-open { background: var(--success-soft); border-color: var(--success-line); }
.tier-open .tier-rank { color: var(--success); }
.tier-part { background: var(--info-soft); border-color: var(--info-line); }
.tier-shut .tier-units { filter: grayscale(.85); opacity: .55; }
.tier-now { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.tier-now .tier-rank { color: var(--accent-strong); }
.tier-detail { margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.tier-detail-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.tier-needs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.tier-need { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.tier-need > .gi { border-radius: 10px; }
.tier-need > div { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tier-need span { color: var(--muted); font-size: .72rem; font-weight: 600; }
.tier-need b { font: 700 .98rem var(--font-num); color: var(--text); }
.tier-need small { color: var(--text-2); font-size: .74rem; }
.tier-need.ok { border-color: var(--success-line); }
.tier-need.ok > .ic { color: var(--success); }
.tier-need.no { border-color: var(--warning-line); background: var(--warning-soft); }
.tier-need.no > .ic { color: var(--warning); }
.tier-gates { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tier-gate { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); }
.tier-gate .gi { border-radius: 9px; }
.tier-gate-art { display: inline-flex; gap: 3px; flex: none; }
.tier-gate.wide { grid-column: 1 / -1; }
.tier-gate > div { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tier-gate small { color: var(--muted); font-size: .74rem; }
.tier-gate.done { border-style: solid; border-color: var(--success-line); background: var(--success-soft); }
/* the ranks' way on the research's first section (15.11): the three groups to choose from, one in sight; the next
   rank's gates and what each waits on drawn with the Academy's tree (.bt-*) */
.tiers-pick { display: flex; gap: 8px; margin-bottom: 16px; }
.tiers-tab { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); font: inherit; text-align: start; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.tiers-tab > .gi { border-radius: 11px; flex: none; }
.tiers-tab > span { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tiers-tab b { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiers-tab small { color: var(--text-2); font: 700 .78rem var(--font-num); display: inline-flex; align-items: center; gap: 3px; }
.tiers-tab small .ic { color: var(--muted); }
.tiers-tab:hover { border-color: var(--border-strong); }
.tiers-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tiers-tab.on { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.tiers-tab.on b { color: var(--accent-strong); }
.tier-need-ic { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tier-detail > .card-note { margin: 12px 0 0; }
.tier-detail .bt-tree { margin-top: 2px; }
.rt-units { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.rt-units .gi { border-radius: 7px; }
@media (max-width: 640px) {
  .tiers-pick { gap: 6px; }
  .tiers-tab { flex-direction: column; text-align: center; gap: 4px; padding: 8px 4px; }
  .tiers-tab > span { align-items: center; max-width: 100%; }
  .tiers-tab b { font-size: .82rem; }
  .bt-head { flex-direction: column; align-items: stretch; }
  .bt-head > .gi { align-self: center; }
  .bt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-kids { margin-inline-start: 6px; padding-inline-start: 12px; }
  .bt-kids > .bt-node::before { inset-inline-start: -12px; width: 10px; height: 44px; border-end-start-radius: 8px; }
  .bt-kids > .bt-node:not(:last-child)::after { inset-inline-start: -12px; top: 44px; }
  .bt-card { padding: 8px 10px; gap: 10px; }
  .bt-card > .gi { --gi: 44px !important; }
  .tier { flex-basis: 86px; }
  /* the ranks open already stand narrow on a phone, one unit each: the next one is in sight beside them */
  .tier-open { flex: 0 0 56px; min-width: 56px; padding-inline: 4px; }
  .tier-open .tier-units .gi:nth-child(n+2), .tier-open .tier-word { display: none; }
}

/* the events' personal goals: each event's points against its ladder, a step a reward */
/* What the attack-and-claim way still needs (14.11): each row its words and, where it has one, its switch — beside
   the words on a wide screen, under them on a phone (two buttons beside them left the words a column a word wide) */
.ready-list li { flex-wrap: wrap; }
.ready-list .ready-words { flex: 1 1 220px; }
.ready-list .ready-acts { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
@media (max-width: 640px) { .ready-list .ready-acts { flex-basis: 100%; padding-inline-start: 20px; } }
.goal-today { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: .88rem; }
.goal-today > .ic { color: var(--accent-strong); flex: none; }
.goal-events { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.goal-event { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.goal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.goal-head > b { font-size: .98rem; }
.goal-points { margin-inline-start: auto; color: var(--text-2); font-size: .86rem; white-space: nowrap; }
.goal-points b { font: 700 1rem var(--font-num); color: var(--text); }
.goal-next { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; color: var(--text-2); font-size: .88rem; }
.goal-next > .ic { flex: none; margin-top: 3px; color: var(--muted); }
.goal-steps { list-style: none; margin: 10px 0 0; padding: 2px 2px 8px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.goal-steps li { flex: 0 0 auto; min-width: 84px; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 9px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); text-align: center; position: relative; }
.goal-steps li b { font: 800 .95rem var(--font-num); color: var(--text-2); }
.goal-steps li span { font-size: .72rem; color: var(--muted); line-height: 1.35; }
.goal-steps li .ic { position: absolute; top: 4px; inset-inline-end: 4px; color: var(--success); }
.goal-steps li.done { border-style: solid; border-color: var(--success-line); background: var(--success-soft); }
.goal-steps li.done b { color: var(--success); }
.goal-steps li.ready { border-style: solid; border-color: var(--info-line); background: var(--info-soft); }
.goal-steps li.ready b { color: var(--info); }
@media (max-width: 640px) {
  .goal-points { margin-inline-start: 0; flex-basis: 100%; }
  .goal-steps li { min-width: 76px; }
}
