.home-legacy-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.home-community-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
  border: 1px solid #c8d9ea;
  border-radius: 12px;
  background: #f8fbff;
  padding: 6px 8px;
}

.community-ticker-label a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #1f67cf;
  color: #fff;
  text-decoration: none;
  font-size: 0.8em;
  font-weight: 800;
}

.community-ticker-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.community-ticker-track {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  animation: communityTickerScroll 28s linear infinite;
}

.home-community-ticker:hover .community-ticker-track {
  animation-play-state: paused;
}

.community-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid #d4e2f0;
  border-radius: 8px;
  background: #fff;
  color: #2a3d4b;
  text-decoration: none;
  white-space: nowrap;
}

.community-ticker-item:active,
.community-ticker-item:hover {
  border-color: #a8bfd6;
  background: #f1f7ff;
}

.community-ticker-tag {
  color: #1f67cf;
  font-size: 0.76em;
  font-weight: 900;
}

.community-ticker-text {
  font-size: 0.8em;
  font-weight: 700;
}

@keyframes communityTickerScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .community-ticker-track {
    animation: none;
  }
}

.home-page #calendar-ad-container {
  display: flex !important;
  min-height: auto !important;
  margin: 10px auto !important;
}

.home-page #calendar-ad-container .ad-slider-container {
  width: 100%;
  max-width: 480px;
}

.home-page .month-title-bar,
.content-page .month-title-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.home-page .month-title-bar .month-title,
.content-page .month-title-bar .month-title {
  margin: 0;
  justify-self: center;
}

.home-page .month-title-bar #last-updated,
.content-page .month-title-bar #last-updated {
  justify-self: start;
  margin: 0;
  padding: 0;
  font-size: calc(0.62em + 2px);
  color: #4a6072;
  text-align: left;
  line-height: 1.08;
  white-space: nowrap;
}

.home-page .month-title-bar #last-updated .calendar-status-lines,
.content-page .month-title-bar #last-updated .calendar-status-lines {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: inherit;
  color: inherit;
}

.home-page .month-title-bar #last-updated .calendar-status-line,
.content-page .month-title-bar #last-updated .calendar-status-line {
  display: block;
  font-weight: 700;
}

.home-page .month-title-bar #last-updated .calendar-status-line.is-updated,
.content-page .month-title-bar #last-updated .calendar-status-line.is-updated {
  color: #d97706;
}

.home-page .month-title-bar #last-updated .calendar-status-sec,
.content-page .month-title-bar #last-updated .calendar-status-sec {
  font-size: 0.8em;
  font-weight: 600;
  opacity: 0.88;
}

.calendar-filter-btn {
  border: 2px solid #0d4ea6;
  background: linear-gradient(180deg, #2f83ff 0%, #1f67cf 100%);
  color: #ffffff;
  border-radius: 10px;
  font-size: 0.88em;
  font-weight: 800;
  padding: 7px 12px;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(24, 87, 181, 0.35);
  justify-self: end;
}

.calendar-filter-btn.partial {
  border-color: #ad6217;
  background: linear-gradient(180deg, #ffb35f 0%, #ef8f2c 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(173, 98, 23, 0.3);
}

.calendar-filter-btn.all {
  border-color: #2b8a43;
  background: linear-gradient(180deg, #46b565 0%, #2e934b 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(43, 138, 67, 0.3);
}

.calendar-filter-summary {
  margin: 0 0 8px;
  font-size: 0.8em;
  color: #5b6f7b;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-filter-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.calendar-filter-modal.hidden {
  display: none;
}

.calendar-filter-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.calendar-filter-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  background: #fff;
  border-radius: 16px 16px 0 0;
  border: 1px solid #d7dee5;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.calendar-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid #e9eef2;
}

.calendar-filter-head h3 {
  margin: 0;
  font-size: 1.05em;
  color: #2a3d4b;
}

.calendar-filter-close {
  border: 1px solid #cfd8df;
  background: #f5f8fb;
  color: #3f5563;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.8em;
  font-weight: 700;
  cursor: pointer;
}

.calendar-filter-body {
  max-height: 42vh;
  overflow-y: auto;
  padding: 12px 12px 6px;
}

.calendar-filter-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.calendar-filter-chip {
  border: 1px solid #cfd9e1;
  background: #f8fbfd;
  color: #355061;
  border-radius: 999px;
  padding: 7px 10px;
  text-align: center;
  font-size: 0.82em;
  font-weight: 700;
  cursor: pointer;
}

.calendar-filter-chip.active {
  border-color: #2f7d52;
  background: #e3f3ea;
  color: #215237;
}

.calendar-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid #e9eef2;
}

.calendar-filter-reset,
.calendar-filter-clear {
  border: 0;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.82em;
  font-weight: 700;
  cursor: pointer;
}

.calendar-filter-reset {
  background: #edf2f6;
  color: #3b5160;
}

.calendar-filter-clear {
  background: #ffe8e8;
  color: #7a3030;
}

.calendar-day.clickable {
  cursor: pointer;
}

#diary .room-indicator,
#diary .room-text {
  pointer-events: none;
}

#diary .room-text {
  cursor: default;
}

.day-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
}

.day-detail-modal.hidden {
  display: none;
}

.day-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.day-detail-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  max-height: 72vh;
  border-radius: 16px 16px 0 0;
  border: 1px solid #d7dee5;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.day-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #e9eef2;
}

.day-detail-head h3 {
  margin: 0;
  font-size: 1em;
  color: #2a3d4b;
}

.day-detail-close {
  border: 1px solid #cfd8df;
  background: #f5f8fb;
  color: #3f5563;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.8em;
  font-weight: 700;
  cursor: pointer;
}

.day-detail-body {
  overflow-y: auto;
  padding: 10px 12px 14px;
}

.day-detail-center + .day-detail-center {
  margin-top: 10px;
}

.day-detail-center h4 {
  margin: 0 0 6px;
  font-size: 0.9em;
  color: #2f4758;
}

.day-detail-center-card {
  display: block;
  border: 1px solid #c7d5df;
  border-radius: 10px;
  background: #fafdff;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
}

.day-detail-center-card:active,
.day-detail-center-card:hover {
  border-color: #99b2c2;
  background: #f1f8fc;
}

.day-detail-card-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.day-detail-center-name {
  color: #203847;
  font-size: 0.92em;
  font-weight: 800;
}

.day-detail-center-date {
  color: #1f5fbf;
  font-size: 0.84em;
  font-weight: 900;
}

.day-detail-room-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.day-detail-room-item {
  color: #2f4758;
  font-size: 0.82em;
  line-height: 1.45;
  margin: 2px 0;
}

.day-detail-room-item::before {
  content: '- ';
  color: #6c7d89;
  font-weight: 700;
}

.day-detail-room-name {
  color: #c61f1f;
  font-weight: 900;
  font-size: 0.96em;
}

.day-detail-capacity {
  color: #a80f0f;
  font-weight: 900;
  font-size: 1.02em;
}

.day-detail-empty {
  border: 1px dashed #d6dfe5;
  border-radius: 10px;
  background: #f8fbfd;
  color: #5f707d;
  font-size: 0.85em;
  padding: 12px;
}

@media (max-width: 480px) {
  .home-page #calendar-ad-container {
    padding: 0 !important;
  }

  .home-page #calendar-ad-container .ad-slider-container {
    margin: 5px auto;
  }

  .home-page .month-title-bar,
  .content-page .month-title-bar {
    gap: 4px;
  }

  .home-page .month-title-bar #last-updated,
  .content-page .month-title-bar #last-updated {
    font-size: calc(0.56em + 2px);
  }

  .calendar-filter-btn {
    font-size: 0.8em;
    padding: 6px 10px;
  }

  .calendar-filter-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (hover: hover) {
  #diary .room-text:hover {
    filter: none;
  }
}
