:root {
  --bg: #f6f1e6;
  --ink: #1f1b16;
  --muted: #6f6256;
  --accent: #d47532;
  --panel: #fffaf2;
  --border: #d7c8b8;
  --grid: #b7a594;
  --chip: #f1e1cf;
  --chip-active: #1f1b16;
  --chip-active-text: #fffaf2;
  --shadow: 0 8px 24px rgba(31, 27, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #f1e5d4 0%, transparent 60%),
              radial-gradient(1200px 600px at 90% -20%, #edd4c1 0%, transparent 55%),
              var(--bg);
  color: var(--ink);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  background: rgba(246, 241, 230, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.logo {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.3px;
}

nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-weight: 600;
  color: var(--muted);
}

nav a {
  text-decoration: none;
  color: inherit;
  padding: 6px 10px;
  border-radius: 8px;
}

nav a.active {
  color: var(--ink);
  background: var(--chip);
}

main {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
}

.submenu {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #efe4d4;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 14px;
  align-items: center;
  justify-content: center;
}

.submenu-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.submenu-item.active {
  background: var(--chip);
  color: var(--ink);
  border-color: var(--border);
}

.submenu-item:focus-visible {
  outline: none;
  border-color: var(--ink);
}

.filters {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.filters-label {
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  font: inherit;
  width: 62px;
  text-align: center;
}

.chip.active {
  background: var(--chip-active);
  color: var(--chip-active-text);
  border-color: var(--chip-active);
}

.section-title {
  margin: 24px 0 12px;
  font-family: "Fraunces", serif;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.loading-note {
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.results {
  display: grid;
  gap: 18px;
}

.results-status {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f2e7d7;
  color: var(--ink);
  font-weight: 600;
}

.results-status.error {
  background: #fde4dd;
  border-color: #db9f90;
  color: #6d1f0f;
}

.hidden {
  display: none;
}

.result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.date {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.date-title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 16px;
  letter-spacing: 0.3px;
}

.result-title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 16px;
  letter-spacing: 0.3px;
}

.match-row {
  font-size: 13px;
}

.match-title {
  font-weight: 600;
}

.match-field {
  display: grid;
  grid-template-columns: 30px 1fr 30px;/*28px 1fr 28px;*/
  align-items: center;
  gap: 8px;
  /*background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;*/
}

.match-field .date-value,
.match-field .time-value,
.match-field .court-value {
  text-align: center;
  font-weight: 700;
}

.schedule-grid {
  display: grid;
  gap: 12px;
}

.schedule-field,
.score-field {
  display: grid;
  gap: 6px;
}

.schedule-label,
.score-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.match-table .match-title {
  text-align: left;
}

.ctrl-btn {
  border: 1px solid var(--border);
  background: #fffaf2;
  border-radius: 8px;
  height: 28px;
  cursor: pointer;
  font-weight: 700;
}

.ctrl-btn:hover,
.ctrl-btn:focus-visible {
  background: var(--chip);
  outline: none;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.matrix th,
.matrix td {
  border: 1px solid var(--grid);
  padding: 8px;
  text-align: center;
  vertical-align: middle;
}

.matrix thead th {
  background: #f2e7d7;
  font-weight: 600;
}

.matrix tbody th {
  text-align: left;
  background: #f6ebdb;
  font-weight: 600;
}

.matrix td.diag {
  background: #d9c8b6;
  color: #6d5d4f;
  font-weight: 600;
}

.matrix td:not(.diag),
.match-row {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

footer {
  border-top: 1px solid var(--border);
  padding: 18px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.context-menu {
  position: fixed;
  min-width: 180px;
  background: #fffaf2;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 100;
}

.context-menu.visible {
  display: grid;
  gap: 4px;
}

.context-menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.context-menu button:hover,
.context-menu button:focus-visible {
  background: var(--chip);
  outline: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal.visible {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 27, 22, 0.35);
}

.modal-card {
  position: relative;
  width: min(720px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(31, 27, 22, 0.18);
  padding: 18px;
  display: grid;
  gap: 14px;
  z-index: 1;
}

.modal-title {
  margin: 0 34px 0 0;
  font-family: "Fraunces", serif;
  font-size: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: var(--chip);
  outline: none;
}

.modal-body {
  overflow-x: auto;
}

.score-grid {
  display: grid;
  gap: 12px;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.score-table th,
.score-table td {
  border: 1px solid var(--grid);
  padding: 8px;
  text-align: center;
}

.score-table thead th {
  background: #f2e7d7;
  font-weight: 600;
}

.score-table tbody th {
  text-align: left;
  background: #f6ebdb;
  font-weight: 600;
}

.score-cell {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 8px;
}

.score-btn {
  border: 1px solid var(--border);
  background: #fffaf2;
  border-radius: 8px;
  height: 28px;
  cursor: pointer;
  font-weight: 700;
}

.score-btn:hover,
.score-btn:focus-visible {
  background: var(--chip);
  outline: none;
}

.score-val {
  text-align: center;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  background: #fffaf2;
}

.btn.secondary:hover,
.btn.secondary:focus-visible {
  background: var(--chip);
  outline: none;
}

.btn.primary {
  background: var(--ink);
  color: #fffaf2;
  border-color: var(--ink);
}

.btn.primary:hover,
.btn.primary:focus-visible {
  background: #2a241e;
  outline: none;
}

@media (min-width: 900px) {
  .results {
    grid-template-columns: 1fr 1fr;
  }
}

.home-main {
  padding: 0;
  max-width: 1100px;
}

.home-hero {
  position: relative;
  min-height: 260px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.75), rgba(210, 210, 210, 0.45)),
    radial-gradient(circle at 20% 120%, #d2d2d2 0 28%, transparent 28%),
    radial-gradient(circle at 90% -10%, #d4d4d4 0 22%, transparent 22%),
    repeating-linear-gradient(165deg, transparent 0 42px, rgba(255, 255, 255, 0.5) 42px 47px, transparent 47px 98px),
    #dcdcdc;
  display: grid;
  place-items: center;
  text-align: center;
}

.home-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1));
}

.home-hero-content {
  position: relative;
  z-index: 1;
  padding: 28px 18px;
  max-width: 700px;
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.15;
  color: #40464f;
  font-weight: 700;
}

.home-hero h1 span {
  display: block;
  font-weight: 500;
}

.home-section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 24px 16px 18px;
  background: rgba(255, 255, 255, 0.16);
}

.home-section-title {
  margin: 0 0 14px;
  text-align: center;
  font-size: clamp(24px, 3vw, 32px);
  font-family: "Fraunces", serif;
  color: #424953;
  padding-bottom: 10px;
  border-bottom: 1px solid #d4d4d4;
}

.home-carousel-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.home-carousel {
  width: 100%;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 6px 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.home-carousel::-webkit-scrollbar {
  display: none;
}

.home-card {
  flex: 0 0 min(78vw, 280px);
  background: #f7f3eb;
  border: 1px solid #c6c6c6;
  border-radius: 4px;
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: 0 2px 8px rgba(20, 20, 20, 0.08);
  display: flex;
  flex-direction: column;
}

.home-card-poster {
  aspect-ratio: 973 / 1225;
  border-bottom: 1px solid #bdbdbd;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #d8d8d8;
  filter: grayscale(100%);
}

.poster-a {
  background-image:
    linear-gradient(160deg, rgba(230, 230, 230, 0.3), rgba(130, 130, 130, 0.25)),
    url("images/sinu_tenis_febrero.jpg");
}

.poster-b {
  background-image:
    linear-gradient(135deg, rgba(220, 220, 220, 0.3), rgba(120, 120, 120, 0.25)),
    url("images/departamental_infantil_sinu_tenis_marzo.jpeg");
}

.poster-c {
  background-image:
    linear-gradient(145deg, rgba(230, 230, 230, 0.3), rgba(122, 122, 122, 0.25)),
    url("images/sinu_tenis_febrero.jpg");
}

.poster-d {
  background-image:
    linear-gradient(120deg, rgba(210, 210, 210, 0.3), rgba(100, 100, 100, 0.25)),
    url("images/departamental_infantil_sinu_tenis_marzo.jpeg");
}

.home-card-body {
  padding: 12px;
  min-height: 172px;
  display: flex;
  flex-direction: column;
}

.home-card-body h3 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.15;
  min-height: 2.3em;
}

.home-card-body p {
  margin: 0 0 4px;
  color: #4f4f4f;
  font-size: 19px;
}

.home-card-body button {
  width: 100%;
  margin-top: auto;
  border: 1px solid #81868f;
  border-radius: 8px;
  background: linear-gradient(180deg, #8e9299, #6e727a);
  color: #fff;
  font-weight: 600;
  font-size: 17px;
  padding: 10px 12px;
  cursor: pointer;
}

.home-card-body button:disabled {
  background: linear-gradient(180deg, #b8bcc3, #9fa4ac);
  border-color: #9fa4ac;
  color: #eef1f4;
  cursor: not-allowed;
}

.home-carousel-btn {
  position: absolute;
  z-index: 1;
  width: 38px;
  height: 56px;
  border: 1px solid #c9c9c9;
  border-radius: 4px;
  background: rgba(235, 235, 235, 0.92);
  color: #6f747d;
  font-size: 24px;
  cursor: pointer;
}

.home-carousel-btn.prev {
  left: -14px;
}

.home-carousel-btn.next {
  right: -14px;
}

.home-carousel-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.home-dots {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 9px;
}

.home-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 0;
  background: #c9c9c9;
  padding: 0;
  cursor: pointer;
}

.home-dot.active {
  background: #6f747d;
}

.home-cta {
  text-align: center;
  padding: 28px 20px;
}

.home-cta h2 {
  margin: 0 0 10px;
  font-size: clamp(30px, 3.6vw, 42px);
  color: #434a53;
}

.home-cta p {
  margin: 0 0 16px;
  font-size: clamp(22px, 2.6vw, 34px);
  color: #4d545d;
}

.home-cta button {
  min-width: min(360px, 90%);
  border: 1px solid #81868f;
  border-radius: 8px;
  background: linear-gradient(180deg, #8e9299, #6e727a);
  color: #fff;
  font-weight: 600;
  font-size: 19px;
  padding: 12px 14px;
  cursor: pointer;
}

.home-modal-card {
  width: min(680px, 92vw);
}

.home-modal-text {
  margin: 0 0 12px;
  color: #4d545d;
  line-height: 1.45;
  font-size: 14px;
}

.home-modal-form {
  display: grid;
  gap: 10px;
}

.home-modal-form input,
.home-modal-form textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fffaf2;
  color: var(--ink);
}

.home-modal-form input:focus-visible,
.home-modal-form textarea:focus-visible {
  outline: 2px solid #8e9299;
  outline-offset: 1px;
}

@media (max-width: 899px) {
  .home-carousel-btn {
    display: none;
  }
}

@media (min-width: 900px) {
  .home-main {
    padding: 0 0 12px;
  }

  .home-section,
  .home-cta {
    padding-left: 28px;
    padding-right: 28px;
  }

  .home-card {
    flex-basis: calc((100% - 28px) / 3);
  }
}
