:root {
  color-scheme: light;
  --ink: #221b16;
  --muted: #7b6f66;
  --line: #f0d8c1;
  --surface: #ffffff;
  --wash: #fff8ef;
  --orange: #f58220;
  --orange-dark: #c75410;
  --orange-soft: #fff0dc;
  --coral: #f05f42;
  --sun: #ffc24b;
  --blue: #2f6fb7;
  --shadow: 0 18px 42px rgba(135, 74, 24, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: #fff3df;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(255, 246, 232, 0.62) 0%, rgba(255, 255, 255, 0.66) 42%, rgba(255, 224, 178, 0.24) 100%),
    url("./assets/gym-background.png") center bottom / cover no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 76% 9%, rgba(255, 219, 134, 0.34), transparent 18rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.5));
  pointer-events: none;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(100%, 720px);
  height: 100svh;
  min-height: 0;
  margin: 0 auto;
  padding: 18px 14px;
  display: grid;
  overflow: hidden;
}

.chat-panel {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
}

.hero {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 18px;
  align-items: center;
}

.mascot-stage {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: rotate(-2deg);
  overflow: visible;
}

.mascot {
  width: 88px;
  height: 88px;
  border-radius: 0;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(118, 63, 16, 0.14));
  animation: floaty 3.2s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--orange-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 7vw, 2.2rem);
  line-height: 1.18;
}

.progress-wrap {
  align-self: start;
  padding: 12px 14px;
  border: 1px solid rgba(240, 216, 193, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 26px rgba(135, 74, 24, 0.08);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.progress-copy span:first-child {
  color: var(--orange-dark);
}

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: #ffe8cb;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--sun));
  transition: width 0.28s ease;
}

.messages {
  min-height: 0;
  padding: 4px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-bottom: 12px;
}

.bubble {
  width: fit-content;
  max-width: min(88%, 560px);
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.65;
  white-space: pre-wrap;
  box-shadow: 0 8px 20px rgba(135, 74, 24, 0.09);
  animation: bubbleIn 0.2s ease-out both;
}

.bubble.bot {
  align-self: flex-start;
  background: var(--surface);
  border-bottom-left-radius: 5px;
  border: 1px solid rgba(240, 216, 193, 0.84);
}

.bubble.user {
  align-self: flex-end;
  background: #fff0dc;
  border: 1px solid #ffd4a1;
  border-bottom-right-radius: 5px;
}

.bubble.typing::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.08em;
  margin-left: 2px;
  border-right: 2px solid var(--orange);
  vertical-align: -0.18em;
  animation: caretBlink 0.8s steps(2, start) infinite;
}

.reply-area {
  align-self: end;
  max-height: min(56svh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  border: 1px solid rgba(240, 216, 193, 0.95);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.current-question {
  margin: 0 0 11px;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.5;
  white-space: pre-wrap;
}

.current-question[hidden] {
  display: none;
}

.choice-area {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
}

.availability-grid {
  width: 100%;
  display: grid;
  gap: 8px;
}

.availability-help {
  padding: 7px 9px;
  border-radius: 12px;
  background: #fff6e8;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.45;
}

.availability-row {
  display: grid;
  grid-template-columns: 28px repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.availability-day {
  color: var(--orange-dark);
  font-weight: 900;
  text-align: center;
}

.availability-choice {
  min-height: 38px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: 0 5px 12px rgba(135, 74, 24, 0.06);
}

.availability-choice[aria-pressed="true"] {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.choice {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(135, 74, 24, 0.07);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  animation: choiceIn 0.18s ease-out both;
}

.choice:hover {
  transform: translateY(-1px);
  border-color: #f8b66d;
}

.choice[aria-pressed="true"] {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-weight: 800;
}

.text-reply {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.text-reply[hidden] {
  display: none;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

.form-actions {
  position: sticky;
  bottom: -14px;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  padding-bottom: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.96) 30%);
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff9a32 0%, var(--orange) 100%);
  color: #fff;
  font-weight: 800;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.danger {
  border: 1px solid #f4b3a6;
  background: #fff4f0;
  color: #ba3d24;
}

.small-button {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 10px;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.55;
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.admin-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 16px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(135, 74, 24, 0.08);
}

.metric {
  padding: 14px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  background: #fff4e5;
  font-size: 0.82rem;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes choiceIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes caretBlink {
  to {
    border-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding: 28px;
  }

  .app-shell {
    height: 100dvh;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 14px;
  }

  .app-shell {
    padding: 10px 10px;
  }

  .chat-panel {
    gap: 9px;
  }

  .hero {
    grid-template-columns: 52px 1fr;
    gap: 10px;
  }

  .mascot-stage,
  .mascot {
    width: 52px;
    height: 52px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: 0.72rem;
  }

  h1 {
    font-size: 1.46rem;
    line-height: 1.12;
  }

  .progress-wrap {
    padding: 9px 10px;
    border-radius: 14px;
  }

  .progress-copy {
    margin-bottom: 7px;
    font-size: 0.78rem;
  }

  .progress-track {
    height: 7px;
  }

  .messages {
    gap: 8px;
    padding-bottom: 6px;
  }

  .bubble {
    max-width: 94%;
    padding: 10px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .reply-area {
    max-height: 58svh;
    padding: 10px;
    border-radius: 16px;
  }

  .current-question {
    margin-bottom: 8px;
    font-size: 0.86rem;
    line-height: 1.45;
  }

  .choice-area {
    gap: 7px;
    margin-bottom: 8px;
  }

  .availability-grid {
    gap: 6px;
  }

  .availability-help {
    padding: 6px 8px;
    font-size: 0.7rem;
  }

  .availability-row {
    grid-template-columns: 24px repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .availability-day {
    font-size: 0.88rem;
  }

  .availability-choice {
    min-height: 32px;
    padding: 4px 2px;
    border-radius: 10px;
    font-size: 0.92rem;
  }

  .choice {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  textarea {
    min-height: 92px;
    padding: 10px;
    font-size: 0.9rem;
  }

  .form-actions {
    bottom: -10px;
    grid-template-columns: 84px 1fr;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    padding-bottom: 10px;
  }

  button {
    min-height: 42px;
    border-radius: 12px;
    font-size: 0.92rem;
  }
}
