:root {
  color-scheme: dark;
  --ink: #f4f7f0;
  --muted: #9aa69d;
  --panel: rgba(16, 24, 23, 0.88);
  --panel-strong: #131d1b;
  --line: rgba(197, 224, 206, 0.14);
  --green: #8fe2a8;
  --green-dark: #163f2a;
  --amber: #f3c778;
  --red: #ff9f91;
  --blue: #9ac7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(64, 135, 93, 0.25), transparent 33rem),
    radial-gradient(circle at 90% 70%, rgba(57, 105, 129, 0.18), transparent 32rem),
    #08100f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(143, 226, 168, 0.42);
  outline-offset: 2px;
}

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 64px;
}

.hero,
.section-heading,
.result-toolbar,
.trial-header,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.step,
.trial-id {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 850px;
  margin-bottom: 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 7vw, 6.2rem);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.lead {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.service-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.86rem;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px currentColor;
}

.service-state.ready .state-dot {
  background: var(--green);
}

.service-state.offline .state-dot {
  background: var(--red);
}

.warning {
  margin: 34px 0 22px;
  padding: 15px 18px;
  border: 1px solid rgba(243, 199, 120, 0.25);
  border-radius: 12px;
  color: #eadbbd;
  background: rgba(86, 61, 23, 0.22);
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(450px, 1.2fr);
  gap: 18px;
}

.input-panel,
.result-panel {
  min-height: 580px;
  padding: clamp(24px, 3vw, 42px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(20px);
}

.input-panel {
  display: flex;
  flex-direction: column;
}

label {
  margin: 42px 0 10px;
  color: #d8e1da;
  font-size: 0.86rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 330px;
  flex: 1;
  resize: vertical;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(5, 10, 9, 0.66);
  line-height: 1.65;
}

.form-footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.78rem;
}

.primary-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 13px 18px;
  border-radius: 9px;
  color: #07110a;
  background: var(--green);
  font-weight: 800;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.text-button {
  padding: 6px 0;
  color: var(--green);
  background: transparent;
  font-weight: 750;
}

.result-panel {
  overflow: hidden auto;
}

.empty-state,
.loading-state,
.error-state {
  display: grid;
  min-height: 490px;
  place-content: center;
  text-align: center;
}

.empty-state > p:last-child,
.error-state > p:last-child {
  max-width: 440px;
  color: var(--muted);
  line-height: 1.6;
}

.empty-mark {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 28px;
  place-items: center;
  border: 1px solid rgba(143, 226, 168, 0.34);
  border-radius: 50%;
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 1.3rem;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 24px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loading-state ol {
  margin: 18px auto 0;
  padding-left: 20px;
  color: var(--muted);
  text-align: left;
  line-height: 1.9;
}

.profile-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 28px 0 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.profile-item {
  min-height: 76px;
  padding: 14px;
  background: var(--panel-strong);
}

.profile-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.trial-card {
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 13, 12, 0.55);
}

.trial-title {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.4;
}

.status-badge,
.criterion-status {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.potentially_eligible,
.met {
  color: var(--green);
  background: var(--green-dark);
}

.insufficient_information,
.unknown {
  color: var(--amber);
  background: rgba(91, 65, 21, 0.6);
}

.not_eligible,
.not_met {
  color: var(--red);
  background: rgba(86, 35, 31, 0.65);
}

.trial-summary,
.trial-meta,
.criterion p,
.result-notice {
  color: var(--muted);
  line-height: 1.55;
}

.trial-summary {
  margin: 14px 0;
}

.trial-meta {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}

.criterion {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  padding-top: 16px;
}

.criterion h4,
.criterion p {
  margin: 0;
}

.criterion p {
  grid-column: 2;
  font-size: 0.85rem;
}

.result-notice {
  margin: 20px 0 0;
  font-size: 0.78rem;
}

.hero-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  display: flex;
  width: min(420px, 100%);
  flex-direction: column;
  padding: clamp(28px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.auth-card h2 {
  margin-bottom: 8px;
}

.auth-lead {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-card label {
  margin: 22px 0 8px;
}

.auth-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(5, 10, 9, 0.66);
}

.auth-card .primary-button {
  justify-content: space-between;
  margin-top: 26px;
}

.auth-error {
  margin: 16px 0 0;
  padding: 11px 14px;
  border: 1px solid rgba(255, 159, 145, 0.28);
  border-radius: 10px;
  color: var(--red);
  background: rgba(86, 35, 31, 0.35);
  font-size: 0.86rem;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

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

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

  .input-panel,
  .result-panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 24px, 1440px);
    padding-top: 28px;
  }

  .hero,
  .section-heading,
  .result-toolbar,
  .trial-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .service-state {
    align-self: flex-start;
  }
}
