:root {
  --bg: #f6f5f4;
  --surface: #ffffff;
  --text: rgba(0, 0, 0, 0.95);
  --muted: #615d59;
  --soft: #a39e98;
  --border: rgba(0, 0, 0, 0.1);
  --blue: #0075de;
  --blue-dark: #005bab;
  --green: #1a7f45;
  --orange: #b54d00;
  --red: #c73535;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.027);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fff 0, var(--bg) 340px);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.35;
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-weight: 650;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

button:hover {
  background: var(--blue-dark);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(9, 127, 232, 0.28);
  outline-offset: 2px;
}

input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d7d4d1;
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 72px;
  margin-top: 6px;
  resize: vertical;
}

.login-page main {
  width: min(430px, calc(100% - 32px));
  margin-top: min(14vh, 120px);
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-page h1 {
  font-size: 2rem;
}

.login-page form {
  display: grid;
  gap: 18px;
}

.login-page label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

[role="alert"] {
  padding: 10px 12px;
  border-radius: 6px;
  color: #8f1f1f;
  background: #fff1f1;
}

.home-page main > form {
  position: absolute;
  top: 24px;
  right: max(16px, calc((100vw - 1180px) / 2));
}

.home-page main > form button {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

.project-card {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.project-card p {
  margin-bottom: 0;
}

.project-page main > a {
  display: inline-block;
  margin-bottom: 32px;
  color: var(--muted);
  font-weight: 600;
}

.query-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 24px;
}

.method-column {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.method-column > header {
  min-height: 96px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfaf9;
}

.method-column h3 {
  margin-bottom: 6px;
}

.pipeline {
  color: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
}

.result-card {
  padding: 18px;
}

.result-card + .result-card {
  border-top: 1px solid var(--border);
}

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--green);
  background: #ecf8f0;
  font-size: 0.72rem;
  font-weight: 700;
}

.result-text {
  margin: 14px 0;
  color: var(--text);
  font-weight: 600;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0 0 16px;
  font-size: 0.82rem;
}

dt {
  color: var(--soft);
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}

audio {
  width: 100%;
  height: 40px;
  margin-bottom: 18px;
}

.rating-form {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.86rem;
}

.rating-form fieldset {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}

.rating-form legend {
  margin-bottom: 8px;
  font-weight: 700;
}

.rating-form fieldset label {
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
}

.rating-form > label {
  display: block;
}

.rating-form button {
  width: 100%;
}

.empty-result {
  padding: 18px;
}

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

  .method-column > header {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 20px, 1180px);
    padding-top: 28px;
  }

  .login-page main {
    margin-top: 24px;
    padding: 24px;
  }

  .home-page main > form {
    position: static;
    margin-bottom: 24px;
  }

  .home-page main {
    display: flex;
    flex-direction: column;
  }

  .home-page main > form {
    order: -1;
    align-self: flex-end;
  }

  .project-card,
  .result-card {
    padding: 16px;
  }

  .rating-form fieldset {
    grid-template-columns: 1fr;
  }
}
