@import url("https://cdn.tonycrane.cc/jbmono/jetbrainsmono.css");
@import url("https://cdn.tonycrane.cc/lxgw/lxgwscreen.css");

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #f0f3f8;
  --surface-strong: #e4e9f2;
  --ink: #17202f;
  --muted: #667085;
  --line: #d9e0ea;
  --line-strong: #b8c4d4;
  --kpl: #3268d8;
  --kpl-soft: #e4edff;
  --worldcup: #c43f8f;
  --worldcup-soft: #f9e3f1;
  --scheduled: #247856;
  --live: #dc5b3f;
  --finished: #7a8291;
  --shadow: 0 22px 80px rgb(23 32 47 / 10%);
  --display: "JetBrains Mono", "LXGW WenKai Screen", ui-monospace, monospace;
  --body: "LXGW WenKai Screen", "JetBrains Mono", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% 0, rgb(50 104 216 / 12%), transparent 24rem),
    radial-gradient(circle at 92% 8%, rgb(196 63 143 / 10%), transparent 26rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--kpl);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgb(247 248 251 / 86%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgb(23 32 47 / 8%);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: -0.03em;
}

.brand small {
  margin-top: -2px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
}

.view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.view-button {
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--display);
  font-size: 12px;
}

.view-button:hover,
.view-button.active {
  background: var(--ink);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: 210px minmax(760px, 1fr) 300px;
  gap: 18px;
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 26px 28px 64px;
}

.filters,
.day-panel {
  position: sticky;
  top: 94px;
  align-self: start;
}

.filter-panel,
.day-panel,
.calendar-toolbar,
.calendar-canvas,
.sources {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgb(255 255 255 / 78%);
  box-shadow: var(--shadow);
}

.filter-panel {
  margin-bottom: 14px;
  padding: 14px;
  box-shadow: none;
}

.filter-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0;
  padding: 8px 10px;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.filter-button:hover,
.filter-button.active {
  background: var(--surface-soft);
  color: var(--ink);
}

.filter-button.active {
  box-shadow: inset 3px 0 0 var(--kpl);
}

.filter-button small {
  color: var(--muted);
  font-family: var(--display);
}

.filter-note {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.filter-note strong {
  color: var(--ink);
  font-family: var(--display);
  font-size: 12px;
}

.calendar-app {
  min-width: 0;
}

.calendar-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 16px;
}

.period-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.period-controls h2 {
  margin: 0 0 0 8px;
  overflow: hidden;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.today-button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--display);
}

.icon-button {
  width: 38px;
}

.today-button {
  padding: 0 14px;
}

.icon-button:hover,
.today-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.search-box {
  display: grid;
  min-width: min(320px, 100%);
  gap: 6px;
}

.search-box span {
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
}

.search-box input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
}

.result-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
}

.notice {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid #e6c06c;
  border-radius: 16px;
  background: #fff6df;
  color: #6c4a08;
}

.hidden {
  display: none;
}

.calendar-canvas {
  min-height: 520px;
  padding: 20px;
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  text-align: center;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.day-cell {
  display: flex;
  min-height: 136px;
  flex-direction: column;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.day-cell:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.day-cell.outside-period {
  opacity: 0.42;
}

.day-cell.is-past {
  background: #f4f5f7;
}

.day-cell.is-today {
  border-color: var(--kpl);
  box-shadow: inset 0 0 0 1px var(--kpl);
}

.day-cell.is-selected {
  background: #eef4ff;
}

.day-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.day-number {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 800;
}

.match-count {
  display: inline-grid;
  min-width: 24px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 800;
}

.month-fixtures {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.fixture-pair {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
}

.watch-marker {
  display: inline-flex;
  width: fit-content;
  min-width: 38px;
  align-items: center;
  justify-content: center;
  justify-self: center;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
}

.fixture-pair.source-kpl,
.watch-marker.source-kpl,
.compact-match.source-kpl,
.detail-match.source-kpl {
  border-color: rgb(50 104 216 / 22%);
  background: var(--kpl-soft);
}

.fixture-pair.source-worldcup,
.watch-marker.source-worldcup,
.compact-match.source-worldcup,
.detail-match.source-worldcup {
  border-color: rgb(196 63 143 / 22%);
  background: var(--worldcup-soft);
}

.fixture-pair.is-focus {
  border-color: #e2b93b;
  box-shadow:
    inset 0 0 0 1px rgb(226 185 59 / 42%),
    0 6px 14px rgb(226 185 59 / 18%);
}

.watch-marker.is-watch {
  border-color: rgb(23 32 47 / 14%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 60%);
}

.fixture-pair span:not(.mini-flag):not(.mini-initial) {
  color: var(--muted);
  font-family: var(--display);
  font-size: 9px;
  line-height: 1;
  text-transform: uppercase;
}

.mini-logo,
.mini-initial {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 50%;
  background: rgb(255 255 255 / 82%);
  object-fit: contain;
}

.mini-flag {
  flex: 0 0 auto;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 19px;
  line-height: 1;
}

.mini-initial {
  font-family: var(--display);
  font-size: 8px;
  font-weight: 800;
}

.more-events {
  justify-self: center;
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
}

.quarter-canvas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.quarter-month {
  min-width: 0;
}

.quarter-month header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.quarter-month h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
}

.quarter-month header span {
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
}

.compact-month-grid .day-cell {
  min-height: 54px;
  justify-content: space-between;
  padding: 7px;
  border-radius: 11px;
}

.compact-month-grid .day-number {
  font-size: 12px;
}

.event-dots {
  display: flex;
  gap: 3px;
}

.event-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.event-dot.source-kpl {
  background: var(--kpl);
}

.event-dot.source-worldcup {
  background: var(--worldcup);
}

.week-canvas {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.week-day {
  display: flex;
  min-width: 0;
  min-height: 580px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}

.week-day.is-today {
  border-color: var(--kpl);
}

.week-day-head {
  display: grid;
  gap: 2px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  cursor: pointer;
  text-align: left;
}

.week-day-head span,
.week-day-head small {
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
}

.week-day-head strong {
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
}

.week-events {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
}

.compact-match {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 12px;
}

.compact-match.is-focus,
.detail-match.is-focus {
  border-color: #e2b93b;
  box-shadow: inset 0 0 0 1px rgb(226 185 59 / 36%);
}

.compact-match.is-watch:not(.is-focus),
.detail-match.is-watch:not(.is-focus) {
  border-color: rgb(23 32 47 / 18%);
}

.compact-match strong {
  font-size: 13px;
  line-height: 1.35;
}

.compact-match em {
  color: var(--muted);
  font-family: var(--display);
  font-size: 10px;
  font-style: normal;
}

.compact-time,
.compact-match small {
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
}

.day-detail {
  display: grid;
  gap: 18px;
}

.day-detail-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 18px;
  border-bottom: 1px solid var(--line);
}

.day-detail-head span {
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
}

.day-detail-head h3 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: -0.05em;
}

.day-detail-head strong {
  font-family: var(--display);
  font-size: 18px;
}

.day-agenda,
.selected-day-list {
  display: grid;
  gap: 12px;
}

.detail-match {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 16px;
}

.match-time {
  display: grid;
  align-content: start;
  gap: 4px;
  font-family: var(--display);
}

.match-time strong {
  font-size: 18px;
}

.match-time span {
  color: var(--muted);
  font-size: 11px;
}

.match-body {
  min-width: 0;
}

.match-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.team-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.team-block:last-child {
  justify-content: flex-end;
  text-align: right;
}

.team-block span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-block img,
.team-initial {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  object-fit: contain;
}

.team-flag {
  flex: 0 0 auto;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 24px;
  line-height: 1;
}

.versus {
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.match-meta span,
.match-meta a {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 64%);
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
}

.match-meta .focus-badge {
  background: var(--ink);
  color: #fff;
}

.match-meta .watch-badge {
  background: rgb(23 32 47 / 10%);
  color: var(--ink);
}

.empty-day,
.empty-state,
.loading-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgb(255 255 255 / 62%);
  color: var(--muted);
}

.empty-day {
  padding: 10px;
  font-family: var(--display);
  font-size: 12px;
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.day-panel {
  padding: 18px;
}

.day-panel-header {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.day-panel-header p {
  margin: 0;
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day-panel-header h2 {
  margin: 6px 0 4px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.05em;
}

.day-panel-header span {
  color: var(--muted);
  font-size: 13px;
}

.day-panel .detail-match {
  grid-template-columns: 62px minmax(0, 1fr);
  box-shadow: none;
}

.day-panel .match-teams {
  grid-template-columns: 1fr;
  gap: 6px;
}

.day-panel .team-block:last-child {
  justify-content: flex-start;
  text-align: left;
}

.day-panel .versus {
  display: none;
}

.sources {
  margin-top: 18px;
  padding: 18px;
  box-shadow: none;
}

.sources h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 20px;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.source-list strong {
  font-family: var(--display);
}

.source-list span,
.source-list a {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
}

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .day-panel {
    position: static;
    grid-column: 2;
  }

}

@media (max-width: 920px) {
  .app-header {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .view-switch {
    width: 100%;
    overflow-x: auto;
  }

  .workspace {
    display: block;
    padding: 18px 14px 48px;
  }

  .filters {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
  }

  .filter-panel {
    margin: 0;
  }

  .filter-note {
    grid-column: 1 / -1;
  }

  .calendar-toolbar {
    display: grid;
  }

  .period-controls {
    flex-wrap: wrap;
  }

  .search-box {
    min-width: 0;
  }

  .quarter-canvas,
  .week-canvas {
    grid-template-columns: 1fr;
  }

  .week-day {
    min-height: auto;
  }

  .day-panel {
    margin-top: 16px;
  }
}

@media (max-width: 640px) {
  .filters {
    grid-template-columns: 1fr;
  }

  .calendar-canvas {
    padding: 12px;
  }

  .weekday-row {
    gap: 4px;
    font-size: 11px;
  }

  .month-grid {
    gap: 4px;
  }

  .day-cell {
    min-height: 76px;
    padding: 6px;
    border-radius: 11px;
  }

  .month-fixtures {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .fixture-pair {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 999px;
  }

  .fixture-pair.source-kpl {
    background: var(--kpl);
  }

  .fixture-pair.source-worldcup {
    background: var(--worldcup);
  }

  .fixture-pair > * {
    display: none;
  }

  .detail-match {
    grid-template-columns: 1fr;
  }

  .match-teams {
    grid-template-columns: 1fr;
  }

  .team-block:last-child {
    justify-content: flex-start;
    text-align: left;
  }

  .versus {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
