/* 3. Popups & Modals Base (Dark Fantasy Obsidian Theme) */
.pixel-modal {
  border: 1px solid #3c4257;
  border-radius: 8px;
  background: #111420;
  color: #f8fafc;
  padding: 22px 24px;
  max-width: 450px;
  width: 92%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 0 100vmax rgba(5, 8, 16, 0.78);
  position: fixed;
  inset: 0;
  margin: auto;
  animation: pixelModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.pixel-modal::backdrop {
  background: rgba(4, 7, 14, 0.8);
  backdrop-filter: blur(5px);
}
@keyframes pixelModalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Modal Shared Header */
.pixel-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid #232a3b;
  margin-bottom: 16px;
}
.modal-badge-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-sigil {
  font-size: 24px;
  color: #fbbf24;
  line-height: 1;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}
.modal-eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: #84918e;
  text-transform: uppercase;
}
.modal-title {
  margin: 2px 0 0 0;
  font-size: 19px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.5px;
}
.modal-close-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
}
.modal-close-icon:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
}

/* 4. Redesigned Authentication Modal */
.auth-modal {
  max-width: 440px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #090c14;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid #1e2638;
  margin-bottom: 14px;
}
.auth-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.auth-tab-btn:hover {
  color: #f1f5f9;
  background: #141a27;
}
.auth-tab-btn.active {
  background: #182030;
  border-color: #f59e0b;
  color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}
.tab-badge-gift {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(147, 51, 234, 0.5);
}

/* Dynamic Auth Banner */
.auth-banner-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(26, 36, 54, 0.7), rgba(15, 21, 34, 0.9));
  border: 1px solid #2d3748;
  border-left: 3px solid #38bdf8;
  border-radius: 6px;
  padding: 9px 12px;
  margin-bottom: 15px;
  transition: border-color 0.2s ease;
}
.auth-banner-box.register-mode {
  border-left-color: #a855f7;
}
.banner-icon {
  font-size: 18px;
  line-height: 1.2;
}
.banner-text strong {
  display: block;
  font-size: 12px;
  color: #f1f5f9;
  margin-bottom: 2px;
}
.banner-text p {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

/* Auth Input Fields */
.auth-field-group {
  margin-bottom: 13px;
}
.auth-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.auth-label-text {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
}
.auth-label-hint {
  font-size: 10.5px;
  color: #64748b;
}
.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0.7;
}
.auth-input-wrapper input, .auth-field-group textarea {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 36px;
  background: #090c14;
  border: 1px solid #283247;
  border-radius: 6px;
  color: #f8fafc;
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.15s ease;
}
.auth-field-group textarea {
  height: 60px;
  padding: 8px 10px;
  resize: vertical;
}
.auth-input-wrapper input:focus, .auth-field-group textarea:focus {
  border-color: #f59e0b;
  outline: none;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
  background: #0d121e;
}
.auth-toggle-pwd {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
  transition: color 0.15s;
}
.auth-toggle-pwd:hover {
  color: #f1f5f9;
}

/* Auth Alert Message */
.auth-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 13px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid #ef4444;
  color: #fca5a5;
  animation: pixelModalPop 0.15s ease-out;
}
.auth-alert.success {
  background: rgba(16, 185, 129, 0.14);
  border-color: #10b981;
  color: #6ee7b7;
}

/* Auth Action Button */
.auth-modal-actions {
  margin-top: 16px;
}
.auth-submit-btn {
  width: 100%;
  height: 42px;
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid #f59e0b;
  border-radius: 6px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.5px;
  transition: all 0.18s ease;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}
.auth-submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}
.auth-submit-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-switch-footer {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.auth-switch-link {
  background: transparent;
  border: none;
  padding: 0;
  color: #38bdf8;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-switch-link:hover {
  color: #7dd3fc;
}

/* 5. Redesigned Player Profile & Logout Modal */
.profile-modal {
  max-width: 480px;
}
.profile-card {
  background: #090c14;
  border: 1px solid #232c3f;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.profile-avatar-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #1a2233;
}
.profile-avatar-frame {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, #252f44, #101522);
  border: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
}
.profile-avatar-icon {
  font-size: 24px;
}
.profile-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.profile-username-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-username {
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
}
.profile-status-pill {
  font-size: 10px;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 7px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 5px #10b981;
}
.profile-rank-title {
  font-size: 11.5px;
  color: #fbbf24;
  font-weight: 500;
}

/* Stats 3-Column Matrix */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.profile-stat-item {
  background: #111624;
  border: 1px solid #20293d;
  border-radius: 6px;
  padding: 9px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 3px;
}
.stat-icon {
  font-size: 12px;
}
.stat-label {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 600;
}
.stat-value {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 2px;
}
.stat-desc {
  font-size: 9px;
  color: #64748b;
}
.soul-stat .stat-value {
  color: #c084fc;
  text-shadow: 0 0 8px rgba(192, 132, 252, 0.45);
}
.score-stat .stat-value {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.45);
}
.vault-stat .stat-value {
  color: #34d399;
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.45);
}

/* Profile Action Buttons */
.profile-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.profile-action-btn {
  flex: 1;
  padding: 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.profile-action-btn.vault-action {
  background: #1f1430;
  border: 1px solid #7c3aed;
  color: #e9d5ff;
}
.profile-action-btn.vault-action:hover {
  background: #2e184b;
  border-color: #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
}
.profile-action-btn.sync-action {
  flex: 0 0 auto;
  background: #131926;
  border: 1px solid #2d3748;
  color: #94a3b8;
  padding: 9px 14px;
}
.profile-action-btn.sync-action:hover {
  background: #1a2233;
  color: #f1f5f9;
  border-color: #4a5568;
}

/* Logout Section with Smooth Inline Confirmation */
.profile-logout-section {
  border-top: 1px dashed #283247;
  padding-top: 12px;
}
.logout-btn {
  width: 100%;
  padding: 9px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid #7f1d1d;
  color: #f87171;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #dc2626;
  color: #fca5a5;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.25);
}
.logout-confirm-box {
  background: #170d10;
  border: 1px solid #ef4444;
  border-radius: 6px;
  padding: 10px 12px;
  animation: pixelModalPop 0.18s ease-out;
}
.logout-confirm-text {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.confirm-warn-icon {
  font-size: 18px;
  line-height: 1.1;
}
.logout-confirm-text strong {
  display: block;
  font-size: 12.5px;
  color: #fecaca;
}
.logout-confirm-text p {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: #f87171;
  line-height: 1.35;
}
.logout-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.logout-cancel-btn {
  padding: 5px 12px;
  border-radius: 4px;
  background: #1e2638;
  border: 1px solid #3d4a66;
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.logout-cancel-btn:hover {
  background: #2a354d;
  color: #f8fafc;
}
.logout-confirm-btn {
  padding: 5px 14px;
  border-radius: 4px;
  background: #dc2626;
  border: 1px solid #ef4444;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
  transition: all 0.15s ease;
}
.logout-confirm-btn:hover {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.7);
}

/* 6. Claim Throne & Vault Modal Extras */
.claim-record-banner {
  background: #191424;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  border: 1px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.claim-record-label {
  font-size: 12px;
  color: #cbd5e1;
}
.claim-record-val {
  color: #fbbf24;
  font-size: 16px;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}
.claim-submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #b45309, #78350f);
  border: 1px solid #f59e0b;
  color: #fff;
  font-weight: 700;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
  transition: all 0.15s ease;
}
.claim-submit-btn:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.6);
}

/* Card Vault Modal (Kho Thần Tích) */
.vault-modal {
  max-width: 620px;
}
.vault-balance-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e1b2e;
  border: 1px solid #6b21a8;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 16px;
  color: #e9d5ff;
}
.vault-balance-num {
  font-size: 18px;
  font-weight: bold;
  color: #c084fc;
}
.vault-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}
.vault-card-item {
  background: #171a28;
  border: 1px solid #2d3748;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.vault-card-item.locked {
  border-color: #4b3658;
  background: #151421;
}
.vault-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.vault-card-icon {
  font-size: 20px;
}
.vault-card-title {
  font-weight: 600;
  font-size: 13px;
  color: #f1f5f9;
}
.vault-card-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 8px;
}
.vault-unlock-btn {
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s;
}
.vault-unlock-btn:hover {
  background: #9333ea;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}
.vault-unlocked-badge {
  color: #10b981;
  font-size: 11px;
  font-weight: 600;
}

/* End-run Reward Display */
.end-soul-ash-box {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid #7c3aed;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 0;
  color: #d8b4fe;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: soulGlow 2s infinite alternate;
}
@keyframes soulGlow {
  from { box-shadow: 0 0 5px rgba(147, 51, 234, 0.3); }
  to { box-shadow: 0 0 15px rgba(147, 51, 234, 0.7); }
}
/* Account controls use their own metrics on both game and guide routes. */
#site-account #authModal{width:calc(100% - 32px);max-width:480px;max-height:calc(100dvh - 32px);padding:24px;box-sizing:border-box;border:3px solid #080a11;outline:1px solid #746476;background:#1b1c2b;color:#eee5d5;box-shadow:inset 0 2px #b4a3ab33,inset 0 -3px #0b0d17,6px 6px #080a11;font-size:20px;line-height:1.25;animation:none}
#authModal *,#authModal *:before,#authModal *:after{box-sizing:border-box;border-radius:0}
#authModal button,#authModal input{font:inherit;letter-spacing:0}
#authModal button{cursor:pointer}
#authModal .pixel-modal-header{gap:12px;margin:0 0 18px;padding:0 0 16px;border-bottom:2px solid #625364}
#authModal .modal-badge-title{gap:12px;min-width:0}
#authModal .modal-sigil{color:#e5bd7b;font-size:28px;text-shadow:none;flex-shrink:0}
#authModal .modal-eyebrow{font-size:14px;line-height:1.2;letter-spacing:1px;color:#b4abba;font-weight:400}
#authModal .modal-title{font-size:32px;line-height:1.1;font-weight:400;letter-spacing:0;margin:4px 0 0;color:#f3dfbd}
#authModal .modal-close-icon{width:40px;min-width:40px;height:40px;padding:0;margin:0;flex-shrink:0;background:#242432;border:2px solid #6c6578;color:#eee5d5;font-size:20px;box-shadow:2px 2px #080a11}
#authModal .modal-close-icon:hover{border-color:#e5bd7b;color:#ffe2a5}
#authModal .auth-tabs{gap:8px;padding:0;margin:0 0 16px;background:transparent;border:0;grid-template-columns:repeat(2,minmax(0,1fr))}
#authModal .auth-tab-btn{min-width:0;min-height:48px;padding:8px;gap:4px 6px;flex-wrap:wrap;font-size:20px;font-weight:400;line-height:1.1;border:2px solid #625364;background:#242432;color:#b4abba;box-shadow:2px 2px #080a11}
#authModal .auth-tab-btn.active{border-color:#b3986a;background:#302b32;color:#ffe2a5;box-shadow:inset 0 -3px #604b36,2px 2px #080a11}
#authModal .auth-tab-btn:hover{border-color:#e5bd7b;color:#ffe2a5}
#authModal .tab-icon{display:none}
#authModal .tab-badge-gift{font-size:16px;font-weight:400;line-height:1.1;white-space:nowrap;padding:2px 4px;border:1px solid #977cb8;background:#42344f;color:#ead9ff;box-shadow:none}
#authModal .auth-banner-box{gap:10px;padding:12px;margin:0 0 18px;border:2px solid #625364;border-left:4px solid #acd5ad;background:#222635}
#authModal .auth-banner-box.register-mode{border-left-color:#b59ad6}
#authModal .banner-icon{flex-shrink:0;font-size:20px;line-height:1.2}
#authModal .banner-text{min-width:0;overflow-wrap:anywhere}
#authModal .banner-text strong{font-size:20px;font-weight:400;line-height:1.2;color:#eee5d5;margin:0 0 4px}
#authModal .banner-text p{font-size:18px;line-height:1.3;color:#b4abba;margin:0}
#authModal .auth-field-group{margin:0 0 16px}
#authModal .auth-label{gap:4px 10px;flex-wrap:wrap;margin:0 0 6px;line-height:1.15}
#authModal .auth-label-text{font-size:20px;font-weight:400;color:#eee5d5}
#authModal .auth-label-hint{font-size:16px;color:#b4abba}
#authModal .auth-input-wrapper{min-width:0}
#authModal .auth-input-wrapper input{min-width:0;width:100%;height:46px;padding:0 46px 0 40px;border:2px solid #625364;background:#10111b;color:#eee5d5;font-size:20px;line-height:1.2}
#authModal .auth-input-wrapper input::placeholder{color:#a49aaf;opacity:1}
#authModal .auth-input-wrapper input:focus{border-color:#e5bd7b;background:#141622;box-shadow:0 0 0 1px #e5bd7b;outline:none}
#authModal .auth-input-icon{left:12px;font-size:18px;line-height:1;opacity:1}
#authModal .auth-toggle-pwd{right:3px;top:3px;width:40px;min-width:40px;height:40px;padding:0;margin:0;border:0;background:transparent;color:#b4abba;font-size:18px;line-height:1;box-shadow:none}
#authModal .auth-toggle-pwd:hover{background:#302b32;color:#ffe2a5}
#authModal .auth-alert{font-size:18px;line-height:1.25;border-width:2px}
#authModal .auth-modal-actions{margin-top:18px}
#authModal .auth-submit-btn{min-height:48px;height:auto;width:100%;padding:10px 16px;border:2px solid #d2e4b8;background:#accfa7;color:#17261f;font-size:22px;line-height:1.1;font-weight:400;letter-spacing:0;box-shadow:inset 0 -4px #71927c,3px 3px #080a11;transform:none}
#authModal .auth-submit-btn:hover:not(:disabled){background:#c8e0b7;color:#17261f;box-shadow:inset 0 -4px #71927c,3px 3px #080a11;transform:none}
#authModal .auth-switch-footer{flex-wrap:wrap;gap:4px 8px;margin-top:18px;font-size:18px;line-height:1.25;color:#b4abba}
#authModal .auth-switch-link{padding:0;margin:0;max-width:100%;border:0;background:transparent;color:#acd5ad;font-size:18px;line-height:1.25;font-weight:400;white-space:normal;box-shadow:none}
#authModal .auth-switch-link:hover{color:#e5bd7b}
@media(max-width:480px){#site-account #authModal{padding:16px}#authModal .modal-title{font-size:28px}#authModal .modal-badge-title{gap:8px}#authModal .auth-tab-btn{font-size:18px}#authModal .tab-badge-gift{display:none}}
