@font-face {
  font-family: "Noto Sans JP";
  src: url("./assets/noto-sans-jp-variable.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  scrollbar-gutter: stable;
  --ink: #162844;
  --muted: #4d627c;
  --accent: #2558c3;
  --accent-deep: #1b449e;
  --line: #d1deee;
  --paper: #fff;
  --ground: #edf5ff;
  --tint: #f3f7fe;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a, button, input, [tabindex]:focus { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
.shell { width: min(100% - 64px, 1060px); margin-inline: auto; }

.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; flex: none; align-items: center; gap: 9px; color: inherit; font-weight: 800; font-size: 1.125rem; letter-spacing: .025em; text-decoration: none; }
.masthead-link { color: var(--accent-deep); font-size: .875rem; font-weight: 750; text-align: end; text-underline-offset: .2em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: white; background: var(--accent); }
.brand-mark i { position: relative; width: 22px; height: 14px; border: 1px solid currentColor; border-radius: 3px; }
.brand-mark i::before, .brand-mark i::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.brand-mark i::before { height: 100%; border-left: 1px solid currentColor; }
.brand-mark i::after { width: 6px; height: 6px; border-radius: 50%; border: 1px solid currentColor; }

.main { padding-block: 34px 24px; }
.intro { margin-bottom: 24px; }
h1 { font-size: clamp(1.8rem, 4.2vw, 2.65rem); line-height: 1.25; letter-spacing: -.035em; font-weight: 800; }
.intro p { margin-top: 6px; color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(280px, 328px) minmax(0, 1fr); align-items: start; gap: 30px; }

.entry { padding-top: clamp(34px, 9vh, 88px); }
.entry-panel { max-width: 600px; margin-inline: auto; padding: clamp(20px, 5vw, 42px); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.entry-actions { display: grid; gap: 10px; }
.entry-actions .action { min-height: 56px; font-size: 1rem; }
.usage-link { display: inline-flex; align-items: center; margin-top: 8px; }
.usage-guide { display: grid; gap: 14px; }
.usage-guide h3 { margin-bottom: 4px; font-size: 1rem; }
.usage-guide .desk-notice { margin-top: 0; }

.reservation-page { max-width: 760px; }
.booking-groups { display: grid; gap: 14px; }
.booking-group { min-width: 0; padding: clamp(16px, 3.5vw, 24px); border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.booking-group-name { font-size: 1.25rem; line-height: 1.4; }
.booking-group-summary { margin-top: 5px; color: var(--muted); }
.booking-system-link { margin-top: 12px; }
.booking-facilities { list-style: none; margin: 16px 0 0; padding: 0; }
.booking-facility { padding-block: 12px; border-top: 1px solid var(--line); }
.booking-facility:last-child { padding-bottom: 0; }
.booking-facility-name { font-size: 1rem; line-height: 1.45; }
.booking-facility-details summary { align-content: center; min-height: 44px; color: var(--accent-deep); font-size: .875rem; font-weight: 750; cursor: pointer; }
.booking-facility-details + .booking-facility-details { border-top: 1px solid var(--line); }
.booking-facility-details[open] { padding-bottom: 8px; }
.booking-facility-details a { color: var(--accent-deep); text-underline-offset: .15em; }

.date-panel { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.date-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.date-panel h2 { font-size: .875rem; color: var(--muted); font-weight: 700; }
#date-summary { margin-top: 3px; font-size: 1.1875rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.calendar { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.calendar-toggle { display: none; flex: none; white-space: nowrap; }
.calendar-navigation { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.calendar-navigation h3 { font-size: .9375rem; font-weight: 750; text-align: center; }
.quiet-button, .text-button {
  min-height: 44px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  font-size: .875rem;
  font-weight: 700;
  color: var(--accent-deep);
}
.quiet-button:hover:not(:disabled), .text-button:hover { background: var(--tint); }
.quiet-button:disabled { color: #687a90; background: #f2f6fc; border-color: var(--line); }
.calendar-navigation .quiet-button { padding-inline: 8px; }
.calendar-table { width: 100%; margin-block: 9px 4px; border-collapse: separate; border-spacing: 1px 2px; table-layout: fixed; text-align: center; }
.calendar-table th { height: 28px; font-size: .8125rem; color: var(--muted); }
.calendar-table th:nth-child(6) { color: var(--accent-deep); }
.calendar-table th:nth-child(7) { color: #9b4d34; }
.calendar-table td { padding: 0; }
.day {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  font-size: .9rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.day:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--tint); }
.day[aria-current="date"] { border-color: #91add4; }
.day[aria-pressed="true"] { background: var(--accent); color: white; }
.day:disabled { color: #687a90; opacity: .65; }
.text-button { display: block; margin: 3px auto 0; border-color: transparent; text-decoration: underline; text-underline-offset: .2em; }

.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.results h2 { font-size: 1.25rem; font-weight: 750; }
#result-count { margin-top: 1px; font-size: .875rem; color: var(--muted); }
.result-filters { display: flex; flex-wrap: wrap; gap: 8px; }
#city-filter {
  appearance: none;
  min-height: 44px;
  padding: 4px 31px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper) linear-gradient(45deg, transparent 50%, var(--accent) 50%) calc(100% - 14px) center / 5px 5px no-repeat;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  font: inherit;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
}
.filter {
  min-height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 700;
}
.filter input { margin: 0; width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.availability-note { margin-block: 12px; color: var(--muted); font-size: .875rem; }
#closure-note, #holiday-note { margin-top: 4px; }
#closure-note summary { cursor: pointer; }
#closure-names { margin-top: 4px; }
.facility-list { display: grid; gap: 14px; }

.facility-card {
  min-width: 0;
  scroll-margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.facility-content { padding: 20px 22px 10px; }
.facility-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 12px; }
.facility-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.facility-city { color: var(--accent-deep); font-size: .875rem; font-weight: 700; }
.lottery-tag { border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.lottery-tag.has-lottery { color: var(--accent-deep); border-color: #abc3eb; background: var(--tint); }
.facility-name, .facility-address { grid-column: 1 / -1; }
.facility-name { font-weight: 800; font-size: clamp(1.2rem, 2.5vw, 1.625rem); line-height: 1.3; text-wrap: balance; }
.facility-address { color: var(--muted); font-size: .875rem; }
.status { border-radius: 6px; padding: 3px 8px; font-size: .875rem; font-weight: 750; }
.status.lottery-open { color: #126458; background: #e2f5ef; }
.status.upcoming, .status.lottery-upcoming { color: #78501c; background: #fff2d8; }
.status.check, .status.lottery-ended { color: #334b74; background: #e8effc; }
.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
  padding: 11px 13px;
  margin-block: 13px;
  background: var(--tint);
  border-radius: 9px;
}
.details dt { color: var(--muted); font-size: .875rem; font-weight: 700; }
.details dd { margin-top: 2px; font-weight: 700; line-height: 1.45; }
.facility-fee { text-wrap: balance; }
.details .facility-dates, .details .facility-price-basis { font-size: .875rem; font-weight: 500; color: var(--muted); }
.details .facility-rule[hidden] + .facility-dates { color: var(--ink); font-weight: 700; }
.facility-dates time { white-space: nowrap; }
.facility-price, .facility-duration { padding-top: 8px; border-top: 1px solid var(--line); }
.facility-actions { display: grid; gap: 8px; }
.facility-actions .facility-phone { flex-wrap: wrap; gap: 2px 4px; line-height: 1.25; }
.facility-phone-limit { color: var(--muted); font-size: .8125rem; font-weight: 600; }
.facility-card-links { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 4px; }
.detail-button {
  min-height: 44px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-size: .875rem;
  font-weight: 750;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.detail-button:hover { color: var(--accent); }
.facility-info p + p { margin-top: 8px; }
#facility-alternative:not(:empty) { margin-top: 8px; }
.facility-info ul { margin-block: 8px; padding-left: 1.3em; }
.facility-info li + li { margin-top: 4px; }
.dialog-body a, .footnote a { color: var(--accent-deep); text-underline-offset: .15em; }
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 15px;
  color: white;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  text-decoration: none;
  text-align: center;
  font-weight: 750;
  font-size: .9375rem;
}
.action:hover { background: var(--accent-deep); }
.action.secondary { background: var(--paper); color: var(--accent-deep); border-color: #94add0; }
.action.secondary:hover { background: var(--tint); }
.footnote { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 22px; color: var(--muted); font-size: .8125rem; }
.empty { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.empty p { margin-block: 6px 14px; color: var(--muted); }

:root:has(dialog[open]) { overflow: hidden; }
dialog { width: min(100% - 24px, 500px); max-height: calc(100dvh - 24px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #14274696; }
.dialog-content { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100dvh - 26px); }
.dialog-content h2 { padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 1.25rem; }
.dialog-body { overflow-y: auto; overscroll-behavior: contain; padding: 15px 20px; }
.dialog-facility { font-weight: 800; }
.desk-meta { margin-top: 3px; color: var(--muted); font-size: .875rem; }
.desk-notice { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: var(--tint); }
.desk-steps, .desk-sources { margin: 12px 0 0; padding-inline-start: 1.5em; }
.desk-steps li + li, .desk-sources li + li { margin-top: 5px; }
.desk-steps li::marker { color: var(--accent-deep); font-weight: 750; }
.desk-sources { font-size: .875rem; }
.dialog-actions { display: flex; justify-content: flex-end; padding: 10px 20px; border-top: 1px solid var(--line); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(255px, 290px) minmax(0, 1fr); gap: 18px; }
  .shell { width: min(100% - 40px, 1060px); }
  .date-panel { padding: 14px; }
  .facility-content { padding: 16px 16px 8px; }
}

@media (max-width: 700px) {
  .shell { width: min(100% - 32px, 520px); }
  .masthead-inner { min-height: 58px; flex-wrap: wrap; gap: 6px 12px; padding-block: 8px; }
  .masthead-link { margin-inline-start: auto; }
  .main { padding-top: 23px; }
  .intro { margin-bottom: 16px; }
  .intro p { margin-top: 7px; font-size: .9375rem; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .calendar-toggle { display: block; }
  .calendar:not(.expanded) { display: none; }
  .calendar .day { min-height: 44px; }
  .availability-note { margin-block: 8px 10px; }
  .results-heading { flex-wrap: wrap; }
  .details { margin-block: 13px; gap: 9px; padding: 10px; }
  .details dd { font-size: .9375rem; }
}

@media (max-width: 355px) {
  .shell { width: calc(100% - 24px); }
  #date-summary { font-size: 1.0625rem; }
  .facility-content { padding-inline: 12px; }
}
