:root {
  --navy: #102c4c;
  --blue: #1769d2;
  --blue-2: #4898f2;
  --brand-primary: #1769d2;
  --brand-accent: #4898f2;
  --ice: #eaf3ff;
  --cream: #f7f5ef;
  --paper: #fffefb;
  --ink: #182433;
  --muted: #617083;
  --line: #dce4ec;
  --success: #0f7a5f;
  --warning: #9b5c00;
  --shadow: 0 24px 70px rgba(16, 44, 76, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(72, 152, 242, 0.15), transparent 26rem),
    linear-gradient(140deg, #f3f8fe 0%, var(--cream) 54%, #f1f0e9 100%);
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 17px;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px clamp(20px, 4vw, 64px) 54px;
}

.hero {
  position: relative;
  padding: 12px 4px 44px;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  width: 24px;
  height: 10px;
  border-radius: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  transform: rotate(-12deg);
}

.hero-copy {
  max-width: none;
  padding-top: 48px;
}

.eyebrow,
.step {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 22px;
  color: var(--navy);
  font-size: clamp(2.55rem, 5.1vw, 4.65rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
  word-break: keep-all;
  overflow-wrap: normal;
}

.headline-line {
  display: inline-block;
  white-space: nowrap;
}

h1 em {
  color: var(--blue);
  font-style: normal;
}

.service-title {
  display: flex;
  align-items: baseline;
  gap: clamp(8px, 1.2vw, 18px);
  width: max-content;
  margin-bottom: 18px;
  color: var(--brand-primary);
  font-size: clamp(4rem, 8vw, 7rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.075em;
  white-space: nowrap;
}

.service-dot {
  color: var(--brand-accent);
  font-size: 0.58em;
  line-height: 1;
}

.service-subtitle {
  margin-bottom: 16px;
  color: #347fcf;
  font-size: clamp(1.65rem, 3.2vw, 2.75rem);
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.service-promise {
  max-width: 830px;
  margin-bottom: 16px;
  color: var(--navy);
  font-size: clamp(1.3rem, 2.15vw, 1.9rem);
  font-weight: 820;
  line-height: 1.35;
  letter-spacing: -0.035em;
  word-break: keep-all;
}

.service-promise em {
  color: var(--blue);
  font-style: normal;
}

.intro {
  max-width: 670px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.75;
}

.hero-message {
  color: var(--ink);
  font-size: clamp(1.02rem, 1.55vw, 1.27rem);
  font-weight: 650;
  line-height: 1.65;
}

.trust-strip {
  position: absolute;
  right: 5px;
  bottom: 46px;
  display: flex;
  gap: 25px;
  color: var(--muted);
  font-size: 0.78rem;
}

.trust-strip span {
  display: grid;
  gap: 3px;
  min-width: 72px;
}

.trust-strip b {
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 1.25rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(370px, 0.9fr) minmax(440px, 1.1fr);
  min-height: 670px;
  overflow: hidden;
  border: 1px solid rgba(16, 44, 76, 0.08);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.query-panel,
.result-panel {
  padding: clamp(28px, 4vw, 54px);
}

.query-panel {
  border-right: 1px solid var(--line);
}

.section-heading,
.result-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading > div:first-child,
.result-topline > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

#question-heading {
  word-break: keep-all;
  overflow-wrap: normal;
  text-wrap: balance;
}

h2 {
  margin-bottom: 24px;
  color: var(--navy);
  font-size: clamp(1.55rem, 2vw, 2.15rem);
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.domain-switch {
  display: flex;
  flex: 0 0 auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f7f9fb;
}

.domain-button {
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 800;
}

.domain-button.active {
  color: white;
  background: var(--navy);
  box-shadow: 0 5px 14px rgba(16, 44, 76, 0.22);
}

.query-label {
  display: block;
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 850;
}

textarea {
  width: 100%;
  min-height: 168px;
  padding: 20px;
  resize: vertical;
  border: 1px solid #ccd8e4;
  border-radius: 16px;
  outline: none;
  color: var(--ink);
  background: white;
  font-size: 1rem;
  line-height: 1.65;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(23, 105, 210, 0.1);
}

textarea::placeholder {
  color: #93a0af;
}

.input-help {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.examples {
  margin-top: 25px;
}

.examples-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.example-chip {
  max-width: 100%;
  overflow: hidden;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy);
  background: white;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.example-chip:hover,
.example-chip:focus-visible {
  border-color: var(--blue-2);
  background: var(--ice);
}

.submit-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 28px;
  padding: 17px 19px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: linear-gradient(100deg, var(--navy), #184f83);
  font-weight: 850;
  box-shadow: 0 13px 28px rgba(16, 44, 76, 0.2);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.submit-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(16, 44, 76, 0.25);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.66;
  transform: none;
}

.arrow {
  font-size: 1.35rem;
}

.runtime-note {
  min-height: 18px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.result-panel {
  position: relative;
  background:
    linear-gradient(rgba(234, 243, 255, 0.46), rgba(255, 255, 255, 0.9)),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(16, 44, 76, 0.025) 32px);
}

.result-panel.empty {
  display: grid;
  place-items: center;
}

.empty-state,
.loading-state,
.error-state {
  max-width: 460px;
  text-align: center;
}

.empty-state h2,
.loading-state h2,
.error-state h2 {
  margin-bottom: 14px;
}

.empty-state > p:last-child,
.loading-state > p:last-child,
.error-state > p:last-child {
  color: var(--muted);
  line-height: 1.7;
}

.orbit {
  position: relative;
  width: 86px;
  height: 86px;
  margin: 0 auto 28px;
  border: 1px solid rgba(23, 105, 210, 0.25);
  border-radius: 50%;
}

.orbit::before,
.orbit::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(23, 105, 210, 0.16);
  border-radius: 50%;
}

.orbit::before {
  inset: 12px -15px;
  transform: rotate(38deg);
}

.orbit::after {
  inset: -15px 12px;
  transform: rotate(-38deg);
}

.orbit span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
}

.orbit span:nth-child(1) { top: 6px; left: 38px; }
.orbit span:nth-child(2) { right: 8px; bottom: 19px; background: var(--success); }
.orbit span:nth-child(3) { left: 9px; bottom: 16px; background: #f0a834; }

.hidden {
  display: none !important;
}

.loader {
  width: 58px;
  height: 58px;
  margin: 0 auto 25px;
  border: 4px solid #dce9f8;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.result-content {
  width: 100%;
}

.path-badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--success);
  background: #e4f5ef;
  font-size: 0.72rem;
  font-weight: 900;
}

.understanding-card,
.correction-card,
.common-reason {
  border-radius: 15px;
}

.understanding-card {
  padding: 17px 18px;
  border: 1px solid #cfe0f2;
  background: rgba(255, 255, 255, 0.78);
}

.correction-card {
  margin-top: 12px;
  padding: 17px 18px;
  border: 1px solid #efd49f;
  background: #fff7e8;
}

.card-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.correction-card .card-kicker {
  color: var(--warning);
}

.understanding-card p,
.correction-card p,
.common-reason p {
  margin: 0;
  line-height: 1.62;
}

.recommendation-section {
  margin-top: 22px;
}

.common-reason {
  display: flex;
  gap: 13px;
  padding: 17px 18px;
  color: white;
  background: var(--navy);
}

.common-reason .card-kicker {
  color: #86c2ff;
}

.reason-icon {
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: var(--navy);
  background: #8de2c5;
  font-weight: 900;
}

.recommendation-list {
  display: grid;
  gap: 11px;
  margin-top: 12px;
}

.recommendation-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 13px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  box-shadow: 0 7px 20px rgba(16, 44, 76, 0.06);
}

.rec-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--blue);
  background: var(--ice);
  font-family: Georgia, serif;
  font-weight: 900;
}

.rec-title {
  margin: 0 0 7px;
  color: var(--navy);
  font-size: 1.02rem;
  line-height: 1.35;
}

.rec-reason {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.evidence-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.evidence-tag {
  padding: 5px 8px;
  border-radius: 7px;
  color: #35506d;
  background: #f0f4f8;
  font-size: 0.78rem;
  font-weight: 750;
}

.provenance {
  margin: 15px 0 0;
  color: #7b8794;
  font-size: 0.76rem;
}

.error-symbol {
  display: grid;
  width: 56px;
  height: 56px;
  margin: 0 auto 24px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #c75d42;
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 900;
}

@media (max-width: 980px) {
  .headline-line {
    white-space: normal;
  }

  .trust-strip {
    position: static;
    margin-top: 34px;
  }

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

  .query-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-panel {
    min-height: 580px;
  }
}

@media (max-width: 590px) {
  .shell {
    padding: 20px 13px 34px;
  }

  .hero-copy {
    padding-top: 38px;
  }

  .service-title {
    gap: 7px;
    font-size: clamp(3.7rem, 20vw, 5.2rem);
  }

  .trust-strip {
    gap: 15px;
  }

  .section-heading,
  .result-topline {
    display: block;
  }

  .domain-switch {
    width: max-content;
    margin-bottom: 22px;
  }

  .query-panel,
  .result-panel {
    padding: 27px 20px;
  }

  .input-help {
    display: block;
  }

  #char-count {
    display: block;
    margin-top: 4px;
  }
}
