/* =========================================================
   Discord-Inspired Dark Theme
   ========================================================= */

:root {
  --bg-primary:    #080a0f;
  --bg-secondary:  #0d1117;
  --bg-tertiary:   #111620;
  --bg-accent:     #171d2b;
  --bg-hover:      #1e2636;

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #4b5871;
  --text-link:     #60a5fa;

  --blurple:       #2563eb;
  --blurple-hover: #1d4ed8;
  --green:         #34d399;
  --red:           #f87171;
  --gold:          #fbbf24;
  --pink:          #a78bfa;
  --teal:          #2dd4bf;

  --border:        #0d1117;
  --border-subtle: #1e2636;

  --radius:        8px;
  --radius-sm:     4px;
  --radius-lg:     12px;

  --shadow:        0 2px 10px rgba(0,0,0,0.6);
  --shadow-lg:     0 4px 24px rgba(0,0,0,0.8);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'gg sans', 'Noto Sans', Whitney, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: #000000;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    radial-gradient(125% 125% at 50% 0%, #010133 0%, #000000 60%);
  background-size: 26px 26px, 100% 100%;
  background-attachment: fixed, fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* =========================================================
   LAYOUT
   ========================================================= */

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

/* =========================================================
   NAVBAR
   ========================================================= */

.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 24px;
  box-shadow: var(--shadow);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-brand:hover { text-decoration: none; color: white; }

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--blurple);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--bg-accent);
  color: white;
}

/* Category market map */
.categories-page {
  max-width: 1180px;
  margin: 0 auto;
}

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

.categories-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 8px 0 0;
}

.categories-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.categories-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: rgba(255,255,255,.035);
}

.categories-toggle__btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
}

.categories-toggle__btn.active,
.categories-toggle__btn:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
}

.categories-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 11px;
  margin: 0 2px 10px;
}

.category-bubble-field {
  position: relative;
  display: block;
  height: min(620px, 70vh);
  min-height: 500px;
  padding: 34px 20px 44px;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 44%, rgba(88,101,242,.09), transparent 42%),
    var(--bg-secondary);
  overflow: hidden;
  transition: opacity .15s;
}

.category-bubble-field.is-loading {
  opacity: .55;
  pointer-events: none;
}

.category-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--bubble-size, 140px);
  height: var(--bubble-size, 140px);
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid;
  border-radius: 50%;
  text-align: center;
  text-decoration: none;
  cursor: grab;
  touch-action: none;
  will-change: transform;
  transition: transform .2s, box-shadow .2s;
}

.category-bubble:hover {
  color: var(--text-primary);
  text-decoration: none;
  transform: translateY(-5px) scale(1.04);
}

.category-bubble.is-dragging {
  z-index: 20;
  cursor: grabbing;
  filter: brightness(1.16);
  transition: none;
}

.category-bubble--positive {
  background: radial-gradient(circle at 35% 28%, rgba(52,211,153,.3), rgba(52,211,153,.08) 68%);
  border-color: rgba(52,211,153,.48);
  box-shadow: 0 8px 28px rgba(52,211,153,.1);
  color: var(--green);
}

.category-bubble--negative {
  background: radial-gradient(circle at 35% 28%, rgba(248,113,113,.3), rgba(248,113,113,.08) 68%);
  border-color: rgba(248,113,113,.48);
  box-shadow: 0 8px 28px rgba(248,113,113,.1);
  color: var(--red);
}

.category-bubble__name {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-bubble__change {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
  margin: 4px 0;
}

.category-bubble small {
  color: var(--text-muted);
  font-size: 10px;
}

@media (max-width: 700px) {
  .categories-header { flex-direction: column; }
  .categories-controls { justify-content: flex-start; }
  .categories-meta { flex-direction: column; gap: 4px; }
  .category-bubble-field { height: 68vh; min-height: 520px; }
}

.navbar-spacer { flex: 1; }

/* Login with Discord button */
.nav-login-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #5865f2;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.nav-login-btn:hover {
  background: #4752c4;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Logged-in user display */
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-user__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-subtle);
  display: block;
}
.nav-user__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user__logout {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.nav-user__logout:hover {
  color: var(--red);
  border-color: var(--red);
  text-decoration: none;
}
.nav-gold-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(254, 231, 92, 0.1);
  border: 1px solid rgba(254, 231, 92, 0.25);
  border-radius: 20px;
  padding: 4px 10px 4px 7px;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.nav-gold-badge:hover {
  background: rgba(254, 231, 92, 0.18);
  border-color: rgba(254, 231, 92, 0.45);
  text-decoration: none;
  color: var(--gold);
}

/* Profile menu (avatar trigger + expandable pane) */
.profile-menu {
  position: relative;
  flex-shrink: 0;
}
.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.profile-trigger:hover {
  background: rgba(255,255,255,0.08);
}
.profile-menu.open .profile-trigger {
  background: rgba(255,255,255,0.08);
  border-color: var(--border);
}
.profile-trigger__gold {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(254, 231, 92, 0.1);
  border-radius: 12px;
  padding: 3px 8px 3px 6px;
}
.profile-trigger__chevron {
  color: var(--text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.profile-menu.open .profile-trigger__chevron {
  transform: rotate(180deg);
}

.profile-pane {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 1000;
  flex-direction: column;
  gap: 14px;
}
.profile-menu.open .profile-pane {
  display: flex;
}
.profile-pane__header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.profile-pane__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-subtle);
  display: block;
  flex-shrink: 0;
}
.profile-pane__identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.profile-pane__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-pane__logout {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  width: fit-content;
  transition: color 0.15s;
}
.profile-pane__logout:hover {
  color: var(--red);
  text-decoration: none;
}
.profile-pane__gold {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(254, 231, 92, 0.08);
  border: 1px solid rgba(254, 231, 92, 0.2);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.profile-pane__gold-icon {
  color: var(--gold);
  display: flex;
  flex-shrink: 0;
}
.profile-pane__gold-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.profile-pane__gold-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.profile-pane__gold-amount {
  font-size: 17px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.profile-pane__trade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--gold);
  color: #202225;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: filter 0.15s;
}
.profile-pane__trade-btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
  color: #202225;
}
.profile-pane__divider {
  height: 1px;
  background: var(--border);
}
.profile-pane__sake {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-pane__sake-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-pane__sake-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.profile-pane__sake-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.profile-pane__sake-symbol {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}
.profile-pane__sake-name {
  font-size: 10px;
  color: var(--text-muted);
}
.profile-pane__sake-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.profile-pane__sake-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.profile-pane__sake-mcap {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.profile-pane__sake-buy {
  display: block;
  text-align: center;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}
.profile-pane__sake-buy:hover {
  background: #1d4ed8;
  color: #fff;
  text-decoration: none;
}
.profile-pane__sake-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.profile-pane__sake-link {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.profile-pane__sake-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
}

.sake-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 5px 12px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.sake-ticker:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}
.sake-ticker__icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Nav token search ─────────────────────────── */
.nav-search {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 380px;
}

.nav-search__wrap {
  position: relative;
  width: 100%;
}

.nav-search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.nav-search__input {
  width: 100%;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px 10px 38px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-sizing: border-box;
}

.nav-search__input:hover {
  border-color: var(--text-muted);
}

.nav-search__input:focus {
  background: var(--bg-secondary);
  border-color: var(--blurple);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25);
}

.nav-search__input:focus + .nav-search__spinner,
.nav-search__input:focus ~ .nav-search__icon {
  color: var(--blurple);
}

.nav-search__input::placeholder {
  color: var(--text-muted);
}

.nav-search__spinner {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--blurple);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.nav-search__spinner.loading {
  opacity: 1;
  animation: nav-search-spin 0.6s linear infinite;
}

@keyframes nav-search-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.nav-search__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 300;
  overflow: hidden;
  display: none;
}

.nav-search__dropdown.open {
  display: block;
}

.nav-search__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  transition: background 0.1s;
  cursor: pointer;
}

.nav-search__item:hover,
.nav-search__item.focused {
  background: var(--bg-accent);
  text-decoration: none;
}

.nav-search__symbol {
  font-weight: 700;
  color: var(--blurple);
  min-width: 48px;
  flex-shrink: 0;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.nav-search__name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-search__empty {
  padding: 12px 14px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Hamburger button ─────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.nav-hamburger:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.2);
}
.nav-hamburger__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease, width 0.2s ease;
  transform-origin: center;
}
.nav-hamburger.open .nav-hamburger__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger.open .nav-hamburger__bar:nth-child(2) {
  opacity: 0;
  width: 0;
}
.nav-hamburger.open .nav-hamburger__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile nav drawer ────────────────────────── */
.nav-drawer {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: translateY(-6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease, visibility 0s linear 0.18s;
}
.nav-drawer.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: transform 0.18s ease, opacity 0.18s ease, visibility 0s;
}

/* Sake price row inside drawer */
.drawer-sake-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.drawer-sake-row:hover {
  background: rgba(255,255,255,0.08);
}
.drawer-sake-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
}
.drawer-sake-mcap {
  font-size: 12px;
  color: var(--text-muted);
  display: none;
}

/* Divider */
.drawer-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* Drawer nav links */
.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.drawer-link:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
  text-decoration: none;
}
.drawer-link.active {
  background: var(--bg-accent);
  color: white;
}
.drawer-link svg {
  flex-shrink: 0;
  color: var(--text-muted);
}
.drawer-link.active svg,
.drawer-link:hover svg {
  color: var(--text-primary);
}

/* Drawer auth row */
.drawer-auth {
  padding-top: 2px;
}
.drawer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
}
.drawer-gold-balance {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  background: rgba(254, 231, 92, 0.07);
  border: 1px solid rgba(254, 231, 92, 0.2);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.drawer-gold-balance:hover {
  background: rgba(254, 231, 92, 0.14);
  text-decoration: none;
  color: var(--gold);
}
.drawer-trade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: #202225;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.drawer-trade-btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
  color: #202225;
}

/* Sake Modal */
.sake-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.sake-modal-backdrop.open {
  display: flex;
}
.sake-modal {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sake-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.sake-modal__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sake-modal__symbol {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}
.sake-modal__name {
  font-size: 11px;
  color: var(--text-muted, #8e9297);
}
.sake-modal__close {
  background: none;
  border: none;
  color: var(--text-muted, #8e9297);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  font-family: inherit;
}
.sake-modal__close:hover { color: #fff; }
.sake-modal__price-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.sake-modal__price {
  font-size: 24px;
  font-weight: 800;
  color: #57f287;
  font-variant-numeric: tabular-nums;
}
.sake-modal__mcap {
  font-size: 12px;
  color: var(--text-muted, #8e9297);
}
.sake-modal__buy-btn {
  display: block;
  text-align: center;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}
.sake-modal__buy-btn:hover {
  background: #1d4ed8;
  color: #fff;
  text-decoration: none;
}
.sake-modal__links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sake-modal__link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #b9bbbe);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sake-modal__link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
}

.sake-ticker__symbol {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #8e9297);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sake-ticker__price {
  font-size: 13px;
  font-weight: 700;
  color: #57f287;
  font-variant-numeric: tabular-nums;
}

.sake-ticker__mcap {
  font-size: 11px;
  color: var(--text-muted, #8e9297);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   CRYPTO TICKER STRIP
   ========================================================= */

.crypto-ticker {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  height: 34px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 9;
  user-select: none;
}

.crypto-ticker::before,
.crypto-ticker::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  z-index: 2;
  pointer-events: none;
}

.crypto-ticker::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.crypto-ticker::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-secondary), transparent);
}

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

.crypto-ticker:hover .crypto-ticker__track {
  animation-play-state: paused;
}

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

.ticker-item {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 5px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
  border-right: 1px solid var(--border-subtle);
  height: 34px;
  text-decoration: none;
  color: inherit;
}
a.ticker-item:hover {
  background: rgba(88, 101, 242, 0.12);
}

.ticker-item__logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.ticker-item__symbol {
  color: var(--text-primary);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.ticker-item__chg {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ticker-item--up   .ticker-item__chg { color: var(--green); }
.ticker-item--down .ticker-item__chg { color: var(--red); }

/* =========================================================
   PAGE CONTENT
   ========================================================= */

.page-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px;
}

/* =========================================================
   ADVERTISEMENT PAGE
   ========================================================= */

.advertise-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 0 56px;
}

.advertise-intro {
  margin-bottom: 24px;
}

.advertise-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.advertise-intro h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.1;
}

.advertise-intro p {
  max-width: 620px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.advertise-form {
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.advertise-form__section {
  padding: 24px 26px 26px;
  border-bottom: 1px solid var(--border-subtle);
}

.advertise-form__section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.advertise-form__step {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid rgba(250, 204, 21, .35);
  border-radius: 50%;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}

.advertise-form__section-heading h2 {
  margin: 1px 0 3px;
  color: var(--text-primary);
  font-size: 15px;
}

.advertise-form__section-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.advertise-form__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}

.advertise-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.advertise-field--full {
  grid-column: 1 / -1;
}

.advertise-field input,
.advertise-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.advertise-field textarea {
  min-height: 78px;
  resize: vertical;
}

.advertise-field input::placeholder,
.advertise-field textarea::placeholder {
  color: var(--text-muted);
}

.advertise-field input:focus,
.advertise-field textarea:focus {
  border-color: var(--blurple);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, .14);
}

.advertise-field input[type="file"] {
  padding: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.advertise-field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 9px;
  border: 0;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}

.advertise-field small {
  margin-top: -2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

.advertise-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 26px;
  background: rgba(0, 0, 0, .12);
}

.advertise-balance {
  display: grid;
  gap: 2px;
  margin: 0;
}

.advertise-balance span,
.advertise-balance small {
  color: var(--text-muted);
  font-size: 11px;
}

.advertise-balance strong {
  color: var(--gold);
  font-size: 15px;
}

.advertise-submit {
  padding: 10px 15px;
  white-space: nowrap;
}

.advertise-submit span {
  font-size: 17px;
  line-height: 12px;
}

.advertise-login {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
}

.advertise-login__icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  background: rgba(88, 101, 242, .16);
  color: #9ba5ff;
  font-size: 20px;
}

.advertise-login h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.advertise-login p {
  margin: 0;
  font-size: 13px;
}

.advertise-login .btn {
  margin-left: auto;
  white-space: nowrap;
}

.advertise-flash {
  margin-bottom: 18px;
}

@media (max-width: 600px) {
  .advertise-page {
    padding: 10px 0 36px;
  }

  .advertise-form__section {
    padding: 20px 16px 22px;
  }

  .advertise-form__fields {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .advertise-field--full {
    grid-column: auto;
  }

  .advertise-form__footer {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

  .advertise-submit {
    justify-content: center;
    width: 100%;
  }

  .advertise-login {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 18px;
  }

  .advertise-login .btn {
    width: 100%;
    justify-content: center;
    margin-left: 54px;
  }
}

/* =========================================================
   HOME TWO-COLUMN LAYOUT
   ========================================================= */

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

.home-main {
  flex: 1;
  min-width: 0;
}

.home-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 80px;
}

/* SAKE trade promotion */
.sake-trade-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 11px 12px;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(254, 231, 92, .13), rgba(194, 118, 28, .08));
  border: 1px solid rgba(254, 231, 92, .28);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .1s;
}

.sake-trade-card:hover {
  background: linear-gradient(135deg, rgba(254, 231, 92, .19), rgba(194, 118, 28, .12));
  border-color: rgba(254, 231, 92, .5);
  color: var(--text-primary);
  text-decoration: none;
  transform: translateY(-1px);
}

.sake-trade-card__icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(254, 231, 92, .18);
}

.sake-trade-card__copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.sake-trade-card__copy strong {
  color: var(--gold);
  font-size: 12px;
  line-height: 1.2;
}

.sake-trade-card__copy small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sake-trade-card__arrow {
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
}

/* Sidebar panel */
.sidebar-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.sidebar-panel__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.sidebar-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-rank-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.sidebar-rank-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  width: 14px;
  flex-shrink: 0;
  text-align: right;
}

.sidebar-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blurple);
  flex-shrink: 0;
  object-fit: cover;
}

.sidebar-rank-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.sidebar-rank-name:hover { color: var(--text-primary); text-decoration: none; }

.sidebar-value {
  font-size: 11px;
  font-weight: 600;
  color: #57f287;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.sidebar-empty {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.sidebar-link {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-link, #00b0f4);
  text-decoration: none;
}
.sidebar-link:hover { text-decoration: underline; }

/* Compact pick cards on home page */
.tournament-picks-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  padding: 12px 16px;
  gap: 8px;
}

.pick-card--compact {
  padding: 9px 10px;
  gap: 5px;
}

/* Two-column long/short layout on tournament cards */
.picks-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--border-subtle);
}

.picks-col {
  padding: 8px 12px 10px;
}

.picks-col:first-child {
  border-right: 1px solid var(--border-subtle);
}

.picks-col-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.picks-col-header.long  { color: var(--green); }
.picks-col-header.short { color: var(--red); }

.picks-col-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

.pick-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 12px;
  border-radius: 4px;
  transition: color 0.12s;
}

.pick-row:hover { color: var(--text-primary); text-decoration: none; }

.pick-row-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pick-row-symbol {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 12px;
  flex-shrink: 0;
}

.pick-row-change {
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 44px;
  text-align: right;
}

.pick-row-change.positive { color: var(--green); }
.pick-row-change.negative { color: var(--red); }
.pick-row-change.neutral  { color: var(--text-muted); }

/* =========================================================
   CARDS
   ========================================================= */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-sm {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* =========================================================
   STATS BAR
   ========================================================= */

.stats-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.stat-pill {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.stat-pill .stat-value {
  font-weight: 700;
  color: var(--blurple);
  font-size: 15px;
}

.stat-pill .stat-label {
  color: var(--text-muted);
}

/* =========================================================
   SECTION HEADERS
   ========================================================= */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* =========================================================
   CLASS GEM BADGE
   ========================================================= */

.class-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  position: relative;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  flex-shrink: 0;
  vertical-align: middle;
}

.class-badge::before {
  content: '';
  position: absolute;
  width: 62%;
  height: 62%;
  background: rgba(255, 255, 255, 0.93);
  border-radius: 50%;
  z-index: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

.class-badge::after {
  content: '';
  position: absolute;
  top: -10%;
  left: -40%;
  width: 28%;
  height: 120%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.52), transparent);
  transform: skewX(-12deg);
  z-index: 3;
  animation: gem-glint 4s ease-in-out infinite;
}

.class-badge__letter {
  position: relative;
  z-index: 2;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
}

@keyframes gem-glint {
  0%, 65%  { left: -40%; opacity: 0; }
  68%      { opacity: 1; }
  82%      { left: 110%; opacity: 0; }
  100%     { left: 110%; opacity: 0; }
}

/* SSS — Prismatic platinum (ultra-tier) — Octagon */
.class-badge--sss {
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  background: linear-gradient(135deg, #e8f4ff 0%, #a8d8ff 40%, #7ec8ff 70%, #c8a8ff 100%);
  animation: gem-glow-sss 1.6s ease-in-out infinite;
}
.class-badge--sss .class-badge__letter { color: #1a3a5c; }
.class-badge--sss::after { animation-duration: 2s; }

@keyframes gem-glow-sss {
  0%, 100% { filter: drop-shadow(0 0 5px #a8d8ffcc) drop-shadow(0 0 10px #c8a8ff80); }
  50%      { filter: drop-shadow(0 0 12px #7ec8ff) drop-shadow(0 0 22px #c8a8ffaa); }
}

/* SS — Diamond blue — Hexagon */
.class-badge--ss {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(135deg, #aee9ff 0%, #29b6f6 55%, #0277bd 100%);
  animation: gem-glow-ss 1.5s ease-in-out infinite;
}
.class-badge--ss .class-badge__letter { color: #002f4d; }
.class-badge--ss::after { animation-duration: 2.5s; }

@keyframes gem-glow-ss {
  0%, 100% { filter: drop-shadow(0 0 4px #29b6f699); }
  50%      { filter: drop-shadow(0 0 10px #29b6f6) drop-shadow(0 0 20px #29b6f660); }
}

/* S — Gold — Pentagon */
.class-badge--s {
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  background: linear-gradient(135deg, #fff0a0 0%, #ffd700 55%, #c8930a 100%);
  animation: gem-glow-s 2s ease-in-out infinite;
}
.class-badge--s .class-badge__letter { color: #5c3300; }
.class-badge--s::after { animation-duration: 3s; }

@keyframes gem-glow-s {
  0%, 100% { filter: drop-shadow(0 0 4px #ffd70099); }
  50%      { filter: drop-shadow(0 0 10px #ffd700) drop-shadow(0 0 18px #ffd70060); }
}

/* A — Ruby red — Diamond (default shape, no override needed) */
.class-badge--a {
  background: linear-gradient(135deg, #ff6b6b 0%, #c0392b 55%, #7b0d1e 100%);
  animation: gem-glow-a 2s ease-in-out infinite;
}
.class-badge--a .class-badge__letter { color: #fff; }
.class-badge--a::after { animation-duration: 3.5s; }

@keyframes gem-glow-a {
  0%, 100% { filter: drop-shadow(0 0 4px #c0392b99); }
  50%      { filter: drop-shadow(0 0 9px #c0392b) drop-shadow(0 0 16px #c0392b60); }
}

/* B — Azure blue — Square */
.class-badge--b {
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  background: linear-gradient(135deg, #7baeff 0%, #4169e1 55%, #1e3a9e 100%);
  animation: gem-glow-b 2.5s ease-in-out infinite;
}
.class-badge--b .class-badge__letter { color: #fff; }
.class-badge--b::after { animation-duration: 4s; }

@keyframes gem-glow-b {
  0%, 100% { filter: drop-shadow(0 0 3px #4169e199); }
  50%      { filter: drop-shadow(0 0 7px #4169e1) drop-shadow(0 0 14px #4169e150); }
}

/* C — Green apple — Circle */
.class-badge--c {
  clip-path: circle(50%);
  background: linear-gradient(135deg, #c5e86c 0%, #7dc23e 55%, #4a8f1a 100%);
  animation: gem-glow-c 3s ease-in-out infinite;
}
.class-badge--c .class-badge__letter { color: #1a3d00; }
.class-badge--c::after { animation-duration: 5s; }

@keyframes gem-glow-c {
  0%, 100% { filter: drop-shadow(0 0 3px #7dc23e80); }
  50%      { filter: drop-shadow(0 0 7px #7dc23e) drop-shadow(0 0 13px #7dc23e50); }
}

/* Profile name — badge inline with username */
.profile-name-badge {
  width: 40px;
  height: 40px;
}
.profile-name-badge .class-badge__letter {
  font-size: 13px;
}

/* =========================================================
   STATUS BADGE
   ========================================================= */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-picking  { background: rgba(37, 99, 235, 0.2); color: var(--blurple); }
.status-middle   { background: rgba(254, 231, 92, 0.2); color: var(--gold); }
.status-waiting  { background: rgba(114, 118, 125, 0.2); color: var(--text-muted); }
.status-ended    { background: rgba(87, 242, 135, 0.15); color: var(--green); }

/* =========================================================
   TOURNAMENT CARD
   ========================================================= */

.tournament-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  margin-bottom: 16px;
}

.tournament-card:hover {
  border-color: var(--blurple);
  transform: translateY(-1px);
}

.tournament-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.tournament-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tournament-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.tournament-server {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.server-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--bg-accent);
  flex-shrink: 0;
}

.tournament-time {
  font-size: 12px;
  color: var(--text-muted);
}

.tournament-picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 16px 20px;
}

/* =========================================================
   PICK CARD
   ========================================================= */

.pick-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.pick-card:hover { border-color: var(--bg-hover); }

.pick-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pick-symbol {
  font-weight: 700;
  font-size: 15px;
  color: white;
}

.pick-direction {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.pick-direction.long  { background: rgba(87, 242, 135, 0.15); color: var(--green); }
.pick-direction.short { background: rgba(237, 66, 69, 0.15);  color: var(--red); }

.pick-change {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.pick-change.positive { color: var(--green); }
.pick-change.negative { color: var(--red); }
.pick-change.neutral  { color: var(--text-muted); }

.pick-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
}

.pick-user:hover { color: var(--text-primary); text-decoration: none; }

.pick-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blurple);
  flex-shrink: 0;
  object-fit: cover;
}

.pick-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* =========================================================
   ACTIVE TOURNAMENT BANNER
   ========================================================= */

.active-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(96, 165, 250, 0.06) 100%);
  border: 1px solid var(--blurple);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.active-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.active-banner-title {
  font-weight: 600;
  font-size: 15px;
}

.active-banner-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.15s, transform 0.1s;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary { background: var(--blurple); color: white; }
.btn-primary:hover { background: var(--blurple-hover); color: white; }

.btn-ghost { background: var(--bg-accent); color: var(--text-primary); }
.btn-ghost:hover { background: var(--bg-hover); color: white; }

/* =========================================================
   CLANS GRID
   ========================================================= */

.clans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  column-gap: 16px;
  row-gap: 65px;
}

.clan-card {
  position: relative;
  overflow: visible;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 20px 20px 98px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  color: inherit;
}

.clan-card:hover {
  border-color: var(--blurple);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.clan-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.clan-banner {
  position: absolute;
  top: 0;
  left: 18px;
  width: 68px;
  aspect-ratio: 1 / 3;
  border-radius: 0;
  background: var(--blurple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  overflow: hidden;
  transform-origin: top center;
  animation: nobori-wave-card 9s ease-in-out infinite;
  z-index: 2;
}

.clan-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes nobori-wave-card {
  0%   { transform: perspective(400px) rotateY(0deg)   skewX(0deg)   scaleX(1); }
  20%  { transform: perspective(400px) rotateY(3deg)   skewX(0.6deg) scaleX(0.995); }
  42%  { transform: perspective(400px) rotateY(0.8deg) skewX(0.15deg) scaleX(1.001); }
  58%  { transform: perspective(400px) rotateY(4deg)   skewX(0.75deg) scaleX(0.992); }
  78%  { transform: perspective(400px) rotateY(1.5deg) skewX(0.3deg) scaleX(0.997); }
  100% { transform: perspective(400px) rotateY(0deg)   skewX(0deg)   scaleX(1); }
}

.clan-name {
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.clan-tag {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.clan-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clan-stats-row {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.clan-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.clan-stat strong { color: var(--text-primary); }

.clan-private-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(237, 66, 69, 0.15);
  color: var(--red);
  font-weight: 600;
}

/* =========================================================
   CREATE CLAN MODAL  (cc)
   ========================================================= */

.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cc-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  width: 100%;
  max-width: 660px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

.cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.cc-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.cc-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.cc-close:hover { color: var(--text-primary); }

.cc-form {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cc-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cc-required {
  color: var(--red);
}

.cc-field input,
.cc-field textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s;
  resize: vertical;
}

.cc-field input:focus,
.cc-field textarea:focus {
  outline: none;
  border-color: var(--blurple);
}

.cc-field input::placeholder,
.cc-field textarea::placeholder {
  color: var(--text-muted);
}

.cc-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.cc-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
}

.cc-cost-label {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.cc-cost-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--blurple);
}

.cc-balance-row {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.cc-balance-row strong {
  color: var(--text-secondary);
}

.cc-balance--low strong {
  color: var(--red);
}

.cc-balance-warn {
  color: var(--red);
  font-weight: 600;
}

.cc-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* ── Create Clan: banner preview column ──── */
.cc-body-row {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}
.cc-preview-col {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}
.cc-preview-banner {
  width: 90px;
  height: 270px;
  display: block;
  border-radius: 3px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: nobori-wave-card 9s ease-in-out infinite;
}
.cc-preview-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}
.cc-preview-refresh {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cc-preview-refresh:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.cc-fields-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cc-modal-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(237,66,69,0.12);
  border: 1px solid rgba(237,66,69,0.3);
  border-radius: 8px;
  color: var(--red);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 4px;
}
@media (max-width: 540px) {
  .cc-body-row { flex-direction: column; align-items: center; }
  .cc-preview-col { flex-direction: row; gap: 14px; align-items: center; }
  .cc-preview-banner { width: 64px; height: 192px; }
}

.cc-error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(237, 66, 69, 0.12);
  border: 1px solid rgba(237, 66, 69, 0.3);
  border-radius: 8px;
  color: var(--red);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.cc-already-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 5px 12px;
}

.clan-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius);
  cursor: default;
  user-select: none;
}
.clan-join-btn--open {
  background: var(--blurple);
  color: #fff;
}
.clan-join-btn--private {
  background: rgba(237, 66, 69, 0.12);
  border: 1px solid rgba(237, 66, 69, 0.3);
  color: var(--red);
}
.clan-join-btn--member {
  background: rgba(87, 242, 135, 0.10);
  border: 1px solid rgba(87, 242, 135, 0.3);
  color: var(--green);
}
.clan-join-btn--taken {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

/* =========================================================
   CLAN DETAIL
   ========================================================= */

.clan-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 140px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
  min-height: 340px;
  position: relative;
  overflow: visible;
}

.clan-nobori-wrap {
  position: absolute;
  top: 0;
  left: 28px;
  z-index: 5;
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.clan-hero-banner {
  width: 150px;
  height: 450px;
  border-radius: 0;
  background: var(--blurple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
  transform-origin: top center;
  animation: nobori-wave 7s ease-in-out infinite;
}

@keyframes nobori-wave {
  0%   { transform: perspective(600px) rotateY(0deg)   skewX(0deg)   scaleX(1); }
  18%  { transform: perspective(600px) rotateY(4deg)   skewX(0.8deg) scaleX(0.994); }
  38%  { transform: perspective(600px) rotateY(1.2deg) skewX(0.25deg) scaleX(1.002); }
  55%  { transform: perspective(600px) rotateY(5.5deg) skewX(1deg)   scaleX(0.990); }
  72%  { transform: perspective(600px) rotateY(2deg)   skewX(0.4deg) scaleX(0.997); }
  88%  { transform: perspective(600px) rotateY(3.5deg) skewX(0.7deg) scaleX(0.993); }
  100% { transform: perspective(600px) rotateY(0deg)   skewX(0deg)   scaleX(1); }
}

.clan-hero-banner img { width: 100%; height: 100%; object-fit: cover; }

.clan-hero-info { flex: 1; min-width: 200px; }

.clan-hero-name {
  font-size: 26px;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.clan-hero-tag {
  font-size: 14px;
  color: var(--text-muted);
  font-family: monospace;
  font-weight: 400;
}

.clan-hero-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
}

.clan-hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  flex-wrap: wrap;
}

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

.clan-hero-stat .value {
  font-size: 22px;
  font-weight: 700;
  color: white;
}

.clan-hero-stat .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================================================
   CLAN HERO — 3-COLUMN BODY LAYOUT (chi = clan-hero-inner)
   ========================================================= */

.chi-body {
  padding: 18px 24px 18px 206px;
  display: flex;
  gap: 0;
  align-items: stretch;
  min-height: 280px;
}

.chi-col {
  padding: 0 24px;
  border-right: 1px solid var(--border-subtle);
}

.chi-col:last-child {
  border-right: none;
}

.chi-col--summary {
  flex: 1 1 220px;
  min-width: 200px;
  padding-left: 0;
}

.chi-col--ranks {
  flex: 0 0 230px;
  width: 230px;
}

.chi-col--details {
  flex: 0 0 200px;
  width: 200px;
  padding-right: 0;
}

.chi-col-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.chi-leader-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

/* ── Detail list (right column) ─────────────────────────── */

.chi-details-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chi-detail-group {
  display: flex;
  flex-direction: column;
}

.chi-detail-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Capacity group: grid so slot-rows + master-slot sit side by side */
.chi-detail-group--capacity {
  display: grid;
  grid-template-columns: 1fr 44px;
  column-gap: 8px;
  row-gap: 0;
}

.chi-detail-group--capacity .chi-detail-group-title {
  grid-column: 1 / -1;
}

.slot-rows {
  grid-column: 1;
  display: flex;
  flex-direction: column;
}

.master-slot {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px;
  transition: background 0.2s, box-shadow 0.2s;
}

.master-slot--locked {
  background: rgba(255,255,255,0.02);
  border: 1.5px dashed rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.2);
}

.master-slot--unlocked {
  background: linear-gradient(180deg, rgba(254,231,92,0.12), rgba(254,231,92,0.04));
  border: 1.5px solid rgba(254,231,92,0.45);
  color: #fee75c;
  cursor: pointer;
  animation: master-pulse 3s ease-in-out infinite;
}

.master-slot--unlocked:hover {
  background: rgba(254,231,92,0.18);
  box-shadow: 0 0 18px rgba(254,231,92,0.12);
}

.master-slot-label {
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

@keyframes master-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(254,231,92,0.05) inset; }
  50%       { box-shadow: 0 0 20px rgba(254,231,92,0.14) inset; }
}
.chi-detail-group--capacity .chi-detail-group-title {
  margin-bottom: 6px;
}
.chi-detail-group--capacity .slot-type-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  min-width: 0;
}
.chi-detail-group--capacity .slot-type-wrap:last-child {
  margin-bottom: 0;
}
.chi-detail-group--capacity .slot-type-header {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 68px;
  flex-shrink: 0;
  margin-bottom: 0;
}
.chi-detail-group--capacity .slot-type-label {
  font-size: 10px;
  white-space: nowrap;
}
.chi-detail-group--capacity .slot-info-btn {
  display: none;
}
.chi-detail-group--capacity .slot-cells {
  gap: 3px;
  flex-shrink: 0;
}
.chi-detail-group--capacity .slot-cell {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}
.chi-detail-group--capacity .slot-buy-hint {
  font-size: 9px;
  margin-top: 0;
  white-space: nowrap;
  color: var(--text-muted);
}

.chi-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.chi-detail-row:last-child { margin-bottom: 0; }

.chi-detail-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.chi-detail-label {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.chi-detail-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.chi-detail-max {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.chi-detail-value--ok  { color: #57f287; }
.chi-detail-value--warn { color: #fee75c; }

/* =========================================================
   RANK STRUCTURE PILLS
   ========================================================= */

.clan-ranks-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crp {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  width: 100%;
  max-width: 400px;
}

.crp:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.crp-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  color: #0a0b0d;
}

.crp--1 .crp-rank { background: #fee75c; }
.crp--2 .crp-rank { background: #b9bbbe; }
.crp--3 .crp-rank { background: #cd7f32; }
.crp--4 .crp-rank { background: #5865f2; color: white; }
.crp--5 .crp-rank { background: #4f545c; color: #dcddde; }

.crp--1 { border-left: 3px solid #fee75c; }
.crp--2 { border-left: 3px solid #b9bbbe; }
.crp--3 { border-left: 3px solid #cd7f32; }
.crp--4 { border-left: 3px solid #5865f2; }
.crp--5 { border-left: 3px solid #4f545c; }

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

.crp-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crp-meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.crp-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

/* =========================================================
   SLOT CELLS
   ========================================================= */

.slot-type-wrap {
  margin-bottom: 12px;
}

.slot-type-wrap:last-child { margin-bottom: 0; }

.slot-type-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.slot-type-icon { color: var(--text-muted); flex-shrink: 0; }

.slot-type-label {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
}

.slot-info-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  transition: color 0.15s;
  flex-shrink: 0;
}

.slot-info-btn:hover { color: var(--blurple); }

.slot-cells {
  display: flex;
  gap: 4px;
}

.slot-cell {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.slot-cell--on {
  background: var(--blurple);
  border: none;
  color: white;
}

.slot-cell--buy {
  background: transparent;
  border: 1.5px dashed var(--border-medium);
  color: var(--text-muted);
}

.slot-cell--buy-leader {
  border-color: var(--blurple);
  color: var(--blurple);
  cursor: pointer;
}

.slot-cell--buy-leader:hover {
  background: rgba(88, 101, 242, 0.12);
  transform: scale(1.08);
}

.slot-cell--off {
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.12);
  opacity: 1;
}

.slot-buy-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.slot-buy-hint--max {
  color: #57f287;
}

/* =========================================================
   SLOT INFO POPOVER  (sip)
   ========================================================= */

.sip {
  position: absolute;
  z-index: 9300;
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 12px 14px;
  width: 220px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.55);
  pointer-events: none;
}

.sip-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.sip-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.sip-costs {
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sip-cost-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.sip-cost-row span:last-child {
  font-weight: 600;
  color: var(--text-secondary);
}

/* =========================================================
   CAPACITY INFO PANEL  (cip)
   ========================================================= */

.capacity-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cap-info-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.cap-info-btn:hover { color: var(--blurple); }

.cip {
  position: absolute;
  z-index: 9400;
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  padding: 0;
  width: 260px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: hidden;
}

.cip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.cip-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
}

.cip-close-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.cip-close-btn:hover { color: var(--text-primary); }

.cip-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.cip-row:last-child { border-bottom: none; }

.cip-row-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.cip-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 6px;
}

.cip-costs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cip-costs span {
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  padding: 2px 5px;
  font-weight: 600;
}

.cip-row--master .cip-row-head {
  color: rgba(255,255,255,0.3);
}
.cip-row--master .cip-desc {
  font-style: italic;
}

/* =========================================================
   SLOT PURCHASE MODAL  (spm)
   ========================================================= */

.spm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.spm-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spm-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  padding: 24px;
  transform: translateY(10px);
  transition: transform 0.2s;
}

.spm-overlay.active .spm-box { transform: translateY(0); }

.spm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.spm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.spm-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s;
}

.spm-close:hover { color: var(--text-primary); }

.spm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.spm-slot-preview {
  display: flex;
  gap: 6px;
}

.spm-dot {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.spm-dot--on  { background: var(--blurple); }
.spm-dot--off { background: var(--bg-tertiary); border: 1.5px solid var(--border-subtle); }

.spm-detail {
  text-align: center;
  width: 100%;
}

.spm-cost-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.spm-cost-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.spm-cost-label {
  font-size: 13px;
  color: var(--text-muted);
}

.spm-balance-line {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.spm-balance-line strong { color: var(--text-secondary); }

.spm-after-line {
  font-size: 12px;
  color: var(--text-muted);
}

.spm-after-line--warn { color: #ed4245; }

.spm-error {
  font-size: 13px;
  color: #ed4245;
  text-align: center;
  margin-bottom: 12px;
  min-height: 18px;
}

.spm-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* =========================================================
   RANK MEMBERS MODAL
   ========================================================= */

.rank-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.rank-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.rank-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(8px);
  transition: transform 0.2s;
}

.rank-modal-overlay.active .rank-modal {
  transform: translateY(0);
}

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

.rank-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.rank-modal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.rank-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s;
}

.rank-modal-close:hover { color: var(--text-primary); }

.rank-modal-body {
  overflow-y: auto;
  padding: 8px 0;
  flex: 1;
}

.rank-modal-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.rm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  transition: background 0.1s;
}

.rm-row:hover { background: var(--bg-tertiary); }

.rm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.rm-avatar--blank {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.rm-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rm-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.rm-name:hover { color: var(--blurple); text-decoration: underline; }

.rm-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

.rm-score {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 50px;
  text-align: right;
}

/* =========================================================
   MEMBER TABLE
   ========================================================= */

.table-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-tertiary);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--bg-tertiary); }

tbody td {
  padding: 12px 16px;
  font-size: 14px;
  vertical-align: middle;
}

.rank-num {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 13px;
  font-family: monospace;
}

.rank-num.top-1 { color: var(--gold); }
.rank-num.top-2 { color: var(--text-secondary); }
.rank-num.top-3 { color: #cd7f32; }

.class-section-row td {
  padding: 18px 16px 8px;
  background: transparent;
  border-bottom: none;
}
.class-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blurple);
  flex-shrink: 0;
  object-fit: cover;
}

.user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-name a { color: inherit; }
.user-name a:hover { color: white; text-decoration: none; }

.agent-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.2);
  color: var(--blurple);
  font-weight: 600;
  margin-left: 4px;
}

.change-positive { color: var(--green); font-weight: 600; }
.change-negative { color: var(--red); font-weight: 600; }
.change-neutral  { color: var(--text-muted); }

/* =========================================================
   USER PROFILE
   ========================================================= */

.profile-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.profile-banner {
  height: 200px;
  background: linear-gradient(135deg, #1e3a6e 0%, #2563eb 100%);
  background-size: cover;
  background-position: center;
}

.profile-body {
  display: grid;
  grid-template-columns: 260px 1fr 1fr;
  margin-top: -36px;
  align-items: start;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--bg-secondary);
  background: var(--blurple);
  object-fit: cover;
}

.profile-class-badge {
  position: absolute;
  bottom: 2px;
  right: -2px;
}

/* Col 1: avatar · class/rank · bars */
.profile-col1 {
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--border-subtle);
}

/* Col 2–3: name · clan · stats · resources */
.profile-col2 {
  grid-column: 2 / 4;
  padding: 40px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Class badge + rank badge row under avatar */
.profile-class-rank {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Legacy — kept for compatibility */
.profile-info {
  flex: 1;
  padding-top: 10px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-name {
  font-size: 22px;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Rank badge next to class */
.profile-rank-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(254, 231, 92, 0.12);
  border: 1px solid rgba(254, 231, 92, 0.3);
  border-radius: 99px;
  padding: 2px 9px;
  letter-spacing: 0.3px;
}

.profile-clan {
  font-size: 13px;
  color: var(--text-secondary);
}

.profile-clan a { color: var(--text-link); }

/* Inline stats row (Score / Average / Games) */
.profile-inline-stats {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.pis-item {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pis-val {
  font-size: 16px;
  font-weight: 700;
  color: white;
  line-height: 1.1;
}

.pis-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pis-sep {
  width: 1px;
  height: 32px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

/* Level badge left of XP bar */
.profile-xp-lv {
  font-size: 10px;
  font-weight: 700;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* Resources row inside profile-info */
.profile-resources {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
  align-items: center;
  margin-top: 4px;
}

/* =========================================================
   RPG STATS PANEL
   ========================================================= */

.rpg-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

/* Zone 1 — Core stats row */
.rpg-core-row {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
}

.rpg-core-stat {
  flex: 1;
  min-width: 90px;
  padding: 14px 18px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rpg-core-stat:last-child { border-right: none; }

.rpg-core-val {
  font-size: 20px;
  font-weight: 800;
  color: white;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rpg-core-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.rpg-streak-val { color: #ff9535; }

.rpg-flame-icon {
  width: 16px;
  height: 16px;
  color: #ff9535;
  flex-shrink: 0;
}

/* Tooltip */
.rpg-tip {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: help;
  color: var(--text-muted);
  line-height: 0;
  flex-shrink: 0;
}

.rpg-tip i { width: 10px; height: 10px; }

.rpg-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  width: max-content;
  max-width: 220px;
  white-space: normal;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: var(--shadow-lg);
  text-transform: none;
  letter-spacing: 0;
}

.rpg-tip:hover::after { opacity: 1; }

/* Zone 2 — Progress bars */
.rpg-bars-zone {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.rpg-bar-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rpg-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rpg-bar-name {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.rpg-bar-nums {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.rpg-bar-nums strong { color: white; font-weight: 700; }
.rpg-sep { color: var(--text-muted); }

.rpg-bar-track {
  width: 100%;
  height: 7px;
  background: var(--bg-tertiary);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.rpg-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 3px;
}

.rpg-bar-fill--wr {
  background: linear-gradient(90deg, #1e8c4f 0%, #57f287 100%);
  box-shadow: 0 0 8px #57f28730;
}

.rpg-bar-fill--xp {
  background: linear-gradient(90deg, #5b21b6 0%, #a78bfa 100%);
  box-shadow: 0 0 8px #a78bfa30;
}

/* Zone 3 — Resources */
.rpg-resources-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  padding: 14px 20px;
  align-items: center;
}

.rpg-resource {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rpg-resource__icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.rpg-coins-icon {
  width: 20px;
  height: 20px;
  color: var(--gold);
}

.rpg-resource__val {
  font-size: 15px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1.2;
}

.rpg-resource__sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.rpg-resource__lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* =========================================================
   LEADERBOARD FILTERS
   ========================================================= */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--blurple);
  color: var(--text-primary);
  text-decoration: none;
}

.filter-btn.active {
  background: var(--blurple);
  border-color: var(--blurple);
  color: white;
}

/* =========================================================
   STREAK BADGE
   ========================================================= */

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(254, 231, 92, 0.15);
  color: var(--gold);
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-muted);
  gap: 8px;
  text-align: center;
}

.empty-state .icon { font-size: 40px; margin-bottom: 4px; }
.empty-state p { font-size: 14px; }

/* =========================================================
   HERO
   ========================================================= */

.hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14) 0%, rgba(96, 165, 250, 0.05) 60%, rgba(0, 0, 0, 0) 100%);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-lg);
  padding: 48px 40px 36px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(37, 99, 235, 0.07) 0%, transparent 60%);
  pointer-events: none;
}

.hero-video {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: auto;
  max-width: 55%;
  object-fit: cover;
  object-position: right center;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  mask-image: linear-gradient(to left, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 55%, transparent 100%);
}

#hero-sparkline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.38;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.hero-headline {
  font-size: 38px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 28px;
  max-width: 520px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--blurple);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 26px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
}

.hero-cta:hover {
  background: var(--blurple-hover);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.5);
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

.hero-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.4px;
}

.hero-pill--long    { background: rgba(87, 242, 135, 0.15); color: var(--green); border: 1px solid rgba(87, 242, 135, 0.3); }
.hero-pill--short   { background: rgba(237, 66, 69, 0.15);  color: var(--red);   border: 1px solid rgba(237, 66, 69, 0.3); }
.hero-pill--neutral { background: rgba(185, 187, 190, 0.1); color: var(--text-secondary); border: 1px solid rgba(185, 187, 190, 0.2); }
.hero-pill--clan    { background: rgba(254, 231, 92, 0.12); color: var(--gold);  border: 1px solid rgba(254, 231, 92, 0.25); }

@media (max-width: 768px) {
  .hero { padding: 32px 20px 28px; }
  .hero-headline { font-size: 28px; }
  .hero-sub { font-size: 14px; }
}

@media (max-width: 480px) {
  .hero-headline { font-size: 24px; }
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 40px 24px 0;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 48px;
  padding-bottom: 32px;
}

.footer-brand {
  flex-shrink: 0;
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}

.footer-nav-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 120px;
}

.footer-nav-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.footer-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}

.footer-nav-link:hover {
  color: var(--text-primary);
}

.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  border-top: 1px solid var(--border-subtle);
  padding: 14px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text-primary); }

@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    gap: 28px;
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1024px) {
  .home-layout { flex-direction: column; }
  .home-sidebar {
    width: 100%;
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 768px) {
  /* Navbar — hamburger mode */
  .navbar { padding: 0 12px; gap: 8px; height: 56px; }
  .navbar-brand img { height: 36px; }
  .sake-ticker__mcap { display: none; }

  /* Hide desktop-only nav elements */
  .navbar-nav { display: none; }
  .navbar-spacer { display: none; }
  .nav-user { display: none; }
  .navbar > .nav-login-btn { display: none; }
  .nav-gold-badge { display: none; }
  .profile-menu { display: none; }
  .navbar > .sake-ticker { display: none; }

  /* Show search prominently, alongside the hamburger */
  .nav-search {
    display: flex;
    flex: 1;
    max-width: none;
    margin: 0;
  }

  /* Show hamburger */
  .nav-hamburger { display: flex; }

  /* Show mcap in drawer */
  .drawer-sake-mcap { display: inline; }

  /* Page */
  .page-content { padding: 14px 12px; }

  /* Stats bar — horizontal scroll on tiny screens */
  .stats-bar {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .stats-bar::-webkit-scrollbar { display: none; }
  .stat-pill { flex-shrink: 0; }

  /* Hero */
  .hero { padding: 28px 16px 24px; }
  .hero-headline { font-size: 26px; }
  .hero-sub { font-size: 14px; margin-bottom: 20px; }
  .hero-video { display: none; }

  /* Tournament cards — stack header content */
  .tournament-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tournament-meta { gap: 6px; }

  /* Grids */
  .tournament-picks-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .clans-grid { grid-template-columns: 1fr; }

  /* Clan & profile */
  .clan-hero { flex-direction: column; }
  .profile-body { flex-direction: column; align-items: flex-start; }
  .profile-info { padding-top: 0; }

  /* Sidebar — 2-col grid */
  .home-sidebar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  /* Sidebar — single column on small phones */
  .home-sidebar {
    grid-template-columns: 1fr;
  }

  /* Picks two-col — keep side by side but smaller */
  .picks-col { padding: 6px 8px 8px; }
  .pick-row-name { max-width: 60px; }
}

@media (max-width: 480px) {
  .sake-ticker { padding: 4px 8px; }
  .sake-ticker__symbol { display: none; }

  .hero-headline { font-size: 22px; }

  .tournament-picks-grid { grid-template-columns: 1fr 1fr; }

  /* Tables — hide less important columns */
  thead th:nth-child(n+5) { display: none; }
  tbody td:nth-child(n+5) { display: none; }

  /* Active banner — stack on very small screens */
  .active-banner { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   ADMIN PANEL (/dojo)
   ========================================================= */

.admin-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

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

.admin-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.admin-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Flash messages */
.admin-flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}
.admin-flash--ok  { background: rgba(52,211,153,0.12); border: 1px solid rgba(52,211,153,0.3); color: var(--green); }
.admin-flash--error { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.3); color: var(--red); }

/* Stats row */
.admin-stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.admin-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 120px;
}

.admin-stat__val {
  font-size: 24px;
  font-weight: 800;
  color: var(--blurple);
}

.admin-stat__label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Grid layout */
.admin-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cards */
.admin-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.admin-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Tables */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:hover td { background: var(--bg-accent); }

.admin-table .mono { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; }
.admin-table .muted { color: var(--text-muted); }

/* Server icon in table */
.admin-server-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

/* User link */
.admin-user-link { color: var(--text-link); font-weight: 500; }
.admin-user-link:hover { text-decoration: underline; }

/* Class badge (admin override removed — gem styles above) */

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge--green   { background: rgba(52,211,153,0.15);  color: var(--green); }
.badge--red     { background: rgba(248,113,113,0.15); color: var(--red); }
.badge--gold    { background: rgba(251,191,36,0.15);  color: var(--gold); }
.badge--muted   { background: var(--bg-accent); color: var(--text-muted); }
.badge--blurple { background: rgba(88,101,242,0.2);   color: #818cf8; }

/* Buttons */
.btn-primary {
  background: var(--blurple);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--blurple-hover); }

.btn-sm {
  background: var(--bg-accent);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-sm:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger-sm {
  background: rgba(248,113,113,0.1);
  color: var(--red);
  border: 1px solid rgba(248,113,113,0.25);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger-sm:hover { background: rgba(248,113,113,0.2); }

.inline-form { display: inline; }

/* Expandable add form */
.admin-expandable {
  margin-top: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-expandable summary {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  background: var(--bg-tertiary);
  list-style: none;
}
.admin-expandable summary:hover { color: var(--text-primary); }
.admin-expandable[open] summary { border-bottom: 1px solid var(--border-subtle); }

.admin-form {
  padding: 16px;
}

.admin-form__row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-form__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 180px;
  flex: 1;
}

.admin-form__field--wide { flex: 2; }

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

.admin-form__field input {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.admin-form__field input:focus {
  outline: none;
  border-color: var(--blurple);
}

/* =========================================================
   DATABASE BACKEND TOGGLE
   ========================================================= */

.db-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.db-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.db-toggle-status {
  font-size: 15px;
  color: var(--text-secondary);
}

.db-toggle-status__val {
  font-size: 16px;
  font-weight: 700;
}

.db-toggle-status__val--replit { color: #f26522; }
.db-toggle-status__val--supa   { color: #3ecf8e; }

.db-toggle-note {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 460px;
}

.db-toggle-btns {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.db-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 2px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}

.db-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.db-btn--active {
  border-color: #f26522;
  background: rgba(242,101,34,0.1);
  color: #f26522;
}

.db-btn--active.db-btn--supa {
  border-color: #3ecf8e;
  background: rgba(62,207,142,0.1);
  color: #3ecf8e;
}

.db-btn--disabled,
.db-btn--disabled:hover {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  border-color: var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.db-toggle-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.db-toggle-divider__line {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
}

.db-toggle-divider__label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* =========================================================
   AI AGENT CREATE / EDIT PAGE
   ========================================================= */

.agent-create-page {
  max-width: 680px;
  margin: 48px auto;
  padding: 0 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.agent-section-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-section-sub {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Flash messages */
.agent-flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.agent-flash--success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--green);
}

.agent-flash--error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--red);
}

.agent-flash svg { flex-shrink: 0; margin-top: 1px; }

/* Existing agent card */
.agent-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.agent-card__icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blurple);
}

.agent-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-card__name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-card__about {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.agent-card__about--empty {
  color: var(--text-muted);
  font-style: italic;
}

.agent-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.agent-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(37, 99, 235, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.35);
  text-transform: uppercase;
}

.agent-card__tag {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.agent-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.agent-edit-btn:hover {
  border-color: var(--blurple);
  color: var(--text-primary);
  background: rgba(37, 99, 235, 0.1);
  text-decoration: none;
}

/* Form */
.agent-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.agent-form__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-form__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.agent-form__required {
  color: var(--red);
  margin-left: 2px;
}

.agent-form__input,
.agent-form__textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  padding: 11px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
}

.agent-form__input::placeholder,
.agent-form__textarea::placeholder {
  color: var(--text-muted);
}

.agent-form__input:focus,
.agent-form__textarea:focus {
  border-color: var(--blurple);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.agent-form__textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

.agent-form__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.agent-form__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

.agent-form__submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius);
  border: none;
  background: var(--blurple);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.agent-form__submit:hover {
  background: var(--blurple-hover);
  transform: translateY(-1px);
}
.agent-form__cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(254, 231, 92, 0.08);
  border: 1px solid rgba(254, 231, 92, 0.22);
  border-radius: 20px;
  padding: 6px 12px 6px 9px;
}

.agent-form__cancel {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.agent-form__cancel:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

/* Info box */
.agent-info-box {
  display: flex;
  gap: 16px;
  background: var(--bg-accent);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.agent-info-box__icon {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-info-box__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-info-box__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.agent-info-box__body p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 520px) {
  .agent-card { flex-direction: column; }
  .agent-edit-btn { align-self: flex-start; }
}

/* =========================================================
   AGENT PROFILE PAGE
   ========================================================= */

.agent-profile-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Hero */
/* ── Agent Hero — banner strip + straddling avatar ───────────────── */
.ap-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 12px;
  /* no overflow:hidden — avatar must poke above .ap-hero__body */
}

/* Top banner strip */
.ap-hero__banner-section {
  position: relative;
  height: 210px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-accent);
}

.ap-hero__banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.ap-hero__banner-fallback {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    var(--bg-accent),
    var(--bg-accent) 20px,
    var(--bg-tertiary) 20px,
    var(--bg-tertiary) 40px
  );
  opacity: 0.45;
}

/* Edit button — top-right of banner */
.ap-hero__edit-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

/* Body — content area below the banner */
.ap-hero__body {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 0 28px 26px 28px;
  /* top padding = half avatar (60px) + gap (12px) */
  padding-top: 72px;
}

/* Avatar sits at the very top of the body, half above it */
.ap-hero__avatar-wrap {
  position: absolute;
  top: -60px;   /* pull up half of 120px avatar */
  left: 28px;
  z-index: 2;
}

.ap-hero__avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--bg-secondary);
  object-fit: cover;
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
}

.ap-hero__avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--bg-secondary);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
}

/* Name row — sits right below the avatar space */
.ap-hero__name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ap-hero__name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

/* Mid row — description left, stats right */
.ap-hero__mid-row {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

/* Info block — description + meta */
.ap-hero__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ap-hero__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ap-class-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ap-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.ap-edit-link:hover {
  color: var(--text-primary);
  border-color: var(--blurple);
  text-decoration: none;
}

.ap-hero__about {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

.ap-hero__meta {
  font-size: 12px;
  color: var(--text-muted);
}

.ap-hero__stats {
  display: flex;
  flex-direction: row;
  gap: 28px;
  flex-shrink: 0;
  align-items: flex-start;
  padding-top: 8px;
}

.ap-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.ap-stat__val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

.ap-stat__lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Aggression stat label ───────────────────────────────── */
.ap-stat__val--aggression {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* ── Aggression panel ────────────────────────────────────── */
.ap-aggression-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin: 0 0 18px 0;
  padding: 16px 22px;
}
.ap-aggression-panel__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.ap-aggression-panel__left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 130px;
}
.ap-aggression-panel__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.ap-aggression-panel__label {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}
.ap-aggression-panel__hint {
  font-size: 11px;
  color: var(--text-muted);
}
.ap-aggression-panel__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 220px;
}
.ap-aggression-slider {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
.ap-aggression-save {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.ap-aggression-save:hover { opacity: 0.85; }
.ap-aggression-save:disabled { opacity: 0.5; cursor: not-allowed; }
.ap-aggression-status {
  font-size: 12px;
  font-weight: 600;
  min-width: 40px;
}
.ap-aggression-status--ok  { color: var(--success); }
.ap-aggression-status--err { color: var(--danger); }

/* ── Distillery ─────────────────────────────────────────── */
.distillery {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.distillery__hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
  flex-wrap: wrap;
}

.distillery__title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.distillery__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.distillery__sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dt-admin-inspect-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.35);
  color: #7983f5;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 20px;
}

.distillery__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.dt-insert-group { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dt-insert-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); padding-right: 8px; border-right: 1px solid var(--border-subtle); white-space: nowrap; }
.dt-cut-cost-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--gold); background: rgba(254,231,92,.08); border: 1px solid rgba(254,231,92,.22); border-radius: 20px; padding: 3px 9px 3px 6px; white-space: nowrap; margin-right: 4px; }
.dt-insert-tab { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 9px 12px; min-width: 62px; border-radius: 7px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid; transition: all .15s; line-height: 1.2; background: transparent; white-space: nowrap; }
.dt-insert-tab--data   { color: #10b981; border-color: rgba(16,185,129,.3); }
.dt-insert-tab--data:hover,   .dt-insert-tab--data.dt-insert-tab--active   { background: rgba(16,185,129,.13); border-color: rgba(16,185,129,.6); }
.dt-insert-tab--text   { color: #f59e0b; border-color: rgba(245,158,11,.3); }
.dt-insert-tab--text:hover,   .dt-insert-tab--text.dt-insert-tab--active   { background: rgba(245,158,11,.13); border-color: rgba(245,158,11,.6); }
.dt-insert-tab--filter { color: #06b6d4; border-color: rgba(6,182,212,.3); }
.dt-insert-tab--filter:hover, .dt-insert-tab--filter.dt-insert-tab--active { background: rgba(6,182,212,.13); border-color: rgba(6,182,212,.6); }
.dt-insert-tab--sort   { color: #f97316; border-color: rgba(249,115,22,.3); }
.dt-insert-tab--sort:hover,   .dt-insert-tab--sort.dt-insert-tab--active   { background: rgba(249,115,22,.13); border-color: rgba(249,115,22,.6); }
.dt-insert-tab--ta     { color: #a855f7; border-color: rgba(168,85,247,.3); }
.dt-insert-tab--ta:hover,     .dt-insert-tab--ta.dt-insert-tab--active     { background: rgba(168,85,247,.13); border-color: rgba(168,85,247,.6); }
.dt-tbtn--fs { background: transparent; border-color: var(--border-subtle); color: var(--text-muted); font-size: 15px; padding: 5px 9px; }
.dt-tbtn--fs:hover { color: #e2e8f0; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.05); }
.distillery--fs { position: fixed !important; inset: 0 !important; z-index: 800; overflow-y: auto; border-radius: 0 !important; margin: 0 !important; background: var(--bg-secondary) !important; }
.distillery--fs .dt-stage { height: calc(100vh - 240px) !important; }

.dt-tbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.dt-tbtn:hover { transform: translateY(-1px); }

.dt-tbtn--text {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.4);
  color: #f59e0b;
}

.dt-tbtn--text:hover { background: rgba(245,158,11,0.15); }

.dt-tbtn--data {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.4);
  color: #10b981;
}

.dt-tbtn--data:hover { background: rgba(16,185,129,0.15); }

.dt-tbtn--save {
  background: var(--blurple);
  border-color: var(--blurple);
  color: #fff;
}

.dt-tbtn--save:hover { background: var(--blurple-hover); }
.dt-tbtn--save:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.dt-tbtn--reset {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.dt-tbtn--reset:hover { border-color: var(--text-muted); color: var(--text-secondary); }

.dt-tbtn--test {
  background: rgba(194,118,28,0.1);
  border-color: rgba(194,118,28,0.5);
  color: #c2761c;
}
.dt-tbtn--test:hover { background: rgba(194,118,28,0.18); border-color: #c2761c; }
.dt-tbtn--test:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

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

.dt-tbtn--filter {
  background: rgba(6,182,212,0.08);
  border-color: rgba(6,182,212,0.4);
  color: #06b6d4;
}

.dt-tbtn--filter:hover { background: rgba(6,182,212,0.15); }

.dt-add-menu__btn--sort {
  color: #f97316;
}
.dt-add-menu__btn--sort:hover { background: rgba(249,115,22,0.12); }
.dt-add-menu__btn--filter {
  color: #06b6d4;
}

.dt-add-menu__btn--filter:hover { background: rgba(6,182,212,0.12); }

/* Canvas */
.dt-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}

.dt-stage {
  position: relative;
  min-width: 1000px;
  height: 440px;
  background-color: #060c18;
  background-image:
    radial-gradient(circle, #0f1a2e 1.5px, transparent 1.5px);
  background-size: 30px 30px;
  border-top: 1px solid rgba(194,118,28,0.2);
  border-bottom: 1px solid rgba(194,118,28,0.1);
  cursor: default;
  overflow: hidden;
}

/* Nodes */
.dt-node {
  position: absolute;
  width: 168px;
  min-height: 80px;
  border: 1.5px solid;
  border-radius: 10px;
  padding: 10px 14px 10px 10px;
  cursor: grab;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: box-shadow 0.15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  overflow: hidden;
}

.dt-node:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

.dt-node--fixed {
  cursor: default;
}

.dt-node__badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
}

.dt-node__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.dt-node__del {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  background: rgba(15,15,20,0.6);
  border: 1px solid rgba(237,66,69,0.35);
  color: #ed4245;
  font-size: 13px;
  cursor: pointer;
  border-radius: 7px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, background 0.15s, transform 0.18s;
  transform: translateY(4px);
}

.dt-node:hover .dt-node__del {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dt-node__del:hover {
  background: rgba(237,66,69,0.22);
  border-color: rgba(237,66,69,0.65);
}

.dt-node__port {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid currentColor;
  pointer-events: none;
  z-index: 2;
}

/* Port positions — one per side */
.dt-node__port--left   { left: -6px;   top: 50%;  transform: translateY(-50%); }
.dt-node__port--right  { right: -6px;  top: 50%;  transform: translateY(-50%); }
.dt-node__port--top    { top: -6px;    left: 50%; transform: translateX(-50%); }
.dt-node__port--bottom { bottom: -6px; left: 50%; transform: translateX(-50%); }

/* Liquid fill overlay — rises from bottom inside node */
.dt-node__liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
  will-change: height;
}

/* Node content sits above liquid fill */
.dt-node__badge,
.dt-node__label {
  position: relative;
  z-index: 1;
}

/* Node active glow during test animation */
.dt-node--liquid {
  box-shadow: 0 0 0 2px #fee75c, 0 0 16px rgba(254,231,92,0.4) !important;
}

/* Broken node — effectiveness depleted to zero */
.dt-node--broken {
  background: rgba(237,66,69,0.07) !important;
  animation: dt-broken-pulse 2.5s ease-in-out infinite;
}
@keyframes dt-broken-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(237,66,69,0.35); }
  50%       { box-shadow: 0 0 0 2px rgba(237,66,69,0.65), 0 0 10px rgba(237,66,69,0.2); }
}
.dt-node__broken-overlay {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 13px;
  line-height: 1;
  z-index: 1;
  pointer-events: none;
  opacity: 0.8;
}

/* Degraded node — effectiveness below 50%, not yet broken */
.dt-node--degraded {
  animation: dt-degraded-pulse 3s ease-in-out infinite;
}
@keyframes dt-degraded-pulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 0 1px rgba(254,231,92,0.15); }
  50%       { box-shadow: 0 2px 12px rgba(0,0,0,0.5), 0 0 0 2px rgba(254,231,92,0.45), 0 0 10px rgba(254,231,92,0.12); }
}

/* Effectiveness decay bar — pinned to the very bottom of the node */
.dt-node__eff-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255,255,255,0.07);
  z-index: 1;
  pointer-events: none;
}
.dt-node__eff-fill {
  height: 100%;
  transition: width 0.4s ease, background 0.4s ease;
}
/* Percentage label — floats just above the bar, right-aligned */
.dt-node__eff-label {
  position: absolute;
  bottom: 7px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  opacity: 0.85;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.18s;
}
/* Hide the eff-label when action buttons are visible to avoid overlap */
.dt-node:hover .dt-node__eff-label {
  opacity: 0;
}
/* Edit button — bottom-left, hidden until node hover */
.dt-node__edit {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  background: rgba(15,15,20,0.6);
  border: 1px solid rgba(88,101,242,0.35);
  color: #5865f2;
  font-size: 12px;
  cursor: pointer;
  border-radius: 7px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, background 0.15s, transform 0.18s;
  transform: translateY(4px);
}
.dt-node:hover .dt-node__edit {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dt-node__edit:hover {
  background: rgba(88,101,242,0.22);
  border-color: rgba(88,101,242,0.65);
  color: #7983f5;
}

.dt-node__inspect {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  background: rgba(15,15,20,0.6);
  border: 1px solid rgba(88,101,242,0.35);
  color: #7983f5;
  font-size: 12px;
  cursor: pointer;
  border-radius: 7px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, background 0.15s, transform 0.18s;
  transform: translateY(4px);
}
.dt-node:hover .dt-node__inspect {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dt-node__inspect:hover {
  background: rgba(88,101,242,0.22);
  border-color: rgba(88,101,242,0.65);
}

/* ── Cut Inventory Panel ────────────────────────────────────────────── */
.dt-inventory {
  margin-top: 8px;
}
.dt-inv-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2px 10px;
  letter-spacing: 0.04em;
}
.dt-inv-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.55;
}
.dt-inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.dt-inv-card {
  border: 1.5px solid;
  border-radius: 10px;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.dt-inv-card__badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
}
.dt-inv-card__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
  flex: 1;
}
.dt-inv-card__eff {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.dt-inv-card__eff-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
}
.dt-inv-card__eff-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.dt-inv-card__eff-pct {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.dt-inv-card__place {
  margin-top: 6px;
  width: 100%;
  background: transparent;
  border: 1px solid;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 0;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  letter-spacing: 0.02em;
}
.dt-inv-card__place:hover {
  background: rgba(255,255,255,0.06);
}

/* SVG Pipes — orthogonal pipe rendering */
.dt-pipe-casing {
  stroke: #0d1117;
  stroke-width: 11;
  fill: none;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.dt-pipe-bore {
  stroke: #c2761c;
  stroke-width: 5;
  fill: none;
  stroke-linecap: square;
  stroke-linejoin: miter;
  filter: drop-shadow(0 0 3px rgba(194,118,28,0.45));
}

/* Add-between dropdown */
.dt-add-menu {
  background: var(--bg-secondary);
  border: 1px solid #c2761c;
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateX(-50%);
}

.dt-add-menu__title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 2px 8px 4px;
}

.dt-add-menu__btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.dt-add-menu__btn--text { color: #f59e0b; }
.dt-add-menu__btn--text:hover { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); }

.dt-add-menu__btn--data { color: #10b981; }
.dt-add-menu__btn--data:hover { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); }
.dt-add-menu__btn--ta { color: #a855f7; }
.dt-add-menu__btn--ta:hover { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.3); }

/* Edit modal backdrop */
.dt-edit-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 998;
  display: none;
}

/* Edit panel — modal */
.dt-edit-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  background: #2f3136;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 24px;
  width: 520px;
  max-width: 94vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  animation: dtModalIn 0.18s ease;
}

@keyframes dtModalIn {
  from { opacity: 0; transform: translate(-50%, -47%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.dt-edit-panel__hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dt-edit-panel__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.dt-edit-panel__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.dt-edit-panel__close:hover { color: var(--text-primary); }

.dt-edit-panel__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dt-edit-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dt-edit-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.dt-edit-input,
.dt-edit-textarea,
.dt-edit-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dt-edit-input:focus,
.dt-edit-textarea:focus,
.dt-edit-select:focus {
  border-color: var(--blurple);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.dt-edit-textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.dt-edit-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.dt-edit-hint--fixed {
  padding: 10px 14px;
  background: var(--bg-accent);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-muted);
}

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

.dt-edit-apply {
  padding: 9px 20px;
  background: var(--blurple);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.dt-edit-apply:hover { background: var(--blurple-hover); }

.dt-edit-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: transparent;
  border: 1px solid rgba(248,113,113,0.35);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.dt-edit-delete:hover { background: rgba(248,113,113,0.08); }

/* Hint bar */
.distillery__hint {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-accent);
}

/* Toast */
.dt-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  animation: toastIn 0.25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.dt-toast--success { background: rgba(52,211,153,0.15); border: 1px solid rgba(52,211,153,0.4); color: var(--green); }
.dt-toast--error   { background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.4); color: var(--red);   }
.dt-toast--out     { animation: toastOut 0.4s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform:translateX(-50%) translateY(10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateX(-50%) translateY(8px); } }

/* Picks table extras */
.ap-section { display: flex; flex-direction: column; gap: 0; }

.pick-name { font-size: 12px; color: var(--text-muted); }

.pick-dir {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pick-dir--long  { background: rgba(52,211,153,0.12); color: var(--green); }
.pick-dir--short { background: rgba(248,113,113,0.12); color: var(--red);   }

.pick-up   { color: var(--green); font-weight: 600; }
.pick-down { color: var(--red);   font-weight: 600; }

.pick-tourn-link { color: var(--text-muted); font-size: 12px; text-transform: capitalize; }
.pick-tourn-link:hover { color: var(--text-secondary); }

.ap-empty {
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* =========================================================
   AGENTS LISTING PAGE
   ========================================================= */

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.agent-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color .15s, background .15s;
}
.agent-card:hover {
  border-color: #c2761c55;
  background: var(--bg-tertiary);
  text-decoration: none;
}

.agent-card__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.agent-card__icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  background: rgba(37,99,235,0.12);
  border: 1px solid rgba(37,99,235,0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  overflow: hidden;
}
.agent-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-card__info {
  flex: 1;
  min-width: 0;
}

.agent-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-card__rank {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}
.agent-card__rank-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.agent-card__rank-lbl {
  font-size: 10px;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-card__about {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.agent-card__stats {
  display: flex;
  gap: 16px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  margin-top: auto;
}

.agent-card__stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.agent-card__stat strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.agent-card__stat span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

@media (max-width: 640px) {
  .ap-hero__banner-section { height: 160px; }
  .ap-hero__body { padding: 0 18px 20px; padding-top: 66px; }
  .ap-hero__avatar-wrap { left: 18px; top: -55px; }
  .ap-hero__avatar-img, .ap-hero__avatar-placeholder { width: 110px; height: 110px; }
  .ap-hero__mid-row { flex-direction: column; gap: 14px; }
  .ap-hero__stats { flex-direction: row; flex-wrap: wrap; gap: 20px; padding-top: 0; }
  .ap-stat { align-items: flex-start; }
}

/* ── Ingredient Shelf ─────────────────────────────────────────────── */
.ing-shelf {}
.ing-row { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.ing-row__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; min-width: 68px; padding-top: 7px; flex-shrink: 0; }
.ing-row__label--text   { color: rgba(167,139,250,.75); }
.ing-row__label--data   { color: rgba(52,211,153,.75); }
.ing-row__label--filter { color: rgba(34,211,238,.75); }
.ing-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ing-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all .15s; border: 1px solid; line-height: 1.3; }
.ing-chip--text   { color: #a78bfa; border-color: rgba(167,139,250,.3); background: rgba(167,139,250,.07); }
.ing-chip--text:hover   { background: rgba(167,139,250,.16); border-color: rgba(167,139,250,.55); transform: translateY(-1px); }
.ing-chip--data   { color: #34d399; border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.07); }
.ing-chip--data:hover   { background: rgba(52,211,153,.16); border-color: rgba(52,211,153,.55); transform: translateY(-1px); }
.ing-chip--filter { color: #22d3ee; border-color: rgba(34,211,238,.3); background: rgba(34,211,238,.07); }
.ing-chip--filter:hover { background: rgba(34,211,238,.16); border-color: rgba(34,211,238,.55); transform: translateY(-1px); }
.ing-modal { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 14px; width: 480px; max-width: 94vw; padding: 26px; }
.ing-modal__hdr { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.ing-modal__icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ing-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 3px 9px; border-radius: 5px; }
.ing-badge--text   { color: #a78bfa; background: rgba(167,139,250,.15); border: 1px solid rgba(167,139,250,.3); }
.ing-badge--data   { color: #34d399; background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); }
.ing-badge--filter { color: #22d3ee; background: rgba(34,211,238,.12); border: 1px solid rgba(34,211,238,.3); }

/* ── Inline filter picker panel ───────────────────────────────────── */
@keyframes dt-panel-slide-in {
  from { opacity: 0; transform: translateY(-10px) scaleY(0.94); }
  to   { opacity: 1; transform: translateY(0)     scaleY(1);    }
}
.dt-filter-panel { border-top: 1px solid rgba(6,182,212,0.18); background: rgba(6,182,212,0.03); padding: 14px 20px 16px; transform-origin: top center; }
.dt-filter-panel--in { animation: dt-panel-slide-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.dt-filter-panel__hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dt-filter-panel__title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #06b6d4; }
.dt-filter-panel__close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 3px; transition: color .15s; }
.dt-filter-panel__close:hover { color: #e2e8f0; }
.dt-filter-panel__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.dt-filter-panel__desc { margin-top: 12px; padding: 10px 14px; background: var(--bg-primary); border: 1px solid rgba(6,182,212,0.15); border-radius: 8px; }
.dt-filter-panel__desc-name { font-size: 13px; font-weight: 600; color: #e2e8f0; display: block; margin-bottom: 5px; }
.dt-filter-panel__desc-text { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin: 0; }
.fp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; color: #22d3ee; border: 1px solid rgba(34,211,238,0.3); background: rgba(34,211,238,0.07); transition: all .15s; line-height: 1.3; }
.fp-chip:hover { background: rgba(34,211,238,0.16); border-color: rgba(34,211,238,0.55); transform: translateY(-1px); }
