/* Ember Vault - Scoreboard, Auth & Meta Progression Styles */

/* 1. Header Action Buttons */
.auth-btn, .unlock-btn {
  background: #1e2433;
  color: #f1f5f9;
  border: 1px solid #4a5568;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.auth-btn:hover, .unlock-btn:hover {
  background: #2d3748;
  border-color: #f59e0b;
  color: #fbbf24;
}
.auth-btn.logged-in {
  background: #1c2738;
  border-color: #3b82f6;
  color: #93c5fd;
}
.unlock-btn {
  border-color: #7c3aed;
  color: #c4b5fd;
}
.unlock-btn:hover {
  border-color: #a855f7;
  color: #f3e8ff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

/* 2. Scoreboard 300x600 Widget */
.scoreboard-widget-box {
  width: 300px;
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid #383446;
  border-radius: 6px;
  overflow: hidden;
  background: #10121a;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  position: relative;
}
.scoreboard-header {
  padding: 8px 12px;
  background: #171924;
  border-bottom: 1px solid #2b2e3f;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hall-badge {
  color: #fbbf24;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1px;
}
.hall-sub {
  color: #94a3b8;
  font-size: 10px;
}

.monarch-art-container {
  position: relative;
  width: 300px;
  height: 520px;
  background: #0d0f17;
  overflow: hidden;
}
.monarch-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: pixelated;
}
.monarch-animation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  pointer-events: none;
}
.monarch-animation[hidden] { display: none; }

/* Top Text: Monarch Quote Bubble */
.monarch-quote-bubble {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  background: rgba(15, 17, 26, 0.88);
  border: 2px solid #b45309;
  border-radius: 8px;
  padding: 10px 12px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.8), 0 0 10px rgba(245, 158, 11, 0.25);
  animation: monarchPulse 4s infinite ease-in-out;
}
@keyframes monarchPulse {
  0%, 100% { border-color: #b45309; box-shadow: 0 0 10px rgba(245, 158, 11, 0.2); }
  50% { border-color: #f59e0b; box-shadow: 0 0 18px rgba(245, 158, 11, 0.45); }
}
.monarch-quote-text {
  margin: 0 0 6px 0;
  font-size: 12px;
  line-height: 1.45;
  color: #fef08a;
  font-style: italic;
  word-break: break-word;
  text-shadow: 0 1px 2px #000;
}
.monarch-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  border-top: 1px dashed rgba(245, 158, 11, 0.3);
  padding-top: 4px;
}
.king-name {
  color: #f8fafc;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.king-score {
  color: #f59e0b;
  font-weight: 700;
}

/* Bottom Text: Servants Stone Tablet */
.servants-tablet {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: rgba(13, 15, 23, 0.92);
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
  backdrop-filter: blur(3px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.7);
}
.servants-title {
  font-size: 10px;
  color: #94a3b8;
  letter-spacing: 1px;
  margin-bottom: 2px;
}
.servants-count {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.servants-number {
  font-size: 20px;
  font-weight: 800;
  color: #38bdf8;
  font-family: inherit;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}
.servants-label {
  font-size: 10px;
  color: #64748b;
}

/* Scoreboard Bottom Actions */
.scoreboard-actions {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  background: #141722;
  border-top: 1px solid #232738;
}
.refresh-score-btn, .history-score-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.refresh-score-btn:hover, .history-score-btn:hover {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #64748b;
}

/* 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); }
}

/* 7. Header Navigation Groups (Desktop & Base) */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.header-nav-utils,
.header-nav-features {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 8. Mobile Ergonomic Header & Topbar Enhancement */
@media (max-width: 768px) {
  main {
    padding: 12px 10px !important;
  }

  header {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "brand utils"
      "features features" !important;
    gap: 10px 8px !important;
    align-items: center !important;
    margin-bottom: 14px !important;
    width: 100% !important;
  }

  .brand {
    grid-area: brand;
    font-size: 17px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    color: #edf6ef !important;
  }
  .brand span {
    font-size: 22px !important;
    margin: 0 !important;
    line-height: 1;
    color: #83f1c4 !important;
  }

  .edition {
    display: none !important;
  }

  .header-actions {
    display: contents !important;
  }

  /* Utility bar on the top-right */
  .header-nav-utils {
    grid-area: utils;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    min-width: 0 !important;
  }

  .header-nav-utils .discord-btn,
  .header-nav-utils #langBtn,
  .header-nav-utils #sound {
    height: 36px !important;
    padding: 0 10px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  .header-nav-utils #sound {
    background: #171c26 !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
  }

  .header-nav-utils #langBtn {
    background: #171c26 !important;
    border: 1px solid #334155 !important;
    color: #f59e0b !important;
  }

  /* Feature action cards on the bottom full-width row */
  .header-nav-features {
    grid-area: features;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .header-nav-features .auth-btn,
  .header-nav-features .unlock-btn {
    height: 42px !important;
    width: 100% !important;
    padding: 0 10px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    gap: 7px !important;
    box-sizing: border-box !important;
    letter-spacing: 0.3px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
  }

  .header-nav-features .auth-btn {
    background: #1e293b !important;
    border: 1px solid #38bdf8 !important;
    color: #f0f9ff !important;
  }
  .header-nav-features .auth-btn.logged-in {
    background: #172554 !important;
    border-color: #60a5fa !important;
    color: #bfdbfe !important;
  }

  .header-nav-features .unlock-btn {
    background: #24143a !important;
    border: 1px solid #9333ea !important;
    color: #f3e8ff !important;
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.25) !important;
  }
}

@media (max-width: 430px) {
  header {
    gap: 8px 6px !important;
  }

  .brand {
    font-size: 15px !important;
    letter-spacing: 1px !important;
  }
  .brand span {
    font-size: 19px !important;
  }

  /* Hide the text "Discord" on compact screens, show SVG icon cleanly */
  .header-nav-utils .discord-btn span {
    display: none !important;
  }
  .header-nav-utils .discord-btn {
    width: 36px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  .header-nav-utils #sound,
  .header-nav-utils #langBtn {
    padding: 0 8px !important;
    font-size: 12px !important;
  }

  .header-nav-features .auth-btn,
  .header-nav-features .unlock-btn {
    height: 40px !important;
    font-size: 12.5px !important;
    padding: 0 6px !important;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 8px !important;
    padding: 10px 12px !important;
  }
  .topbar small {
    font-size: 10.5px !important;
    letter-spacing: 1px !important;
    font-weight: 600 !important;
    color: #94a3b8 !important;
    margin-bottom: 2px !important;
  }
  .topbar .depth b {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #f1f5f9 !important;
  }
  .topbar #health {
    height: 18px !important;
    border-radius: 3px !important;
  }
  .topbar .coins strong {
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    color: #f59e0b !important;
  }
}


/* scoreboard-servants:start */
/* Coordinates match the four subjects in scoreboard-monarch-v2.png. */
.monarch-art-container { width: 100%; height: auto; aspect-ratio: 300 / 520; }
.monarch-bg-img { position: absolute; inset: 0; }
.scoreboard-widget-box > .monarch-quote-bubble,
.scoreboard-widget-box > .servants-tablet {
  position: relative; inset: auto; margin: 8px; padding: 8px;
}
.ranked-servants { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.servant-nameplate {
  position: absolute; transform: translateX(-50%); max-width: 38%; box-sizing: border-box;
  display: flex; align-items: center; gap: 4px; padding: 3px 5px;
  background: rgba(13,15,23,.94); border: 1px solid #383446;
  border-radius: 3px; color: #e2e8f0; font: 10px/1.3 sans-serif;
  pointer-events: auto;
}
.servant-nameplate b { color: #fbbf24; flex: none; }
.servant-nameplate span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.servant-rank-2 { left: 30%; top: 57%; }
.servant-rank-3 { left: 72%; top: 57%; }
.servant-rank-4 { left: 25%; top: 71%; }
.servant-rank-5 { left: 75%; top: 71%; }
