:root {
  --sw-bg: #ffffff;
  --sw-surface: #ffffff;
  --sw-surface-strong: #ffffff;
  --sw-ink: #000000;
  --sw-muted: #4b5563;
  --sw-line: #e5e7eb;
  --sw-brand: #c5ea6c;
  --sw-brand-strong: #b7df56;
  --sw-brand-soft: #dff4a4;
  --sw-accent: #c5ea6c;
  --sw-user: #f5f5f5;
  --sw-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
  --sw-radius-xl: 24px;
  --sw-radius-lg: 18px;
  --sw-radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--sw-bg);
  color: var(--sw-ink);
}

body.embed-body {
  background: #ffffff;
  min-height: 100dvh;
}

.widget-shell {
  min-height: 100vh;
  padding: 32px 16px;
}

.widget-frame {
  position: relative;
  width: min(100%, 1100px);
  margin: 0 auto;
  background: var(--sw-surface);
  border: 1px solid var(--sw-line);
  border-radius: 28px;
  box-shadow: var(--sw-shadow);
  overflow: hidden;
}

.widget-frame::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 5px;
  background: var(--sw-brand);
}

.widget-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 760px;
  position: relative;
}

.widget-aside {
  padding: 28px 24px;
  background: #fafafa;
  color: var(--sw-ink);
  position: relative;
  z-index: 1;
  border-right: 1px solid var(--sw-line);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--sw-brand);
  color: #000000;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.brand-logo-full {
  width: min(100%, 320px);
  margin-bottom: 18px;
}

.brand-logo-mark {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 14px;
  background: var(--sw-brand);
  padding: 8px;
  border: 1px solid var(--sw-line);
}

.brand-logo-embed {
  width: 190px;
  margin-bottom: 12px;
}

.widget-aside h1 {
  margin: 18px 0 10px;
  font-size: 34px;
  line-height: 1.02;
}

.widget-aside h1::after {
  content: "";
  display: block;
  width: 66px;
  height: 4px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--sw-brand);
}

.widget-aside p {
  margin: 0;
  color: var(--sw-muted);
  line-height: 1.6;
}

.aside-card {
  margin-top: 26px;
  padding: 18px;
  border-radius: var(--sw-radius-lg);
  background: #f5f5f5;
  border: 1px solid var(--sw-line);
}

.aside-card h2 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.aside-list {
  display: grid;
  gap: 10px;
}

.aside-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--sw-line);
}

.aside-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.aside-item span {
  font-size: 13px;
  color: var(--sw-muted);
}

.widget-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--sw-surface);
  position: relative;
}

.widget-main::before {
  content: none;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--sw-line);
  position: relative;
  z-index: 1;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.widget-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.widget-header p {
  margin: 0;
  color: var(--sw-muted);
}

.landing-player-types {
  padding: 20px 24px 0;
  display: grid;
  gap: 14px;
}

.landing-section-heading h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.landing-section-heading p {
  margin: 0;
  color: var(--sw-muted);
  line-height: 1.5;
}

.widget-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #000000;
  font-weight: 600;
  border: 1px solid var(--sw-line);
}

.widget-status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--sw-brand);
  box-shadow: 0 0 0 6px rgba(197, 234, 108, 0.25);
}

.chat-scroll {
  padding: 22px 24px;
  overflow-y: auto;
  display: grid;
  gap: 16px;
  align-content: start;
  position: relative;
  z-index: 1;
}

.message-row {
  display: flex;
}

.message-row.bot {
  justify-content: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: min(90%, 720px);
  padding: 16px 18px;
  border-radius: 20px;
  line-height: 1.55;
  box-shadow: 0 10px 24px rgba(23, 50, 44, 0.08);
}

.message-row.bot .message-bubble {
  background: var(--sw-surface-strong);
  border: 1px solid var(--sw-line);
}

.message-row.user .message-bubble {
  background: var(--sw-user);
  color: #000000;
  border: 1px solid var(--sw-line);
}

.message-meta {
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sw-muted);
}

.message-row.user .message-meta {
  color: var(--sw-muted);
}

.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.question-help-wrap {
  margin-top: 14px;
}

.question-help-toggle {
  border: none;
  background: transparent;
  color: #1f2937;
  padding: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.question-help-panel {
  margin-top: 10px;
  padding: 16px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--sw-line);
}

.question-help-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 12px;
}

.question-help-grid {
  display: grid;
  gap: 12px;
}

.question-help-section {
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e8edf3;
}

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

.question-help-section strong {
  font-size: 14px;
}

.question-help-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--sw-muted);
}

.question-help-note {
  margin-top: 8px !important;
  color: #111827 !important;
  font-weight: 600;
}

.shape-visual {
  position: relative;
  width: 44px;
  height: 20px;
  flex: 0 0 auto;
}

.shape-visual span {
  position: absolute;
  inset: 0;
  border: 2px solid #90b940;
  background: rgba(197, 234, 108, 0.2);
}

.shape-elongated span {
  border-radius: 999px / 70%;
  transform: scaleX(1.1);
}

.shape-hybrid span {
  border-radius: 999px / 75%;
  transform: scaleX(0.95);
}

.shape-widebody span {
  border-radius: 999px / 80%;
  transform: scaleX(0.78);
}

.profile-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.profile-card-option {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 260px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--sw-line);
  background: #ffffff;
  color: var(--sw-ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.profile-card-option:hover {
  transform: translateY(-1px);
  border-color: rgba(197, 234, 108, 0.9);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.08);
}

.profile-card-option.is-selected {
  border-color: rgba(197, 234, 108, 0.95);
  background: linear-gradient(180deg, #ffffff 0%, #fbfff0 100%);
  box-shadow: 0 18px 34px rgba(167, 199, 78, 0.18);
}

.profile-card-copy {
  display: grid;
  gap: 4px;
}

.profile-card-title {
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.9rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.profile-card-subtitle {
  font-size: clamp(0.95rem, 0.88rem + 0.28vw, 1.12rem);
  color: #1f2937;
  line-height: 1.15;
}

.profile-card-art {
  display: grid;
  place-items: center;
  min-height: 108px;
}

.profile-card-art-image {
  width: 100%;
  max-width: 196px;
  height: auto;
  object-fit: contain;
  display: block;
  filter: saturate(1.02);
}

.profile-card-traits {
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.42;
  color: var(--sw-muted);
}

.profile-card-traits span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--sw-brand);
  vertical-align: middle;
}

.quick-option {
  border: 1px solid var(--sw-line);
  background: #fff;
  color: var(--sw-ink);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.quick-option:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  background: #f9fafb;
}

.results-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.result-card {
  padding: 18px;
  border-radius: 20px;
  background: #f5f5f5;
  border: 1px solid var(--sw-line);
}

.result-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.result-title {
  margin: 0;
  font-size: 20px;
}

.rank-pill {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--sw-brand);
  color: #000000;
  font-weight: 700;
  font-size: 13px;
}

.result-description {
  margin: 0 0 14px;
  color: var(--sw-muted);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-chip {
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--sw-line);
  font-size: 13px;
}

.match-list {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--sw-ink);
}

.match-list li + li {
  margin-top: 6px;
}

.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-button,
.submit-button {
  border: none;
  background: var(--sw-brand);
  color: #000000;
  padding: 13px 18px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.shop-button:hover,
.submit-button:hover {
  filter: brightness(1.03);
}

.reasoning-panel {
  padding: 16px 18px;
  border-radius: 20px;
  background: #f5f5f5;
  border: 1px solid var(--sw-line);
  color: #111827;
}

.composer {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--sw-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, #ffffff 100%);
  position: relative;
  z-index: 1;
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.06);
}

.composer form {
  padding: 18px;
  border: 2px solid rgba(197, 234, 108, 0.85);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.composer-label {
  display: block;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.composer textarea {
  min-height: 108px;
  max-height: 180px;
  resize: vertical;
  border-radius: 18px;
  border: 2px solid rgba(197, 234, 108, 0.65);
  padding: 18px;
  font: inherit;
  color: var(--sw-ink);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.composer textarea:focus {
  outline: none;
  border-color: var(--sw-brand-strong);
  box-shadow: 0 0 0 4px rgba(197, 234, 108, 0.22);
}

.helper-text {
  margin-top: 12px;
  font-size: 14px;
  color: var(--sw-muted);
}

.loading-pill,
.error-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  width: fit-content;
}

.loading-pill {
  background: #f5f5f5;
  color: #111827;
  border: 1px solid var(--sw-line);
}

.error-pill {
  background: #fff0ee;
  color: #ad3b25;
  border: 1px solid #f5c4bc;
}

.embed-shell {
  display: block;
  min-height: 100dvh;
  background: var(--sw-surface);
}

.embed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--sw-line);
  background: #ffffff;
}

.embed-title {
  margin: 10px 0 0;
  font-size: 22px;
  line-height: 1.05;
}

.embed-chat {
  padding: 16px;
  overflow: visible;
  overscroll-behavior: auto;
}

.embed-composer {
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, #ffffff 100%);
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
}

.embed-composer-row {
  grid-template-columns: 1fr auto;
}

@media (max-width: 920px) {
  .widget-grid {
    grid-template-columns: 1fr;
  }

  .widget-aside {
    padding-bottom: 20px;
  }

  .composer-row,
  .embed-composer-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .widget-shell {
    padding: 0;
  }

  .widget-frame {
    border-radius: 0;
    min-height: 100vh;
  }

  .widget-header,
  .landing-player-types,
  .chat-scroll,
  .composer,
  .embed-header,
  .embed-chat,
  .embed-composer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .embed-header {
    align-items: flex-start;
  }

  .embed-title {
    font-size: 20px;
  }

  .message-bubble {
    max-width: 100%;
  }

  .composer form {
    padding: 14px;
    border-radius: 18px;
  }

  .composer-label {
    font-size: 16px;
  }

  .profile-card-grid {
    gap: 8px;
  }

  .profile-card-option {
    min-height: 220px;
    padding: 14px;
    border-radius: 20px;
  }

  .profile-card-art {
    min-height: 86px;
  }

  .profile-card-subtitle {
    font-size: 0.95rem;
  }

  .question-help-panel {
    padding: 14px;
    border-radius: 16px;
  }

  .question-help-section {
    padding: 11px 12px;
  }
}
