/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg-primary: #0f1923;
  --bg-secondary: #162231;
  --bg-card: #1b2b3a;
  --bg-card-hover: #213344;
  --bg-elevated: #1e3044;
  --bg-input: #0f1923;
  --border: #263a4c;
  --border-light: #2d4a5e;
  --text: #e1e8ef;
  --text-secondary: #8899a6;
  --text-muted: #5b6f80;
  --accent: #4fc3f7;
  --accent-hover: #81d4fa;
  --accent-dim: rgba(79, 195, 247, 0.12);
  --green: #4caf50;
  --red: #ef5350;
  --gold: #ffc107;
  --elixir: #e040fb;
  --dark-elixir: #7c4dff;
  --orange: #ff9800;
  --trophies: #ffc107;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.nav-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: -0.3px;
  user-select: none;
}

.nav-brand .icon {
  font-size: 22px;
  line-height: 1;
}

.nav-links {
  display: flex;
  gap: 2px;
  align-items: center;
}

.nav-links button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  font-family: inherit;
  letter-spacing: 0.2px;
}

.nav-links button:hover {
  background: rgba(79, 195, 247, 0.08);
  color: var(--text);
}

.nav-links button.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== HERO / SEARCH ===== */
.hero {
  text-align: center;
  padding: 48px 20px 36px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.hero p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 28px;
  font-weight: 400;
}

.search-box {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 100px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.15);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-box button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  border: none;
  color: var(--bg-primary);
  padding: 7px 18px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background var(--transition);
}

.search-box button:hover { background: var(--accent-hover); }

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header a {
  font-size: 13px;
  font-weight: 600;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

/* ===== STAT BLOCKS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.stat-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  transition: border-color var(--transition);
}

.stat-block:hover { border-color: var(--border-light); }

.stat-block .stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.stat-block .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
  font-weight: 600;
}

.stat-block.gold .stat-value { color: var(--gold); }
.stat-block.elixir .stat-value { color: var(--elixir); }
.stat-block.dark .stat-value { color: var(--dark-elixir); }
.stat-block.trophies .stat-value { color: var(--trophies); }
.stat-block.green .stat-value { color: var(--green); }
.stat-block.red .stat-value { color: var(--red); }
.stat-block.blue .stat-value { color: var(--accent); }

/* ===== LEADERBOARD TABLE ===== */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table thead {
  background: var(--bg-secondary);
}

.leaderboard-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.leaderboard-table tbody tr {
  transition: background var(--transition);
}

.leaderboard-table tbody tr:hover td {
  background: var(--bg-card-hover);
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}

.leaderboard-table .rank {
  font-weight: 800;
  width: 48px;
  font-size: 14px;
}

.rank-1 { color: #ffd700; }
.rank-2 { color: #b0bec5; }
.rank-3 { color: #cd8c32; }

.player-name {
  font-weight: 600;
  cursor: pointer;
  color: var(--accent);
  transition: color var(--transition);
}

.player-name:hover { color: var(--accent-hover); }

.player-id-tag {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}

.trophy-count {
  color: var(--trophies);
  font-weight: 700;
}

.gold-count {
  color: var(--gold);
  font-weight: 700;
}

/* ===== PLAYER PROFILE ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #0288d1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.2);
}

.profile-info h1 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
}

.profile-info .tag {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.profile-info .badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
  cursor: pointer;
  transition: background var(--transition);
}

.profile-info .badge:hover { background: rgba(79, 195, 247, 0.2); }

/* ===== BUILDINGS GRID ===== */
.buildings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.building-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color var(--transition);
}

.building-card:hover { border-color: var(--border-light); }

.building-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.building-card .building-name {
  font-size: 12px;
  font-weight: 600;
}

.building-card .building-level {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tabs button {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  font-family: inherit;
  flex: 1;
}

.tabs button:last-child { border-right: none; }
.tabs button:hover { color: var(--text); background: var(--bg-card-hover); }

.tabs button.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ===== GUILD ===== */
.guild-banner {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.guild-banner h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
}

.guild-banner .guild-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.members-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition);
}

.member-item:hover { border-color: var(--accent); }

.member-mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

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

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

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* ===== ERROR ===== */
.error-msg {
  background: rgba(239,83,80,0.08);
  border: 1px solid rgba(239,83,80,0.3);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--red);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}

/* ===== STATS TYPE TABS ===== */
.stats-type-tabs {
  display: flex;
  gap: 0;
  max-width: 320px;
  margin: 0 auto 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stats-type-tabs button {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 24px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  font-family: inherit;
  flex: 1;
}

.stats-type-tabs button:last-child { border-right: none; }
.stats-type-tabs button:hover { color: var(--text); background: var(--bg-card-hover); }
.stats-type-tabs button.active { color: var(--accent); background: var(--accent-dim); }

/* ===== LEADERBOARD TABS ===== */
.lb-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lb-tabs button {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 24px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  font-family: inherit;
}

.lb-tabs button:last-child { border-right: none; }
.lb-tabs button:hover { color: var(--text); background: var(--bg-card-hover); }

.lb-tabs button.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 26px; }
  .hero { padding: 32px 16px 24px; }
  .container { padding: 12px; }
  .profile-header { flex-direction: column; text-align: center; gap: 12px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .buildings-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .hero-full { min-height: 400px; }
  .hero-full-content { padding: 48px 16px; }
  .hero-full-title { font-size: 40px; letter-spacing: 2px; }
  .hero-full-tagline { font-size: 18px; }
  .land-split { grid-template-columns: 1fr; gap: 28px; }
  .land-split-reverse { direction: ltr; }
  .land-section { padding: 40px 16px; }
  .resource-grid-big { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-block .stat-value { font-size: 18px; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== FULL-WIDTH HERO ===== */
.hero-full {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at 50% 30%, #1a3a5c 0%, #0f1923 70%);
  overflow: hidden;
}

.hero-full-overlay {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234fc3f7' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-full-content {
  position: relative;
  z-index: 1;
  padding: 80px 24px;
  max-width: 700px;
}

.hero-full-badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 20px;
}

.hero-full-title {
  font-size: 64px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 4px;
  margin-bottom: 8px;
  line-height: 1.1;
  text-shadow: 0 4px 30px rgba(79, 195, 247, 0.15);
}

.hero-full-tagline {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.hero-full-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.65;
}

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

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 11px 28px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

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

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 10px 28px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.btn-secondary:hover { background: var(--accent-dim); }

.btn-lg {
  padding: 14px 36px;
  font-size: 15px;
}

/* ===== LANDING SECTIONS ===== */
.land-section {
  padding: 64px 24px;
}

.land-section-dark {
  background: var(--bg-secondary);
}

.land-section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.land-section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.land-section-inner h2 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
}

.land-section-inner > .land-split h2 {
  margin-bottom: 12px;
}

/* Split layout: visual + text side by side */
.land-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.land-split-reverse {
  direction: rtl;
}

.land-split-reverse > * {
  direction: ltr;
}

.land-split-text p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

/* Building showcase grid */
.land-showcase {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.showcase-row {
  display: flex;
  gap: 10px;
}

.showcase-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 10px;
  border-radius: var(--radius-lg);
  font-size: 32px;
  border: 1px solid var(--border);
  transition: transform 0.15s ease, border-color var(--transition);
}

.showcase-item:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
}

.showcase-item span {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Stats preview for combat section */
.land-stats-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.land-stat-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color var(--transition);
}

.land-stat-row:hover { border-color: var(--border-light); }

.land-stat-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.land-stat-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.land-stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Resource cards big */
.resource-grid-big {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.resource-card-big {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: border-color var(--transition), transform 0.15s ease;
}

.resource-card-big:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.resource-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.resource-card-big h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}

.resource-card-big p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Clan preview card */
.clan-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.clan-preview-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.clan-preview-members {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.clan-member-dot {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--accent);
  border: 1px solid var(--border);
}

/* CTA Banner */
.land-cta {
  padding: 64px 24px;
  background: linear-gradient(135deg, #1a3a5c 0%, #0f1923 100%);
  border-top: 1px solid var(--border);
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 24px 20px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}
