:root {
  --bg: #0f1420;
  --panel: #171e2c;
  --panel-2: #1e2635;
  --border: #2a3346;
  --text: #e8ecf4;
  --muted: #8b96ab;
  --accent: #22c55e;
  --danger: #ef4444;
  --unclaimed: #2a3346;
  --gold: #f5c542;
  --gold-2: #fce8a8;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 20px;
  background: rgba(6, 6, 10, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(245, 197, 66, 0.05);
  flex: 0 0 auto;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.topbar-right {
  justify-content: flex-end;
}

.topbar-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  white-space: nowrap;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #fff;
  text-shadow: 0 0 20px rgba(245, 197, 66, 0.18);
}

.topbar-logo-icon {
  font-size: 18px;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 2px;
  flex-shrink: 0;
}

/* connection status pill — colour reflects live status */
.status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.status-chip.connected {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}
.status-chip.connecting {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}
.status-chip.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.status-chip.demo {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* streamer identity chip (shown once a username is saved) */
.streamer-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.streamer-chip.hidden {
  display: none;
}

.platform-account {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
}
.platform-account-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}
.platform-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.platform-logout-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.streamer-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  object-fit: cover;
}

.streamer-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  overflow: hidden;
}

.streamer-label {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.streamer-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

/* pill-shaped action buttons in the topbar */
.pill-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}
.pill-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(245, 197, 66, 0.4);
  filter: brightness(1.08);
}
.pill-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pill-icon {
  flex-shrink: 0;
  opacity: 0.95;
}
.pill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.pill-primary {
  background: linear-gradient(135deg, #3ee879, var(--accent) 65%);
  border-color: transparent;
  color: #06240f;
  box-shadow: 0 2px 14px rgba(34, 197, 94, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.pill-primary:hover:not(:disabled) {
  box-shadow: 0 4px 22px rgba(34, 197, 94, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.pill-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(239, 68, 68, 0.05));
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.pill-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.24), rgba(239, 68, 68, 0.08));
  box-shadow: 0 2px 16px rgba(239, 68, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.pill-gold {
  background: linear-gradient(135deg, var(--gold-2), var(--gold) 65%);
  border-color: transparent;
  color: #241a04;
  box-shadow: 0 2px 14px rgba(245, 197, 66, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.pill-gold:hover:not(:disabled) {
  box-shadow: 0 4px 22px rgba(245, 197, 66, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.icon-circle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.icon-circle-btn:hover {
  border-color: rgba(245, 197, 66, 0.4);
  box-shadow: 0 0 12px rgba(245, 197, 66, 0.3);
}

.toast-container {
  position: fixed;
  top: 70px;
  left: 20px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  max-width: 340px;
  background: linear-gradient(135deg, rgba(48, 24, 24, 0.95), rgba(13, 17, 28, 0.97));
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-left: 4px solid var(--danger);
  border-radius: 12px;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-24px) scale(0.94); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(-20px) scale(0.92); }
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.6));
}

#settingsPanel {
  right: 340px;
}

.settings-hint {
  margin: 10px 0 0 0;
  font-size: 12px;
  color: var(--muted);
}

.test-panel-btn {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 10px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.test-panel-btn:hover {
  border-color: rgba(245, 197, 66, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 14px rgba(245, 197, 66, 0.3);
}

.test-panel {
  position: fixed;
  top: 64px;
  right: 22px;
  z-index: 55;
  width: 280px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.test-panel.hidden {
  display: none;
}

.test-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.test-panel-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

.test-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.test-gift-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.test-gift-search input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.test-gift-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-x: hidden;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 2px;
}

.test-gift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.test-gift-card:hover {
  border-color: rgba(245, 197, 66, 0.5);
}
.test-gift-card.selected {
  border-color: var(--gold);
  background: rgba(245, 197, 66, 0.1);
  box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.35);
}
.test-gift-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  font-size: 17px;
}
.test-gift-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.test-gift-card-name {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.test-gift-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  padding: 14px 4px;
}

.rulers-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  min-height: 72px;
  background: rgba(6, 6, 10, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.rulers-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.4px;
  text-shadow: 0 0 12px rgba(245, 197, 66, 0.4);
}

.rulers-crown {
  font-size: 16px;
  filter: drop-shadow(0 0 6px rgba(245, 197, 66, 0.6));
}

.ruler-card {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-width: 0;
  scrollbar-width: none;
  cursor: grab;
}
.ruler-card:active {
  cursor: grabbing;
}

.ruler-card::-webkit-scrollbar {
  display: none;
}

.ruler-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 6px 16px 6px 6px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.14), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(245, 197, 66, 0.35);
  border-radius: 999px;
  box-shadow:
    0 4px 18px rgba(245, 197, 66, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ruler-empty {
  padding: 4px 10px;
  color: var(--muted);
  font-size: 13px;
}

.ruler-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.ruler-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.18), 0 2px 8px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.ruler-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4a3b1a, #241d10);
  color: var(--gold-2);
  font-weight: 800;
  font-size: 15px;
}

.ruler-rank-badge {
  position: absolute;
  left: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #b8860b);
  color: #241d05;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d0f18;
}

.ruler-crown-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  font-size: 15px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 5px rgba(245, 197, 66, 0.7));
}

.ruler-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  max-width: 130px;
}

.ruler-name {
  font-weight: 700;
  color: #fff;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ruler-handle {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ruler-points {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 12px;
  border-left: 1px solid rgba(245, 197, 66, 0.25);
}

.ruler-points-value {
  font-weight: 800;
  font-size: 16px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(245, 197, 66, 0.35);
  line-height: 1;
}

.ruler-points-label {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.rulers-manage-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid rgba(245, 197, 66, 0.3);
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px;
  cursor: pointer;
}
.rulers-manage-btn:hover {
  background: rgba(245, 197, 66, 0.14);
}

.rulers-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.rulers-modal-overlay.hidden {
  display: none;
}

.rulers-modal {
  width: 420px;
  max-width: 92vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #201a12, #14171f 55%);
  border: 1px solid rgba(245, 197, 66, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(245, 197, 66, 0.08);
  padding: 18px 18px 16px 18px;
}

/* --- full settings shell (sidebar + content), used by the big centered modal --- */
.settings-shell {
  width: 920px;
  max-width: 94vw;
  height: 660px;
  max-height: 90vh;
  display: flex;
  background: linear-gradient(160deg, #201a12, #14171f 55%);
  border: 1px solid rgba(245, 197, 66, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(245, 197, 66, 0.08);
  overflow: hidden;
}

.settings-sidebar {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.35);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 10px;
  overflow-y: auto;
}

.settings-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 14px 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 800;
  font-size: 15px;
  color: #fff;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: not-allowed;
  opacity: 0.45;
}

.settings-nav-item:not(:disabled) {
  cursor: pointer;
  opacity: 1;
}
.settings-nav-item:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.settings-nav-item.active {
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.18), rgba(245, 197, 66, 0.05));
  border: 1px solid rgba(245, 197, 66, 0.35);
  color: var(--gold-2);
  opacity: 1;
}

.settings-sidebar {
  display: flex;
  flex-direction: column;
}
.settings-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.settings-sidebar-footer {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-footer-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.5;
}
.sidebar-footer-btn-share {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
}

.settings-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-content-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}
.settings-content-topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-content-topbar-title h2 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}
.settings-content-topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.settings-cancel-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
}
.settings-cancel-btn:hover {
  color: var(--text);
}
.settings-save-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(124, 58, 237, 0.4);
}
.settings-save-btn:hover {
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.55);
}

.settings-content-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 24px 24px;
  display: flex;
  flex-direction: column;
}

.settings-section-intro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.settings-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.28), rgba(239, 68, 68, 0.1));
  font-size: 18px;
}
.settings-section-intro h3 {
  margin: 0 0 2px 0;
  font-size: 15px;
  color: #fff;
}
.settings-section-intro p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.settings-info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  font-size: 12.5px;
}
.settings-info-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  font-size: 12px;
}
.settings-info-box strong {
  color: #fca5a5;
  display: block;
  margin-bottom: 3px;
}
.settings-info-box p {
  margin: 0;
  color: #e8ecf4;
  line-height: 1.5;
}
.settings-info-box p strong {
  display: inline;
  color: #fca5a5;
  margin: 0;
}

.settings-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.settings-section-icon-like {
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.28), rgba(217, 70, 239, 0.1));
}

.settings-info-box-like {
  background: rgba(217, 70, 239, 0.08);
  border-color: rgba(217, 70, 239, 0.25);
}
.settings-info-box-like strong,
.settings-info-box-like p strong {
  color: #f0abfc;
}
.settings-info-icon-like {
  background: rgba(217, 70, 239, 0.22);
  color: #f0abfc;
}

.settings-section-icon-follow {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0.1));
}

.settings-info-box-follow {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.25);
}
.settings-info-box-follow strong,
.settings-info-box-follow p strong {
  color: #93c5fd;
}
.settings-info-icon-follow {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.follow-toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 460px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}
.follow-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.22);
  font-size: 16px;
}
.follow-toggle-meta { flex: 1; min-width: 0; }
.follow-toggle-meta strong { display: block; font-size: 13.5px; color: #fff; margin-bottom: 2px; }
.follow-toggle-meta p { margin: 0; font-size: 12px; color: var(--muted); }

.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 25px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background 0.2s ease;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}
.toggle-switch.on {
  background: linear-gradient(135deg, #60a5fa, #6366f1);
}
.toggle-switch.on::after {
  transform: translateX(19px);
}

.follow-amount-card {
  max-width: 460px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}
.follow-amount-card label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 7px;
}
.follow-amount-card .attack-amount-input { margin-bottom: 0; }
.follow-amount-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.settings-section-icon-game {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(168, 85, 247, 0.1));
}
.settings-info-box-game {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.25);
}
.settings-info-box-game strong,
.settings-info-box-game p strong {
  color: #d8b4fe;
}
.settings-info-icon-game {
  background: rgba(168, 85, 247, 0.22);
  color: #d8b4fe;
}

.game-settings-section-label {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 2px 0 8px;
}

.game-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  margin-bottom: 14px;
}

.game-settings-card {
  min-width: 0;
  box-sizing: border-box;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}

.game-settings-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.game-settings-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(168, 85, 247, 0.18);
  font-size: 15px;
}
.game-settings-card-meta { flex: 1; min-width: 0; }
.game-settings-card-meta strong { display: block; font-size: 13.5px; color: #fff; }
.game-settings-card-meta p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }

.game-settings-badge {
  flex-shrink: 0;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.22);
  color: #d8b4fe;
  font-size: 11.5px;
  font-weight: 800;
}

.game-settings-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  margin: 6px 0 8px;
}
.game-settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c084fc, #a855f7);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
  cursor: pointer;
}
.game-settings-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #c084fc, #a855f7);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
  cursor: pointer;
}

.game-settings-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
}

.token-ratio-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.token-ratio-field { flex: 1 1 0; min-width: 0; }
.token-ratio-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.token-ratio-field .attack-amount-input { margin-bottom: 0; }
.token-ratio-equals {
  flex-shrink: 0;
  padding-bottom: 11px;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 760px) {
  .game-settings-grid { grid-template-columns: 1fr; }
}

.like-power-row {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  max-width: 460px;
}
.like-power-field {
  flex: 1;
}
.like-power-field label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 7px;
}
.like-power-equals {
  flex-shrink: 0;
  padding-bottom: 11px;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}
.like-amount-input {
  margin-bottom: 0;
}

.settings-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 460px;
  margin-top: 18px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.attack-power-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  flex: 1;
  min-height: 0;
}

.attack-power-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.attack-power-form label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 7px;
}
.attack-power-form input[type="text"],
.attack-power-form input[type="number"] {
  margin-bottom: 14px;
}

.gift-picker-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.gift-picker-trigger:hover {
  border-color: rgba(245, 197, 66, 0.4);
}
.gift-picker-trigger-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  font-size: 15px;
  overflow: hidden;
}
.gift-picker-trigger-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gift-picker-trigger-icon.has-image {
  background: none;
}
#giftPickerTriggerText {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gift-picker-trigger-chevron {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--muted);
}

.attack-amount-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  min-width: 0;
}
.attack-amount-input input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
  padding: 0;
  margin: 0;
}

.attack-add-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(239, 68, 68, 0.4);
}
.attack-add-btn:hover {
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.55);
}

.gift-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 14, 0.75);
}
.gift-picker-overlay.hidden {
  display: none;
}

.gift-picker-modal {
  width: 560px;
  max-width: 92vw;
  height: 640px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #14171f, #0d0f18 60%);
  border: 1px solid rgba(245, 197, 66, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  padding: 18px;
}

.gift-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.gift-picker-head h2 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}

.gift-picker-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.gift-picker-search input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.gift-picker-grid {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-content: start;
}

.gift-picker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 30px 10px;
}

.gift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.gift-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 197, 66, 0.5);
}
.gift-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.35);
}

.gift-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  font-size: 26px;
}
.gift-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-card-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.gift-card-coin {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
}

.attack-power-rules {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.attack-power-rules h4 {
  margin: 0 0 10px 0;
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.attack-power-rules h4 span {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}

.gift-rules-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gift-rules-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.gift-rule-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  font-size: 18px;
  overflow: hidden;
}
.gift-rule-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-rule-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.3;
}
.gift-rule-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gift-rule-amount {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  font-size: 10.5px;
  color: #fca5a5;
  font-weight: 700;
}

.gift-rule-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.gift-rule-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}
.gift-rule-edit:hover {
  border-color: rgba(245, 197, 66, 0.4);
  color: var(--text);
}

@media (max-width: 720px) {
  .settings-shell { flex-direction: column; height: 88vh; }
  .settings-sidebar { flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; }
  .attack-power-grid { grid-template-columns: 1fr; }
}

.rulers-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rulers-modal-head h2 {
  margin: 0;
  font-size: 16px;
  color: var(--gold);
}

.rulers-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.rulers-manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rulers-manage-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 0;
}

.rulers-manage-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-shrink: 0;
}

.rulers-manage-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(245, 197, 66, 0.5);
}

.rulers-manage-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  color: var(--gold-2);
  font-weight: 700;
  font-size: 12px;
}

.rulers-manage-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.rulers-manage-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.stepper-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.stepper-btn:hover {
  border-color: var(--gold);
}

.stepper-value {
  width: 44px;
  text-align: center;
  padding: 4px 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper-value::-webkit-inner-spin-button,
.stepper-value::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rulers-manage-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  line-height: 1;
}
.rulers-manage-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
}

.rulers-add-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.rulers-add-form input[type="text"] {
  flex: 1;
  margin-bottom: 0;
}

.rulers-add-form .give-count-input {
  width: 58px;
}

.layout {
  display: flex;
  gap: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
}

.map-panel {
  flex: 3;
  position: relative;
  background: var(--panel);
  border: none;
  border-radius: 0;
  padding: 0;
  min-height: 0;
}

.map-standings {
  position: absolute;
  top: 24px;
  left: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 230px;
  max-height: 70%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  pointer-events: none;
}

.map-standings::-webkit-scrollbar {
  display: none;
}

.map-standings:empty {
  display: none;
}

.map-standings li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 13px;
  background:
    linear-gradient(135deg, rgba(40, 48, 70, 0.92), rgba(13, 17, 28, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 12px;
  overflow: hidden;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  animation: feedRowIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-standings li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--row-accent, #888);
  box-shadow: 0 0 10px 1px var(--row-accent, #888);
}

.map-standings li.removing {
  animation: feedRowOut 0.32s ease forwards;
}

@keyframes feedRowIn {
  from { opacity: 0; transform: translateX(-18px) scale(0.94); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes feedRowOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(-14px) scale(0.92); }
}

.feed-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 2px var(--row-accent, transparent), 0 2px 5px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

.feed-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.feed-name {
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 82px;
}

.feed-city {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  font-size: 11px;
}

.feed-city-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90px;
}

.feed-pin {
  font-size: 10px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.5));
}

.leaders-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  min-height: 72px;
  background: rgba(6, 6, 10, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

#leadersRow {
  max-width: none;
}

.avatar-context-trigger {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

#map {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#map:active {
  cursor: grabbing;
}

.map-total-stat {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  background: rgba(13, 17, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.map-total-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
  white-space: nowrap;
}

.map-total-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.4px;
}

.map-zoom-hint {
  position: absolute;
  left: 24px;
  bottom: 16px;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

.region {
  fill: var(--unclaimed);
  stroke: #0f1420;
  stroke-width: 1;
  transition: fill 0.15s ease;
}

.region-label {
  fill: #cfd6e4;
  font-size: 9px;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: #0f1420;
  stroke-width: 2px;
}

#avatarLayer {
  pointer-events: none;
}

.avatar-marker {
  transform-box: fill-box;
  transform-origin: center;
  animation: avatarBreathe 2.6s ease-in-out infinite;
}

@keyframes avatarBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.avatar-ring {
  fill: none;
  stroke-width: 2.5px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

.avatar-initial {
  fill: #fff;
  font-size: 14px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"] {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
}

.give-count-input {
  width: 64px;
  flex-shrink: 0;
  padding: 9px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  text-align: center;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

button {
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text);
}

button.primary {
  background: var(--accent);
  color: #06240f;
  border-color: var(--accent);
  flex: 1;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
  flex: 1;
}

button.ghost {
  width: 100%;
  background: transparent;
  color: var(--muted);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hidden { display: none !important; }

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-top: 10px;
}

.row input { margin: 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 8px 0 0 0;
}

.color-picker-hidden {
  position: fixed;
  top: -100px;
  left: -100px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: none;
  padding: 0;
}

/* --- avatar context menu: color / photo / block, opens on avatar click --- */
.avatar-context-menu {
  position: fixed;
  z-index: 70;
  min-width: 210px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.avatar-context-menu.hidden { display: none; }

.avatar-context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.avatar-context-item:hover { background: var(--panel-2); }
.avatar-context-icon { font-size: 14px; flex-shrink: 0; }

.avatar-context-item-danger { color: #fca5a5; }
.avatar-context-item-danger:hover { background: rgba(239, 68, 68, 0.14); }

.settings-section-icon-blocked {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.28), rgba(239, 68, 68, 0.1));
}

.region {
  cursor: pointer;
}

.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.3s ease;
}

.win-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.win-crown {
  font-size: 40px;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 14px rgba(245, 197, 66, 0.7));
}

.win-title {
  margin: 0 0 26px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(245, 197, 66, 0.6);
}

.win-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--panel-2);
  background-size: cover;
  background-position: center;
  border: 4px solid var(--gold);
  box-shadow: 0 0 40px rgba(245, 197, 66, 0.6);
  margin-bottom: 18px;
}

.win-name {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.win-handle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

.win-points-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 44px;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--gold-2), var(--gold));
  box-shadow: 0 0 34px rgba(245, 197, 66, 0.5);
}

.win-points-value {
  font-size: 24px;
  font-weight: 900;
  color: #241a04;
}

.win-points-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #241a04;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- protection ("qoruma") countdown overlay: fires when someone owns all
   regions but hasn't won yet — others can still break it via likes/gifts --- */
.protection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  animation: fadeIn 0.3s ease;
}
.protection-overlay.hidden { display: none; }

.protection-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.protection-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--panel-2);
  background-size: cover;
  background-position: center;
  border: 3px solid #ec4899;
  box-shadow: 0 0 30px rgba(236, 72, 153, 0.6);
  margin-bottom: 14px;
}

.protection-name {
  font-size: 20px;
  font-weight: 800;
  color: #ec4899;
  margin-bottom: 16px;
}

.protection-shield-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1.5px solid #22c55e;
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.35);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 26px;
}
.protection-shield-pill #protectionValue { color: #22c55e; }
.protection-shield-icon { font-size: 16px; }

.protection-countdown {
  font-size: 64px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  transition: color 0.4s ease, transform 0.4s ease;
}
.protection-countdown.slow {
  color: var(--danger);
  animation: protectionPulse 1.5s ease-in-out infinite;
}

/* Performans Modu: zəif kompüterlər üçün animasiyaları/keçidləri söndürür */
body.performance-mode *,
body.performance-mode *::before,
body.performance-mode *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@keyframes protectionPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
