/* ui.css — modals, top-bar, theme, profile dropdown */

/* ── Light theme ── */
body.theme-light {
  --bg:#f1f5f9;--surface:#fff;--panel:#f8fafc;--border:#e2e8f0;
  --text:#1e293b;--muted:#64748b;--accent:#3b82f6;--nour:#0891b2;
  --green:#059669;--red:#dc2626;--gold:#d97706;--purple:#7c3aed;
}
body.theme-light .bubble.ai   { background:#f8fafc; border-color:#e2e8f0; color:#1e293b; }
body.theme-light .bubble.usr  { background:var(--accent); color:#fff; }
body.theme-light #chat-input  { color:#1e293b; }
body.theme-light #chat-input::placeholder { color:#94a3b8; }
body.theme-light .auth-tab    { color:#64748b; }
body.theme-light .auth-tab.active { color:#fff; }

/* ── Top bar ── */
.top-bar {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
}
[dir="rtl"] .top-bar { left: 12px; right: auto; }
[dir="ltr"] .top-bar { right: 12px; left: auto; }

.signup-topbtn {
  padding: 6px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-family: var(--font-ar);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.signup-topbtn:hover { background: #2563eb; transform: translateY(-1px); }
.guest-settings-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; font-size: 16px; display: flex;
  align-items: center; justify-content: center;
  transition: all .18s;
}
.guest-settings-btn:hover { border-color: var(--accent); transform: translateY(-1px); }

.user-topbtn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font-ar);
  font-size: 13px;
  color: var(--text);
  transition: all .18s;
}
.user-topbtn:hover { border-color: var(--accent); }
.top-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border);
}
.top-chevron { font-size: 11px; color: var(--muted); }

/* ── Profile dropdown ── */
.profile-dropdown {
  position: fixed;
  top: 52px;
  left: 12px;
  z-index: 400;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  min-width: 200px;
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  display: none;
  animation: tIn .18s ease;
}
[dir="ltr"] .profile-dropdown { right: 12px; left: auto; }
.profile-dropdown.open { display: block; }
.pd-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 8px;
}
.pd-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--border); object-fit: cover;
}
.pd-name     { font-size: 13px; font-weight: 700; color: var(--text); }
.pd-username { font-size: 11px; color: var(--muted); }
.pd-divider  { height: 1px; background: var(--border); margin: 4px 0; }
.pd-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 12px;
  background: transparent; border: none;
  color: var(--text); font-family: var(--font-ar);
  font-size: 13px; cursor: pointer; border-radius: 8px;
  text-align: right; transition: background .13s;
}
.pd-item:hover { background: var(--panel); }
.pd-logout { color: var(--red); }

/* ── Modal veil ── */
.modal-veil {
  display: none;
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,.65);
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-veil.open { display: flex; }

/* ── Auth modal box ── */
.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 24px 20px;
  width: 100%; max-width: 400px;
  position: relative;
  animation: tIn .22s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute; top: 14px; left: 14px;
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%; width: 32px; height: 32px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; z-index: 10;
  transition: background .15s;
}
[dir="ltr"] .modal-close { left: auto; right: 14px; }
.modal-close:hover { background: rgba(0,0,0,.7); color: #fff; }
.theme-light .modal-close { background: rgba(255,255,255,.8); color: #333; border-color: #ddd; }
.theme-light .modal-close:hover { background: rgba(255,255,255,1); }
.modal-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  text-align: center; margin-bottom: 18px;
}

/* auth form fields */
.modal-veil .field-group { margin-bottom: 12px; }
.modal-veil .field-group label {
  display: block; font-size: 11px; color: var(--muted);
  margin-bottom: 5px; font-family: var(--font-mono);
}
.modal-veil input[type=text],
.modal-veil input[type=email],
.modal-veil input[type=password],
.modal-veil input[type=date],
.modal-veil select {
  width: 100%; background: var(--panel); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 9px;
  padding: 9px 12px; font-family: var(--font-ar); font-size: 13.5px;
  outline: none; transition: border-color .2s;
}
.modal-veil input:focus,
.modal-veil select:focus { border-color: var(--accent); }
.modal-veil input::placeholder { color: var(--muted); }
.modal-veil .auth-btn {
  width: 100%; padding: 11px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 10px;
  font-family: var(--font-ar); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .18s; margin-top: 4px;
}
.modal-veil .auth-btn:hover { background: #2563eb; }
.modal-veil .auth-btn.google-btn {
  background: var(--panel); color: var(--text);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.modal-veil .auth-btn.google-btn:hover { border-color: var(--accent); background: var(--panel); }
.auth-or {
  text-align: center; margin: 10px 0; position: relative;
  color: var(--muted); font-size: 12px;
}
.auth-or::before, .auth-or::after {
  content: ''; position: absolute; top: 50%; width: 42%; height: 1px;
  background: var(--border);
}
.auth-or::before { right: 0; }
.auth-or::after  { left: 0; }
.auth-sub  { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.auth-logo { text-align: center; font-size: 16px; font-weight: 700; color: var(--nour); margin-bottom: 4px; }
.auth-switch { text-align: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.auth-switch a { color: var(--accent); cursor: pointer; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-left: 36px; }
[dir="ltr"] .pass-wrap input { padding-left: 12px; padding-right: 36px; }
.pass-eye {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 15px; color: var(--muted);
}
[dir="ltr"] .pass-eye { left: auto; right: 8px; }
.remember-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; margin-bottom: 10px;
}
.fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.req { color: var(--red); }
.field-hint { font-size: 10.5px; color: var(--muted); margin-top: 3px; display: block; }

/* ── Setup modal ── */
.setup-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 24px 20px;
  width: 100%; max-width: 440px;
  animation: tIn .22s ease;
  max-height: 90vh; overflow-y: auto;
}
.setup-header { text-align: center; margin-bottom: 22px; }
.setup-logo { font-size: 28px; margin-bottom: 6px; }
.setup-header h2 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.setup-header p  { font-size: 12px; color: var(--muted); }
.setup-steps     { min-height: 220px; }
.setup-step      { display: none; text-align: center; }
.setup-step.active { display: block; animation: tIn .2s ease; }
.step-icon       { font-size: 36px; margin-bottom: 10px; }
.setup-step h3   { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.step-sub        { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.setup-input {
  width: 100%; background: var(--panel); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 9px;
  padding: 10px 13px; font-family: var(--font-ar); font-size: 14px;
  outline: none; text-align: center; margin-bottom: 12px;
}
.setup-input:focus { border-color: var(--accent); }
.setup-next-btn {
  width: 100%; padding: 10px; background: var(--accent); color: #fff;
  border: none; border-radius: 10px; font-family: var(--font-ar);
  font-size: 14px; font-weight: 700; cursor: pointer; margin-bottom: 8px;
}
.setup-next-btn:hover { background: #2563eb; }
.setup-back-btn {
  width: 100%; padding: 8px; background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: var(--font-ar); font-size: 13px; cursor: pointer;
}
.grade-pills {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 14px;
}
.grade-pill {
  background: var(--panel); border: 1.5px solid var(--border);
  border-radius: 9px; padding: 9px 4px; text-align: center;
  font-size: 12px; cursor: pointer; color: var(--muted); transition: all .15s;
}
.grade-pill:hover  { border-color: var(--accent); color: var(--text); }
.grade-pill.selected { border-color: var(--accent); background: rgba(59,130,246,.1); color: var(--accent); font-weight: 700; }
.grade-pill.grade-locked { opacity: 0.4; cursor: not-allowed; border-style: dashed; pointer-events: auto; }
.grade-pill.grade-locked:hover { border-color: var(--border); color: var(--muted); }
.referral-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.referral-opt {
  background: var(--panel); border: 1.5px solid var(--border);
  border-radius: 9px; padding: 10px 6px; text-align: center;
  font-size: 12px; cursor: pointer; color: var(--muted); transition: all .15s;
}
.referral-opt:hover   { border-color: var(--accent); }
.referral-opt.selected { border-color: var(--accent); background: rgba(59,130,246,.1); color: var(--accent); }
.birth-selects {
  display: flex; gap: 8px; margin-bottom: 14px; direction: ltr;
}
.birth-select {
  flex: 1; background: var(--panel); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 8px; font-family: var(--font-ar); font-size: 14px;
  cursor: pointer; outline: none; appearance: none;
  -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 8px center;
  text-align: center;
  transition: border-color .2s;
}
.birth-select:focus { border-color: var(--accent); }
.birth-select option { background: var(--surface); color: var(--text); }

.setup-dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: all .25s;
}
.dot.active { background: var(--accent); transform: scale(1.2); }

/* ── Profile modal ── */
.profile-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 24px 20px;
  width: 100%; max-width: 440px;
  position: relative; max-height: 90vh; overflow-y: auto;
  animation: tIn .22s ease;
}
.profile-avatar-section { text-align: center; margin-bottom: 18px; }
.profile-avatar-wrap { position: relative; display: inline-block; }
.profile-big-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  border: 3px solid var(--border); display: block;
}
.avatar-change-btn {
  position: absolute; bottom: -4px; right: -4px;
  width: 26px; height: 26px; background: var(--accent);
  border: none; border-radius: 50%; color: #fff; font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ap-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; text-align: center; }
.avatar-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 8px; }
.av-opt {
  width: 100%; border-radius: 50%; border: 2.5px solid var(--border);
  cursor: pointer; transition: border-color .15s; aspect-ratio: 1;
}
.av-opt:hover,.av-opt.selected { border-color: var(--accent); }
.profile-fields { display: flex; flex-direction: column; gap: 14px; }
.pf-row label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; font-family: var(--font-mono); letter-spacing: 1px; }
.pf-row small  { font-size: 10.5px; color: var(--muted); margin-top: 3px; display: block; }
.pf-val { font-size: 14px; color: var(--text); padding: 8px 0; }
.pf-val.locked { color: var(--muted); }
.pf-editable { display: flex; gap: 8px; align-items: center; }
.pf-editable input, .pf-select {
  flex: 1; background: var(--panel); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 11px; font-family: var(--font-ar); font-size: 13px; outline: none;
}
.pf-editable input:focus, .pf-select:focus { border-color: var(--accent); }
.pf-save-btn {
  padding: 8px 14px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-family: var(--font-ar);
  font-size: 12px; cursor: pointer; white-space: nowrap;
}
.pass-change-form { display: flex; flex-direction: column; gap: 7px; }

/* ── Settings modal ── */
.settings-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 24px 20px;
  width: 100%; max-width: 360px;
  position: relative; animation: tIn .22s ease;
}
.settings-section h3 { font-size: 13px; color: var(--muted); margin-bottom: 12px; font-family: var(--font-mono); }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-opt {
  background: var(--panel); border: 2px solid var(--border);
  border-radius: 12px; padding: 14px; text-align: center;
  cursor: pointer; transition: all .18s; font-size: 13px; color: var(--muted);
}
.theme-opt:hover  { border-color: var(--accent); }
.theme-opt.active { border-color: var(--accent); color: var(--accent); background: rgba(59,130,246,.06); }
.theme-preview { width: 100%; height: 40px; border-radius: 8px; margin-bottom: 8px; }
.dark-prev  { background: #0b0f14; border: 1px solid #1e2d3d; }
.light-prev { background: #f1f5f9; border: 1px solid #e2e8f0; }

/* ── Guest limit overlay ── */
.guest-limit-overlay {
  position: absolute; inset: 0; z-index: 200;
  background: rgba(11,15,20,.85);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit; backdrop-filter: blur(4px);
  padding: 24px;
}
.limit-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px 24px; text-align: center;
  max-width: 320px; width: 100%;
}
.limit-icon  { font-size: 36px; margin-bottom: 10px; }
.limit-title { font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 7px; }
.limit-sub   { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 18px; }
.limit-btns  { display: flex; flex-direction: column; gap: 8px; }
.limit-btn-primary {
  padding: 11px; background: var(--accent); color: #fff;
  border: none; border-radius: 10px; font-family: var(--font-ar);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.limit-btn-secondary {
  padding: 10px; background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: var(--font-ar); font-size: 13px; cursor: pointer;
}

/* Mobile adjustments */
@media(max-width:680px){
  .setup-box { max-width: 92vw; padding: 22px 18px 16px; }
  .setup-header h2 { font-size: 20px; }
  .setup-header p { font-size: 13px; }
  .step-icon { font-size: 36px; }
  .setup-step h3 { font-size: 16px; }
  .step-sub { font-size: 12px; }
  .setup-input { font-size: 15px; padding: 10px 12px; }
  .setup-next-btn { font-size: 14px; padding: 11px; }
  .setup-back-btn { font-size: 12px; padding: 9px; }
  .birth-selects { gap: 6px; }
  .birth-select { font-size: 13px; padding: 10px 6px; }
  .referral-options { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .referral-opt { font-size: 11px; padding: 9px 4px; }
  .auth-box { max-width: 92vw; }
  .profile-box { max-width: 92vw; }
  .settings-box { max-width: 92vw; }
}
@media(max-width:480px){
  .auth-box,.setup-box,.profile-box,.settings-box { padding: 20px 16px 16px; }
  .grade-pills { grid-template-columns: repeat(3,1fr); }
  .grade-pill { font-size: 11px; padding: 8px 3px; }
  .fields-row { grid-template-columns: 1fr; }
  .profile-dropdown { left: 8px; right: 8px; min-width: unset; }
  [dir="ltr"] .profile-dropdown { right: 8px; left: 8px; }
  .birth-selects { gap: 5px; }
  .birth-select { font-size: 12px; padding: 9px 4px; border-radius: 8px; }
  .referral-options { grid-template-columns: 1fr; gap: 6px; }
  .referral-opt { padding: 10px 8px; font-size: 12px; }
  .setup-logo { font-size: 28px; }
  .setup-header h2 { font-size: 18px; }
  .modal-veil { padding: 10px; }
}
@media(max-width:380px){
  .grade-pills { grid-template-columns: repeat(3,1fr); gap: 5px; }
  .grade-pill { font-size: 10.5px; padding: 7px 2px; }
  .birth-select { font-size: 11px; padding: 8px 3px; }
}

.pricing-box { max-width: 820px; padding: 28px 20px 20px; }
.pricing-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.pricing-card {
  background: var(--card, #1a1f2e);
  border: 2px solid var(--border, #2a2f3e);
  border-radius: 16px;
  padding: 22px 18px;
  width: 230px;
  text-align: center;
  position: relative;
  transition: transform .2s, box-shadow .2s;
}
.pricing-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.pricing-card.popular { border-color: #6c63ff; box-shadow: 0 0 20px rgba(108,99,255,.15); }
.pricing-card.premium { border-color: #f5a623; box-shadow: 0 0 20px rgba(245,166,35,.12); }
.pricing-popular-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: #6c63ff; color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 14px; border-radius: 20px; white-space: nowrap;
}
.pricing-badge {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 4px 14px; border-radius: 20px; margin-bottom: 8px;
}
.free-badge { background: #2a3045; color: #8b95a5; }
.explorer-badge { background: rgba(108,99,255,.15); color: #9b94ff; }
.creative-badge { background: rgba(245,166,35,.15); color: #f5a623; }
.pricing-name { font-size: 20px; font-weight: 800; margin: 4px 0 8px; color: var(--text, #fff); }
.pricing-price { font-size: 14px; color: var(--muted, #8b95a5); margin-bottom: 14px; }
.price-amount { font-size: 28px; font-weight: 800; color: var(--text, #fff); }
.price-period { font-size: 12px; }
.pricing-includes { font-size: 11px; color: var(--accent, #6c63ff); font-weight: 700; margin-bottom: 8px; padding: 4px 10px; background: rgba(108,99,255,0.08); border-radius: 8px; text-align: center; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 16px; text-align: start; }
.pricing-features li {
  padding: 5px 0; font-size: 13px; color: var(--text-secondary, #a0a8b8);
  border-bottom: 1px solid var(--border, #2a2f3e);
}
.pricing-features li:last-child { border-bottom: none; }
.pricing-btn {
  width: 100%; padding: 10px; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: .2s;
}
.free-btn { background: #2a3045; color: #8b95a5; cursor: default; }
.explorer-btn { background: #6c63ff; color: #fff; }
.explorer-btn:hover { background: #5a52e0; }
.creative-btn { background: linear-gradient(135deg, #f5a623, #f57c23); color: #fff; }
.creative-btn:hover { background: linear-gradient(135deg, #e09520, #e06c1e); }
.pricing-btn:disabled { opacity: .6; cursor: default; }
.pricing-note { text-align: center; color: var(--muted, #8b95a5); font-size: 12px; margin-top: 14px; }
.pricing-whatsapp-cta { text-align: center; margin-top: 18px; }
.pricing-whatsapp-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #25D366; color: #fff; text-decoration: none;
  padding: 12px 28px; border-radius: 12px; font-size: 15px; font-weight: 700;
  transition: background .2s, transform .15s;
}
.pricing-whatsapp-btn:hover { background: #1ebe5d; transform: scale(1.03); }
.pricing-whatsapp-btn svg { flex-shrink: 0; }
.pricing-card.active-plan { border-color: #22c55e; }
.pricing-card.active-plan .pricing-btn { background: #22c55e; color: #fff; cursor: default; }

.trial-banner {
  background: linear-gradient(135deg, rgba(245,166,35,.12), rgba(108,99,255,.12));
  border: 1px solid rgba(245,166,35,.25);
  border-radius: 12px; padding: 10px 16px;
  text-align: center; font-size: 14px; font-weight: 600;
  color: #f5a623; margin-bottom: 12px;
}
.trial-icon { font-size: 18px; margin-inline-end: 6px; }

.usage-counters {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 4px 0 0; font-size: 11px; color: var(--muted, #8b95a5);
}
.usage-item { display: inline-flex; align-items: center; gap: 3px; cursor: default; }
.usage-item.warn { color: #f59e0b; font-weight: 600; }
.usage-item.danger { color: #ef4444; font-weight: 700; }

.lb-crown { font-size: 14px; margin-inline-start: 4px; }

@media(max-width:680px){
  .pricing-box { max-width: 96vw; padding: 20px 12px; }
  .pricing-cards { flex-direction: column; align-items: center; }
  .pricing-card { width: 100%; max-width: 320px; }
}
@media(max-width:480px){
  .pricing-card { padding: 16px 12px; }
  .pricing-name { font-size: 17px; }
  .price-amount { font-size: 24px; }
}

.theme-light .pricing-card { background: #fff; border-color: #e2e8f0; }
.theme-light .pricing-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.theme-light .free-badge { background: #f1f5f9; color: #64748b; }
.theme-light .free-btn { background: #f1f5f9; color: #64748b; }
.theme-light .pricing-features li { border-color: #e2e8f0; }
.theme-light .trial-banner { border-color: rgba(245,166,35,.35); }

/* ── Promo Code Input ── */
.promo-section { margin-top: 16px; text-align: center; }
.promo-input-wrap {
  display: inline-flex; gap: 8px; align-items: center;
  background: var(--card, #1a1f2e); border: 1px solid var(--border, #2a2f3e);
  border-radius: 10px; padding: 4px; max-width: 320px; width: 100%;
}
.promo-input {
  flex: 1; border: none; background: transparent; color: var(--text, #fff);
  padding: 8px 12px; font-size: 14px; font-family: 'IBM Plex Mono', monospace;
  outline: none; min-width: 0;
}
.promo-input::placeholder { color: var(--muted, #64748b); }
.promo-apply-btn {
  background: var(--accent, #6c63ff); color: #fff; border: none;
  border-radius: 8px; padding: 8px 16px; font-size: 13px;
  font-weight: 700; cursor: pointer; white-space: nowrap;
}
.promo-result {
  margin-top: 8px; font-size: 13px; padding: 6px 12px;
  border-radius: 8px; display: inline-block;
}
.promo-result.success { background: rgba(34,197,94,.12); color: #22c55e; }
.promo-result.error { background: rgba(239,68,68,.12); color: #ef4444; }
.price-old {
  text-decoration: line-through; color: var(--muted, #64748b);
  font-size: 18px; margin-left: 6px; opacity: .7;
}
.price-new { color: #22c55e !important; }
.theme-light .promo-input-wrap { background: #f8fafc; border-color: #e2e8f0; }
.theme-light .promo-input { color: #1e293b; }

/* ── Profile Hero Redesign ── */
.pf-hero {
  position: relative; margin: 0; padding: 0;
  border-radius: 16px 16px 0 0; overflow: hidden;
}
.pf-hero-bg {
  height: 100px;
  background: linear-gradient(135deg, #6c63ff 0%, #9b59b6 50%, #f5a623 100%);
}
.pf-avatar-area {
  display: flex; align-items: flex-end; gap: 14px;
  padding: 0 22px; margin-top: -36px; position: relative; z-index: 2;
}
.pf-name-area {
  padding-bottom: 2px; min-width: 0; flex: 1;
  display: flex; flex-direction: column; justify-content: flex-end;
  margin-top: 8px;
}
.pf-hero-name {
  font-size: 20px; font-weight: 800; color: var(--text, #fff); margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.3;
}
.pf-hero-plan { display: none; }
.pf-hero-name.creative-name { color: #f5a623; }
.pf-hero-name.explorer-name { color: #9b94ff; }
.profile-avatar-wrap.creative-wrap .profile-big-avatar { border-color: #f5a623; box-shadow: 0 0 12px rgba(245,166,35,.35); }
.profile-avatar-wrap.creative-wrap::after {
  content: '👑'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 18px; z-index: 3; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4));
}
.profile-box > .modal-close { z-index: 5; }

.pf-stats-row {
  display: flex; justify-content: space-around; gap: 8px;
  padding: 16px 12px; margin: 14px 20px 0;
  background: var(--card, rgba(26,31,46,.6));
  border: 1px solid var(--border, #2a2f3e);
  border-radius: 12px;
}
.pf-stat { text-align: center; }
.pf-stat-val { display: block; font-size: 20px; font-weight: 800; color: var(--text, #fff); }
.pf-stat-lbl { display: block; font-size: 11px; color: var(--muted, #8b95a5); margin-top: 2px; }

.pf-plan-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; margin: 14px 20px 0;
  background: linear-gradient(135deg, rgba(108,99,255,.08), rgba(245,166,35,.08));
  border: 1px solid rgba(108,99,255,.2);
  border-radius: 12px;
}
.pf-plan-info { display: flex; align-items: center; gap: 10px; }
.pf-plan-icon { font-size: 28px; }
.pf-plan-name { font-size: 15px; font-weight: 700; color: var(--text, #fff); }
.pf-plan-detail { font-size: 12px; color: var(--muted, #8b95a5); margin-top: 2px; }
.pf-plan-upgrade {
  background: linear-gradient(135deg, #6c63ff, #9b59b6);
  color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-size: 13px; font-weight: 700; cursor: pointer;
}

.pf-section-title {
  font-size: 14px; font-weight: 700; color: var(--muted, #8b95a5);
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border, #2a2f3e);
}

.theme-light .pf-hero-plan.plan-free { background: #f1f5f9; color: #64748b; }
.theme-light .pf-stats-row { background: #f8fafc; border-color: #e2e8f0; }
.theme-light .pf-plan-card { background: linear-gradient(135deg, rgba(108,99,255,.05), rgba(245,166,35,.05)); border-color: rgba(108,99,255,.15); }
.theme-light .pf-section-title { border-color: #e2e8f0; }

@media(max-width:480px) {
  .pf-hero-bg { height: 70px; }
  .pf-avatar-area { padding: 0 14px; margin-top: -30px; gap: 10px; }
  .profile-big-avatar { width: 60px !important; height: 60px !important; }
  .pf-hero-name { font-size: 16px; }
  .pf-hero-plan { font-size: 10px; padding: 2px 8px; }
  .pf-name-area { padding-bottom: 6px; }
  .pf-stats-row { padding: 10px 8px; margin: 10px 14px 0; gap: 4px; }
  .pf-stat-val { font-size: 16px; }
  .pf-stat-lbl { font-size: 10px; }
  .pf-plan-card { flex-direction: column; gap: 8px; text-align: center; padding: 10px 12px; margin: 10px 14px 0; }
  .pf-plan-info { flex-direction: column; gap: 6px; }
  .pf-plan-name { font-size: 14px; }
  .pf-plan-detail { font-size: 11px; }
  .pf-plan-upgrade { width: 100%; padding: 10px; font-size: 14px; }
  .pf-section-title { font-size: 13px; }
  .avatar-change-btn { width: 24px; height: 24px; font-size: 11px; }
}

.katex-block {
  display: block;
  text-align: center;
  margin: 10px 0;
  overflow-x: auto;
  direction: ltr;
}
.katex { direction: ltr; unicode-bidi: isolate; }
