:root {
  --ink: #101827;
  --ink-2: #334155;
  --muted: #667085;
  --line: #d9e1ec;
  --line-soft: #edf1f7;
  --page: #f7f9fc;
  --surface: #ffffff;
  --blue: #2563eb;
  --teal: #0f766e;
  --red: #991b1b;
  --amber: #a8550f;
  --shadow: 0 18px 42px rgba(16, 24, 39, 0.08);
  --radius: 8px;
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 0 22px 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.brand-text {
  font-size: 0.98rem;
}

.topbar-note,
.muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.search-hero {
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 70px);
  align-content: center;
  padding: 10px 0 34px;
}

.search-hero.is-compact {
  min-height: auto;
  align-content: start;
  padding: 22px 0 8px;
}

.kicker {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search-hero > .kicker,
.search-hero h1,
.hero-copy {
  text-align: center;
}

.search-hero h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.search-hero.is-compact h1 {
  font-size: clamp(1.8rem, 3vw, 2.55rem);
}

.hero-copy {
  max-width: 680px;
  margin: 0 auto 4px;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.6;
}

.search-form {
  display: grid;
  gap: 12px;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(16, 24, 39, 0.08);
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 58px;
  max-height: 150px;
  resize: vertical;
  border: 0;
  outline: none;
  padding: 11px 14px;
  background: transparent;
  color: var(--ink);
  line-height: 1.55;
}

.search-box:focus-within {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 16px 38px rgba(16, 24, 39, 0.1);
}

.primary-btn,
.secondary-btn {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 850;
  white-space: nowrap;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
}

.secondary-btn {
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
}

.mic-btn {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
}

.mic-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mic-btn:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
}

.mic-btn.is-listening {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(153, 27, 27, 0.12);
}

.mic-btn:disabled {
  background: #f3f5f8;
  color: #9ca3af;
  cursor: not-allowed;
}

.voice-status {
  width: min(880px, 100%);
  min-height: 18px;
  margin: -3px auto 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.voice-status:empty {
  display: none;
}

.input-note {
  width: min(880px, 100%);
  margin: -4px auto 0;
  color: #7b8798;
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn:disabled {
  color: #9ca3af;
  background: #f3f5f8;
  cursor: not-allowed;
  transform: none;
}

.type-strip {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

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

.strip-head h2 {
  font-size: 0.92rem;
  letter-spacing: 0;
}

.strip-head span {
  color: var(--muted);
  font-size: 0.78rem;
}

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

.intake-card {
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink-2);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.1s;
}

.intake-card:hover {
  border-color: rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.intake-card[aria-pressed="true"] {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: inset 0 3px 0 var(--blue);
}

.intake-card strong {
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.25;
}

.intake-card span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.optional-details {
  width: min(880px, 100%);
  margin: 0 auto;
}

.optional-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.optional-details[open] {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff;
}

.optional-details[open] summary {
  margin-bottom: 12px;
  color: var(--ink-2);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.check-row span {
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--ink);
  outline: none;
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fff;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  line-height: 1.45;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.sample-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  width: min(880px, 100%);
  margin: 0 auto;
}

.sample-label {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.sample-strip button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.sample-strip button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.survey-section,
.result-panel,
.wide-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.survey-section {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 24px;
}

.result-panel {
  margin-top: 18px;
  min-height: 260px;
  padding: 24px;
}

.wide-section {
  margin-top: 18px;
  padding: 24px;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 210px;
  gap: 8px;
  color: var(--ink-2);
  text-align: center;
}

.empty-state h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.35;
}

.result-view {
  display: grid;
  gap: 16px;
}

.filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 800;
}

.verdict-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 154px;
  padding: 22px;
  border-radius: var(--radius);
  background: #111827;
  color: #fff;
}

.verdict-box[data-tone="danger"] {
  background: var(--red);
}

.verdict-box[data-tone="warning"] {
  background: var(--amber);
}

.verdict-box[data-tone="caution"] {
  background: #164e63;
}

.verdict-box[data-tone="neutral"] {
  background: #374151;
}

.verdict-box h2 {
  margin: 8px 0;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.verdict-box p:not(.kicker) {
  max-width: 720px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.62;
}

.score-dial {
  display: grid;
  place-items: center;
  align-content: center;
  width: 96px;
  height: 96px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  flex: 0 0 auto;
}

.score-dial strong {
  font-size: 2rem;
  line-height: 1;
}

.score-dial span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.72rem;
}

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

.decision-card {
  display: grid;
  gap: 7px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.decision-card[data-priority="high"] {
  border-color: #fecaca;
  background: #fff7f7;
}

.decision-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.decision-card h3 {
  color: var(--ink);
  font-size: 0.88rem;
}

.decision-card p {
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1.5;
}

.section-head {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.survey-section .section-head {
  margin-bottom: 0;
}

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

.section-head h2 {
  font-size: clamp(1.18rem, 2.2vw, 1.55rem);
  line-height: 1.28;
}

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

.result-card,
.entity-card,
.route-item,
.side-panel,
.markdown-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.result-card {
  min-height: 170px;
  padding: 18px;
}

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

.card-head h3,
.side-panel h3 {
  font-size: 0.95rem;
}

.card-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.stack-list {
  display: grid;
  gap: 8px;
}

.stack-item {
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  background: #fff;
}

.stack-item[data-tone="danger"] {
  border-left-color: var(--red);
}

.stack-item[data-tone="warning"] {
  border-left-color: var(--amber);
}

.stack-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.88rem;
}

.stack-item p {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.entity-card {
  min-height: 104px;
  padding: 14px;
}

.entity-card h3 {
  margin-bottom: 8px;
  color: var(--ink-2);
  font-size: 0.86rem;
}

.entity-card p,
.entity-card li {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.entity-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 17px;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.markdown-box,
.side-panel {
  padding: 18px;
}

.markdown-box {
  line-height: 1.72;
}

.markdown-box h1 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.markdown-box h2 {
  margin: 16px 0 7px;
  color: var(--teal);
  font-size: 1rem;
}

.markdown-box p {
  margin-bottom: 8px;
}

.plain-list {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
  padding-left: 18px;
}

.plain-list li {
  line-height: 1.6;
}

.action-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: action;
}

.action-list li {
  counter-increment: action;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  line-height: 1.55;
}

.action-list li::before {
  content: counter(action);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
}

.alternative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.alternative-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.alternative-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.alternative-card a {
  color: var(--blue);
}

.alternative-card p,
.alternative-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.alternative-card span {
  margin-top: 7px;
  color: var(--teal);
  font-weight: 750;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.route-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 9px;
}

.route-item {
  padding: 13px 14px;
}

.route-item strong {
  display: block;
  margin-bottom: 5px;
}

.route-item p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.route-item a {
  color: var(--blue);
  font-weight: 800;
}

.survey-actions {
  display: flex;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 750;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .intake-card-grid,
  .decision-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-layout,
  .result-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0 14px 42px;
  }

  .topbar-note {
    display: none;
  }

  .search-hero {
    min-height: auto;
    align-content: start;
    padding-top: 28px;
  }

  .search-hero h1 {
    font-size: 2rem;
  }

  .search-box {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .search-actions {
    display: grid;
    grid-template-columns: 44px 1fr;
  }

  .primary-btn {
    width: 100%;
  }

  .strip-head,
  .section-head.inline {
    align-items: start;
    flex-direction: column;
  }

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

  .intake-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intake-card {
    min-height: 70px;
    padding: 10px;
  }

  .intake-card strong {
    font-size: 0.78rem;
  }

  .intake-card span {
    font-size: 0.68rem;
  }

  .survey-section,
  .result-panel,
  .wide-section {
    padding: 18px;
  }

  .verdict-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-dial {
    align-self: flex-end;
    width: 82px;
    height: 82px;
  }

  .share-actions,
  .share-actions button,
  .survey-actions,
  .survey-actions button {
    width: 100%;
  }
}
