:root {
  --bg: #ffffff;
  --surface: #faf8f3;
  --border: #dedad0;
  --text: #2b3035;
  --text-muted: #5c5954;
  --accent: #355254;
  --accent-hover: #294143;
  --accent-soft: #f2f6f6;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --text-heading: clamp(1.375rem, 2.4vw, 1.75rem);
  --text-body: 1rem;
  --text-sm: 0.875rem;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: var(--text-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.page-shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 16px 56px;
}

.page-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.back-facility-link {
  display: inline-block;
  margin-bottom: 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.back-facility-link:hover {
  text-decoration: underline;
}

.back-facility-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.page-header h1 {
  margin: 0;
  font-size: var(--text-heading);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.lang-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lang-btn {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), color 180ms var(--ease-out);
}

.lang-btn:hover {
  background-color: var(--surface);
  border-color: var(--accent);
}

.lang-btn[aria-pressed="true"] {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.lang-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.page-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-body);
}

.mode-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.inline-reset-btn {
  margin-left: 8px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.inline-reset-btn:hover {
  background-color: var(--accent-soft);
  border-color: var(--accent);
}

.calendar-section {
  margin-top: 24px;
}

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.4;
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-range-label {
  font-size: var(--text-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nav-btn {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.nav-btn:hover:not(:disabled) {
  background-color: var(--surface);
  border-color: var(--accent);
}

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

.status-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text);
}

.status-banner.is-error {
  background-color: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg);
}

.slot-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.slot-table th,
.slot-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
  padding: 0;
}

.slot-table th:last-child,
.slot-table td:last-child {
  border-right: none;
}

.slot-table tbody tr:last-child th,
.slot-table tbody tr:last-child td {
  border-bottom: none;
}

.slot-table thead th {
  background-color: var(--surface);
  padding: 10px 4px;
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.35;
}

.time-col-head {
  width: 68px;
}

.day-date-text {
  display: block;
  font-size: var(--text-sm);
  color: var(--text);
}

.day-week-text {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.day-holiday-text {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--danger);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-cell {
  background-color: var(--surface);
  padding: 8px 4px;
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--text);
}

.slot-cell {
  height: 64px;
}

.slot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 64px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: none;
  background-color: var(--bg);
  color: var(--accent);
  font-family: inherit;
  font-size: 1.375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.slot-btn:hover {
  background-color: var(--accent-soft);
}

.slot-btn:focus-visible,
.nav-btn:focus-visible,
.primary-btn:focus-visible,
.inline-reset-btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.slot-btn.is-selected {
  background-color: var(--accent);
  color: #ffffff;
}

.slot-unavailable {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 64px;
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text-muted);
  background-color: #fafbfa;
  user-select: none;
}

.slot-unavailable.is-holiday {
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 700;
}

.calendar-legend {
  margin: 10px 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.form-section,
.complete-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.selected-slot-box {
  margin: 14px 0 20px;
  padding: 14px 16px;
  background-color: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.selected-slot-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-hover);
}

.selected-slot-value {
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: var(--text-body);
  font-weight: 500;
}

.req-mark {
  margin-left: 6px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--danger);
}

.form-row input:not([type="radio"]):not([type="checkbox"]),
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-body);
  line-height: 1.5;
  transition: border-color 180ms var(--ease-out);
}

.form-row textarea {
  min-height: 92px;
  resize: vertical;
}

.field-note {
  margin: 4px 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

.choice-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.choice-legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: var(--text-body);
  font-weight: 500;
}

.choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.choice-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--bg);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

.choice-option:hover {
  border-color: var(--accent);
}

.choice-option:has(input:checked) {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

.choice-option input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: auto;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.consent-row {
  margin-top: 2px;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.6;
  cursor: pointer;
}

.consent-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: auto;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  background-color: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 500;
}

.form-actions {
  margin-top: 4px;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background-color: var(--accent);
  color: #ffffff;
  font-family: inherit;
  font-size: var(--text-body);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.primary-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.complete-lead {
  margin: 10px 0 16px;
  color: var(--text-muted);
}

.complete-summary {
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
  padding: 4px 16px;
}

.complete-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.complete-summary-row:last-child {
  border-bottom: none;
}

.complete-summary-row dt {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.complete-summary-row dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.tabular-text {
  font-variant-numeric: tabular-nums;
}

.complete-note {
  margin: 0 0 16px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (max-width: 520px) {
  .page-shell {
    padding: 20px 10px 44px;
  }

  .time-col-head {
    width: 64px;
  }

  .time-cell {
    font-size: var(--text-sm);
  }

  .week-nav {
    width: 100%;
    justify-content: space-between;
  }

  .nav-btn {
    padding: 8px 10px;
  }

  .slot-btn,
  .slot-unavailable,
  .slot-cell {
    height: 56px;
  }

  .choice-group {
    grid-template-columns: 1fr;
  }

  .lang-btn {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inline-reset-btn,
  .lang-btn,
  .nav-btn,
  .slot-btn,
  .choice-option,
  .form-row input,
  .form-row select,
  .form-row textarea,
  .primary-btn {
    transition: none;
  }
}
