.etc-timetable {
  --etc-border: #111827;
  --etc-soft-border: #d1d5db;
  --etc-header: #d8d6d6;
  --etc-weekday-bg: #efeeee;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto 28px;
  font-family: inherit;
  container-type: inline-size;
}

.etc-timetable * {
  box-sizing: border-box;
}

.etc-calendar {
  width: 100%;
  border: 2px solid var(--etc-border);
  border-radius: 16px;
  margin: 0 0 clamp(18px, 3cqw, 34px);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(17, 24, 39, .14);
}

.etc-calendar-first {
  margin-bottom: clamp(14px, 2.2cqw, 24px);
}

.etc-calendar-following:last-child {
  margin-bottom: 0;
}

.etc-calendar-title {
  background: linear-gradient(180deg, #dedcdc 0%, #c9c6c6 100%);
  color: #111;
  text-align: center;
  font-size: clamp(20px, 3cqw, 34px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: .01em;
  padding: clamp(14px, 2.1cqw, 26px) 10px;
  border-bottom: 2px solid var(--etc-border);
}

.etc-weekday-row,
.etc-date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
}

.etc-weekday {
  min-width: 0;
  background: var(--etc-weekday-bg);
  padding: clamp(4px, 1cqw, 11px);
  border-right: 2px solid var(--etc-border);
  border-bottom: 2px solid var(--etc-border);
  text-align: center;
}

.etc-weekday:nth-child(7n) {
  border-right: none;
}

.etc-weekday span {
  display: block;
  background: rgba(255, 255, 255, .48);
  border: 1px solid var(--etc-soft-border);
  border-radius: 10px;
  color: #111;
  font-size: clamp(11px, 2.55cqw, 30px);
  font-weight: 800;
  line-height: 1.05;
  padding: clamp(6px, 1.15cqw, 12px) 2px;
  white-space: nowrap;
}

.etc-date-cell {
  min-width: 0;
  min-height: clamp(42px, 8.4cqw, 86px);
  border-right: 2px solid var(--etc-border);
  border-bottom: 2px solid var(--etc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(12px, 2.5cqw, 30px);
  font-weight: 650;
  line-height: 1;
  color: #111;
  background: #fff;
  transition: transform .15s ease, filter .15s ease;
}

.etc-date-cell:nth-child(7n) {
  border-right: none;
}

.etc-date-grid .etc-date-cell:nth-last-child(-n+7) {
  border-bottom: none;
}

.etc-date-cell:not(.etc-date-empty):hover {
  filter: brightness(.98);
}

.etc-date-number {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .12);
}

.etc-date-empty {
  background: #fbfbfb;
  background-image: linear-gradient(135deg, rgba(17, 24, 39, .035) 25%, transparent 25%, transparent 50%, rgba(17, 24, 39, .035) 50%, rgba(17, 24, 39, .035) 75%, transparent 75%, transparent);
  background-size: 12px 12px;
}

.etc-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 12px;
  margin: 0 0 clamp(20px, 3cqw, 34px);
}

.etc-legend-item {
  display: grid;
  grid-template-columns: clamp(42px, 7cqw, 72px) minmax(0, 1fr);
  align-items: stretch;
  min-height: clamp(52px, 7.4cqw, 78px);
  overflow: hidden;
  border: 1px solid var(--etc-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(17, 24, 39, .08);
  font-size: clamp(14px, 2cqw, 24px);
  line-height: 1.15;
}

.etc-legend-swatch {
  display: block;
  align-self: stretch;
  border-right: 1px solid var(--etc-border);
}

.etc-legend-item span:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  text-align: center;
  font-weight: 600;
}

.etc-following-months {
  width: 100%;
  max-height: min(78vh, 980px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(10px, 1.6cqw, 18px);
  border: 1px solid rgba(17, 24, 39, .18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 24, 39, .035), rgba(17, 24, 39, .012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 24, 39, .45) rgba(17, 24, 39, .08);
}

.etc-following-months::-webkit-scrollbar {
  width: 10px;
}

.etc-following-months::-webkit-scrollbar-track {
  background: rgba(17, 24, 39, .08);
  border-radius: 999px;
}

.etc-following-months::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, .42);
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .75);
}

.etc-following-months .etc-calendar {
  box-shadow: 0 8px 22px rgba(17, 24, 39, .1);
}

.etc-error {
  border: 1px solid #cc1818;
  background: #fff5f5;
  padding: 12px;
}

@media (max-width: 520px) {
  .etc-calendar {
    border-width: 1px;
    border-radius: 10px;
  }

  .etc-calendar-title,
  .etc-weekday,
  .etc-date-cell {
    border-width: 1px;
  }

  .etc-weekday span {
    border-radius: 7px;
  }

  .etc-date-cell {
    min-height: 38px;
  }

  .etc-legend {
    gap: 8px;
  }

  .etc-legend-item {
    border-radius: 10px;
  }

  .etc-following-months {
    max-height: 72vh;
    padding: 8px;
    border-radius: 12px;
  }
}

/* One-month-at-a-time slider */
.etc-timetable-slider {
  overflow: hidden;
}

.etc-slider-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2cqw, 18px);
  margin: 0 0 clamp(14px, 2.3cqw, 24px);
}

.etc-slider-button {
  width: clamp(38px, 6cqw, 56px);
  height: clamp(38px, 6cqw, 56px);
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  font-size: clamp(26px, 4.4cqw, 42px);
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(17, 24, 39, .12);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.etc-slider-button:hover:not(:disabled),
.etc-slider-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 24, 39, .16);
}

.etc-slider-button:disabled {
  cursor: not-allowed;
  opacity: .38;
  box-shadow: none;
}

.etc-slider-status {
  min-width: min(100%, 280px);
  padding: 9px 16px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f9fafb;
  color: #111827;
  text-align: center;
  font-size: clamp(14px, 2cqw, 20px);
  font-weight: 700;
  line-height: 1.2;
}

.etc-slider-viewport,
.etc-slider-track {
  width: 100%;
}

.etc-slider-viewport {
  overflow: hidden;
}

.etc-slide {
  display: none;
  width: 100%;
}

.etc-slide.is-active {
  display: block;
  animation: etcFadeIn .18s ease;
}

@keyframes etcFadeIn {
  from { opacity: .45; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.etc-slide .etc-calendar {
  margin-bottom: clamp(14px, 2.2cqw, 24px);
}

.etc-slide .etc-legend {
  margin-top: 0;
}

@media (max-width: 520px) {
  .etc-slider-nav {
    gap: 8px;
  }

  .etc-slider-status {
    min-width: 0;
    flex: 1;
    padding: 8px 10px;
  }
}
