/* Account drawer + account page — cosmic theme */

body.account-active .site-footer {
  position: relative;
  z-index: 120;
  background: rgba(0, 0, 0, 0.85);
  border-top: 1px solid rgba(45, 212, 191, 0.12);
}

body.account-active .site-footer a {
  color: rgba(203, 213, 225, 0.75);
}

#account-view {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
}

#account-view.hidden {
  display: none !important;
}

/* Sidebar user trigger */
.sidebar-user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.sidebar-user-trigger:hover {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.06);
  box-shadow: 0 2px 12px rgba(45, 212, 191, 0.08);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  flex-shrink: 0;
  background: linear-gradient(135deg, #2dd4bf, #3b82f6);
}

.sidebar-user-meta {
  flex: 1;
  min-width: 0;
}

.sidebar-user-meta .sidebar-username {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-user-credits {
  color: var(--accent);
  font-weight: 700;
}

.sidebar-user-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.7;
}

.sidebar-footer {
  padding: 10px 12px 14px;
}

.sidebar-footer .membership-badge {
  font-size: 9px;
  padding: 1px 6px;
  margin-left: 0;
}

/* Account drawer */
.ac-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.ac-drawer:not(.hidden) {
  pointer-events: auto;
}

.ac-drawer.hidden {
  display: none !important;
}

.ac-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s;
}

.ac-drawer:not(.hidden) .ac-drawer-backdrop {
  opacity: 1;
}

.ac-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100%;
  padding: 20px 18px 24px;
  background: linear-gradient(180deg, #121a24 0%, #0a1018 100%);
  border-left: 1px solid rgba(45, 212, 191, 0.15);
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.45);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ac-drawer-panel::-webkit-scrollbar {
  display: none;
}

.ac-drawer:not(.hidden) .ac-drawer-panel {
  transform: translateX(0);
}

.ac-drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
}

.ac-drawer-close:hover {
  color: #f1f5f9;
}

.ac-drawer-profile {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  padding-right: 28px;
}

.ac-drawer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  flex-shrink: 0;
  border: 2px solid rgba(45, 212, 191, 0.35);
}

.ac-drawer-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ac-drawer-name {
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
}

.ac-copy-btn {
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
}

.ac-copy-btn:hover {
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.35);
}

.ac-drawer-id,
.ac-drawer-contact {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.ac-drawer-vip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
  border-radius: 12px;
  color: #0f172a;
}

.ac-drawer-vip.tier-none {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.25) 0%, rgba(59, 130, 246, 0.2) 100%);
  color: #e2e8f0;
  border: 1px solid rgba(45, 212, 191, 0.25);
}

.ac-drawer-vip-text {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ac-drawer-vip-text strong {
  display: block;
  font-size: 14px;
}

.ac-drawer-vip-text small {
  display: block;
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.ac-drawer-vip-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: #0f172a;
  color: #84cc16;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ac-drawer-vip.tier-none .ac-drawer-vip-btn {
  background: #2dd4bf;
  color: #0f172a;
}

.ac-drawer-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.ac-drawer-balance-label {
  display: block;
  font-size: 12px;
  color: #64748b;
}

.ac-drawer-balance-value {
  font-size: 26px;
  font-weight: 800;
  color: #fbbf24;
  font-family: Orbitron, sans-serif;
}

.ac-drawer-recharge-btn {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: transparent;
  color: #e2e8f0;
  font-size: 13px;
  cursor: pointer;
}

.ac-drawer-recharge-btn:hover {
  border-color: #2dd4bf;
  color: #2dd4bf;
}

.ac-drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.ac-drawer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ac-drawer-item:hover {
  border-color: rgba(45, 212, 191, 0.3);
  background: rgba(45, 212, 191, 0.06);
  color: #f1f5f9;
}

.ac-drawer-item-icon {
  font-size: 22px;
}

.ac-drawer-logout {
  width: 100%;
  padding: 12px;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
}

.ac-drawer-logout:hover {
  color: #f87171;
}

/* Account page */
.ac-page {
  position: relative;
  height: 100%;
  background: #000;
  color: #f8fafc;
}

.ac-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.ac-planet-video {
  position: absolute;
  object-fit: cover;
  pointer-events: none;
}

.ac-planet-video-hero {
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.48;
  animation: auth-hero-drift 30s ease-in-out infinite alternate;
}

.ac-planet-video-1 {
  width: min(260px, 32vw);
  height: min(260px, 32vw);
  right: -4%;
  bottom: 10%;
  border-radius: 50%;
  border: 2px solid rgba(45, 212, 191, 0.2);
  opacity: 0.8;
  animation: auth-planet-float 14s ease-in-out infinite;
}

.ac-bg-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 0%, rgba(0, 0, 0, 0.45) 55%, rgba(0, 0, 0, 0.9) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 25%, rgba(0, 0, 0, 0.85) 100%);
}

.ac-scroll {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px 48px;
  max-width: 920px;
  margin: 0 auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ac-scroll::-webkit-scrollbar {
  display: none;
}

.ac-header {
  margin-bottom: 24px;
}

.ac-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px 8px 10px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 14px;
  cursor: pointer;
}

.ac-back-btn:hover {
  background: rgba(45, 212, 191, 0.1);
  color: #2dd4bf;
}

.ac-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
}

.ac-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ac-tab {
  padding: 8px 20px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ac-tab.active {
  background: rgba(45, 212, 191, 0.15);
  color: #2dd4bf;
}

.ac-tab-panel.hidden {
  display: none !important;
}

.ac-hero-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 24px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(45, 212, 191, 0.18);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}

.ac-hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  border: 2px solid rgba(45, 212, 191, 0.35);
}

.ac-hero-info h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0 4px;
}

.ac-hero-contact {
  font-size: 13px;
  color: #64748b;
}

.ac-hero-bio {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 8px;
  line-height: 1.5;
}

.ac-hero-stats {
  text-align: right;
}

.ac-stat {
  margin-bottom: 10px;
}

.ac-stat-label {
  display: block;
  font-size: 11px;
  color: #64748b;
}

.ac-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
}

.ac-stat-value.accent,
.ac-stat-value.accent.accent {
  color: #2dd4bf;
}

.ac-hero-recharge {
  margin-top: 8px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ac-card,
.ac-settings-card {
  padding: 20px 22px;
  margin-bottom: 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
}

.ac-card h3,
.ac-settings-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: #f1f5f9;
}

.ac-card-note {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 12px;
}

.ac-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.ac-info-item {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  font-size: 12px;
  color: #64748b;
}

.ac-info-item strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: #e2e8f0;
  font-weight: 600;
  word-break: break-all;
}

.ac-pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ac-pricing-grid h4 {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.ac-pricing-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ac-pricing-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #94a3b8;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ac-pricing-list li:last-child {
  border-bottom: none;
}

.ac-pricing-list strong {
  color: #2dd4bf;
  font-weight: 600;
}

.ac-history .history-table-wrap {
  overflow-x: auto;
  scrollbar-width: none;
}

.ac-history .history-table-wrap::-webkit-scrollbar {
  display: none;
}

.ac-history .history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ac-history .history-table th {
  text-align: left;
  padding: 10px 12px;
  color: #64748b;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ac-history .history-table td {
  padding: 10px 12px;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ac-history .positive { color: #2dd4bf; font-weight: 600; }
.ac-history .negative { color: #f87171; font-weight: 600; }

.ac-history .empty-hint {
  text-align: center;
  padding: 32px;
  color: #64748b;
  font-size: 14px;
}

/* Settings */
.ac-settings-avatar,
.ac-drawer-avatar,
.ac-hero-avatar,
.sidebar-user-avatar {
  overflow: hidden;
}

.ac-settings-avatar.has-image,
.ac-drawer-avatar.has-image,
.ac-hero-avatar.has-image,
.sidebar-user-avatar.has-image {
  padding: 0;
  color: transparent;
}

.ac-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.ac-avatar-picker-wrap {
  flex: 1;
  min-width: 0;
}

.ac-avatar-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ac-upload-hint {
  font-size: 12px;
  color: #64748b;
}

.ac-avatar-picker-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}

.ac-settings-avatar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.ac-settings-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  border: 2px solid rgba(45, 212, 191, 0.35);
}

.ac-avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ac-avatar-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.15s, border-color 0.15s;
}

.ac-avatar-option:hover {
  transform: scale(1.08);
}

.ac-avatar-option.active {
  border-color: #2dd4bf;
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.25);
}

.ac-settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ac-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #94a3b8;
}

.ac-field input,
.ac-field textarea {
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #f1f5f9;
  font-size: 14px;
  font-family: inherit;
}

.ac-field input:focus,
.ac-field textarea:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.45);
}

.ac-field input[readonly] {
  color: #64748b;
}

.ac-field-copy {
  display: flex;
  gap: 8px;
}

.ac-field-copy input {
  flex: 1;
}

.ac-save-btn {
  align-self: flex-start;
  padding: 12px 28px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.ac-save-btn:hover {
  filter: brightness(1.05);
}

.ac-form-msg {
  font-size: 13px;
}

.ac-form-msg.success { color: #2dd4bf; }
.ac-form-msg.error { color: #f87171; }

.ac-security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ac-security-row:last-child {
  border-bottom: none;
}

.ac-outline-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
}

.ac-outline-btn:hover:not(:disabled) {
  border-color: #2dd4bf;
  color: #2dd4bf;
}

.ac-outline-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ac-wechat-bind {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ac-wechat-bind .jm-pay-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #07c160;
  flex-shrink: 0;
}

.ac-logout-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 12px;
  background: rgba(248, 113, 113, 0.08);
  color: #f87171;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.ac-logout-btn:hover {
  background: rgba(248, 113, 113, 0.15);
}

/* Tier pills on dark bg */
#account-view .tier-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

#account-view .tier-pill.tier-standard {
  background: rgba(45, 212, 191, 0.15);
  color: #2dd4bf;
}

#account-view .tier-pill.tier-pro {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

#account-view .tier-pill.tier-ultimate {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

@media (max-width: 768px) {
  .ac-hero-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .ac-hero-avatar {
    margin: 0 auto;
  }

  .ac-hero-stats {
    text-align: center;
  }

  .ac-pricing-grid {
    grid-template-columns: 1fr;
  }

  .ac-scroll {
    padding: 16px 16px 40px;
  }
}
