* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  line-height: 1.5;
  color: #111;
  background: #fff;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #111;
  padding-bottom: 0.75rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#calendarSelector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid #ccc;
}

#calendarSelector label {
  font-weight: 600;
  font-size: 0.875rem;
}
#calendarSelector select,
#calendarSelector input {
  padding: 0.375rem 0.5rem;
  border: 1px solid #999;
  font-size: 0.875rem;
}

#calendarSelector button,
#switchMonth button {
  padding: 0.375rem 1rem;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

#calendarSelector button:hover,
#switchMonth button:hover {
  background: #111;
  color: #fff;
}

#calendarSelector :focus,
#switchMonth button:focus {
  outline: 2px solid #111;
  outline-offset: 2px;
}

#calendarGrid {
  border: 1px solid #111;
}

#calendarTable {
  width: 100%;
  border-collapse: collapse;
}

#calendarTable caption {
  caption-side: top;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #111;
}

#calendarTable thead th {
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.5rem;
  border-bottom: 1px solid #111;
}

#calendarTable td {
  border: 1px solid #ccc;
  width: 14.28%;
  height: 90px;
  vertical-align: top;
  padding: 0.5rem;
  font-size: 0.875rem;
}

#calendarTable td.other-month {
  color: #635e5e;
}

.commemorative {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #555;
}

#calendarTable td.today {
  outline: 2px solid #111;
  outline-offset: -2px;
}

footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ccc;
  font-size: 0.875rem;
  color: #555;
}

footer a {
  color: #111;
}

@media (max-width: 640px) {
  body {
    padding: 1rem;
  }

  #calendarSelector {
    flex-direction: column;
    align-items: stretch;
  }

  #calendarSelector select,
  #calendarSelector input,
  #calendarSelector button,
  #switchMonth button {
    width: 100%;
  }

  #calendarGrid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #calendarTable thead th {
    font-size: 0.75rem;
    padding: 0.375rem 0.25rem;
  }
  #calendarTable thead th::before {
    content: attr(data-abbr);
  }
  #calendarTable thead th {
    font-size: 0;
  }
  #calendarTable thead th::before {
    font-size: 0.75rem;
    display: block;
  }

  #calendarTable td {
    height: 60px;
    font-size: 0.8125rem;
    padding: 0.375rem;
  }

  .commemorative {
    font-size: 0.625rem;
  }
}
