@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Cinzel+Decorative:wght@700;900&display=swap');

:root {
  --bg-dark: #1a1a2e;
  --bg-panel: #22223b;
  --bg-panel-light: #2a2a45;
  --gold: #f5c542;
  --gold-dim: #b8942f;
  --text-main: #e8e8f0;
  --text-dim: #9c9cb5;
  --win: #4caf7d;
  --lose: #d9534f;
  --border: #3a3a5c;
  --epic: 'Cinzel', 'Segoe UI', serif;
}

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

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(245, 197, 66, 0.09), transparent 60%),
    radial-gradient(ellipse 700px 600px at 100% 30%, rgba(140, 160, 220, 0.05), transparent 55%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.012) 0px, rgba(255,255,255,0.012) 1px, transparent 1px, transparent 26px),
    var(--bg-dark);
  color: var(--text-main);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
}

/* HEADER */
header {
  position: relative;
  background: linear-gradient(180deg, #26264a 0%, var(--bg-dark) 100%);
  border-bottom: 2px solid var(--gold);
  padding: 64px 20px 46px;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(245, 197, 66, 0.12) inset;
}

header::before {
  content: "";
  position: absolute;
  top: -220px; left: 50%;
  transform: translateX(-50%);
  width: 640px; height: 440px;
  background: radial-gradient(ellipse at center, rgba(245, 197, 66, 0.22), transparent 65%);
  pointer-events: none;
  animation: emberPulse 5s ease-in-out infinite;
}

@keyframes emberPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

header .crest {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 14px rgba(245, 197, 66, 0.6));
}

header .tag {
  position: relative;
  display: inline-block;
  color: var(--gold);
  letter-spacing: 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-weight: 600;
}

header h1 {
  position: relative;
  font-family: var(--epic);
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: 3px;
  color: var(--gold);
  text-shadow:
    0 0 12px rgba(245, 197, 66, 0.55),
    0 0 36px rgba(245, 197, 66, 0.25);
  animation: titleGlow 3.5s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 12px rgba(245,197,66,0.55), 0 0 36px rgba(245,197,66,0.25); }
  50%      { text-shadow: 0 0 20px rgba(245,197,66,0.85), 0 0 54px rgba(245,197,66,0.4); }
}

header p.subtitle {
  color: var(--text-dim);
  margin-top: 12px;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.header-divider {
  position: relative;
  width: 220px;
  height: 14px;
  margin: 22px auto 0;
}
.header-divider::before,
.header-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 92px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim));
}
.header-divider::before { left: 0; }
.header-divider::after { right: 0; transform: scaleX(-1); }
.header-divider span {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 9px; height: 9px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(245, 197, 66, 0.7);
}

/* NAV */
nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(34, 34, 59, 0.92);
  backdrop-filter: blur(6px);
  padding: 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 20px rgba(0,0,0,0.35);
}

nav a {
  position: relative;
  color: var(--text-main);
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  transition: all 0.25s;
}

nav a:hover { background: var(--gold); color: var(--bg-dark); font-weight: bold; box-shadow: 0 0 16px rgba(245,197,66,0.5); }

#admin-link.logged-in { color: var(--win); font-weight: bold; }

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

section {
  padding: 60px 0;
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transform: translateY(18px);
  animation: riseIn 0.7s ease forwards;
}
section:nth-of-type(2) { animation-delay: 0.08s; }
section:nth-of-type(3) { animation-delay: 0.16s; }

@keyframes riseIn {
  to { opacity: 1; transform: translateY(0); }
}

section:last-child { border-bottom: none; }

section h2 {
  font-family: var(--epic);
  color: var(--gold);
  font-size: 1.7rem;
  letter-spacing: 1px;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 0 14px rgba(245, 197, 66, 0.25);
}

section h2::before {
  content: "";
  width: 5px;
  height: 26px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  display: inline-block;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(245, 197, 66, 0.6);
}

section h2 .icon { font-size: 1.4rem; filter: drop-shadow(0 0 6px rgba(245,197,66,0.5)); }

.about-text { color: var(--text-dim); font-size: 1.05rem; max-width: 750px; }

.stats-row { display: flex; gap: 20px; margin-top: 30px; flex-wrap: wrap; }

.stat-box {
  position: relative;
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-light));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 30px;
  flex: 1;
  min-width: 150px;
  text-align: center;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.stat-box::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(245,197,66,0.5), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.stat-box:hover {
  transform: translateY(-5px);
  border-color: var(--gold-dim);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35), 0 0 22px rgba(245,197,66,0.12);
}
.stat-box:hover::after { opacity: 1; }

.stat-box .icon { font-size: 1.3rem; margin-bottom: 6px; display: block; filter: drop-shadow(0 0 6px rgba(245,197,66,0.45)); }
.stat-box .num { font-family: var(--epic); color: var(--gold); font-size: 2rem; font-weight: 700; text-shadow: 0 0 16px rgba(245,197,66,0.3); }
.stat-box .label { color: var(--text-dim); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1.2px; margin-top: 6px; }

/* ROSTER TABLE */
table { width: 100%; border-collapse: collapse; background: var(--bg-panel); border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
thead { background: linear-gradient(180deg, var(--bg-panel-light), var(--bg-panel)); }
th { color: var(--gold); text-align: left; padding: 14px 16px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1.2px; }
td { padding: 14px 16px; border-top: 1px solid var(--border); color: var(--text-main); transition: background 0.2s; }
tbody tr:hover td { background: var(--bg-panel-light); }

tbody tr:has(.rank-leader) td {
  background: linear-gradient(90deg, rgba(245, 197, 66, 0.1), transparent 70%);
  border-top: 1px solid rgba(245, 197, 66, 0.35);
}
tbody tr:has(.rank-leader) td:first-child { font-weight: 700; color: var(--gold); }

.rank-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.4px;
}
.rank-leader  { background: rgba(245, 197, 66, 0.18); color: var(--gold); box-shadow: 0 0 10px rgba(245,197,66,0.35); border: 1px solid rgba(245,197,66,0.4); }
.rank-officer { background: rgba(140, 160, 220, 0.18); color: #8ca0dc; border: 1px solid rgba(140,160,220,0.35); }
.rank-member  { background: rgba(156, 156, 181, 0.12); color: var(--text-dim); border: 1px solid rgba(156,156,181,0.25); }

/* CVC */
.cvc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 10px; }
.cvc-card {
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-light));
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.cvc-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0,0,0,0.3); }
.cvc-card:has(.result.win)  { border-left-color: var(--win); }
.cvc-card:has(.result.lose) { border-left-color: var(--lose); }
.cvc-card .week { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.cvc-card .result { font-family: var(--epic); font-size: 1.35rem; font-weight: bold; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.cvc-card .result.win  { color: var(--win); text-shadow: 0 0 14px rgba(76,175,125,0.35); }
.cvc-card .result.win::before  { content: "⚔"; }
.cvc-card .result.lose { color: var(--lose); text-shadow: 0 0 14px rgba(217,83,79,0.3); }
.cvc-card .result.lose::before { content: "💀"; }
.cvc-card .opponent { color: var(--text-dim); font-size: 0.9rem; }
.cvc-card .del-btn { position: absolute; top: 10px; right: 10px; }

footer {
  position: relative;
  text-align: center;
  padding: 40px 20px 30px;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
footer::before {
  content: "⚔ ═══════════ ⚔";
  display: block;
  color: var(--gold-dim);
  letter-spacing: 4px;
  margin-bottom: 16px;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Logowanie i panel admina */
.login-box {
  max-width: 380px;
  margin: 80px auto;
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-light));
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 0 40px rgba(245, 197, 66, 0.1), 0 20px 40px rgba(0,0,0,0.35);
}
.login-box h3 { font-family: var(--epic); color: var(--gold); margin-bottom: 20px; letter-spacing: 0.5px; }
.login-box input {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-box input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,197,66,0.15); }

.btn {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--bg-dark);
  border: none;
  padding: 11px 20px;
  border-radius: 6px;
  font-weight: bold;
  letter-spacing: 0.3px;
  cursor: pointer;
  font-size: 0.9rem;
  width: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(245,197,66,0.35); }
.btn-small { width: auto; padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { background: var(--lose); color: white; }
.btn-danger:hover { background: #c9302c; box-shadow: 0 6px 18px rgba(217,83,79,0.35); }

.form-error {
  color: var(--lose);
  background: rgba(217, 83, 79, 0.1);
  border: 1px solid var(--lose);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.form-success {
  color: var(--win);
  background: rgba(76, 175, 125, 0.1);
  border: 1px solid var(--win);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

#admin-panel {
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-light));
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  padding: 25px;
  margin-top: 20px;
  box-shadow: 0 0 24px rgba(245, 197, 66, 0.08);
}
#admin-panel h4 { font-family: var(--epic); color: var(--gold); margin-bottom: 14px; font-size: 1rem; letter-spacing: 0.5px; }

.admin-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.admin-form input, .admin-form select {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  flex: 1;
  min-width: 110px;
}

.del-btn {
  background: transparent;
  border: 1px solid var(--lose);
  color: var(--lose);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.2s, color 0.2s;
}
.del-btn:hover { background: var(--lose); color: white; }

@media (max-width: 600px) {
  header { padding: 48px 16px 36px; }
  header h1 { font-size: 2rem; letter-spacing: 1.5px; }
  table { font-size: 0.85rem; }
  th, td { padding: 10px 8px; }
}
