:root {
  color-scheme: light;
  --bg: #fff8f9;
  --panel: #ffffff;
  --text: #2f3137;
  --muted: #6f7684;
  --line: #ead7dc;
  --accent: #d94f73;
  --accent-dark: #b93d5f;
  --accent-soft: #fff0f4;
  --mint: #e8f7f1;
  --mint-dark: #267258;
  --disabled: #f1f2f4;
  --shadow: 0 18px 45px rgba(115, 77, 87, 0.14);
}

html {
  width: 100%;
  overflow-x: hidden;
}

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

body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(180deg, #fff2f5 0%, #fffafb 45%, #f3fbf8 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 760px);
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: clip;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.hero {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 7;
  min-height: 154px;
  max-height: 300px;
  overflow: hidden;
  background: linear-gradient(135deg, #fce4ea, #eef8fb);
}

.hero-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: clamp(154px, 35vw, 300px);
  object-fit: cover;
  object-position: center;
}

.hero-image.is-hidden {
  display: none;
}

.booking-panel {
  width: 100%;
  max-width: 100%;
  padding: 24px clamp(16px, 4vw, 32px) 42px;
  overflow-wrap: anywhere;
}

.intro-card,
.calendar-card,
.day-slots-card,
.form-card {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(234, 215, 220, 0.9);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(115, 77, 87, 0.08);
}

.intro-card {
  margin-bottom: 18px;
  padding: 24px 20px;
  text-align: center;
}

h1,
h2 {
  line-height: 1.3;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: clamp(1.55rem, 5vw, 2.05rem);
  text-align: center;
}

.page-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.slot-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.slot-fieldset > legend {
  margin-bottom: 10px;
  color: #3c3f47;
  font-weight: 800;
}

.calendar-card {
  padding: 16px;
}

.calendar-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.calendar-header h2 {
  margin: 0;
  color: #363941;
  font-size: 1.08rem;
  text-align: center;
}

.calendar-nav {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent-dark);
  font-size: 1.45rem;
  font-weight: 800;
  cursor: pointer;
}

.calendar-nav:hover {
  background: var(--accent-soft);
}

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

.weekday-row {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  width: 100%;
  min-width: 0;
  min-height: 76px;
  padding: 8px 4px 7px;
  border: 1px solid #efe1e5;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.calendar-day:hover {
  border-color: #e08aa0;
  background: #fff9fb;
}

.calendar-day.is-outside {
  visibility: hidden;
  pointer-events: none;
}

.calendar-day.has-no-slots {
  background: #fbfbfc;
  color: #a6acb5;
  cursor: default;
}

.calendar-day.has-no-slots:hover {
  border-color: #efe1e5;
  background: #fbfbfc;
}

.calendar-day.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(217, 79, 115, 0.12);
}

.calendar-day-number {
  font-weight: 800;
  line-height: 1.2;
}

.calendar-status {
  display: inline-grid;
  place-items: center;
  max-width: 100%;
  min-height: 20px;
  margin-top: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e9f8f1;
  color: var(--mint-dark);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.calendar-status.is-full {
  background: #eceff3;
  color: #69707b;
}

.calendar-dot {
  width: 7px;
  height: 7px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar-loading {
  grid-column: 1 / -1;
  padding: 12px;
}

.day-slots-card {
  margin-top: 16px;
  padding: 18px 16px;
}

.day-slots-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
}

.day-slots-heading h2 {
  margin: 0;
  color: #363941;
  font-size: 1.02rem;
}

.day-slots-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.slots-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.slot-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 66px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.slot-option:hover {
  border-color: #e08aa0;
  background: #fff9fb;
}

.slot-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slot-circle {
  width: 20px;
  height: 20px;
  border: 2px solid #b8bec9;
  border-radius: 50%;
  background: #fff;
}

.slot-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(217, 79, 115, 0.12);
}

.slot-option:has(input:checked) .slot-circle {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 4px #fff;
  background: var(--accent);
}

.slot-option.is-disabled {
  color: #8d949f;
  background: var(--disabled);
  cursor: not-allowed;
}

.slot-option.is-disabled:hover {
  border-color: var(--line);
  background: var(--disabled);
}

.slot-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.slot-time {
  display: block;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.35;
}

.slot-id {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-badge {
  max-width: 100%;
  min-width: 68px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fde5ec;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

.is-disabled .status-badge {
  background: #e2e5e9;
  color: #69707b;
}

.form-card {
  margin-top: 18px;
  padding: 18px 16px 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

label span {
  display: block;
  margin-bottom: 6px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid #d9dde4;
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
  overflow-wrap: anywhere;
}

select {
  appearance: none;
  min-width: 0;
  padding-right: 42px;
  background:
    linear-gradient(45deg, transparent 50%, var(--accent-dark) 50%) calc(100% - 20px) 52% / 7px 7px no-repeat,
    linear-gradient(135deg, var(--accent-dark) 50%, transparent 50%) calc(100% - 14px) 52% / 7px 7px no-repeat,
    #fff;
  cursor: pointer;
}

.course-field {
  min-width: 0;
}

.course-description {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.course-description[hidden] {
  display: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.calendar-nav:focus-visible,
.calendar-day:focus-visible,
.slot-option:focus-within,
#backToSlotsBtn:focus-visible,
button[type="submit"]:focus-visible {
  outline: 3px solid rgba(217, 79, 115, 0.18);
  outline-offset: 2px;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f6f7f9;
  color: #98a0aa;
}

button[type="submit"] {
  width: 100%;
  max-width: 100%;
  min-height: 54px;
  margin-top: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

button[type="submit"]:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button[type="submit"]:disabled {
  background: #c8cdd5;
  cursor: wait;
  transform: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  align-content: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-dark);
  font-weight: 800;
  overflow-x: hidden;
  padding: 20px;
  text-align: center;
}

.loading-overlay p {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}

.loading-overlay.is-visible {
  display: grid;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid #f4c9d4;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.toast-container {
  position: fixed;
  top: 16px;
  right: max(12px, env(safe-area-inset-right));
  left: max(12px, env(safe-area-inset-left));
  z-index: 30;
  display: grid;
  gap: 10px;
  justify-items: end;
  max-width: none;
  pointer-events: none;
}

.toast {
  width: fit-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.2);
  overflow-wrap: anywhere;
  pointer-events: auto;
}

.toast.error {
  background: #be3144;
}

.toast.success {
  background: #177245;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.error-box {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #efb6c0;
  border-radius: 8px;
  background: #fff4f5;
  color: #a32738;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

.success-view {
  width: 100%;
  max-width: 100%;
  padding: 56px 28px 44px;
  text-align: center;
  overflow-wrap: anywhere;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: #fde5ec;
  color: var(--accent);
}

.success-icon svg {
  width: 42px;
  height: 42px;
  fill: currentColor;
}

.success-view h2 {
  margin: 0 0 12px;
  color: #25272d;
  font-size: 1.55rem;
  line-height: 1.35;
}

.success-view p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.success-view strong {
  color: var(--accent-dark);
  overflow-wrap: anywhere;
  word-break: break-word;
}

#backToSlotsBtn {
  max-width: 100%;
  min-height: 46px;
  margin-top: 28px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 800;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: 100%;
    box-shadow: none;
  }

  .booking-panel {
    padding: 18px 12px 34px;
  }

  .intro-card,
  .calendar-card,
  .day-slots-card,
  .form-card {
    padding-right: 12px;
    padding-left: 12px;
  }

  .weekday-row,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    min-height: 56px;
    padding: 5px 2px;
  }

  .calendar-status {
    min-height: 16px;
    margin-top: 4px;
    padding: 2px 4px;
    font-size: 0.58rem;
  }

  .calendar-dot {
    display: none;
  }

  .slot-option {
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
  }

  .status-badge {
    grid-column: 2;
    justify-self: start;
  }
}
