:root {
  --bg: #f6f7f1;
  --surface: #fffdfa;
  --surface-2: #eef6f2;
  --text: #17211b;
  --muted: #68736c;
  --primary: #216e4e;
  --primary-2: #0f4c81;
  --accent: #f5c542;
  --danger: #c24135;
  --border: #dce3dc;
  --shadow: 0 16px 42px rgba(23, 33, 27, .1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: linear-gradient(135deg, #f6f7f1 0%, #eef6f2 52%, #f9f0dc 100%);
  color: var(--text);
}

a { color: inherit; }
button, input, select { font: inherit; }

.app-header, .layout { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.app-header { padding: 22px 0 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.brand { font-weight: 950; font-size: 22px; text-decoration: none; }
.switch-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid rgba(33, 110, 78, .24);
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}
.service-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(33, 110, 78, .24);
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
}
.service-tabs a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}
.service-tabs a.active {
  background: var(--primary);
  color: #fff;
  pointer-events: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  align-items: end;
  padding: 24px;
  border: 1px solid rgba(33, 110, 78, .18);
  border-radius: 22px;
  background: rgba(255, 253, 250, .86);
  box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 8px; color: var(--primary-2); font-size: 12px; font-weight: 950; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 720px; font-size: clamp(28px, 4vw, 46px); line-height: 1.1; }
.hero-copy { margin: 12px 0 0; max-width: 700px; color: var(--muted); line-height: 1.65; font-size: 15px; }
.source-meta { margin: 10px 0 0; color: var(--primary); font-size: 13px; font-weight: 900; }
.hero-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  background: #17211b;
  color: #fff;
}
.hero-metrics strong { font-size: 30px; line-height: 1; }
.hero-metrics span { color: #d6e4dc; font-size: 12px; font-weight: 800; }

.layout { padding: 0 0 80px; }
.panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 253, 250, .86);
  box-shadow: 0 10px 26px rgba(23, 33, 27, .06);
}
.filters { display: grid; grid-template-columns: repeat(4, 1fr) auto auto; gap: 10px; align-items: end; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 900; }
select, input[type="date"] {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-weight: 850;
}
.toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.view-tabs { display: flex; gap: 8px; margin: 14px 0; overflow-x: auto; }
.tab {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
  color: var(--text);
  font-weight: 950;
  cursor: pointer;
}
.tab.is-active { border-color: var(--primary); background: var(--primary); color: #fff; }
.view { display: none; }
.view.is-active { display: block; }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tournament-card {
  display: grid;
  gap: 12px;
  min-height: 250px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(23, 33, 27, .07);
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 12px;
  font-weight: 950;
}
.badge.warn { background: #fff5d6; color: #7a5600; }
.badge.closed { background: #eef0f3; color: #5b6470; }
.badge.danger { background: #ffe7e2; color: var(--danger); }
.source { color: var(--muted); font-size: 12px; font-weight: 850; }
.tournament-card h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.meta { display: grid; gap: 6px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.division-list { display: flex; flex-wrap: wrap; gap: 6px; }
.division-chip { padding: 6px 8px; border-radius: 999px; background: #f3f5ef; color: #2f3a32; font-size: 12px; font-weight: 900; }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.primary-action, .secondary-action {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 950;
  cursor: pointer;
}
.primary-action { background: var(--primary); color: #fff; }
.secondary-action { background: #eef2f7; color: #233040; text-decoration: none; display: inline-flex; align-items: center; }

.empty { padding: 32px; border: 1px dashed var(--border); border-radius: 18px; color: var(--muted); text-align: center; font-weight: 900; }
.calendar-list { display: grid; gap: 10px; }
.date-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.date-row strong { color: var(--primary-2); }
.date-row ul { margin: 0; padding-left: 18px; color: var(--muted); }

.section-head h2 { margin: 0 0 6px; }
.section-head p { margin: 0 0 14px; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
th { color: var(--muted); background: #f6f8f4; font-weight: 950; }
td { vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.schema-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.schema-grid article { padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.schema-grid h2 { margin: 0 0 10px; font-size: 18px; }
.schema-grid li, .schema-grid p { color: var(--muted); line-height: 1.6; }
pre { overflow-x: auto; padding: 12px; border-radius: 12px; background: #17211b; color: #e8f4ee; }

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100%);
  height: 100vh;
  padding: 20px;
  background: var(--surface);
  box-shadow: -24px 0 60px rgba(23, 33, 27, .18);
  transform: translateX(105%);
  transition: transform .18s ease;
  overflow-y: auto;
  z-index: 50;
}
.detail-panel.is-open { transform: translateX(0); }
.detail-panel h2 { margin: 12px 0 8px; }
.detail-close {
  border: 0;
  border-radius: 999px;
  background: #eef2f7;
  color: #233040;
  padding: 8px 12px;
  font-weight: 950;
  cursor: pointer;
}
.detail-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.detail-block h3 { margin: 0 0 8px; font-size: 15px; }
.detail-block p, .detail-block li { color: var(--muted); line-height: 1.6; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-metrics { grid-template-columns: auto 1fr; align-items: center; }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .card-grid, .schema-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .app-header, .layout { width: min(100% - 24px, 1120px); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .service-tabs { width: 100%; }
  .service-tabs a { flex: 1; }
  .hero { padding: 18px; }
  .filters { grid-template-columns: 1fr; }
  .date-row { grid-template-columns: 1fr; }
  .card-actions { flex-direction: column; }
  .primary-action, .secondary-action { width: 100%; justify-content: center; }
}
