/* ==========================================================================
   Apple 디자인 토큰 (2026-05-13 도입, 본 파일은 대학·초등 대회 페이지 공용 CSS)
   ========================================================================== */
:root {
  --color-primary: #0066cc;
  --color-primary-focus: #0071e3;
  --color-ink: #1d1d1f;
  --color-ink-muted-80: #333333;
  --color-ink-muted-48: #7a7a7a;
  --color-canvas: #ffffff;
  --color-canvas-parchment: #f5f5f7;
  --color-surface-pearl: #fafafc;
  --color-surface-chip: #d2d2d7;
  --color-divider-soft: #f0f0f0;
  --color-hairline: #e0e0e0;
  --color-on-dark: #ffffff;

  --font-display: "SF Pro Display", system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Pretendard", "Malgun Gothic", sans-serif;
  --font-text: "SF Pro Text", system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Pretendard", "Malgun Gothic", sans-serif;

  --r-xs: 5px;
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 18px;
  --r-pill: 9999px;

  --s-xxs: 4px;
  --s-xs: 8px;
  --s-sm: 12px;
  --s-md: 17px;
  --s-lg: 24px;
  --s-xl: 32px;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: var(--font-text);
  font-size: 14px;
  background: var(--color-canvas);
  color: var(--color-ink);
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 헤더 (Apple 톤, 2026-05-13) ── */
#header {
  background: var(--color-canvas);
  color: var(--color-ink);
  padding: var(--s-sm) var(--s-lg);
  display: flex;
  align-items: center;
  gap: var(--s-md);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-hairline);
}

#header h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--color-ink);
}

.back-link {
  color: var(--color-primary) !important;
  text-decoration: none !important;
  font-size: 14px !important;
  font-weight: 500;
  white-space: nowrap;
  padding: var(--s-xxs) var(--s-sm);
  border-radius: var(--r-pill);
  transition: background 0.18s ease;
}
.back-link:hover {
  background: rgba(0, 102, 204, 0.06);
  text-decoration: none !important;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#upload-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

#upload-area label {
  background: #fff;
  color: #1a3a6b;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
}

#upload-area label:hover {
  background: #e8f0fe;
}

#file-input {
  display: none;
}

#upload-status {
  font-size: 12px;
  color: #adf;
}

/* ── 1단: 메인 탭 (Apple 톤, 2026-05-13) ── */
#main-tabs {
  display: flex;
  align-items: center;
  gap: var(--s-xxs);
  margin-left: var(--s-sm);
}

.main-tab {
  padding: var(--s-xs) var(--s-md);
  background: transparent;
  color: var(--color-ink-muted-48);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.18s ease, color 0.18s ease;
}

.main-tab:hover {
  background: var(--color-canvas-parchment);
  color: var(--color-ink);
}

.main-tab.active {
  background: var(--color-primary);
  color: var(--color-on-dark);
  border-color: var(--color-primary);
  font-weight: 600;
}

.main-tab.ranking-tab {
  margin-left: var(--s-xs);
}

/* ── 2단: 성별 탭 (Apple 톤, 2026-05-13) ── */
#gender-tabs {
  display: flex;
  gap: var(--s-xs);
  padding: var(--s-sm) var(--s-lg);
  background: var(--color-canvas-parchment);
  border-bottom: 1px solid var(--color-hairline);
}

.gender-tab {
  padding: var(--s-xs) var(--s-md);
  border: 1px solid var(--color-hairline);
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-text);
  font-weight: 500;
  background: var(--color-canvas);
  color: var(--color-ink-muted-80);
  transition: all 0.18s ease;
}

.gender-tab.male { border-color: #b3d4ff; }
.gender-tab.male.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-dark);
}

.gender-tab.female { border-color: #ffb3b3; }
.gender-tab.female.active {
  background: #d63838;
  border-color: #d63838;
  color: var(--color-on-dark);
}

/* ── 3단: 종별(카테고리) 탭 ── */
#category-tabs {
  display: flex;
  gap: var(--s-xs);
  padding: var(--s-sm) var(--s-lg);
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline);
  flex-wrap: wrap;
}

.cat-tab {
  padding: var(--s-xxs) var(--s-md);
  background: var(--color-canvas);
  color: var(--color-ink-muted-80);
  border: 1px solid var(--color-hairline);
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-text);
  font-weight: 500;
  transition: all 0.18s ease;
}

.cat-tab:hover {
  background: var(--color-canvas-parchment);
  border-color: var(--color-primary-focus);
}

/* 남자 선택 시 */
.cat-tab.active.male-cat {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-dark);
}

/* 여자 선택 시 */
.cat-tab.active.female-cat {
  background: #d63838;
  border-color: #d63838;
  color: var(--color-on-dark);
}

/* ── 콘텐츠 영역 ── */
#content-area {
  padding: var(--s-md) var(--s-lg);
  margin: 0 auto;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.placeholder-msg {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 15px;
}

/* ── 예선리그: 그룹 선택 + 패널 ── */
#group-selector-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

#group-selector-area label {
  font-weight: bold;
  color: #1a3a6b;
}

#group-select {
  padding: 5px 10px;
  border: 1px solid #aab;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}

#three-panel {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

#panel-roster {
  flex: 0 0 200px;
  min-width: 160px;
}

#panel-schedule {
  flex: 1 1 400px;
  min-width: 300px;
}

#panel-matrix {
  flex: 0 0 auto;
  min-width: 260px;
}

#no-group-msg {
  color: #888;
  padding: 20px;
  text-align: center;
}

#print-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* ── 공통 버튼 ── */
.btn {
  padding: 5px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: bold;
}

.btn-primary {
  background: #1a3a6b;
  color: #fff;
}

.btn-primary:hover {
  background: #2a5a9f;
}

.btn-secondary {
  background: #5a7a3b;
  color: #fff;
}

.btn-secondary:hover {
  background: #7a9a5b;
}

.btn-danger {
  background: #c0392b;
  color: #fff;
}

.btn-danger:hover {
  background: #e74c3c;
}

.btn-outline {
  background: #fff;
  color: #1a3a6b;
  border: 1px solid #1a3a6b;
}

.btn-outline:hover {
  background: #e8f0fe;
}

/* ── 시상(상장대장) ── */
.awards-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

/* 시상 서브탭 */
.aw-sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #1a73e8;
  margin-bottom: 16px;
}
.aw-sub-tab {
  padding: 10px 24px;
  border: none;
  background: #f1f3f4;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  border-radius: 8px 8px 0 0;
  transition: all .2s;
}
.aw-sub-tab:hover { background: #e0e0e0; }
.aw-sub-tab.active {
  background: #1a73e8;
  color: #fff;
}
.aw-tab-pane { display: none; }
.aw-tab-pane.active { display: block; }

/* 검사결과 */
.vf-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.vf-card {
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.vf-card.danger { background: #fce4ec; border: 1px solid #e57373; }
.vf-card.warning { background: #fff3e0; border: 1px solid #ffb74d; }
.vf-card.success { background: #e8f5e9; border: 1px solid #81c784; }
.vf-card.info { background: #e3f2fd; border: 1px solid #64b5f6; }
.vf-card .vf-num { font-size: 32px; font-weight: 700; }
.vf-card .vf-label { font-size: 12px; color: #666; margin-top: 4px; }
.vf-section {
  margin-bottom: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}
.vf-section-hdr {
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.vf-section-hdr.danger { background: #e53935; }
.vf-section-hdr.warning { background: #fb8c00; }
.vf-section-hdr.info { background: #1e88e5; }
.vf-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.vf-tbl th {
  background: #f5f5f5;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #ddd;
}
.vf-tbl td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
.vf-tbl tr:hover { background: #f9f9f9; }
.vf-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.vf-badge.red { background: #ffcdd2; color: #c62828; }
.vf-badge.orange { background: #ffe0b2; color: #e65100; }
.vf-badge.green { background: #c8e6c9; color: #2e7d32; }
.vf-badge.blue { background: #bbdefb; color: #1565c0; }

.aw-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.aw-table td {
  border: 1px solid #333;
  padding: 4px 3px;
  text-align: center;
  vertical-align: middle;
  word-break: keep-all;
}

.aw-title {
  font-size: 16px;
  font-weight: bold;
  padding: 10px !important;
  background: #fff;
  border: 2px solid #333 !important;
}

.aw-subtitle {
  font-size: 11px;
  color: #555;
  padding: 6px !important;
  border: 2px solid #333 !important;
}

.aw-section {
  font-weight: bold;
  background: #f0f0f0;
  font-size: 12px;
  width: 65px;
}

.aw-hdr {
  background: #f0f0f0;
  width: 60px;
}

.aw-place {
  font-weight: bold;
  background: #f5f5f5;
  font-size: 11px;
  width: 60px;
}

.aw-grade-hdr {
  background: #e8f0fe;
  font-weight: bold;
  font-size: 11px;
}

.aw-sub-hdr {
  background: #f5f8ff;
  font-size: 10px;
  color: #555;
}

.aw-cell {
  font-size: 11px;
  line-height: 1.4;
  min-height: 50px;
  padding: 5px 3px !important;
}

.aw-empty {
  color: #ccc;
}

.aw-team {
  font-size: 10px;
  color: #666;
}

/* ── 본선 대진표 인쇄 버튼 (Apple 톤, 2026-05-13) ── */
.brk-print-section {
  margin-top: var(--s-lg);
  padding-top: var(--s-md);
  border-top: 1px solid var(--color-hairline);
}

.brk-print-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--s-sm);
  letter-spacing: -0.01em;
}

.brk-print-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-xs);
  align-items: center;
}

.brk-btn {
  padding: var(--s-xs) var(--s-md);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-text);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--color-hairline);
  transition: all 0.18s ease;
}

.brk-btn.m {
  background: var(--color-canvas);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.brk-btn.m:hover { background: rgba(0, 102, 204, 0.08); }

.brk-btn.f {
  background: var(--color-canvas);
  color: #d63838;
  border-color: #ffb3b3;
}
.brk-btn.f:hover { background: #fff0f0; }

.brk-btn.t {
  background: var(--color-canvas);
  color: #16a34a;
  border-color: #b2e0c2;
}
.brk-btn.t:hover { background: #f0fdf4; }

.brk-btn.aw {
  background: var(--color-primary);
  color: var(--color-on-dark);
  border-color: var(--color-primary);
  padding: var(--s-xs) var(--s-lg);
  font-weight: 600;
}
.brk-btn.aw:hover { background: var(--color-primary-focus); }

/* ── 기권 선수 ── */
.btn-forfeit {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 6px;
}

.btn-forfeit:hover {
  background: #b91c1c;
}

.forfeit-box {
  background: #fff;
  border: 2px solid #dc2626;
  border-radius: 6px;
  margin-bottom: 10px;
}

.forfeit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #dc2626;
  color: #fff;
  padding: 6px 12px;
  font-weight: bold;
  font-size: 13px;
}

.forfeit-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

.forfeit-body {
  padding: 10px 12px;
}

.forfeit-desc {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.5;
}

.forfeit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.forfeit-table th,
.forfeit-table td {
  padding: 5px 8px;
  border: 1px solid #ddd;
  text-align: center;
}

.forfeit-table th {
  background: #f5f5f5;
  font-weight: bold;
}

.btn-forfeit-del {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.btn-forfeit-del:hover {
  background: #dc2626;
}

.forfeit-warn {
  padding: 10px;
  color: #999;
  text-align: center;
  font-size: 12px;
}

/* ── 선수 이동 ── */
.btn-move {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 6px;
}

.btn-move:hover {
  background: #1d4ed8;
}

.move-box {
  background: #fff;
  border: 2px solid #2563eb;
  border-radius: 6px;
  margin-bottom: 10px;
}

.move-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2563eb;
  color: #fff;
  padding: 6px 12px;
  font-weight: bold;
  font-size: 13px;
}

.move-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

.move-body {
  padding: 10px 12px;
}

.move-desc {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
  line-height: 1.5;
}

.move-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.move-col {
  flex: 1;
}

.move-arrow {
  font-size: 24px;
  font-weight: bold;
  color: #2563eb;
  padding-top: 28px;
  flex-shrink: 0;
}

.move-label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #333;
}

.move-body select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 8px;
}

.move-dst-info {
  padding: 8px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  font-size: 13px;
}

.btn-move-select {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.btn-move-select:hover {
  background: #1d4ed8;
}

/* ── 패널 ── */
.panel-title {
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: #1a3a6b;
  padding: 5px 10px;
  border-radius: 4px 4px 0 0;
}

.panel-body {
  background: #fff;
  border: 1px solid #c0c8d8;
  border-top: none;
  border-radius: 0 0 4px 4px;
  overflow: auto;
}

/* ── 데이터 테이블 (가독성 향상, 2026-05-13 보스 피드백) ── */
table.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

table.data-table th {
  background: #dde5f5;
  padding: 7px 10px;
  text-align: center;
  border: 1px solid #aab8d8;
  font-weight: 600;
  white-space: nowrap;
  font-size: 13px;
}

table.data-table td {
  padding: 6px 10px;
  border: 1px solid #c8d0e0;
  text-align: center;
  white-space: nowrap;
}

table.data-table tr:hover td {
  background: #f0f4ff;
}

.round-label {
  background: #e8eff8;
  font-weight: 600;
  color: #1a3a6b;
  text-align: left;
  padding: 5px 10px;
  font-size: 13px;
}

/* ── 점수 입력 (크기 향상, 2026-05-13 보스 피드백) ── */
.score-input {
  width: 54px;
  text-align: center;
  border: 1px solid #aac;
  border-radius: var(--r-sm);
  padding: 6px 4px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-text);
}
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.score-input { -moz-appearance: textfield; }

.score-sep {
  color: #888;
  font-size: 11px;
}

.save-btn {
  padding: 2px 8px;
  background: #1a3a6b;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
}

.save-btn:hover {
  background: #2a5a9f;
}

.winner-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #81c784;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: bold;
}

/* ── 매트릭스 테이블 (크기 향상, 2026-05-13. 2026-06-02 보스 정책: seed cell 동일 width = 대각선 perpendicular) ── */
.matrix-table {
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.matrix-table th {
  background: #dde5f5;
  padding: 4px 4px;
  border: 1px solid #aab8d8;
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
}

.matrix-table td {
  padding: 4px 4px;
  border: 1px solid #c8d0e0;
  text-align: center;
  white-space: nowrap;
}

/* No / 성명 / 소속 / 승 / 패 / 기권 / 승점 / 득 / 실 / 순위 = 좁게 (호프스 11~16명, 본선 16명 대응) */
.matrix-table th:first-child,
.matrix-table td:first-child { width: 28px; }      /* No */
.matrix-table th:nth-child(2),
.matrix-table td:nth-child(2) { width: 56px; text-align: center; }   /* 성명 */
.matrix-table th:nth-child(3),
.matrix-table td:nth-child(3) { width: 60px; }     /* 소속 */
/* seed columns + 우측 stats 모두 = 동일 정사각형 */
.matrix-diag, .matrix-score, .matrix-table th:not(:nth-child(-n+3)),
.matrix-table td:not(:nth-child(-n+3)) {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  height: 28px;
}

.matrix-diag {
  background: #fff;
  position: relative;
  overflow: hidden;
}

.matrix-diag::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom left, transparent calc(50% - 0.5px), #777 calc(50% - 0.5px), #777 calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

.matrix-score {
  font-size: 12px;
}

.rank-col {
  font-weight: bold;
  color: #1a3a6b;
}

.match-done td {
  background: #f5fff5;
}

.match-row td {
  vertical-align: middle;
}

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

/* ── 본선 토너먼트: 서브탭 ── */
#tournament-sub-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
}

.sub-tab {
  padding: 7px 20px;
  background: #fff;
  color: #555;
  border: 1px solid #bbb;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: bold;
  border-bottom: 2px solid #bbb;
}

.sub-tab:hover {
  background: #f0f4ff;
}

.sub-tab.active {
  background: #fff;
  color: #1a3a6b;
  border-color: #1a3a6b;
  border-bottom: 2px solid #fff;
}

.sub-view {
  display: none;
}

.sub-view.active {
  display: block;
}

/* ── 본선 토너먼트: 경기 결과 모달 ── */
.match-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.match-modal-backdrop.show {
  display: flex;
}

.match-modal {
  background: #fff;
  border-radius: 10px;
  width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.match-modal-header {
  padding: 14px 18px 10px;
  background: #1a3a5c;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 10px 10px 0 0;
}

.match-modal-header h3 {
  font-size: 15px;
}

.match-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #ccc;
  padding: 2px 6px;
  border-radius: 4px;
}

.match-modal-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.match-modal-body {
  padding: 20px 24px;
}

.match-vs-row {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}

.match-player-name {
  font-size: 18px;
  font-weight: bold;
  color: #222;
}

.match-player-team {
  font-size: 12px;
  color: #777;
  margin-top: 2px;
}

.match-vs {
  font-size: 14px;
  color: #999;
}

/* 게임별 점수 입력 */
.mm-games-header {
  display: grid;
  grid-template-columns: 50px 1fr 20px 1fr;
  align-items: center;
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  color: #777;
  margin-bottom: 4px;
  padding: 0 4px;
}

.mm-game-row {
  display: grid;
  grid-template-columns: 50px 1fr 20px 1fr;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 6px;
}

.mm-game-label {
  font-size: 12px;
  font-weight: bold;
  color: #555;
  text-align: left;
}

.mm-game-input {
  width: 100%;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  border: 2px solid #ddd;
  border-radius: 6px;
  padding: 8px 4px;
  outline: none;
  font-family: inherit;
}

.mm-game-input:focus {
  border-color: #1a3a5c;
}

.mm-game-input::-webkit-inner-spin-button,
.mm-game-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.mm-game-input { -moz-appearance: textfield; }

.mm-game-sep {
  font-size: 16px;
  font-weight: bold;
  color: #999;
}

.mm-game-row.win-p1 .mm-game-input:first-of-type {
  border-color: #2e7d32;
  background: #f0fdf4;
}

.mm-game-row.win-p2 .mm-game-input:last-of-type {
  border-color: #2e7d32;
  background: #f0fdf4;
}

.mm-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a3a5c;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
  margin: 10px 0;
}

.mm-total-row #mm-total-score {
  font-size: 18px;
}

.match-hint {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin: 12px 0;
}

.match-modal-actions {
  margin-top: 12px;
}

.match-completed-badge {
  background: #d4edda;
  color: #155724;
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── 본선 토너먼트: 추첨 테이블 ── */
#draw-section {
  margin-bottom: 12px;
}

.draw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.draw-header h3 {
  font-size: 14px;
  color: #1a3a6b;
}

.draw-info {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #555;
}

.draw-info span {
  background: #f0f4ff;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid #c0c8d8;
}

/* BYE 안내 */
.draw-bye-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}

.draw-bye-label {
  background: #888;
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: bold;
  font-size: 11px;
}

.draw-bye-num {
  background: #f0f0f0;
  border: 1px solid #ccc;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
  color: #666;
}

.draw-bye-note {
  color: #856404;
  font-size: 11px;
}

/* 대진번호 배치도 */
.draw-slot-map {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 6px;
}

.draw-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 24px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  border: 1px solid #ccc;
}

.draw-slot.slot-first {
  background: #fef9c3;
  border-color: #facc15;
  color: #854d0e;
}

.draw-slot.slot-second {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.draw-slot.slot-bye {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #6b7280;
  text-decoration: line-through;
}

.draw-slot-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
  font-size: 11px;
  color: #555;
}

.slot-legend-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 3px;
  border: 1px solid #ccc;
}

.slot-legend-box.slot-first {
  background: #fef9c3;
  border-color: #facc15;
}

.slot-legend-box.slot-second {
  background: #dcfce7;
  border-color: #86efac;
}

.slot-legend-box.slot-bye {
  background: #e5e7eb;
  border-color: #9ca3af;
}

table.draw-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  background: #fff;
}

table.draw-table th {
  background: #1a3a6b;
  color: #fff;
  padding: 6px 10px;
  text-align: center;
  border: 1px solid #1a3a6b;
  font-weight: bold;
  white-space: nowrap;
}

table.draw-table td {
  padding: 5px 10px;
  border: 1px solid #c8d0e0;
  text-align: center;
  white-space: nowrap;
}

table.draw-table tr:nth-child(even) td {
  background: #f8faff;
}

table.draw-table tr:hover td {
  background: #e8f0fe;
}

table.draw-table .rank-1 td {
  font-weight: bold;
}

table.draw-table .rank-1 td:first-child {
  color: #d4a017;
}

.draw-number-input {
  width: 50px;
  text-align: center;
  border: 1px solid #aac;
  border-radius: 3px;
  padding: 4px 2px;
  font-size: 13px;
  font-weight: bold;
  font-family: inherit;
}

.draw-number-input:focus {
  border-color: #1a3a6b;
  outline: none;
  box-shadow: 0 0 3px rgba(26,58,107,0.3);
}

.draw-number-input.error {
  border-color: #d84040;
  background: #fff0f0;
}

.draw-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.draw-status {
  font-size: 12px;
  color: #555;
  margin-left: 8px;
}

.draw-status.success {
  color: #2e7d32;
}

.draw-status.error {
  color: #d84040;
}

.advance-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #81c784;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: bold;
}

/* ── 본선 토너먼트: 브라켓 ── */
#bracket-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

#champion-banner {
  background: #ffd700;
  color: #333;
  text-align: center;
  padding: 10px;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  border-radius: 4px;
}

#bracket-summary,
#team-bracket-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.summary-card {
  background: #f0f4ff;
  border: 1px solid #c0c8d8;
  border-radius: 6px;
  padding: 6px 14px;
  text-align: center;
  min-width: 70px;
}

.summary-card .round-name {
  font-size: 11px;
  color: #555;
}

.summary-card .count {
  font-size: 14px;
  font-weight: bold;
  color: #1a3a6b;
}

#bracket-round-btns,
#team-bracket-round-btns {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

#bracket-round-btns a,
#team-bracket-round-btns a {
  text-decoration: none;
  font-size: 12px;
  background: #1a3a5c;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
}

#bracket-round-btns a:hover,
#team-bracket-round-btns a:hover {
  background: #2a5a8c;
}

.bracket-wrap {
  overflow-x: auto;
  padding: 8px 0;
}

.bracket {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: max-content;
}

.bracket .round {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bracket .round-label {
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  background: #1a3a5c;
  padding: 3px 8px;
  margin-bottom: 4px;
  border-radius: 3px;
}

.bracket .match {
  display: flex;
  flex-direction: column;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s;
}

.bracket .match:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.bracket .team-row {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  min-height: 20px;
  border-bottom: 1px solid #ddd;
  gap: 4px;
}

.bracket .team-row:last-child {
  border-bottom: none;
}

.bracket .team-row.winner-row {
  background: #fffff0;
  font-weight: bold;
}

.bracket .team-row.bye-row {
  background: #f8f8f8;
  color: #aaa;
  font-style: italic;
}

.bracket .draw-num {
  font-size: 10px;
  color: #999;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.bracket .team-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.bracket .team-score {
  font-size: 12px;
  font-weight: bold;
  color: #1a3a5c;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.bracket .r1 .match { width: 130px; margin: 2px 0; }
.bracket .r2 .match { width: 130px; }
.bracket .r3 .match { width: 130px; }
.bracket .r4 .match { width: 130px; }
.bracket .r5 .match { width: 140px; }

.bracket .connector-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 20px;
}

.bracket .conn-line {
  border-right: 2px solid #bbb;
  border-top: 2px solid #bbb;
  border-bottom: 2px solid #bbb;
  min-height: 20px;
}

.bracket-empty-msg {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* ── 랭킹 ── */
.ranking-grade-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 10px;
  background: #fff;
  border-radius: 4px;
  padding: 4px;
  border: 1px solid #ccc;
  width: fit-content;
}

.rk-grade-tab {
  padding: 6px 18px;
  border: none;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  font-family: inherit;
  color: #666;
  transition: all 0.15s;
}

.rk-grade-tab:hover {
  background: #f0f4ff;
  color: #333;
}

.rk-grade-tab.active {
  background: #1a3a6b;
  color: #fff;
}

.ranking-search-bar {
  margin-bottom: 10px;
}

.ranking-search-input {
  width: 100%;
  max-width: 400px;
  padding: 7px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.ranking-search-input:focus {
  border-color: #3b78d8;
  box-shadow: 0 0 0 2px rgba(59,120,216,0.15);
}

.ranking-stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.ranking-stat-card {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 16px;
  min-width: 100px;
}

.rk-label {
  font-size: 11px;
  color: #888;
  font-weight: bold;
}

.rk-value {
  font-size: 20px;
  font-weight: bold;
  color: #1a3a6b;
}

.ranking-table-wrap {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ranking-table thead th {
  background: #dde5f5;
  padding: 6px 8px;
  text-align: center;
  border: 1px solid #aab8d8;
  font-weight: bold;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.ranking-table tbody td {
  padding: 5px 8px;
  border: 1px solid #dde0e8;
  text-align: center;
  white-space: nowrap;
}

.ranking-table tbody tr:hover td {
  background: #f0f4ff;
}

.rk-rank-cell {
  font-weight: bold;
  color: #1a3a6b;
  width: 50px;
}

.rk-rank-1 { color: #b45309; }
.rk-rank-2 { color: #6b7280; }
.rk-rank-3 { color: #92400e; }

.rk-medal {
  font-size: 14px;
  margin-right: 2px;
}

.rk-name-cell {
  text-align: left !important;
  font-weight: bold;
  cursor: pointer;
  color: #2563eb;
}

.rk-name-cell:hover {
  color: #db2777;
  text-decoration: underline;
}

.rk-province-cell,
.rk-school-cell {
  text-align: left !important;
  color: #444;
}

.rk-score-zero {
  color: #ccc;
}

.rk-score-highlight {
  background: #fef9c3;
}

.rk-th-highlight {
  background: #fde047 !important;
  color: #333 !important;
}

.rk-total-cell {
  font-weight: bold;
  font-size: 13px;
  color: #1a3a6b;
}

/* 랭킹 모달 */
.rk-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.rk-modal-backdrop.show {
  display: flex;
}

.rk-modal {
  background: #fff;
  border-radius: 8px;
  width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.rk-modal-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rk-modal-header h3 {
  font-size: 15px;
  color: #1a3a6b;
}

.rk-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #888;
  padding: 2px 6px;
  border-radius: 4px;
}

.rk-modal-close:hover {
  background: #f0f0f0;
}

.rk-modal-body {
  padding: 14px 18px;
}

.rk-player-info {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #444;
  flex-wrap: wrap;
}

.rk-player-info span {
  background: #f0f4ff;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #dde5f5;
}

.rk-score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rk-score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9fafb;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

.rk-score-item .rk-t-name {
  font-size: 12px;
  font-weight: bold;
}

.rk-score-item .rk-t-class {
  font-size: 11px;
  color: #888;
}

.rk-score-item .rk-t-score {
  font-size: 15px;
  font-weight: bold;
  color: #1a3a6b;
}

.rk-score-item .rk-t-score.zero {
  color: #ccc;
}

.rk-modal-total {
  margin-top: 12px;
  padding: 10px 14px;
  background: #1a3a6b;
  color: #fff;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 14px;
}

/* 랭킹 상단 바 (학년 탭 + 버튼) */
.rk-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.rk-action-btns {
  display: flex;
  gap: 6px;
}

.rk-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.rk-btn-generate {
  background: #f59e0b;
  color: #fff;
}

.rk-btn-generate:hover {
  background: #d97706;
}

.rk-btn-export {
  background: #10b981;
  color: #fff;
}

.rk-btn-export:hover {
  background: #059669;
}

.rk-btn-save {
  background: #3b82f6;
  color: #fff;
  padding: 8px;
  font-size: 13px;
}

.rk-btn-save:hover {
  background: #2563eb;
}

/* 모달 내 편집 필드 */
.rk-edit-grade {
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 12px;
}

.rk-edit-score {
  width: 60px;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 14px;
  font-weight: bold;
  text-align: right;
  color: #1a3a6b;
}

/* ── 일정표 ────────────────────────────────────────── */
.schedule-wrap {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 10px;
}
.schedule-title {
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #1a3a6b;
}
.schedule-notice {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-bottom: 2px;
}
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 13px;
}
.schedule-table th {
  background: #1a3a6b;
  color: #fff;
  padding: 8px 4px;
  border: 1px solid #345;
  text-align: center;
  font-weight: bold;
}
.schedule-table td {
  padding: 5px 6px;
  border: 1px solid #ccc;
  text-align: center;
  vertical-align: middle;
}
.schedule-date {
  background: #f0f4fa;
  font-weight: bold;
  color: #1a3a6b;
  font-size: 14px;
}
.schedule-date-border {
  border-top: none;
}
.schedule-highlight-green {
  background: #e6ffe6;
  font-weight: bold;
  color: #006600;
  text-align: left;
}
.schedule-highlight-pink {
  background: #ffe6f0;
  font-weight: bold;
  color: #cc0066;
  text-align: center;
}
.schedule-note {
  font-size: 11px;
  color: #c00;
  text-align: left;
  line-height: 1.4;
}
.schedule-table tr:hover {
  background: #f8f9fd;
}
