/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Theme transition (only active during toggle, not on every hover) ── */
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition:
    background-color 250ms ease,
    color            250ms ease,
    border-color     250ms ease,
    box-shadow       250ms ease !important;
}

html { overflow-y: scroll; }

/* ── Global scrollbar theme ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
*::-webkit-scrollbar-corner { background: transparent; }

body {
  background: var(--bg-page);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; display: flex; flex-direction: column; }

/* ── Ticker ── */
.ticker-wrap {
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-1);
  height: 28px;
  display: flex;
  align-items: center;
  user-select: none;
}

.ticker-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  will-change: transform;
}

.ticker-wrap:hover .ticker-track { animation-play-state: paused; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 20px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.ticker-label   { color: var(--fg-4); }
.ticker-value   { color: var(--fg-1); font-weight: 600; }
.ticker-change  { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; opacity: 0.85; }
.ticker-arrow   { font-size: 8px; line-height: 1; display: inline-flex; align-items: center; }
.ticker-up      { color: var(--up-500); font-weight: 600; }
.ticker-down    { color: var(--down-500); font-weight: 600; }
.ticker-neutral { color: var(--fg-1); font-weight: 600; }
.ticker-accent  { color: var(--brand-teal); font-weight: 600; }
.ticker-sep     { color: var(--border-default); padding: 0 4px; font-size: 10px; user-select: none; }

/* ── Banner ── */
.site-banner {
  width: 100%;
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  padding: 7px 40px;
  letter-spacing: 0.01em;
  color: #fff;
  position: relative;
}

.site-banner-text { display: inline; }

.site-banner-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 2px 4px;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.site-banner-close:hover { opacity: 1; }

/* ── Admin Login ── */
.admin-login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 16px;
}

.admin-login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.admin-login-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand-teal);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  margin-bottom: 6px;
}

.admin-login-header { margin-bottom: 28px; }
.admin-login-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--fg-1);
  line-height: var(--lh-tight);
}
.admin-login-sub { font-size: var(--text-sm); color: var(--fg-3); margin-top: 6px; }

.admin-login-form { display: flex; flex-direction: column; gap: 20px; }

.admin-login-submit {
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--bg-page);
  background: var(--brand-teal);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
  letter-spacing: 0.03em;
}
.admin-login-submit:hover { background: var(--brand-teal-hover); }

.admin-input-error { border-color: var(--down-500) !important; }
.admin-login-error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--down-500);
  background: var(--down-100);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-top: 2px;
}

/* ── Admin Banner ── */
.admin-banner-page { max-width: 560px; }

.admin-banner-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.admin-banner-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand-teal);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  margin-bottom: 4px;
}

.admin-logout-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-4);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 4px;
}
.admin-logout-link:hover { color: var(--fg-2); border-color: var(--border-strong); text-decoration: none; }

.admin-banner-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.admin-field { display: flex; flex-direction: column; gap: 8px; }

.admin-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.admin-input {
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.admin-input:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px var(--brand-teal-20);
}

.item-vbreak-pie {
  height: 100%;
}

.admin-toggle-row { display: flex; align-items: center; gap: 10px; }

.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--bg-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.toggle-thumb {
  position: absolute;
  width: 14px; height: 14px;
  background: var(--fg-4);
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: transform var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.toggle-switch input:checked + .toggle-track { background: var(--brand-teal-20); border-color: var(--brand-teal); }
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); background: var(--brand-teal); }

.admin-toggle-hint { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-4); }

.admin-color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.color-preset {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}
.color-preset:hover { transform: scale(1.15); }
.color-preset.active { border-color: var(--fg-1); }

.admin-color-input {
  width: 32px; height: 28px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  padding: 2px;
  cursor: pointer;
}

.admin-preview-row { display: flex; flex-direction: column; gap: 8px; }

.admin-banner-preview {
  width: 100%;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.admin-actions { display: flex; align-items: center; gap: 12px; }

.admin-save-btn {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--bg-page);
  background: var(--brand-teal);
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 20px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.admin-save-btn:hover { background: var(--brand-teal-hover); }
.admin-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.admin-save-status { font-family: var(--font-mono); font-size: var(--text-xs); }

@media (max-width: 768px) {
  .admin-banner-form { padding: 18px 16px; gap: 20px; }
  .admin-banner-header { flex-direction: column; gap: 12px; }
  .admin-login-card { padding: 24px 20px; }
}

/* ── Nav ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--nav-height);
}

.navbar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 16px;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Brand */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-brand img { width: 40px; height: 40px; }

.navbar-brand-text {
  font-weight: 700;
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-tight);
}

.brand-ps99 { color: var(--brand-teal); }
.brand-rap  { color: var(--fg-1); }

/* Nav links */
.navbar-links {
  display: flex;
  align-items: center;
  gap: 5px;
  list-style: none;
}

.navbar-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-3);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.navbar-links a:hover { color: var(--fg-1); background: var(--bg-2); }

.navbar-links a.active { color: var(--fg-1); background: var(--bg-3); }

.navbar-links a i,
.navbar-links a svg { width: 14px; height: 14px; stroke-width: 1.5; display: inline-block; flex-shrink: 0; }

/* Right: links + toggle */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

/* Search */
.navbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 7px 14px;
  cursor: text;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.navbar-search:focus-within {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px var(--brand-teal-20);
  outline: none;
}

.navbar-search i,
.navbar-search svg { width: 14px; height: 14px; color: var(--fg-4); flex-shrink: 0; display: inline-block; }

.icon-btn i { width: 16px; height: 16px; display: inline-block; }

.navbar-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.navbar-search input::placeholder { color: var(--fg-4); }

.search-slash-hint {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  color: var(--fg-4);
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: 4px;
  padding: 2px 5px;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.navbar-search:focus-within .search-slash-hint { opacity: 0; }


/* Search dropdown */
.navbar-search-wrap {
  position: relative;
  width: 100%;
  justify-self: center;
}

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 15px);
  left: 0;
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 420px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--fg-1);
  font-size: var(--text-sm);
  transition: background var(--dur-fast) var(--ease-out);
}

.search-result:hover,
.search-result.active { background: var(--bg-2); text-decoration: none; }

.search-result img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Icon buttons */
.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--fg-3);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.icon-btn:hover { color: var(--fg-1); border-color: var(--border-default); background: var(--bg-2); }

.cosmic-btn {
  width: auto;
  padding: 0 10px;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: #814AC8;
  border-color: #814AC8;
  text-decoration: none;
}
.cosmic-btn:hover { color: #814AC8; background: rgba(129,74,200,0.12); border-color: #814AC8; text-decoration: none; }

.donate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #000;
  background: #FFDD00;
  border: 1px solid #e6c800;
  border-radius: var(--radius-md);
  padding: 5px 10px;
  text-decoration: none;
  white-space: nowrap;
  min-width: 90px;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.donate-btn:hover { background: #f5d300; border-color: #d4b800; text-decoration: none; }

.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #5865F2;
  border: 1px solid #4752c4;
  border-radius: var(--radius-md);
  padding: 5px 10px;
  text-decoration: none;
  white-space: nowrap;
  min-width: 90px;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.discord-btn:hover { background: #4752c4; border-color: #3c45a5; text-decoration: none; }

.discord-icon { object-fit: contain; filter: brightness(0) invert(1); }

.donate-btn img { width: 16px; height: 16px; object-fit: contain; }
.icon-btn svg { width: 16px; height: 16px; stroke-width: 1.5; }

/* ── Breadcrumb ── */
.breadcrumb-nav {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 8px 24px 0;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  flex-wrap: wrap;
}
.breadcrumb-item {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--fg-4);
  gap: 6px;
}
.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--fg-5);
}
.breadcrumb-item a {
  color: var(--fg-4);
  text-decoration: none;
}
.breadcrumb-item a:hover { color: var(--fg-2); }
.breadcrumb-item.breadcrumb-current { color: var(--fg-3); }
.breadcrumb:not(:has(.breadcrumb-item + .breadcrumb-item)) { display: none; }

/* ── Page ── */
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 20px 24px;
  flex: 1;
}

.page-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  color: var(--fg-1);
  margin-bottom: 8px;
  line-height: var(--lh-tight);
}

.page-subtitle {
  font-size: var(--text-base);
  color: var(--fg-3);
}

/* ── Footer ── */
.footer {
  margin-top: 40px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}

.footer-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.footer-brand img { width: 40px; height: 40px; }

.footer-brand-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--fg-1);
  letter-spacing: var(--tracking-tight);
}

.footer-brand-sub {
  font-size: 11px;
  color: var(--fg-4);
}

.footer-links {
  display: flex;
  gap: 48px;
  font-size: 12px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-col-label {
  font-size: 10px;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 2px;
}

.footer-col a {
  color: var(--fg-2);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-col a:hover { color: var(--fg-1); text-decoration: underline; }

.footer-disclaimer {
  max-width: var(--content-max);
  margin: 20px auto 0;
  padding: 0 24px;
  font-size: 11px;
  color: var(--fg-4);
  line-height: 1.5;
}

/* ── Home page ── */


.home-sections {
  display: flex;
  flex-direction: column;
}

/* Uniform spacing + separators for all draggable sections */
.home-sections > [data-section-id] {
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}

.home-sections > [data-section-id]:last-child { border-bottom: none; }

.market-section {
  padding: 32px 0;
}

.market-section:first-child {
  padding-top: 1rem;
}

/* Shelf sections inside home-sections get same spacing as chart sections */
.home-sections .home-shelf-section,
.home-sections .sentiment-section {
  margin-top: 0;
  padding-top: 32px;
  padding-bottom: 32px;
}

.home-sections .movers-section { border-top: none; }

/* ── Drag handle (absolute, sits in the top padding area) ── */
.section-drag-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 20px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  color: var(--fg-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, color 0.15s;
  z-index: 2;
  border-radius: 4px;
}

.home-sections [data-section-id]:hover .section-drag-handle {
  opacity: 1;
  pointer-events: auto;
  color: var(--fg-3);
}

@media (hover: none) {
  .section-drag-handle {
    opacity: 0.6;
    pointer-events: auto;
  }
}

.section-drag-handle:active { cursor: grabbing; }

/* ── Ghost (the floating element that follows the cursor) ── */
.drag-ghost {
  opacity: 0.95 !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--brand-teal) !important;
  background: var(--bg-page) !important;
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none !important;
  cursor: grabbing !important;
}

/* ── Placeholder (shows drop position) ── */
.drag-placeholder {
  border: 2px dashed var(--brand-teal-40);
  border-radius: 6px;
  background: var(--brand-teal-10);
  box-sizing: border-box;
  min-height: 48px;
  pointer-events: none;
}

.market-section:last-child { border-bottom: none; }

.market-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.market-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.market-section-value {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg-1);
  margin-bottom: 6px;
  cursor: default;
}

.msv-cursor-tip {
  display: none;
  position: fixed;
  background: var(--bg-4);
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
}

@media (max-width: 768px) {
  .market-section-value { font-size: var(--text-3xl); }
}

.market-value-placeholder { color: var(--fg-4); }

.market-section-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.market-section-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-4);
}

.market-section-delta {
  font-size: 14px;
  min-height: 20px;
}

.market-section-delta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.market-section-rate {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.market-section-rate .rate-up   { color: var(--up-500); }
.market-section-rate .rate-down { color: var(--down-500); }

@media (max-width: 768px) {
  .market-section-date { font-size: 10px; }
}

.market-chart {
  width: 100%;
  height: 240px;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Range toggle */
.range-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-inset);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.range-toggle button {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-3);
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  position: relative;
}
.range-toggle button:hover .stat-tooltip { display: block; }

.range-toggle button:hover { color: var(--fg-1); }
.range-toggle button.active { background: var(--bg-3); color: var(--fg-1); }
.range-toggle.disabled { opacity: 0.35; cursor: not-allowed; }
.range-toggle.disabled button { cursor: not-allowed; pointer-events: none; }
.range-toggle button.range-unavailable { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

.range-toggle button i,
.range-toggle button svg { width: 14px; height: 14px; display: block; stroke-width: 1.75; }

.exists-type-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

@media (max-width: 768px) {
  .exists-type-controls { align-items: flex-start; }
}

.hamburger-btn { display: none; }

.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px 12px;
  gap: 4px;
}

.mobile-menu.open {
  display: flex;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  z-index: 39;
  box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.mobile-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--fg-2);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.mobile-menu a:hover { background: var(--bg-2); color: var(--fg-1); }
.mobile-menu a.active { background: var(--bg-1); color: var(--fg-2); }

.mobile-menu a i,
.mobile-menu a svg { width: 16px; height: 16px; stroke-width: 1.5; flex-shrink: 0; }

.mobile-menu-btns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.mobile-menu .discord-btn,
.mobile-menu .donate-btn {
  justify-content: center;
  flex: 1;
}

.mobile-menu .discord-btn { color: #fff; }
.mobile-menu .discord-btn:hover { color: #fff; }
.mobile-menu .donate-btn { color: #000; }
.mobile-menu .donate-btn:hover { color: #000; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .navbar-inner {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 0 16px;
  }

  .navbar-search-wrap { max-width: 100%; }

  .navbar-links { display: none; }
  .navbar-right .discord-btn,
  .navbar-right .donate-btn,
  .navbar-right .settings-btn { display: none; }
  .hamburger-btn { display: flex; }

  .page {
    padding: 24px 16px;
  }

  .market-section-value {
    font-size: var(--text-3xl);
  }

  .market-section-header {
    flex-direction: column;
    gap: 12px;
  }

  .market-chart { height: 180px; }

  .footer-inner {
    flex-direction: column;
    gap: 24px;
  }

  .footer-links { gap: 24px; }
}

/* ── Items page ── */
.items-header {
  margin-bottom: 16px;
}

.items-counter {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--fg-1);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.item-card {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0 12px 0 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  min-width: 0;
  overflow: hidden;
}

.item-card:hover { text-decoration: none; }

.item-card:hover {
  border-color: var(--border-default);
  background: var(--bg-2);
}

.item-card-thumb {
  width: 64px;
  align-self: stretch;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.item-card-thumb img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.item-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  padding: 10px 0;
}

.item-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-card-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-card-rap {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-teal);
}

.item-card-rap.no-rap { color: var(--fg-4); }

.item-card-exists-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-card-exists {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-4);
}

.item-card-rate {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.item-card-rate-up   { color: var(--up-500); }
.item-card-rate-down { color: var(--down-500); }
.item-card-rate-zero { color: var(--fg-4); }

/* ── Chart view grid ── */
.items-grid--chart {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.item-card--chart {
  padding-right: 0;
}

.items-na-hint {
  margin: 16px 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--brand-teal) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-teal) 30%, transparent);
  color: var(--fg-2);
  font-size: var(--text-sm);
}

.item-card--chart .item-card-stats--inline {
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
}

.item-card-spark {
  width: 120px;
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 6px 8px 6px 6px;
  border-left: 1px solid var(--border-subtle);
}

.item-spark-combined {
  width: 100%;
}

@keyframes spark-shimmer {
  from { background-position: -200% center; }
  to   { background-position:  200% center; }
}

.spark-skeleton {
  width: 100%;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-1) 25%, var(--bg-3) 50%, var(--bg-1) 75%);
  background-size: 200% 100%;
  animation: spark-shimmer 2.2s ease infinite;
}

.spark-svg {
  width: 100%;
  height: 28px;
  display: block;
}

/* ── View toggle ── */
.items-view-toggle {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.items-view-btn {
  width: 28px;
  height: 28px;
  color: var(--fg-4);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.items-view-btn.active {
  color: var(--brand-teal);
  border-color: var(--border-teal);
  background: var(--brand-teal-10);
}

.items-view-btn:hover:not(.active) { color: var(--fg-2); }

@media (max-width: 480px) {
  .items-grid { grid-template-columns: 1fr; gap: 8px; }
  .items-grid--chart { grid-template-columns: 1fr; }
  .item-card-exists-row { flex-wrap: wrap; gap: 3px 6px; }
  .item-card-rate { font-size: 10px; }
}

/* ── Tools page ── */
.tools-header { margin-bottom: 24px; }
.tools-title { font-size: var(--text-2xl); font-weight: 700; color: var(--fg-1); margin-bottom: 6px; }
.tools-subtitle { font-size: var(--text-sm); color: var(--fg-3); }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.tool-card:hover { border-color: var(--brand-teal); background: var(--bg-2); text-decoration: none; }

.tool-card-icon-wrap {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-teal-20);
  border-radius: var(--radius-md);
}
.tool-card-icon-wrap svg { width: 18px; height: 18px; color: var(--brand-teal); stroke-width: 1.75; }

.tool-card-name { font-size: var(--text-base); font-weight: 600; color: var(--fg-1); }
.tool-card-desc { font-size: var(--text-sm); color: var(--fg-3); line-height: 1.5; }

@media (max-width: 768px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card { padding: 16px; }
}

/* ── Compare tool ── */
.cmp-search-row   { margin-top: 20px; margin-bottom: 8px; }
.cmp-search-wrap  { width: 100%; }

.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.cmp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg-2);
}
.cmp-chip-dot    { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-color); flex-shrink: 0; }
.cmp-chip-remove { background: none; border: none; cursor: pointer; color: var(--fg-4); font-size: 10px; padding: 0 0 0 2px; line-height: 1; transition: color var(--dur-fast) var(--ease-out); }
.cmp-chip-remove:hover { color: var(--down-500); }

.cmp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 64px 0;
  color: var(--fg-4);
  font-size: var(--text-sm);
}
.cmp-empty svg { width: 30px; height: 30px; }

.cmp-content { display: flex; flex-direction: column; }

.cmp-chart-section { padding-top: 20px; }

.cmp-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cmp-legend      { display: flex; flex-wrap: wrap; gap: 10px; }
.cmp-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cmp-legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cmp-legend-name { font-size: var(--text-xs); font-weight: 500; color: var(--fg-2); text-decoration: none; }
.cmp-legend-name:hover { color: var(--fg-1); }

/* Stats table */
.cmp-stat-tbl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }

.cmp-stat-tbl th {
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.cmp-stat-tbl th:first-child { text-align: left; padding-left: 0; }

.cmp-stat-tbl td {
  padding: 10px 0 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--fg-1);
  vertical-align: middle;
  text-align: right;
  white-space: nowrap;
}
.cmp-stat-tbl td:first-child { text-align: left; padding-left: 0; }
.cmp-stat-tbl tbody tr:last-child td { border-bottom: none; }

.cmp-table-dot  { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; flex-shrink: 0; }
.cmp-table-name { color: var(--fg-1); text-decoration: none; font-weight: 500; }
.cmp-table-name:hover { color: var(--brand-teal); }
.cmp-td-mono   { font-family: var(--font-mono); }
.cmp-td-muted  { color: var(--fg-4); }

/* Analysis */
.cmp-analysis-section { border-bottom: none; }
.cmp-analysis { display: flex; flex-wrap: wrap; gap: 12px; }

.cmp-analysis-block {
  flex: 1;
  min-width: 220px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.cmp-analysis-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.cmp-rank-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border-subtle); }
.cmp-rank-row:last-child { border-bottom: none; padding-bottom: 0; }
.cmp-rank-num  { font-size: var(--text-xs); color: var(--fg-4); font-family: var(--font-mono); width: 20px; flex-shrink: 0; }
.cmp-rank-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cmp-rank-name { flex: 1; font-size: var(--text-sm); color: var(--fg-1); text-decoration: none; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-rank-name:hover { color: var(--brand-teal); }
.cmp-rank-val  { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--fg-1); flex-shrink: 0; }

.cmp-pair-row  { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.cmp-pair-row:last-child { border-bottom: none; padding-bottom: 0; }
.cmp-pair-label { display: flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--fg-3); flex-wrap: wrap; }
.cmp-pair-vals  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cmp-pair-stat  { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--fg-1); }
.cmp-pair-sep   { color: var(--fg-4); }

@media (max-width: 640px) {
  .cmp-td-hide           { display: none; }
  .cmp-chart-header      { flex-direction: column; align-items: flex-start; }
}

/* ── Star button ── */
.star-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--fg-4);
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-md);
  transition: color var(--dur-fast) var(--ease-out);
}

.star-btn:hover { color: var(--warn-400); }

.star-btn svg {
  width: 18px;
  height: 18px;
  transition: fill var(--dur-fast) var(--ease-out), stroke var(--dur-fast) var(--ease-out);
}

.star-btn.starred { color: var(--warn-400); }
.star-btn.starred svg { fill: var(--warn-400); stroke: var(--warn-400); }

/* ── Home shelves (Favorites + Recently Visited) ── */
.home-shelf-section {
  margin-top: 32px;
}

.home-shelf-section .item-section-label {
  margin-bottom: 10px;
}

.shelf-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.fav-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--fg-1);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.fav-card:hover { border-color: var(--border-default); background: var(--bg-2); text-decoration: none; }

.fav-card-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.fav-card-name { color: var(--fg-1); }

.fav-card-watch { align-items: center; }

.fav-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.fav-card-stats {
  display: flex;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.fav-card-rap  { color: var(--brand-teal); font-weight: 600; }
.fav-card-ex   { color: var(--fg-4); }

@media (max-width: 768px) {
  .fav-card-stats { font-size: 10px; }
}

.fav-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  color: var(--fg-4);
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-left: 2px;
  transition: color var(--dur-fast) var(--ease-out);
}

.fav-remove-btn:hover { color: var(--down-500); }

@media (max-width: 768px) {
  .fav-card { padding: 7px 10px; font-size: var(--text-xs); }
  .fav-card-thumb { width: 20px; height: 20px; }
}

/* ── Movers ── */
.movers-section { border-top: 1px solid var(--border-subtle); padding-top: 32px; }

.movers-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.movers-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.movers-controls-row2 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.movers-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 460px;
}

.movers-loading { color: var(--fg-4); font-size: var(--text-sm); padding: 12px 0; }

/* stats columns: 72px + 90px + 86px = 248px total — must stay in sync with .mover-stats */
.mover-list-head {
  display: grid;
  grid-template-columns: 1fr 248px;
  gap: 10px;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-5);
  text-align: left;
}

.mover-list-head-stats {
  display: grid;
  grid-template-columns: 72px 90px 86px;
  text-align: right;
}

.mover-row {
  display: grid;
  grid-template-columns: 32px 1fr 248px;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--fg-1);
  transition: background var(--dur-fast) var(--ease-out);
}

.mover-row:hover { background: var(--bg-2); text-decoration: none; }

.mover-rank {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-4);
  text-align: right;
  padding-right: 2px;
}

.mover-thumb-wrap {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  position: relative;
}

.mover-thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

.mover-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mover-stats {
  display: grid;
  grid-template-columns: 72px 90px 86px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  flex-shrink: 0;
  text-align: right;
}

.mover-stats > span { text-align: right; }

.mover-curr { color: var(--fg-2); font-weight: 500; }

.mover-delta-up   { color: var(--up-500);   font-weight: 600; }
.mover-delta-down { color: var(--down-500); font-weight: 600; }

/* mobile: 60px + 76px + 70px = 206px */
@media (max-width: 768px) {
  .movers-header { flex-direction: column; align-items: flex-start; }
  .movers-controls { align-items: flex-start; }
  .mover-list-head { grid-template-columns: 1fr 206px; gap: 8px; }
  .mover-list-head-stats { grid-template-columns: 60px 76px 70px; }
  .mover-row { grid-template-columns: 28px 1fr 206px; gap: 8px; padding: 5px 4px; }
  .mover-thumb-wrap { width: 28px; height: 28px; }
  .mover-thumb, .mover-thumb-placeholder { width: 28px; height: 28px; }
  .mover-name { font-size: var(--text-xs); }
  .mover-stats { grid-template-columns: 60px 76px 70px; font-size: 10px; }
}

/* ── Movers page ── */
.movers-page-header {
  margin-bottom: 20px;
}

.mvp-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* ── About ── */
.about-page {
  max-width: 680px;
  margin: 0 auto;
}

.about-hero {
  text-align: center;
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 40px;
}

.about-hero-title {
  font-size: var(--text-4xl);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  margin-bottom: 12px;
}

.about-hero-sub {
  font-size: var(--text-base);
  color: var(--fg-3);
  max-width: 480px;
  margin: 0 auto;
  line-height: var(--lh-body);
}

.about-sections {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.about-section {
  display: flex;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-1);
}

.about-section:last-child { border-bottom: none; }

.about-section-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border-radius: var(--radius-md);
  color: var(--brand-teal);
}

.about-section-icon svg { width: 16px; height: 16px; stroke-width: 1.75; }

.about-section-body { display: flex; flex-direction: column; gap: 6px; }

.about-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg-1);
}

.about-section-text {
  font-size: var(--text-sm);
  color: var(--fg-3);
  line-height: var(--lh-body);
}

.about-section-text strong { color: var(--fg-2); font-weight: 600; }

.about-privacy-tldr {
  background: var(--brand-teal-10);
  border: 1px solid var(--brand-teal-40);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

.about-privacy-tldr-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 18px;
  border-bottom: 1px solid var(--brand-teal-40);
  background: var(--brand-teal-20);
}

.about-privacy-tldr p {
  font-size: var(--text-sm);
  color: var(--fg-2);
  line-height: var(--lh-body);
  margin: 0;
  padding: 14px 18px;
}

.about-privacy-tldr a { color: var(--brand-teal); font-weight: 500; }

/* ── Privacy ── */
.privacy-page {
  max-width: 680px;
  margin: 0 auto;
}

.privacy-header {
  text-align: center;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 28px;
}

.privacy-tldr {
  background: var(--brand-teal-10);
  border: 1px solid var(--brand-teal-40);
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  overflow: hidden;
}

.privacy-tldr-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 18px;
  border-bottom: 1px solid var(--brand-teal-40);
  background: var(--brand-teal-20);
}

.privacy-tldr-text {
  font-size: var(--text-sm);
  color: var(--fg-2);
  line-height: var(--lh-body);
  margin: 0;
  padding: 14px 18px;
}

.privacy-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.privacy-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.privacy-section p {
  font-size: var(--text-sm);
  color: var(--fg-3);
  line-height: var(--lh-body);
  margin: 0;
}

.privacy-section ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.privacy-section li {
  font-size: var(--text-sm);
  color: var(--fg-3);
  line-height: var(--lh-body);
}

.privacy-section a { color: var(--brand-teal); }

.privacy-section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: var(--tracking-tight);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.privacy-point {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.privacy-point:last-child { border-bottom: none; }

.privacy-point-q {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-1);
}

@media (max-width: 768px) {
  .about-privacy-tldr-label { padding: 8px 14px; }
  .about-privacy-tldr p { padding: 12px 14px; }
  .privacy-tldr-label { padding: 8px 14px; }
  .privacy-tldr-text { padding: 12px 14px; }
  .privacy-header { padding: 28px 0 20px; }
}

@media (max-width: 768px) {
  .about-hero { padding: 32px 0 28px; }
  .about-hero-title { font-size: var(--text-3xl); }
  .about-section { padding: 18px 16px; gap: 14px; }
  .about-section-icon { width: 30px; height: 30px; }
}

/* ── Changelog ── */
.changelog-header { margin-bottom: 32px; text-align: center; }

.changelog-loading {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}

.changelog-list {
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.changelog-entry {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-subtle);
}

.changelog-entry:last-child { border-bottom: none; }

.changelog-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-subtle);
}

.changelog-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-2);
}

.changelog-latest-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--brand-teal);
  background: var(--brand-teal-10);
  border: 1px solid var(--brand-teal-40);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.changelog-version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-4);
}

.changelog-entry-body { padding: 16px 20px; }

.changelog-items {
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-left: 18px;
  margin: 0;
}

.changelog-item {
  font-size: var(--text-sm);
  color: var(--fg-2);
  line-height: var(--lh-body);
  padding-left: 4px;
}

.changelog-item a { color: var(--brand-teal); }
.changelog-item a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .changelog-entry-header { padding: 10px 14px; }
  .changelog-entry-body { padding: 12px 14px; }
  .changelog-date { font-size: var(--text-xs); }
}

/* ── Calculator ── */
.calc-page { display: flex; flex-direction: column; flex: 1; }

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 180px 1fr;
  gap: 24px;
  align-items: start;
  flex: 1;
}

.calc-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 300px;
}

.calc-side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-side-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
}

.calc-side-total {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--fg-1);
}

.calc-items { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 120px; }

.calc-empty { font-size: var(--text-sm); color: var(--fg-4); padding: 16px 0; text-align: center; }

.calc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-2);
  border-radius: var(--radius-md);
}

.calc-item img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }

.calc-item-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }

.calc-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calc-item-rap {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-teal);
}

.calc-item-qty {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.calc-qty-btn {
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: none;
  color: var(--fg-2);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: background var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}

.calc-qty-btn:hover { background: var(--bg-4); }

.calc-qty-input {
  width: 36px;
  text-align: center;
  background: var(--bg-inset);
  border: none;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

.calc-qty-input::-webkit-inner-spin-button,
.calc-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; }
.calc-qty-input { -moz-appearance: textfield; appearance: textfield; }

.calc-item-remove {
  background: none;
  border: none;
  color: var(--fg-4);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease-out);
}

.calc-item-remove:hover { color: var(--fg-1); }

.calc-diamonds-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  background: var(--bg-inset);
}

.calc-diamond-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.calc-diamonds-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
  min-width: 0;
}

.calc-diamonds-input::-webkit-inner-spin-button,
.calc-diamonds-input::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; }
.calc-diamonds-input { -moz-appearance: textfield; appearance: textfield; }

.calc-diamonds-input::placeholder { color: var(--fg-4); }

.calc-diamonds-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-4);
  white-space: nowrap;
}

.calc-search-wrap { position: relative; }

.calc-search-input {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--fg-1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.calc-search-input:focus { border-color: var(--brand-teal); }
.calc-search-input::placeholder { color: var(--fg-4); }

.calc-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.calc-drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--fg-1);
  transition: background var(--dur-fast) var(--ease-out);
}

.calc-drop-item:hover,
.calc-drop-item.active { background: var(--bg-2); }

.calc-drop-item img { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }

.calc-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 16px;
  min-width: 160px;
  position: sticky;
  top: calc(var(--nav-height) + 24px);
}

.calc-result-label {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--fg-3);
  white-space: nowrap;
  min-height: 1.2em;
}

.calc-result-label.win  { color: var(--up-500); }
.calc-result-label.loss { color: var(--down-500); }
.calc-result-label.even { color: var(--brand-teal); }

.calc-result-diff {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  min-height: 1.2em;
}

.calc-result-diff.win  { color: var(--up-500); }
.calc-result-diff.loss { color: var(--down-500); }

@media (max-width: 768px) {
  .calc-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .calc-result { flex-direction: row; padding: 12px 0; position: static; }
}

/* ── API Reference ── */
.api-page { display: flex; flex-direction: column; gap: 32px; max-width: 780px; }

.api-header { display: flex; flex-direction: column; gap: 6px; }
.api-subtitle { font-size: var(--text-sm); color: var(--fg-3); margin: 0; }

.api-base-url-block {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}
.api-base-label { font-size: var(--text-xs); color: var(--fg-4); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }
.api-base-code { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--fg-1); }

.api-groups { display: flex; flex-direction: column; gap: 40px; }

.api-group { display: flex; flex-direction: column; gap: 12px; }
.api-group-title {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-4);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.api-endpoints { display: flex; flex-direction: column; gap: 8px; }

.api-endpoint {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-endpoint-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.api-method {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(16,185,129,0.12);
  color: #10b981;
  flex-shrink: 0;
}

.api-path {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--fg-1);
  word-break: break-all;
}

.api-desc { font-size: var(--text-sm); color: var(--fg-2); margin: 0; }

.api-section-label {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-4);
  margin-top: 4px;
}

.api-params { display: flex; flex-direction: column; gap: 6px; }
.api-param {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
}
.api-param-name { font-family: var(--font-mono); font-size: 12px; color: var(--fg-1); flex-shrink: 0; }
.api-param-in {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.api-param-in-query { background: rgba(99,102,241,0.12); color: #818cf8; }
.api-param-in-path  { background: rgba(245,158,11,0.12); color: #f59e0b; }
.api-param-desc { color: var(--fg-3); flex: 1; min-width: 0; }
.api-param-required { font-size: 10px; color: var(--down-500); font-family: var(--font-mono); flex-shrink: 0; }

.api-returns {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  background: var(--bg-2);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .api-base-url-block { flex-direction: column; align-items: flex-start; gap: 4px; }
  .api-endpoint { padding: 12px; }
}

/* ── Enchant Builder ── */
.eb-page { display: flex; flex-direction: column; gap: 32px; }

.eb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eb-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand-teal);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  margin-bottom: 4px;
}

.eb-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--fg-1);
}

.eb-sub { font-size: var(--text-sm); color: var(--fg-3); margin-top: 6px; }

.eb-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

.eb-builder { display: flex; flex-direction: column; gap: 16px; }

/* Slot grid */
.eb-slot-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.eb-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.eb-slot {
  width: 104px;
  height: 104px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  position: relative;
  padding: 6px;
  user-select: none;
  flex-shrink: 0;
}

.eb-slot.empty { color: var(--fg-4); }
.eb-slot.empty i, .eb-slot.empty svg { width: 16px; height: 16px; }
.eb-slot.empty:hover { border-color: var(--border-default); background: var(--bg-2); }

.eb-slot.filled { border-color: var(--border-default); }
.eb-slot.filled:hover { border-color: var(--down-500); background: rgba(239,68,68,0.06); box-shadow: 0 0 0 1px var(--down-500); }

.eb-slot.active { border-color: var(--brand-teal); box-shadow: 0 0 0 1px var(--brand-teal); }

.eb-slot.empowered { border-color: #f59e0b; box-shadow: 0 0 0 1px #f59e0b; }
.eb-slot.empowered:hover { border-color: var(--down-500); background: rgba(239,68,68,0.06); box-shadow: 0 0 0 1px var(--down-500); }

.eb-empower-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.eb-slot .eb-empower-btn img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  pointer-events: none;
  display: block;
  filter: grayscale(1) brightness(0.5);
  transition: filter var(--dur-fast) var(--ease-out);
}
.eb-empower-btn:hover img { filter: grayscale(0) brightness(1); }
.eb-empower-btn.active img { filter: grayscale(0) brightness(1.2); }

.eb-empower-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-4);
  color: var(--fg-1);
  font-size: 11px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  pointer-events: none;
  z-index: 20;
}
.eb-slot:has(.eb-empower-btn:hover) .eb-empower-tooltip { display: block; }

.eb-empower-tag img { width: 14px; height: 14px; object-fit: contain; vertical-align: middle; }

@media (max-width: 768px) {
  .eb-empower-btn { width: 14px; height: 14px; bottom: 2px; right: 2px; }
  .eb-slot .eb-empower-btn img { width: 14px; height: 14px; }
}

.eb-slot img { width: 64px; height: 64px; object-fit: contain; }

.eb-slot-name {
  font-size: 9px;
  color: var(--fg-2);
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 100%;
}

.eb-slot-power { font-family: var(--font-mono); font-size: 9px; color: var(--brand-teal); }

/* Search panel */
.eb-search-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eb-search-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
}


/* Summary panel */
.eb-summary {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: calc(var(--nav-height) + 24px);
}

.eb-summary-block { display: flex; flex-direction: column; gap: 4px; }
.eb-summary-block + .eb-summary-block { padding-top: 14px; border-top: 1px solid var(--border-subtle); }

.eb-mastery-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.eb-mastery-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.eb-mastery-opts {
  display: flex;
  gap: 4px;
}

.eb-mastery-opts button {
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.eb-mastery-opts button:hover { background: var(--bg-3); color: var(--fg-1); }

.eb-mastery-opts button.active {
  background: var(--brand-teal-10, rgba(70,221,218,.12));
  border-color: var(--brand-teal);
  color: var(--brand-teal);
}

.eb-summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
}

.eb-summary-rap {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--brand-teal);
}

.eb-breakdown-section { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }

.eb-breakdown { display: flex; flex-direction: column; gap: 10px; }

.eb-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.eb-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eb-group-name { font-size: 12px; font-weight: 600; color: var(--fg-1); }
.eb-group-power { font-family: var(--font-mono); font-size: 12px; color: var(--brand-teal); flex-shrink: 0; }

.eb-threshold-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eb-threshold-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}

.eb-threshold-bar {
  height: 100%;
  background: var(--brand-teal);
  border-radius: 2px;
  transition: width var(--dur-base) var(--ease-out);
}

.eb-threshold-bar.over { background: var(--down-500); }

.eb-threshold-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-4);
  white-space: nowrap;
  flex-shrink: 0;
}

.eb-threshold-label.over { color: var(--down-500); }

.eb-contrib-list { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }

.eb-contrib {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-2);
}

.eb-contrib img { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.eb-contrib-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eb-contrib-power { font-family: var(--font-mono); font-size: 11px; color: var(--brand-teal); flex-shrink: 0; }
.eb-contrib-dim .eb-contrib-power { color: var(--fg-4); }

.eb-pie-wrap { display: flex; align-items: flex-start; gap: 16px; }
.eb-pie-wrap svg { flex-shrink: 0; }
.eb-pie-legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.eb-pie-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.eb-pie-legend-item img { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.eb-pie-rap { font-family: var(--font-mono); font-size: 11px; color: var(--brand-teal); flex-shrink: 0; }
.eb-pie-pct { font-family: var(--font-mono); font-size: 11px; color: var(--fg-4); flex-shrink: 0; }
@media (max-width: 600px) { .eb-pie-wrap { flex-direction: column; align-items: center; } }

.eb-dim-tag {
  font-size: 10px;
  background: rgba(239,68,68,0.12);
  color: var(--down-500);
  border-radius: 3px;
  padding: 1px 5px;
  flex-shrink: 0;
}

/* Picker */
.eb-picker-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eb-picker-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eb-slot-grid-wrap { position: relative; display: inline-block; }
.eb-reset-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--down-500);
  background: transparent;
  color: var(--down-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.eb-reset-btn svg { width: 14px; height: 14px; }
.eb-reset-btn:hover { border-color: #b91c1c; color: #b91c1c; }

.eb-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.eb-pick-item {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  user-select: none;
}

.eb-pick-item:hover { border-color: var(--brand-teal); background: var(--bg-2); }

.eb-pick-item img { width: 48px; height: 48px; object-fit: contain; }

.eb-pick-name {
  font-size: 9px;
  color: var(--fg-2);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}


@media (max-width: 768px) {
  .eb-layout { grid-template-columns: 1fr; }
  .eb-summary { position: static; order: -1; }
  .eb-builder { order: 1; }
  .eb-slot { width: 72px; height: 72px; }
  .eb-slot img { width: 36px; height: 36px; }
  .eb-pick-item img { width: 36px; height: 36px; }
}

/* ── What's New modal ── */
.whats-new-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.whats-new-modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.24);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  animation: whats-new-in 0.2s var(--ease-out);
}

@keyframes whats-new-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.whats-new-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.whats-new-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.whats-new-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: var(--tracking-tight);
}

.whats-new-date {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--fg-4);
}

.whats-new-close {
  background: none;
  border: none;
  color: var(--fg-4);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease-out);
}

.whats-new-close:hover { color: var(--fg-1); }

.whats-new-list {
  list-style: disc;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
}

.whats-new-list li {
  font-size: var(--text-sm);
  color: var(--fg-3);
  line-height: 1.5;
}

.whats-new-list a { color: var(--brand-teal); }

.whats-new-footer {
  font-size: var(--text-xs);
  color: var(--fg-4);
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.whats-new-footer a { color: var(--brand-teal); text-decoration: none; }
.whats-new-footer a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .whats-new-overlay { padding: 16px; align-items: center; }
  .whats-new-modal { max-width: 100%; }
}

/* ── Error pages ── */
.error-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 40px 24px;
}

.error-code {
  font-family: var(--font-mono);
  font-size: 96px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--fg-1);
  line-height: 1;
}

.error-msg {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--fg-1);
}

.error-sub {
  font-size: var(--text-base);
  color: var(--fg-4);
  max-width: 360px;
}

.error-link {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  background: var(--brand-teal);
  color: var(--bg-page);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.error-link:hover { opacity: 0.85; text-decoration: none; }

.item-not-found-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 40px 24px;
}

.item-not-found-code {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--fg-1);
}

.item-not-found-sub {
  font-size: var(--text-sm);
  color: var(--fg-4);
}

.item-not-found-sub code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Item detail ── */
.item-page { display: flex; flex-direction: column; gap: 40px; }

.item-detail-header {
  position: relative;
  display: grid;
  grid-template-columns: 120px 1fr;
  grid-template-rows: auto auto;
  column-gap: 24px;
  row-gap: 10px;
  align-items: start;
}

.item-detail-thumb {
  width: 120px;
  height: 120px;
  grid-row: 1 / 3;
  align-self: start;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-detail-thumb img { width: 100%; height: 100%; object-fit: contain; }

.item-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.item-detail-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.item-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  right: 0;
  position: absolute;
}

@media (max-width: 768px) {
  .item-detail-actions { position: static; margin-top: 6px; }
}

.item-detail-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.item-detail-desc {
  font-size: var(--text-sm);
  color: var(--fg-3);
  line-height: 1.5;
}

.item-detail-desc em { color: var(--fg-4); }

.item-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  color: var(--fg-3);
  background: var(--bg-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}


.item-detail-name {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--fg-1);
  line-height: var(--lh-tight);
}

.item-detail-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .item-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
  }
  #item-created-stat {
    grid-column: 1 / -1;
    align-items: center;
  }
  .item-stat { align-items: center; }
}

.item-stat { display: flex; flex-direction: column; gap: 2px; }

.item-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
}

.stat-tooltip-anchor {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border-default);
  font-size: 9px;
  font-weight: 700;
  color: var(--fg-4);
  cursor: default;
  margin-left: 4px;
  flex-shrink: 0;
  padding-top: 1px;
}

.stat-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-4);
  color: var(--fg-1);
  font-size: 11px;
  font-weight: 400;
  font-family: var(--font-sans);
  white-space: normal;
  max-width: 260px;
  width: max-content;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.5;
  z-index: 10;
}

.stat-tooltip-anchor:hover .stat-tooltip { display: block; }
.stat-tooltip--below { bottom: auto; top: calc(100% + 6px); }

.filter-mcap-wrap {
  display: inline-flex;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  border: none;
  margin-left: 0;
  padding-top: 0;
  cursor: default;
}

@media (max-width: 768px) {
  .filter-mcap-wrap { display: inline-flex; }
}

.item-stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.item-stat-rate {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.item-stat-rate-up   { color: var(--up-500); }
.item-stat-rate-down { color: var(--down-500); }

.item-stat-updated {
  font-size: 10px;
  color: var(--fg-4);
  font-family: var(--font-mono);
}

.item-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--fg-1);
}

.item-section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.item-market-stats { margin-top: 40px; margin-bottom: 0; }

/* ── Price History table ── */
.item-price-history { margin-top: 40px; }

.ph-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.ph-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.ph-table th.ph-left,
.ph-table td.ph-date { text-align: left; }

.ph-table th.ph-num,
.ph-table td.ph-num { text-align: right; }

.ph-table th.ph-tight,
.ph-table td.ph-num { width: 1%; white-space: nowrap; }

.ph-table th:first-child,
.ph-table td:first-child { padding-left: 0; }

.ph-table th:last-child,
.ph-table td:last-child { padding-right: 0; }

.ph-table td {
  padding: 8px 10px;
  color: var(--fg-2);
  border-bottom: 1px solid var(--border-subtle);
}

.ph-table tr:last-child td { border-bottom: none; }
.ph-table tr:hover td { background: var(--bg-2); }

.ph-date { color: var(--fg-3); font-size: var(--text-xs); white-space: nowrap; }
.ph-mono { font-family: var(--font-mono); }

.ph-more-btn {
  display: block;
  margin-top: 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand-teal);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.ph-more-btn:hover { opacity: 0.75; }

/* ── Price History modal ── */
.ph-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 16px;
}

.ph-modal-inner {
  background: var(--bg-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.ph-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-1);
}

.ph-modal-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-1);
  letter-spacing: 0;
}

.ph-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ph-export-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 28px;
  background: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.ph-export-btn:hover { color: var(--fg-1); border-color: var(--border-strong); background: var(--bg-2); }
.ph-export-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.ph-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--fg-3);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.ph-modal-close:hover { color: var(--fg-1); background: var(--bg-3); }

.ph-modal-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ph-filter-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ph-date-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.ph-date-wrap:focus-within {
  border-color: var(--brand-teal);
  box-shadow: none;
}

.ph-date-icon {
  width: 12px;
  height: 12px;
  color: var(--fg-4);
  flex-shrink: 0;
  pointer-events: none;
}

.ph-date-input {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-2);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
  min-width: 100px;
}

.ph-date-input:focus-visible { box-shadow: none; outline: none; }

.ph-date-input::-webkit-calendar-picker-indicator {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
}

[data-theme='light'] .ph-date-input { color-scheme: light; }

.ph-filter-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-4);
  margin-left: 4px;
}

.ph-modal-body {
  overflow-y: auto;
  padding: 0 20px 16px;
  flex: 1;
}

.ph-thead-sticky th {
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 1;
  padding-top: 12px;
}

.ph-empty {
  text-align: center;
  color: var(--fg-4);
  font-size: var(--text-sm);
  padding: 24px 0;
}

/* ── Tooltip ── */
.ph-tip {
  position: fixed;
  z-index: 500;
  background: var(--bg-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 4px 8px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .ph-table th, .ph-table td { padding: 7px 8px; }
  .ph-table { font-size: var(--text-xs); }
  .ph-modal-filter { gap: 6px; }
  .ph-date-wrap { padding: 3px 6px; }
  .ph-date-input { font-size: 10px; }
}

.item-vbreak-section { margin-top: 40px; }

.item-vbreak-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
}

@media (max-width: 768px) {
  .item-vbreak-body { grid-template-columns: 1fr; gap: 24px; }
}

.vpie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.vpie-wrap--right {
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

.vpie-svg { width: 240px; height: 240px; display: block; flex-shrink: 0; }

.vpie-wrap--right .vpie-svg { width: 160px; height: 160px; }

.vpie-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; max-width: 260px; }

.vpie-wrap--right .vpie-legend { flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; max-width: none; }

.vpie-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.vpie-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.vpie-legend-label { color: var(--fg-2); }
.vpie-legend-pct { font-family: var(--font-mono); font-size: 11px; color: var(--fg-4); }

@media (max-width: 600px) {
  .vpie-svg { width: 180px; height: 180px; }
  .vpie-wrap--right { flex-direction: column; }
  .vpie-wrap--right .vpie-svg { width: 180px; height: 180px; }
  .vpie-wrap--right .vpie-legend { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}

.item-variants-section { margin-top: 40px; }

.item-market-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.mstat-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  background: var(--bg-1);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.mstat-tile:nth-child(3n)          { border-right: none; }
.mstat-tile:nth-last-child(-n+3)   { border-bottom: none; }

.mstat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.mstat-value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--fg-1);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.mstat-val-sub {
  font-size: var(--text-sm);
  font-weight: 500;
}

.mstat-val-pct {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg-4);
}

@media (max-width: 768px) {
  .item-market-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .mstat-tile { padding: 12px 14px; }
  .mstat-tile:nth-child(3n)        { border-right: 1px solid var(--border-subtle); }
  .mstat-tile:nth-child(2n)        { border-right: none; }
  .mstat-tile:nth-last-child(-n+3) { border-bottom: 1px solid var(--border-subtle); }
  .mstat-tile:nth-last-child(-n+2) { border-bottom: none; }
  .mstat-value { font-size: var(--text-base); }
}

.item-vbreak-section { display: flex; flex-direction: column; }

.vbreak-row {
  display: grid;
  grid-template-columns: 120px 1fr 110px;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.vbreak-row:last-child { border-bottom: none; }

.vbreak-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vbreak-thumb { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.vpie-legend-thumb { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }

.vbreak-bar-wrap {
  background: var(--bg-3);
  border-radius: 2px;
  height: 8px;
  overflow: hidden;
}

.vbreak-bar {
  height: 100%;
  background: var(--brand-teal);
  border-radius: 2px;
  transition: width 0.4s var(--ease-out);
}

.vbreak-stats {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.vbreak-exists { color: var(--fg-2); font-weight: 600; text-align: right; }
.vbreak-pct    { color: var(--fg-4); text-align: left; }

@media (max-width: 600px) {
  .vbreak-row { grid-template-columns: 80px 1fr 90px; gap: 8px; }
  .vbreak-label { font-size: 11px; }
  .vbreak-stats { font-size: 11px; }
}

.item-variants-section { display: flex; flex-direction: column; }

.item-variants-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .item-variants-section { min-width: 0; width: 100%; }
  .item-variants-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    min-width: 0;
  }
}

.variant-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  width: 100px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .variant-card { width: 100%; min-width: 0; }
}

.variant-card:hover { border-color: var(--border-default); background: var(--bg-2); text-decoration: none; }

.variant-card-current { border-color: var(--brand-teal) !important; background: var(--brand-teal-10) !important; }

.variant-card-thumb {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.variant-card-thumb img { width: 56px; height: 56px; object-fit: contain; }

.variant-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.item-charts { display: flex; flex-direction: column; gap: 40px; }

.item-chart-section { display: flex; flex-direction: column; gap: 12px; }

.item-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.item-chart-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.item-chart-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.item-chart-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-4);
  min-height: 1em;
}

.item-chart-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--fg-1);
}

.item-chart-delta { font-size: 14px; min-height: 20px; }

.chart-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.zoom-reset-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--brand-teal);
  background: var(--brand-teal-10);
  border: 1px solid var(--brand-teal-40);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.zoom-reset-btn:hover { background: var(--brand-teal-20); }

.overlay-exists-btn { font-size: 11px; padding: 3px 10px; }

@media (max-width: 768px) {
  .chart-controls { flex-wrap: wrap; gap: 6px; }
  .zoom-reset-btn { font-size: 10px; padding: 3px 8px; }
  .overlay-exists-btn { font-size: 10px; padding: 3px 8px; }
}

@media (max-width: 600px) {
  .item-detail-header { grid-template-columns: 100px 1fr; }
  .item-detail-thumb { width: 100px; min-width: 100px; height: 100px; grid-row: 1; }
  .item-detail-thumb img { width: 100%; height: 100%; }
  .item-detail-meta { grid-column: 2; grid-row: 1; }
  .item-detail-stats { grid-column: 1 / -1; grid-row: 2; margin-bottom: 8px; }
  .item-detail-name { font-size: var(--text-xl); }
  .item-chart-header { flex-direction: column; gap: 10px; }
}

/* ── Items loading ── */
.items-loading-overlay {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--fg-3);
  font-size: var(--text-lg);
  z-index: 30;
}

.items-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand-teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Items controls ── */
.items-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.items-controls-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.filters-toggle {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-3);
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.filters-toggle:hover { color: var(--fg-1); border-color: var(--border-default); }

.filters-body {
  flex-direction: column;
  gap: 10px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  width: 52px;
  flex-shrink: 0;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-3);
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--fg-1);
  border-color: var(--border-default);
}

.filter-btn.active {
  color: var(--brand-teal);
  background: var(--brand-teal-10);
  border-color: var(--border-teal);
}

.sort-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.sort-dropdown { position: relative; }

.sort-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 10px 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sort-trigger:hover { border-color: var(--border-default); color: var(--fg-1); }
.sort-trigger.open  { border-color: var(--border-teal); color: var(--fg-1); }

.sort-chevron { width: 12px; height: 12px; flex-shrink: 0; transition: transform var(--dur-fast) var(--ease-out); }
.sort-trigger.open .sort-chevron { transform: rotate(180deg); }

.sort-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 150px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 4px;
  z-index: 200;
  overflow: visible;
}
.sort-menu.open { display: flex; }

.sort-option {
  position: relative;
  display: flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-2);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  outline: none;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sort-option:hover  { background: var(--bg-2); color: var(--fg-1); }
.sort-option.active { color: var(--brand-teal); background: var(--brand-teal-10); }

.sort-opt-tip {
  display: none;
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-4);
  color: var(--fg-1);
  font-size: 11px;
  font-weight: 400;
  font-family: var(--font-sans);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.5;
  z-index: 201;
}
.sort-option:hover .sort-opt-tip { display: block; }

.na-toggles {
  display: flex;
  gap: 16px;
}

.na-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--fg-4);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: var(--font-sans);
  text-align: left;
  transition: color var(--dur-fast) var(--ease-out);
}

.na-toggle:hover { color: var(--fg-2); }

@media (max-width: 768px) {
  .filter-label { display: none; }
}

/* ── Exclusive Daycare tool ── */
.edc-header { margin-bottom: 20px; }

.edc-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.edc-top-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.edc-search-input { flex: 1; }

.edc-level-input {
  width: 140px;
  flex-shrink: 0;
  -moz-appearance: textfield;
}

.edc-level-input::-webkit-outer-spin-button,
.edc-level-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.edc-level-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--brand-teal);
  white-space: nowrap;
  min-width: 48px;
}

.edc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}

.edc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.edc-card:hover { border-color: var(--border-default); background: var(--bg-2); text-decoration: none; }

.edc-card-thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edc-card-thumb img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.edc-card-body {
  flex: 1;
  min-width: 0;
}

.edc-card-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.edc-card-tags {
  flex-shrink: 0;
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.edc-evolved-badge {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--brand-teal);
  background: var(--brand-teal-10);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.edc-card-rates {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}

.edc-card-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.edc-card-rap {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-4);
}

.edc-card-rates b {
  color: var(--brand-teal);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  margin-right: 3px;
}

.edc-card-payoff {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--up-500);
  background: var(--up-100);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  align-self: flex-start;
}

.edc-card-payoff.na {
  color: var(--fg-4);
  background: none;
}

.edc-loading {
  text-align: center;
  color: var(--fg-3);
  font-size: var(--text-sm);
  padding: 32px 0;
}

/* ── Admin Hub ── */
.admin-back-link {
  color: var(--fg-3);
  text-decoration: none;
}
.admin-back-link:hover { color: var(--fg-1); }

.admin-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.admin-hub-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--fg-1);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.admin-hub-card:hover { background: var(--bg-3); border-color: var(--border-strong); text-decoration: none; }

.admin-hub-icon { width: 22px; height: 22px; color: var(--brand-teal); }
.admin-hub-card-title { font-weight: 700; font-size: var(--text-base); }
.admin-hub-card-sub { font-size: var(--text-sm); color: var(--fg-3); line-height: 1.4; }

/* ── Admin Jobs ── */
.admin-jobs-list { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }

.admin-job-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.admin-job-info { flex: 1; min-width: 0; }
.admin-job-name { font-weight: 700; font-size: var(--text-base); margin-bottom: 4px; }
.admin-job-desc { font-size: var(--text-sm); color: var(--fg-3); line-height: 1.4; }

.admin-job-controls { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.admin-job-status {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-3);
}
.admin-job-status.job-status-running { color: var(--brand-teal); }
.admin-job-status.job-status-done    { color: var(--up-500); }
.admin-job-status.job-status-error   { color: var(--down-500); }

.admin-job-btn {
  padding: 7px 18px;
  background: var(--brand-teal);
  color: var(--bg-page);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.admin-job-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.admin-job-btn:not(:disabled):hover { opacity: 0.85; }

/* ── Admin Logs ── */
.admin-logs-wrap {
  margin-top: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.admin-logs-table { width: 100%; border-collapse: collapse; }

.admin-log-row { border-bottom: 1px solid var(--border-subtle); }
.admin-log-row:last-child { border-bottom: none; }
.admin-log-row-error .admin-log-line { color: var(--down-500); }

.admin-log-line {
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-2);
  word-break: break-all;
}

.admin-logs-empty {
  padding: 32px;
  text-align: center;
  color: var(--fg-4);
  font-size: var(--text-sm);
}

@media (max-width: 768px) {
  .edc-top-row { flex-wrap: wrap; }
  .edc-search-input { width: 100%; }
  .edc-level-input { flex: 1; width: auto; }
  .edc-grid { grid-template-columns: 1fr; }
}

/* ── Sentiment Gauge ── */
.sentiment-section { margin-top: 28px; }

.sentiment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.sentiment-body { width: 100%; }

.sentiment-gauge { display: flex; flex-direction: column; gap: 10px; }

.sentiment-label-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.sentiment-word {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
}
.sentiment-word.sentiment-bull { color: var(--up-500); }
.sentiment-word.sentiment-bear { color: var(--down-500); }
.sentiment-word.sentiment-neut { color: var(--fg-3); }

.sentiment-pct-label {
  font-size: var(--text-sm);
  color: var(--fg-3);
  font-family: var(--font-mono);
}

.sentiment-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-3);
  gap: 2px;
}

.sentiment-bar-seg { height: 100%; min-width: 0; transition: width 0.4s ease; }
.sentiment-bar-seg:first-child { border-radius: 999px 0 0 999px; }
.sentiment-bar-seg:last-child  { border-radius: 0 999px 999px 0; }
.sentiment-bar-bull { background: var(--up-500); }
.sentiment-bar-neut { background: var(--fg-5, var(--border-strong)); }
.sentiment-bar-bear { background: var(--down-500); }

.sentiment-counts {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.sentiment-count {
  font-size: var(--text-sm);
  color: var(--fg-3);
  font-family: var(--font-mono);
}
.sentiment-count-n { font-weight: 700; }
.sentiment-count-bull .sentiment-count-n { color: var(--up-500); }
.sentiment-count-bear .sentiment-count-n { color: var(--down-500); }
.sentiment-count-neut .sentiment-count-n { color: var(--fg-2); }
.sentiment-count-total .sentiment-count-n { color: var(--fg-2); }

/* ── Egg Chances tool ── */
.egg-page { display: flex; flex-direction: column; gap: 24px; }

.egg-controls { display: flex; flex-direction: column; gap: 10px; }

.egg-controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.egg-search { flex: 1; min-width: 160px; max-width: 280px; }

.egg-cat-wrap { position: relative; }

.egg-cat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  min-width: 160px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.egg-cat-btn:hover         { border-color: var(--border-strong); }
.egg-cat-btn.open          { border-color: var(--brand-teal); }
.egg-cat-btn:focus-visible { box-shadow: none; }

.egg-cat-chevron { flex-shrink: 0; color: var(--fg-4); transition: transform var(--dur-base) var(--ease-out); }
.egg-cat-btn.open .egg-cat-chevron { transform: rotate(180deg); }

.egg-cat-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  max-height: 240px;
  overflow-y: auto;
}
.egg-cat-dropdown.open { display: block; }

.egg-cat-item {
  padding: 8px 14px;
  font-size: var(--text-sm);
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.egg-cat-item:hover  { background: var(--bg-2); color: var(--fg-1); }
.egg-cat-item.active { color: var(--brand-teal); background: var(--brand-teal-10); }

.egg-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

.egg-list {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  max-height: 640px;
}

.egg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  border-left: 2px solid transparent;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.egg-item:last-child { border-bottom: none; }
.egg-item:hover { background: var(--bg-2); }
.egg-item.active { background: var(--brand-teal-10); border-left-color: var(--brand-teal); }

.egg-item-thumb { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.egg-item-info  { flex: 1; min-width: 0; }
.egg-item-name  { font-size: var(--text-sm); font-weight: 500; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.egg-item-cat   { font-size: var(--text-xs); color: var(--fg-4); margin-top: 2px; }
.egg-item-id    { font-family: var(--font-mono); font-size: 10px; color: var(--fg-5); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.egg-list-empty { padding: 40px 20px; text-align: center; color: var(--fg-4); font-size: var(--text-sm); }

.egg-detail {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.egg-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--fg-4);
  font-size: var(--text-sm);
}
.egg-detail-empty svg { width: 28px; height: 28px; }

.egg-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-2);
}
.egg-detail-head-info { min-width: 0; flex: 1; }
.egg-share-btn { margin-left: auto; align-self: flex-start; flex-shrink: 0; display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); background: var(--bg-1); color: var(--fg-3); font-size: 11px; font-weight: 500; cursor: pointer; transition: color 0.15s, background 0.15s, border-color 0.15s; }
.egg-share-btn:hover { color: var(--fg-1); background: var(--bg-2); border-color: var(--border-default); }
.egg-share-btn[data-copied] { color: var(--brand-teal); border-color: var(--brand-teal); }
.egg-detail-thumb { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.egg-detail-name  { font-size: var(--text-lg); font-weight: 600; color: var(--fg-1); }
.egg-detail-cat   { font-size: var(--text-xs); color: var(--fg-4); margin-top: 3px; }
.egg-detail-id    { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-5); margin-top: 2px; }

/* Modifier stat row (shiny / rainbow / gold) */
.egg-mod-section {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}
.egg-mod-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  gap: 3px;
  border-right: 1px solid var(--border-subtle);
}
.egg-mod-stat:last-child { border-right: none; }
.egg-mod-label  { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-4); }
.egg-mod-val    { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 600; color: var(--fg-2); }
.egg-mod-val.shiny   { color: var(--info-500); }
.egg-mod-val.rainbow { color: #c084fc; }
.egg-mod-val.gold    { color: var(--warn-500); }
.egg-mod-onein { font-family: var(--font-mono); font-size: 10px; color: var(--fg-4); }

/* Column header row */
.egg-chance-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-subtle);
}
.egg-chance-col-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-4); }

/* Chance rows */
.egg-chance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.egg-chance-row:last-child { border-bottom: none; }

.egg-chance-name { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; text-decoration: none; color: var(--fg-1); }
.egg-chance-name:is(a):hover .egg-chance-name-text { color: var(--brand-teal); text-decoration: underline; }
.egg-chance-name--unknown .egg-chance-name-text { color: var(--fg-4); }
.egg-chance-name-text { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.egg-chance-pet-icon { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }

/* Tier tags in egg list items */
.egg-item-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.egg-tier-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.6;
}
.egg-tier-tag.huge       { background: rgba(168,85,247,0.15); color: #a855f7; }
.egg-tier-tag.titanic    { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.egg-tier-tag.gargantuan { background: rgba(6,182,212,0.15);   color: var(--brand-teal); }


/* Divider between filter groups in the same row */
.egg-filter-divider { width: 1px; height: 18px; background: var(--border-subtle); flex-shrink: 0; }

.egg-chance-nums         { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.egg-chance-official     { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 120px; }
.egg-chance-official-pct { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-2); }
.egg-chance-official-1in { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-4); }
.egg-chance-est          { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 120px; }
.egg-chance-est-pct      { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-2); }
.egg-chance-est-1in      { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-4); }
.egg-est-warn            { position: relative; color: #f59e0b; font-size: 10px; cursor: help; margin-left: 3px; }
.egg-est-warn:hover .stat-tooltip { display: block; }
.egg-chance-est-ci       { position: relative; font-family: var(--font-mono); font-size: 10px; cursor: help; }
.egg-chance-est-ci:hover .stat-tooltip { display: block; }
.egg-chance-est-ci.ci-tight { color: var(--up-500); }
.egg-chance-est-ci.ci-mod   { color: #f59e0b; }
.egg-chance-est-ci.ci-wide  { color: var(--down-500); }
.egg-est-n               { font-family: var(--font-mono); font-size: 9px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--fg-4); margin-left: 4px; margin-right: 2px; }

@media (max-width: 768px) {
  .egg-layout   { grid-template-columns: 1fr; }
  .egg-list     { max-height: 320px; }
  .egg-search   { max-width: 100%; }
  .egg-cat-wrap { width: 100%; }
  .egg-cat-btn  { width: 100%; }

  /* 2-line layout: name full-width, then official | est side-by-side */
  .egg-chance-row,
  .egg-chance-header    { flex-wrap: wrap; gap: 2px 0; padding: 8px 16px; }
  .egg-chance-name      { flex: 0 0 100%; min-width: 0; }
  .egg-chance-nums      { flex: 0 0 100%; justify-content: space-between; gap: 0; }
  .egg-chance-official  { flex: 1; min-width: 0; align-items: flex-start; }
  .egg-chance-est       { display: flex; flex: 1; min-width: 0; align-items: flex-end; }
}

@media (max-width: 600px) {
  .sentiment-header { flex-direction: column; align-items: flex-start; }
  .sentiment-word { font-size: 18px; }
  .sentiment-counts { gap: 12px; }
}

/* ── Egg Hatch Simulator ── */
.egg-sim-section   { border-top: 1px solid var(--border-subtle); padding: var(--space-4); }
.egg-sim-header    { margin-bottom: var(--space-3); }
.egg-sim-title     { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--fg-4); }
.egg-sim-header { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-3); }
.egg-sim-help { font-size: 9px; }
.egg-sim-input-row { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.egg-sim-label     { font-size: var(--text-xs); color: var(--fg-4); flex-shrink: 0; }
.egg-sim-input {
  background: var(--bg-2); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); color: var(--fg-1); font-family: var(--font-mono);
  font-size: var(--text-sm); padding: 4px 8px; width: 90px; outline: none;
  transition: border-color var(--dur-fast);
}
.egg-sim-input:focus { border-color: var(--brand-teal); box-shadow: none; outline: none; }
.egg-sim-input::-webkit-outer-spin-button,
.egg-sim-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.egg-sim-input[type=number] { -moz-appearance: textfield; }
.egg-sim-btn {
  background: var(--brand-teal); border: none; border-radius: var(--radius-sm);
  color: var(--bg-page); font-size: var(--text-xs); font-weight: 700; padding: 4px 14px;
  cursor: pointer; transition: opacity var(--dur-fast); white-space: nowrap; align-self: stretch;
}
.egg-sim-btn:hover:not(:disabled) { opacity: 0.85; }
.egg-sim-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.egg-sim-loading { padding: var(--space-4); color: var(--fg-4); font-size: var(--text-xs); text-align: center; }
.egg-sim-empty   { padding: var(--space-2) 0; color: var(--fg-4); font-size: var(--text-xs); }
.egg-sim-results-wrap { display: flex; flex-direction: column; gap: var(--space-4); }

/* Overall summary */
.egg-sim-overall {
  background: var(--bg-2); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: var(--space-3);
  display: flex; flex-direction: column; gap: 6px;
}
.egg-sim-overall-row  { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.egg-sim-overall-label { font-size: var(--text-xs); color: var(--fg-4); }
.egg-sim-overall-val   { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700; color: var(--fg-1); }

/* Per-pet cards */
.egg-sim-chances { display: flex; flex-direction: column; gap: var(--space-2); }
.egg-sim-pet-card {
  background: var(--bg-2); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: var(--space-3);
  display: flex; flex-direction: row; gap: var(--space-3); align-items: stretch;
}
.egg-sim-pet-card-left { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.egg-sim-pet-card-right { flex: 2 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.egg-sim-pet-card-name {
  display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-2);
  font-size: var(--text-sm); color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.egg-sim-pet-stat  { display: flex; align-items: baseline; gap: var(--space-2); }
.egg-sim-big-pct   { font-size: 22px; font-weight: 800; font-family: var(--font-mono); line-height: 1; color: var(--fg-1); }
.egg-sim-big-pct.huge       { color: #a855f7; }
.egg-sim-big-pct.titanic    { color: var(--warn-500); }
.egg-sim-big-pct.gargantuan { color: var(--brand-teal); }
.egg-sim-big-label { font-size: var(--text-xs); color: var(--fg-4); }
.egg-sim-pct-bar   { height: 4px; background: var(--bg-3); border-radius: 2px; margin: var(--space-2) 0 var(--space-1); overflow: hidden; }
.egg-sim-pct-fill  { height: 100%; border-radius: 2px; background: var(--fg-4); transition: width 600ms var(--ease-out); }
.egg-sim-pct-fill.titanic    { background: var(--warn-500); }
.egg-sim-pct-fill.gargantuan { background: var(--brand-teal); }
.egg-sim-avg { font-size: var(--text-xs); color: var(--fg-4); }
.egg-sim-mini-hist-label { font-size: 10px; color: var(--fg-4); margin-top: var(--space-2); margin-bottom: 4px; }
.egg-sim-mini-hist-foot  { font-size: var(--text-xs); color: var(--fg-3); margin-top: 4px; }
.egg-sim-mini-hist-foot strong { color: var(--fg-1); }

/* Histogram */
.egg-sim-dist      { display: flex; flex-direction: column; gap: 5px; }
.egg-sim-dist-title { font-size: var(--text-sm); font-weight: 600; color: var(--fg-1); }
.egg-sim-dist-sub  { font-size: 10px; color: var(--fg-4); }
.egg-sim-chart {
  display: flex; align-items: flex-end; gap: 3px; flex: 1; min-height: 70px;
}
.egg-sim-bar-col {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 2px;
}
.egg-sim-bar-pct {
  font-size: 9px; font-family: var(--font-mono); color: var(--fg-5);
  height: 16px; display: flex; align-items: flex-end; justify-content: center;
}
.egg-sim-bar-col.peak .egg-sim-bar-pct { color: var(--brand-teal); font-weight: 700; }
.egg-sim-bar-fill      { width: 100%; background: var(--bg-3); border-radius: 2px 2px 0 0; min-height: 0; }
.egg-sim-bar-fill.peak { background: var(--brand-teal); }
.egg-sim-xlabels   { display: flex; gap: 3px; }
.egg-sim-xlabel    { flex: 1; text-align: center; font-size: 9px; color: var(--fg-5); font-family: var(--font-mono); overflow: hidden; white-space: nowrap; }
.egg-sim-xlabel-axis { font-size: 10px; color: var(--fg-5); text-align: center; }
.egg-sim-summary   { font-size: var(--text-sm); color: var(--fg-3); }
.egg-sim-summary strong { color: var(--fg-1); }

@media (max-width: 480px) {
  .egg-sim-big-pct { font-size: 18px; }
  .egg-sim-pet-card { flex-direction: column; }
  .egg-sim-pet-card-right { width: 100%; }
}

/* ── Portfolio / Favorites page ── */
.pflio-page-header { margin-bottom: 24px; }

.pflio-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 120px;
  color: var(--fg-4);
  font-size: var(--text-sm);
}

.pflio-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 24px;
  text-align: center;
}
.pflio-empty-icon  { width: 40px; height: 40px; color: var(--fg-5); }
.pflio-empty-title { font-size: var(--text-xl); font-weight: 600; color: var(--fg-2); }
.pflio-empty-sub   { font-size: var(--text-sm); color: var(--fg-4); }
.pflio-browse-btn {
  margin-top: 4px;
  background: var(--brand-teal);
  color: var(--bg-page);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 8px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: opacity var(--dur-fast);
}
.pflio-browse-btn:hover { opacity: 0.85; text-decoration: none; }

.pflio-tiles {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pflio-tile {
  flex: 1 1 130px;
  min-width: 0;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pflio-tile-primary {
  flex: 1.6 1 180px;
  background: var(--bg-2);
}
.pflio-tile-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-4);
}
.pflio-tile-big {
  font-size: 26px;
  font-weight: 700;
  color: var(--fg-1);
  font-family: var(--font-mono);
  line-height: 1.1;
  min-height: 30px;
}
.pflio-tile-val {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  min-height: 22px;
  display: flex;
  align-items: center;
}
.pflio-tile-sub {
  font-size: 12px;
  color: var(--fg-4);
  font-family: var(--font-mono);
  line-height: 1;
  min-height: 14px;
  display: flex;
  align-items: center;
}

.pflio-highlights {
  display: flex;
  flex-wrap: wrap;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.pflio-hl {
  flex: 1 1 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 18px;
  min-width: 0;
}
.pflio-hl-sep { border-left: 1px solid var(--border-subtle); }
.pflio-hl-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-5);
}
.pflio-hl > span:last-child {
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pflio-hl > span:last-child:has(.pflio-hl-name) {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.pflio-hl-name {
  font-size: 11px;
  color: var(--fg-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pflio-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-4);
  margin-bottom: 4px;
}
.pflio-chart-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px 12px;
  margin-bottom: 16px;
}
.pflio-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.pflio-chart-val-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
  min-height: 28px;
}
.pflio-chart-val   { font-size: 20px; font-weight: 700; color: var(--fg-1); }
.pflio-chart-delta { font-size: 13px; font-family: var(--font-mono); }
.pflio-chart-date  { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); }
.pflio-chart-svg   { width: 100%; height: 160px; display: block; overflow: visible; }
.pflio-nav-svg     { width: 100%; height: 44px; display: block; overflow: visible; margin-top: 10px; border-top: 1px solid var(--border-subtle); }
.item-rap-nav      { width: 100%; height: 44px; display: block; overflow: visible; margin-top: 10px; border-top: 1px solid var(--border-subtle); }

.pflio-list-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.pflio-table-scroll { overflow-x: auto; }
.pflio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.pflio-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-4);
  background: var(--bg-2);
  white-space: nowrap;
}
.pflio-th-item                    { min-width: 160px; }
.pflio-table .pflio-th-num    { text-align: right; }
.pflio-table .pflio-th-spark  { text-align: right; width: 96px; }
.pflio-table .pflio-th-action { width: 40px; text-align: right; }
.pflio-tr {
  border-top: 1px solid var(--border-subtle);
  transition: background var(--dur-fast);
  cursor: pointer;
}
.pflio-tr:hover { background: var(--bg-2); }
.pflio-td { padding: 10px 16px; vertical-align: middle; }
.pflio-td-num    { text-align: right; white-space: nowrap; }
.pflio-td-spark  { text-align: right; padding-right: 12px; }
.pflio-td-action { text-align: right; padding-right: 12px; }
.pflio-table a { text-decoration: none; color: inherit; }
.pflio-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.pflio-item-link:hover .pflio-item-name { color: var(--brand-teal); }
.pflio-thumb { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.pflio-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  transition: color var(--dur-fast);
}
.pflio-rap    { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--brand-teal); }
.pflio-exists { font-family: var(--font-mono); font-size: 12px; color: var(--fg-4); }
.pflio-na     { color: var(--fg-5); font-size: 12px; }
.pflio-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--fg-5);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast), background var(--dur-fast);
  margin-left: auto;
}
.pflio-remove-btn:hover { color: var(--down-500); background: var(--down-100); }
.pflio-remove-btn svg { width: 14px; height: 14px; }

.home-shelf-header { margin-bottom: 10px; }
.home-shelf-title-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: inherit;
}
.home-shelf-title-link:hover { text-decoration: none; }
.home-shelf-title-link:hover .item-section-label { color: var(--brand-teal); }
.home-shelf-chevron { width: 16px; height: 16px; color: var(--fg-4); flex-shrink: 0; }
.home-shelf-title-link:hover .home-shelf-chevron { color: var(--brand-teal); }

@media (max-width: 1024px) {
  .pflio-hide-lg { display: none !important; }
}
@media (max-width: 768px) {
  .pflio-hide-md { display: none !important; }
  .pflio-nav-svg { display: none !important; }
  .item-rap-nav  { display: none !important; }
}
@media (max-width: 640px) {
  .pflio-tiles  { gap: 8px; }
  .pflio-tile-big { font-size: 22px; }
  .pflio-tile-val { font-size: 14px; }
  .pflio-hl-hide-sm { display: none; }
  .pflio-thumb  { width: 28px; height: 28px; }
}
@media (max-width: 480px) {
  .pflio-tile         { flex: 1 1 100%; }
  .pflio-tile-primary { flex: 1 1 100%; }
}

/* ── Thumbnail hiding ── */
[data-no-thumbs="1"] img[src*="thumbnails"],
[data-no-thumbs="1"] .item-card-thumb,
[data-no-thumbs="1"] .item-detail-thumb,
[data-no-thumbs="1"] .variant-card-thumb,
[data-no-thumbs="1"] .live-modal-thumb { display: none; }
[data-no-thumbs="1"] .item-card { padding-left: 12px; }

/* ── Settings page ── */
.settings-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 48px 16px 80px;
}
.settings-header { margin-bottom: 36px; }
.settings-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--fg-1);
  line-height: var(--lh-tight);
}
.settings-sub { font-size: var(--text-sm); color: var(--fg-4); margin-top: 6px; }

.settings-body { display: flex; flex-direction: column; gap: 40px; }

.settings-group { display: flex; flex-direction: column; }

.settings-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-4);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row:last-child { border-bottom: none; }

.settings-row-label { font-size: var(--text-sm); font-weight: 500; color: var(--fg-1); }
.settings-row-desc  { font-size: var(--text-xs); color: var(--fg-4); margin-top: 3px; }
.settings-row-col { flex-direction: column; align-items: stretch; gap: 10px; }

.stg-reset-btn {
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--fg-4);
  background: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
}

.stg-reset-btn:hover { color: var(--fg-1); border-color: var(--border-strong); }

.stg-section-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stg-section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  user-select: none;
}

.stg-section-drag-handle {
  color: var(--fg-4);
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  padding: 3px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}

.stg-section-drag-handle:hover { color: var(--fg-2); background: var(--bg-4); }
.stg-section-drag-handle:active { cursor: grabbing; }

.stg-section-name { font-size: var(--text-sm); color: var(--fg-1); font-weight: 500; flex: 1; }

.stg-section-skeleton {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 5px;
}

.stg-section-skeleton-chart {
  color: var(--brand-teal);
  background: var(--brand-teal-10);
  border: 1px solid var(--brand-teal-20);
}

.stg-section-skeleton-info {
  color: var(--fg-4);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}

.stg-section-item.stg-drag-ghost {
  opacity: 0.92;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5), 0 0 0 2px var(--brand-teal);
  background: var(--bg-3);
  pointer-events: none;
}

.stg-section-placeholder {
  border: 2px dashed var(--brand-teal-40);
  border-radius: var(--radius-md);
  background: var(--brand-teal-10);
  box-sizing: border-box;
  min-height: 44px;
  pointer-events: none;
}

@media (max-width: 480px) {
  .stg-section-item { padding: 8px 10px; }
}

/* Segmented control */
.stg-segment {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}
.stg-segment button {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-3);
  background: none;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  padding: 5px 16px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.stg-segment button { display: inline-flex; align-items: center; gap: 6px; }
.stg-segment button svg { width: 13px; height: 13px; flex-shrink: 0; }
.stg-segment button.active { background: var(--bg-1); color: var(--fg-1); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stg-segment button:not(.active):hover { color: var(--fg-1); }

/* Toggle switch */
.stg-toggle { position: relative; flex-shrink: 0; cursor: pointer; display: inline-block; }
.stg-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.stg-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  background: var(--border-default);
  border-radius: 99px;
  position: relative;
  transition: background 150ms var(--ease-out);
}
.stg-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform 150ms var(--ease-out);
}
.stg-toggle input:checked + .stg-toggle-track { background: var(--brand-teal); }
.stg-toggle input:checked + .stg-toggle-track::after { transform: translateX(18px); }

@media (max-width: 480px) {
  .settings-row { gap: 16px; }
  .settings-page { padding-top: 32px; }
}

/* ── Notifications ──────────────────────────────────────────────────────── */

.notif-page { display: flex; flex-direction: column; gap: 28px; padding-bottom: 48px; }

/* Header */
.notif-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.notif-title   { font-size: var(--text-2xl); font-weight: 700; color: var(--fg-1); letter-spacing: var(--tracking-tight); margin: 0 0 4px; }
.notif-subtitle { font-size: var(--text-sm); color: var(--fg-3); margin: 0; }

/* Status pill */
.notif-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  margin-top: 4px;
}
.notif-status-dot          { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-4); flex-shrink: 0; }
.notif-status-connected    { background: var(--up-500); box-shadow: 0 0 6px rgba(34,197,94,.55); animation: notif-dot-pulse 2s ease-in-out infinite; }
.notif-status-connecting   { background: var(--warn-500); animation: notif-pulse 1.2s ease-in-out infinite; }
.notif-status-disconnected { background: var(--down-500); }
@keyframes notif-dot-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes notif-pulse     { 0%,100%{opacity:1} 50%{opacity:.3} }
.notif-status-label { font-size: var(--text-xs); font-weight: 600; color: var(--fg-3); }

/* Permission banners */
.notif-permission-banner,
.notif-permission-request {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}
.notif-permission-banner  { background: var(--down-100); border: 1px solid rgba(239,68,68,0.3); color: var(--down-400); }
.notif-permission-banner--warn { background: var(--warn-100); border-color: rgba(245,158,11,0.35); color: var(--warn-500); }
.notif-permission-request { background: var(--info-100); border: 1px solid rgba(96,165,250,0.3); color: var(--fg-2); }
.notif-permission-banner svg, .notif-permission-request svg { width: 16px; height: 16px; flex-shrink: 0; }
.notif-perm-body  { flex: 1; }
.notif-perm-title { font-size: var(--text-sm); font-weight: 600; color: var(--fg-1); margin-bottom: 2px; }
.notif-perm-desc  { font-size: var(--text-xs); color: var(--fg-3); }
.notif-perm-btn {
  margin-left: auto;
  padding: 7px 18px;
  background: var(--brand-teal);
  color: var(--bg-page);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease-out);
}
.notif-perm-btn:hover { background: var(--brand-teal-hover); }

/* Section */
.notif-section { display: flex; flex-direction: column; gap: 12px; }

.notif-section-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.notif-section-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.notif-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
}

/* Count badge */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: var(--bg-3);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
}

/* Add button */
.notif-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--brand-teal);
  color: var(--bg-page);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out);
}
.notif-add-btn:hover { background: var(--brand-teal-hover); }
.notif-add-btn svg   { width: 14px; height: 14px; stroke: var(--bg-page); flex-shrink: 0; }
.notif-add-btn--standalone { margin: 0; }

/* Ghost button */
.notif-ghost-btn {
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg-4);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.notif-ghost-btn:hover { border-color: var(--down-500); color: var(--down-400); }

/* Empty state */
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 64px 24px;
  background: var(--bg-1);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-xl);
  text-align: center;
}
.notif-empty-icon svg { width: 36px; height: 36px; color: var(--fg-4); }
.notif-empty-title    { font-size: var(--text-base); font-weight: 600; color: var(--fg-2); }
.notif-empty-desc     { font-size: var(--text-sm); color: var(--fg-4); max-width: 280px; }

/* Alerts list */
.notif-list { display: flex; flex-direction: column; gap: 8px; }

.notif-alert-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.notif-alert-row:hover { border-color: var(--border-default); }

.notif-alert-link {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.notif-alert-link:hover { text-decoration: none; }
.notif-alert-link:hover .notif-alert-name { text-decoration: underline; }

.notif-alert-img {
  width: 44px; height: 44px;
  border-radius: var(--radius-lg);
  object-fit: contain;
  flex-shrink: 0;
}
.notif-alert-info { flex: 1; min-width: 0; }
.notif-alert-name {
  font-size: var(--text-sm); font-weight: 600; color: var(--brand-teal);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.notif-alert-condition { font-size: var(--text-xs); color: var(--fg-3); margin-bottom: 5px; }
.notif-alert-meta { display: flex; gap: 14px; font-size: var(--text-xs); color: var(--fg-4); flex-wrap: wrap; }
.notif-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.notif-alert-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Toggle */
.notif-toggle { display: flex; align-items: center; cursor: pointer; }
.notif-toggle-input { display: none; }
.notif-toggle-track {
  display: block; width: 36px; height: 20px;
  background: var(--bg-4); border: 1px solid var(--border-default);
  border-radius: var(--radius-full); position: relative;
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.notif-toggle-track::after {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 14px; height: 14px; background: var(--fg-4);
  border-radius: 50%;
  transition: transform var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.notif-toggle-input:checked + .notif-toggle-track { background: var(--brand-teal-20); border-color: var(--border-teal); }
.notif-toggle-input:checked + .notif-toggle-track::after { transform: translateX(16px); background: var(--brand-teal); }

/* Delete button */
.notif-delete-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; background: none;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  color: var(--fg-4); cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.notif-delete-btn:hover { border-color: var(--down-500); color: var(--down-400); background: var(--down-100); }
.notif-delete-btn svg   { width: 13px; height: 13px; }

/* History */
.notif-history-empty {
  font-size: var(--text-sm); color: var(--fg-4); text-align: center;
  padding: 24px; background: var(--bg-1);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
}
.notif-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}
.notif-history-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; background: var(--bg-1);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
}
.notif-history-icon {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notif-history-icon--up    { background: var(--up-100);       color: var(--up-500); }
.notif-history-icon--down  { background: var(--down-100);     color: var(--down-500); }
.notif-history-icon--info  { background: var(--info-100);     color: var(--info-500); }
.notif-history-icon--brand { background: var(--brand-teal-10); color: var(--brand-teal); }
.notif-history-icon svg   { width: 13px; height: 13px; }
.notif-history-info  { flex: 1; min-width: 0; }
.notif-history-msg   { font-size: var(--text-xs); color: var(--fg-2); line-height: 1.45; word-break: break-word; }
.notif-history-time  { font-size: 11px; color: var(--fg-4); margin-top: 3px; }

/* ── Modal ── */
.notif-modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(7,13,25,0.72);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 16px;
}
.notif-modal-backdrop.open { display: flex; }

.notif-modal {
  width: 100%; max-width: 480px;
  height: 580px;
  max-height: calc(100dvh - 32px);
  background: var(--bg-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  animation: notif-modal-in 180ms var(--ease-out) both;
  overflow: hidden;
}
@keyframes notif-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.notif-modal-header {
  display: flex; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.notif-modal-title { font-size: var(--text-base); font-weight: 700; color: var(--fg-1); flex: 1; }

.notif-modal-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: none; border: none;
  color: var(--fg-4); cursor: pointer; border-radius: var(--radius-md);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.notif-modal-close:hover { background: var(--bg-3); color: var(--fg-1); }
.notif-modal-close svg   { width: 15px; height: 15px; }

.notif-modal-body {
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px; overflow-y: auto; flex: 1;
}

.notif-modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.notif-cancel-btn {
  padding: 8px 18px; background: none;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  font-size: var(--text-sm); color: var(--fg-3); cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.notif-cancel-btn:hover { border-color: var(--border-strong); color: var(--fg-1); }

.notif-save-btn {
  padding: 8px 22px;
  background: var(--brand-teal); color: var(--bg-page);
  border: none; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.notif-save-btn:hover:not(:disabled) { background: var(--brand-teal-hover); }
.notif-save-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Modal fields */
.notif-field { display: flex; flex-direction: column; gap: 8px; }
.notif-label {
  font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--fg-3);
}

/* Search */
.notif-search-wrap { position: relative; }
.notif-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--fg-4); pointer-events: none;
}
.notif-search-input {
  width: 100%; background: var(--bg-inset);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 10px 12px 10px 34px;
  font-family: var(--font-sans); font-size: var(--text-sm);
  color: var(--fg-1); outline: none;
  -webkit-appearance: none; appearance: none; box-shadow: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.notif-search-input:focus { border-color: var(--brand-teal); box-shadow: 0 0 0 2px var(--brand-teal-10); }
.notif-search-input::placeholder { color: var(--fg-4); }

.notif-search-dropdown {
  display: none; position: fixed;
  background: var(--bg-4); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  z-index: 1100; max-height: 240px; overflow-y: auto;
}
.notif-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  transition: background var(--dur-fast);
}
.notif-dropdown-item:hover { background: var(--bg-3); }
.notif-dropdown-img  { width: 28px; height: 28px; border-radius: var(--radius-sm); object-fit: contain; flex-shrink: 0; }
.notif-dropdown-name { font-size: var(--text-sm); color: var(--fg-1); }
.notif-dropdown-loading { padding: 10px 12px; font-size: var(--text-sm); color: var(--fg-4); }

/* Item preview */
.notif-item-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
}
.notif-preview-img  { width: 44px; height: 44px; border-radius: var(--radius-md); object-fit: contain; flex-shrink: 0; }
.notif-preview-info { flex: 1; min-width: 0; }
.notif-preview-name { font-size: var(--text-sm); font-weight: 600; color: var(--fg-1); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-preview-stats { display: flex; gap: 8px; }
.notif-stat-chip {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-3); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 2px 8px 2px 6px;
}
.notif-stat-chip-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--fg-4); }
.notif-stat-chip-val   { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-2); }
.notif-change-btn {
  padding: 5px 12px; background: none;
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  font-size: var(--text-xs); color: var(--fg-4); cursor: pointer; flex-shrink: 0;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.notif-change-btn:hover { border-color: var(--border-strong); color: var(--fg-2); }

/* Condition list */
.notif-cond-list { display: flex; flex-direction: column; gap: 14px; }
.notif-cond-group { display: flex; flex-direction: column; gap: 4px; }
.notif-cond-group-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--fg-4); padding: 0 2px 4px;
}

.notif-cond-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); cursor: pointer; user-select: none;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.notif-cond-row:hover  { border-color: var(--border-default); }
.notif-cond-row.active { border-color: var(--brand-teal); background: var(--brand-teal-10); }

.notif-cond-radio {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border-strong); flex-shrink: 0;
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.notif-cond-row.active .notif-cond-radio {
  border-color: var(--brand-teal); background: var(--brand-teal);
  box-shadow: 0 0 0 3px var(--brand-teal-10);
}

.notif-cond-icon {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0; color: var(--fg-4);
}
.notif-cond-icon svg { width: 14px; height: 14px; }
.notif-cond-row.active .notif-cond-icon { color: var(--brand-teal); }

.notif-cond-label { font-size: var(--text-sm); color: var(--fg-2); white-space: nowrap; }
.notif-cond-row.active .notif-cond-label { color: var(--fg-1); font-weight: 500; }

.notif-cond-desc { font-size: var(--text-xs); color: var(--fg-4); margin-left: auto; white-space: nowrap; }

.notif-cond-inline {
  display: flex; align-items: center; gap: 4px; margin-left: auto;
}

.notif-cond-input::-webkit-inner-spin-button,
.notif-cond-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.notif-cond-input { -moz-appearance: textfield; }

.notif-cond-input {
  width: 90px; margin-left: auto;
  background: var(--bg-inset); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 3px 8px;
  font-family: var(--font-mono); font-size: var(--text-sm);
  color: var(--fg-4); outline: none;
  -webkit-appearance: none; appearance: none; box-shadow: none;
  pointer-events: none; cursor: default; text-align: right;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.notif-cond-input--pct { width: 60px; margin-left: 0; }
.notif-cond-row.active .notif-cond-input { border-color: var(--border-default); color: var(--fg-1); pointer-events: auto; cursor: text; }
.notif-cond-row.active .notif-cond-input:focus { border-color: var(--brand-teal); }
.notif-cond-input::placeholder { color: var(--fg-5); }

.notif-cond-unit { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-4); white-space: nowrap; }

.notif-cond-hint { font-size: var(--text-xs); color: var(--fg-4); font-family: var(--font-mono); margin-top: 6px; min-height: 14px; padding: 0 2px; }

/* Format picker (modal) */
.notif-format-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.notif-format-seg {
  display: flex;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}
.notif-format-opt {
  padding: 4px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg-4);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.notif-format-opt--active {
  background: var(--bg-3);
  color: var(--fg-1);
  font-weight: 600;
}

/* Config button on alert card */
.notif-config-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--fg-4);
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
  flex-shrink: 0;
}
.notif-config-btn:hover { border-color: var(--border-strong); color: var(--fg-2); background: var(--bg-2); }
.notif-config-btn svg { width: 14px; height: 14px; pointer-events: none; }

/* Edit modal */
.notif-modal--edit { height: auto; }

.notif-edit-condition-label {
  font-size: 13px;
  color: var(--fg-2);
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.notif-edit-threshold-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-edit-threshold-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--fg-1);
  font-size: 14px;
  outline: none;
  transition: border-color var(--dur-fast);
  -moz-appearance: textfield;
}
.notif-edit-threshold-input::-webkit-inner-spin-button,
.notif-edit-threshold-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.notif-edit-threshold-input:focus { border-color: var(--brand-teal); }
.notif-edit-threshold-unit { font-size: 13px; color: var(--fg-3); flex-shrink: 0; }

/* Mobile */
@media (max-width: 640px) {
  .notif-header { flex-direction: column; align-items: flex-start; }
  .notif-alert-row { padding: 12px; gap: 10px; }
  .notif-alert-img { width: 36px; height: 36px; }
  .notif-alert-meta { gap: 8px; }
  .notif-history-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .notif-modal-backdrop { align-items: flex-end; padding: 0; }
  .notif-modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-width: 100%; height: 88dvh; max-height: 88dvh; }
  .notif-modal-body { padding: 16px; gap: 16px; }
  .notif-modal-footer { padding: 12px 16px; }
  .notif-cond-row { padding: 9px 10px; gap: 8px; }
  .notif-cond-input { width: 70px; }
  .notif-cond-input--pct { width: 48px; }
  .notif-alert-row { flex-wrap: wrap; }
  .notif-alert-controls { margin-left: auto; }
}

/* ── Mastery Calculator ── */
.mc-page { display: flex; flex-direction: column; flex: 1; padding-bottom: 48px; }

.mc-layout {
  display: flex;
  gap: 24px;
  flex: 1;
  align-items: flex-start;
}

/* ── Sidebar ── */
.mc-sidebar {
  width: 188px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: var(--nav-height);
}

#mc-sidebar-btns {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mc-sidebar-item {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--fg-2);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.mc-sidebar-item:hover { background: var(--bg-2); color: var(--fg-1); border-color: var(--border-default); }
.mc-sidebar-item.active {
  background: var(--brand-teal-10);
  border-color: var(--border-teal);
  color: var(--brand-teal);
  font-weight: 600;
}

.mc-sidebar-icon { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }

.mc-boost-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  margin-top: 6px;
  border-top: 1px solid var(--border-subtle);
  cursor: pointer;
}
.mc-boost-wrap input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-default);
  border-radius: 3px;
  background: var(--bg-2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.1s, border-color 0.1s;
}
.mc-boost-wrap input[type="checkbox"]:checked {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
}
.mc-boost-wrap input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid var(--bg-page);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.mc-boost-label-text { font-size: var(--text-sm); color: var(--fg-3); user-select: none; font-weight: 500; }

/* ── Content area ── */
.mc-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mc-cat-title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.mc-cat-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  margin-bottom: 0;
}
.mc-cape-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}
.mc-cape-stat:hover { text-decoration: underline; }
.mc-cape-stat:hover .mc-cape-stat-value { color: inherit; }
.mc-cape-stat-label {
  font-size: var(--text-sm);
  color: var(--fg-4);
}
.mc-cape-stat-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-2);
  font-family: var(--font-mono);
}

/* ── Section cards ── */
.mc-section {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.mc-section-header {
  padding: 11px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
}

.mc-section-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Inputs row ── */
.mc-inputs-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.mc-input-group { display: flex; flex-direction: column; gap: 6px; }

.mc-input-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-4);
}

.mc-level-input {
  background: var(--bg-inset);
  border: none;
  border-radius: var(--radius-md);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0 10px;
  outline: none;
  width: 120px;
  height: 32px;
  box-sizing: border-box;
  transition: box-shadow var(--dur-fast) var(--ease-out);
}
.mc-level-input:focus { box-shadow: 0 0 0 1.5px var(--brand-teal); }
.mc-level-input::placeholder { color: var(--fg-5); }
.mc-level-input::-webkit-inner-spin-button,
.mc-level-input::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; }
.mc-level-input { -moz-appearance: textfield; appearance: textfield; }

.mc-calc-btn {
  background: var(--brand-teal);
  color: var(--bg-page);
  border: none;
  border-radius: var(--radius-md);
  padding: 0 20px;
  height: 32px;
  box-sizing: border-box;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  letter-spacing: 0.01em;
  align-self: flex-end;
}
.mc-calc-btn:hover { background: var(--brand-teal-hover); }

/* ── Results grid ── */
.mc-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}

.mc-result-card {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mc-result-card-label { font-size: var(--text-xs); color: var(--fg-3); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-result-card-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--fg-1);
  line-height: 1.2;
}
.mc-result-card-value.na { color: var(--fg-5); font-size: var(--text-sm); font-weight: 400; }
.mc-result-card-rap { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-3); line-height: 1.2; }

/* ── Gain stats ── */
.mc-gain-stats {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.mc-gain-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  flex: 1;
}
.mc-gain-stat + .mc-gain-stat { border-left: 1px solid var(--border-subtle); }
.mc-gain-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-4);
}
.mc-gain-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--brand-teal);
  line-height: 1.2;
}

/* ── Action inputs ── */
.mc-actions-section {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.mc-actions-group + .mc-actions-group { border-top: 1px solid var(--border-subtle); }
.mc-actions-group-header {
  padding: 9px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-4);
}
.mc-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 18px 20px;
}
.mc-action-item { display: flex; flex-direction: column; gap: 5px; }
.mc-action-item-hd { display: flex; align-items: baseline; gap: 5px; min-width: 0; overflow: hidden; }
.mc-action-item-label { font-size: var(--text-xs); color: var(--fg-2); font-weight: 500; line-height: 1.35; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-action-note { color: var(--fg-4); font-weight: 400; }
.mc-action-xp-note { font-size: 10px; color: var(--brand-teal); font-family: var(--font-mono); flex-shrink: 0; }
.mc-action-input {
  background: var(--bg-inset);
  border: none;
  border-radius: var(--radius-md);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 8px 10px;
  outline: none;
  width: 100%;
  transition: box-shadow var(--dur-fast) var(--ease-out);
}
.mc-action-input:focus { box-shadow: 0 0 0 1.5px var(--brand-teal); }
.mc-action-input::placeholder { color: var(--fg-5); }
.mc-action-input::-webkit-inner-spin-button,
.mc-action-input::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; }
.mc-action-input { -moz-appearance: textfield; appearance: textfield; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .mc-layout { flex-direction: column; gap: 16px; }
  .mc-sidebar {
    width: 100%;
    flex-direction: column;
    gap: 8px;
    position: static;
  }
  #mc-sidebar-btns {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  #mc-sidebar-btns::-webkit-scrollbar { display: none; }
  .mc-sidebar-item {
    flex-shrink: 0;
    width: auto;
    padding: 6px 12px;
    text-align: center;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    gap: 7px;
  }
  .mc-sidebar-icon { width: 18px; height: 18px; }
  .mc-boost-wrap {
    margin-top: 0;
    border-top: none;
    padding: 8px 4px;
    border-radius: 0;
    background: none;
    border: none;
  }
  .mc-actions-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .mc-cat-title { font-size: var(--text-2xl); }
  .mc-section-body { padding: 14px; }
  .mc-inputs-row { flex-direction: column; align-items: stretch; }
  .mc-level-input { width: 100%; }
  .mc-calc-btn { width: 100%; text-align: center; }
  .mc-results-grid { grid-template-columns: repeat(2, 1fr); }
  .mc-actions-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px 14px; }
  .mc-gain-stat { padding: 12px 14px; }
  .mc-gain-stat + .mc-gain-stat { border-left: none; border-top: 1px solid var(--border-subtle); }
}

.mc-attribution {
  font-size: 11px;
  color: var(--fg-5);
}
.mc-attribution a { color: var(--fg-4); text-decoration: underline; text-underline-offset: 2px; }
.mc-attribution a:hover { color: var(--fg-3); }

@media (max-width: 380px) {
  .mc-actions-grid { grid-template-columns: 1fr; }
  .mc-results-grid { grid-template-columns: 1fr; }
}