:root {
  color-scheme: dark;
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --bg: #0c1016;
  --panel: #141a23;
  --line: #2b3543;
  --ink: #f0f3f7;
  --muted: #bac5d2;
  --gold: #ebc991;
  --blue: #8ed3fc;
  --red: #ffaaa5;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.masthead { border-bottom: 1px solid var(--line); background: #10151d; }
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.masthead-brand { display: flex; align-items: center; height: 64px; }
.brand { text-decoration: none; color: var(--gold); font-size: 20px; font-weight: 800; }
.site-nav { display: flex; gap: 8px; }
.site-nav a {
  display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 8px 24px;
  border: 1px solid #344b61; border-bottom: 0; border-radius: 5px 5px 0 0;
  background: #0d1722; color: #b9c8da; font-size: 15px; font-weight: 700;
  line-height: 1.3; text-align: center; text-decoration: none; word-break: keep-all;
}
.site-nav a[aria-current="page"] {
  border-color: #e6bd72; background: linear-gradient(#192633, #101a25); color: #f3cd85;
}
.site-nav a:not([aria-current]):hover { background: #1d2a38; }
.site-nav a:focus-visible { outline-offset: -4px; }
main { padding-block: 44px 36px; }
.hero { margin-bottom: 24px; }
.realm { color: var(--gold); font-size: 17px; font-weight: 700; margin: 0 0 9px; }
h1 { font-size: clamp(34px, 5vw, 48px); letter-spacing: -.055em; margin: 0 0 12px; line-height: 1.12; }
.transfer-overview {
  margin-top: 18px; overflow: hidden; border: 1px solid #7e633e; border-radius: 12px;
  background: #191b22;
}
.overview-top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 18px; padding: 15px clamp(12px, 3vw, 20px);
  background: linear-gradient(100deg, #272018, #191b22 73%);
}
.round-status { color: var(--muted); font-size: 17px; line-height: 1.5; margin: 0; }
.round-status strong { color: var(--ink); font-size: 19px; }
.transfer-schedule { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin: 5px 0 0; font-size: 17px; line-height: 1.5; }
.transfer-schedule strong { color: var(--gold); }
#schedule-window { font-weight: 700; font-variant-numeric: tabular-nums; }
.transfer-schedule small { flex-basis: 100%; color: var(--muted); font-size: 15px; }
.castle-rotation { padding: 10px clamp(12px, 3vw, 20px) 13px; border-top: 1px solid #493b2c; }
.castle-rotation h2 { margin: 0 0 7px; color: var(--muted); font-size: 15px; }
.castle-rotation ol {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  margin: 0; padding: 0; list-style: none;
}
.castle-rotation li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: #151a22;
}
.castle-rotation li span { color: var(--muted); font-size: 14px; }
.castle-rotation li strong { color: var(--ink); font-size: 17px; }
.castle-rotation li[aria-current="date"] { border-color: var(--gold); background: var(--gold); }
.castle-rotation li[aria-current="date"] > * { color: #21170d; }
.guide-button, .guide-close {
  min-height: 44px; padding: 6px 12px; border: 1px solid #92774f; border-radius: 8px;
  background: #2b2218; color: var(--gold); font-size: 16px; font-weight: 700; cursor: pointer;
}
.guide-button:hover, .guide-close:hover { background: #3e3021; }
.overview-top .guide-button { background: var(--gold); color: #21170d; border-color: var(--gold); }
.overview-top .guide-button:hover { background: #f9dbad; }
.transfer-guide {
  width: min(680px, calc(100% - 24px)); max-width: none; height: min(600px, calc(100dvh - 24px));
  padding: 0; overflow: auto; overscroll-behavior: contain; border: 1px solid #48576a;
  border-radius: 14px; background: var(--panel); color: var(--ink);
}
.transfer-guide::backdrop { background: rgb(0 0 0 / 74%); }
body:has(.transfer-guide[open]) { overflow: hidden; }
.guide-header {
  position: sticky; top: 0; z-index: 1;
  padding: 14px clamp(14px, 4vw, 24px) 0; border-bottom: 1px solid var(--line); background: #191f29;
}
.guide-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.guide-header h2 { margin: 0; font-size: clamp(20px, 5vw, 25px); }
.guide-close { flex-shrink: 0; }
.guide-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.guide-tab {
  min-height: 46px; padding: 7px; border: 1px solid var(--line); border-bottom: 3px solid transparent;
  border-radius: 7px 7px 0 0; color: var(--muted); background: #151b24;
  font-size: 17px; font-weight: 700; cursor: pointer;
}
.guide-tab:hover { color: var(--ink); }
.guide-tab[aria-selected="true"] { color: var(--gold); background: #31271d; border-bottom-color: var(--gold); }
.board-tabs { margin: 0 0 18px; }
.board-tabs .guide-tab { min-height: 50px; font-size: 18px; }
.guide-body { padding: 18px clamp(14px, 4vw, 24px) 22px; font-size: 17px; line-height: 1.55; }
.guide-body h3 { margin: 0 0 8px; font-size: 20px; }
.guide-body p { margin: 0; }
.guide-body details { border-bottom: 1px solid var(--line); }
.guide-body summary { padding-block: 10px; font-weight: 700; cursor: pointer; }
.guide-body summary::marker { color: var(--gold); }
.guide-body details > p, .guide-body .guide-meta { padding-bottom: 10px; color: var(--muted); }
.guide-schedule-note { color: var(--muted); }
.guide-periods { padding: 0; margin: 0 0 12px; list-style: none; }
.guide-periods li { padding: 4px 0; }
.guide-periods .schedule-break { color: var(--gold); font-weight: 700; }
.guide-links { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 14px; }
.guide-links a { color: var(--blue); font-size: 15px; text-underline-offset: 3px; }
.siege { margin-bottom: 20px; }
.siege h2 { margin: 0 0 10px; font-size: 20px; }
.siege-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.summary-card {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: 4px 12px; padding: 11px 15px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel); font-size: 17px; font-weight: 700;
}
.summary-card strong { font-size: 24px; }
.summary-card[hidden] { display: none; }
button.summary-card {
  cursor: pointer; text-align: left;
  border-color: color-mix(in srgb, currentColor 50%, var(--line));
}
button.summary-card:hover { background: color-mix(in srgb, currentColor 10%, var(--panel)); }
button.summary-card[aria-pressed="true"] {
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 18%, var(--panel));
}
.contested { color: var(--gold); }
button.summary-card.contested {
  border-color: #bb914f; background: #33271a;
}
button.summary-card.contested:hover,
button.summary-card.contested[aria-pressed="true"] {
  border-color: var(--gold); background: #46331e;
}
.board { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.toolbar { display: flex; align-items: end; gap: 12px; padding: 16px 18px; }
.control { display: grid; gap: 6px; color: var(--muted); font-size: 16px; font-weight: 700; }
.control input, .control select {
  height: 48px; max-width: 100%; min-width: 0; border: 1px solid #48576a;
  border-radius: 7px; padding-inline: 11px; color: var(--ink); background: #0f141c; font-size: 17px;
}
.control select { min-width: 132px; }
.search { width: min(100%, 320px); }
input::placeholder { color: var(--muted); opacity: 1; }
#count { margin: 0 0 13px auto; color: var(--muted); font-size: 15px; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.has-headcount { cursor: pointer; }
.headcount-toggle { display: block; margin-top: 8px; padding: 6px 8px; border: 1px solid #b88c48; border-radius: 6px; background: #201c16; color: #ffd78c; font: inherit; font-size: 13px; cursor: pointer; }
.headcount-toggle:hover { background: #43321d; }
.headcount-toggle:focus-visible { outline: 2px solid #ffd78c; outline-offset: 3px; }
.headcount-detail[hidden] { display: none; }
.headcount-detail > td { background: #141b25; padding: 20px; }
.headcount-panel h3 { margin: 0 0 8px; color: #ffd78c; font-size: 20px; }
.headcount-source { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 8px 0; }
.headcount-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.headcount-side { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.headcount-side.blue { background: #152332; }
.headcount-side.red { background: #2b2029; }
.headcount-side h4 { margin: 0 0 12px; font-size: 16px; }
.headcount-teams { margin: 0; }
.headcount-teams > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.headcount-teams dd { margin: 0; font-weight: 700; white-space: nowrap; }
.headcount-teams .headcount-nicknames { flex-basis: 100%; font-weight: 400; white-space: normal; overflow-wrap: anywhere; line-height: 1.6; color: #d8e0eb; font-size: 14px; }
@media (max-width: 600px) { .headcount-sides { grid-template-columns: 1fr; } .headcount-detail > td { padding: 12px; } }
col:first-child { width: 14%; }
col.side-column { width: 43%; }
th, td { text-align: left; padding: 12px 16px; border-top: 1px solid var(--line); }
thead th { text-align: center; font-size: 18px; color: var(--muted); background: #191f29; }
thead .blue { background: #152332; }
thead .red { background: #2b2029; }
.blue { color: var(--blue); }
.red { color: var(--red); }
tbody th { font-size: 18px; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
tbody td { font-size: 18px; }
tbody th[data-siege-status] {
  background: color-mix(in srgb, currentColor 9%, var(--panel));
}
tbody tr:has(> th[data-siege-status="contested"]) {
  background: #2b231b;
}
tbody tr:has(> th[data-siege-status="contested"]):hover {
  background: #352a1f;
}
tbody tr:has(> th[data-siege-status="contested"]) > * {
  border-top-color: #6a5032;
}
tbody th[data-siege-status="contested"] {
  background: #44321e;
  color: #ffde99;
}
.siege-status {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.siege-results-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 12px; }
.siege-results-header h2 { margin: 0; font-size: 22px; }
.siege-results-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; }
.siege-results-controls h2 { align-self: center; }
.siege-round-control select { min-width: 125px; }
.siege-result-totals { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.siege-result-totals strong { padding: 5px 10px; border: 1px solid currentColor; border-radius: 6px; font-size: 17px; }
.siege-result-totals .blue { background: #123550; }
.siege-result-totals .red { background: #492932; }
.siege-result-table col:first-child { width: 27%; }
.siege-result-table thead .blue { color: #d7f1ff; background: #174064; }
.siege-result-table thead .red { color: #ffe3e1; background: #642f3b; }
.siege-result-table :is(th, td) { text-align: center; }
.siege-result-table td:nth-child(2) { background: #122839; }
.siege-result-table td:nth-child(3) { background: #32212a; }
.siege-result-table .siege-winner {
  font-weight: 800; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere;
}
.siege-result-table td.siege-winner.blue { background: #205b84; color: #f1fbff; }
.siege-result-table td.siege-winner.red { background: #883d49; color: #fff2ef; }
th + th, td { border-left: 1px solid var(--line); }
tbody tr:nth-child(even) { background: #121821; }
tbody tr:hover { background: #1c2633; }
.placement { display: grid; grid-template-columns: minmax(0, 39%) minmax(0, 1fr); gap: 10px; align-items: start; }
.servers { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; padding: 3px 7px; background: #223247; border-radius: 4px; font-size: 17px; font-weight: 700; line-height: 1.3; }
.red .chip { background: #3a2831; }
.teams { display: grid; gap: 4px; padding-block: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.team-line { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px; align-items: baseline; }
.team-label { font-size: 14px; font-weight: 700; white-space: nowrap; }
.team-main .team-names { color: var(--ink); font-weight: 700; }
.team-friendly, .team-note { color: var(--muted); }
.team-note { font-size: 14px; }
.empty, .unknown { color: var(--muted); }
.no-results { text-align: center; padding: 34px 12px; color: var(--muted); }
footer { color: var(--muted); margin-top: 14px; font-size: 15px; line-height: 1.65; }
@media (max-width: 660px) {
  .shell { width: calc(100% - 28px); }
  main { padding-top: 30px; }
  .masthead-brand { height: 55px; }
  .site-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .site-nav a { min-height: 44px; padding: 6px 4px; font-size: 13px; }
  .overview-top .guide-button { width: 100%; }
  .castle-rotation ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { flex-wrap: wrap; gap: 8px 10px; padding: 12px; }
  .search { flex: 1 1 140px; width: auto; min-width: 0; }
  .control select { min-width: 108px; }
  #count { flex-basis: 100%; margin: 2px 0 0; text-align: right; }
  .siege-summary { gap: 6px; }
  .summary-card { display: grid; align-content: space-between; padding: 8px; font-size: 14px; word-break: keep-all; }
  .summary-card strong { font-size: 20px; }
  col:first-child { width: 21%; }
  col.side-column { width: 39.5%; }
  th, td { padding: 9px 8px; }
  tbody th { padding-inline: 5px; }
  thead th, tbody th, tbody td { font-size: 16px; }
  .placement { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .chip { font-size: 16px; }
  .team-line { gap: 5px; }
}
