:root {
  --sm-background: #0c0e19;
  --sm-panel: #15213f;
  --sm-panel-dark: #11162d;
  --sm-border: #293451;
  --sm-text: #f5f7ff;
  --sm-muted: #8d98b3;
  --sm-orange: #ff9d00;
  --sm-red: #ff453d;
  --sm-blue: #3f8cff;
  --sm-green: #20df78;
  --sm-row: #111936;
  --sm-row-soft: #17203d;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--sm-background);
  color: var(--sm-text);
  font-family: Tahoma, "Noto Sans Thai", sans-serif;
}

button,
select {
  font: inherit;
}

.sm-app {
  width: min(1250px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

/* ปฏิทิน */

.sm-calendar-card {
  width: 100%;
  max-width: 575px;
  margin: 0 auto 40px;
  padding: 20px;
  background: #14111a;
  border: 1px solid rgba(255, 69, 61, 0.48);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.sm-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.sm-month-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sm-month-selector h2 {
  margin: 0;
  color: white;
  font-size: 22px;
}

.sm-month-selector select {
  height: 36px;
  padding: 0 12px;
  color: #ffd0cb;
  background: #0f1018;
  border: 1px solid rgba(255, 69, 61, 0.55);
  border-radius: 7px;
  outline: none;
  cursor: pointer;
}

.sm-arrow-button {
  width: 42px;
  height: 42px;
  padding: 0;
  color: #f1bdba;
  background: #0f1018;
  border: 1px solid rgba(255, 69, 61, 0.28);
  border-radius: 50%;
  font-size: 34px;
  line-height: 36px;
  cursor: pointer;
  transition: 0.2s ease;
}

.sm-arrow-button:hover {
  color: white;
  background: #1b121a;
  border-color: rgba(255, 69, 61, 0.58);
  transform: scale(1.05);
}

.sm-weekdays,
.sm-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.sm-weekdays {
  margin-bottom: 18px;
}

.sm-weekdays span {
  color: #c4b5bf;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.sm-weekdays .sm-sunday {
  color: var(--sm-red);
}

.sm-weekdays .sm-saturday {
  color: var(--sm-blue);
}

.sm-calendar-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 56px;
  padding: 0;
  color: white;
  background: #0e1019;
  border: 1px solid rgba(255, 69, 61, 0.12);
  border-radius: 9px;
  cursor: pointer;
  transition: 0.2s ease;
}

.sm-calendar-day:hover {
  border-color: rgba(255, 69, 61, 0.52);
  background: #17121a;
  transform: translateY(-2px);
}

.sm-calendar-day.sm-empty {
  visibility: hidden;
  pointer-events: none;
}

.sm-calendar-day.sm-has-event::after {
  content: "";
  position: absolute;
  bottom: 7px;
  width: 7px;
  height: 7px;
  background: var(--sm-green);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(32, 223, 120, 0.7);
}

.sm-calendar-day.sm-cancelled::after {
  background: var(--sm-red);
  box-shadow: 0 0 8px rgba(255, 69, 61, 0.7);
}

.sm-calendar-day.sm-today {
  border-color: #74b8ff;
  box-shadow: inset 0 0 0 1px rgba(116, 184, 255, 0.82);
}

.sm-calendar-day.sm-selected {
  color: white;
  background: #d53b30;
  border-color: #e65347;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(213, 59, 48, 0.35);
}

.sm-calendar-day.sm-selected.sm-today {
  border-color: #74b8ff;
  box-shadow:
    inset 0 0 0 1px rgba(116, 184, 255, 0.92),
    0 8px 18px rgba(213, 59, 48, 0.35);
}

.sm-calendar-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 24px;
  padding: 14px 12px;
  color: #d6cfd3;
  background: rgba(15, 16, 24, 0.72);
  border: 1px solid rgba(255, 69, 61, 0.18);
  border-radius: 8px;
  font-size: 12px;
}

.sm-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sm-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sm-dot-green {
  background: var(--sm-green);
  box-shadow: 0 0 7px rgba(32, 223, 120, 0.7);
}

.sm-dot-red {
  background: var(--sm-red);
  box-shadow: 0 0 7px rgba(255, 69, 61, 0.6);
}

.sm-selected-label {
  padding: 3px 8px;
  color: #ffd0cb;
  border: 1px solid rgba(255, 69, 61, 0.58);
  border-radius: 4px;
}

/* รายการศึก: ถ้าวันเดียวมีหลายศึกจะเรียงลงมา */

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

/* กรอบใหญ่หนึ่งกรอบต่อหนึ่งศึก */

.sm-event-card {
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid #303030;
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.sm-event-header {
  padding: 25px 24px 24px;
  background: #0a0a0a;
  text-align: center;
  border-bottom: 1px solid #303030;
}

.sm-event-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 8px;
}

.sm-event-header h1 {
  margin: 0;
  color: #f5f5f5;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.35;
}

.sm-fight-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  color: #f5f5f5;
  background: #222222;
  border: 1px solid #383838;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.sm-event-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  color: #d4d4d4;
  font-size: 15px;
}

/* คู่มวยทุกคู่อยู่ภายในกรอบใหญ่ของศึก */

.sm-fight-table-wrap {
  padding: 18px;
  background: #0a0a0a;
  overflow-x: auto;
}

.sm-fight-table {
  width: 100%;
  min-width: 760px;
  overflow: hidden;
  color: #f5f5f5;
  background: #0a0a0a;
  border: 1px solid #303030;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
}

.sm-fight-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.sm-fight-table thead {
  background: #181818;
}

.sm-fight-table th {
  padding: 14px 16px;
  color: #f5f5f5;
  border-bottom: 1px solid #303030;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}

.sm-fight-table th.sm-red-heading {
  color: #ff6666;
  text-align: right;
}

.sm-fight-table th.sm-blue-heading {
  color: #60a5fa;
  text-align: left;
}

.sm-fight-table th:nth-child(1),
.sm-fight-table th:nth-child(2),
.sm-fight-table th:nth-child(4) {
  text-align: center;
}

.sm-fight-table td {
  padding: 16px;
  border-bottom: 1px solid #303030;
  line-height: 1.45;
  vertical-align: middle;
}

.sm-fight-table tbody tr {
  background: #101010;
  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

.sm-fight-table tbody tr:nth-child(even) {
  background: #181818;
}

.sm-fight-table tbody tr:hover {
  background: #242424;
}

.sm-fight-table tbody tr:last-child td {
  border-bottom: 0;
}

.sm-fight-label,
.sm-fight-weight,
.sm-vs-cell {
  text-align: center;
  white-space: nowrap;
}

.sm-fight-label span,
.sm-fight-weight span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.sm-fight-label span {
  color: #f5f5f5;
  background: #222222;
  border: 1px solid #383838;
}

.sm-fight-weight span {
  color: #f5f5f5;
  background: #222222;
  border: 1px solid #383838;
}

.sm-fighter-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: clamp(15px, 1.6vw, 18px);
  font-weight: 700;
}

.sm-fighter-red {
  justify-content: flex-end;
  color: #ff6666;
  text-align: right;
}

.sm-fighter-blue {
  justify-content: flex-start;
  color: #60a5fa;
  text-align: left;
}

.sm-corner-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.sm-fighter-red .sm-corner-dot {
  background: var(--sm-red);
  box-shadow: 0 0 10px rgba(255, 69, 61, 0.55);
}

.sm-fighter-blue .sm-corner-dot {
  background: var(--sm-blue);
  box-shadow: 0 0 10px rgba(63, 140, 255, 0.55);
}

.sm-vs-cell {
  width: 82px;
}

.sm-vs-cell span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: #f5f5f5;
  background: #222222;
  border: 1px solid #383838;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.sm-status-message {
  padding: 55px 20px;
  text-align: center;
}

.sm-status-message h2 {
  margin: 0 0 10px;
  color: #f5f5f5;
}

.sm-status-message p {
  margin: 0;
  color: #d4d4d4;
}

@media (max-width: 768px) {
  .sm-app {
    width: calc(100% - 20px);
    padding-top: 16px;
  }

  .sm-calendar-card {
    padding: 16px 12px;
  }

  .sm-calendar-day {
    height: 48px;
  }

  .sm-event-header {
    padding: 22px 16px 20px;
  }

  .sm-fight-table-wrap {
    padding: 12px;
    overflow: visible;
  }

  .sm-fight-table {
    min-width: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .sm-fight-table thead {
    display: none;
  }

  .sm-fight-table,
  .sm-fight-table tbody,
  .sm-fight-table tr,
  .sm-fight-table td {
    display: block;
    width: 100%;
  }

  .sm-fight-table tbody {
    display: grid;
    gap: 12px;
  }

  .sm-fight-table tbody tr,
  .sm-fight-table tbody tr:nth-child(even) {
    padding: 12px 14px;
    background: #101010;
    border: 1px solid #303030;
    border-radius: 8px;
  }

  .sm-fight-table tbody tr:nth-child(even) {
    background: #181818;
  }

  .sm-fight-table tbody tr:hover {
    background: #242424;
  }

  .sm-fight-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 0;
    text-align: left;
    white-space: normal;
  }

  .sm-fight-table td::before {
    content: attr(data-label);
    color: #f5f5f5;
    font-size: 12px;
    font-weight: 700;
  }

  .sm-vs-cell {
    display: none;
  }

  .sm-fight-label span,
  .sm-fight-weight span {
    width: fit-content;
  }

  .sm-fighter-name,
  .sm-fighter-red,
  .sm-fighter-blue {
    justify-content: flex-start;
    text-align: left;
  }

  .sm-fighter-red .sm-corner-dot {
    order: -1;
  }
}

@media (max-width: 520px) {
  .sm-calendar-day {
    height: 43px;
    font-size: 12px;
  }

  .sm-month-selector h2 {
    font-size: 18px;
  }

  .sm-event-meta {
    flex-direction: column;
    gap: 7px;
  }

  .sm-fight-table td {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .sm-fighter-name {
    font-size: 15px;
  }
}
