:root {
  --bg: #f3efe5;
  --bg-accent: radial-gradient(circle at top left, rgba(191, 146, 84, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(31, 75, 63, 0.12), transparent 28%),
    linear-gradient(180deg, #f8f4eb 0%, #f2eee4 100%);
  --panel: rgba(255, 252, 247, 0.88);
  --panel-strong: #fffdf8;
  --text: #1d1d1b;
  --muted: #6d6b66;
  --line: rgba(90, 79, 62, 0.14);
  --accent: #21493f;
  --accent-soft: #edf3ef;
  --accent-warm: #c28c44;
  --positive: #0f766e;
  --negative: #b91c1c;
  --shadow: 0 18px 44px rgba(43, 34, 21, 0.08);
  --shadow-soft: 0 8px 20px rgba(43, 34, 21, 0.05);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-accent);
  color: var(--text);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    "IBM Plex Sans",
    "Noto Sans SC",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  position: relative;
}

.shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 82%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 244, 235, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(90, 79, 62, 0.12);
}

.header-inner,
.main-content {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 16px;
}

.brand-mark {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.header-actions,
.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  padding: 9px 12px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.nav-link.is-active,
.nav-link:hover {
  color: var(--text);
  border-color: rgba(31, 75, 63, 0.16);
  background: rgba(255, 255, 255, 0.56);
}

.lang-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(90, 79, 62, 0.12);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-soft);
}

.lang-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.lang-button.is-active {
  background: var(--accent);
  color: #fff;
}

.main-content {
  padding: 34px 0 76px;
}

.summary-grid,
.detail-grid,
.player-layout {
  display: grid;
  gap: 18px;
}

.panel-toolbar,
.filter-row,
.list-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.summary-card,
.panel,
.chart-panel,
.stats-panel,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.summary-card {
  padding: 22px;
}

.summary-card-accent {
  background: linear-gradient(135deg, rgba(31, 75, 63, 0.94) 0%, rgba(46, 95, 81, 0.9) 100%);
  color: #fff;
}

.summary-card-accent .eyebrow,
.summary-card-accent .summary-meta {
  color: rgba(255, 255, 255, 0.78);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 700;
}

h2 {
  font-size: 1.15rem;
  font-weight: 650;
}

.summary-card h2 {
  font-size: 2rem;
}

.summary-meta,
.panel-intro,
.subhead p,
.list-foot,
.chart-empty {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel {
  padding: 26px;
}

.panel + .panel {
  margin-top: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-head.compact {
  align-items: center;
}

.search-field {
  min-width: 260px;
  display: grid;
  gap: 8px;
}

.field-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.search-field input,
.search-field select,
.admin-form input,
.admin-form select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.ranking-table-wrap,
.detail-table-wrap {
  overflow-x: auto;
}

.ranking-table,
.detail-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table th,
.ranking-table td,
.detail-table th,
.detail-table td {
  padding: 14px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.97rem;
}

.ranking-table th,
.detail-table th {
  color: var(--muted);
  font-weight: 600;
}

.ranking-table tbody tr:last-child td,
.detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(255, 255, 255, 0.64);
}

.event-list {
  display: grid;
  gap: 14px;
}

.event-card {
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.event-card:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.event-card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
}

.status-upcoming {
  background: #f8fafc;
}

.status-ongoing {
  background: var(--accent-soft);
  color: #23463d;
  border-color: #d6e5dc;
}

.status-completed {
  background: #f5f5f4;
}

.event-summary,
.match-event {
  margin: 0;
  color: var(--muted);
}

.event-meta-grid,
.event-meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 16px 0 0;
}

.event-meta-grid dt,
.event-meta-list dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.event-meta-grid dd,
.event-meta-list dd {
  margin: 6px 0 0;
  font-weight: 600;
}

.event-detail-grid {
  margin-top: 18px;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.roster-item strong {
  font-variant-numeric: tabular-nums;
}

.empty-block {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.ranking-cards {
  display: none;
  gap: 12px;
}

.player-card {
  background: rgba(255, 252, 247, 0.84);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.player-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.card-rank {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.player-name {
  font-size: 1.1rem;
  font-weight: 650;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 18px 0 0;
}

.stat-grid dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-grid dd {
  margin: 6px 0 0;
  font-weight: 600;
}

.player-layout {
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  margin-bottom: 18px;
}

.chart-panel,
.stats-panel,
.detail-panel {
  padding: 20px;
}

.subhead {
  margin-bottom: 14px;
}

.stats-panel {
  display: grid;
  gap: 14px;
}

.mini-stat {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.mini-stat:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-grid {
  stroke: #ecece8;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-dot {
  fill: var(--accent);
}

.chart-label,
.chart-axis {
  fill: var(--muted);
  font-size: 11px;
}

.match-list {
  display: grid;
}

.match-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 110px;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.match-row:first-child {
  border-top: 0;
}

.match-date,
.match-score {
  color: var(--muted);
}

.match-event {
  margin-top: 4px;
  font-size: 0.92rem;
}

.match-title {
  margin: 0 0 6px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.match-rating {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--negative);
}

.list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.button-outline,
.button-solid,
.button-text {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.button-solid {
  background: linear-gradient(135deg, var(--accent) 0%, #2e5f51 100%);
  color: #fff;
  border-color: var(--accent);
}

.button-text {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.button:hover {
  border-color: rgba(31, 75, 63, 0.26);
}

.button-solid:hover {
  background: linear-gradient(135deg, #18372f 0%, #21493f 100%);
  border-color: #18372f;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-form label {
  display: grid;
  gap: 8px;
}

.admin-form span {
  color: var(--muted);
  font-size: 0.9rem;
}

.full-row {
  grid-column: 1 / -1;
}

.form-actions {
  padding-top: 6px;
}

.banner {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.banner-notice {
  background: var(--accent-soft);
  color: #23463d;
}

.banner-error {
  background: #fff5f5;
  color: #991b1b;
  border-color: #fecaca;
}

.empty-cell {
  color: var(--muted);
}

.loading-panel {
  text-align: center;
  color: var(--muted);
}

code {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
  font-size: 0.92em;
}

@media (max-width: 900px) {
  .summary-grid,
  .detail-grid,
  .player-layout,
  .admin-form,
  .event-meta-grid,
  .event-meta-list,
  .roster-grid {
    grid-template-columns: 1fr;
  }

  .header-inner,
  .panel-head {
    align-items: start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .search-field {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .main-content {
    width: min(100vw - 24px, 1120px);
  }

  .site-nav {
    gap: 12px;
    flex-wrap: wrap;
  }

  .lang-switch {
    width: 100%;
  }

  .event-card-top {
    flex-direction: column;
  }

  .ranking-table-wrap {
    display: none;
  }

  .ranking-cards {
    display: grid;
  }

  .panel,
  .summary-card,
  .chart-panel,
  .stats-panel,
  .detail-panel {
    padding: 18px;
  }

  .match-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .match-rating {
    justify-items: start;
  }

  .list-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row,
  .panel-toolbar {
    width: 100%;
  }

  .filter-clear {
    width: 100%;
  }
}
