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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0F172A;
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ─── Main card ─────────────────────────────────── */

.card {
  width: 100%;
  max-width: 1100px;
  background: #1E293B;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

@media (min-width: 900px) {
  .card {
    grid-template-columns: 5fr 7fr;
    min-height: 700px;
  }
}

/* ─── Image panel ────────────────────────────────── */

.image-panel {
  position: relative;
  min-height: 260px;
  overflow: hidden;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: grayscale(1) contrast(1.2);
  transition: transform 0.7s ease;
}

.image-panel:hover .hero-img {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(15, 23, 42, 0.92) 0%,
    rgba(15, 23, 42, 0.3) 50%,
    transparent 100%
  );
}

@media (min-width: 900px) {
  .image-overlay {
    background: linear-gradient(
      to right,
      rgba(15, 23, 42, 0.1) 0%,
      rgba(30, 41, 59, 0.95) 100%
    );
  }
}

.image-text {
  position: absolute;
  bottom: 28px;
  left: 24px;
  z-index: 2;
}

.badge {
  background: #FF4757;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 10px;
}

.image-text h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.image-text p {
  color: #94a3b8;
  margin-top: 8px;
  font-size: 0.85rem;
  max-width: 240px;
  line-height: 1.6;
}

/* ─── Form panel ─────────────────────────────────── */

.form-panel {
  padding: 36px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

@media (max-width: 600px) {
  .form-panel {
    padding: 24px 16px;
  }
}

.panel-header {
  margin-bottom: 28px;
}

.panel-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.subtitle {
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ─── Section headers ────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.icon-primary {
  color: #FF4757;
  font-size: 1.15rem !important;
}

.section-label-upper {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
}

/* ─── Card section (Limitations) ────────────────── */

.form-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}

.section-desc {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 14px;
}

/* ─── Plain section (Goals, Type) ────────────────── */

.form-section-plain {
  margin-bottom: 24px;
}

.section-title-large {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 14px;
}

/* ─── Chip group ─────────────────────────────────── */

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.chip input[type="checkbox"] {
  display: none;
}

.chip:has(input:checked) {
  background: #FF4757;
  border-color: #FF4757;
  color: #fff;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: background 0.2s;
}

.chip:has(input:checked) .dot {
  background: rgba(255, 255, 255, 0.5);
}

/* ─── Field label ────────────────────────────────── */

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
}

/* ─── Select ─────────────────────────────────────── */

.select-wrapper {
  position: relative;
}

select {
  width: 100%;
  padding: 11px 40px 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #f1f5f9;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus {
  outline: none;
  border-color: #FF4757;
  box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.15);
}

select option {
  background: #1E293B;
  color: #f1f5f9;
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #475569;
  pointer-events: none;
  font-size: 1.1rem !important;
}

/* ─── Form actions ───────────────────────────────── */

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 24px;
}

#recommend-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FF4757;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 71, 87, 0.3);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

#recommend-btn:hover {
  background: #FF6B81;
  box-shadow: 0 6px 22px rgba(255, 71, 87, 0.45);
  transform: translateY(-1px);
}

#recommend-btn:active {
  transform: translateY(0);
}

#recommend-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#recommend-btn .material-icons-round {
  font-size: 1.15rem;
  transition: transform 0.2s;
}

#recommend-btn:hover .material-icons-round {
  transform: translateX(2px);
}

.powered-by {
  margin-left: auto;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ─── Loading ────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 0.875rem;
}

.loading[hidden] {
  display: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 71, 87, 0.2);
  border-top-color: #FF4757;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  flex-shrink: 0;
}

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

/* ─── Results ────────────────────────────────────── */

.results {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.results[hidden] {
  display: none;
}

.results h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #FF4757;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.results h2::before {
  content: 'fitness_center';
  font-family: 'Material Icons Round';
  font-size: 1.1rem;
  font-style: normal;
  font-weight: normal;
}

#results-text {
  font-size: 0.9rem;
  line-height: 1.75;
  color: #94a3b8;
  word-wrap: break-word;
}

#results-text strong {
  font-weight: 700;
  color: #e2e8f0;
}

#results-text em {
  font-style: italic;
  color: #cbd5e1;
}

#results-text h1,
#results-text h2,
#results-text h3 {
  color: #f1f5f9;
  margin: 14px 0 6px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#results-text ol,
#results-text ul {
  padding-left: 1.5em;
  margin: 8px 0;
}

#results-text li {
  margin: 5px 0;
}

#results-text p {
  margin: 8px 0;
}

/* ─── Ad container ───────────────────────────────── */

.ad-container {
  display: flex;
  justify-content: center;
  margin: 0 -32px 24px;
}

@media (max-width: 600px) {
  .ad-container {
    margin: 0 -16px 24px;
  }
}

/* ─── Footer ─────────────────────────────────────── */

footer {
  text-align: center;
  color: #1e293b;
  font-size: 0.78rem;
  padding: 8px 0;
  margin-top: auto;
}

footer span {
  color: #334155;
  font-weight: 500;
}

/* ─── Scrollbar ──────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ─── Mobile ─────────────────────────────────────── */

@media (max-width: 599px) {
  body {
    padding: 0;
    align-items: flex-start;
  }

  .card {
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
    border: none;
  }

  .panel-header h1 {
    font-size: 1.6rem;
  }

  .chip {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  #recommend-btn {
    padding: 11px 22px;
    font-size: 0.9rem;
  }
}
