/* ============================================================
   TOPORIO — Trading Platform Stylesheet
   Unique design identity: deep space dark + electric violet/cyan
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --bg-primary:    #090b10;
  --bg-secondary:  #0f1218;
  --bg-card:       #151921;
  --bg-elevated:   #1c2230;
  --bg-input:      #1a1f2e;
  --border:        #252d3d;
  --border-light:  #2e3a4e;
  --border-focus:  #7c5cfc;

  --text-primary:   #e8eaf0;
  --text-secondary: #8b92a5;
  --text-muted:     #525a6e;

  --green:     #00d68f;
  --green-dim: rgba(0, 214, 143, 0.12);
  --red:       #ff4d6a;
  --red-dim:   rgba(255, 77, 106, 0.12);

  /* Primary brand: violet → cyan gradient */
  --accent:       #7c5cfc;
  --accent-light: #9b7fff;
  --accent-dim:   rgba(124, 92, 252, 0.12);
  --accent-hover: #6a4ae0;
  --cyan:         #00d4aa;
  --cyan-dim:     rgba(0, 212, 170, 0.10);
  --gradient:     linear-gradient(135deg, #7c5cfc 0%, #00d4aa 100%);
  --gradient-h:   linear-gradient(90deg, #7c5cfc 0%, #00d4aa 100%);

  --nav-height: 56px;
  --sidebar-width: 340px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --transition: 150ms ease;
  --shadow:    0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.7);
  --glow:      0 0 20px rgba(124, 92, 252, 0.15);
}


/* ---------- Glow & Ambient Effects ---------- */
@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes priceFlashGreen {
  0% { background: rgba(0,230,138,0.15); }
  100% { background: transparent; }
}
@keyframes priceFlashRed {
  0% { background: rgba(255,68,102,0.15); }
  100% { background: transparent; }
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; width: 100%; }
body { overflow-x: clip; max-width: 100vw; width: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


a { color: var(--accent-light); text-decoration: none; cursor: pointer; }
a:hover { color: var(--accent); }

input, button, select, textarea { font-family: inherit; font-size: inherit; }

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Ticker tape */
#ticker-tape { overflow: hidden !important; width: 100%; max-width: 100vw; }
#ticker-tape-content { width: max-content; }

/* Ticker tape animation */
@keyframes tickerScroll {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}
#ticker-tape:hover #ticker-tape-content { animation-play-state: paused; }

/* Overview item hover */
.overview-item:hover { background: var(--bg-elevated) !important; }

/* Global UX improvements */
button, [role="button"], .person-item, .cat-tab, .nav-link, .tf-btn, .order-type-btn, .qty-preset, .wallet-btn {
  cursor: pointer;
}
.trade-tab:hover, .cat-tab:hover, .qty-preset:hover, .order-type-btn:hover {
  filter: brightness(1.15);
}

/* Utility */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.nowrap      { white-space: nowrap; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
}

.toast.success::before { background: var(--green); }
.toast.error::before   { background: var(--red); }
.toast.info::before    { background: var(--accent); }
.toast.warning::before { background: #f6a609; }

.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; }
.toast-title   { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.toast-message { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.toast-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; line-height: 1;
  padding: 0; flex-shrink: 0;
}
.toast-close:hover { color: var(--text-primary); }
.toast.hiding { animation: slideOut 0.25s ease forwards; }

@keyframes slideIn  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to   { transform: translateX(110%); opacity: 0; } }

/* ============================================================
   TOP NAVIGATION BAR
   ============================================================ */
#topbar {
  height: var(--nav-height);
  background: rgba(15, 18, 24, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  white-space: nowrap;
  position: relative;
}

.logo .accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 2px;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text-primary); background: var(--bg-elevated); }
.nav-link.active {
  color: var(--accent-light);
  background: var(--accent-dim);
}

/* User Section */
.user-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Wallet Button */
.wallet-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.wallet-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 12px rgba(124, 92, 252, 0.3);
}
.wallet-btn.connected {
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  color: var(--accent-light);
}
.wallet-btn.connected:hover {
  background: var(--accent-dim);
  box-shadow: none;
}

/* Notifications */
.notif-wrap { position: relative; }

.notif-bell {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
  transition: all var(--transition); position: relative; display: flex; align-items: center;
}
.notif-bell:hover { color: var(--text-primary); background: var(--bg-elevated); }

.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.notif-dropdown {
  display: none; position: fixed; top: calc(var(--nav-height) + 6px); right: 20px; padding-top: 4px;
  width: 340px; z-index: 9999;
}
.notif-dropdown-inner {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.notif-wrap:hover .notif-dropdown,
.notif-dropdown:hover,
.notif-wrap.open .notif-dropdown,
.notif-dropdown.open { display: block; }

.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.notif-clear { background: none; border: none; color: var(--accent-light); font-size: 11px; cursor: pointer; }

.notif-list { max-height: 300px; overflow-y: auto; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 12px; }

.notif-item {
  padding: 10px 14px; border-bottom: 1px solid rgba(37,45,61,0.3);
  cursor: pointer; transition: background 0.1s;
}
.notif-item:hover { background: var(--bg-elevated); }
.notif-item:last-child { border-bottom: none; }
.notif-item-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.notif-item-body { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-item-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.balance-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.balance-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.balance-amount {
  font-size: 14px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.username-text {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
}

.user-dropdown {
  display: none;
  position: fixed;
  top: calc(var(--nav-height) + 6px);
  right: 20px;
  padding-top: 4px;
  min-width: 180px;
  z-index: 9999;
}
.user-dropdown-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.user-avatar-wrap:hover .user-dropdown,
.user-dropdown:hover,
.user-avatar-wrap.open .user-dropdown,
.user-dropdown.open { display: block; }

.dropdown-item {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.dropdown-item:hover { background: var(--bg-elevated); color: var(--text-primary); }

.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* Buttons */
.btn-primary {
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 20px;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   VIEW SYSTEM
   ============================================================ */
.view { display: none; flex: 1; }
.view.active { display: flex; flex-direction: column; }

/* ============================================================
   MARKET VIEW
   ============================================================ */
.market-layout {
  display: flex;
  flex: 1;
  max-height: calc(100vh - var(--nav-height) - 28px);
  overflow: hidden;
}

/* ---------- Market Sidebar ---------- */
.market-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s, opacity 0.2s;
}

/* Trading mode — sidebar slides out, full width for trading */
body.trading-mode .market-sidebar {
  position: fixed;
  left: -340px;
  top: 0;
  bottom: 0;
  z-index: 900;
  width: 340px;
  transition: left 0.25s ease;
  border-right: 1px solid var(--border);
  box-shadow: none;
}

body.trading-mode .market-sidebar.sidebar-open {
  left: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,0.5);
}

body.trading-mode .market-main {
  width: 100% !important;
  margin-left: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  height: calc(100vh - 55px) !important;
  overflow: hidden !important;
}

body.trading-mode .site-footer,
body.trading-mode #newsletter-section,
body.trading-mode #cookie-banner,
body.trading-mode .market-overview-footer {
  display: none !important;
}

/* Sidebar overlay when open */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 899;
}

body.trading-mode .sidebar-open ~ .sidebar-overlay,
body.trading-mode .sidebar-overlay.active {
  display: block;
}

/* Toggle button — docked to left edge */
#sidebar-toggle {
  display: none;
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 901;
  width: 24px;
  height: 48px;
  border-radius: 0 8px 8px 0;
  border: 1px solid var(--border);
  border-left: none;
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  align-items: center;
  justify-content: center;
}

#sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

body.trading-mode #sidebar-toggle {
  display: flex;
}

.sidebar-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px 9px 36px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
#search-input::placeholder { color: var(--text-muted); }

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
}

.search-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}

.search-suggestion:hover { background: var(--bg-elevated); }

.search-suggestion .sg-ticker {
  font-weight: 600;
  color: var(--accent-light);
  min-width: 70px;
}

.search-suggestion .sg-name {
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggestion .sg-price {
  color: var(--text-primary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Category Tabs — wrapping grid, all visible */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.cat-tab {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 20px;
  white-space: nowrap;
  transition: all var(--transition);
}

.cat-tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border);
}

.cat-tab.active {
  color: var(--accent-light);
  background: var(--accent-dim);
  border-color: rgba(124, 92, 252, 0.3);
}

/* Country Filter */
.country-filter {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.country-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b92a5' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.country-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.country-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Sidebar List Header */
.sidebar-list-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}

.sort-col {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.sort-col:hover { color: var(--text-secondary); }
.sort-col.active { color: var(--accent-light); }
.sort-arrow { font-size: 8px; opacity: 0.7; }

/* Person List */
.person-list {
  flex: 1;
  overflow-y: auto;
}

.person-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(37, 45, 61, 0.4);
  position: relative;
}

.person-item:hover { background: rgba(21, 25, 33, 0.7); }

.person-item.active {
  background: linear-gradient(90deg, rgba(124,92,252,0.08) 0%, transparent 100%);
}

.person-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient);
  border-radius: 0 3px 3px 0;
}

.person-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.person-info { overflow: hidden; min-width: 0; }

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

.person-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.person-stats { text-align: right; flex-shrink: 0; }

.person-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.person-change {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.person-change.positive { color: var(--green); }
.person-change.negative { color: var(--red); }

/* Price flash animation on update */
.person-price.flash-green { animation: priceFlashGreen 0.8s ease; }
.person-price.flash-red { animation: priceFlashRed 0.8s ease; }

@keyframes priceFlashGreen {
  0% { background: rgba(0, 214, 143, 0.3); }
  100% { background: transparent; }
}
@keyframes priceFlashRed {
  0% { background: rgba(255, 77, 106, 0.3); }
  100% { background: transparent; }
}

/* ---------- Market Main ---------- */
.market-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-primary);
}

/* Person Header */
.person-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  flex-shrink: 0;
}

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

.person-header-empty svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
}

.person-header-empty p {
  font-size: 13px;
  max-width: 260px;
}

/* person-header-loaded is now a simple flex row (set inline via JS) */

.header-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.header-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-elevated);
}
.header-action-btn svg { flex-shrink: 0; }

.header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.header-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }

.header-info { flex: 1; min-width: 0; }

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

.header-ticker {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.header-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent-light);
  text-transform: capitalize;
}

.header-badge.sub {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* Metrics Pills */
.header-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.metric-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.metric-icon {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.header-disclaimer {
  width: 100%;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-style: italic;
}

/* Social Media Links */
.header-socials {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  transition: all var(--transition);
}

.social-link:hover { color: var(--text-primary); transform: translateY(-1px); }
.social-youtube:hover { color: #ff0000; background: rgba(255,0,0,0.1); }
.social-instagram:hover { color: #e4405f; background: rgba(228,64,95,0.1); }
.social-twitter:hover { color: #fff; background: rgba(255,255,255,0.1); }
.social-tiktok:hover { color: #00f2ea; background: rgba(0,242,234,0.1); }
.social-spotify:hover { color: #1db954; background: rgba(29,185,84,0.1); }

.header-price-block { text-align: left; }

.header-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.header-change {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

.header-stats {
  display: flex;
  gap: 24px;
  margin-top: 10px;
  flex-wrap: wrap;
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.header-stat { display: flex; flex-direction: column; gap: 3px; }

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Chart + Trade Layout ---------- */
#chart-trade-grid {
  display: grid;
  grid-template-columns: 1fr 260px 260px;
  gap: 4px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

/* Chart takes full height of left column */
#chart-trade-grid #chart-container {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
#chart-trade-grid #chart-canvas { flex: 1; min-height: 200px; }

/* Buy/Sell — middle column */
#chart-trade-grid .trade-panel {
  border: 1px solid var(--border); border-radius: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  order: 2;
  min-height: 0;
}

/* Order Book — right column */
#chart-trade-grid .orderbook-section {
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
  order: 3;
  min-height: 0;
}

/* Discussion — moved OUTSIDE grid, placed next to person header via JS */
#chart-trade-grid .comments-section { display: none !important; }

@media (max-width: 1000px) {
  #chart-trade-grid { grid-template-columns: 1fr 260px !important; }
  #chart-trade-grid .orderbook-section { display: none !important; }
}

@media (max-width: 768px) {
  #chart-trade-grid { grid-template-columns: 1fr !important; display: flex !important; flex-direction: column !important; }
  #chart-trade-grid .orderbook-section { display: none !important; }
  #chart-trade-grid .trade-panel { max-height: none; order: 2; }
  #chart-trade-grid #chart-container { order: 1; }
}

/* Discussion slide-out panel (right side) */
.discussion-panel {
  position: fixed;
  right: -360px;
  top: 0;
  bottom: 0;
  width: 350px;
  z-index: 900;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
}
.discussion-panel.disc-open {
  right: 0;
  box-shadow: -4px 0 24px rgba(0,0,0,0.5);
}

#discussion-toggle {
  display: none;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 901;
  width: 24px;
  height: 48px;
  border-radius: 8px 0 0 8px;
  border: 1px solid var(--border);
  border-right: none;
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  align-items: center;
  justify-content: center;
}
#discussion-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
body.trading-mode #discussion-toggle {
  display: flex;
}

#chart-container {
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-width: 0;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
  gap: 6px;
}

.chart-timeframes {
  display: flex;
  gap: 2px;
  align-items: center;
}

.tf-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.tf-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.tf-btn.active { color: var(--accent-light); background: var(--accent-dim); }

.chart-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.chart-tool-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  position: relative;
}
.chart-tool-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.chart-tool-btn.active { color: var(--accent-light); background: var(--accent-dim); border-color: var(--accent-dim); }
.chart-tool-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.chart-type-btns {
  display: flex;
  gap: 1px;
  margin-left: 6px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 1px;
}
.chart-type-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
}
.chart-type-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.chart-type-btn.active { color: var(--accent-light); background: var(--accent-dim); }

/* Indicators dropdown */
.indicators-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 0;
  min-width: 200px;
  z-index: 100;
  box-shadow: var(--shadow);
}
.indicators-dropdown.open { display: block; }
.ind-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.ind-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.ind-item .ind-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-light);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ind-item.active .ind-check {
  background: var(--accent);
  border-color: var(--accent);
}
.ind-item.active .ind-check::after {
  content: '✓';
  font-size: 9px;
  color: #fff;
}
.ind-item .ind-color {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.ind-section-title {
  padding: 4px 14px 2px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* MA legend overlay on chart */
.chart-ma-legend {
  position: absolute;
  top: 34px;
  left: 12px;
  z-index: 5;
  display: flex;
  gap: 12px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none;
}
.ma-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ma-legend-dot {
  width: 8px;
  height: 3px;
  border-radius: 2px;
}

.chart-price-info {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.chart-price-info span { display: flex; gap: 4px; }
.chart-price-info .label { color: var(--text-muted); font-weight: 500; }

/* Bottom chart toolbar */
.chart-bottom-bar {
  display: flex;
  align-items: center;
  padding: 2px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
  gap: 4px;
  min-height: 26px;
}
.chart-bottom-bar .cbb-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all var(--transition);
}
.chart-bottom-bar .cbb-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.chart-bottom-bar .cbb-btn.active { color: var(--accent-light); }
.chart-bottom-bar .cbb-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
}
.chart-bottom-bar .cbb-spacer { flex: 1; }
.chart-bottom-bar .cbb-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

#chart-canvas {
  width: 100%;
  flex: 1;
  min-height: 0;
  position: relative;
  transition: opacity 0.2s ease;
}

/* ---------- Trade Panel ---------- */
.trade-panel {
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
}

.trade-tabs { display: flex; flex-shrink: 0; }

.trade-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trade-tab.buy-tab.active  {
  color: var(--green);
  border-bottom-color: var(--green);
  background: var(--green-dim);
}
.trade-tab.sell-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
  background: var(--red-dim);
}
.trade-tab:hover:not(.active) { color: var(--text-primary); background: var(--bg-elevated); }

/* Order Type Tabs */
.order-type-tabs {
  display: flex;
  gap: 3px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.order-type-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.order-type-btn:hover { color: var(--text-primary); }
.order-type-btn.active {
  background: var(--bg-elevated);
  color: var(--accent-light);
}

.trade-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.trade-field { display: flex; flex-direction: column; gap: 4px; }
.trade-field label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 46px 8px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.input-suffix {
  position: absolute;
  right: 10px;
  font-size: 10px;
  color: var(--text-muted);
  pointer-events: none;
  font-weight: 600;
}

.trade-balance {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
}

.quick-qty {
  display: flex;
  gap: 4px;
}

.qty-preset {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 2px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.qty-preset:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-dim);
}

.trade-summary {
  background: var(--bg-primary);
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

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

.btn-small {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-small.btn-sell { background: var(--red); color: #fff; }
.btn-small.btn-sell:hover { filter: brightness(1.1); }
.btn-small.btn-buy { background: var(--green); color: #000; }
.btn-small.btn-buy:hover { filter: brightness(1.1); }

.summary-impact { font-size: 11px; font-weight: 600; }
.summary-impact.low { color: var(--green); }
.summary-impact.medium { color: #f6a609; }
.summary-impact.high { color: var(--red); }

#execute-trade-btn, .btn-trade {
  padding: 9px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.btn-buy { background: var(--green); color: #000; }
.btn-sell { background: var(--red); color: #fff; }
.btn-buy:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 16px rgba(0, 214, 143, 0.25); }
.btn-sell:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 4px 16px rgba(255, 77, 106, 0.25); }

#execute-trade-btn:disabled, .btn-trade:disabled {
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

/* ============================================================
   ORDER BOOK & RECENT TRADES
   ============================================================ */
.orderbook-section {
  background: var(--bg-secondary);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ob-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ob-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ob-tab:hover { color: var(--text-primary); }
.ob-tab.active { color: var(--accent-light); border-bottom: 2px solid var(--accent); }

.ob-content {
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ob-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
}

#ob-recent-trades .ob-header {
  grid-template-columns: 1fr 1fr 1fr;
}

.ob-spread {
  padding: 4px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.ob-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 2px 12px;
  font-size: 12px;
  transition: background 0.1s;
}

.ob-row:hover { background: var(--bg-elevated); }
.ob-row.ask .ob-price { color: var(--red); }
.ob-row.bid .ob-price { color: var(--green); }
.ob-row .ob-qty { text-align: right; color: var(--text-secondary); }

.ob-trade-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 2px 12px;
  font-size: 12px;
}

.ob-trade-row .ob-time { text-align: right; color: var(--text-muted); font-size: 11px; }

/* ============================================================
   COMMENTS SECTION
   ============================================================ */
.comments-section {
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  max-height: 300px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.comments-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.comments-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 10px;
}

.comment-input-wrap {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.comment-input-wrap input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
}

.comment-input-wrap input:focus { border-color: var(--accent); }
.comment-input-wrap input::placeholder { color: var(--text-muted); }

.btn-comment-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}

.btn-comment-submit:hover { opacity: 0.85; }

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.comment-item {
  padding: 8px 16px;
  display: flex;
  gap: 10px;
  transition: background 0.1s;
}

.comment-item:hover { background: rgba(28, 34, 48, 0.3); }

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

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

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin-bottom: 2px;
}

.comment-username { font-weight: 600; color: var(--accent-light); }
.comment-time { color: var(--text-muted); }
.comment-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; word-break: break-word; }

/* ============================================================
   CONTENT PAGES (Portfolio & Leaderboard)
   ============================================================ */
.content-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  width: 100%;
}

.page-header { margin-bottom: 24px; }

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

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

/* Summary Cards */
.portfolio-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition);
}

.summary-card:hover { border-color: var(--border-light); }

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

.card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Section Block */
.section-block { margin-top: 28px; }

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

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

.data-table thead tr { background: var(--bg-secondary); }

.data-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(37, 45, 61, 0.4);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(28, 34, 48, 0.5); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px !important;
  font-size: 14px;
}

/* Side Badge */
.side-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side-badge.buy  { background: var(--green-dim); color: var(--green); }
.side-badge.sell { background: var(--red-dim); color: var(--red); }

/* Trade Action Buttons in Table */
.btn-table-buy, .btn-table-sell {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-table-buy  { background: var(--green-dim); color: var(--green); }
.btn-table-sell { background: var(--red-dim); color: var(--red); margin-left: 4px; }
.btn-table-buy:hover  { background: var(--green); color: #000; }
.btn-table-sell:hover { background: var(--red); color: #fff; }

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.lb-filter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 18px;
  cursor: pointer;
  transition: all var(--transition);
}

.lb-filter:hover { color: var(--text-primary); border-color: var(--border-light); }
.lb-filter.active {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Rank Badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
}

.rank-1 { background: linear-gradient(135deg, #ffd700, #f0b90b); color: #000; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.rank-2 { background: linear-gradient(135deg, #c0c0c0, #a8b2b8); color: #000; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #a0522d); color: #fff; }
.rank-other { background: var(--bg-elevated); color: var(--text-secondary); }

/* ============================================================
   AUTH MODAL
   ============================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.modal-box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 36px;
  box-shadow: var(--shadow-lg), var(--glow);
  z-index: 1;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { transform: scale(0.95) translateY(-10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

.modal-logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.modal-logo .accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* Social Login Buttons */
.social-login-section {
  margin-bottom: 12px;
}

.social-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.social-btn svg, .social-btn img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.social-btn-google {
  background: #fff;
  color: #333;
  opacity: 0.5;
  cursor: default;
  position: relative;
}
.social-btn-google::after { content: ' (coming soon)'; font-size: 11px; color: #999; }
.social-btn-google:hover { background: #f5f5f5; }

.social-btn-apple {
  background: #000;
  color: #fff;
  border-color: #333;
  opacity: 0.5;
  cursor: default;
  position: relative;
}
.social-btn-apple::after { content: ' (coming soon)'; font-size: 11px; color: #666; }
.social-btn-apple:hover { background: #1a1a1a; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Form Fields */
.form-field { margin-bottom: 16px; }

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-field input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.form-field input::placeholder { color: var(--text-muted); }
.form-field input.error { border-color: var(--red); }

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input { padding-right: 44px; }

.toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.toggle-password:hover { color: var(--text-primary); }
.toggle-password svg { width: 16px; height: 16px; }

.form-error {
  color: var(--red);
  font-size: 12px;
  margin-bottom: 12px;
  min-height: 16px;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 20px;
}

/* Button Spinner */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ============================================================
   MOBILE ELEMENTS (hidden on desktop)
   ============================================================ */
.mobile-market-tabs { display: none; }
.mobile-back-btn { display: none; }

/* ============================================================
   LOADING STATES
   ============================================================ */
.loading-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 8px 20px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

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

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 10px;
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--text-secondary); }

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border-color var(--transition);
}

.settings-card:hover { border-color: var(--border-light); }

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.settings-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.settings-card p {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-settings {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.btn-settings:hover:not(:disabled) { opacity: 0.85; }
.btn-settings:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-settings-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-settings-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 77, 106, 0.2);
}

.btn-settings-danger:hover:not(:disabled) { background: var(--red); color: #fff; opacity: 1; }

/* ============================================================
   TREND INDICATOR
   ============================================================ */
.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.trend-indicator::before {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
}

.trend-indicator.down::before {
  border-bottom: none;
  border-top: 5px solid currentColor;
}

/* ============================================================
   RESPONSIVE — Tablet (<=900px)
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-width: 260px; }
  .cat-tab { font-size: 10px; padding: 3px 8px; }

  .nav-links { gap: 0; }
  .nav-link  { padding: 6px 10px; font-size: 13px; }
  .username-text { display: none; }
}

/* ============================================================
   RESPONSIVE — Mobile (<=768px)
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --nav-height: 50px;
    --sidebar-width: 100%;
  }

  /* CRITICAL: prevent any horizontal overflow on mobile */
  html, body { overflow-x: clip !important; width: 100vw !important; }
  #topbar, .market-layout, .site-footer, .legal-bar, #risk-banner, #ticker-tape {
    max-width: 100vw !important; overflow-x: hidden !important;
  }

  #topbar { padding: 0 10px; gap: 8px; }
  .logo { font-size: 16px; }
  .nav-left { gap: 12px; }
  /* MOBILE NAV: only show Market + Portfolio */
  .nav-links { gap: 0; }
  .nav-link { padding: 4px 6px; font-size: 11px; font-weight: 600; white-space: nowrap; }
  .nav-link[href="/news.html"],
  .nav-link[href="/token.html"],
  .nav-link[href="/roadmap.html"],
  .nav-link[href="/how-to-start.html"],
  .nav-link[data-view="leaderboard"] { display: none !important; }
  .nav-link[data-view="portfolio"] { display: none !important; }
  .nav-link[data-view="market"] { display: none !important; }

  /* Mobile Bottom Tab Bar */
  #mobile-tabbar {
    display: flex !important;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 58px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #mobile-tabbar .mtab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
    transition: color var(--transition);
  }
  #mobile-tabbar .mtab svg { width: 20px; height: 20px; }
  #mobile-tabbar .mtab.active { color: var(--accent-light); }
  #mobile-tabbar .mtab.active svg { stroke: var(--accent); }

  /* Reserve space above tabbar so content isn't covered */
  body { padding-bottom: 58px; }
  .market-layout { height: calc(100dvh - var(--nav-height) - 58px) !important; }
  .site-footer, .legal-bar { margin-bottom: 58px; }

  /* Mobile More Sheet */
  .mobile-more-sheet { position: fixed; inset: 0; z-index: 1000; }
  .mobile-more-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
  .mobile-more-panel {
    position: absolute; left: 0; right: 0; bottom: 58px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 12px 0 8px;
    animation: slideUp 0.2s ease-out;
  }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .mobile-more-header { padding: 4px 18px 10px; font-size: 11px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 1px; }
  .mobile-more-item {
    display: block;
    padding: 14px 18px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-top: 1px solid var(--border);
  }
  .mobile-more-close {
    display: block; width: calc(100% - 24px); margin: 10px 12px 4px;
    padding: 12px; background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-primary); border-radius: 8px; font-weight: 600; cursor: pointer;
  }
}
@media (min-width: 769px) {
  #mobile-tabbar { display: none !important; }
  .mobile-more-sheet { display: none !important; }
}
@media (max-width: 768px) {

  /* Compact wallet/login on mobile */
  .wallet-btn { padding: 5px 10px !important; font-size: 10px !important; }
  #auth-btn { padding: 5px 12px !important; font-size: 11px !important; }
  #auth-login-btn { padding: 4px 8px !important; font-size: 10px !important; }
  #deposit-nav-btn { display: none !important; }

  .balance-info { display: none !important; }
  .username-text { display: none; }
  .user-section { gap: 6px; }

  /* Hide deposit button on mobile, keep wallet connect compact */
  .wallet-btn { padding: 5px 10px; font-size: 10px; }
  .wallet-btn:first-of-type { display: none; } /* Hide deposit/withdraw on mobile navbar */

  /* Risk banner compact on mobile */
  #risk-banner { font-size: 10px; padding: 4px 10px; flex-wrap: wrap; }
  #risk-banner svg { display: none; }

  .btn-primary { padding: 6px 14px; font-size: 13px; }
  .user-avatar { width: 28px; height: 28px; font-size: 11px; }

  /* Mobile Market Layout: Tabbed */
  .market-layout {
    flex-direction: column;
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height));
    overflow: hidden;
  }

  .mobile-market-tabs {
    display: flex !important;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .mobile-market-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
  }

  .mobile-market-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
  }

  .market-sidebar {
    width: 100%;
    flex: 1;
    border-right: none;
    min-height: 0;
  }

  .market-sidebar.mobile-hidden { display: none; }

  .market-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: none;
  }

  .market-main.mobile-visible { display: flex; }

  .mobile-back-btn {
    display: flex !important;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--accent-light);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    width: 100%;
  }

  .mobile-back-btn svg { width: 16px; height: 16px; }

  .sidebar-search { padding: 8px 10px; }

  #search-input {
    padding: 10px 12px 10px 34px;
    font-size: 16px;
  }

  .search-icon { left: 18px; }

  .category-tabs { padding: 6px 8px; }
  .cat-tab { padding: 6px 12px; font-size: 12px; }

  .person-item { padding: 12px; gap: 10px; }
  .person-avatar { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
  .person-ticker { font-size: 14px; }
  .person-name { font-size: 11px; }
  .person-price { font-size: 14px; }
  .person-change { font-size: 12px; }
  .sidebar-list-header { padding: 6px 12px; font-size: 10px; }

  .person-header { padding: 12px 16px; }
  .header-avatar { width: 36px; height: 36px; font-size: 14px; border-radius: 10px; }
  .header-name { font-size: 15px; }
  .header-price { font-size: 20px; }
  .header-change { font-size: 12px; }
  .header-stats { gap: 12px; margin-top: 8px; padding-top: 8px; }
  .stat-label { font-size: 9px; }
  .stat-value { font-size: 12px; }

  body.trading-mode .market-main {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 120px !important;
  }
  #chart-trade-grid {
    flex: none !important;
    min-height: auto !important;
    height: auto !important;
  }
  /* Sidebar toggle bigger on mobile */
  #sidebar-toggle {
    width: 32px !important;
    height: 56px !important;
    font-size: 18px !important;
    z-index: 950 !important;
  }
  /* Sidebar overlay above tabbar */
  .sidebar-overlay { z-index: 940 !important; }
  body.trading-mode .market-sidebar { z-index: 945 !important; }
  /* Mobile header: hide metrics row, keep compact */
  .person-header { padding: 8px 12px !important; }
  .person-header-loaded { gap: 2px !important; }
  .header-action-btn { width: 24px; height: 20px; }
  .metric-pill { display: none !important; }

  /* Mobile chart: smaller */
  #chart-container { flex-shrink: 0; }
  #chart-canvas { height: 220px !important; flex: none !important; }
  .chart-toolbar { padding: 4px 8px; flex-wrap: wrap; gap: 2px; }
  .chart-tools { display: none; }
  .chart-bottom-bar { display: none; }
  .chart-ma-legend { display: none; }
  .tf-btn { padding: 3px 6px; font-size: 10px; }
  .chart-type-btns { display: none; }
  #chart-fullscreen-btn { display: none; }
  #btn-screenshot { display: none; }

  /* Mobile trade panel: full width, visible */
  .trade-panel { border-top: 1px solid var(--border); margin: 0; border-radius: 0; }
  .trade-tab { padding: 10px; font-size: 14px; }
  .trade-body { padding: 10px 12px; flex-direction: column; gap: 8px; }
  .trade-field label { font-size: 12px; }
  .input-wrap input { padding: 10px 46px 10px 12px !important; font-size: 16px !important; }
  .quick-qty { gap: 6px; }
  .qty-preset { padding: 8px; font-size: 12px; }
  .trade-summary { margin-top: 4px; }
  .summary-row { font-size: 11px; padding: 3px 0; }
  #execute-trade-btn { padding: 14px; font-size: 16px; }

  .content-page { padding: 12px 10px 32px; }
  .page-title { font-size: 18px; }
  .page-subtitle { font-size: 12px; }
  .portfolio-summary-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .summary-card { padding: 12px; }
  .card-label { font-size: 10px; }
  .card-value { font-size: 16px; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -10px; padding: 0 10px; }
  .data-table { font-size: 12px; min-width: 600px; }
  .data-table th, .data-table td { padding: 8px 6px; white-space: nowrap; }

  .leaderboard-filters { gap: 4px; flex-wrap: wrap; }
  .lb-filter { padding: 6px 14px; font-size: 12px; }

  .modal-box { margin: 12px; padding: 24px 16px; max-height: 90dvh; overflow-y: auto; }
  .modal-logo { font-size: 16px; }
  .modal-title { font-size: 18px; }
  .btn-full { padding: 14px; font-size: 15px; }
  .form-field input { padding: 12px; font-size: 16px; }
  /* iOS zoom prevention: all inputs/selects/textareas min 16px on mobile */
  .modal-box input, .modal-box select, .modal-box textarea { font-size: 16px !important; }
  .modal-close { padding: 8px 12px !important; min-width: 44px; min-height: 44px; }

  #toast-container { top: calc(var(--nav-height) + 8px); right: 10px; left: 10px; }
  .toast { min-width: auto; max-width: none; }

  /* Notification & user dropdowns — position:fixed to escape #topbar overflow:hidden clipping */
  .notif-dropdown,
  .user-dropdown {
    position: fixed !important;
    top: calc(var(--nav-height) + 6px) !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    min-width: 0 !important;
    max-height: calc(100dvh - var(--nav-height) - 80px);
    overflow-y: auto;
    z-index: 950;
    padding-top: 0 !important;
  }

  /* Stat labels readable */
  .stat-label { font-size: 10px !important; }

  /* Hide newsletter on mobile — takes too much space */
  #newsletter-section { display: none !important; }

  /* Compact footer on mobile */
  .site-footer { padding: 8px 12px; font-size: 10px; }
  .footer-inner { flex-direction: column; text-align: center; gap: 4px; }
  .footer-brand { flex-direction: column; gap: 4px; }
  .footer-logo { font-size: 13px !important; }
  .footer-links { flex-wrap: wrap; justify-content: center; gap: 8px !important; }
  .footer-links a { font-size: 10px !important; min-height: 32px; display: inline-flex; align-items: center; }

  /* Compact legal bar on mobile */
  .legal-bar { padding: 10px 12px !important; }
  .legal-bar p { font-size: 10px !important; margin-bottom: 6px !important; }
  .legal-bar a { font-size: 11px !important; }

  /* Risk banner: more compact + easier to dismiss */
  #risk-banner { padding: 6px 12px; }
  #risk-banner .dismiss-risk { padding: 4px 12px !important; font-size: 11px !important; }

  /* Ticker tape on mobile */
  #ticker-tape { height: 24px; font-size: 10px; }

  /* Daily challenge cards stack */
  #challenge-picks { flex-direction: column; }

  /* Collections scroll horizontally */
  #collections-container { overflow-x: auto; }

  /* Activity feed smaller */
  #activity-feed { max-height: 120px; font-size: 10px; }

  /* Subcategory tabs: smaller on mobile */
  #subcategory-tabs .cat-tab { font-size: 10px !important; padding: 3px 8px !important; }

  /* Gainers/Losers grid: single column on mobile */
  #gainers-losers-grid { grid-template-columns: 1fr !important; gap: 12px !important; }

  /* Market overview: compact on mobile */
  .person-header-empty { padding: 8px !important; }
  .person-header-empty div[style*="max-width:900px"] { padding: 4px 0 !important; }
  .person-header-empty div[style*="font-size:20px"] { font-size: 16px !important; }
  .person-header-empty div[style*="gap:16px"] { gap: 8px !important; font-size: 11px !important; }

  /* Hide less important sections on mobile to reduce scroll */
  #collections-container { display: none !important; }
  #rivalries-container { display: none !important; }
  #how-to-start { grid-template-columns: 1fr !important; }
  #new-listings-container { display: none !important; }

  /* Legal bar compact */
  .legal-bar { padding: 12px !important; }
  .legal-bar div { gap: 12px !important; }
  .legal-bar a { font-size: 11px !important; }

  /* Leverage panel compact */
  #leverage-panel .trade-summary { font-size: 11px; }

  /* How to start stack */
  #how-to-start { grid-template-columns: 1fr !important; }

  /* Touch targets */
  .cat-tab { min-height: 36px; padding: 6px 12px; }
  .tf-btn { min-height: 36px; padding: 6px 10px; }
  .order-type-btn { min-height: 36px; }
  .qty-preset { min-height: 36px; min-width: 44px; }
}

/* Extra small (<=400px) */
@media (max-width: 400px) {
  .nav-link { padding: 4px 6px; font-size: 10px; }
  .logo { font-size: 14px; }
  .portfolio-summary-cards { grid-template-columns: 1fr; }
  .header-price { font-size: 16px; }
  .person-header-loaded { grid-template-columns: 1fr !important; }
  .header-price-block { text-align: left; }
  /* Hide Login button on tiny screens — Sign Up is enough (modal has Sign In link) */
  #auth-login-btn { display: none !important; }
}

/* ============================================================
   Toporio Plus — Crown sitewide (2026-04-14)
   Apply .plus-user class to any username element to render the
   golden crown. Set from JS after fetching /api/user/me or via
   leaderboard API response that includes the `is_premium` flag.
   IRON RULE: do NOT hide the crown in settings-only — it must
   appear everywhere a Plus user is visible or the status pillar
   tanks conversion. See project_monetization_implementation_plan.md.
   ============================================================ */
.plus-user {
  position: relative;
  color: #FFD700 !important;
  font-weight: 600;
}
.plus-user::after {
  content: "👑";
  display: inline-block;
  margin-left: 4px;
  font-size: 0.9em;
  vertical-align: baseline;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.35));
}
/* Smaller crown inside tight spaces (recent trades, order book) */
.compact .plus-user::after,
.ob-row .plus-user::after,
.recent-trades-list .plus-user::after {
  font-size: 0.8em;
  margin-left: 2px;
}
