/* ============================================
   维度之门 — Global Styles
   Design: Dimensional Portal / Dark Obsidian
   ============================================ */

@import url('https://fonts.googleapis.cn/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

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

:root {
  --bg-void: #08080f;
  --bg-surface: rgba(15, 15, 25, 0.85);
  --bg-elevated: rgba(25, 20, 40, 0.9);
  --portal-primary: #8B5CF6;
  --portal-secondary: #06B6D4;
  --nether-accent: #F97316;
  --end-gold: #EAB308;
  --text-primary: #E8E4F0;
  --text-secondary: #9892A6;
  --glow-purple: rgba(139, 92, 246, 0.4);
  --glow-cyan: rgba(6, 182, 212, 0.3);
  --border-subtle: rgba(139, 92, 246, 0.15);
  --radius: 8px;
  --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background grid texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--portal-primary);
  text-decoration: none;
  transition: color 0.2s var(--transition);
}

a:hover {
  color: var(--portal-secondary);
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(8, 8, 15, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.navbar-brand:hover { color: var(--text-primary); }

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--portal-primary), var(--portal-secondary));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 0 12px var(--glow-purple);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-links a {
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.1);
}

.navbar-links a.active {
  color: var(--portal-primary);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all 0.2s var(--transition);
}

/* ===== Main ===== */
.main-content {
  position: relative;
  z-index: 1;
  padding-top: 64px;
  min-height: calc(100vh - 120px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border-subtle);
  background: rgba(8, 8, 15, 0.95);
  padding: 40px 0 24px;
  margin-top: 80px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 8px;
  max-width: 320px;
  line-height: 1.7;
}

.footer-section h4 {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.footer-section a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 3px 0;
  transition: color 0.2s;
}

.footer-section a:hover { color: var(--portal-primary); }

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 100px 0 80px;
  text-align: center;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, var(--glow-purple) 0%, transparent 70%);
  opacity: 0.3;
  pointer-events: none;
  animation: heroGlow 4s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  from { opacity: 0.2; transform: translate(-50%, -50%) scale(0.9); }
  to   { opacity: 0.4; transform: translate(-50%, -50%) scale(1.1); }
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--portal-primary) 50%, var(--portal-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--portal-primary), #7C3AED);
  color: white;
  box-shadow: 0 0 20px var(--glow-purple);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--glow-purple), 0 4px 20px rgba(0,0,0,0.3);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  border-color: var(--portal-primary);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  padding: 24px;
  transition: all 0.25s var(--transition);
}

.card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  text-align: center;
  padding: 24px 16px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: var(--portal-primary);
  line-height: 1.2;
}

.stat-value.cyan { color: var(--portal-secondary); }
.stat-value.gold  { color: var(--end-gold); }
.stat-value.orange { color: var(--nether-accent); }

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Section ===== */
.section {
  padding: 60px 0;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.section-desc {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

/* ===== Grid ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* ===== Status Indicator ===== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: #22C55E;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.offline {
  background: #EF4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Table ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 500px;
}

th {
  background: var(--bg-elevated);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.05);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.mono, th.mono {
  text-align: center;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(139, 92, 246, 0.05);
}

/* Leaderboard table column widths */
table.lb-player th:nth-child(1), table.lb-player td:nth-child(1) { width: 70px; text-align: center; }
table.lb-player th:nth-child(2), table.lb-player td:nth-child(2) { width: auto; }
table.lb-player th:nth-child(3), table.lb-player td:nth-child(3) { width: 100px; text-align: center; }

table.lb-guild th:nth-child(1), table.lb-guild td:nth-child(1) { width: 60px; text-align: center; }
table.lb-guild th:nth-child(2), table.lb-guild td:nth-child(2) { width: auto; }
table.lb-guild th:nth-child(3), table.lb-guild td:nth-child(3) { width: 70px; text-align: center; }
table.lb-guild th:nth-child(4), table.lb-guild td:nth-child(4) { width: 90px; text-align: center; }
table.lb-guild th:nth-child(5), table.lb-guild td:nth-child(5) { width: 90px; text-align: center; }
table.lb-guild th:nth-child(6), table.lb-guild td:nth-child(6) { width: 70px; text-align: center; }

table.lb-elite th:nth-child(1), table.lb-elite td:nth-child(1) { width: 60px; text-align: center; }
table.lb-elite th:nth-child(2), table.lb-elite td:nth-child(2) { width: auto; }
table.lb-elite th:nth-child(3), table.lb-elite td:nth-child(3) { width: 90px; text-align: center; }
table.lb-elite th:nth-child(4), table.lb-elite td:nth-child(4) { width: 70px; text-align: center; }
table.lb-elite th:nth-child(5), table.lb-elite td:nth-child(5) { width: 70px; text-align: center; }
table.lb-elite th:nth-child(6), table.lb-elite td:nth-child(6) { width: 70px; text-align: center; }

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-legendary { background: rgba(234, 179, 8, 0.15); color: var(--end-gold); }
.badge-epic       { background: rgba(139, 92, 246, 0.15); color: var(--portal-primary); }
.badge-rare       { background: rgba(59, 130, 246, 0.15); color: #3B82F6; }
.badge-common     { background: rgba(148, 163, 184, 0.15); color: #94A3B8; }
.badge-online     { background: rgba(34, 197, 94, 0.15); color: #22C55E; }
.badge-offline    { background: rgba(239, 68, 68, 0.15); color: #EF4444; }
.badge-purple     { background: rgba(139, 92, 246, 0.2); color: var(--portal-primary); }
.badge-secondary  { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }
.badge-gold       { background: rgba(234, 179, 8, 0.18); color: var(--end-gold); }
.badge-nether     { background: rgba(249, 115, 22, 0.18); color: var(--nether-accent); }
.badge-cyan       { background: rgba(6, 182, 212, 0.15); color: var(--portal-secondary); }

/* ===== Page Header ===== */
.page-header {
  padding: 60px 0 40px;
  text-align: center;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
}

.tab, .tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s var(--transition);
  margin-bottom: -1px;
  font-family: inherit;
}

.tab:hover, .tab-btn:hover { color: var(--text-primary); }

.tab.active, .tab-btn.active {
  color: var(--portal-primary);
  border-bottom-color: var(--portal-primary);
}

/* Tab content visibility */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--portal-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Server Card ===== */
.server-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
}

.server-info { display: flex; align-items: center; gap: 16px; }

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.server-name { font-weight: 600; font-size: 1.05rem; }

.server-version {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.server-stats { display: flex; gap: 24px; align-items: center; }

.server-stat { text-align: center; }

.server-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.1rem;
}

.server-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===== Progress Bar ===== */
.progress-bar {
  height: 6px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary));
  border-radius: 3px;
  transition: width 0.5s var(--transition);
}

/* ===== Feature Card ===== */
.feature-card { text-align: center; padding: 32px 24px; }

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 16px;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== News Card ===== */
.news-card { cursor: default; }

.news-type {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.news-type.type-news { color: var(--portal-primary); }
.news-type.type-update { color: var(--portal-secondary); }
.news-type.type-event { color: var(--end-gold); }
.news-type.type-announcement { color: var(--nether-accent); }

.news-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 8px 0;
  line-height: 1.4;
}

.news-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.news-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== Guild Card ===== */
.guild-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: center;
}

.guild-rank.top-1 { color: var(--end-gold); text-shadow: 0 0 10px rgba(234, 179, 8, 0.3); }
.guild-rank.top-2 { color: #C0C0C0; }
.guild-rank.top-3 { color: #CD7F32; }

.guild-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
}

.guild-info { flex: 1; }

.guild-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.guild-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.guild-stats-row {
  display: flex;
  gap: 20px;
  align-items: center;
}

/* ===== Particles ===== */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--portal-primary);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}

.particle:nth-child(odd) { background: var(--portal-secondary); }
.particle:nth-child(3n)  { width: 2px; height: 2px; }

@keyframes particleFloat {
  0%   { transform: translateY(100vh) translateX(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-20px) translateX(30px); opacity: 0; }
}

/* ===== Rank ===== */
.rank-number {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  min-width: 36px;
  text-align: center;
}

.rank-1 { color: var(--end-gold); }
.rank-2 { color: #C0C0C0; }
.rank-3 { color: #CD7F32; }

/* ===== Copy ===== */
.copy-ip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--portal-secondary);
  cursor: pointer;
  transition: all 0.2s var(--transition);
}

.copy-ip:hover {
  border-color: var(--portal-secondary);
  box-shadow: 0 0 10px var(--glow-cyan);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .navbar-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(8, 8, 15, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .navbar-links.open { display: flex; }

  .hamburger { display: flex; }

  .hero h1 { font-size: 2.25rem; }
  .hero { padding: 60px 0 50px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .footer-grid { grid-template-columns: 1fr; gap: 24px; }

  .server-card { flex-direction: column; gap: 16px; text-align: center; }
  .server-info { flex-direction: column; }
  .server-stats { justify-content: center; }

  .page-header h1 { font-size: 1.75rem; }

  .guild-card { flex-direction: column; text-align: center; }
  .guild-stats-row { justify-content: center; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.75rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: center; }
  .tabs { overflow-x: auto; }
}

/* ============================================
   Auth Pages (Login / Register / Account)
   ============================================ */

.auth-container {
  max-width: 440px;
  margin: 60px auto;
  padding: 0 20px;
  position: relative;
}

.auth-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 40px 32px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(20px);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header .navbar-brand {
  font-size: 1.5rem;
  margin-bottom: 12px;
  display: inline-flex;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.auth-tab:hover {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.05);
}

.auth-tab.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--portal-primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  padding: 10px 14px;
  background: var(--bg-void);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.form-error {
  color: #ef4444;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.form-result {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: var(--radius);
  display: none;
}

.form-result-success {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.form-result-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-submit {
  margin-top: 4px;
  width: 100%;
  justify-content: center;
  padding: 12px 24px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.auth-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.auth-footer a:hover {
  color: var(--portal-primary);
}

/* Nav Auth Button */
.nav-auth {
  display: flex;
  align-items: center;
}

.nav-auth-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

/* Account Page */
.bound-uuid-item {
  transition: border-color 0.2s ease;
}

.bound-uuid-item:hover {
  border-color: rgba(139, 92, 246, 0.3);
}

/* Auth responsive */
@media (max-width: 640px) {
  .auth-container {
    margin: 30px auto;
  }

  .auth-card {
    padding: 28px 20px;
  }
}

/* ============================================
   Towny / Town & Nation Styles
   ============================================ */
.town-card, .nation-card {
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.town-card:hover, .nation-card:hover {
  border-color: var(--portal-primary);
  box-shadow: 0 0 20px rgba(139,92,246,0.15);
  transform: translateY(-2px);
}

.town-info {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.town-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}
.town-info-item span:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  border-radius: 4px;
  background: rgba(139,92,246,0.1);
  color: var(--portal-primary);
  border: 1px solid rgba(139,92,246,0.2);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-content {
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

/* Ranking list */
.ranking-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(139,92,246,0.06);
}
.ranking-item:last-child {
  border-bottom: none;
}
.ranking-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(139,92,246,0.1);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.ranking-rank.rank-1 {
  background: rgba(234,179,8,0.2);
  color: var(--end-gold);
}
.ranking-rank.rank-2 {
  background: rgba(139,92,246,0.2);
  color: var(--portal-primary);
}
.ranking-rank.rank-3 {
  background: rgba(6,182,212,0.15);
  color: var(--portal-secondary);
}
.ranking-info {
  flex: 1;
  min-width: 0;
}
.ranking-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-bar {
  height: 4px;
  background: rgba(139,92,246,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.ranking-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary));
  border-radius: 2px;
  transition: width 0.6s ease;
}
.ranking-value {
  font-size: 0.85rem;
  color: var(--portal-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

/* ===== Skeleton Loading ===== */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.skeleton-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  height: 160px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ===== Towny Page ===== */
.towny-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
}
.towny-stat-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.towny-stat-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.towny-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--portal-secondary);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}
.towny-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.towny-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

/* Towny Card Grid */
.towny-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* Towny Card */
.towny-card {
  padding: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.towny-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.12);
}
.towny-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.towny-card-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}
.towny-card-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.towny-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.75rem;
}
.towny-card-stat {
  text-align: center;
}
.towny-card-stat-icon {
  font-size: 1rem;
  margin-bottom: 2px;
}
.towny-card-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}
.towny-card-stat-lbl {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.towny-card-mayor {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.towny-avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

/* Towny Badges */
.towny-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.towny-badge-purple { background: rgba(139, 92, 246, 0.18); color: var(--portal-primary); }
.towny-badge-red    { background: rgba(239, 68, 68, 0.15);  color: #EF4444; }
.towny-badge-green  { background: rgba(34, 197, 94, 0.15);  color: #22C55E; }
.towny-badge-gold   { background: rgba(234, 179, 8, 0.18);  color: var(--end-gold); }
.towny-badge-muted  { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }

/* Towny Rankings Grid */
.towny-rankings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.towny-rank-card {
  padding: 1.25rem;
}
.ranking-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.ranking-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Towny Detail Modal */
.towny-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1.5rem;
}
.towny-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.towny-detail-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.towny-detail-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Towny Residents */
.towny-residents-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}
.towny-residents-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.towny-residents-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.towny-resident-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.towny-resident-mayor {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.06);
}
.towny-resident-name {
  color: var(--text-primary);
}

/* Towny responsive */
@media (max-width: 768px) {
  .towny-stats-bar {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
  }
  .towny-stat-divider {
    display: none;
  }
  .towny-stat-item {
    flex: 1 1 45%;
    justify-content: flex-start;
    padding: 0.5rem 0;
  }
  .towny-card-grid {
    grid-template-columns: 1fr;
  }
  .towny-rankings-grid {
    grid-template-columns: 1fr;
  }
  .towny-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ Admin Page ============ */
.admin-page {
  padding: 2rem 0;
  min-height: 60vh;
}

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.admin-tab {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.admin-tab:hover {
  color: var(--text-primary);
}

.admin-tab.active {
  color: var(--portal-primary);
  border-bottom-color: var(--portal-primary);
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

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

.admin-toolbar h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: border-color 0.2s ease;
}

.admin-item:hover {
  border-color: var(--portal-primary);
}

.admin-item-info {
  flex: 1;
  min-width: 0;
}

.admin-item-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-item-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.admin-item-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  line-height: 1.4;
}

.admin-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 4px;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-secondary {
  background: rgba(139, 92, 246, 0.1);
  color: var(--portal-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(139, 92, 246, 0.2);
}

.admin-editor-modal {
  max-width: 640px;
  width: 90%;
}

.modal-sm {
  max-width: 420px;
  width: 90%;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

#deleteModal p {
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (max-width: 640px) {
  .admin-item {
    flex-direction: column;
  }
  .admin-item-actions {
    align-self: flex-end;
  }
}

/* Community Links */
.community-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.community-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: all 0.2s;
}
.community-link:hover {
  border-color: var(--portal-primary);
  background: rgba(139, 92, 246, 0.1);
  transform: translateY(-2px);
}
.community-link-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 10px;
  color: var(--portal-primary);
}
