:root {
  --bg-dark: #f4f7fb;
  --bg-card: #ffffff;
  --bg-sub: #eef3f9;
  --border: #d7e0ec;
  --text-main: #172033;
  --text-dim: #627188;
  --primary: #007fa7;
  --secondary: #7c47ff;
  --gold: #a86a00;
  --red: #d34b4b;
  --sa-surface-1: #ffffff;
  --sa-surface-2: #f5f8fc;
  --sa-surface-3: #ebf1f7;
  --sa-surface-4: #dde6f1;
  --sa-text-strong: #0f1728;
  --sa-text-muted: #5c6a82;
  --sa-text-soft: #74829a;
  --sa-line-soft: rgba(15, 23, 40, 0.08);
  --sa-line-strong: rgba(15, 23, 40, 0.14);
  --sa-shadow: 0 18px 40px rgba(16, 24, 40, 0.08);
  --sa-overlay: rgba(248, 251, 255, 0.92);
  --sa-accent-soft: rgba(0, 127, 167, 0.1);
  --sa-secondary-soft: rgba(124, 71, 255, 0.1);
  --sa-gold-soft: rgba(168, 106, 0, 0.12);
  --sa-red-soft: rgba(211, 75, 75, 0.1);
}

body.dark-mode {
  --bg-dark: #0f111a;
  --bg-card: #1a1d2e;
  --bg-sub: #141724;
  --border: #2d3356;
  --text-main: #e0e0e0;
  --text-dim: #888;
  --primary: #00d2ff;
  --secondary: #bc00ff;
  --gold: #ffcc00;
  --red: #ff4d4d;
  --sa-surface-1: #171b2d;
  --sa-surface-2: #111522;
  --sa-surface-3: #141724;
  --sa-surface-4: #1e2235;
  --sa-text-strong: #ffffff;
  --sa-text-muted: #95a0c9;
  --sa-text-soft: #7f8ab1;
  --sa-line-soft: rgba(255, 255, 255, 0.06);
  --sa-line-strong: rgba(255, 255, 255, 0.1);
  --sa-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --sa-overlay: rgba(20, 23, 36, 0.9);
  --sa-accent-soft: rgba(0, 210, 255, 0.12);
  --sa-secondary-soft: rgba(188, 0, 255, 0.14);
  --sa-gold-soft: rgba(255, 204, 0, 0.12);
  --sa-red-soft: rgba(255, 77, 77, 0.12);
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Pretendard', sans-serif;
  min-height: 100vh;
  padding-top: 70px; /* GNB 높이만큼 여백 확보 */
}

/* Home Navigation Button (Optional, since we now have GNB) */
.home-nav { margin-bottom: 25px; text-align: left; }
.home-link {
  text-decoration: none; font-size: 13px; font-weight: bold; color: var(--gold);
  background: rgba(255, 204, 0, 0.05); border: 1px solid rgba(255, 204, 0, 0.2);
  padding: 8px 16px; border-radius: 10px; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.home-link:hover { background: rgba(255, 204, 0, 0.1); transform: translateX(-3px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

.sa-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
}

.sa-home-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.sa-home-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: white;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sa-home-badge.subtle {
  background: var(--sa-accent-soft);
  border-color: color-mix(in srgb, var(--primary) 28%, transparent);
  color: var(--primary);
}

.sa-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.85fr);
  gap: 24px;
  margin-bottom: 26px;
}

.sa-home-hero-copy,
.sa-home-hero-panel {
  border-radius: 30px;
  box-shadow: var(--sa-shadow);
}

.sa-home-hero-copy {
  position: relative;
  overflow: hidden;
  padding: 38px;
  background:
    radial-gradient(circle at top right, rgba(0, 127, 167, 0.28), transparent 34%),
    radial-gradient(circle at 20% 20%, rgba(124, 71, 255, 0.18), transparent 26%),
    linear-gradient(135deg, #08111f 0%, #0f1f39 54%, #1358d8 100%);
  color: white;
}

.sa-home-hero-copy h1 {
  margin: 18px 0 14px;
  font-size: clamp(2.7rem, 5vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.sa-home-hero-copy p {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1rem;
  line-height: 1.8;
}

.sa-home-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.sa-home-hero-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.88rem;
  font-weight: 700;
}

.sa-home-hero-panel {
  padding: 28px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 94%, transparent), color-mix(in srgb, var(--sa-surface-2) 96%, transparent)),
    radial-gradient(circle at bottom right, color-mix(in srgb, var(--secondary) 16%, transparent), transparent 42%);
  border: 1px solid var(--sa-line-strong);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sa-home-panel-label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.sa-home-hero-panel strong {
  color: var(--sa-text-strong);
  font-size: 1.4rem;
  line-height: 1.2;
}

.sa-home-hero-panel p {
  margin: 0;
  color: var(--sa-text-muted);
  line-height: 1.7;
}

.sa-home-panel-link,
.sa-home-league-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 800;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.sa-home-panel-link {
  width: fit-content;
  background: linear-gradient(135deg, var(--primary), #2d6bff);
  color: #08111f;
  box-shadow: 0 14px 28px rgba(0, 127, 167, 0.24);
}

.sa-home-panel-link:hover,
.sa-home-league-link:hover {
  transform: translateY(-2px);
  opacity: 0.96;
}

.sa-home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.sa-home-feature-card {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--sa-line-strong);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 95%, transparent), color-mix(in srgb, var(--sa-surface-2) 98%, transparent));
  box-shadow: var(--sa-shadow);
}

.sa-home-feature-card.accent {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 88%, transparent), color-mix(in srgb, var(--sa-surface-2) 92%, transparent)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--secondary) 18%, transparent), transparent 42%);
}

.sa-home-feature-kicker {
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sa-home-feature-card h2 {
  margin: 0 0 10px;
  color: var(--sa-text-strong);
  font-size: 1.3rem;
  line-height: 1.2;
}

.sa-home-feature-card p {
  margin: 0;
  color: var(--sa-text-muted);
  line-height: 1.7;
}

.sa-home-search-card {
  border-bottom: none;
  border-radius: 30px;
  border: 1px solid var(--sa-line-strong);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 96%, transparent), color-mix(in srgb, var(--sa-surface-2) 98%, transparent)),
    radial-gradient(circle at top center, color-mix(in srgb, var(--primary) 12%, transparent), transparent 44%);
  box-shadow: var(--sa-shadow);
}

.sa-search-eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sa-home-search-card h2 {
  margin: 10px 0 0;
  color: var(--sa-text-strong);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.sa-home-search-desc {
  max-width: 660px;
  margin: 14px auto 0;
  color: var(--sa-text-muted);
  line-height: 1.8;
}

.sa-home-search-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sa-search-guide {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.sa-search-guide-card {
  width: min(100%, 760px);
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--sa-line-strong);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 96%, transparent), color-mix(in srgb, var(--sa-surface-2) 98%, transparent)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--secondary) 14%, transparent), transparent 42%);
  text-align: left;
}

.sa-search-guide-kicker {
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.sa-search-guide-card strong {
  display: block;
  color: var(--sa-text-strong);
  font-size: 1.05rem;
  line-height: 1.4;
}

.sa-search-guide-card p {
  margin: 8px 0 0;
  color: var(--sa-text-muted);
  line-height: 1.7;
}

.sa-search-guide-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.sa-search-guide-points span,
.sa-results-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--sa-line-soft);
  border: 1px solid var(--sa-line-strong);
  color: var(--sa-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.sa-home-league-link {
  border: 1px solid color-mix(in srgb, var(--secondary) 32%, transparent);
  background: var(--sa-secondary-soft);
  color: color-mix(in srgb, var(--secondary) 72%, white 28%);
}

.sa-results-shell {
  margin-top: 30px;
  padding: 30px;
  border-radius: 30px;
  border: 1px solid var(--sa-line-strong);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 95%, transparent), color-mix(in srgb, var(--sa-surface-2) 98%, transparent));
  box-shadow: var(--sa-shadow);
}

.sa-results-header {
  margin-bottom: 18px;
}

.sa-results-header h2 {
  margin: 12px 0 0;
  color: var(--sa-text-strong);
  font-size: 1.9rem;
}

.sa-results-header p {
  margin: 10px 0 0;
  color: var(--sa-text-muted);
  line-height: 1.7;
}

.sa-results-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.sa-results-meta span.is-strong {
  color: var(--sa-text-strong);
  border-color: color-mix(in srgb, var(--primary) 28%, transparent);
  background: var(--sa-accent-soft);
}

.sa-results-notice {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--gold) 32%, transparent);
  background: linear-gradient(180deg, var(--sa-gold-soft), color-mix(in srgb, var(--sa-surface-1) 96%, transparent));
  color: var(--sa-text-strong);
}

.sa-results-notice strong {
  display: block;
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 14px;
}

.sa-results-notice p {
  margin: 0;
  color: var(--sa-text-muted);
  line-height: 1.6;
}

.sa-results-notice a {
  display: inline-flex;
  margin-top: 10px;
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
}

.sa-league-shell {
  max-width: 1160px;
}

.sa-league-hero {
  margin-bottom: 32px;
}

.sa-league-hero h1 {
  margin: 14px 0 10px;
  color: var(--sa-text-strong);
  font-size: clamp(2.4rem, 4vw, 3.5rem);
  letter-spacing: -0.04em;
}

.sa-league-intro {
  max-width: 820px;
  margin: 0 0 24px;
  color: var(--sa-text-muted);
  line-height: 1.8;
}

.sa-league-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.sa-league-card {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--sa-line-strong);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 96%, transparent), color-mix(in srgb, var(--sa-surface-2) 99%, transparent));
  box-shadow: var(--sa-shadow);
}

.sa-league-card.active {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sa-surface-1) 90%, transparent), color-mix(in srgb, var(--sa-surface-2) 94%, transparent)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 16%, transparent), transparent 44%);
}

.sa-league-card.planned {
  opacity: 0.94;
}

.sa-league-card-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--sa-accent-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.sa-league-card h2 {
  margin: 14px 0 10px;
  color: var(--sa-text-strong);
  font-size: 1.3rem;
}

.sa-league-card p {
  margin: 0;
  color: var(--sa-text-muted);
  line-height: 1.75;
}

.sa-league-card a,
.sa-league-card span {
  display: inline-flex;
  margin-top: 16px;
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.sa-league-search-title {
  margin: 0;
  color: var(--sa-text-strong);
  font-size: 2rem;
}

.sa-league-search-desc {
  max-width: 720px;
  margin: 14px auto 0;
  color: var(--sa-text-muted);
  line-height: 1.8;
}

.hidden { display: none !important; }

/* Global Loading UI */
#loading {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}
#loading p { color: var(--primary); font-weight: 600; }
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--sa-accent-soft); border-left-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shared Modal Styles */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10,16,28,0.48); 
  display: flex; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(5px);
}
.modal-content {
  background: var(--bg-card); padding: 30px; border-radius: 12px; border: 1px solid var(--border); 
  width: 95%; max-width: 450px; max-height: 90vh; overflow-y: auto; text-align: center; position: relative; 
  box-shadow: var(--sa-shadow); display: flex; flex-direction: column;
}
.balancer-modal {
  max-width: 1000px !important;
  max-height: 95vh !important;
}
.modal-content h3 { margin-top: 0; color: var(--sa-text-strong); }
.modal-content input {
  width: 100%; padding: 12px; background: var(--bg-sub); border: 1px solid var(--border); border-radius: 6px; 
  color: var(--text-main); margin: 15px 0; box-sizing: border-box; font-size: 16px;
}
.modal-btns { display: flex; gap: 10px; margin-top: 20px; }
.modal-btns button { flex: 1; padding: 12px; border-radius: 6px; border: none; font-weight: bold; cursor: pointer; }
.modal-btns button.primary { background: var(--primary); color: #000; }

/* Main Search Section */
.search-section { text-align: center; padding: 50px 0; border-bottom: 1px solid var(--border); }
.search-bar { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.search-bar input { padding: 12px 20px; width: 300px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); font-size: 16px; }
.search-btns { display: flex; gap: 8px; }
.search-bar button { padding: 12px 25px; background: var(--primary); border: none; border-radius: 8px; color: #0f111a; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.search-bar .compare-btn { background: var(--secondary); color: #fff; }
.search-bar button:hover { opacity: 0.9; transform: translateY(-1px); }
.search-bar button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}
.search-bar input:disabled {
  opacity: 0.72;
  cursor: wait;
}
.crew-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Recent Searches Chips */
.recent-searches {
  margin-top: 15px; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 35px;
}
.recent-searches span { color: var(--text-dim); font-size: 13px; }
.favorite-searches { margin-top: 8px; }
.favorite-searches .search-chip {
  border-color: color-mix(in srgb, var(--gold) 28%, transparent);
  color: var(--gold);
  background: var(--sa-gold-soft);
}
.favorite-searches .search-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 18%, transparent);
}
.search-chip {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim); padding: 5px 12px; border-radius: 20px; font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.search-chip:hover { background: var(--bg-sub); color: var(--primary); border-color: var(--primary); }
.chip-action-btn {
  background: transparent;
  border: 1px solid var(--sa-line-soft);
  color: var(--sa-text-muted);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.chip-action-btn:hover {
  border-color: var(--sa-line-strong);
  color: var(--sa-text-strong);
  background: var(--sa-line-soft);
}
.chip-with-remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-right: 6px;
}
.chip-label,
.chip-compare,
.chip-remove {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
}
.chip-label { line-height: 1; }
.chip-compare {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--sa-secondary-soft);
  color: color-mix(in srgb, var(--secondary) 70%, white 30%);
  font-size: 11px;
  font-weight: 700;
}
.chip-compare:hover {
  background: color-mix(in srgb, var(--secondary) 18%, transparent);
  color: var(--secondary);
}
.chip-remove {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: var(--sa-text-muted);
}
.chip-remove:hover {
  background: var(--sa-line-soft);
  color: var(--sa-text-strong);
}

/* VS Mode Container */
.vs-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; }
.vs-header-banner {
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 15px; text-align: center; border-radius: 12px; margin-bottom: 20px; font-weight: 900; color: #fff; text-transform: uppercase; letter-spacing: 2px;
}
@media (max-width: 850px) { .vs-container { grid-template-columns: 1fr; } }

/* Common Helper Classes */
.clickable-name { cursor: pointer; transition: color 0.2s; }
.clickable-name:hover { color: var(--primary); text-decoration: underline; }
.sub-btn { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim); padding: 8px 16px; border-radius: 6px; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.sub-btn:hover { background: var(--bg-sub); color: var(--sa-text-strong); }
.sub-btn.favorite-active {
  border-color: color-mix(in srgb, var(--gold) 40%, transparent);
  color: var(--gold);
  background: var(--sa-gold-soft);
}
.sub-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Admin Panel UI */
.admin-section {
  background: var(--bg-card); border: 1px solid var(--gold); border-radius: 12px; padding: 25px; margin: 20px 0; box-shadow: var(--sa-shadow);
}
.admin-section h2 { margin-top: 0; color: var(--gold); margin-bottom: 20px; }
.admin-actions-bar { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255,204,0,0.2); }

.app-list { display: flex; flex-direction: column; gap: 10px; }
.app-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-sub); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.app-name { color: var(--sa-text-strong); font-weight: 700; }
.app-actions { display: flex; gap: 8px; }
.approve-btn, .reject-btn, .close-panel {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.approve-btn {
  background: rgba(0, 210, 255, 0.14); border-color: rgba(0, 210, 255, 0.35); color: var(--primary);
}
.approve-btn:hover { background: rgba(0, 210, 255, 0.22); transform: translateY(-1px); }
.reject-btn {
  background: rgba(255, 77, 77, 0.12); border-color: rgba(255, 77, 77, 0.32); color: var(--red);
}
.reject-btn:hover { background: rgba(255, 77, 77, 0.2); transform: translateY(-1px); }
.close-panel {
  margin-top: 14px; background: var(--sa-surface-4); border-color: var(--border); color: var(--sa-text-strong);
}
.close-panel:hover { background: var(--bg-sub); color: var(--sa-text-strong); transform: translateY(-1px); }

.admin-main-btns { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.admin-sub-btns { display: flex; gap: 10px; margin-top: 10px; }

.manual-penalty-panel {
  background: rgba(255, 77, 77, 0.06);
  border: 1px solid rgba(255, 77, 77, 0.22);
  border-radius: 12px;
  padding: 16px;
}
.manual-penalty-panel h4 {
  margin: 0 0 12px 0;
  color: #ff9c9c;
  font-size: 15px;
}
.manual-penalty-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.3fr) auto auto;
  gap: 10px;
  align-items: center;
}
.manual-penalty-controls select {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  min-height: 40px;
}
.manual-penalty-hint {
  margin: 10px 0 0 0;
  font-size: 12px;
  color: #c9b0b0;
}
.manual-penalty-log-panel {
  margin-top: 14px;
  background: var(--sa-line-soft);
  border: 1px solid var(--sa-line-strong);
  border-radius: 12px;
  padding: 16px;
}
.manual-penalty-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.manual-penalty-log-head h4 {
  margin: 0;
  font-size: 15px;
  color: #d7dbff;
}
.manual-penalty-log-list {
  display: grid;
  gap: 10px;
}
.manual-penalty-log-item {
  background: rgba(12, 16, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
}
.manual-penalty-log-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.manual-penalty-log-title strong {
  color: var(--sa-text-strong);
  font-size: 14px;
}
.manual-penalty-log-title span {
  color: var(--sa-text-muted);
  font-size: 12px;
}
.manual-penalty-log-meta {
  display: grid;
  gap: 4px;
  color: var(--text-dim);
  font-size: 12px;
}
.manual-penalty-log-empty {
  margin: 0;
  padding: 12px 0;
  color: var(--text-dim);
  font-size: 12px;
}

.settle-btn {
  background: var(--gold); color: #000; border: none; padding: 12px 24px; border-radius: 8px; 
  font-weight: 900; cursor: pointer; transition: all 0.2s; font-size: 14px;
}
.settle-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(255, 204, 0, 0.3); }
.settle-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.season-date-setter { 
  display: flex; align-items: center; gap: 10px; background: rgba(255, 204, 0, 0.05); 
  padding: 8px 15px; border-radius: 8px; border: 1px solid rgba(255, 204, 0, 0.2); 
}
.season-date-setter label { font-size: 13px; font-weight: bold; color: var(--gold); white-space: nowrap; }
.season-date-setter input[type="date"] { 
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); padding: 5px 10px; 
  border-radius: 4px; font-size: 13px; outline: none; 
}

.admin-reset-btn { border-color: #ff4d4d !important; color: #ff4d4d !important; margin-left: auto; }
.repair-btn { border-color: #00bcd4 !important; color: #00bcd4 !important; }

.admin-member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; margin-top: 20px; }
.admin-member-item { 
  background: var(--bg-sub); border: 1px solid var(--border); padding: 18px; border-radius: 12px; 
  display: flex; flex-direction: column; gap: 12px; transition: border-color 0.2s;
}
.admin-member-item:hover { border-color: var(--gold); }
.admin-member-item .m-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--sa-line-soft); padding-bottom: 10px; }
.admin-member-item .m-name { font-weight: bold; font-size: 16px; }
.admin-member-item .m-score { font-family: 'Roboto Mono', monospace; font-size: 14px; color: var(--gold); }
.admin-member-item .m-stats { font-size: 13px; color: var(--text-dim); }
.admin-member-item .m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.mini-btn { 
  padding: 10px; border-radius: 6px; font-size: 12px; font-weight: bold; cursor: pointer; 
  border: 1px solid transparent; transition: all 0.2s; display: flex; align-items: center; justify-content: center; 
}
.mini-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.individual-scan-btn { background: rgba(0, 210, 255, 0.1); color: var(--primary); border-color: rgba(0, 210, 255, 0.2); grid-column: 1 / -1; font-size: 13px; }
.update-name-btn { background: var(--sa-surface-4); color: var(--sa-text-strong); }
.delete-member-btn { background: rgba(255, 77, 77, 0.1); color: #ff4d4d; border-color: rgba(255, 77, 77, 0.2); }

.admin-hint { font-size: 12px; color: var(--text-dim); font-style: italic; margin-top: 20px; }
.history-section h2 { margin-top: 40px; margin-bottom: 20px; }

.settlement-report-modal { max-width: 760px; width: 95%; text-align: left; }
.settlement-report-modal h2 { margin: 0 0 8px 0; color: var(--gold); font-size: 22px; }
.settlement-report-modal .summary-text { margin: 0 0 14px 0; color: var(--text-dim); font-size: 13px; }
.report-scroll-area {
  max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  padding-right: 4px;
}
.report-item {
  background: var(--bg-sub); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
}
.report-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
  border-bottom: 1px solid var(--sa-line-soft); padding-bottom: 8px;
}
.map-name { color: var(--sa-text-strong); font-weight: 800; font-size: 15px; }
.winner-tag {
  font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 999px; border: 1px solid transparent;
}
.winner-tag.red { color: #ff7878; background: rgba(255, 77, 77, 0.14); border-color: rgba(255, 77, 77, 0.35); }
.winner-tag.blue { color: #78dcff; background: rgba(0, 210, 255, 0.14); border-color: rgba(0, 210, 255, 0.35); }
.player-changes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.change-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-name { color: #dce5ff; font-size: 13px; font-weight: 700; }
.p-mmr { color: #a7f0ff; font-size: 13px; font-family: 'Roboto Mono', monospace; }
.p-mmr small { color: #8d97be; }
@media (max-width: 760px) {
  .player-changes { grid-template-columns: 1fr; }
}

/* Team Balancer UI (Inside Modal) */
.balancer-modal {
  max-width: 1000px !important;
  max-height: 95vh !important;
}
.balancer-search-input {
  width: 100%; padding: 12px 20px; margin-bottom: 15px; border: 1px solid var(--border); border-radius: 8px; 
  background: var(--bg-dark); color: var(--text-main); font-size: 15px; outline: none; box-sizing: border-box;
}
.selected-count-display {
  color: var(--gold); font-size: 15px; font-weight: bold; margin-bottom: 15px; text-align: right;
}
.balancer-member-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 20px 0; 
  max-height: 450px; overflow-y: auto; padding: 15px; background: var(--bg-sub); border-radius: 12px; border: 1px solid var(--border);
}
.balancer-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; background: #1c2031; border-radius: 10px; 
  cursor: pointer; transition: all 0.2s; border: 1px solid transparent;
}
.balancer-item:hover { background: var(--border); border-color: rgba(0, 210, 255, 0.3); }
.balancer-item.selected { background: rgba(0, 210, 255, 0.1); border-color: var(--primary); }
.balancer-item input[type="checkbox"] { margin: 0; width: 18px; height: 18px; cursor: pointer; }
.balancer-item .m-name { font-size: 14px; color: var(--sa-text-strong); font-weight: 600; flex: 1; text-align: left; }
.balancer-item .m-mmr { color: var(--text-dim); font-size: 11px; margin-right: 10px; }

.pos-select { display: flex; gap: 5px; background: rgba(0,0,0,0.2); padding: 3px; border-radius: 20px; }
.pos-select input[type="radio"] { display: none; }
.pos-select label { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 50%; font-size: 14px; transition: all 0.2s; filter: grayscale(1); opacity: 0.5; }
.pos-select input[type="radio"]:checked + label { filter: grayscale(0); opacity: 1; background: var(--border); }

/* SWR Status Bar */
.swr-status {
  padding: 10px 20px;
  margin-bottom: 15px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.5s ease;
  opacity: 1;
  transform: translateY(0);
}
.swr-status.stale {
  background: rgba(255, 204, 0, 0.1);
  border: 1px solid rgba(255, 204, 0, 0.3);
  color: var(--gold);
}
.swr-status.fresh {
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: var(--primary);
  animation: pulse-fresh 2s infinite;
}
.swr-status.hidden-out {
  opacity: 0;
  transform: translateY(-10px);
}
.swr-status .spin {
  display: inline-block;
  animation: spin 2s linear infinite;
}

/* Season Toggle */
.season-toggle-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 4px 0 12px 0;
}
.season-toggle-group {
  display: inline-flex;
  gap: 6px;
  background: rgba(20, 23, 36, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.season-toggle-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #a4afc7;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.season-toggle-btn:hover {
  color: var(--sa-text-strong);
  background: var(--sa-line-soft);
}
.season-toggle-btn.active {
  color: #00131a;
  background: #79e3ff;
  border-color: rgba(121, 227, 255, 0.7);
}
.season-period {
  color: #7f8aab;
  font-size: 12px;
  font-weight: 700;
}

@keyframes pulse-fresh {
  0% { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(0, 210, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0); }
}

/* Relationship (Synergy & Rivalry) Cards Common Styles */
.rel-section { display: flex; flex-direction: column; height: 100%; }
.rel-header { font-size: 14px; color: var(--text-dim); margin: 0 0 15px 0; font-weight: normal; display: flex; align-items: center; gap: 6px; }
.rel-grid { display: flex; flex-direction: column; gap: 10px; }
.rel-card { 
  background: var(--sa-surface-3); border-radius: 10px; padding: 12px; position: relative; 
  border: 1px solid transparent; transition: all 0.2s ease; cursor: pointer;
  display: flex; flex-direction: column;
}
.rel-card:hover { transform: translateY(-2px); box-shadow: var(--sa-shadow); }
.rel-card.best { border-color: rgba(0, 255, 136, 0.2); background: linear-gradient(135deg, rgba(0, 255, 136, 0.08) 0%, var(--sa-surface-3) 100%); }
.rel-card.worst { border-color: rgba(0, 210, 255, 0.2); background: linear-gradient(135deg, rgba(0, 210, 255, 0.08) 0%, var(--sa-surface-3) 100%); }
.rel-card.nemesis { border-color: rgba(255, 77, 77, 0.2); background: linear-gradient(135deg, rgba(255, 77, 77, 0.08) 0%, var(--sa-surface-3) 100%); }
.rel-card.prey { border-color: rgba(0, 210, 255, 0.2); background: linear-gradient(135deg, rgba(0, 210, 255, 0.08) 0%, var(--sa-surface-3) 100%); }

.rel-tag { font-size: 11px; font-weight: 800; margin-bottom: 6px; display: block; }
.best .rel-tag { color: #00ff88; }
.worst .rel-tag, .prey .rel-tag { color: #00d2ff; }
.nemesis .rel-tag { color: #ff4d4d; }

.rel-body { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.rel-name { font-size: 16px; font-weight: bold; color: var(--sa-text-strong); }
.rel-stats { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; }
.rel-stats strong { color: var(--sa-text-strong); margin: 0 2px; }
.rel-stats .dot { margin: 0 6px; opacity: 0.3; }

.rel-footer { margin-top: 6px; font-size: 10px; color: var(--text-dim); line-height: 1.2; }

@media (max-width: 768px) {
  .sa-home-shell,
  .sa-container { padding: 0 14px 24px; }
  .sa-home-hero,
  .sa-home-feature-grid,
  .sa-league-grid {
    grid-template-columns: 1fr;
  }
  .sa-home-hero-copy,
  .sa-home-hero-panel,
  .sa-home-search-card,
  .sa-results-shell,
  .sa-league-card {
    border-radius: 22px;
  }
  .sa-home-hero-copy {
    padding: 28px 24px;
  }
  .sa-home-hero-panel,
  .sa-home-feature-card,
  .sa-results-shell,
  .sa-league-card {
    padding: 22px 18px;
  }
  .sa-home-hero-copy h1 {
    font-size: 2.4rem;
  }
  .search-section { padding: 28px 0 18px; }
  .search-section h1 {
    font-size: 30px;
    line-height: 1.15;
    margin-bottom: 0;
  }
  .home-nav {
    margin-bottom: 18px;
  }
  .search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .search-bar input {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }
  .search-btns {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .search-bar button {
    width: 100%;
    padding: 12px 14px;
  }
  .recent-searches,
  .favorite-searches,
  .crew-actions,
  .sa-home-search-actions {
    justify-content: flex-start;
  }
  .sa-search-guide-card {
    padding: 16px;
    border-radius: 18px;
  }
  .sa-search-guide-points,
  .sa-results-meta {
    gap: 8px;
  }
  .recent-searches span {
    width: 100%;
    text-align: left;
  }
  .chip-action-btn {
    margin-left: auto;
  }
  .crew-actions .sub-btn,
  .sa-home-search-actions .sub-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    text-align: center;
  }
  .sa-home-panel-link,
  .sa-home-league-link {
    width: 100%;
    box-sizing: border-box;
  }
  .swr-status {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    line-height: 1.45;
  }
  .season-toggle-bar { flex-direction: column; align-items: flex-start; }
  .manual-penalty-controls { grid-template-columns: 1fr; }
  .manual-penalty-log-head,
  .manual-penalty-log-title { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .sa-container { padding: 0 12px 20px; }
  .sa-home-shell { padding: 0 12px 20px; }
  .sa-home-hero-copy h1,
  .sa-league-hero h1 {
    font-size: 2rem;
  }
  .sa-home-search-card h2,
  .sa-results-header h2,
  .sa-league-search-title {
    font-size: 1.6rem;
  }
  .search-section h1 {
    font-size: 26px;
  }
  .home-link {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
  .search-btns {
    grid-template-columns: minmax(0, 1fr) 52px 78px;
  }
  .search-bar input,
  .search-bar button {
    font-size: 15px;
  }
  .search-chip,
  .chip-action-btn {
    font-size: 12px;
  }
  .crew-actions .sub-btn,
  .sa-home-search-actions .sub-btn {
    flex-basis: 100%;
  }
  .history-section h2 {
    margin-top: 28px;
    margin-bottom: 14px;
    font-size: 22px;
  }
}
