:root {
  color-scheme: light;
  --charcoal: #1d1f26;
  --magenta: #da318b;
  --yellow: #fae070;
  --blue: #4a8ad4;
  --blue-dark: #326ba9;
  --red: #ea3323;
  --amber: #f7ce46;
  --pink: #ef96c4;
  --teal: #69aaa4;
  --aqua: #c7e5e1;
  --ink: var(--charcoal);
  --muted: #656873;
  --line: #d9dadd;
  --paper: #ffffff;
  --wash: #f7f7f5;
  --soft-blue: #edf4fb;
  --soft-teal: #eef8f7;
  --soft-pink: #fcedf5;
  --shadow: 0 16px 38px rgb(29 31 38 / 8%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

main {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 clamp(18px, 5vw, 72px);
  border-bottom: 0;
  background: var(--charcoal);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--magenta);
  color: white;
}

.engine-pill,
.privacy-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: var(--aqua);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 11px;
}

.privacy-chip {
  border-color: #cfd1d5;
  background: var(--soft-teal);
  color: #356e69;
}

.hero {
  padding: 36px clamp(18px, 5vw, 72px) 18px;
  border-top: 7px solid transparent;
  border-image: linear-gradient(90deg, var(--magenta), var(--yellow), var(--blue), var(--red), var(--amber), var(--pink), var(--aqua)) 1;
  background: linear-gradient(110deg, var(--soft-pink), var(--wash) 46%, var(--soft-teal));
}

.hero-copy {
  max-width: 860px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 14px;
  color: var(--charcoal);
  font-size: clamp(2.4rem, 4.8vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  margin: 0;
  max-width: 68ch;
  color: #494c55;
  font-size: 1.03rem;
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 24px clamp(18px, 5vw, 72px) 64px;
}

.panel,
.animal-panel,
.score-panel,
.scan-panel,
.recommendations,
.mode-detail {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

label {
  color: #383a42;
  font-size: 0.9rem;
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c9d3df;
  border-radius: 7px;
  background: #fcfcfb;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

input:focus,
textarea:focus,
.drop-zone:focus-within {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgb(218 49 139 / 13%);
}

textarea {
  min-height: 260px;
  line-height: 1.5;
  resize: vertical;
}

.drop-zone {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 86px;
  margin: 4px 0 16px;
  border: 1px dashed #9fb0c8;
  border-radius: 8px;
  background: var(--soft-blue);
  cursor: pointer;
  padding: 16px;
}

.drop-zone input {
  display: none;
}

.drop-zone.is-dragging,
.drop-zone.has-file {
  border-color: var(--magenta);
  background: var(--soft-teal);
}

.drop-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 1.35rem;
  font-weight: 900;
}

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

.drop-copy strong {
  color: var(--charcoal);
}

.drop-copy span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

button {
  min-height: 44px;
  border-radius: 7px;
  border: 1px solid var(--charcoal);
  background: var(--charcoal);
  color: white;
  cursor: pointer;
  font-weight: 900;
  padding: 0 16px;
}

button:hover {
  border-color: var(--magenta);
  background: var(--magenta);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary-button {
  border-color: var(--charcoal);
  background: white;
  color: var(--charcoal);
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: var(--magenta);
  background: var(--soft-pink);
  color: var(--magenta);
}

.secondary-button:disabled {
  border-color: #cbd3df;
  background: #f4f6f9;
  color: var(--muted);
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.results {
  display: grid;
  gap: 18px;
}

.analysis-feedback {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--soft-blue);
  color: #23314a;
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.analysis-feedback[hidden] {
  display: none;
}

.analysis-feedback h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.analysis-feedback p {
  margin: 0;
  line-height: 1.5;
}

.feedback-indicator {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border: 2px solid rgb(74 138 212 / 25%);
  border-top-color: var(--blue);
  border-radius: 50%;
}

.analysis-feedback.is-loading .feedback-indicator {
  animation: feedback-spin 0.9s linear infinite;
}

.analysis-feedback.is-error {
  border-color: #e5a4a4;
  background: #fff1f1;
  color: #711616;
}

.analysis-feedback.is-error .feedback-indicator {
  border: 0;
  border-radius: 0;
}

.analysis-feedback.is-error .feedback-indicator::before {
  content: "!";
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #a12626;
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
}

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

.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 14px 18px;
}

.profile-actions .eyebrow {
  margin-bottom: 3px;
}

.profile-actions-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.animal-panel {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-bottom: 6px solid var(--magenta);
}

.animal-avatar {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border: 1px solid #cbd5e2;
  border-radius: 50%;
  background: var(--soft-pink);
  font-size: 3.75rem;
}

.animal-panel h2 {
  margin: 0 0 8px;
  color: var(--magenta);
  font-size: 1.55rem;
  line-height: 1.18;
}

.animal-panel p:last-of-type {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.trait-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.trait-row span {
  border: 1px solid #cbd3df;
  border-radius: 999px;
  background: #fbfcfe;
  padding: 5px 10px;
  color: #303947;
  font-size: 0.82rem;
  font-weight: 850;
}

.score-panel {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px;
  border-bottom: 6px solid var(--aqua);
}

.score-panel h2 {
  margin: 0;
  color: var(--blue);
  font-size: clamp(3.2rem, 7vw, 5.2rem);
  line-height: 0.95;
}

.score-panel p:last-child {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.scan-panel {
  padding: 22px;
}

.profile-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.profile-tabs button {
  min-height: 42px;
  border-color: #cbd3df;
  background: white;
  color: #303947;
  font-size: 0.86rem;
  line-height: 1.2;
  padding: 0 10px;
}

.profile-tabs button:hover {
  border-color: var(--magenta);
  background: var(--soft-pink);
}

.profile-tabs button[aria-selected="true"] {
  border-color: var(--charcoal);
  background: var(--charcoal);
  color: white;
}

.mode-detail {
  min-height: 176px;
  padding: 18px;
  box-shadow: none;
}

.mode-detail h3,
.recommendations h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.mode-detail p {
  color: var(--muted);
  line-height: 1.55;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li {
  margin: 7px 0;
  line-height: 1.42;
}

.recommendations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

.recommendations > div {
  padding: 20px;
}

.recommendations > div + div {
  border-left: 1px solid var(--line);
}

.is-loading .results {
  opacity: 0.82;
}

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

  .input-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar,
  .panel-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    min-height: auto;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    padding-bottom: 14px;
  }

  .engine-pill {
    align-self: flex-start;
  }

  .workspace,
  .hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  .animal-panel,
  .score-panel,
  .recommendations {
    grid-template-columns: 1fr;
  }

  .recommendations > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .profile-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .profile-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
