:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5c675f;
  --line: #dce3dd;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --green: #2f6b4f;
  --green-dark: #214f3a;
  --mint: #e7f1e9;
  --gold: #e5b64a;
  --rose: #d96f5f;
  --blue: #356b8c;
  --shadow: 0 18px 45px rgba(23, 32, 27, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.hero {
  background:
    linear-gradient(rgba(15, 36, 26, 0.74), rgba(15, 36, 26, 0.5)),
    url("https://images.unsplash.com/photo-1559027615-cd4628902d4a?auto=format&fit=crop&w=1800&q=80") center/cover;
  color: #fff;
  min-height: 62vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(18px, 4vw, 54px);
  gap: 20px;
}

.brand {
  font-size: 1.3rem;
  font-weight: 800;
}

.nav-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-pills a {
  text-decoration: none;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
}

.hero-inner {
  width: min(980px, calc(100% - 36px));
  margin: auto auto 7vh;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  color: #f3d784;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  margin: 22px 0 0;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.9;
}

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

.section {
  margin-top: 22px;
}

.search-grid,
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.panel,
.prompt-card,
.email-output,
.candidate-card,
.summary,
.message {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.prompt-card,
.email-output {
  padding: 22px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading.inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.05rem;
}

.label {
  color: var(--green);
  font-size: 0.78rem;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
}

legend {
  margin-bottom: 9px;
  font-weight: 800;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 13px;
  cursor: pointer;
  min-height: 40px;
}

.chip.selected {
  border-color: var(--green);
  background: var(--mint);
  color: var(--green-dark);
  font-weight: 800;
}

.chip.primary-choice.selected {
  background: var(--green);
  color: #fff;
}

.fixed-value {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 13px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--blue);
  font-weight: 800;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #9aaaa0;
}

.secondary-button {
  background: #eef2f5;
  color: var(--ink);
}

.secondary-button.small {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 0.85rem;
}

.prompt-text {
  margin: 0;
  line-height: 1.85;
  font-weight: 700;
}

.notice,
.helper,
.count-text {
  color: var(--muted);
  line-height: 1.7;
}

.notice {
  border-top: 1px solid var(--line);
  margin: 18px 0 0;
  padding-top: 16px;
}

.status-pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.message,
.summary {
  padding: 16px;
  margin-bottom: 14px;
  line-height: 1.75;
}

.message {
  border-left: 5px solid var(--rose);
}

.message[data-type="info"] {
  border-left-color: var(--blue);
}

.wait-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 28, 22, 0.58);
  backdrop-filter: blur(4px);
}

.wait-modal[hidden] {
  display: none;
}

.wait-dialog {
  width: min(360px, 100%);
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 26px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 5px solid #dce3dd;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.wait-title {
  margin: 0 0 8px;
  font-weight: 800;
  font-size: 1.08rem;
}

.wait-detail {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.wait-steps {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
  text-align: left;
}

.wait-steps li {
  position: relative;
  padding-left: 28px;
  color: var(--muted);
  font-weight: 700;
}

.wait-steps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.25rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
}

.wait-steps li.done::before {
  border-color: var(--green);
  background: var(--green);
}

.wait-steps li.active {
  color: var(--ink);
}

.wait-steps li.active::before {
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--mint);
}

.wait-log {
  list-style: none;
  margin: 16px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
  text-align: left;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.wait-log:empty {
  display: none;
}

.wait-log li {
  position: relative;
  padding-left: 18px;
}

.wait-log li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

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

.summary {
  border-left: 5px solid var(--green);
}

.candidate-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.candidate-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.candidate-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.candidate-title {
  margin: 0;
  font-size: 1.08rem;
}

.confidence {
  align-self: flex-start;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.confidence.high {
  background: var(--mint);
  color: var(--green-dark);
}

.confidence.medium {
  background: #fff1c9;
  color: #735717;
}

.confidence.low {
  background: #fbe1dd;
  color: #87392f;
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.decision-item {
  background: #f7f8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.decision-item span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  margin-bottom: 3px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  background: #eef2f5;
  color: var(--blue);
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.candidate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toggle-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-weight: 800;
}

.toggle-button.active {
  border-color: var(--green);
  background: var(--mint);
  color: var(--green-dark);
}

.candidate-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  line-height: 1.75;
}

.candidate-details p {
  margin: 0 0 10px;
}

.candidate-details ul {
  margin: 7px 0 0;
  padding-left: 1.2rem;
}

.source-link {
  word-break: break-all;
  color: var(--green-dark);
  font-weight: 800;
}

.source-missing {
  color: var(--muted);
  font-weight: 800;
}

.mini-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 11px;
  background: #fff;
}

.email-output {
  min-width: 0;
}

.output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  line-height: 1.75;
  color: var(--ink);
  font-family: inherit;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    min-height: 70vh;
  }

  .search-grid,
  .two-column,
  .candidate-list {
    grid-template-columns: 1fr;
  }

  .panel,
  .prompt-card,
  .email-output {
    padding: 18px;
  }

  .section-heading.inline {
    align-items: flex-start;
    flex-direction: column;
  }

  .candidate-actions,
  .decision-grid {
    grid-template-columns: 1fr;
  }
}
