* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #030507 url("/assets/stars.jpg") center / cover no-repeat fixed;
  color: #101010;
  font-family: Manrope, Arial, Helvetica, sans-serif;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background: rgb(0 0 0 / 18%);
  content: "";
  pointer-events: none;
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100svh;
  padding: 1.5rem;
  place-items: center;
}

.auth-form {
  width: min(100%, 28rem);
  color: #f4f4f5;
}

.auth-form header {
  margin-bottom: 2.5rem;
}

.auth-form h1 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 2.25rem;
  font-weight: 600;
}

.auth-form form {
  display: grid;
  gap: 0.75rem;
}

.auth-form .auth-message {
  margin: -1rem 0 1.5rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid;
  border-radius: 0.5rem;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%), 0 0.75rem 2rem rgb(0 0 0 / 18%);
  backdrop-filter: blur(12px);
}

.auth-form .auth-message-error {
  border-color: rgb(248 113 113 / 55%);
  background: rgb(127 29 29 / 24%);
  color: #fee2e2;
}

.auth-form .auth-message-success {
  border-color: rgb(74 222 128 / 50%);
  background: rgb(20 83 45 / 24%);
  color: #dcfce7;
}

.auth-form label {
  color: #d8dae0;
  font-weight: 600;
}

.auth-form input:not([type="hidden"]) + label {
  margin-top: 0.5rem;
}

.auth-form input {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 0.5rem;
  background: rgb(8 10 14 / 58%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%);
  color: #f4f4f5;
  backdrop-filter: blur(8px);
  font: inherit;
}

.auth-form input::placeholder {
  color: #9a9fa8;
}

.auth-form input:focus-visible {
  border-color: rgb(255 255 255 / 75%);
  outline: 2px solid rgb(167 184 221 / 70%);
  outline-offset: 1px;
}

.auth-form .password-field {
  position: relative;
}

.auth-form .password-field input {
  padding-right: 4.5rem;
}

.auth-form .password-toggle {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  padding: 0.25rem;
  border: 0;
  background: transparent;
  color: #d8dae0;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  visibility: hidden;
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}

.auth-form .password-toggle.password-toggle-available {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition-delay: 0s;
}

.auth-form .password-toggle:focus-visible {
  border-radius: 0.25rem;
  outline: 2px solid #a7b8dd;
  outline-offset: 2px;
}

.auth-form .primary-action {
  min-height: 3rem;
  margin-top: 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: #f4f4f5;
  color: #111318;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.auth-form .primary-action:hover {
  background: #d9dadd;
}

.auth-form .auth-alternative {
  margin: 0;
  color: #aeb3bd;
  font-size: 0.9375rem;
  text-align: center;
}

.auth-form .auth-alternative a {
  color: #f4f4f5;
  font-weight: 700;
  text-underline-offset: 0.2em;
}

.auth-form .auth-alternative a:hover {
  color: #cbd6ee;
}

.session-view {
  width: min(100%, 28rem);
  color: #f4f4f5;
  text-align: center;
}

.session-view h1 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 2.25rem;
  font-weight: 600;
}

.session-view p {
  margin: 0.75rem 0 2rem;
  color: #d8dae0;
}

.session-view form {
  margin-bottom: 1rem;
}

.session-view button,
.session-view a {
  display: inline-grid;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 0.5rem;
  background: rgb(8 10 14 / 58%);
  color: #f4f4f5;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  place-items: center;
  text-underline-offset: 0.2em;
}

.session-view button:hover,
.session-view a:hover {
  background: rgb(255 255 255 / 10%);
}

.billing-view {
  width: min(100%, 68rem);
  color: #f4f4f5;
  text-align: center;
}

.billing-view > header {
  margin-bottom: 3rem;
}

.billing-view h1 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
}

.billing-view > header p {
  margin: 0.75rem 0 0;
  color: #d8dae0;
}

.billing-message {
  width: fit-content;
  margin: -1.5rem auto 2rem;
  color: #fee2e2;
}

.billing-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.billing-plan {
  padding: 0.5rem 2.5rem;
}

.billing-plan + .billing-plan {
  border-left: 1px solid rgb(255 255 255 / 40%);
}

.billing-plan h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: 1.75rem;
  font-weight: 600;
}

.billing-price {
  display: grid;
  min-height: 7rem;
  margin: 1.25rem 0 1.75rem;
  align-content: center;
}

.billing-price strong {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 600;
  line-height: 1;
}

.billing-price span {
  margin-top: 0.5rem;
  color: #aeb3bd;
}

.billing-plan button,
.billing-actions button,
.billing-actions a {
  display: inline-grid;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 0.5rem;
  background: rgb(8 10 14 / 58%);
  color: #f4f4f5;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  place-items: center;
  text-underline-offset: 0.2em;
}

.billing-plan button:hover,
.billing-actions button:hover,
.billing-actions a:hover {
  background: rgb(255 255 255 / 10%);
}

.billing-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  align-items: center;
}

.billing-actions form {
  margin: 0;
}

.onboarding-view {
  width: min(100%, 68rem);
  padding: 3rem 0;
  color: #f4f4f5;
}

.onboarding-view > header {
  margin-bottom: 3rem;
  text-align: center;
}

.onboarding-view h1,
.onboarding-view h2,
.onboarding-view h3,
.onboarding-view p {
  margin-top: 0;
}

.onboarding-view h1 {
  margin-bottom: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
}

.onboarding-view > header p {
  margin: 0.75rem 0 0;
  color: #d8dae0;
  text-wrap: balance;
}

.onboarding-message {
  margin: -1.25rem 0 1.5rem;
  color: #fee2e2;
  text-align: center;
}

.onboarding-view form {
  display: grid;
}

.onboarding-section {
  padding: 2.25rem 0;
  border-top: 1px solid rgb(255 255 255 / 40%);
}

.onboarding-section > header h2,
.area-fieldset legend {
  font-family: Newsreader, Georgia, serif;
  font-size: 1.75rem;
  font-weight: 600;
}

.onboarding-section > header h2 {
  margin-bottom: 1.5rem;
}

.company-fields,
.competitor-fields {
  display: grid;
  grid-template-columns: minmax(12rem, 0.8fr) minmax(18rem, 1.5fr);
  gap: 1.25rem;
}

.field-group {
  display: grid;
  align-content: start;
  gap: 0.5rem;
}

.field-group label {
  color: #d8dae0;
  font-weight: 600;
}

.field-group input {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 0.5rem;
  background: rgb(8 10 14 / 58%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%);
  color: #f4f4f5;
  backdrop-filter: blur(8px);
  font: inherit;
}

.field-group input::placeholder {
  color: #9a9fa8;
}

.field-group input:focus-visible,
.area-option input:focus-visible,
.onboarding-view button:focus-visible {
  outline: 2px solid rgb(167 184 221 / 70%);
  outline-offset: 2px;
}

.field-group input[aria-invalid="true"] {
  border-color: rgb(248 113 113 / 70%);
}

.field-error {
  margin: 0;
  color: #fecaca;
  font-size: 0.875rem;
}

.area-fieldset {
  min-width: 0;
  margin: 2.5rem 0 0;
  padding: 2.25rem 0 0;
  border: 0;
  border-top: 1px solid rgb(255 255 255 / 22%);
}

.area-fieldset legend {
  padding: 0;
}

.area-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.25rem 0 1.5rem;
  color: #d8dae0;
}

.area-heading p,
.competitor-heading p {
  margin-bottom: 0;
}

.area-heading output {
  flex: none;
  color: #f4f4f5;
  font-weight: 700;
}

.area-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1.25rem;
}

.area-option {
  display: flex;
  min-height: 3rem;
  gap: 0.75rem;
  align-items: center;
  color: #d8dae0;
  cursor: pointer;
}

.area-option input {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  accent-color: #f4f4f5;
}

.area-option:has(input:disabled) {
  cursor: default;
  opacity: 0.45;
}

.competitor-heading {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.competitor-heading h2 {
  margin-bottom: 0.25rem;
}

.competitor-heading p {
  color: #d8dae0;
}

.competitor-list {
  display: grid;
}

.competitor-row {
  padding: 1.5rem 0;
}

.competitor-row + .competitor-row {
  border-top: 1px solid rgb(255 255 255 / 22%);
}

.competitor-row h3 {
  margin-bottom: 0.75rem;
  color: #d8dae0;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.competitor-fields {
  grid-template-columns: minmax(12rem, 0.8fr) minmax(18rem, 1.5fr) auto;
  align-items: start;
}

.onboarding-view button,
.onboarding-view .primary-action {
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 0.5rem;
  background: rgb(8 10 14 / 58%);
  color: #f4f4f5;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.onboarding-view button:hover {
  background: rgb(255 255 255 / 10%);
}

.onboarding-view button:disabled {
  cursor: default;
  opacity: 0.4;
}

.onboarding-view .primary-action {
  justify-self: end;
  min-width: 12rem;
  margin-top: 0.75rem;
  border-color: #f4f4f5;
  background: #f4f4f5;
  color: #111318;
}

.onboarding-view .primary-action:hover {
  background: #d9dadd;
}

.remove-competitor {
  align-self: end;
}

.analysis-status-view,
.graph-view {
  width: min(76rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 4rem 0;
}

.analysis-status-view {
  max-width: 42rem;
  min-height: 70vh;
  color: #f4f4f5;
  display: grid;
  align-content: center;
  gap: 1rem;
}

.analysis-status-view h1,
.graph-view h1,
.evidence-panel h2 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-weight: 600;
}

.analysis-status-view h1,
.graph-view h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.95;
}

.graph-header p,
.evidence-panel > p {
  color: #62665d;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: #85897d;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.graph-view {
  min-width: 0;
  max-width: 100%;
  padding: 2rem;
  border-radius: 1rem;
  background: #f4f4ef;
  color: #181813;
}

.graph-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.graph-header > div {
  max-width: 48rem;
}

.domain-picker {
  min-width: 18rem;
}

.domain-picker label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.domain-picker select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid #c7cabf;
  border-radius: 0.45rem;
  background: #fff;
  color: #181813;
}

.graph-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #d7d9d1;
  border-radius: 1rem;
}

.graph-scroll-hint {
  display: none;
}

.graph-canvas {
  height: min(64vh, 46rem);
  min-height: 32rem;
  background:
    radial-gradient(circle at center, rgb(24 24 19 / 4%) 0 1px, transparent 1px) 0 0 / 24px 24px,
    #f8f8f5;
}

.evidence-panel {
  margin-top: 4rem;
}

.evidence-panel h2 {
  font-size: 2.2rem;
}

.evidence-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.evidence-item {
  padding: 1.25rem;
  border: 1px solid #d7d9d1;
  border-radius: 0.75rem;
  background: #fff;
}

.evidence-item header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.evidence-item blockquote {
  margin: 1rem 0;
  color: #383a34;
}

.evidence-item a,
.analysis-status-view a {
  color: #3d5141;
  font-weight: 700;
}

@media (max-width: 44rem) {
  .billing-view > header {
    margin-bottom: 2rem;
  }

  .billing-plans {
    grid-template-columns: 1fr;
  }

  .billing-plan {
    padding: 2rem 0.5rem;
  }

  .billing-plan + .billing-plan {
    border-top: 1px solid rgb(255 255 255 / 40%);
    border-left: 0;
  }

  .billing-price {
    min-height: auto;
  }

  .billing-actions {
    flex-direction: column;
  }

  .analysis-status-view,
  .graph-view {
    width: 100%;
    padding: 2rem 0;
  }

  .graph-view {
    padding: 1rem;
  }

  .graph-header {
    align-items: stretch;
    flex-direction: column;
  }

  .domain-picker {
    min-width: 0;
  }

  .graph-scroll-hint {
    display: block;
    margin: 0 0 0.5rem;
    color: #62665d;
    font-size: 0.8rem;
  }

  .graph-canvas {
    min-width: 52rem;
    height: 32rem;
    min-height: 32rem;
  }

  .evidence-list {
    grid-template-columns: 1fr;
  }

  .onboarding-view {
    padding: 1rem 0;
  }

  .onboarding-view > header {
    margin-bottom: 2rem;
    text-align: left;
  }

  .company-fields,
  .competitor-fields,
  .area-options {
    grid-template-columns: 1fr;
  }

  .area-heading,
  .competitor-heading {
    flex-direction: column;
  }

  .competitor-heading .secondary-action,
  .remove-competitor,
  .onboarding-view .primary-action {
    width: 100%;
  }

  .remove-competitor {
    margin-top: 0.25rem;
  }

  .onboarding-view .primary-action {
    justify-self: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-form .password-toggle {
    transition: none;
  }
}
