/* ==========================================================================
   MY AI TYPE — Digital Najeon design system
   "생각의 파도 × 현대 자개": a quiet dark surface where small nacre-colored
   fragments and slow waves carry the light. Deep dark dominates; nacre
   color is reserved for small accents only (glyphs, borders, the crest).
   ========================================================================== */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
               "Malgun Gothic", "Noto Sans KR", sans-serif;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.35; margin: 0 0 0.6em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; }
button { font-family: inherit; }

:root {
  /* Design tokens */
  --bg-deep: #080B0E;
  --bg-surface: #101820;
  --bg-surface-2: #141d26;

  --text-primary: #F2EFE8;
  --text-muted: #9DA4A8;

  --pearl-silver: #D8DEE2;
  --nacre-cyan: #72D5D0;
  --nacre-blue: #779BD8;
  --nacre-violet: #AE8BC9;
  --nacre-rose: #D89BAF;

  --line: rgba(216, 222, 226, 0.14);
  --line-soft: rgba(216, 222, 226, 0.08);
  --card-bg: var(--bg-surface);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --nacre-gradient: linear-gradient(120deg, var(--nacre-cyan), var(--nacre-blue), var(--nacre-violet), var(--nacre-rose));
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--pearl-silver);
  color: var(--bg-deep);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 10px; top: 10px; }

.mobile-only { display: inline; }

/* ---------- Header ---------- */
.site-header {
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.brand-block { display: flex; flex-direction: column; line-height: 1.2; }
.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}
.brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 56px 0 48px;
  text-align: center;
  background: var(--bg-deep);
  overflow: hidden;
}
.hero-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
}
.hero-wave .wave-line {
  fill: none;
  stroke-width: 1;
  opacity: 0.35;
}
.hero-wave .wave-line--cyan { stroke: var(--nacre-cyan); }
.hero-wave .wave-line--blue { stroke: var(--nacre-blue); }
.hero-wave .wave-line--violet { stroke: var(--nacre-violet); }
.hero-wave .wave-chip { opacity: 0.6; }
.hero-wave .wave-group {
  animation: wave-drift 34s linear infinite;
  transform-origin: center;
}
.hero-wave .wave-group--slow {
  animation-duration: 48s;
  animation-direction: reverse;
}
@keyframes wave-drift {
  0% { transform: translateX(0); }
  50% { transform: translateX(-14px); }
  100% { transform: translateX(0); }
}

.hero-glyph {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  color: var(--pearl-silver);
  opacity: 0.85;
}

.hero .wrap { position: relative; z-index: 1; }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 20px;
  font-family: var(--mono);
}
.hero h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
  color: var(--text-primary);
}
.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 30px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.btn:hover, .btn:focus-visible {
  border-color: var(--nacre-cyan);
  background: rgba(114, 213, 208, 0.06);
}
.btn:active { background: rgba(114, 213, 208, 0.1); }
.btn-primary {
  background: var(--text-primary);
  color: var(--bg-deep);
  border-color: var(--text-primary);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--pearl-silver);
  border-color: var(--nacre-cyan);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--line);
}
.btn-large {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.02rem;
}
.btn-copy { display: flex; align-items: center; justify-content: center; gap: 8px; }
.copy-icon { font-size: 1.1em; }

@media (min-width: 700px) {
  .btn-large { width: auto; }
}

/* ---------- Sections ---------- */
section { padding: 44px 0; }
section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text-primary);
}
.section-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.concept {
  background: var(--bg-surface);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.callout {
  background: var(--bg-surface-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--nacre-blue);
  border-radius: 8px;
  padding: 16px 18px;
  margin-top: 20px;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.callout p { margin: 0; }
.callout strong { color: var(--text-primary); }

/* ---------- How it works ---------- */
.steps { list-style: none; display: flex; flex-direction: column; gap: 22px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step-num {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--pearl-silver);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.92rem;
}
.step h3 { font-size: 1.02rem; margin-bottom: 4px; color: var(--text-primary); }
.step p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Diagnostic prompt ---------- */
.diagnose {
  background: var(--bg-surface);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.prompt-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  margin: 20px 0 16px;
}
.prompt-details summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
  color: var(--text-primary);
}
.prompt-details summary::-webkit-details-marker { display: none; }
.prompt-details summary::before {
  content: "▸ ";
  color: var(--nacre-cyan);
}
.prompt-details[open] summary::before { content: "▾ "; }
.prompt-pre {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: break-word;
  background: var(--bg-deep);
  border-top: 1px solid var(--line-soft);
  padding: 16px 14px;
  margin: 0;
  max-height: 420px;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
  color: var(--text-muted);
}
.copy-feedback {
  min-height: 1.4em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--nacre-cyan);
  text-align: center;
  margin-top: 10px;
}

/* ---------- Examples ---------- */
.example-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.example-list li {
  background: var(--bg-surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-family: var(--mono);
  color: var(--text-muted);
}
.example-note {
  color: var(--text-muted);
  font-size: 0.88rem;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

/* ---------- Share: paste & parse ---------- */
.share { background: var(--bg-deep); }
.paste-block { display: flex; flex-direction: column; gap: 8px; }
.paste-block label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}
.paste-block textarea,
.optional-feedback select,
.optional-feedback textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-surface-2);
  color: var(--text-primary);
  resize: vertical;
  width: 100%;
}
.paste-block textarea {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
}
.paste-block textarea:focus,
.optional-feedback select:focus,
.optional-feedback textarea:focus {
  outline: 2px solid var(--nacre-cyan);
  outline-offset: 1px;
}
.paste-meta {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.privacy-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}
.paste-block .btn-large { margin-top: 6px; }
.parse-status {
  min-height: 1.4em;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: pre-line;
  margin: 0;
  color: var(--text-muted);
}
.parse-status-success { color: var(--nacre-cyan); }
.parse-status-error { color: var(--nacre-rose); }

.share-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.share-actions .btn { flex: 1 1 auto; }

/* ---------- Result card preview (on-page) ---------- */
.share-result {
  margin-top: 24px;
}
.result-card {
  background: linear-gradient(180deg, var(--bg-surface-2), var(--bg-deep));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 22px 24px;
  text-align: center;
  max-width: 340px;
  margin: 0 auto;
  animation: crest-appear 0.5s ease both;
}
@keyframes crest-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-card-brand {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.result-card-crest {
  width: 128px;
  height: 128px;
  margin: 0 auto 16px;
}
.result-card-type {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 18px;
  line-height: 1.4;
}
.result-card-roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  text-align: left;
}
.result-role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}
.result-role-glyph { width: 16px; height: 16px; flex: none; color: var(--pearl-silver); }
.result-role-name { flex: 1; color: var(--text-primary); }
.result-role-pct { font-family: var(--mono); color: var(--text-muted); font-size: 0.78rem; }
.result-role-bar-track {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
  margin-top: 4px;
}
.result-role-bar-fill {
  position: absolute;
  inset: 0;
  width: 0;
  border-radius: 999px;
  background: var(--nacre-gradient);
  opacity: 0.85;
}
.result-role-row-wrap { display: flex; flex-direction: column; gap: 3px; }

.result-card-divider {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 0 0 16px;
}
.result-card-traits {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.result-trait-row { display: flex; gap: 10px; align-items: baseline; }
.result-trait-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--nacre-cyan);
  flex: none;
}
.result-trait-text { font-size: 0.86rem; color: var(--text-muted); line-height: 1.5; }

.result-card-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.image-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.image-actions .btn { flex: 1 1 140px; }

/* ---------- Optional feedback (below card) ---------- */
.optional-feedback {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.optional-feedback-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}
.optional-feedback-title span {
  font-weight: 400;
  color: var(--text-muted);
}

.feedback-placeholder {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.feedback-placeholder p { margin: 0; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 28px 0 40px;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.site-footer p { margin: 0 0 6px; }

/* ---------- Glyph symbol library defaults ---------- */
svg.glyph-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.glyph {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.glyph-dot { fill: currentColor; stroke: none; }

/* ---------- Larger screens ---------- */
@media (min-width: 700px) {
  .wrap { max-width: 720px; }
  .hero { padding: 84px 0 64px; }
  .hero h1 { font-size: 2.5rem; }
  .hero-sub { font-size: 1.08rem; }
  .mobile-only { display: none; }
  section { padding: 64px 0; }
  section h2 { font-size: 1.55rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .hero-wave .wave-group { animation: none; }
  .result-card { animation: none; }
}
