*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --clr-bg-start: #0b0e1a;
  --clr-bg-end:   #0f1c2e;
  --clr-surface:  rgba(255, 255, 255, 0.055);
  --clr-border:   rgba(255, 255, 255, 0.12);
  --clr-text:     #e8edf5;
  --clr-muted:    #8b96aa;
  --clr-discord:  #5865f2;
  --clr-discord-h:#6872f5;
  --clr-primary:  #2f80ed;
  --clr-primary-h:#4390f7;
  --clr-ok:       #3dd68c;
  --clr-error:    #f87171;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--clr-bg-start) 0%, var(--clr-bg-end) 100%);
  color: var(--clr-text);
  overflow: hidden;
  position: relative;
}

/* ── animated background orbs ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-1 { width: 520px; height: 520px; background: #5865f2; top: -120px; left: -100px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: #2f80ed; bottom: -80px; right: -60px; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: #7c3aed; top: 40%; left: 55%; animation-delay: -12s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.08); }
}

/* ── card ── */
.card {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 2rem));
  padding: 2.5rem 2.25rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255,255,255,0.06) inset;
  text-align: center;
}

/* ── logo ── */
.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.logo-icon {
  width: 48px;
  height: 48px;
  color: var(--clr-primary);
  filter: drop-shadow(0 0 12px rgba(47,128,237,0.55));
}

/* ── titles ── */
.app-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #a0b4d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.925rem;
  color: var(--clr-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

/* ── user badge ── */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--clr-border);
  border-radius: 40px;
  padding: 0.4rem 1rem 0.4rem 0.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.925rem;
  font-weight: 500;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-discord));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  flex-shrink: 0;
}

/* ── status banners ── */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-ok  { background: rgba(61,214,140,0.12); color: var(--clr-ok);   border: 1px solid rgba(61,214,140,0.25); }
.status-ok .status-dot  { background: var(--clr-ok);   box-shadow: 0 0 6px var(--clr-ok); }
.status-error { background: rgba(248,113,113,0.12); color: var(--clr-error); border: 1px solid rgba(248,113,113,0.25); }
.status-error .status-dot { background: var(--clr-error); box-shadow: 0 0 6px var(--clr-error); }

/* ── buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
  margin-bottom: 0.65rem;
  cursor: pointer;
}

.btn:active { transform: scale(0.975); }

.btn-discord {
  background: var(--clr-discord);
  color: #fff;
  box-shadow: 0 4px 20px rgba(88,101,242,0.4);
}
.btn-discord:hover {
  background: var(--clr-discord-h);
  box-shadow: 0 4px 28px rgba(88,101,242,0.6);
}

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(47,128,237,0.35);
}
.btn-primary:hover {
  background: var(--clr-primary-h);
  box-shadow: 0 4px 28px rgba(47,128,237,0.55);
}

.btn-muted {
  background: rgba(255,255,255,0.08);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}
.btn-muted:hover {
  background: rgba(255,255,255,0.13);
}

.btn-ghost {
  background: transparent;
  color: var(--clr-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem;
  margin-bottom: 0;
}
.btn-ghost:hover {
  color: var(--clr-text);
}

/* ── discord logo inside button ── */
.discord-logo {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── reused utility classes ── */
.ok    { color: var(--clr-ok); }
.error { color: var(--clr-error); }
.small { font-size: 0.875rem; color: var(--clr-muted); line-height: 1.6; }

/* ── map page ── */
body.map-page {
  display: block;
  overflow: hidden;
  height: 100vh;
}

.map-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: rgba(11, 14, 26, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--clr-border);
  gap: 1rem;
}

.map-header-left,
.map-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.map-back {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-muted);
  transition: color 0.15s;
  flex-shrink: 0;
}
.map-back:hover { color: var(--clr-text); }
.map-back svg { width: 20px; height: 20px; }

.map-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.map-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--clr-muted);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

.map-coords {
  font-size: 0.8rem;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  color: var(--clr-muted);
  min-width: 130px;
  text-align: right;
  white-space: nowrap;
}

.map-user-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.map-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-discord));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  flex-shrink: 0;
}

.map-signout {
  display: flex;
  align-items: center;
  color: var(--clr-muted);
  transition: color 0.15s;
  flex-shrink: 0;
}
.map-signout:hover { color: var(--clr-error); }
.map-signout svg { width: 18px; height: 18px; }

/* zoom controls */
.map-controls {
  position: fixed;
  bottom: 1.5rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.map-ctrl-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  background: rgba(11, 14, 26, 0.82);
  backdrop-filter: blur(10px);
  color: var(--clr-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.map-ctrl-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.map-ctrl-btn svg { width: 16px; height: 16px; }

/* viewport + scene */
.map-viewport {
  position: fixed;
  inset: 52px 0 0 0;
  overflow: hidden;
  cursor: grab;
  background: #0b0e1a;
  user-select: none;
  -webkit-user-select: none;
}

.map-scene {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-img {
  display: block;
  max-width: none;
  pointer-events: none;
  image-rendering: auto;
}

/* forward-compat for container class used in other pages */
.container {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 2rem));
  padding: 2.5rem 2.25rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.45);
}

.container h1 {
  margin-top: 0;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.container p { line-height: 1.6; margin-bottom: 0.75rem; }

.container .button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0.5rem 0 0;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  text-decoration: none;
  background: var(--clr-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.18s ease;
}
.container .button:hover { background: var(--clr-primary-h); }
.container .button.muted { background: rgba(255,255,255,0.08); border: 1px solid var(--clr-border); color: var(--clr-text); }
.container .button.muted:hover { background: rgba(255,255,255,0.14); }

/* ── page layout (guilds + manage pages) ── */
.page-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 1.5rem 3rem;
  min-height: 100vh;
}

.form-wrap {
  max-width: 520px;
}

.page-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
  background: rgba(11, 14, 26, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--clr-border);
}

/* ── buttons (sm variants) ── */
.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-sm.btn-primary  { background: var(--clr-primary);  color: #fff; }
.btn-sm.btn-primary:hover { background: var(--clr-primary-h); }
.btn-sm.btn-muted    { background: rgba(255,255,255,0.08); color: var(--clr-text); border: 1px solid var(--clr-border); }
.btn-sm.btn-muted:hover   { background: rgba(255,255,255,0.14); }

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--clr-muted);
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover       { color: var(--clr-text); background: rgba(255,255,255,0.07); }
.btn-icon-danger:hover { color: var(--clr-error) !important; }

.inline-form { display: inline; }

/* ── flash messages ── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.flash-ok    { background: rgba(61,214,140,0.12); color: var(--clr-ok);   border: 1px solid rgba(61,214,140,0.25); }
.flash-error { background: rgba(248,113,113,0.12); color: var(--clr-error); border: 1px solid rgba(248,113,113,0.25); }

/* ── my guild banner ── */
.guild-my-card {
  background: rgba(47,128,237,0.1);
  border: 1px solid rgba(47,128,237,0.3);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.guild-my-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.guild-my-name { font-size: 1.15rem; font-weight: 700; margin: 0.15rem 0; }
.guild-my-role { font-size: 0.85rem; color: var(--clr-muted); }

/* ── guild tag pill ── */
.guild-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--clr-muted);
  white-space: nowrap;
}

.guild-tag-sm { font-size: 0.7rem; padding: 0.1rem 0.35rem; }

/* ── guild list ── */
.guild-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.guild-list-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guild-count {
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 0.1rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-muted);
}

.guild-empty {
  text-align: center;
  color: var(--clr-muted);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.guild-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  transition: border-color 0.15s;
}
.guild-card:hover { border-color: rgba(255,255,255,0.25); }

.guild-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.guild-member-badge {
  font-size: 0.75rem;
  color: var(--clr-muted);
}

.guild-card-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.guild-card-desc {
  font-size: 0.85rem;
  color: var(--clr-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── manage grid ── */
.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.manage-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
}

.manage-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-muted);
  margin-bottom: 1rem;
}

.manage-card-wide {
  grid-column: 1 / -1;
}

/* ── relationships ── */
.rel-group { margin-bottom: 1rem; }

.rel-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clr-muted);
  margin-bottom: 0.35rem;
}

.rel-empty { font-size: 0.85rem; color: var(--clr-muted); padding-left: 0.25rem; }

.rel-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.rel-remove-form { margin-left: auto; }

.rel-add-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--clr-border);
}

.rel-add-form select {
  flex: 1;
  min-width: 120px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  color: var(--clr-text);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

/* ── form styles ── */
.form-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--clr-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  color: var(--clr-text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--clr-primary);
}

.form-group small {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--clr-muted);
}

.form-errors {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--clr-error);
  line-height: 1.6;
}

.req { color: var(--clr-error); }

/* ── roster table ── */
.roster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.roster-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0 !important;
}

.add-player-form {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--clr-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.add-player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.add-player-grid .form-group { margin-bottom: 0; }

.roster-table-wrap {
  overflow-x: auto;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.roster-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clr-muted);
  border-bottom: 1px solid var(--clr-border);
  white-space: nowrap;
}

.roster-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}

.roster-table tbody tr:last-child td { border-bottom: none; }
.roster-table tbody tr:hover td { background: rgba(255,255,255,0.03); }

.roster-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
  white-space: nowrap;
}

.roster-empty {
  text-align: center;
  color: var(--clr-muted);
  padding: 2rem;
}

.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.role-owner   { background: rgba(251,189,35,0.15);  color: #fbd923; }
.role-officer { background: rgba(47,128,237,0.15);  color: #60a5fa; }
.role-member  { background: rgba(255,255,255,0.07); color: var(--clr-muted); }

.guild-actions { display: flex; gap: 0.5rem; }

/* ═══════════════════════════════════════════════════════════
   ONE-PAGE MAP APP — header, panels, tools, search, modals
   ═══════════════════════════════════════════════════════════ */

/* ── Map page body ── */
body.map-page {
  overflow: hidden;
  background: #0b0e1a;
  display: block;
  align-items: unset;
  justify-content: unset;
}

/* ── Map header ── */
.map-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  background: rgba(11, 14, 26, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--clr-border);
}
.map-header-left  { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.map-header-center { flex: 0 0 auto; }
.map-header-right { display: flex; align-items: center; gap: 0.35rem; flex: 1; justify-content: flex-end; }

.site-brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #7c3aed, #2f80ed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.map-badge {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-muted);
  white-space: nowrap;
}

.map-coords {
  font-size: 0.78rem;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  color: var(--clr-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  padding: 0.15rem 0.6rem;
  min-width: 110px;
  text-align: center;
}

.hdr-sep {
  width: 1px;
  height: 20px;
  background: var(--clr-border);
  margin: 0 0.2rem;
}

.hdr-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--clr-muted);
  padding: 0.35rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.hdr-icon-btn svg { width: 18px; height: 18px; }
.hdr-icon-btn:hover { color: var(--clr-text); background: rgba(255,255,255,0.08); }

/* ── Annotation tool buttons ── */
.tool-group {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: 0.25rem;
}
.tool-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--clr-muted);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { color: var(--clr-text); background: rgba(255,255,255,0.08); }
.tool-btn.active { color: var(--clr-primary); background: rgba(47,128,237,0.15); }

.color-swatch {
  width: 26px; height: 26px;
  border: 2px solid var(--clr-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
  margin-left: 0.2rem;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 4px; }

/* ── Map user chip ── */
.map-user-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--clr-border);
  border-radius: 20px;
  padding: 0.2rem 0.65rem 0.2rem 0.3rem;
}
.map-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--clr-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.map-uname { font-size: 0.82rem; color: var(--clr-text); white-space: nowrap; }

/* ── Map viewport ── */
.map-viewport {
  position: fixed;
  top: 52px; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  cursor: grab;
}
.map-scene {
  position: absolute;
  transform-origin: 0 0;
  will-change: transform;
}
.map-img {
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}
.annot-svg {
  position: absolute;
  top: 0; left: 0;
  pointer-events: all;
  overflow: visible;
}
.ann-selected { filter: drop-shadow(0 0 6px #fff8); }

/* ── Map controls (zoom) ── */
.map-controls {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.map-ctrl-btn {
  width: 38px; height: 38px;
  background: rgba(15,20,38,0.9);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  color: var(--clr-text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  backdrop-filter: blur(8px);
}
.map-ctrl-btn svg { width: 18px; height: 18px; }
.map-ctrl-btn:hover { background: rgba(47,128,237,0.2); }

/* ── Search ── */
.header-search { position: relative; display: flex; align-items: center; }
.search-input {
  width: 0; overflow: hidden; opacity: 0;
  background: rgba(255,255,255,0.07);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--clr-text);
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
  outline: none;
  transition: width 0.2s, opacity 0.2s, border-color 0.2s;
}
.search-input.search-input-open {
  width: 200px; opacity: 1;
  border-color: var(--clr-border);
}
.search-input:focus { border-color: var(--clr-primary); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  background: #141826;
  border: 1px solid var(--clr-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 300;
  overflow: hidden;
  max-height: 360px;
  overflow-y: auto;
}
.sr-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.88rem;
}
.sr-item:last-child { border-bottom: none; }
.sr-name { font-weight: 600; flex: 1; }
.sr-meta { font-size: 0.78rem; color: var(--clr-muted); white-space: nowrap; }
.sr-empty { padding: 1rem; text-align: center; color: var(--clr-muted); font-size: 0.88rem; }

/* ── Side panels ── */
.panel-backdrop {
  position: fixed;
  inset: 52px 0 0;
  background: rgba(0,0,0,0.45);
  z-index: 290;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.panel-backdrop.visible { opacity: 1; pointer-events: all; }

.side-panel {
  position: fixed;
  top: 52px; left: 0; bottom: 0;
  width: min(340px, 92vw);
  background: #0f1325;
  border-right: 1px solid var(--clr-border);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}
.side-panel.open { transform: translateX(0); }
.side-panel-right {
  left: auto; right: 0;
  border-right: none;
  border-left: 1px solid var(--clr-border);
  transform: translateX(105%);
}
.side-panel-right.open { transform: translateX(0); }

.panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 48px;
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}
.panel-title { font-weight: 700; font-size: 0.95rem; }
.panel-close {
  background: none; border: none; cursor: pointer;
  color: var(--clr-muted); font-size: 1.4rem; line-height: 1;
  padding: 0.1rem 0.3rem; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.panel-close:hover { color: var(--clr-text); background: rgba(255,255,255,0.08); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.panel-loading { color: var(--clr-muted); font-size: 0.9rem; padding: 1rem 0; }
.panel-err     { color: var(--clr-error);  font-size: 0.9rem; padding: 1rem 0; }
.panel-note    { color: var(--clr-muted);  font-size: 0.88rem; margin-bottom: 0.75rem; }

/* ── Guild panel content ── */
.guild-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.guild-desc-text { font-size: 0.85rem; color: var(--clr-muted); margin-bottom: 0.75rem; line-height: 1.5; }

/* ── Tab navigation ── */
.tab-nav {
  display: flex;
  gap: 0.2rem;
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: 1rem;
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--clr-primary); border-bottom-color: var(--clr-primary); }
.tab-btn:hover:not(.active) { color: var(--clr-text); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Settings sections ── */
.settings-section { margin-bottom: 1.5rem; }
.settings-section h4 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--clr-muted); margin-bottom: 0.75rem; }
.settings-hint { font-size: 0.8rem; color: var(--clr-muted); margin-bottom: 0.75rem; line-height: 1.5; }
.settings-hint code {
  background: rgba(255,255,255,0.08); border-radius: 4px;
  padding: 0.1rem 0.3rem; font-size: 0.82em;
}

/* ── Profile cards ── */
.profile-section-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--clr-muted); margin-bottom: 0.5rem;
}
.profile-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s;
}
.profile-card:hover { border-color: rgba(255,255,255,0.2); }
.profile-active { border-color: var(--clr-primary) !important; }
.profile-card-top { display: flex; align-items: center; justify-content: space-between; }
.profile-name { font-weight: 600; font-size: 0.9rem; }
.profile-actions { display: flex; gap: 0.2rem; align-items: center; }
.profile-actions .btn-icon.active { color: var(--clr-primary); }
.w-full { width: 100%; }

/* ── Save indicator ── */
.save-indicator {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(15,20,38,0.95);
  border: 1px solid var(--clr-border);
  border-radius: 20px;
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  color: var(--clr-muted);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(8px);
}
.save-indicator.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Modals ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 490;
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  background: #141826;
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 1.5rem;
  width: min(360px, 90vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  color: var(--clr-text);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: var(--clr-primary); }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.rel-section { margin-bottom: 0.5rem; }

/* ── Misc responsive ── */
@media (max-width: 600px) {
  .map-uname { display: none; }
  .search-input.search-input-open { width: 130px; }
  .tool-group { gap: 0.1rem; padding: 0.2rem; }
  .tool-btn { width: 26px; height: 26px; }
  .tool-btn svg { width: 14px; height: 14px; }
}
