@property --card-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ============================================================
   CSS Custom Properties — Dark Mode (default) & Light Mode
   ============================================================ */
:root {
  --bg:            #060b14;
  --surface:       #0d1526;
  --surface-2:     #141f35;
  --surface-3:     #1b2843;
  --border:        #1e2e4a;
  --border-light:  #27406a;
  --text:          #dce8fa;
  --text-muted:    #6e8aad;
  --text-faint:    #3a506e;
  --accent:        #2b8fff;
  --accent-hover:  #5aaaff;
  --green:         #3dc98e;
  --yellow:        #f0b429;
  --red:           #e94560;
  --purple:        #9b72cf;
  --teal:          #2ec4b6;
  --orange:        #f4845f;
  --pink:          #e96ca8;
  --amber:         #f5a623;
  --header-h:      72px;
  --radius:        8px;
  --radius-sm:     5px;
  --radius-lg:     12px;
  --shadow:        0 2px 12px rgba(0,15,60,0.55);
  --shadow-lg:     0 6px 32px rgba(0,15,60,0.65);
  --glow:          0 0 24px rgba(43,143,255,0.16);
  --transition:    0.15s ease;
  --font-mono:     'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
}


/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(43,143,255,0.018) 3px, rgba(43,143,255,0.018) 4px),
    radial-gradient(rgba(43,143,255,0.12) 1px, transparent 1px);
  background-size: 100% 4px, 28px 28px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.6;
  padding-top: var(--header-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#app-root { flex: 1 0 auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   Header
   ============================================================ */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: linear-gradient(180deg, #0c1a35 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(43,143,255,0.2), var(--shadow);
  z-index: 1000;
}
.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 20px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.2px;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--accent); text-decoration: none; }

#main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  flex-shrink: 0;
}
.nav-tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
}
.nav-tab:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.nav-tab.active {
  color: var(--accent);
  background: rgba(43,143,255,0.12);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.nav-tab--tool {
  background: rgba(61, 201, 142, 0.12);
  color: var(--green);
  flex-shrink: 0;
}
.nav-tab--tool:hover { color: var(--green); background: rgba(61, 201, 142, 0.2); }
.nav-tab--tool.active { color: var(--green); background: rgba(61, 201, 142, 0.2); }

/* ============================================================
   Header — mobile menu (hamburger + dropdown panel)
   ============================================================ */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* On desktop the panel's children sit inline as normal nav-bar items */
.mobile-nav-panel { display: contents; }
.site-logo           { order: 1; }
#main-nav            { order: 2; }
.global-search-wrap  { order: 3; }
.lang-picker         { order: 4; }
#mods-puzzle-btn     { order: 5; }

@media (max-width: 768px) {
  :root { --header-h: 108px; }

  body.mobile-menu-open { overflow: hidden; }

  .header-inner {
    position: relative;
    flex-wrap: wrap;
    align-content: center;
    gap: 8px;
    padding: 8px 12px;
  }

  .mobile-menu-btn { display: flex; order: 1; }

  .site-logo {
    order: 2;
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
    font-size: 16px;
  }
  .site-logo .logo-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
  }

  .header-inner .global-search-wrap {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .mobile-nav-panel { display: none; }
  .mobile-nav-panel.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    z-index: 999;
    padding: 8px 0;
  }

  .mobile-nav-panel #main-nav {
    display: flex;
    flex-direction: column;
    overflow: visible;
    gap: 0;
  }
  .mobile-nav-panel .nav-tab {
    width: 100%;
    padding: 12px 16px;
    border-radius: 0;
    font-size: 16px;
  }

  .mobile-nav-panel .lang-picker {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
  }
  .mobile-nav-panel .lang-picker-dropdown { left: 16px; right: 16px; width: auto; }

  .mobile-nav-panel #mods-puzzle-btn {
    margin: 8px 16px 0;
    width: calc(100% - 32px);
  }
}

/* ============================================================
   Global search bar (in header)
   ============================================================ */
.global-search-wrap {
  position: relative;
  width: 320px;
  flex-shrink: 0;
}
.global-search-input {
  width: 100%;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.global-search-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.global-search-input::placeholder { color: var(--text-faint); }
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  max-height: 400px;
  overflow-y: auto;
  display: none;
}
.global-search-dropdown.visible { display: block; }
.gs-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  text-decoration: none;
  color: var(--text);
}
.gs-result:last-child { border-bottom: none; }
.gs-result:hover, .gs-result.highlighted { background: var(--surface-2); }
.gs-result.focused { background: rgba(43,143,255,0.14); }
.gs-result-name { flex: 1; font-size: 16px; font-weight: 500; }
.gs-result-type {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  flex-shrink: 0;
}
.gs-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
}

/* Filter search bar inside list views */
.list-filter {
  margin-bottom: 14px;
}
.list-filter-input {
  width: 100%;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color var(--transition);
}
.list-filter-input:focus { border-color: var(--accent); }
.list-filter-input::placeholder { color: var(--text-faint); }

/* Compact filter inside detail-section lists */
.detail-list-filter {
  width: 100%;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.detail-list-filter:focus { border-color: var(--accent); }
.detail-list-filter::placeholder { color: var(--text-faint); }

/* Lab test link panel */
.badge-lab-test   { background: rgba(61, 201, 142, 0.18); color: var(--green); border: 1px solid rgba(61, 201, 142, 0.35); }
.badge-spawns-lab { background: rgba(46, 196, 182, 0.18); color: var(--teal);  border: 1px solid rgba(46, 196, 182, 0.35); }


/* ============================================================
   Loading screen
   ============================================================ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 16px;
  color: var(--text-muted);
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(43,143,255,0.25)); }
  50%       { filter: drop-shadow(0 0 12px rgba(43,143,255,0.60)); }
}
@keyframes pulse-glow-gold {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(212,175,55,0.25)); }
  50%       { filter: drop-shadow(0 0 12px rgba(212,175,55,0.55)); }
}
@keyframes card-border-spin {
  to { --card-angle: 360deg; }
}
@keyframes lethal-pulse {
  0%, 20%, 100% { filter: drop-shadow(0 0 2px rgba(233,69,96,0.35)); }
  10%           { filter: drop-shadow(0 0 8px rgba(233,69,96,0.85)); }
}
@keyframes list-item-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes gradient-liquid {
  from { background-position: 0 0; }
  to   { background-position: 600px 0; }
}

/* ============================================================
   Layout containers
   ============================================================ */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
}
.page-wide {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ============================================================
   Page headers
   ============================================================ */
.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-header p {
  color: var(--text-muted);
  font-size: 16px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 16px;
  padding: 4px 0;
  transition: color var(--transition);
}
.back-link:hover { color: var(--accent); text-decoration: none; }

/* ============================================================
   Icons (sprite sheet)
   ============================================================ */
.game-icon.mod-icon {
  display: inline-block;
  flex-shrink: 0;
  object-fit: contain;
  image-rendering: auto;
  background: none;
}
.game-icon {
  display: inline-block;
  width: 60px;
  height: 60px;
  background-image: url('../assets/icons.png');
  background-repeat: no-repeat;
  flex-shrink: 0;
  image-rendering: pixelated;
}
.game-icon-sm {
  width: 45px;
  height: 45px;
}
.game-icon-lg {
  width: 90px;
  height: 90px;
}
.game-icon-xl {
  width: 114px;
  height: 114px;
}
.no-icon {
  display: inline-block;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

/* ============================================================
   Department filter tabs
   ============================================================ */
.dept-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}
.dept-tab {
  --dept-rgb: 43, 143, 255;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.dept-tab:hover {
  border-color: rgba(var(--dept-rgb), 0.3);
  background: rgba(var(--dept-rgb), 0.08);
  color: rgb(var(--dept-rgb));
}
.dept-tab.active {
  background: rgba(var(--dept-rgb), 0.15);
  border-color: rgba(var(--dept-rgb), 0.3);
  color: rgb(var(--dept-rgb));
}
.dept-tab--icon {
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Diagnostic tool department toggles — same visual language as dept-tab */
.dept-toggle {
  --dept-rgb: 43, 143, 255;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.dept-toggle:hover {
  border-color: rgba(var(--dept-rgb), 0.3);
  background: rgba(var(--dept-rgb), 0.08);
  color: rgb(var(--dept-rgb));
}
.dept-toggle.on {
  background: rgba(var(--dept-rgb), 0.15);
  border-color: rgba(var(--dept-rgb), 0.3);
  color: rgb(var(--dept-rgb));
}

/* Quick-filter toggles (second row, multi-select) */
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.qf {
  padding: 3px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.qf:hover { border-color: var(--accent); color: var(--text); }
.qf.on { background: rgba(43,143,255,0.15); border-color: rgba(43,143,255,0.45); color: var(--accent); box-shadow: 0 1px 6px rgba(43,143,255,0.2); }
.qf.on-green  { background: rgba(61,201,142,0.15);  border-color: rgba(61,201,142,0.4);  color: var(--green); }
.qf.on-yellow { background: rgba(240,180,41,0.15);  border-color: rgba(240,180,41,0.4);  color: var(--yellow); }
.qf.on-red    { background: rgba(233,69,96,0.15);   border-color: rgba(233,69,96,0.4);   color: var(--red); }
.qf.on-purple { background: rgba(155,114,207,0.15); border-color: rgba(155,114,207,0.4); color: var(--purple); }
.qf.on-mod    { background: rgba(180,120,255,0.12); border-color: rgba(180,120,255,0.25); color: #b07cff; }
.qf.on-teal   { background: rgba(46,196,182,0.15);  border-color: rgba(46,196,182,0.4);  color: var(--teal); }
.qf-sep {
  width: 1px;
  height: 18px;
  background: var(--border-light);
  align-self: center;
  flex-shrink: 0;
  margin: 0 2px;
}

/* ============================================================
   Card grid
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
}
.card {
  --dept-rgb: 43, 143, 255;
  background: rgba(var(--dept-rgb), 0.10);
  border: 1px solid rgba(var(--dept-rgb), 0.44);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: visible;
  animation: list-item-in 0.25s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 20) * 15ms);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(var(--dept-rgb), 0.2), 0 4px 14px rgba(0,0,0,0.2);
  border-color: rgba(var(--dept-rgb), 0.5);
  text-decoration: none;
  color: var(--text);
}
.deadly-caution {
  color: var(--yellow);
  font-size: 13px;
  cursor: help;
  line-height: 1;
}
.deadly-caution-fatal {
  color: var(--red);
}
.card:hover,
.card:hover * {
  text-decoration: none;
}
.card:hover::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  padding: 2px;
  background: conic-gradient(
    from var(--card-angle),
    transparent 0deg,
    transparent 265deg,
    rgba(var(--dept-rgb), 0.45) 295deg,
    rgba(255,255,255,0.85)      315deg,
    rgba(var(--dept-rgb), 0.45) 335deg,
    transparent 360deg
  );
  animation: card-border-spin 2.8s linear infinite;
  pointer-events: none;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  flex: 1;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================================
   Badges / pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge[title] { cursor: help; }
.badge-common    { background: rgba(61, 201, 142, 0.15); color: var(--green); }
.badge-uncommon  { background: rgba(240, 180, 41, 0.15); color: var(--yellow); }
.badge-rare      { background: rgba(233, 69, 96, 0.15);  color: var(--red); }
.badge-low       { background: rgba(61, 201, 142, 0.15); color: var(--green); }
.badge-medium    { background: rgba(240, 180, 41, 0.15); color: var(--yellow); }
.badge-high      { background: rgba(233, 69, 96, 0.15);  color: var(--red); }
.badge-none      { background: var(--surface-3); color: var(--text-muted); }
.badge-positive  { background: rgba(61, 201, 142, 0.15); color: var(--green); }
.badge-blue      { background: rgba(74, 158, 255, 0.15); color: var(--accent); }
.badge-purple    { background: rgba(155, 114, 207, 0.15); color: var(--purple); }
.badge-dlc       { background: rgba(155, 114, 207, 0.12); color: var(--purple); border: 1px solid rgba(155, 114, 207, 0.3); }
.badge-green     { background: rgba(61, 201, 142, 0.15); color: var(--green); }
.badge-room-tag      { background: var(--surface-3); color: var(--text-muted); font-size: 0.72rem; }
.badge-room-clinic   { background: rgba(43,143,255,0.12);  color: var(--accent);  border: 1px solid rgba(43,143,255,0.3);  font-size: 0.72rem; }
.badge-room-ward     { background: rgba(240,180,41,0.12);  color: var(--yellow);  border: 1px solid rgba(240,180,41,0.3);  font-size: 0.72rem; }
.badge-room-trauma   { background: rgba(233,69,96,0.12);   color: var(--red);     border: 1px solid rgba(233,69,96,0.3);   font-size: 0.72rem; }
.badge-room-med-lab  { background: rgba(61,201,142,0.12);  color: var(--green);   border: 1px solid rgba(61,201,142,0.3);  font-size: 0.72rem; }
.badge-room-radiology{ background: rgba(155,114,207,0.12); color: var(--purple);  border: 1px solid rgba(155,114,207,0.3); font-size: 0.72rem; }
.badge-room-operating{ background: rgba(46,196,182,0.12);  color: var(--teal);    border: 1px solid rgba(46,196,182,0.3);  font-size: 0.72rem; }
.badge-yellow    { background: rgba(240, 180, 41, 0.15); color: var(--yellow); }
.badge-red       { background: rgba(233, 69, 96, 0.15);  color: var(--red); }

/* Collapse / death symptom warning */
.collapse-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-top: 12px;
  background: rgba(233, 69, 96, 0.08);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--text);
}
.collapse-warning a { color: var(--yellow); font-weight: 600; }
.badge-collapse { background: rgba(240, 180, 41, 0.15); color: var(--yellow); border: 1px solid rgba(240, 180, 41, 0.35); }
.badge-lethal   { background: rgba(233, 69, 96, 0.25); color: var(--red); border: 1px solid rgba(233, 69, 96, 0.5); font-weight: 700; animation: lethal-pulse 4.5s linear infinite; will-change: filter; }

/* Department-specific badge colors */
.badge-dept-emergency           { background: rgba(233, 69, 96, 0.15);   color: var(--red); }
.badge-dept-general-surgery     { background: rgba(74, 158, 255, 0.15);  color: var(--accent); }
.badge-dept-internal-medicine   { background: rgba(61, 201, 142, 0.15);  color: var(--green); }
.badge-dept-orthopedics         { background: rgba(245, 166, 35, 0.15);  color: var(--amber); }
.badge-dept-cardiology          { background: rgba(233, 108, 168, 0.15); color: var(--pink); }
.badge-dept-neurology           { background: rgba(155, 114, 207, 0.15); color: var(--purple); }
.badge-dept-infectious-diseases { background: rgba(140, 210, 55, 0.15);   color: #8cd237; }
.badge-dept-traumatology        { background: rgba(244, 132, 95, 0.15);  color: var(--orange); }
.badge-dept-oncology            { background: rgba(120,144,156,0.15); color: #78909c; border: 1px solid rgba(120,144,156,0.3); }
.badge-dept-diagnostics         { background: rgba(245,127,23,0.15);  color: #f57f17; border: 1px solid rgba(245,127,23,0.3); }
.badge-mod { background: rgba(180, 120, 255, 0.12); color: #b07cff; border: 1px solid rgba(180, 120, 255, 0.25); }
.badge-dept-hematology      { background: rgba(191,26,47,0.15);   color: #bf1a2f; border: 1px solid rgba(191,26,47,0.3); }
.badge-dept-psychiatry      { background: rgba(0,105,92,0.15);    color: #00695c; border: 1px solid rgba(0,105,92,0.3); }
.badge-dept-ent             { background: rgba(51,105,30,0.15);   color: #33691e; border: 1px solid rgba(51,105,30,0.3); }
.badge-dept-gynecology      { background: rgba(194,24,91,0.15);   color: #c2185b; border: 1px solid rgba(194,24,91,0.3); }
.badge-dept-plastic-surgery { background: rgba(126,87,194,0.15);  color: #7e57c2; border: 1px solid rgba(126,87,194,0.3); }
.badge-dept-sexual-health   { background: rgba(216,67,21,0.15);   color: #d84315; border: 1px solid rgba(216,67,21,0.3); }
.badge-dept-urology         { background: rgba(224,184,26,0.15);  color: #e0b81a; border: 1px solid rgba(224,184,26,0.3); }
.badge-dept-ophthalmology   { background: rgba(92,107,192,0.15);  color: #5c6bc0; border: 1px solid rgba(92,107,192,0.3); }
.badge-dept-dentistry       { background: rgba(230,230,240,0.12);  color: #e6e6f0; border: 1px solid rgba(230,230,240,0.3); }
.badge-dept-diabetology     { background: rgba(0,188,212,0.15);   color: #00bcd4; border: 1px solid rgba(0,188,212,0.3); }

/* ============================================================
   Mods banner
   ============================================================ */
.mods-banner {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(7, 25, 22, 0.97);
  border-bottom: 1px solid rgba(0, 176, 155, 0.25);
}
.mods-banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}
.mods-banner-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--text);
  cursor: pointer;
  padding: 10px 0;
  font-size: 14px;
  user-select: none;
}
.mods-banner-header:hover { color: #00b09b; }
.mods-banner-icon { font-size: 16px; flex-shrink: 0; }
.mods-banner-title { font-weight: 600; color: #00b09b; flex-shrink: 0; }
.mods-banner-summary { color: var(--text-muted); font-size: 13px; }
.mods-banner-chevron {
  color: var(--text-muted);
  transition: transform var(--transition);
  font-size: 20px;
  flex-shrink: 0;
}
.mods-banner-chevron.open { transform: rotate(180deg); }
.mods-banner-body {
  display: none;
  padding-bottom: 12px;
}
/* The banner is sticky, so it can never scroll out of the way — if the open list
   is taller than the viewport its bottom is unreachable. Cap it and scroll inside.
   Budget: header + banner header row (~40px) + body padding + a strip of page below. */
.mods-banner-body.open {
  display: block;
  max-height: calc(100vh - var(--header-h) - 92px);
  max-height: calc(100dvh - var(--header-h) - 92px);
  overflow-y: auto;
  overflow-x: hidden; /* overflow-y:auto would otherwise compute overflow-x to auto too */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.mods-banner-header .mods-all-btn { margin-left: auto; }
.mods-all-btn {
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid rgba(0, 176, 155, 0.5);
  background: rgba(0, 176, 155, 0.12);
  color: #00b09b;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.mods-all-btn:hover {
  background: rgba(0, 176, 155, 0.22);
  border-color: rgba(0, 176, 155, 0.8);
}
.mods-all-btn--disable {
  border-color: rgba(233, 69, 96, 0.5);
  background: rgba(233, 69, 96, 0.1);
  color: #e94560;
}
.mods-all-btn--disable:hover {
  background: rgba(233, 69, 96, 0.2);
  border-color: rgba(233, 69, 96, 0.8);
}
.mods-banner-mods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

@media (max-width: 768px) {
  .mods-banner-inner { padding: 0 12px; }
  .mods-all-btn--disable { display: none; }
  .mods-banner-chevron { margin-left: auto; }
  .mods-banner-mods { gap: 6px; }
}
.mod-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mod-card--unlocalised .mod-card-info,
.mod-card--unlocalised .mod-steam-btn,
.mod-card--unlocalised .mods-toggle {
  opacity: 0.6;
  filter: saturate(0.5);
}
.mod-lang-warn {
  font-size: 13px;
  color: #f5a623;
  cursor: help;
  flex-shrink: 0;
  line-height: 1;
}
.mod-conflict-icon {
  font-size: 14px;
  cursor: help;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,68,68,0.1);
  border: 1px solid rgba(255,68,68,0.3);
  color: #ff4444;
  line-height: 1;
  white-space: nowrap;
}
.mod-card--conflicted {
  opacity: 0.65;
  border-color: rgba(255,68,68,0.25);
}
.mod-card-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mod-card-name { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-card-author { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mod-steam-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  background: rgba(28, 57, 78, 0.7);
  color: #c7d5e0;
  text-decoration: none;
  border: 1px solid #3d6f8e;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.mod-steam-btn:hover:not(.mod-steam-btn--disabled) {
  background: rgba(28, 57, 78, 1);
  border-color: #6ba3c5;
  color: #e8f1f8;
}
.mod-steam-btn--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Toggle switch */
.mods-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}
.mods-toggle-track {
  width: 36px;
  height: 20px;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}
.mods-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}
.mods-toggle.on { color: #00b09b; }
.mods-toggle.on .mods-toggle-track {
  background: rgba(0, 176, 155, 0.25);
  border-color: rgba(0, 176, 155, 0.6);
}
.mods-toggle.on .mods-toggle-thumb {
  background: #00b09b;
  transform: translateX(16px);
}

/* Mobile mod cards. Must sit after the .mod-card / .mods-toggle base rules above —
   same specificity, so source order decides. Cards keep the desktop stacked layout
   (name/author, then actions below): a side-by-side row leaves too little width for
   the Steam link and toggle once a long mod name or a language warning is present,
   and the toggle ends up clipped past the right edge. */
@media (max-width: 768px) {
  .mod-card { min-width: 0; }
  .mod-card-actions { row-gap: 8px; }
  .mods-toggle, .mod-steam-btn { min-height: 32px; }
}

/* Puzzle icon button in main header (shown when banner is hidden) */
.mods-puzzle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0 9px;
  height: 36px;
  font-size: 16px;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.mods-puzzle-count {
  font-size: 12px;
  font-weight: 600;
  color: #00b09b;
  white-space: nowrap;
}
.mods-puzzle-btn:hover {
  background: var(--surface-3);
  border-color: rgba(0, 176, 155, 0.5);
}
.mods-puzzle-btn.active {
  background: rgba(0, 176, 155, 0.12);
  border-color: rgba(0, 176, 155, 0.5);
  color: #00b09b;
}
@keyframes mod-puzzle-appear {
  0%   { transform: scale(0.4); opacity: 0; }
  55%  { transform: scale(1.28); opacity: 1; }
  80%  { transform: scale(0.92); }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes mod-puzzle-flash {
  0%   { box-shadow: 0 0 0 0   rgba(0, 176, 155, 0.75); }
  65%  { box-shadow: 0 0 0 9px rgba(0, 176, 155, 0); }
  100% { box-shadow: 0 0 0 0   rgba(0, 176, 155, 0); }
}
@keyframes mod-puzzle-shrink {
  0%   { transform: scale(1);    opacity: 1; }
  20%  { transform: scale(1.08); }
  100% { transform: scale(0.3);  opacity: 0; }
}
@keyframes banner-slide-down {
  from { clip-path: inset(0 0 100% 0); opacity: 0.5; }
  to   { clip-path: inset(0 0   0% 0); opacity: 1;   }
}
@keyframes banner-slide-up {
  from { clip-path: inset(0 0   0% 0); opacity: 1;   }
  to   { clip-path: inset(0 0 100% 0); opacity: 0.5; }
}
.mods-puzzle-btn.animate {
  animation: mod-puzzle-appear 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
             mod-puzzle-flash  0.75s ease-out 0.18s;
}
.mods-puzzle-btn.shrink {
  animation: mod-puzzle-shrink 0.22s ease-in forwards;
}
.mods-banner.banner-entering {
  animation: banner-slide-down 0.28s cubic-bezier(0.2, 0, 0.38, 1) forwards;
}
.mods-banner.banner-leaving {
  animation: banner-slide-up 0.22s ease-in forwards;
  pointer-events: none;
}

/* ============================================================
   List view (symptoms, exams, treatments)
   ============================================================ */
.entity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.entity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-left: 13px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition), border-left-color var(--transition);
  cursor: pointer;
  animation: list-item-in 0.2s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 20) * 28ms);
}
.entity-row:last-child { border-bottom: none; }
.entity-row:nth-child(even) { background: rgba(255,255,255,0.025); }
.entity-row:hover {
  background: var(--surface-2);
  border-left-color: var(--accent);
  text-decoration: none;
  color: var(--text);
}
.entity-row-name {
  flex: 1;
  font-weight: 500;
  font-size: 16px;
}
.entity-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .entity-row-meta { display: none; }
}

/* ============================================================
   Detail page
   ============================================================ */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-top: 20px;
  padding-bottom: 20px;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(43,143,255,0.06) 0%, transparent 60%);
}
.detail-icon-wrap {
  flex-shrink: 0;
  background: radial-gradient(circle at center, rgba(43,143,255,0.22) 0%, rgba(43,143,255,0.06) 55%, transparent 75%);
  border-radius: var(--radius-lg);
  padding: 10px;
  border: 1px solid rgba(43,143,255,0.18);
  box-shadow: 0 0 24px rgba(43,143,255,0.12);
}
.detail-title-block { flex: 1; }
.detail-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.detail-payout-label {
  font-size: 13px;
  color: var(--text-muted);
}
.detail-description {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 1100px;
}

.detail-section {
  margin-bottom: 24px;
}
.detail-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 12px;
  padding: 7px 32px 7px 12px;
  border-left: 3px solid var(--accent);
  border-bottom: none;
  background: linear-gradient(90deg, rgba(43,143,255,0.12) 0%, transparent 80%);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 100%, 0 100%);
  font-family: var(--font-mono);
}

/* ============================================================
   Symptom probability table
   ============================================================ */
.sym-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 16px;
}
.sym-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.sym-th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sym-th-sortable:hover { color: var(--text); }
.sym-th-sortable.active { color: var(--accent); }
.sort-icon { opacity: 0.4; font-style: normal; }
.sym-th-sortable.active .sort-icon { opacity: 1; }
.sym-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.sym-table tr:last-child td { border-bottom: none; }
.sym-table tbody tr {
  animation: list-item-in 0.2s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 20) * 20ms);
}
.sym-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
.sym-table tr:hover td,
.sym-table tbody tr:nth-child(even):hover td { background: rgba(43,143,255,0.07); }
.sym-table .prob-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prob-track {
  flex: 1;
  height: 5px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  max-width: 80px;
  border: 1px solid rgba(43,143,255,0.1);
}
.prob-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(43,143,255,0.6), var(--accent));
  box-shadow: 0 0 6px rgba(43,143,255,0.5);
}
.prob-fill.high   { background: linear-gradient(90deg, rgba(61,201,142,0.6), var(--green));   box-shadow: 0 0 6px rgba(61,201,142,0.5); }
.prob-fill.medium { background: linear-gradient(90deg, rgba(240,180,41,0.6), var(--yellow));  box-shadow: 0 0 6px rgba(240,180,41,0.4); }
.prob-fill.low    { background: linear-gradient(90deg, rgba(233,69,96,0.6), var(--red));      box-shadow: 0 0 6px rgba(233,69,96,0.5); }
.prob-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  min-width: 32px;
  text-align: right;
}
/* Inline exam/treatment chips inside the symptoms table */
.sym-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.sym-inline-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 16px 2px 6px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition);
}
.sym-inline-chip:hover { background: var(--border-light); color: var(--accent); text-decoration: none; }

.main-sym-indicator {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: middle;
  title: "Main symptom";
}

/* ============================================================
   Linked items list (exams/treatments in detail)
   ============================================================ */
.linked-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.linked-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
  animation: list-item-in 0.18s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 20) * 25ms);
}
.linked-item:last-child { border-bottom: none; }
.linked-item:nth-child(even) { background: rgba(255,255,255,0.025); }
.linked-item:hover {
  background: rgba(43,143,255,0.07);
  text-decoration: none;
  color: var(--text);
}
.linked-item-name { flex: 1; font-weight: 500; }
.linked-item-meta { color: var(--text-muted); font-size: 14px; }

/* ============================================================
   Stats row (for detail pages)
   ============================================================ */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 2px solid rgba(43,143,255,0.5);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 120px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}
.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
}

/* ============================================================
   Search page
   ============================================================ */
.search-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}
.search-bar-wrap {
  margin-bottom: 20px;
}
.search-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.search-input {
  flex: 1;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 18px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-faint); }
.search-type-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.type-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.type-btn:hover { border-color: var(--accent); color: var(--accent); }
.type-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #1a6fd4 100%);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(43,143,255,0.35);
}

.search-results { margin-top: 8px; }
.search-section { margin-bottom: 20px; }
.search-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.search-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
  font-size: 18px;
}

/* ============================================================
   Diagnostic Tool
   ============================================================ */
.diag-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 20px;
}
@media (max-width: 768px) {
  .diag-layout { grid-template-columns: 1fr; }
  .diag-tool-wrap .badge,
  .diag-tool-wrap .candidate-badges,
  .diag-tool-wrap .exam-reco-top-badge {
    display: none;
  }
}

.patient-sidebar {
  background: rgba(13,21,38,0.97);
  border: 1px solid rgba(43,143,255,0.14);
  border-radius: var(--radius);
  overflow: hidden;
}
.patient-sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.patient-list { list-style: none; }
.patient-item {
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background var(--transition);
}
.patient-item:last-child { border-bottom: none; }
.patient-item:hover { background: var(--surface-2); }
.patient-item.active { background: rgba(43,143,255,0.1); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.patient-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-delete {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 17px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color var(--transition);
  flex-shrink: 0;
}
.patient-delete:hover { color: var(--red); }
.add-patient-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.add-patient-btn:hover { background: var(--surface-2); }

.diag-main > .diag-panel:first-child { position: relative; z-index: 2; }

.diag-tool-wrap {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.diag-tool-wrap .diag-layout {
  padding: 0;
  margin: 0;
  max-width: none;
}
.diag-panel {
  background: rgba(13,21,38,0.97);
  border: 1px solid rgba(43,143,255,0.14);
  border-radius: var(--radius);
  /* overflow visible so dropdowns inside can extend beyond the panel */
}
.diag-panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, rgba(43,143,255,0.07) 0%, transparent 65%);
  box-shadow: inset 3px 0 0 rgba(43,143,255,0.5);
}
.diag-panel-body { padding: 14px; }

.dept-disable-all-btn {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.dept-disable-all-btn:hover:not(:disabled) {
  border-color: rgba(233,69,96,0.55);
  color: var(--red);
}
.dept-disable-all-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.dept-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dept-toggle {
  --dept-rgb: 43, 143, 255;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.dept-toggle:hover {
  border-color: rgba(var(--dept-rgb), 0.55);
  color: rgb(var(--dept-rgb));
}
.dept-toggle.on {
  background: rgba(var(--dept-rgb), 0.18);
  border-color: rgba(var(--dept-rgb), 0.6);
  color: rgb(var(--dept-rgb));
  box-shadow: 0 1px 6px rgba(var(--dept-rgb), 0.2);
}

.symptom-picker {
  position: relative;
}
.symptom-search {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  outline: none;
  margin-bottom: 8px;
}
.symptom-search:focus { border-color: var(--accent); }
.symptom-search::placeholder { color: var(--text-faint); }
.symptom-dropdown {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  max-height: 240px;
  overflow-y: auto;
}
.symptom-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.symptom-option:last-child { border-bottom: none; }
.symptom-option:hover { background: var(--surface-2); }
.symptom-option.focused { background: rgba(43,143,255,0.14); outline: none; }

.confirmed-symptoms {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 40px;
}
.confirmed-symptom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(61, 201, 142, 0.08);
  border: 1px solid rgba(61, 201, 142, 0.25);
  border-radius: var(--radius-sm);
  font-size: 16px;
}
.confirmed-symptom-name { flex: 1; }
.remove-symptom {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 17px;
  padding: 0 4px;
  margin-left: 8px;
  cursor: pointer;
  transition: color var(--transition);
}
.remove-symptom:hover { color: var(--red); }

.exam-list-diag {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exam-item-diag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
}
.exam-item-diag-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}
.exam-item-diag-name { flex: 1; font-weight: 500; }
.exam-sym-picker {
  padding: 6px 10px 8px;
  border-top: 1px solid var(--border);
  background: var(--surface-3);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.found-syms-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.found-sym-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: rgba(61,201,142,0.15);
  border: 1px solid rgba(61,201,142,0.3);
  border-radius: 20px;
  font-size: 13px;
  color: var(--green);
}
.found-sym-remove {
  background: none;
  border: none;
  color: var(--green);
  font-size: 12px;
  cursor: pointer;
  padding: 0 0 0 2px;
  line-height: 1;
}
.found-sym-remove:hover { color: var(--red); }
.none-found-tag { background: rgba(233,69,96,0.12); border-color: rgba(233,69,96,0.35); color: var(--red); min-height: 45px; }
.none-found-tag .found-sym-remove { color: var(--red); }
.no-sym-label { color: var(--red); font-style: italic; }
.add-sym-btn {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.add-sym-btn:hover { border-color: var(--accent); color: var(--accent); }
.exam-sym-picker { width: 100%; }
.sym-dropdown-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.sym-dropdown-filter {
  width: 100%;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.sym-dropdown-filter:focus { border-color: var(--accent); }

.patient-name-input {
  width: 100%;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 17px;
  outline: none;
  transition: border-color var(--transition);
}
.patient-name-input:focus { border-color: var(--accent); }
.patient-name-input::placeholder { color: var(--text-faint); }

/* Inline patient name in sidebar */
.patient-name-inline {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 2px 0;
  cursor: default;
  transition: border-color var(--transition);
}
.patient-item.active .patient-name-inline { cursor: text; }
.patient-item.active .patient-name-inline:focus { border-bottom-color: var(--accent); }
.patient-name-inline::placeholder { color: var(--text-faint); }

/* Unified exam + symptom table */
.unified-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* overflow: visible so dropdowns inside can extend beyond the list */
}
.unified-list-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.unified-col-header { padding: 10px 14px; }
.unified-col-header:first-child { border-right: 1px solid var(--border); }
.unified-col-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.unified-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border);
}
.unified-row:hover .unified-cell { background: rgba(255,255,255,0.025); }
.unified-cell {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 52px;
}
.unified-cell:first-child { border-right: 1px solid var(--border); }
.unified-cell.sym-cell { align-items: flex-start; padding-top: 12px; }
.exam-row-name { font-weight: 500; flex: 1; min-width: 0; }
.sym-row-name { font-weight: 500; }

/* Recommendations */
.reco-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 900px) { .reco-section { grid-template-columns: 1fr; } }
.reco-section > div { display: flex; flex-direction: column; }

.candidate-impossible {
  border-color: rgba(233, 69, 96, 0.4);
  background: rgba(233, 69, 96, 0.06);
  animation: lethal-pulse 4.5s linear infinite;
  will-change: filter;
}
.candidate-impossible .candidate-name { color: var(--red); font-style: italic; }

.candidate-list { display: flex; flex-direction: column; gap: 4px; }
.candidate-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 16px;
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
  animation: list-item-in 0.2s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.candidate-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(43,143,255,0.07);
  border-right: 1px solid rgba(43,143,255,0.12);
  pointer-events: none;
  transition: width 0.4s ease;
}
.candidate-confirmed .candidate-bar {
  background: rgba(212,175,55,0.09);
  border-right-color: rgba(212,175,55,0.18);
}
.candidate-rank {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-faint);
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.candidate-name { flex: 1; font-weight: 500; min-width: 0; }
.candidate-badges { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; align-items: center; }
.candidate-score { font-size: 13px; color: var(--accent); font-weight: 600; flex-shrink: 0; }

.candidate-confirmed {
  background: rgba(212,175,55,0.08);
  border-color: #c8a400;
  animation: list-item-in 0.2s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.candidate-confirmed .candidate-rank { color: #c8a400; }
.candidate-confirmed .candidate-score { color: #c8a400; }
.badge-confirmed {
  background: rgba(212,175,55,0.15);
  border: 1px solid rgba(212,175,55,0.5);
  color: #c8a400;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.reco-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.exam-reco-list { display: flex; flex-direction: column; gap: 6px; }
.exam-reco {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  animation: list-item-in 0.2s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.exam-reco:hover { border-color: rgba(43,143,255,0.45); background: rgba(43,143,255,0.05); }
.exam-reco:first-child {
  border-color: rgba(43,143,255,0.5);
  border-left-color: var(--accent);
  border-left-width: 3px;
  background: rgba(43,143,255,0.07);
  animation: list-item-in 0.2s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.exam-reco.exam-reco-done { opacity: 0.45; cursor: default; }
.exam-reco.exam-reco-done:hover { border-color: var(--border); background: none; }
.exam-reco-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.exam-reco-name { font-weight: 600; flex: 1; font-size: 16px; }
.exam-reco-reason { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-top: 5px; }
.exam-reco-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.reco-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.reco-tag-confirms { background: rgba(61,201,142,0.18);  color: var(--green); }
.reco-tag-unique   { background: rgba(245,166,35,0.18);  color: var(--amber); }
.reco-tag-count    { background: rgba(255,255,255,0.07); color: var(--text-muted); }
.exam-reco-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.reco-found-btn, .reco-none-btn {
  flex: 1;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.reco-found-btn {
  background: rgba(74,158,255,0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.reco-found-btn:hover { background: rgba(74,158,255,0.2); }
.reco-none-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.reco-none-btn:hover { border-color: var(--text-muted); color: var(--text); }
.exam-reco-top-badge {
  font-size: 12px;
  padding: 2px 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Patient details — arrival, care stage, total symptom count */
.pd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 24px;
}
.pd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pd-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.pd-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
}
.pd-tip:hover { color: var(--accent); border-color: var(--accent); }

.pd-segments { display: flex; flex-wrap: wrap; gap: 5px; }
.pd-seg {
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.pd-seg:hover { border-color: rgba(43,143,255,0.5); color: var(--accent); }
.pd-seg.on {
  background: rgba(43,143,255,0.18);
  border-color: rgba(43,143,255,0.6);
  color: var(--accent);
  box-shadow: 0 1px 6px rgba(43,143,255,0.2);
}

.pd-select {
  width: 100%;
  max-width: 280px;
  padding: 5px 30px 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2) no-repeat right 10px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e8aad' stroke-width='1.6'/%3E%3C/svg%3E");
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  outline: none;
}
.pd-select:hover { border-color: rgba(43,143,255,0.5); }
.pd-select:focus { border-color: var(--accent); }
.pd-select option { background: var(--surface-2); color: var(--text); }

.pd-count { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pd-step {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}
.pd-step:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pd-step:disabled { opacity: 0.35; cursor: default; }
.pd-count-input {
  width: 68px;
  height: 30px;
  padding: 0 8px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  outline: none;
}
.pd-count-input:focus { border-color: var(--accent); }
.pd-count-input::placeholder { color: var(--text-faint); font-family: inherit; font-size: 13px; }
.pd-count-clear {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.pd-count-clear:hover:not(:disabled) { border-color: var(--text-muted); color: var(--text); }
.pd-count-clear:disabled { opacity: 0.35; cursor: default; }
.pd-hint { font-size: 13px; color: var(--text-muted); }
.pd-hint-faint { color: var(--text-faint); }
.pd-hint-good  { color: var(--green); }
.pd-hint-warn  { color: var(--yellow); }

/* Candidate diagnosis — expandable symptom breakdown */
@keyframes detail-expand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.candidate-entry { display: flex; flex-direction: column; }
.candidate-entry .candidate-item { cursor: pointer; }
/* Confirmed rows keep their gold tint — hovering must not wash it out. */
.candidate-entry .candidate-item:not(.candidate-confirmed):hover { background: rgba(43,143,255,0.06); }

/* Name + "open its page" link. The wrapper takes the free space so the link
   stays glued to the end of the name instead of drifting out to the badges. */
.cand-name-wrap, .reco-name-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cand-name-wrap .candidate-name,
.reco-name-wrap .exam-reco-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.goto-page {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-faint);
  text-decoration: none;
  transition: all var(--transition);
}
.goto-page:hover {
  color: var(--accent);
  border-color: rgba(43,143,255,0.5);
  background: rgba(43,143,255,0.1);
}
.goto-page:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}
.candidate-item:hover .goto-page,
.exam-reco:hover .goto-page { color: var(--text-muted); }
.candidate-item:hover .goto-page:hover,
.exam-reco:hover .goto-page:hover { color: var(--accent); }
.candidate-entry.open .candidate-item {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.candidate-detail {
  animation: detail-expand 0.16s ease-out;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: rgba(6,11,20,0.5);
  padding: 8px 10px 10px;
}
.candidate-detail-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.cand-sym-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.cand-sym {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border-left: 2px solid transparent;
}
.cand-sym .game-icon { width: 22px; height: 22px; flex-shrink: 0; }
.cand-sym-found   { border-left-color: var(--green); background: rgba(61,201,142,0.07); }
.cand-sym-out     { border-left-color: var(--red);   opacity: 0.5; }
.cand-sym-unknown { border-left-color: var(--border-light); }
.cand-sym-name { flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.cand-sym-name:hover { color: var(--accent); text-decoration: underline; }
.cand-sym-tag { flex-shrink: 0; font-size: 10px; padding: 1px 5px; }
.cand-sym-state { flex-shrink: 0; font-size: 11px; color: var(--text-faint); }
.cand-sym-found .cand-sym-state { color: var(--green); }
.cand-sym-out   .cand-sym-state { color: var(--red); }
.cand-sym-prob {
  position: relative;
  flex-shrink: 0;
  width: 62px;
  height: 16px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.cand-sym-prob-bar { position: absolute; inset: 0 auto 0 0; background: rgba(43,143,255,0.3); }
.cand-sym-prob-num {
  position: relative;
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  color: var(--text);
}

/* Recommended exam — expandable "which diagnoses" breakdown */
.exam-reco.exam-reco-expandable { cursor: pointer; }
.exam-reco-expandable.open .reco-tag-count { background: rgba(43,143,255,0.16); color: var(--accent); }

.exam-reco-detail {
  animation: detail-expand 0.16s ease-out;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(6,11,20,0.5);
}
.reco-detail-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.reco-aff-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.reco-aff-head { display: flex; align-items: center; gap: 7px; }
.reco-aff-head .game-icon { width: 22px; height: 22px; flex-shrink: 0; }
.reco-aff-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none; }
.reco-aff-name:hover { color: var(--accent); text-decoration: underline; }
.reco-aff-score { flex-shrink: 0; font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.reco-aff-syms { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 0 29px; }
.reco-aff-sym {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  font-size: 12px;
  color: var(--text-muted);
}
.reco-aff-sym.is-main     { background: rgba(245,166,35,0.15);  color: var(--amber); }
.reco-aff-sym.is-decisive { background: rgba(61,201,142,0.15);  color: var(--green); }
.reco-aff-prob { font-family: var(--font-mono); font-size: 11px; opacity: 0.8; }
.reco-aff-more { font-size: 12px; color: var(--text-faint); font-style: italic; }

.diag-no-depts {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  gap: 10px;
  text-align: center;
}
.diag-no-depts-icon  { font-size: 2rem; }
.diag-no-depts-title { font-size: 18px; font-weight: 600; color: var(--text-muted); }
.diag-no-depts-hint  { font-size: 15px; color: var(--text-faint); max-width: 380px; }

.no-patient-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  font-size: 18px;
  gap: 12px;
}
.no-patient-placeholder .hint { font-size: 16px; color: var(--text-faint); }

/* ============================================================
   Misc utilities
   ============================================================ */
.mt-auto { margin-top: auto; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-accent { color: var(--accent); }
.font-mono  { font-family: 'SF Mono', 'Consolas', monospace; font-size: 14px; }
.empty-state {
  text-align: center;
  padding: 48px 32px;
  color: var(--text-muted);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.3px;
}
.empty-state::before {
  content: '✚';
  font-size: 34px;
  line-height: 1;
  color: var(--accent);
  opacity: 0.3;
}
.count-chip {
  background: rgba(43,143,255,0.12);
  border: 1px solid rgba(43,143,255,0.25);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ============================================================
   Reduced-motion: strip all animations
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .entity-row, .card, .linked-item, .candidate-item, .exam-reco,
  .badge-lethal, .candidate-impossible,
  .candidate-detail, .exam-reco-detail {
    animation: none;
    will-change: auto;
  }
  .landing-title { animation: none; background-position: 0% 50%; }
  .kofi-backdrop, .kofi-backdrop--leaving,
  .kofi-modal, .kofi-backdrop--leaving .kofi-modal { animation: none; }
}

/* ============================================================
   Landing page
   ============================================================ */
.landing-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.landing-hero {
  text-align: center;
  margin-bottom: 48px;
}

.landing-hero-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 18px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: list-item-in 0.4s ease-out backwards;
}

.landing-title {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(
    90deg,
    #5aaaff   0%,
    #2b8fff  25%,
    #1a6fd4  45%,
    #2ec4b6  62%,
    #2b8fff  80%,
    #5aaaff 100%
  );
  background-size: 600px 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: list-item-in 0.4s ease-out 60ms backwards, gradient-liquid 6s linear infinite;
}

.landing-byline {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
  animation: list-item-in 0.4s ease-out 90ms backwards;
}

.landing-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 20px;
  animation: list-item-in 0.4s ease-out 120ms backwards;
}

.landing-desc {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 600px;
  margin: 0 auto;
  animation: list-item-in 0.4s ease-out 180ms backwards;
}

.landing-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 700px) {
  .landing-nav-grid { grid-template-columns: 1fr 1fr; }
}

.landing-nav-card {
  --card-rgb: 43, 143, 255;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(var(--card-rgb), 0.35);
  background: linear-gradient(135deg, rgba(var(--card-rgb), 0.1) 0%, var(--surface) 65%);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: list-item-in 0.35s ease-out backwards;
  animation-delay: calc(240ms + var(--i, 0) * 55ms);
}

.landing-nav-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--card-rgb), 0.65);
  box-shadow: 0 10px 32px rgba(var(--card-rgb), 0.18);
  text-decoration: none;
  color: var(--text);
}

.landing-card-label {
  font-size: 17px;
  font-weight: 700;
  color: rgb(var(--card-rgb));
}

.landing-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Center a lone card in the last row of a 3-column grid */
.landing-nav-card:last-child:nth-child(3n+1) {
  grid-column: 2;
}

.landing-nav-card--mystery {
  border: 2px dashed rgba(255,255,255,0.18);
  background: transparent;
  cursor: default;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}

.landing-nav-card--mystery:hover {
  transform: none;
  border-color: rgba(255,255,255,0.32);
  box-shadow: 0 0 24px rgba(255,255,255,0.05);
}

.landing-card-mystery-icon {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255,255,255,0.25);
  animation: mystery-pulse 3s ease-in-out infinite;
  letter-spacing: -2px;
}

.landing-card-mystery-label {
  font-size: 17px;
  font-weight: 700;
  color: rgba(255,255,255,0.22);
  letter-spacing: 4px;
}

.landing-card-mystery-desc {
  color: rgba(255,255,255,0.3);
  font-style: italic;
}

@keyframes mystery-pulse {
  0%, 100% { opacity: 0.25; text-shadow: none; }
  50% { opacity: 0.7; text-shadow: 0 0 18px rgba(255,255,255,0.4); }
}

/* ============================================================
   About / FAQ page
   ============================================================ */
.about-page {
  max-width: 780px;
}

.about-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 32px;
  color: var(--text);
}

.about-section {
  margin-bottom: 40px;
  animation: list-item-in 0.3s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 80ms);
}

.about-section-heading {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.about-body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.75;
  margin: 0 0 12px;
}

.about-byline-credit {
  margin-top: 20px;
}

/* Acknowledgements list */
.about-ack-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  width: 100%;
}
.about-ack-list li {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.about-ack-list li strong { color: var(--text); }

/* Collapsible section heading */
.about-collapsible-heading {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.about-collapse-icon {
  font-style: normal;
  font-size: 14px;
  color: var(--text-muted);
  display: inline-block;
  transition: transform 0.18s ease;
}
.about-collapsible-heading.open .about-collapse-icon {
  transform: rotate(90deg);
}

/* Collapsible body */
.data-updated-body { display: none; }
.data-updated-body.open { display: block; }

/* Data-updated search */
.data-updated-search {
  display: block;
  width: 100%;
  padding: 7px 12px;
  margin-bottom: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.data-updated-search:focus { border-color: var(--accent); }
.data-updated-search::placeholder { color: var(--text-faint); }

/* Data-updated list */
.data-updated-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  width: 100%;
}
.data-updated-row {
  display: grid;
  grid-template-columns: 1fr 96px 112px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  animation: list-item-in 0.25s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 30) * 20ms);
}
.dur-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.dur-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 99px;
  text-align: center;
}
.dur-type--base { background: rgba(43,143,255,0.15); color: var(--accent); }
.dur-type--dlc  { background: rgba(240,180,41,0.15);  color: var(--yellow); }
.dur-type--mod  { background: rgba(46,196,182,0.15);  color: var(--teal);   }
.dur-date {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.about-code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

.faq-q {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.faq-a {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}
.faq-a p { margin: 0 0 10px; }
.faq-a p:last-child { margin-bottom: 0; }

/* ============================================================
   Scrollbar styling
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--accent) 0%, rgba(43,143,255,0.35) 100%); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--accent) var(--surface); }

/* ============================================================
   Statistics page
   ============================================================ */

/* Comparison table */
.stats-comparison-wrap { overflow-x: auto; }
.stats-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.stats-comparison-table th {
  text-align: left;
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.stats-comparison-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.stats-comparison-row {
  cursor: pointer;
  animation: list-item-in 0.25s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 20) * 30ms);
}
.stats-comparison-row:hover > td { background: rgba(var(--dept-rgb), 0.08); }
.stats-comparison-row:nth-child(even) > td { background: rgba(255,255,255,0.018); }
.stats-comparison-row:hover > td { background: rgba(var(--dept-rgb), 0.08); }

/* Sortable comparison headers */
.stats-comp-th {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.stats-comp-th:hover { color: var(--text); }
.stats-comp-th.sort-active { color: var(--accent); }
.stats-comp-th .sort-icon,
.stats-th-sortable .sort-icon { font-size: 10px; margin-left: 2px; opacity: 0.7; }
.stats-comparison-table th[title],
.stats-inline-table th[title] { cursor: help; }
.stats-asterisk { color: var(--text-faint); font-size: 10px; }
.stats-footnote {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 8px;
  padding: 0 2px;
  line-height: 1.5;
}

/* Shared number/label helpers */
.stats-num { font-variant-numeric: tabular-nums; }
.stats-none { color: var(--text-faint); }
.stats-fatal-count { color: var(--red); font-weight: 700; }
.stats-dangerous-count { color: var(--yellow); font-weight: 700; }
.stats-collapse-count { color: var(--yellow); font-weight: 700; }
.stats-payout { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-freq   { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-name-muted { color: var(--text-muted); font-size: 13px; }
.stats-exam-inline { font-size: 13px; color: var(--text-muted); }

/* Department header banner */
.stats-dept-header {
  margin-bottom: 20px;
  padding: 14px 18px;
  background: rgba(var(--dept-rgb), 0.08);
  border: 1px solid rgba(var(--dept-rgb), 0.25);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.stats-dept-name { font-size: 20px; font-weight: 700; margin: 0; }
.stats-dept-meta { display: flex; gap: 8px; align-items: center; }

/* Two-column grid */
.stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .stats-two-col { grid-template-columns: 1fr; } }

.stats-section-desc { font-size: 14px; color: var(--text-muted); margin: 4px 0 10px; }

/* Scrollable wrappers for per-department lists */
.stats-exam-list-wrap {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stats-linked-wrap {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Exam detection rows */
.stats-exam-list { display: flex; flex-direction: column; gap: 0; }
.stats-exam-row {
  display: grid;
  grid-template-columns: 45px 1fr auto 100px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition);
  animation: list-item-in 0.25s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 20) * 30ms);
}
.stats-exam-list .stats-exam-row:nth-child(even) { background: rgba(255,255,255,0.025); }
.stats-exam-row:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.stats-exam-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-exam-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.stats-bar-track { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.stats-bar-fill  { height: 100%; border-radius: 3px; }
.stats-bar-cell  { width: 120px; vertical-align: middle; }

/* Collapsible overview sections */
.stats-overview-section { margin-top: 20px; }
.stats-overview-heading {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  transition: background var(--transition), border-color var(--transition);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.stats-overview-heading:hover { background: var(--surface-3); border-color: var(--accent); }
.stats-overview-chevron {
  font-size: 13px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  transform: rotate(-90deg);
}
.stats-overview-chevron.open { transform: rotate(0deg); }
.stats-overview-body { display: none; padding-top: 12px; }
.stats-overview-body.open { display: block; }

/* Scrollable table wrapper with sticky header */
.stats-table-wrap {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stats-table-wrap .stats-inline-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
}

/* Inline sortable tables (pharmacy, diagnoses) */
.stats-inline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.stats-inline-table th {
  text-align: left;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.stats-inline-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.stats-inline-table tbody tr:last-child td { border-bottom: none; }

/* Sortable inline table headers */
.stats-th-sortable { cursor: pointer; user-select: none; transition: color var(--transition); }
.stats-th-sortable:hover { color: var(--text); }
.stats-th-sortable.sort-active { color: var(--accent); }

/* Clickable table rows with zebra + hover */
.stats-table-row {
  cursor: pointer;
  animation: list-item-in 0.25s ease-out backwards;
  animation-delay: calc(min(var(--i, 0), 20) * 15ms);
}
.stats-table-row > td { transition: background var(--transition); }
.stats-table-row:nth-child(even) > td { background: rgba(255,255,255,0.025); }
.stats-table-row:hover > td { background: rgba(43,143,255,0.07); }

/* Icon + name cell layout */
.stats-icon-name-cell { display: flex; align-items: center; gap: 8px; }
.stats-row-name { font-size: 14px; color: var(--text); }

/* ============================================================
   Language Picker
   ============================================================ */
.lang-picker {
  position: relative;
  flex-shrink: 0;
}

.lang-picker-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
  height: 36px;
}
.lang-picker-btn:hover:not(:disabled),
.lang-picker-btn.open { background: var(--surface-3); border-color: var(--border-light); }
.lang-picker-btn:disabled { opacity: 0.6; cursor: default; }

.lang-picker-flag { font-size: 16px; line-height: 1; }
.lang-picker-caret { font-size: 13px; color: var(--text-muted); margin-left: 1px; }

.lang-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 4px;
}
.lang-picker-dropdown.open { display: block; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}
.lang-option:hover { background: var(--surface-3); }
.lang-option.active { background: rgba(43,143,255,0.12); color: var(--accent); }
.lang-option.active:hover { background: rgba(43,143,255,0.18); }
.lang-flag { font-size: 18px; line-height: 1; flex-shrink: 0; }
.lang-label { flex: 1; line-height: 1.3; }
.lang-partial { color: var(--text-muted); font-size: 11px; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.8;
}
.site-footer p { margin: 0; }
.site-footer-links { margin-top: 4px; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent-hover); }
.site-footer-sep { margin: 0 8px; color: var(--text-faint); }


/* ============================================================
   Ko-fi support prompt — centred modal over a dimmed backdrop
   ============================================================ */
.kofi-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 7, 15, 0.74);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overscroll-behavior: contain;   /* don't chain scroll into the page behind */
  animation: kofi-backdrop-in 0.22s ease both;
}
.kofi-backdrop[hidden] { display: none; }
.kofi-backdrop--leaving { animation: kofi-backdrop-out 0.25s ease forwards; }

.kofi-modal {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);  /* vh includes the mobile URL bar; dvh doesn't */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 44px 48px 40px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--glow);
  animation: kofi-modal-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
.kofi-modal:focus { outline: none; }
.kofi-backdrop--leaving .kofi-modal { animation: kofi-modal-out 0.25s ease forwards; }

.kofi-prompt-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 26px;
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}
.kofi-prompt-close:hover { color: var(--text); background: var(--surface-3); }

.kofi-prompt-title {
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
.kofi-prompt-body {
  margin: 0 auto 28px;
  max-width: 44ch;
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-muted);
}

.kofi-prompt-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.kofi-prompt-link {
  display: block;
  line-height: 0;
  border-radius: var(--radius-sm);
  transition: transform var(--transition), filter var(--transition);
}
.kofi-prompt-link:hover { transform: translateY(-2px); filter: brightness(1.08); }
.kofi-prompt-link img { display: block; max-width: 100%; }

.kofi-prompt-later {
  padding: 10px 20px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.kofi-prompt-later:hover {
  color: var(--text);
  border-color: var(--border-light);
  background: var(--surface-3);
}

body.kofi-modal-open { overflow: hidden; }

/* The Ko-fi floating widget pins itself at z-index:10000 via an inline style, so it
   would otherwise sit on top of the backdrop — undimmed, and competing with the very
   CTA inside the modal. Hide it for as long as the modal is open. */
body.kofi-modal-open .floatingchat-container-wrap,
body.kofi-modal-open .floatingchat-container-wrap-mobi { display: none !important; }

@keyframes kofi-backdrop-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes kofi-backdrop-out { to { opacity: 0; } }
@keyframes kofi-modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes kofi-modal-out {
  to { opacity: 0; transform: translateY(10px) scale(0.98); }
}

@media (max-width: 768px) {
  .kofi-backdrop { padding: 16px; }
  .kofi-modal { padding: 40px 22px 30px; }
  .kofi-prompt-title { font-size: 24px; }
  .kofi-prompt-body { font-size: 16px; margin-bottom: 24px; }
  /* 44px minimum touch targets */
  .kofi-prompt-close { top: 6px; right: 6px; width: 44px; height: 44px; font-size: 28px; }
  .kofi-prompt-later { padding: 12px 22px; }
}

/* Short viewports (phone landscape, split-screen): compress and put the actions
   side by side so the whole card still fits without an internal scrollbar. */
@media (max-height: 460px) {
  .kofi-modal { padding: 24px 26px 22px; }
  .kofi-prompt-title { font-size: 20px; margin-bottom: 10px; }
  .kofi-prompt-body { font-size: 15px; margin-bottom: 18px; }
  .kofi-prompt-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 14px; }
  .kofi-prompt-close { top: 4px; right: 4px; }
}

/* Debug trigger — only mounted on localhost or with ?kofidebug. Sits above the
   backdrop so the prompt can be re-triggered while it is open. */
.kofi-debug-btn {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 3100;
  padding: 5px 12px;
  background: var(--surface-2);
  border: 1px dashed var(--yellow);
  border-radius: var(--radius-sm);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.65;
  transition: opacity var(--transition);
}
.kofi-debug-btn:hover { opacity: 1; }
