@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --ch-ink: #14201a;
  --ch-muted: #5c6b63;
  --ch-accent: #1f6b45;
  --ch-accent-soft: #e8f3ec;
  --ch-surface: #eef2ef;
  --ch-card: #ffffff;
  --ch-line: #c5d0c9;
  --ch-live: #c45c26;
  --ch-warn: #b58900;
  --ch-danger: #a33b3b;
  --ch-radius: 14px;
  --ch-shadow: 0 1px 2px rgba(20, 32, 26, 0.08), 0 10px 28px rgba(20, 32, 26, 0.1);
  --ch-font: 'DM Sans', system-ui, sans-serif;
  --ch-display: 'Instrument Serif', Georgia, serif;
}

.ch-page {
  font-family: var(--ch-font);
  color: var(--ch-ink);
  background: var(--ch-surface);
  border-radius: 16px;
  padding: 0 0 28px;
  margin-bottom: 20px;
}

.ch-page > .ch-hero {
  border-radius: 16px 16px 0 0;
}

.ch-page .ch-filters,
.ch-page .ch-grid,
.ch-page .ch-empty,
.ch-page .ch-tabs,
.ch-page .ch-section-title,
.ch-page .ch-section-sub,
.ch-page .ch-form-panel {
  margin-left: 16px;
  margin-right: 16px;
}

.ch-page .ch-grid {
  margin-top: 4px;
}

.ch-page .ch-filters {
  padding-top: 8px;
}

.ch-hero {
  position: relative;
  margin: 0 0 28px;
  padding: 48px 24px 40px;
  background:
    radial-gradient(1200px 400px at 10% -20%, rgba(31, 107, 69, 0.18), transparent 60%),
    linear-gradient(160deg, #0f1f17 0%, #1a3327 55%, #243d31 100%);
  color: #f4f7f5;
  overflow: hidden;
}

.ch-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -12deg,
    transparent,
    transparent 11px,
    rgba(255, 255, 255, 0.015) 11px,
    rgba(255, 255, 255, 0.015) 12px
  );
  pointer-events: none;
}

.ch-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
}

.ch-hero h1 {
  font-family: var(--ch-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.ch-hero p {
  margin: 0 0 22px;
  max-width: 36em;
  color: rgba(244, 247, 245, 0.78);
  font-size: 1.05rem;
  line-height: 1.5;
}

.ch-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none !important;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ch-btn:hover {
  transform: translateY(-1px);
}

.ch-btn-primary {
  background: #f4f7f5;
  color: var(--ch-ink) !important;
}

.ch-btn-ghost {
  background: transparent;
  border-color: rgba(244, 247, 245, 0.35);
  color: #f4f7f5 !important;
}

.ch-btn-accent {
  background: var(--ch-accent);
  color: #fff !important;
}

.ch-btn-soft {
  background: var(--ch-accent-soft);
  color: var(--ch-accent) !important;
}

.ch-btn-danger {
  background: #f8eaea;
  color: var(--ch-danger) !important;
}

.ch-section-title {
  font-family: var(--ch-display);
  font-size: 1.75rem;
  margin: 0 0 6px;
}

.ch-section-sub {
  color: var(--ch-muted);
  margin: 0 0 20px;
}

.ch-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ch-line);
}

.ch-tab {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ch-muted) !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.9rem;
}

.ch-tab:hover {
  background: var(--ch-surface);
  color: var(--ch-ink) !important;
}

.ch-tab.is-active {
  background: var(--ch-accent-soft);
  color: var(--ch-accent) !important;
}

.ch-tab .ch-count {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ch-accent);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.5;
}

.ch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.ch-card-wrap {
  display: flex;
  flex-direction: column;
  background: var(--ch-card);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
  box-shadow: var(--ch-shadow);
  overflow: hidden;
  min-height: 100%;
}

.ch-card {
  display: block;
  flex: 1;
  background: transparent;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none;
  text-decoration: none !important;
  color: var(--ch-ink) !important;
  overflow: hidden;
  transition: background 0.15s ease;
}

a.ch-card:hover,
a.ch-card:focus {
  background: #fbfcfb;
  color: var(--ch-ink) !important;
  text-decoration: none !important;
  transform: none;
}

.ch-card-wrap:hover {
  border-color: #9eb5a8;
  box-shadow: 0 2px 4px rgba(20, 32, 26, 0.1), 0 14px 32px rgba(20, 32, 26, 0.12);
}

.ch-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}

.ch-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ch-surface);
  color: var(--ch-muted);
  border: 1px solid transparent;
}

.ch-chip-live { background: #fdeee6; color: var(--ch-live); border-color: #f3d2c0; }
.ch-chip-pending { background: #fff6db; color: var(--ch-warn); border-color: #edd98a; }
.ch-chip-scheduled { background: var(--ch-accent-soft); color: var(--ch-accent); border-color: #b7d7c4; }
.ch-chip-finished { background: #eef0ef; color: var(--ch-muted); border-color: #d5dbd7; }
.ch-chip-open { background: #e7f0ff; color: #2a5ea8; border-color: #c3d6f5; }

.ch-match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 20px 16px;
}

.ch-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.ch-player-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.ch-player-avatar img,
.ch-player-avatar .img-rounded,
.ch-player img,
.ch-player .img-rounded {
  width: 64px !important;
  height: 64px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ch-line);
  display: block;
}

.ch-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ch-surface);
  border: 1px dashed var(--ch-line);
  color: var(--ch-muted);
  font-weight: 700;
  font-size: 1.25rem;
}

.ch-avatar-placeholder--wait {
  background: #e7f0ff;
  border-style: solid;
  border-color: #c3d6f5;
  color: #2a5ea8;
}

.ch-player-name {
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--ch-ink);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

.ch-card-date {
  color: var(--ch-muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.ch-score {
  font-family: var(--ch-display);
  font-size: 2.15rem;
  line-height: 1;
  color: var(--ch-ink);
}

.ch-vs {
  color: var(--ch-muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  height: 64px;
  padding-top: 0;
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ch-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 16px 16px;
  color: var(--ch-muted);
  font-size: 0.95rem;
  border-top: 1px solid var(--ch-line);
  background: #fafbfa;
}

.ch-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
  border-top: 1px solid var(--ch-line);
  padding-top: 12px;
  background: #fafbfa;
}

.ch-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--ch-muted);
  background: var(--ch-surface);
  border-radius: var(--ch-radius);
  border: 1px dashed var(--ch-line);
}

.ch-empty h3 {
  font-family: var(--ch-display);
  color: var(--ch-ink);
  margin: 0 0 8px;
}

.ch-page--detail {
  display: flex;
  justify-content: center;
  background: var(--ch-surface);
  border-radius: 16px;
  padding: 24px 16px 40px;
  margin-bottom: 20px;
}

.ch-detail {
  width: 100%;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  font-size: 1.05rem;
  text-align: center;
  box-sizing: border-box;
}

.ch-detail > p,
.ch-detail-back {
  text-align: center;
}

.ch-detail .ch-section-title {
  text-align: center;
  font-size: 2rem;
  margin-top: 8px;
}

.ch-detail-board {
  background: var(--ch-card);
  border: 1px solid var(--ch-line);
  border-radius: calc(var(--ch-radius) + 4px);
  box-shadow: var(--ch-shadow);
  padding: 32px 28px 26px;
  margin: 0 auto 24px;
  text-align: center;
}

.ch-detail-board .ch-card-top {
  justify-content: center;
  gap: 14px;
  padding: 0 0 12px;
}

.ch-detail-board .ch-chip {
  font-size: 0.85rem;
}

.ch-detail-board .ch-match {
  padding: 12px 0 24px;
  max-width: 560px;
  margin: 0 auto;
}

.ch-detail-board .ch-player-name {
  font-size: 1.2rem;
}

.ch-detail-board .ch-score {
  font-size: 3rem;
}

.ch-detail-board .ch-vs {
  font-size: 1rem;
  height: 80px;
}

.ch-detail-board .ch-player-avatar,
.ch-detail-board .ch-avatar-placeholder {
  width: 80px;
  height: 80px;
}

.ch-detail-board .ch-player img,
.ch-detail-board .ch-player .img-rounded,
.ch-detail-board .ch-player-avatar img,
.ch-detail-board .ch-player-avatar .img-rounded {
  width: 80px !important;
  height: 80px !important;
}

.ch-detail-board .ch-card-meta {
  justify-content: center;
  font-size: 1rem;
  background: transparent;
  border-top: 0;
  padding: 0 0 8px;
}

.ch-detail-board .ch-card-actions {
  justify-content: center;
  border-top: 0;
  background: transparent;
  padding: 16px 0 0;
}

.ch-detail .ch-form-panel {
  margin-left: auto;
  margin-right: auto;
  text-align: left;
  max-width: 880px;
}

.ch-detail .ch-series-table {
  font-size: 1rem;
}

.ch-detail .ch-series-table th,
.ch-detail .ch-series-table td {
  font-size: 1rem;
  padding: 14px 12px;
}

.ch-detail .ch-timeline {
  text-align: left;
}

.ch-detail .ch-timeline li {
  font-size: 1rem;
}

.ch-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ch-timeline li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  color: var(--ch-muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--ch-line);
}

.ch-timeline li:last-child {
  border-bottom: 0;
}

.ch-series-table {
  width: 100%;
  border-collapse: collapse;
}

.ch-series-table th,
.ch-series-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--ch-line);
  text-align: left;
  font-size: 0.9rem;
}

.ch-series-table th {
  color: var(--ch-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ch-form-panel {
  background: var(--ch-card);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
  box-shadow: var(--ch-shadow);
  padding: 24px;
  max-width: 640px;
}

.ch-form-panel .form-group {
  margin-bottom: 16px;
}

.ch-form-panel label {
  font-weight: 600;
  color: var(--ch-ink);
}

.ch-form-hint {
  color: var(--ch-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.ch-create-modal__body {
  max-height: min(70vh, 720px);
  overflow-y: auto;
}

.ch-create-modal__intro {
  margin: 0 0 16px;
}

.ch-create-form.ch-form-panel {
  max-width: none;
  box-shadow: none;
  border: 0;
  padding: 0;
  background: transparent;
}

.ch-opponent-locked {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius-sm, 8px);
  background: var(--ch-card, #fff);
}

.ch-opponent-locked__name {
  font-weight: 600;
}

.ch-invite-message {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--ch-line);
}

.ch-invite-message__label {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ch-muted);
}

.ch-invite-message__body {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--ch-accent);
  background: var(--ch-accent-soft, rgba(27, 94, 59, 0.08));
  border-radius: 0 var(--ch-radius-sm, 8px) var(--ch-radius-sm, 8px) 0;
  font-size: 0.95rem;
  color: var(--ch-ink);
}

.ch-card-meta .ch-invite-snippet {
  display: block;
  font-style: italic;
  color: var(--ch-muted);
}

.ch-menu-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ch-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.ch-serie-row {
  margin-bottom: 14px;
}

.ch-serie-row .panel-heading {
  background: #f7faf8;
}

@media (max-width: 767px) {
  .ch-hero {
    margin: 0 0 20px;
    padding: 36px 16px 28px;
  }
  .ch-page .ch-filters,
  .ch-page .ch-grid,
  .ch-page .ch-empty,
  .ch-page .ch-tabs,
  .ch-page .ch-section-title,
  .ch-page .ch-section-sub,
  .ch-page .ch-form-panel {
    margin-left: 12px;
    margin-right: 12px;
  }
  .ch-match {
    gap: 6px;
  }
  .ch-score {
    font-size: 1.45rem;
  }
}
