/* ----- Habdew (main.css) ----- */

@font-face {
  font-family: "Volter";
  src: url("../fonts/Volter__28Goldfish_29.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-volter: "Volter", system-ui, sans-serif;
  --nav-h: 70px;
  --header-blue: rgba(26, 42, 68, 0.85);
  --color-surface: #fffcf5;
  --color-ink: #2c2416;
  --color-ink-muted: #5c5346;
  --color-accent: #3d6b2e;
  --color-accent-hover: #2d501f;
  --shadow-soft: 0 4px 24px rgba(44, 36, 22, 0.08);
  --radius: 12px;
}

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

body {
  margin: 0;
  font-family: var(--font-volter);
  background: #1a2a44;
  overflow-x: hidden;
}

/* ----- Header ----- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 3000;
  height: var(--nav-h);
  background: var(--header-blue);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
}

.site-header__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  position: relative;
}

.nav {
  display: flex;
  gap: 2rem;
}

.nav__link {
  color: #ffffff;
  text-decoration: none;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  transition: opacity 0.2s;
}

.nav__link:hover {
  opacity: 0.7;
}

.nav__link--active {
  border-bottom: 2px solid #fff;
}

.nav__link[data-auth-nav="1"] {
  visibility: hidden;
}

body.auth-state-ready .nav__link[data-auth-nav="1"] {
  visibility: visible;
}

.site-header__actions {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}

.site-header__actions.is-visible {
  display: block;
}

.site-header__logout {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
  font-family: var(--font-volter);
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .site-header__inner {
    justify-content: flex-start;
    padding: 0 0.75rem;
  }

  .nav {
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
  }

  .nav__link {
    font-size: 0.72rem;
    padding: 0.4rem 0.45rem;
    white-space: nowrap;
  }

  .site-header__actions {
    position: static;
    transform: none;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 0.35rem;
  }

  .site-header__actions.is-visible {
    display: flex;
    align-items: center;
  }

  .site-header__logout {
    font-size: 0.72rem;
    padding: 0.3rem 0.45rem;
    white-space: nowrap;
  }

  .site-header__inner {
    display: flex;
    align-items: center;
  }
}

.nav-toggle {
  display: none;
  border: 0;
  background: transparent;
  color: #fff;
}

/* ----- Hero ----- */

.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.hero__layer {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  image-rendering: pixelated;
}

.hero__layer--bg {
  z-index: 1;
  background-image: url("../assets/images/hero/HabdewBackground.png");
}

.hero__layer--front {
  z-index: 3;
  background-image: url("../assets/images/hero/HabdewFrontLayer.png");
  transition: opacity 0.75s ease;
}

.hero__logo-container {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 100%;
  display: flex;
  justify-content: center;
  transition: transform 1.05s cubic-bezier(0.33, 0.88, 0.32, 1);
}

.hero__logo {
  width: 480px;
  height: auto;
  image-rendering: pixelated;
}

/* ----- Clouds ----- */

.hero__cloud-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.hero__cloud-layer .cloud {
  position: absolute;
  image-rendering: pixelated;
  opacity: 0.5;
}

@keyframes cloud-drift {
  from { left: -30%; }
  to   { left: 110%; }
}

.cloud-1 { top: 10%; animation: cloud-drift 90s linear infinite; animation-delay: -10s; }
.cloud-2 { top: 25%; animation: cloud-drift 70s linear infinite; animation-delay: -40s; }
.cloud-3 { top: 40%; animation: cloud-drift 120s linear infinite; animation-delay: -70s; }
.cloud-4 { top: 15%; animation: cloud-drift 100s linear infinite; animation-delay: -20s; }
.cloud-5 { top: 5%;  animation: cloud-drift 60s linear infinite; animation-delay: -80s; }

/* ----- Home → map transition ----- */

@keyframes hero-logo-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.12); }
}

.hero.hero--map-transition .hero__layer--front {
  opacity: 0;
  pointer-events: none;
}

.hero.hero--map-transition .hero__logo-container {
  transform: translate(-50%, min(38vh, 360px));
}

.hero.hero--map-transition .hero__logo {
  animation: hero-logo-pulse 1.6s ease-in-out infinite;
}

/* ----- Page exit ----- */

body {
  transition: opacity 0.5s ease;
}

body.page-exit {
  opacity: 0;
  pointer-events: none;
}

/* ----- Home fade-in ----- */

.hero {
  animation: hero-fade-in 0.6s ease forwards;
}

@keyframes hero-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ----- Cards / panels ----- */

.panel {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 1.75rem) clamp(1.15rem, 3.5vw, 1.5rem);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(44, 36, 22, 0.06);
  margin-bottom: 1.25rem;
}

.panel h2 {
  font-family: var(--font-volter);
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: normal;
  margin: 0 0 0.75rem;
}

.panel p {
  margin: 0;
  color: var(--color-ink-muted);
}

.grid-2 {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ----- Forms ----- */

.form-stack {
  max-width: min(380px, 100%);
  margin: 0 auto;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: normal;
  font-size: clamp(0.8rem, 2.5vw, 0.875rem);
  margin-bottom: 0.35rem;
  color: var(--color-ink);
}

.field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-volter);
  font-size: 1rem;
  border: 1px solid rgba(44, 36, 22, 0.15);
  border-radius: 8px;
  background: #fff;
  color: var(--color-ink);
}

.field input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
  font-family: var(--font-volter);
  font-size: 1rem;
  font-weight: normal;
  color: #fff;
  background: var(--color-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

.form-note {
  margin-top: 1rem;
  font-size: clamp(0.8rem, 2.5vw, 0.875rem);
  color: var(--color-ink-muted);
  text-align: center;
}

/* ----- Auth page ----- */

.auth-page {
  color: var(--color-ink);
}

.auth-main {
  position: relative;
  min-height: 100vh;
  padding: calc(var(--nav-h) + 1rem) 1rem 2rem;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-shell {
  position: relative;
  z-index: 2;
  max-width: 420px;
  margin: 40px auto 0;
  opacity: 0;
}

.auth-page.auth-ready .auth-shell {
  opacity: 1;
  transition: opacity 0.35s ease;
}

.auth-card {
  padding-top: 0.75rem;
}

.auth-header {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.auth-tab {
  border: 0;
  background: transparent;
  color: #fff;
  font-family: var(--font-volter);
  font-size: 0.95rem;
  padding: 0.25rem 0.75rem 0.4rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.auth-tab.is-active {
  border-color: #fff;
}

.auth-views {
  position: relative;
}

.auth-view {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  inset: 0;
  transition: opacity 0.25s ease;
}

.auth-view.is-active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}

.auth-alert {
  margin: 0.8rem 0 0.8rem;
  color: #b3261e;
  font-size: 0.8rem;
  font-weight: bold;
  flex-direction: column;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.25;
}

.auth-alert__icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.auth-alert__text {
  display: block;
}

.auth-secondary-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(44, 36, 22, 0.2);
  background: #fff;
  color: var(--color-ink);
  font-family: var(--font-volter);
  font-size: 0.9rem;
  cursor: pointer;
}

.auth-secondary-btn:hover {
  background: #f8f2e4;
}

.auth-step {
  margin-top: 0.75rem;
}

.auth-check.is-fading-out {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.auth-instructions {
  margin: 0 0 0.4rem;
  color: var(--color-ink-muted);
  margin-bottom: 50px;
}

.auth-code {
  margin: 0.35rem 0 0.85rem;
  font-size: 1rem;
  font-weight: bold;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(44, 36, 22, 0.15);
  border-radius: 8px;
  background: #fff;
  color: var(--color-ink);
  margin-top: 50px;
}

.auth-step .btn-primary {
  margin-top: 50px;
}

.auth-check .btn-primary {
  margin-bottom: 0.75rem;
}

.auth-status {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--color-ink-muted);
}

.auth-status.is-error {
  color: #b3261e;
  font-weight: bold;
}

.auth-status--login {
  margin-top: 0.6rem;
  text-align: center;
  min-height: 1.1em;
}

.auth-status.is-success {
  color: #2e7d32;
}

.profile-shell {
  position: relative;
  z-index: 2;
  max-width: 520px;
  margin: 40px auto 0;
  opacity: 0;
}

.profile-page.wiki-ready .profile-shell {
  opacity: 1;
  transition: opacity 0.35s ease;
}

.profile-card {
  display: grid;
  gap: 0.9rem;
  text-align: center;
}

.profile-name {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-ink);
  font-weight: normal;
}

.profile-avatar-wrap {
  display: grid;
  place-items: center;
}

.profile-avatar-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(44, 36, 22, 0.15);
  box-shadow: var(--shadow-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.profile-avatar-circle img {
  width: 140%;
  height: 140%;
  object-fit: contain;
  image-rendering: pixelated;
}

.profile-body {
  margin: 0;
  color: var(--color-ink-muted);
}

/* ----- Profile card ----- */

.pc {
  width: max-content;
  min-width: 300px;
  max-width: 420px;
  font-family: var(--font-volter), "Courier New", monospace;
  image-rendering: pixelated;
  background: #3d3d3d;
  border: 2px solid #222;
  border-radius: 10px;
  box-shadow: 4px 4px 0 #000, inset 0 0 0 1px #525252;
  overflow: hidden;
  margin: 0 auto;
}

.pc-banner {
  background: #4a4a4a;
  border-bottom: 2px solid #222;
  padding: 10px 32px 34px;
  text-align: center;
  position: relative;
}

.pc-name {
  font-size: 24px;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  letter-spacing: 1px;
  line-height: 1.3;
}

.pc-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-top: -36px;
  padding-bottom: 6px;
  position: relative;
  z-index: 2;
  background: #656565;
}

.pc-avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #222;
  box-shadow: 0 0 0 2px #888, 0 3px 10px #0008;
  background: #3d3d3d;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-avatar-circle img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 150%;
  height: 150%;
  object-fit: contain;
  display: block;
}

.pc-motto {
  font-size: 13px;
  color: #f0f0f0;
  text-align: center;
  padding: 6px 14px 10px;
  line-height: 1.8;
  background: #656565;
  border-bottom: 2px solid #222;
}

.pc-shop {
  padding: 8px 8px 10px;
  background: #3d3d3d;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pc-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #2e2e2e;
  border: 1px solid #525252;
  border-radius: 4px;
  padding: 8px 10px;
  white-space: nowrap;
}

.pc-item-label {
  font-size: 13px;
  color: #f0f0f0;
  text-align: center;
  line-height: 1.5;
}

.pc-item-label.gold {
  color: #f5c518;
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: -2px;
  position: relative;
  z-index: 6;
  max-width: 100%;
  padding: 0 4px;
}

.profile-tab {
  width: 55px;
  height: 55px;
  border: 2px solid #b56c27;
  border-radius: 8px;
  background: #f6c57a;
  padding: 4px;
  cursor: pointer;
  image-rendering: pixelated;
  transform: translateY(6px) scale(0.94);
  opacity: 0.88;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  z-index: 1;
}

.profile-tab img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.profile-tab.is-active {
  z-index: 3;
  transform: translateY(0) scale(1.03);
  opacity: 1;
  box-shadow: inset 0 0 0 2px #ffeaac;
  animation: profile-tab-pop 0.35s ease;
}

@keyframes profile-tab-pop {
  0% { transform: translateY(5px) scale(0.96); }
  55% { transform: translateY(-2px) scale(1.06); }
  100% { transform: translateY(0) scale(1.03); }
}

.profile-leaderboard-shop {
  overflow: visible;
}

.profile-lb-subtitle {
  margin: 0 0 10px;
  font-size: 12px;
  color: #f5c518;
  text-align: center;
  font-weight: bold;
  text-shadow: 1px 1px 0 #000;
}

.profile-lb-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}

.profile-lb-mode {
  font-family: var(--font-volter), "Courier New", monospace;
  font-size: 14px;
  padding: 6px 8px;
  border: 2px solid #b56c27;
  border-radius: 4px;
  background: #f4ca8a;
  color: #000000;
  cursor: pointer;
  box-shadow: 2px 2px 0 #111;
  image-rendering: pixelated;
}

.profile-lb-mode:hover {
  border-color: #f5c518;
  color: #fff;
}

.profile-lb-mode.is-active {
  background: #4e7a3f;
  border-color: #87a976;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 2px 2px 0 #111;
}

.profile-lb-mode:focus-visible {
  outline: 2px solid #f5c518;
  outline-offset: 2px;
}

.profile-lb-loading,
.profile-lb-empty,
.profile-lb-error {
  margin: 10px 0;
  font-size: 12px;
  text-align: center;
  color: #ccc;
}

.profile-lb-error {
  color: #ffb4a8;
}

.profile-lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 2rem;
}

.profile-lb-row {
  display: grid;
  grid-template-columns: 28px 40px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #2e2e2e;
  border: 1px solid #525252;
  border-radius: 4px;
}

.profile-lb-rank {
  font-size: 13px;
  font-weight: bold;
  color: #aaa;
  text-align: center;
}

.profile-lb-rank--top {
  color: #f5c518;
}

.profile-lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 2px solid #b56c27;
  background: #1a1a1a;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.profile-lb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
}

.profile-lb-name {
  font-size: 14px;
  color: #f0f0f0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-lb-stat {
  font-size: 14px;
  font-weight: bold;
  color: #f5c518;
  text-align: right;
  white-space: nowrap;
}

.profile-panels {
  position: relative;
}

.profile-panel {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  position: absolute;
  inset: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.profile-panel.is-active {
  position: relative;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.profile-inventory {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.profile-slot {
  height: 44px;
  border: 1px solid #b56c27;
  background: #f4ca8a;
  box-shadow: inset 0 0 0 2px rgba(255, 236, 178, 0.6);
  border-radius: 4px;
}

.profile-section-title {
  margin: 0 0 8px;
  color: #f0f0f0;
  font-size: 13px;
  text-align: center;
}

.profile-main-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.profile-balance {
  color: #f5c518;
}

.profile-panel .pc-avatar-wrap {
  margin-top: 0;
  padding-top: 10px;
}

.profile-panel .pc-motto {
  padding-top: 10px;
  padding-bottom: 12px;
}

.profile-level-row {
  justify-content: flex-start;
  gap: 10px;
}

.profile-level-row img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-panel[data-profile-panel="badges"] > .pc {
  overflow: visible;
}

.profile-badges-shop {
  overflow: visible;
}

.profile-badges-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
}

.profile-badges-search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.52rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #888;
  background: #656565;
  color: #fff;
  font-family: var(--font-volter), "Courier New", monospace;
  font-size: 0.9rem;
}

.profile-badges-search::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.profile-badges-search:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* ----- Search clear (wiki + profile) ----- */
.wiki-search::-webkit-search-cancel-button,
.profile-badges-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 2px;
  cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M2.2 2.2h1.4L6 4.6l2.4-2.4h1.4v1.4L7.4 6l2.4 2.4v1.4H8.4L6 7.4l-2.4 2.4H2.2V8.4L4.6 6 2.2 3.6z'/%3E%3C/svg%3E")
    center / 0.72rem 0.72rem no-repeat;
  opacity: 0.95;
}

.wiki-search::-webkit-search-cancel-button:hover,
.profile-badges-search::-webkit-search-cancel-button:hover {
  opacity: 1;
}

.wiki-search::-search-clear-button,
.profile-badges-search::-search-clear-button {
  appearance: none;
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0 2px 0 0;
  padding: 0;
  cursor: pointer;
  border: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M2.2 2.2h1.4L6 4.6l2.4-2.4h1.4v1.4L7.4 6l2.4 2.4v1.4H8.4L6 7.4l-2.4 2.4H2.2V8.4L4.6 6 2.2 3.6z'/%3E%3C/svg%3E")
    center / 0.72rem 0.72rem no-repeat;
  opacity: 0.95;
}

.wiki-search::-search-clear-button:hover,
.profile-badges-search::-search-clear-button:hover {
  opacity: 1;
}

.profile-badges-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-content: start;
  justify-items: center;
  min-height: 120px;
  overflow: visible;
}

.profile-badge-slot {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 56px;
  margin: 0 auto;
}

.profile-badge-btn {
  appearance: none;
  margin: 0;
  padding: 4px;
  width: 100%;
  aspect-ratio: 1;
  max-width: 55px;
  border: 2px solid #b56c27;
  border-radius: 4px;
  background: #f4ca8a;
  box-shadow: inset 0 0 0 2px rgba(255, 236, 178, 0.55), 2px 2px 0 #1a1a1a;
  cursor: pointer;
  display: grid;
  place-items: center;
  image-rendering: pixelated;
  font: inherit;
}

.profile-badge-btn:hover,
.profile-badge-btn:focus-visible {
  border-color: #f5c518;
  box-shadow: inset 0 0 0 2px #fff5cc, 2px 2px 0 #1a1a1a;
}

.profile-badge-btn:focus-visible {
  outline: 2px solid #f5c518;
  outline-offset: 2px;
}

.profile-badge-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  pointer-events: none;
}

.profile-badge-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 140px;
  max-width: 220px;
  padding: 8px 10px;
  background: #1e1e1e;
  border: 2px solid #b56c27;
  border-radius: 4px;
  box-shadow: 3px 3px 0 #000;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  text-align: center;
}

.profile-badge-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: #b56c27;
}

.profile-badge-tooltip__name {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 4px;
}

.profile-badge-tooltip__desc {
  display: block;
  font-size: 14px;
  font-weight: normal;
  color: #d8d8d8;
  line-height: 1.4;
}

.profile-badge-slot:hover .profile-badge-tooltip,
.profile-badge-slot:focus-within .profile-badge-tooltip {
  opacity: 1;
}

.profile-badge-empty {
  grid-column: 1 / -1;
  font-size: 13px;
  color: #aaa;
  text-align: center;
  padding: 12px 8px;
}

.profile-badges-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 4px;
}

.profile-badges-page-label {
  font-size: 12px;
  color: #f0f0f0;
  font-family: var(--font-volter), "Courier New", monospace;
  min-width: 7em;
  text-align: center;
}

.profile-badges-page-btn {
  width: 36px;
  height: 32px;
  padding: 0;
  border: 2px solid #b56c27;
  border-radius: 4px;
  background: #f6c57a;
  color: #222;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1a1a1a;
  image-rendering: pixelated;
}

.profile-badges-page-btn:hover:not(:disabled) {
  border-color: #f5c518;
  background: #ffe08a;
}

.profile-badges-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.profile-badges-page-btn:focus-visible {
  outline: 2px solid #f5c518;
  outline-offset: 2px;
}

.auth-verified {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  color: #2e7d32;
  font-weight: bold;
  text-align: center;
  opacity: 0;
}

.auth-verified.is-visible {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.auth-verified.is-fading {
  opacity: 0;
  transition: opacity 0.45s ease;
}

/* ----- Wiki page ----- */

.wiki-page {
  color: var(--color-ink);
}

.wiki-main {
  position: relative;
  min-height: 100vh;
  padding: calc(var(--nav-h) + 1rem) 1rem 2rem;
}

.wiki-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.wiki-bg .hero__layer--bg {
  background-position: center top;
}

.wiki-shell {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 50px;
  opacity: 0;
}

.wiki-page.wiki-ready .wiki-shell {
  opacity: 1;
  transition: opacity 0.35s ease;
}

.wiki-intro {
  color: #fff;
  margin-bottom: 1rem;
  text-align: center;
}

.wiki-intro p {
  margin: 0;
  color: rgba(255, 252, 245, 0.88);
}

.wiki-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.wiki-search {
  width: 100%;
  border: 1px solid rgba(44, 36, 22, 0.18);
  border-radius: 8px;
  font-family: var(--font-volter);
  font-size: 0.9rem;
  padding: 0.52rem 0.65rem;
  margin-bottom: 0.7rem;
}

.wiki-search:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.wiki-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wiki-topic-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: 68vh;
  border-radius: 10px;
  border: 1px solid rgba(44, 36, 22, 0.12);
  background: rgba(255, 252, 245, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wiki-topic-list {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 0.55rem;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.wiki-topic-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.wiki-empty {
  margin: 0.2rem 0;
  color: var(--color-ink-muted);
  font-size: 0.85rem;
}

.wiki-topic-btn {
  border: 1px solid rgba(44, 36, 22, 0.18);
  border-radius: 8px;
  background: #fff;
  color: var(--color-ink);
  font-family: var(--font-volter);
  font-size: 0.88rem;
  text-align: left;
  padding: 0.5rem 0.55rem 0.5rem 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
  box-sizing: border-box;
}

.wiki-topic-btn__label {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.wiki-topic-btn__arrow {
  flex-shrink: 0;
  width: 1.1em;
  text-align: center;
  font-size: 1.2em;
  line-height: 1;
  color: var(--color-accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.wiki-topic-btn.is-active .wiki-topic-btn__arrow {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 899px) {
  .wiki-topic-btn__arrow {
    transform: translateX(-4px) rotate(90deg);
  }
  .wiki-topic-btn.is-active .wiki-topic-btn__arrow {
    transform: translateX(0) rotate(90deg);
  }

  .wiki-topic-scroll {
    max-height: 38vh;
    transition: max-height 0.35s ease;
  }

  .wiki-sidebar:has(.wiki-topic-btn.is-active) .wiki-topic-scroll {
    max-height: 28vh;
  }

  .wiki-topic-list {
    scroll-behavior: smooth;
  }

  .wiki-topic-btn.is-active {
    scroll-margin-top: 0.5rem;
    scroll-margin-bottom: 0.5rem;
  }

  .wiki-content {
    transition: opacity 0.24s ease, transform 0.3s ease;
  }

  .wiki-content.is-fading {
    opacity: 0;
    transform: translateY(8px);
  }

  .wiki-layout {
    gap: 0.75rem;
  }
}

.wiki-topic-btn:hover {
  background: #f8f2e4;
}

.wiki-topic-btn.is-active {
  border-color: var(--color-accent);
  background: rgba(61, 107, 46, 0.1);
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.wiki-content {
  display: grid;
  gap: 1rem;
  opacity: 1;
  transition: opacity 0.24s ease;
}

.wiki-content.is-fading {
  opacity: 0;
}

.wiki-media-wrap {
  border-radius: 10px;
  overflow: hidden;
  background: #0f1a2c;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  min-height: 220px;
}

[data-wiki-media] {
  width: 100%;
  max-width: 960px;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  background: #0f1a2c;
}

.wiki-meta h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.1rem, 3.2vw, 1.45rem);
  font-weight: normal;
  text-align: center;
}

.wiki-meta p {
  margin: 0.35rem 0;
  color: var(--color-ink-muted);
}

.wiki-commands {
  color: var(--color-ink);
  font-weight: bold;
  text-decoration: underline;
  margin-bottom: 0.55rem;
}

.wiki-loading {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--nav-h);
  bottom: 0;
  z-index: 1400;
  overflow: hidden;
  transition: opacity 0.85s ease;
}

.wiki-loading.fade-out {
  opacity: 0;
  pointer-events: none;
}

[id$="loading-logo"] {
  image-rendering: pixelated;
  width: min(420px, 78vw);
  height: auto;
  animation: mapLoadLogoPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

@keyframes map-load-cloud-drift {
  from { left: -30%; }
  to { left: 110%; }
}

.map-load__bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: url("../assets/images/hero/HabdewBackground.png") no-repeat center center;
  background-size: cover;
  image-rendering: pixelated;
}

.map-load__clouds {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.map-load__clouds .cloud {
  position: absolute;
  image-rendering: pixelated;
  opacity: 0.5;
}

.map-load__clouds .cloud-1 { top: 10%; animation: map-load-cloud-drift 90s linear infinite; animation-delay: -10s; }
.map-load__clouds .cloud-2 { top: 25%; animation: map-load-cloud-drift 70s linear infinite; animation-delay: -40s; }
.map-load__clouds .cloud-3 { top: 40%; animation: map-load-cloud-drift 120s linear infinite; animation-delay: -70s; }
.map-load__clouds .cloud-4 { top: 15%; animation: map-load-cloud-drift 100s linear infinite; animation-delay: -20s; }
.map-load__clouds .cloud-5 { top: 5%;  animation: map-load-cloud-drift 60s linear infinite; animation-delay: -80s; }

.map-load__content {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 1rem;
  transition: transform 0.75s ease, opacity 0.65s ease;
}

.wiki-loading.fade-out .map-load__content {
  transform: translateY(28px);
  opacity: 0;
}

.loading-dots {
  display: flex;
  gap: 10px;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  animation: dotBounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
.loading-dots span:nth-child(4) { animation-delay: 0.6s; }

@keyframes mapLoadLogoPulse {
  0%, 100% { transform: scale(1); filter: brightness(1) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35)); }
  50% { transform: scale(1.04); filter: brightness(1.12) drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4)); }
}

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-10px); opacity: 1; }
}

@media (min-width: 900px) {
  .wiki-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
  }

  .wiki-sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 1rem);
  }
}

/* ----- Wiki dark theme variant ----- */

.wiki-page .panel {
  background: #3d3d3d;
  border-color: #525252;
  color: #f0f0f0;
}

.wiki-page .wiki-search {
  background: #656565;
  border-color: #888;
  color: #fff;
}

.wiki-page .wiki-search::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.wiki-page .wiki-topic-btn {
  background: #656565;
  color: #fff;
  border-color: #888;
}

.wiki-page .wiki-topic-btn:hover {
  background: #737373;
}

.wiki-page .wiki-topic-btn.is-active {
  background: #4e7a3f;
  border-color: #87a976;
  box-shadow: inset 3px 0 0 #b8e0a8;
}

.wiki-page .wiki-topic-btn__arrow {
  color: #d4f0c4;
}

.wiki-page .wiki-topic-scroll {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.15);
}

.wiki-page .wiki-empty,
.wiki-page .wiki-meta p,
.wiki-page .wiki-commands,
.wiki-page [data-wiki-title] {
  color: #fff;
}