/* ========== CSS Variables & Reset ========== */
:root {
  --bg-primary: #0e1015;
  --bg-secondary: #1a1d26;
  --bg-tertiary: #252830;
  --bg-card: #1e2028;
  --bg-card-hover: #262933;
  --bg-input: #2a2d38;
  --border-color: #2e3140;
  --border-light: #383b4a;
  --text-primary: #e8e8ec;
  --text-secondary: #9a9bac;
  --text-tertiary: #6b6c7d;
  --accent-blue: #5383e8;
  --accent-blue-hover: #4171d6;
  --accent-blue-bg: rgba(83, 131, 232, 0.12);
  --accent-gold: #c8aa6e;
  --accent-gold-bg: rgba(200, 170, 110, 0.12);
  --accent-red: #e84057;
  --accent-red-bg: rgba(232, 64, 87, 0.12);
  --accent-green: #49b04a;
  --accent-green-bg: rgba(73, 176, 74, 0.12);
  --accent-purple: #9b59b6;
  --accent-purple-bg: rgba(155, 89, 182, 0.12);
  --accent-orange: #e8993e;
  --win-color: #5383e8;
  --lose-color: #e84057;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --header-height: 60px;
  --sidebar-width: 240px;
  --container-max: 1200px;
  --transition: 0.2s ease;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

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

/* ========== Header / Navigation ========== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: rgba(14, 16, 21, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-inner {
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  margin-top: 2px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo, .logo:hover { color: #ffffff; }
.logo span.accent { color: #ffffff; }
.logo:hover { opacity: 0.8; transition: opacity 0.2s; }

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

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
  flex-shrink: 0;
}

.nav a {
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  position: relative;
}

.nav a:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.nav a.active {
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
}

.nav a.admin-link { color: var(--accent-gold); }
.nav a.admin-link:hover { background: var(--accent-gold-bg); }
.nav a.admin-link.active { background: var(--accent-gold-bg); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.2rem;
}

/* ========== Main Layout ========== */
.main-content {
  padding-top: var(--header-height);
  min-height: 100vh;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px;
}

/* ========== Page Header ========== */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

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

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

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

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

.card-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.card-body { padding: 20px; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--bg-input); color: var(--text-primary); }

.btn-gold {
  background: var(--accent-gold);
  color: #1a1a2e;
  font-weight: 600;
}
.btn-gold:hover { background: #d4b878; }

.btn-danger {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid rgba(232,64,87,0.2);
}
.btn-danger:hover { background: rgba(232,64,87,0.2); }

.btn-sm { padding: 5px 10px; font-size: 0.82rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.badge-win { background: var(--accent-blue-bg); color: var(--accent-blue); }
.badge-lose { background: var(--accent-red-bg); color: var(--accent-red); }
.badge-gold { background: var(--accent-gold-bg); color: var(--accent-gold); }
.badge-green { background: var(--accent-green-bg); color: var(--accent-green); }
.badge-purple { background: var(--accent-purple-bg); color: var(--accent-purple); }

/* ========== Tables ========== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-tertiary);
  padding: 10px 16px;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  white-space: nowrap;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-card-hover); }

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  padding: 10px 20px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* ========== Form Elements ========== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-blue);
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236b6c7d' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-change {
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red); }

/* ========== Match Card ========== */
.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  overflow: hidden;
  transition: all var(--transition);
}

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

.match-card.win { border-left: 3px solid var(--win-color); }
.match-card.lose { border-left: 3px solid var(--lose-color); }

.match-summary {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 16px;
  cursor: pointer;
}

.match-result {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 28px;
  text-align: center;
}

.match-result.win { color: var(--win-color); }
.match-result.lose { color: var(--lose-color); }

.match-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.match-type { font-weight: 600; font-size: 0.92rem; }
.match-meta { font-size: 0.82rem; color: var(--text-tertiary); }

.match-teams {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 2;
}

.team-champions {
  display: flex;
  gap: 4px;
}

.champion-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
}

.champion-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vs-divider {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 700;
}

.match-score {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  gap: 4px;
}

.match-score .blue { color: var(--win-color); }
.match-score .red { color: var(--lose-color); }

/* ========== Champion / Player Avatars ========== */
.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.player-name { font-weight: 500; }
.player-tier {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* ========== Tier Colors ========== */
.tier-iron { color: #8b8b8b; }
.tier-bronze { color: #a0785a; }
.tier-silver { color: #8eaab5; }
.tier-gold { color: var(--accent-gold); }
.tier-platinum { color: #49b6a4; }
.tier-emerald { color: #49b04a; }
.tier-diamond { color: #576ece; }
.tier-master { color: #9b59b6; }
.tier-grandmaster { color: #e84057; }
.tier-challenger { color: #f4c874; }

/* ========== Vote / Poll ========== */
.poll-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
}

.poll-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.poll-meta {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.poll-option {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.poll-option:hover { border-color: var(--accent-blue); }

.poll-option.selected {
  border-color: var(--accent-blue);
  background: var(--accent-blue-bg);
}

.poll-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent-blue-bg);
  border-radius: var(--radius-md);
  transition: width 0.5s ease;
}

.poll-option-text { position: relative; z-index: 1; font-weight: 500; }
.poll-option-pct { position: relative; z-index: 1; font-weight: 600; font-size: 0.9rem; color: var(--accent-blue); }

.poll-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* ========== Q&A ========== */
.qna-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 8px;
  transition: all var(--transition);
  cursor: pointer;
}

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

.qna-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.qna-category {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.qna-title { font-weight: 600; font-size: 0.95rem; flex: 1; }

.qna-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

.qna-status { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.qna-status.resolved { background: var(--accent-green-bg); color: var(--accent-green); }
.qna-status.pending { background: var(--accent-orange); color: #1a1a2e; }

/* ========== Season / League ========== */
.season-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.season-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(83,131,232,0.05), rgba(200,170,110,0.05));
}

.season-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.season-subtitle {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ========== Podium ========== */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px 20px;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.podium-rank {
  width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 12px 8px;
  font-weight: 700;
  font-size: 1.5rem;
}

.podium-rank.first {
  height: 120px;
  background: linear-gradient(180deg, rgba(200,170,110,0.3), rgba(200,170,110,0.08));
  color: var(--accent-gold);
}

.podium-rank.second {
  height: 90px;
  background: linear-gradient(180deg, rgba(142,170,181,0.3), rgba(142,170,181,0.08));
  color: #8eaab5;
}

.podium-rank.third {
  height: 65px;
  background: linear-gradient(180deg, rgba(160,120,90,0.3), rgba(160,120,90,0.08));
  color: #a0785a;
}

.podium-name {
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

/* ========== Admin Sidebar ========== */
.admin-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 20px 0;
  flex-shrink: 0;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.admin-sidebar a:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.admin-sidebar a.active { color: var(--accent-gold); background: var(--accent-gold-bg); }

.admin-main {
  flex: 1;
  padding: 24px;
  overflow-x: auto;
}

/* ========== Toast Notification ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: slideInRight 0.3s ease;
  font-size: 0.9rem;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========== Dropdown ========== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
}

.dropdown-item {
  padding: 10px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover { background: var(--bg-tertiary); }

/* ========== Pagination ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}

.pagination .page {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.pagination .page:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.pagination .page.active { background: var(--accent-blue); color: #fff; }

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

.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 4px; }

/* ========== Hero Section ========== */
.hero {
  text-align: center;
  padding: 64px 20px 48px;
  background: linear-gradient(180deg, rgba(83,131,232,0.06) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 32px;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 24px;
}

/* ========== Feature Grid ========== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 14px;
}

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

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

/* ========== Members Grid ========== */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
}

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

.member-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 600; font-size: 0.95rem; }

.member-details {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.member-role {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
}

.role-admin { background: var(--bg-tertiary); color: var(--text-secondary); }
.role-member { background: var(--accent-blue-bg); color: var(--accent-blue); }

/* ========== Search ========== */
.search-bar {
  position: relative;
  max-width: 400px;
}

.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.search-bar input:focus { border-color: var(--accent-blue); }

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

/* ========== KDA Display ========== */
.kda {
  font-weight: 600;
  font-size: 0.9rem;
}

.kda .kills { color: var(--text-primary); }
.kda .deaths { color: var(--accent-red); }
.kda .assists { color: var(--text-secondary); }
.kda .slash { color: var(--text-tertiary); margin: 0 2px; }

/* ========== Progress Bar ========== */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-fill.blue { background: rgba(83, 131, 232, 0.4); }
.progress-fill.red { background: rgba(83, 131, 232, 0.4); }
.progress-fill.gold { background: rgba(83, 131, 232, 0.4); }
.progress-fill.green { background: rgba(83, 131, 232, 0.4); }

/* ========== Winrate Bar ========== */
.winrate-bar {
  display: flex;
  height: 24px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 600;
}

.winrate-bar .wins {
  background: var(--win-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.winrate-bar .losses {
  background: var(--lose-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 { font-size: 1.1rem; font-weight: 600; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ========== Filters Bar ========== */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-chip:hover { border-color: var(--border-light); color: var(--text-primary); }
.filter-chip.active { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-bg); }

/* ========== Tooltip ========== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

[data-tooltip]:hover::after { opacity: 1; }

/* ========== Mobile Nav Overlay ========== */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-height);
  background: rgba(14, 16, 21, 0.98);
  z-index: 999;
  padding: 24px;
}

.mobile-nav.open { display: block; }

.mobile-nav a {
  display: block;
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}

.mobile-nav a:hover, .mobile-nav a.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.mobile-nav a.active { color: var(--accent-blue); }

/* ========== Goal / 롤목달 ========== */
.goal-section { margin-bottom: 32px; }

.goal-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.goal-section-header h2 { font-size: 1.15rem; font-weight: 700; }

.goal-section-header .goal-count {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.goal-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.goal-card-solorank { border-left-color: var(--border-light); }
.goal-card-champion { border-left-color: var(--border-light); }
.goal-card-flexrank { border-left-color: var(--border-light); }

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

.goal-card-body { padding: 14px 16px; }

.goal-member {
  display: flex;
  align-items: center;
  gap: 10px;
}

.goal-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.goal-member-info { display: flex; flex-direction: column; }
.goal-member-name { font-weight: 600; font-size: 0.92rem; }

.goal-member-pos {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.goal-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.goal-status-achieved { background: var(--accent-green-bg); color: var(--accent-green); }
.goal-status-progress { background: var(--accent-blue-bg); color: var(--accent-blue); }
.goal-status-failed { background: var(--accent-red-bg); color: var(--accent-red); }

.goal-tier-compare {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.goal-tier-current, .goal-tier-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  text-align: center;
}

.goal-tier-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.goal-tier-value {
  font-size: 1.425rem;
  font-weight: 700;
}

.goal-tier-arrow {
  color: var(--text-tertiary);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.goal-progress-wrap { margin-top: 10px; }

.goal-progress-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.goal-champion-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.goal-champion-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  flex-shrink: 0;
  overflow: hidden;
}

.goal-champion-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.goal-champion-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.goal-champion-target {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.goal-champion-detail {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.goal-games-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .admin-sidebar { width: 200px; }
}

@media (max-width: 768px) {
  html { font-size: 14px; }

  .nav { display: none; }
  .mobile-menu-btn { display: flex; }

  .container { padding: 16px; }

  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 0.95rem; }

  .stats-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 6px; }
  .stat-card { padding: 10px 8px; gap: 4px; text-align: center; align-items: center; }
  .stat-card .stat-value { font-size: 1.1rem; }
  .stat-card .stat-label { font-size: 0.7rem; }
  .stat-card .stat-change { font-size: 0.68rem; justify-content: center; }

  .feature-grid { grid-template-columns: 1fr; }
  .members-grid { grid-template-columns: 1fr; }
  .goal-grid { grid-template-columns: 1fr; }

  .match-summary { flex-wrap: wrap; padding: 12px 16px; }
  .match-teams { width: 100%; order: 3; }

  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-sidebar a { white-space: nowrap; padding: 8px 16px; }
  .admin-main { padding: 16px; }

  .podium { gap: 8px; padding: 20px 12px 16px; }
  .podium-rank { width: 50px; }
  .podium-rank.first { height: 90px; font-size: 1.2rem; }
  .podium-rank.second { height: 65px; font-size: 1.1rem; }
  .podium-rank.third { height: 48px; font-size: 1rem; }
  .podium-name { font-size: 0.78rem; }

  .table-wrap { font-size: 0.85rem; -webkit-overflow-scrolling: touch; }
  thead th, tbody td { padding: 8px 12px; }
  tbody td { white-space: normal; }

  .filters-bar { gap: 8px; }

  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

  /* Page header stacking */
  .page-header { flex-direction: column; gap: 12px; }

  /* Admin inline grids collapse */
  .admin-tab [style*="grid-template-columns: 1fr 1fr"],
  .admin-tab [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Reorder items wrap */
  .reorder-item { flex-wrap: wrap; }
  .reorder-item .btn { flex-shrink: 0; }

  /* Search bar in filters */
  .search-bar { margin-left: 0 !important; width: 100%; max-width: 100%; }

  /* Touch targets - min 44px for iOS/Android */
  .pagination .page { width: 44px; height: 44px; }
  .filter-chip { padding: 8px 14px; min-height: 44px; display: inline-flex; align-items: center; }
  .modal-close { width: 44px; height: 44px; }
  .btn-sm { padding: 8px 12px; min-height: 44px; }
  .btn { min-height: 44px; }
  .tab { padding: 12px 16px; min-height: 44px; }
  .dropdown-item { padding: 12px 16px; min-height: 44px; }

  /* Match detail stacking */
  .match-detail-teams { flex-direction: column !important; }
  .match-detail-teams > div { min-width: 0 !important; width: 100% !important; }

  /* Poll cards */
  .poll-footer { flex-direction: column; gap: 4px; align-items: flex-start; }
  .poll-card { padding: 16px; }

  /* Toast notification */
  .toast { left: 12px; right: 12px; bottom: 12px; }

  /* Card spacing */
  .card-header { padding: 12px 16px; }
  .card-body { padding: 16px; }

  /* Season card */
  .season-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
  .season-title { font-size: 1rem; }

  /* Goal card */
  .goal-card-header { padding: 10px 12px; }
  .goal-card-body { padding: 10px 12px; }
  .goal-tier-value { font-size: 1.15rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 4px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.88rem; }
  .header { padding: 0 12px; }

  .match-score { font-size: 0.95rem; }
  .champion-icon { width: 26px; height: 26px; font-size: 0.6rem; }
  .team-champions { gap: 2px; }

  .stat-card .stat-value { font-size: 1rem; }
  .stat-card .stat-label { font-size: 0.65rem; }
  .stat-card .stat-change { font-size: 0.6rem; }

  .podium-rank { width: 42px; }
  .podium-rank.first { height: 72px; }
  .podium-rank.second { height: 52px; }
  .podium-rank.third { height: 40px; }
}

/* ========== Touch & Mobile Polish ========== */
@media (max-width: 768px) {
  /* Hide scrollbars on mobile while keeping scroll functional */
  .admin-sidebar::-webkit-scrollbar,
  .tabs::-webkit-scrollbar,
  .event-legend::-webkit-scrollbar,
  .table-wrap::-webkit-scrollbar,
  .dl-match-detail::-webkit-scrollbar {
    display: none;
  }
  .admin-sidebar,
  .tabs,
  .event-legend,
  .table-wrap,
  .dl-match-detail {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }

  /* iOS fixed positioning fix - prevent rubber-band on fixed header */
  .header {
    position: sticky;
    top: 0;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Prevent text size adjustment on orientation change */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Safe area insets for notched devices */
  .header {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .toast {
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Prevent tap highlight on touch devices */
  a, button, .btn, .tab, .filter-chip, .poll-option, .match-card, .dl-match, .qna-item, .faq-question {
    -webkit-tap-highlight-color: transparent;
  }

  /* Smooth scrolling for overflow containers */
  .table-wrap, .admin-sidebar, .tabs, .dl-match-detail {
    -webkit-overflow-scrolling: touch;
  }

  /* Hide hamburger menu button (replaced by bottom tab bar) */
  .mobile-menu-btn { display: none !important; }

  /* Remove top padding (header is sticky on mobile, not fixed) + add bottom padding for tab bar */
  .main-content {
    padding-top: 0 !important;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* Toast above tab bar */
  .toast {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Touch target improvements */
  .faq-question, .qna-item { min-height: 48px; }
}

/* ========== Bottom Tab Bar ========== */
.bottom-tab-bar {
  display: none;
}
.bottom-more-overlay,
.bottom-more-sheet {
  display: none;
}

@media (max-width: 768px) {
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(26, 29, 38, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    align-items: stretch;
  }

  .bottom-tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    padding: 6px 0;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    position: relative;
  }

  .bottom-tab-item:hover {
    color: var(--text-secondary);
  }

  .bottom-tab-item.active {
    color: var(--accent-blue);
  }

  .bottom-tab-item.active::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-blue-bg);
    z-index: -1;
  }

  .bottom-tab-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bottom-tab-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
  }

  .bottom-tab-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  /* More sheet overlay */
  .bottom-more-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
  }

  .bottom-more-overlay.open {
    display: block;
  }

  /* More sheet */
  .bottom-more-sheet {
    display: none;
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 1002;
    padding: 8px 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .bottom-more-sheet.open {
    display: block;
    transform: translateY(0);
  }

  .bottom-more-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 4px auto 8px;
  }

  .bottom-more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    min-height: 48px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-more-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
  }

  .bottom-more-item.active {
    color: var(--accent-blue);
    background: var(--accent-blue-bg);
  }

  .bottom-more-item.admin-item {
    color: var(--accent-gold);
  }

  .bottom-more-item.admin-item:hover {
    background: var(--accent-gold-bg);
  }

  .bottom-more-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bottom-more-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
  }

  .bottom-more-label {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 500;
  }

  .bottom-more-arrow {
    color: var(--text-tertiary);
    font-size: 0.82rem;
  }

  /* Body scroll lock when more sheet is open */
  body.more-sheet-open {
    overflow: hidden;
    touch-action: none;
  }

  /* Admin sidebar scroll-snap */
  .admin-sidebar {
    scroll-snap-type: x mandatory;
  }

  .admin-sidebar a {
    scroll-snap-align: start;
  }

  /* Admin sidebar fade hint */
  .admin-layout .admin-sidebar {
    position: relative;
  }
}
