:root {
  --bg-app: #F7F5FB;
  --bg-raised: #FFFFFF;
  --surface-lavender: #B8A6FF;
  --surface-sky: #9EC9F0;
  --surface-mint: #7DD4A8;
  --surface-peach: #FFB59E;
  --surface-pink: #F5B8D0;
  --surface-lemon: #F5D77A;
  --action-primary: #FF7A6B;
  --action-on: #FFFFFF;
  --text-strong: #2E2A3F;
  --text-muted: #6B6580;
  --r-card: 28px;
  --r-button: 18px;
  --r-chip: 999px;
  --r-input: 16px;
  --r-icon: 20px;

  --shadow-white: 8px 8px 22px rgba(140,108,255,0.16), -8px -8px 20px rgba(255,255,255,0.85), inset 3px 3px 6px rgba(255,255,255,0.7), inset -5px -5px 10px rgba(140,108,255,0.10);
  --shadow-lavender: 8px 8px 22px rgba(140,108,255,0.32), -6px -6px 18px rgba(255,255,255,0.6), inset 3px 3px 6px rgba(255,255,255,0.55), inset -5px -5px 10px rgba(140,108,255,0.28);
  --shadow-sky: 8px 8px 22px rgba(80,150,220,0.32), -6px -6px 18px rgba(255,255,255,0.6), inset 3px 3px 6px rgba(255,255,255,0.55), inset -5px -5px 10px rgba(80,150,220,0.28);
  --shadow-mint: 8px 8px 22px rgba(70,180,130,0.32), -6px -6px 18px rgba(255,255,255,0.6), inset 3px 3px 6px rgba(255,255,255,0.55), inset -5px -5px 10px rgba(70,180,130,0.28);
  --shadow-peach: 8px 8px 22px rgba(255,140,110,0.32), -6px -6px 18px rgba(255,255,255,0.6), inset 3px 3px 6px rgba(255,255,255,0.55), inset -5px -5px 10px rgba(255,140,110,0.28);
  --shadow-lemon: 8px 8px 22px rgba(220,180,70,0.32), -6px -6px 18px rgba(255,255,255,0.6), inset 3px 3px 6px rgba(255,255,255,0.55), inset -5px -5px 10px rgba(220,180,70,0.28);
  --shadow-coral: 8px 8px 22px rgba(230,90,75,0.35), -6px -6px 18px rgba(255,255,255,0.6), inset 3px 3px 6px rgba(255,255,255,0.5), inset -5px -5px 10px rgba(230,90,75,0.30);
  --shadow-pressed: inset 4px 4px 8px rgba(140,108,255,0.20), inset -4px -4px 8px rgba(255,255,255,0.75);
  --shadow-sm: 4px 4px 12px rgba(140,108,255,0.18), -3px -3px 10px rgba(255,255,255,0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Quicksand', 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-strong);
  background: var(--bg-app);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px 48px;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.profile-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-raised);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-white);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 2px 2px;
}
.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--r-chip);
  object-fit: cover;
  background: var(--bg-app);
  box-shadow: var(--shadow-sm);
  padding: 4px;
}
.avatar-status {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-mint);
  border: 3px solid var(--bg-raised);
  box-shadow: 0 0 0 1px rgba(70,180,130,0.35);
}
.profile-header-text { min-width: 0; }
.profile-header-text h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-strong);
  word-break: break-word;
}
.profile-header-text .email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-all;
}
.tier-chip {
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 12px;
  border-radius: var(--r-chip);
  background: var(--surface-lemon);
  color: #6b4e00;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: var(--shadow-lemon);
}
.tier-chip svg { flex-shrink: 0; }

.info-box {
  background: var(--bg-app);
  border-radius: var(--r-input);
  padding: 15px 16px;
  box-shadow: var(--shadow-pressed);
}
.info-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.info-box:nth-of-type(1) .info-label { color: #7c5fe0; }
.info-box:nth-of-type(2) .info-label { color: #3f86c9; }
.info-box:nth-of-type(3) .info-label { color: #2f9d6b; }
.info-box:nth-of-type(4) .info-label { color: #d98a1f; }

.value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-strong);
  word-break: break-all;
}
.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.key-row .value {
  flex: 1;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 1px;
}

.anim-reveal {
  animation: blurReveal 0.4s ease-out forwards;
}
@keyframes blurReveal {
  0% { opacity: 0; filter: blur(5px); transform: translateY(4px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.toggle-eye {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 14px;
  background: var(--bg-raised);
  color: var(--text-strong);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.toggle-eye svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-strong);
  transition: stroke 0.15s ease;
}
.toggle-eye:hover { transform: translateY(-1px); }
.toggle-eye:hover svg { stroke: var(--action-primary); }
.toggle-eye:active { box-shadow: var(--shadow-pressed); transform: scale(0.94); }

.toggle-eye.copied { box-shadow: var(--shadow-mint); }
.toggle-eye.copied svg { stroke: #14532d; }

.anim-icon {
  animation: popIcon 0.35s ease-in-out;
}
@keyframes popIcon {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(0.6) rotate(-15deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.warning-box {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,181,158,0.28);
  color: #a24a33;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}
.warning-box svg { flex-shrink: 0; margin-top: 1px; }

.limit-bar-track {
  margin-top: 12px;
  height: 14px;
  border-radius: var(--r-chip);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pressed);
  overflow: hidden;
}
.limit-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--r-chip);
  background: linear-gradient(90deg, var(--surface-mint), #4fb883);
  box-shadow: 0 2px 6px rgba(70,180,130,0.4);
  transition: width 0.5s ease;
}
.limit-bar-fill.limit-warn {
  background: linear-gradient(90deg, var(--surface-lemon), #e0a93f);
  box-shadow: 0 2px 6px rgba(220,180,70,0.45);
}
.limit-bar-fill.limit-danger {
  background: linear-gradient(90deg, var(--surface-peach), var(--action-primary));
  box-shadow: 0 2px 6px rgba(230,90,75,0.45);
}

.stats-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 130px;
  padding: 6px 2px 0;
}
.stat-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
}
.stat-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0;
  animation: popText 0.5s ease-out forwards;
}
.stat-bar {
  width: 60%;
  max-width: 22px;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--surface-lavender), #8f76e6);
  box-shadow: 0 2px 6px rgba(140,108,255,0.35);
  transform-origin: bottom;
  transform: scaleY(0);
  animation: barGrow 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.stat-col:nth-child(2n) .stat-bar { background: linear-gradient(180deg, var(--surface-sky), #5ea3dd); box-shadow: 0 2px 6px rgba(80,150,220,0.35); }
.stat-col:nth-child(3n) .stat-bar { background: linear-gradient(180deg, var(--surface-pink), #e089b4); box-shadow: 0 2px 6px rgba(230,140,180,0.35); }
.stat-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0;
  animation: popText 0.5s ease-out forwards;
}

@keyframes barGrow {
  0% { transform: scaleY(0); opacity: 0; }
  100% { transform: scaleY(1); opacity: 1; }
}
@keyframes popText {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

#password-section-has, #password-section-nopass { display: block; }
#password-section-nopass p { line-height: 1.5; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: var(--r-button);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn svg { flex-shrink: 0; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); box-shadow: var(--shadow-pressed) !important; }

.btn-primary { background: var(--action-primary); color: var(--action-on); box-shadow: var(--shadow-coral); }
.btn-shop { background: var(--surface-sky); color: #123a5c; box-shadow: var(--shadow-sky); }
.btn-admin, #admin-btn { display: none; background: var(--surface-lavender); color: #2e1d63; box-shadow: var(--shadow-lavender); }
.btn-back { background: var(--bg-raised); color: var(--text-strong); box-shadow: var(--shadow-white); }

.link-btn {
  display: inline-block;
  width: 100%;
  margin-top: 10px;
  padding: 6px;
  background: none;
  border: none;
  color: var(--action-primary);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.link-btn:hover { text-decoration: underline; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46,42,63,0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal-box {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-raised);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-white);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-strong);
  text-align: center;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-strong);
}
.form-group input {
  width: 100%;
  padding: 13px 15px;
  border: none;
  border-radius: var(--r-input);
  background: var(--bg-app);
  box-shadow: var(--shadow-pressed);
  color: var(--text-strong);
  font-family: 'Quicksand', sans-serif;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: box-shadow 0.15s ease;
}
.form-group input:focus { box-shadow: var(--shadow-pressed), 0 0 0 3px rgba(184,166,255,0.4); }

.field-hint { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); min-height: 14px; }
.field-hint.error { color: #dc2626; }
.field-hint.success { color: #059669; }
.modal-msg { font-size: 0.8rem; font-weight: 600; text-align: center; min-height: 16px; }
.modal-msg.error { color: #dc2626; }
.modal-msg.success { color: #059669; }

.modal-close {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--r-button);
  background: var(--bg-app);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.modal-close:hover { transform: translateY(-1px); }
.modal-close:active { transform: scale(0.97); box-shadow: var(--shadow-pressed); }

.turnstile-wrapper { display: flex; justify-content: center; margin: 4px 0; }
.resend-row { font-size: 0.78rem; color: var(--text-muted); text-align: center; }
.resend-row .link-btn { display: inline; width: auto; margin: 0; padding: 0; }
.resend-row .link-btn:disabled { color: #b8b2cc; cursor: not-allowed; text-decoration: none; }

.otp-container {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.otp-digit {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  border-radius: var(--r-input);
  background: var(--bg-app);
  box-shadow: var(--shadow-pressed);
  color: var(--text-strong);
  outline: none;
  caret-color: var(--action-primary);
  transition: box-shadow 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.otp-digit:focus {
  box-shadow: var(--shadow-pressed), 0 0 0 3px rgba(184,166,255,0.4);
  transform: translateY(-1px);
}
.otp-digit.filled {
  box-shadow: var(--shadow-sm);
  color: var(--action-primary);
}

.whitelist-current-ip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.whitelist-current-ip span:nth-child(2) {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-strong);
  background: var(--bg-raised);
  padding: 3px 8px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.wl-use-btn {
  margin-left: auto;
  padding: 6px 12px;
  border: none;
  border-radius: var(--r-chip);
  background: var(--surface-sky);
  color: #123a5c;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sky);
  transition: transform 0.15s ease;
}
.wl-use-btn:hover { transform: translateY(-1px); }
.wl-use-btn:active { transform: scale(0.95); }

.wl-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.wl-add-row input {
  flex: 1;
  padding: 11px 13px;
  border: none;
  border-radius: var(--r-input);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pressed);
  color: var(--text-strong);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
}
.wl-add-row input:focus { box-shadow: var(--shadow-pressed), 0 0 0 3px rgba(184,166,255,0.4); }
.wl-add-btn {
  flex-shrink: 0;
  padding: 0 18px;
  border: none;
  border-radius: var(--r-input);
  background: var(--surface-mint);
  color: #14532d;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-mint);
  transition: transform 0.15s ease;
}
.wl-add-btn:hover { transform: translateY(-1px); }
.wl-add-btn:active { transform: scale(0.95); }

.wl-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 2px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}
.wl-count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-strong);
  background: var(--bg-raised);
  padding: 3px 10px;
  border-radius: var(--r-chip);
  box-shadow: var(--shadow-sm);
  text-transform: none;
  letter-spacing: 0;
}

.wl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}
.wl-empty {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}
.wl-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 10px;
  border-radius: 14px;
  background: var(--bg-raised);
  box-shadow: var(--shadow-pressed);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}
.wl-empty-state svg { opacity: 0.45; }

.wl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.wl-item:hover { transform: translateY(-1px); }
.wl-item-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface-mint);
  color: #14532d;
  box-shadow: var(--shadow-mint);
}
.wl-item.wl-item-current .wl-item-icon {
  background: var(--surface-lemon);
  color: #6b4e00;
  box-shadow: var(--shadow-lemon);
}
.wl-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wl-item-ip {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-strong);
  word-break: break-all;
}
.wl-item-badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: #b3860f;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.wl-remove-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: var(--r-chip);
  background: var(--surface-peach);
  color: #7a2e1c;
  cursor: pointer;
  box-shadow: var(--shadow-peach);
  transition: transform 0.15s ease;
}
.wl-remove-btn:hover { transform: translateY(-1px) scale(1.05); }
.wl-remove-btn:active { transform: scale(0.9); }

.wl-rules {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (min-width: 769px) {
  body { padding: 48px 24px; align-items: center; }
  .profile-card { max-width: 540px; padding: 30px; gap: 18px; }
  .profile-header-text h2 { font-size: 1.5rem; }
  .avatar { width: 84px; height: 84px; }
  .info-box { padding: 18px 20px; }
  .btn { padding: 15px 20px; }
}