/* 대회별 일정 기반 경기 입력과 결과 요약 화면의 반응형·인쇄 스타일 */
:root {
  --ink: #17202a;
  --muted: #66717d;
  --line: #d6dce2;
  --paper: #ffffff;
  --canvas: #f3f5f7;
  --blue: #075aa8;
  --blue-soft: #e8f2fb;
  --red: #b42332;
  --red-soft: #fcebed;
  --green: #18794e;
  --green-soft: #e9f6ef;
  --amber: #996515;
  --amber-soft: #fff5d9;
  --charcoal: #20282f;
  --focus: #111111;
}

* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); font-family: Arial, "Noto Sans KR", sans-serif; }
body { margin: 0; min-width: 320px; }
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: #fff; padding: 10px 14px; border: 2px solid var(--focus); }
.skip-link:focus { top: 12px; }

.topbar { background: var(--charcoal); color: #fff; border-bottom: 4px solid var(--blue); }
.topbar-inner { width: min(1440px, 100%); min-height: 68px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.event-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; background: #fff; color: var(--charcoal); border-radius: 4px; font-size: 17px; font-weight: 900; }
.identity-copy { min-width: 0; }
.identity-copy strong, .identity-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; }
.identity-copy strong { font-size: 16px; }
.identity-copy small { margin-top: 3px; color: #c7d0d8; font-size: 12px; }
.top-actions { display: flex; gap: 7px; flex: 0 0 auto; }
.top-actions a, .top-actions button { min-height: 38px; border: 1px solid #59646e; border-radius: 4px; background: transparent; color: #fff; padding: 8px 11px; text-decoration: none; cursor: pointer; }
.top-actions a:hover, .top-actions button:hover { background: #35414b; }

main { width: min(1440px, 100%); margin: 0 auto; padding: 18px 20px 40px; }
.event-summary { display: grid; grid-template-columns: minmax(260px, 0.7fr) minmax(600px, 1.3fr); background: var(--paper); border: 1px solid var(--line); border-radius: 6px 6px 0 0; }
.event-summary > div:first-child { padding: 18px; border-right: 1px solid var(--line); }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 11px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 30px; line-height: 1.15; }
#eventName { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.event-facts { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.event-facts div { min-width: 0; padding: 16px; border-right: 1px solid var(--line); }
.event-facts div:last-child { border-right: 0; }
.event-facts dt { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.event-facts dd { margin: 0; font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }

.notice { padding: 10px 14px; border: 1px solid; border-top: 0; font-size: 13px; }
.notice.warning { background: var(--amber-soft); border-color: #e6c66b; color: #65420b; }
.notice.error { background: var(--red-soft); border-color: #e5a5ad; color: #7a1522; }

.today-board, .group-result, .category-band { background: var(--paper); border: 1px solid var(--line); border-top: 0; }
.board-header { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.board-header h2, .board-header p, .section-heading h3, .section-heading span { margin: 0; }
.board-header h2 { font-size: 18px; }
.board-header p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.day-tabs { min-width: 0; display: flex; gap: 4px; overflow-x: auto; }
.day-tabs button { min-width: 92px; min-height: 38px; border: 1px solid var(--line); border-radius: 4px; background: #fff; padding: 7px 10px; cursor: pointer; font-size: 12px; font-weight: 800; white-space: nowrap; }
.day-tabs button.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.filters { display: flex; gap: 5px; padding: 10px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.filters button, .category-buttons button, .group-buttons button, .group-buttons a { min-height: 34px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 4px; background: #fff; padding: 6px 10px; color: var(--ink); font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; cursor: pointer; }
.filters button.active { border-color: var(--charcoal); background: var(--charcoal); color: #fff; }
.filters button:hover, .category-buttons button:hover, .group-buttons button:hover, .group-buttons a:hover { border-color: var(--blue); background: var(--blue-soft); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.metrics div { min-width: 0; padding: 11px 16px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span, .metrics strong { display: block; }
.metrics span { color: var(--muted); font-size: 11px; }
.metrics strong { margin-top: 3px; font-size: 17px; }

.board-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.5fr); }
.schedule-pane, .detail-pane { min-width: 0; padding: 14px 16px 16px; }
.schedule-pane { border-right: 1px solid var(--line); }
.detail-pane { background: #f8fafb; }
.section-heading { min-height: 32px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-heading h3 { font-size: 14px; }
.section-heading span { color: var(--muted); font-size: 11px; text-align: right; }
.section-heading.compact { margin-top: 18px; }

.schedule-rows { border-top: 1px solid var(--line); }
.schedule-row { width: 100%; min-height: 64px; display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; }
.schedule-row:hover, .schedule-row.selected { background: var(--blue-soft); }
.schedule-row:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.schedule-time { font-size: 12px; font-weight: 850; font-variant-numeric: tabular-nums; }
.schedule-copy { min-width: 0; }
.schedule-copy strong, .schedule-copy small { display: block; overflow-wrap: anywhere; }
.schedule-copy strong { font-size: 13px; }
.schedule-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.status { min-width: 82px; display: inline-flex; align-items: center; justify-content: center; min-height: 28px; border-radius: 4px; padding: 5px 7px; background: #edf1f4; color: #44515d; font-size: 11px; font-weight: 850; white-space: nowrap; }
.status.completed { background: var(--green-soft); color: var(--green); }
.status.partial, .status.session { background: var(--red-soft); color: var(--red); }
.status.draw_pending, .status.result_waiting { background: var(--amber-soft); color: var(--amber); }

.session-detail { min-height: 205px; border-top: 1px solid var(--line); }
.empty-state { margin: 0; padding: 22px 4px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty-state.inline { padding: 0; }
.source-empty { display: grid; gap: 5px; padding: 28px 12px; text-align: center; }
.source-empty strong { color: var(--ink); font-size: 15px; }
.source-empty span { display: block; }
.detail-list { margin: 0; }
.detail-list div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: 11px; font-weight: 700; }
.detail-list dd { margin: 0; font-size: 12px; font-weight: 750; overflow-wrap: anywhere; }
.detail-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }
.detail-link { color: var(--blue); font-size: 12px; font-weight: 800; }
.group-buttons, .category-buttons { display: flex; gap: 5px; flex-wrap: wrap; }
.group-buttons button.active, .category-buttons button.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.group-result { padding: 16px; }
.group-result-header, .category-band { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.group-result-header { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.group-result-header h2, .category-band h2 { margin: 0; font-size: 18px; }
#groupResultStatus { color: var(--green); font-size: 12px; font-weight: 800; }
.group-result-grid { display: grid; grid-template-columns: minmax(330px, 0.7fr) minmax(520px, 1.3fr); gap: 18px; padding-top: 14px; }
.group-result h3 { margin: 0 0 8px; font-size: 14px; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 12px; }
th, td { height: 34px; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th:last-child, td:last-child { border-right: 0; }
thead th { background: #edf1f4; font-weight: 850; }
tbody tr:last-child td { border-bottom: 0; }
.player-cell { text-align: left; }
.winner-cell { color: var(--green); font-weight: 850; }
.forfeit-cell { color: var(--red); }
.match-results { padding-top: 16px; }
.match-result-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); }
.match-result-row { min-height: 58px; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.match-result-row:nth-child(2n) { border-right: 0; }
.match-result-row .match-no { color: var(--muted); font-size: 11px; font-weight: 800; }
.match-players { min-width: 0; font-size: 12px; line-height: 1.45; }
.match-players span { display: block; overflow-wrap: anywhere; }
.game-scores { color: var(--blue); font-size: 11px; font-weight: 800; white-space: nowrap; }

.category-band { padding: 16px; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 2px 0; color: var(--muted); font-size: 12px; }
footer p { margin: 0; }
footer a { color: var(--blue); font-weight: 800; white-space: nowrap; }

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .event-summary { grid-template-columns: 1fr; }
  .event-summary > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .board-layout { grid-template-columns: 1fr; }
  .schedule-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .group-result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .topbar-inner { min-height: 62px; padding: 8px 12px; }
  .identity-copy strong { max-width: 190px; font-size: 13px; }
  .identity-copy small { font-size: 10px; }
  .top-actions .program-link, .top-actions .full-results { display: none; }
  .top-actions a, .top-actions button { min-height: 36px; padding: 7px 8px; font-size: 11px; }
  main { padding: 10px 8px 28px; }
  .event-summary > div:first-child { padding: 14px; }
  h1 { font-size: 24px; }
  .event-facts { grid-template-columns: 1fr 1fr; }
  .event-facts div { padding: 11px; border-bottom: 1px solid var(--line); }
  .event-facts div:nth-child(2n) { border-right: 0; }
  .event-facts div:nth-last-child(-n+2) { border-bottom: 0; }
  .board-header { display: block; padding: 11px; }
  .day-tabs { margin-top: 10px; }
  .filters { padding: 8px 11px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics div:nth-child(2n) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .schedule-pane, .detail-pane { padding: 11px; }
  .section-heading { display: block; }
  .section-heading span { display: block; margin-top: 3px; text-align: left; }
  .schedule-row { grid-template-columns: 74px minmax(0, 1fr); gap: 7px; padding: 9px 4px; }
  .status { grid-column: 2; justify-self: start; min-width: 0; }
  .group-result { padding: 12px 10px; }
  .group-result-header, .category-band { align-items: flex-start; flex-direction: column; gap: 10px; }
  .match-result-rows { grid-template-columns: 1fr; }
  .match-result-row { border-right: 0; }
  .match-result-row { grid-template-columns: 48px minmax(0, 1fr); }
  .game-scores { grid-column: 2; white-space: normal; }
  footer { align-items: flex-start; flex-direction: column; }
}

@page { size: A4 landscape; margin: 8mm; }
@media print {
  html, body { background: #fff; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .skip-link, .topbar, .notice, .filters, .detail-pane, .group-result, .category-band, footer { display: none !important; }
  main { width: 100%; padding: 0; }
  .event-summary, .today-board { border: 1px solid #888; }
  .event-summary { grid-template-columns: 0.8fr 1.2fr; }
  .event-summary > div:first-child { padding: 9px 12px; border-right: 1px solid #888; border-bottom: 0; }
  .event-summary h1 { font-size: 22px; }
  .event-summary .eyebrow, #eventName { margin-bottom: 2px; font-size: 9px; }
  .event-facts div { padding: 9px 11px; }
  .event-facts dt { margin-bottom: 2px; font-size: 9px; }
  .event-facts dd { font-size: 11px; }
  .board-header { min-height: 42px; padding: 6px 11px; }
  .board-header h2 { font-size: 14px; }
  .board-header p, .day-tabs button { font-size: 9px; }
  .day-tabs button { min-height: 28px; padding: 4px 8px; }
  .day-tabs button:not(.active) { display: none; }
  .metrics div { padding: 5px 11px; }
  .metrics span { font-size: 8px; }
  .metrics strong { margin-top: 1px; font-size: 12px; }
  .board-layout { display: block; }
  .schedule-pane { padding: 5px 11px 6px; border: 0; }
  .section-heading { min-height: 20px; margin-bottom: 3px; }
  .section-heading h3 { font-size: 10px; }
  .section-heading span { font-size: 8px; }
  .schedule-row { min-height: 36px; gap: 8px; padding: 3px 7px; break-inside: avoid; }
  .schedule-time, .schedule-copy strong { font-size: 9px; }
  .schedule-copy small, .status { font-size: 8px; }
  .schedule-copy small { margin-top: 1px; }
  .status { min-width: 68px; min-height: 22px; padding: 3px 5px; }
}
