/* ============================================
   Imperium Classic Wiki - Custom Styles
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
  --background: #0a0a0a;
  --foreground: #e8dcc8;
  --card: #1a1a1a;
  --card-foreground: #e8dcc8;
  --popover: #141414;
  --popover-foreground: #e8dcc8;
  --primary: #c9a84c;
  --primary-foreground: #0a0a0a;
  --secondary: #242424;
  --secondary-foreground: #d9ccb4;
  --muted: #242424;
  --muted-foreground: #8a7e6a;
  --accent: #8a6d1f;
  --accent-foreground: #f0e8d5;
  --border: #2e2816;
  --input: #292929;
  --ring: #c9a84c;
  --sidebar-bg: #121212;
  --sidebar-foreground: #d9ccb4;
  --sidebar-primary: #c9a84c;
  --sidebar-accent: #1f1f1f;
  --sidebar-border: #261f0a;
  --gold: #c9a84c;
  --gold-light: #dbb856;
  --gold-dark: #6b4d0a;
  --radius: 0.375rem;
}

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Serif Font (Titles) */
.font-serif {
  font-family: 'Cinzel', serif;
}

/* Pixel Art */
.pixel-art {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Gold Glow */
.gold-glow {
  box-shadow: 0 0 15px rgba(201, 168, 76, 0.15);
}

.gold-glow:hover {
  box-shadow: 0 0 25px rgba(201, 168, 76, 0.25);
}

/* Hero Logo with Particles */
.hero-logo-wrapper {
  position: relative;
  width: 500px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.hero-logo-img {
  position: relative;
  z-index: 1;
  width: 460px;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(201, 168, 76, 0.3)) drop-shadow(0 0 40px rgba(201, 168, 76, 0.1));
  animation: heroLogoFloat 4s ease-in-out infinite;
}

.hero-particles {
  position: absolute;
  inset: -40px -40px 0 -40px;
  width: calc(100% + 80px);
  height: calc(100% + 40px);
  z-index: 0;
  pointer-events: none;
}

@keyframes heroLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Category card hover particles */
.cat-card {
  position: relative;
  overflow: hidden;
}

.cat-card canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s;
}

.cat-card:hover canvas {
  opacity: 1;
}

.cat-card > *:not(canvas) {
  position: relative;
  z-index: 1;
}

/* Quick link cards */
.quick-link[data-hue="145"]:hover { box-shadow: 0 0 25px rgba(74, 222, 128, 0.15); border-color: rgba(74, 222, 128, 0.3); }
.quick-link[data-hue="235"]:hover { box-shadow: 0 0 25px rgba(129, 140, 248, 0.15); border-color: rgba(129, 140, 248, 0.3); }
.quick-link[data-hue="25"]:hover  { box-shadow: 0 0 25px rgba(251, 146, 60, 0.15); border-color: rgba(251, 146, 60, 0.3); }

/* Gold Border */
.gold-border {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--card) 0%, var(--popover) 100%);
}

/* Gold Gradient Border (bottom line) */
.gold-gradient-border {
  position: relative;
}

.gold-gradient-border::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(201, 168, 76, 0.4),
    transparent
  );
}

/* Custom Scrollbar */
.scrollbar-thin {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

/* Layout */
.wiki-layout {
  display: flex;
  min-height: 100vh;
}

.wiki-sidebar {
  width: 16rem;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
}

.wiki-main {
  flex: 1;
  margin-left: 16rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201, 168, 76, 0.04) 0%, transparent 100%),
    radial-gradient(ellipse 60% 80% at 100% 0%, rgba(201, 168, 76, 0.025) 0%, transparent 100%),
    radial-gradient(ellipse 50% 50% at 0% 60%, rgba(139, 109, 31, 0.02) 0%, transparent 100%),
    var(--background);
}

.wiki-main::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.wiki-main > * {
  position: relative;
  z-index: 1;
}

.wiki-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background-color: var(--card);
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.wiki-content {
  flex: 1;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* Sidebar Styles */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  position: relative;
}

.sidebar-logo-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 168, 76, 0.3);
  background-color: rgba(201, 168, 76, 0.1);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
}

.sidebar-category-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
  text-align: left;
}

.sidebar-category-btn:hover {
  background-color: var(--secondary);
}

.sidebar-category-btn i,
.sidebar-category-btn svg {
  color: var(--primary);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.sidebar-category-btn .chevron {
  margin-left: auto;
  color: var(--muted-foreground);
  transition: transform 0.2s;
}

.sidebar-category-btn.open .chevron {
  transform: rotate(90deg);
}

.sidebar-children {
  margin-left: 0.75rem;
  border-left: 1px solid rgba(46, 40, 22, 0.5);
  padding-left: 0.25rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: all 0.15s;
}

.sidebar-item:hover {
  background-color: var(--secondary);
  color: var(--primary);
}

.sidebar-item .dot {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background-color: rgba(138, 126, 106, 0.5);
  flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: center;
}

/* Header Styles */
.header-search {
  position: relative;
  max-width: 32rem;
  flex: 1;
  margin: 0 1rem;
}

.header-search input {
  width: 100%;
  height: 2.25rem;
  padding-left: 2.25rem;
  padding-right: 3rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--foreground);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}

.header-search input::placeholder {
  color: var(--muted-foreground);
}

.header-search input:focus {
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.15);
}

.header-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}

.header-search kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  background-color: var(--background);
  font-size: 0.625rem;
  color: var(--muted-foreground);
  font-family: inherit;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  padding: 0.375rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-menu-btn:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

/* Mobile overlay */
.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background-color: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Cards */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--card);
  transition: all 0.2s;
}

.card:hover {
  border-color: rgba(201, 168, 76, 0.3);
  background-color: var(--secondary);
}

.card-link:hover h3 {
  color: var(--primary);
}

/* Patch card shimmer effect */
.patch-card {
  position: relative;
  overflow: hidden;
}

.patch-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(201, 168, 76, 0.08),
    rgba(201, 168, 76, 0.15),
    rgba(201, 168, 76, 0.08),
    transparent
  );
  transition: none;
  pointer-events: none;
  z-index: 1;
}

.patch-card:hover::before {
  animation: patchShimmer 1s ease forwards;
}

.patch-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1), 0 0 40px rgba(201, 168, 76, 0.05);
}

@keyframes patchShimmer {
  0% { left: -50%; }
  100% { left: 120%; }
}

/* Featured card spotlight effect */
.card-spotlight {
  position: relative;
  overflow: hidden;
}

.card-spotlight:hover {
  border-color: rgba(201, 168, 76, 0.4);
  box-shadow: 0 4px 24px -4px rgba(201, 168, 76, 0.2);
}

.spotlight-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.15) 0%, rgba(201, 168, 76, 0.05) 40%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background-color: rgba(36, 36, 36, 0.8);
  color: var(--foreground);
}

.btn-primary {
  background-color: rgba(201, 168, 76, 0.1);
  color: var(--primary);
  border-color: rgba(201, 168, 76, 0.3);
}

.btn-primary:hover {
  background-color: rgba(201, 168, 76, 0.2);
}

/* Tags & Badges */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-primary {
  background-color: rgba(201, 168, 76, 0.1);
  color: var(--primary);
}

.badge-green {
  background-color: rgba(34, 197, 94, 0.1);
  color: #4ade80;
}

.badge-blue {
  background-color: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.badge-purple {
  background-color: rgba(168, 85, 247, 0.1);
  color: #c084fc;
}

.badge-muted {
  background-color: var(--secondary);
  color: var(--muted-foreground);
}

/* Article Prose */
.prose-wiki h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  position: relative;
}

.prose-wiki p {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}

.prose-wiki ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Stat Table */
.stat-table {
  width: 100%;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.stat-table caption {
  border-bottom: 1px solid var(--border);
  background-color: rgba(36, 36, 36, 0.5);
  padding: 0.5rem 1rem;
  text-align: left;
  font-family: 'Cinzel', serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.stat-table thead tr {
  border-bottom: 1px solid var(--border);
  background-color: rgba(201, 168, 76, 0.1);
}

.stat-table th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.stat-table td {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.stat-table tbody tr {
  border-bottom: 1px solid rgba(46, 40, 22, 0.5);
  transition: background-color 0.15s;
}

.stat-table tbody tr:hover {
  background-color: rgba(36, 36, 36, 0.5);
}

.stat-table tbody tr:nth-child(even) {
  background-color: rgba(36, 36, 36, 0.2);
}

.stat-table tbody tr td:first-child {
  font-weight: 500;
  color: var(--foreground);
}

.stat-table tbody tr td:not(:first-child) {
  color: var(--muted-foreground);
}

/* Item Tooltip */
.item-tooltip {
  width: 18rem;
  overflow: hidden;
  border-radius: var(--radius);
  border-width: 2px;
  background-color: var(--card);
}

.item-tooltip.rarity-common { border-color: var(--muted); }
.item-tooltip.rarity-uncommon { border-color: rgba(74, 222, 128, 0.3); }
.item-tooltip.rarity-rare { border-color: rgba(96, 165, 250, 0.3); }
.item-tooltip.rarity-epic { border-color: rgba(192, 132, 252, 0.3); }
.item-tooltip.rarity-legendary { border-color: rgba(201, 168, 76, 0.4); }

.item-tooltip-header {
  border-bottom: 1px solid var(--border);
  background-color: rgba(36, 36, 36, 0.5);
  padding: 0.75rem 1rem;
}

.rarity-common-text { color: var(--muted-foreground); }
.rarity-uncommon-text { color: #4ade80; }
.rarity-rare-text { color: #60a5fa; }
.rarity-epic-text { color: #c084fc; }
.rarity-legendary-text { color: var(--primary); }

/* NPC Info Box */
.npc-info-box {
  width: 18rem;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--card);
}

.npc-type-merchant { background-color: rgba(34, 197, 94, 0.1); color: #4ade80; border-color: rgba(34, 197, 94, 0.2); }
.npc-type-quest-giver { background-color: rgba(234, 179, 8, 0.1); color: #facc15; border-color: rgba(234, 179, 8, 0.2); }
.npc-type-trainer { background-color: rgba(59, 130, 246, 0.1); color: #60a5fa; border-color: rgba(59, 130, 246, 0.2); }
.npc-type-guard { background-color: rgba(107, 114, 128, 0.1); color: #9ca3af; border-color: rgba(107, 114, 128, 0.2); }
.npc-type-boss { background-color: rgba(239, 68, 68, 0.1); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }

/* Table of Contents */
.toc {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--card);
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  color: inherit;
}

.toc-list {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  list-style: none;
  margin: 0;
}

.toc-list li a {
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: all 0.15s;
}

.toc-list li a:hover {
  background-color: var(--secondary);
  color: var(--primary);
}

.toc-list li a.active {
  background-color: rgba(201, 168, 76, 0.1);
  color: var(--primary);
}

.toc-list li a .toc-number {
  color: rgba(201, 168, 76, 0.4);
  margin-right: 0.5rem;
}

/* Pro Tip Box */
.pro-tip {
  border-radius: var(--radius);
  border: 1px solid rgba(201, 168, 76, 0.2);
  background-color: rgba(201, 168, 76, 0.05);
  padding: 1rem;
  margin-bottom: 1rem;
}

.pro-tip .pro-tip-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.pro-tip p {
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin: 0;
}

/* View Toggle */
.view-toggle {
  display: flex;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.view-toggle button {
  padding: 0.375rem;
  background: var(--secondary);
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle button:hover {
  color: var(--foreground);
}

.view-toggle button.active {
  background-color: rgba(201, 168, 76, 0.1);
  color: var(--primary);
}

/* Search Page */
.search-results-count {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.search-results-count strong {
  color: var(--foreground);
  font-weight: 500;
}

.search-results-count .highlight {
  color: var(--primary);
  font-weight: 500;
}

/* Filter Pills */
.filter-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  color: var(--foreground);
}

.filter-pill.active {
  background-color: rgba(201, 168, 76, 0.1);
  color: var(--primary);
  border-color: rgba(201, 168, 76, 0.3);
}

/* Hero Stats Divider */
.stats-divider {
  width: 1px;
  height: 0.75rem;
  background-color: var(--border);
}

/* Footer */
.wiki-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  margin-top: 4rem;
}

/* Line Clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Text truncate */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1023px) {
  .wiki-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .wiki-sidebar.mobile-open {
    transform: translateX(0);
    z-index: 50;
  }

  .wiki-main {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .desktop-only {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .md-only {
    display: none !important;
  }
}

/* ============================================
   Mobile Responsive Fixes
   ============================================ */

/* Featured + Changelog grid: 2-column on desktop, stacked on mobile */
.featured-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 2rem;
}

/* Changelog wrapper: absolute on desktop (fills grid cell), static on mobile */
.changelog-wrapper {
  position: relative;
}

.changelog-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 767px) {
  .featured-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .changelog-wrapper {
    position: static;
  }

  .changelog-inner {
    position: static;
  }

  /* Verify code inputs smaller on mobile */
  .verify-code-input {
    width: 36px;
    height: 44px;
    font-size: 1rem;
  }

  /* Item tooltips and NPC info boxes full width */
  .item-tooltip,
  .npc-info-box {
    width: 100%;
    max-width: 100%;
  }

  /* Hero logo smaller on mobile */
  .hero-logo-img {
    width: 280px !important;
  }

  .hero-logo-wrapper {
    width: 320px;
    height: 160px;
  }

  /* Category cards 3-col instead of 6 */
  .login-card {
    max-width: calc(100vw - 2rem);
  }
}

@media (max-width: 480px) {
  /* Search filter bar stack */
  .filter-pill {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.5rem;
  }

  /* Smaller hero on very small screens */
  .hero-logo-img {
    width: 220px !important;
  }

  .hero-logo-wrapper {
    width: 260px;
    height: 130px;
  }

  /* Quick links cards stack text */
  .quick-link .text-sm {
    font-size: 0.8125rem;
  }
}

/* ============================================
   User Dropdown
   ============================================ */

.user-dropdown {
  position: relative;
}

.user-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.user-dropdown-btn:hover {
  border-color: rgba(201, 168, 76, 0.3);
  background-color: rgba(201, 168, 76, 0.05);
}

.user-dropdown-btn .user-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.2), rgba(201, 168, 76, 0.05));
  border: 1px solid rgba(201, 168, 76, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-dropdown-btn .user-avatar svg {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--primary);
}

.user-dropdown-btn .chevron-icon {
  color: var(--muted-foreground);
  transition: transform 0.2s;
}

.user-dropdown-btn.open .chevron-icon {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 13rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background-color: var(--popover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(201, 168, 76, 0.05);
  z-index: 50;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-menu.open {
  display: block;
}

.user-dropdown-header {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background-color: rgba(201, 168, 76, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-dropdown-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.user-dropdown-role {
  font-size: 0.5625rem;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  background-color: rgba(201, 168, 76, 0.1);
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.user-dropdown-divider {
  height: 1px;
  background-color: var(--border);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
}

.user-dropdown-item svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  opacity: 0.7;
}

.user-dropdown-item:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.user-dropdown-item:hover svg {
  opacity: 1;
}

.user-dropdown-item-danger {
  color: rgba(248, 113, 113, 0.7);
}

.user-dropdown-item-danger svg {
  color: rgba(248, 113, 113, 0.7);
}

.user-dropdown-item-danger:hover {
  background-color: rgba(239, 68, 68, 0.08);
  color: #f87171;
}

.user-dropdown-item-danger:hover svg {
  color: #f87171;
}

/* ============================================
   Login Modal
   ============================================ */

.login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-overlay.open {
  display: flex;
}

.login-card {
  width: 100%;
  max-width: 22rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 168, 76, 0.08);
  overflow: hidden;
  animation: loginModalIn 0.2s ease-out;
  position: relative;
}

@keyframes loginModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-card-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
  z-index: 1;
}

.login-card-close:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.login-card-header {
  padding: 1.75rem 2rem 1.25rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.04) 0%, transparent 100%);
}

.login-card-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.15), rgba(201, 168, 76, 0.05));
  border: 1px solid rgba(201, 168, 76, 0.2);
}

.login-card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
}

.login-card-header h1 {
  font-family: 'Cinzel', serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 0.25rem;
}

.login-card-header p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0;
}

.login-card-body {
  padding: 1.5rem 2rem 2rem;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.15), rgba(201, 168, 76, 0.08));
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.login-btn:hover {
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.25), rgba(201, 168, 76, 0.12));
  border-color: rgba(201, 168, 76, 0.6);
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.1);
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.verify-code-input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'Courier New', Courier, monospace;
  color: var(--primary);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.verify-code-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.2);
}

/* ============================================
   Form Styles
   ============================================ */

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

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--input);
  color: var(--foreground);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.15);
}

.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--input);
  color: var(--foreground);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
}

.form-select:focus {
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.15);
}

.form-error {
  margin-bottom: 1rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(239, 68, 68, 0.3);
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
  font-size: 0.8125rem;
}

.form-success {
  margin-bottom: 1rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(34, 197, 94, 0.3);
  background-color: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  font-size: 0.8125rem;
}

/* ============================================
   Admin Page
   ============================================ */

.admin-page {
  padding: 2rem;
  max-width: 56rem;
  margin: 0 auto;
}

.admin-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-page-title {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0;
}

.admin-page-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0.125rem 0 0;
}

.admin-card {
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  overflow: hidden;
}

.admin-user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.15), rgba(201, 168, 76, 0.05));
  border: 1px solid rgba(201, 168, 76, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}

/* ============================================
   Admin Table
   ============================================ */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table thead tr {
  border-bottom: 1px solid var(--border);
  background-color: rgba(201, 168, 76, 0.03);
}

.admin-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.admin-table td {
  padding: 0.625rem 1rem;
  color: var(--muted-foreground);
  vertical-align: middle;
}

.admin-table tbody tr {
  border-bottom: 1px solid rgba(46, 40, 22, 0.3);
  transition: background-color 0.15s;
}

.admin-table tbody tr:hover {
  background-color: rgba(201, 168, 76, 0.02);
}

/* Permission Badges */
.perm-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.perm-admin {
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.perm-editor {
  background-color: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.perm-viewer {
  background-color: rgba(107, 114, 128, 0.1);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.2);
}

/* Small Button */
.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.6875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-sm:hover {
  background-color: rgba(36, 36, 36, 0.8);
  color: var(--foreground);
}

.btn-danger {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ============================================
   Faction NPCs (index)
   ============================================ */

.faction-npc {
  position: fixed;
  bottom: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transform: translateY(110%);
  transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.faction-npc-left { left: 18px; }
.faction-npc-right { right: 18px; }

.faction-npc.npc-visible {
  transform: translateY(0);
}

.npc-sprite {
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.npc-bubble {
  position: relative;
  background: rgba(5, 5, 15, 0.95);
  border: 1px solid rgba(180, 180, 180, 0.18);
  border-radius: 3px;
  padding: 10px 13px 8px;
  max-width: 270px;
  min-width: 150px;
  margin-bottom: 6px;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.npc-bubble.npc-bubble-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.npc-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  margin-left: -5px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(5, 5, 15, 0.95);
}

.npc-bubble-text {
  color: #d8d8d8;
  font-size: 11.5px;
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
}

.npc-bubble-name {
  margin-top: 7px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

.npc-bubble-role {
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.35);
  font-family: 'Inter', sans-serif;
  margin-top: 1px;
}

/* Desktop: hide center NPC */
.faction-npc-center { display: none; }

/* Mobile: hide left/right, show center */
@media (max-width: 1100px) {
  .faction-npc-left,
  .faction-npc-right { display: none !important; }

  .faction-npc-center {
    display: flex;
    left: 50%;
    transform: translateX(-50%) translateY(110%);
  }

  .faction-npc-center.npc-visible {
    transform: translateX(-50%) translateY(0);
  }

  .faction-npc-center .npc-bubble {
    max-width: 220px;
    min-width: 120px;
    font-size: 10.5px;
  }

  .faction-npc-center .npc-bubble-text {
    font-size: 10.5px;
  }

  .faction-npc-center .npc-bubble-name {
    font-size: 10px;
  }

  .faction-npc-center .npc-bubble-role {
    font-size: 8.5px;
  }
}
