/* ===== CSS Variables & Reset ===== */
:root {
  --bg-deep: #0a0e1a;
  --bg-surface: #111827;
  --bg-card: #1a2236;
  --bg-card-hover: #1f2a42;
  --accent: #ff9900;
  --accent-glow: rgba(255, 153, 0, 0.3);
  --accent-dim: #cc7a00;
  --text-primary: #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted: #5a6478;
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(255, 153, 0, 0.25);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Noto Sans SC', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #ffb84d; }

/* ===== Canvas Background ===== */
#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 0;
  transition: background 0.3s, backdrop-filter 0.3s;
}

.nav.scrolled {
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 3px;
  background: linear-gradient(135deg, var(--accent), #ffcc66);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--accent); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #000;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(255, 153, 0, 0.45);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
}

.btn-ghost:hover {
  background: rgba(255, 153, 0, 0.08);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.25);
}

.btn-save {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.btn-save:hover {
  background: rgba(52, 211, 153, 0.22);
}

.btn-sm { padding: 8px 18px; font-size: 13px; }

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
}

.btn-text:hover { color: var(--danger); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 24px 80px;
  max-width: 1200px;
  margin: 0 auto;
  gap: 60px;
}

.hero-content { flex: 1; }

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255, 153, 0, 0.1);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s ease both;
}

.hero-title {
  margin-bottom: 24px;
}

.title-line {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 4px;
}

.title-line:first-child {
  font-size: clamp(32px, 5vw, 48px);
  color: var(--text-secondary);
  animation: fadeInUp 0.6s 0.1s ease both;
}

.title-line.accent {
  font-size: clamp(48px, 8vw, 80px);
  background: linear-gradient(135deg, var(--accent), #ffcc66, var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.6s 0.2s ease both, shimmer 4s linear infinite;
}

.title-line.small {
  font-size: clamp(20px, 3vw, 32px);
  color: var(--text-primary);
  letter-spacing: 8px;
  animation: fadeInUp 0.6s 0.3s ease both;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 36px;
  animation: fadeInUp 0.6s 0.4s ease both;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 48px;
  animation: fadeInUp 0.6s 0.5s ease both;
}

.hero-stats {
  display: flex;
  gap: 40px;
  animation: fadeInUp 0.6s 0.6s ease both;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Hero Visual - Floating Cards */
.hero-visual {
  flex: 0 0 380px;
  position: relative;
  height: 480px;
  animation: fadeIn 1s 0.5s ease both;
}

.card-stack {
  position: relative;
  width: 100%;
  height: 100%;
}

.floating-card {
  position: absolute;
  width: 200px;
  height: 280px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent-glow);
  transition: transform 0.4s ease;
}

.floating-card:hover {
  transform: scale(1.05) !important;
  z-index: 10;
}

.card-face {
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #1a2744, #0f1a2e);
  border: 1px solid var(--border-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
}

.card-icon { font-size: 48px; display: flex; align-items: center; justify-content: center; }
.card-icon img { border-radius: 12px; display: block; }

.card-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.card-type {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(255, 153, 0, 0.08);
  border: 1px solid var(--border);
}

.card-1 {
  top: 20px; left: 0;
  transform: rotate(-8deg);
  animation: floatCard1 6s ease-in-out infinite;
}

.card-2 {
  top: 60px; left: 120px;
  transform: rotate(3deg);
  animation: floatCard2 7s ease-in-out infinite;
  z-index: 2;
}

.card-3 {
  top: 160px; left: 40px;
  transform: rotate(-3deg);
  animation: floatCard3 5s ease-in-out infinite;
}

/* ===== Sections ===== */
.section {
  position: relative;
  z-index: 1;
  padding: 100px 24px;
}

.section-dark {
  background: var(--bg-surface);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 2px;
  display: block;
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 900;
  letter-spacing: 2px;
}

.section-desc {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 16px auto 0;
  font-size: 15px;
}

/* ===== About Grid ===== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all 0.3s;
}

.about-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.about-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.about-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.about-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ===== Rules Grid ===== */
.rules-intro {
  text-align: center;
  max-width: 700px;
  margin: -30px auto 48px;
  color: var(--text-secondary);
  font-size: 15px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.rule-card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.rule-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.rule-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.rule-card:hover::before { opacity: 1; }

.rule-num {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: rgba(255, 153, 0, 0.15);
  margin-bottom: 12px;
}

.rule-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

.rule-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 60px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--border), transparent);
}

.timeline-item {
  display: flex;
  gap: 32px;
  padding: 16px 0;
  position: relative;
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 28px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--text-muted);
  z-index: 1;
}

.timeline-item.active::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-content {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-left: 28px;
  transition: all 0.3s;
}

.timeline-date {
  flex: 0 0 48px;
  text-align: center;
}

.date-month {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.date-day {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: var(--accent);
}

.timeline-content {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-left: 20px;
  transition: all 0.3s;
}

.timeline-item.active .timeline-content {
  border-color: var(--border-accent);
  box-shadow: 0 0 30px rgba(255, 153, 0, 0.08);
}

.timeline-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.timeline-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.timeline-tag {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 153, 0, 0.1);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

.event-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.event-detail {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.event-signup-btn {
  display: inline-block;
  text-decoration: none;
}

.event-signup-closed {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.event-tz {
  font-size: 11px;
  color: var(--text-muted);
  font-style: normal;
}

/* ===== Tool Section ===== */
.tool-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

.tool-panel {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.round-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.panel-body {
  padding: 24px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.input-row {
  display: flex;
  gap: 8px;
}

input[type="text"], textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; }

.player-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.player-list {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
}

.player-list::-webkit-scrollbar { width: 4px; }
.player-list::-webkit-scrollbar-track { background: transparent; }
.player-list::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background 0.2s;
}

.player-item:hover { background: rgba(255, 255, 255, 0.03); }

.player-item .player-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.player-item .player-remove:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ===== Tool Actions ===== */
.tool-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ===== Pairings Area ===== */
.pairings-area {
  min-height: 200px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }

.round-header {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.pairing-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.pairing-row:hover {
  border-color: var(--border-accent);
}

.pairing-player {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.pairing-vs {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  flex: 0 0 50px;
  text-align: center;
}

.pairing-bye {
  color: var(--warning);
  font-style: italic;
}

.result-btns {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.result-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}

.result-btn:hover { border-color: var(--accent); color: var(--accent); }
.result-btn.active-win { background: rgba(52, 211, 153, 0.15); border-color: var(--success); color: var(--success); }
.result-btn.active-draw { background: rgba(251, 191, 36, 0.15); border-color: var(--warning); color: var(--warning); }
.result-btn.active-lose { background: rgba(248, 113, 113, 0.15); border-color: var(--danger); color: var(--danger); }

/* ===== Standings ===== */
.standings-area {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.standings-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.standings-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}

.standings-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.standings-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.standings-table .rank-1 td { color: var(--accent); font-weight: 700; }
.standings-table .rank-2 td { color: #c0c0c0; }
.standings-table .rank-3 td { color: #cd7f32; }

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 1;
  padding: 48px 24px 24px;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-brand p {
  width: 100%;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-bottom p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@keyframes floatCard1 {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  50% { transform: rotate(-6deg) translateY(-18px); }
}

@keyframes floatCard2 {
  0%, 100% { transform: rotate(3deg) translateY(0); }
  50% { transform: rotate(5deg) translateY(-22px); }
}

@keyframes floatCard3 {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50% { transform: rotate(-1deg) translateY(-15px); }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding-top: 100px;
  }

  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .hero-stats { justify-content: center; }

  .hero-visual {
    flex: none;
    width: 320px;
    height: 380px;
  }

  .tool-container {
    grid-template-columns: 1fr;
  }

  .nav-links { display: none; }

  .timeline::before { left: 20px; }
  .timeline-item::after { left: 13px; }
  .timeline-date { flex: 0 0 20px; }
  .date-month { font-size: 10px; }
  .date-day { font-size: 18px; }
  .timeline-content { margin-left: 10px; }
}

@media (max-width: 600px) {
  .rules-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
  .pairing-row { flex-wrap: wrap; }
  .result-btns { width: 100%; justify-content: center; margin-top: 8px; }
}

/* ===== Modal Overlay (shared) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
