:root {
  color-scheme: light;
  --bg: #f6f1e8;
  --ink: #241d18;
  --muted: #756b62;
  --line: #ded2c4;
  --panel: #fffaf3;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --rose: #c75b64;
  --gold: #b7791f;
  --shadow: 0 20px 60px rgba(43, 31, 20, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, rgba(15, 118, 110, 0.16), transparent 28%), var(--bg);
  color: var(--ink);
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px max(18px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(222, 210, 196, 0.8);
  background: rgba(246, 241, 232, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 800;
}

.site-nav a,
.site-footer a {
  text-decoration: none;
}

.site-nav a:hover,
.site-footer a:hover {
  color: var(--accent-dark);
}

.app-shell,
.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.app-shell { padding: 36px 0 54px; }
.page-shell { padding: 56px 0; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  min-height: 180px;
  padding: 20px 0 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 820px;
  margin-bottom: 16px;
  font-size: clamp(2.3rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.score-card {
  display: grid;
  grid-template-columns: repeat(2, 92px);
  gap: 8px;
}
.score-card span {
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.72);
  color: var(--accent-dark);
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.upload-panel, .result-panel, .article-card, .type-list article, .text-page, .contact-box, .faq-list details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.9);
  box-shadow: var(--shadow);
}

.upload-panel { padding: 14px; }
.drop-zone {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
  border: 1px dashed #b9a998;
  border-radius: 8px;
  background: #efe6d8;
}
.drop-zone.dragging { border-color: var(--accent); outline: 4px solid rgba(15, 118, 110, 0.14); }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#previewCanvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; padding: 24px; text-align: center; pointer-events: none; }
.empty-state.hidden { display: none; }
.upload-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 4px; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 2rem; line-height: 1; }
.empty-state strong { font-size: 1.15rem; }
.empty-state small, .privacy-note { color: var(--muted); }
.privacy-note { margin: 12px 2px 0; font-size: 0.9rem; line-height: 1.6; }
.actions, .result-actions { display: flex; gap: 10px; margin-top: 14px; }
.primary, .ghost { min-height: 46px; border-radius: 8px; padding: 0 18px; font-weight: 900; }
.primary { flex: 1; background: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.ghost { border: 1px solid var(--line); background: #fffaf3; color: var(--ink); }
.ghost:hover:not(:disabled) { border-color: #a99784; }

.result-panel { min-height: 560px; padding: 26px; }
.result-empty { display: grid; min-height: 500px; place-items: center; color: var(--muted); text-align: center; }
.result-content { min-height: 500px; }
.animal-mark { display: grid; width: 86px; height: 86px; margin-bottom: 20px; place-items: center; border-radius: 8px; background: var(--ink); color: #fffaf3; font-size: 1rem; font-weight: 900; }
.result-kicker { margin-bottom: 8px; color: var(--accent-dark); font-size: 0.82rem; font-weight: 900; }
.result-content h2 { margin-bottom: 6px; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; letter-spacing: 0; }
.match { margin-bottom: 18px; color: var(--rose); font-weight: 900; }
.description { color: var(--muted); line-height: 1.7; }
.traits { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 24px; }
.trait { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: #fff; color: var(--ink); font-size: 0.9rem; font-weight: 800; }
.meters { display: grid; gap: 14px; }
.meter-row { display: grid; gap: 7px; }
.meter-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.88rem; font-weight: 800; }
.meter-track { overflow: hidden; height: 10px; border-radius: 999px; background: #eadfce; }
.meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--gold)); }

.content-section { padding: 56px 0 0; }
.section-heading { max-width: 720px; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(1.8rem, 3vw, 2.7rem); line-height: 1.1; }
.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.article-card, .type-list article, .faq-list details { padding: 22px; box-shadow: none; }
.article-card h3, .type-list h3 { margin-bottom: 10px; font-size: 1.12rem; }
.article-card p, .type-list p, .faq-list p, .text-page p { color: var(--muted); line-height: 1.75; }
.type-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.faq-list { display: grid; gap: 10px; }
.faq-list details { padding: 18px 20px; }
.faq-list summary { cursor: pointer; font-weight: 900; }
.faq-list p { margin: 12px 0 0; }

.text-page { max-width: 820px; padding: 34px; }
.text-page h1 { font-size: clamp(2.1rem, 5vw, 3.8rem); }
.text-page h2 { margin: 32px 0 10px; font-size: 1.35rem; }
.text-page a { color: var(--accent-dark); font-weight: 800; }
.contact-box { display: grid; gap: 8px; margin: 22px 0; padding: 20px; box-shadow: none; }
.contact-box a { font-size: 1.1rem; }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px max(18px, calc((100vw - 1120px) / 2));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 12px; font-weight: 800; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 30; border-radius: 8px; background: var(--ink); color: white; padding: 12px 14px; font-weight: 800; box-shadow: var(--shadow); }

@media (max-width: 860px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .site-nav { justify-content: flex-start; }
  .app-shell, .page-shell { width: min(100% - 22px, 680px); }
  .intro, .workspace, .article-grid, .type-list { grid-template-columns: 1fr; }
  .intro { min-height: auto; gap: 18px; }
  .score-card { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .score-card span { min-height: 46px; font-size: 0.9rem; }
  .result-panel { min-height: auto; padding: 22px; }
  .result-empty, .result-content { min-height: 300px; }
  .site-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 430px) {
  .actions, .result-actions { flex-direction: column; }
  .score-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .text-page { padding: 24px 18px; }
}

.utility-section {
  padding-top: 34px;
}

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

.utility-card {
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.9);
  padding: 22px;
}

.utility-card h3,
.report-box h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.small-button {
  margin-top: 14px;
  min-height: 38px;
  padding: 0 12px;
}

.history-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.history-item small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.report-box {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.report-box p {
  color: var(--muted);
  line-height: 1.7;
}

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

.feature-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.feature-list dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.feature-list dd {
  margin: 4px 0 0;
  color: var(--accent-dark);
  font-size: 1.2rem;
  font-weight: 900;
}

.sub-result {
  margin-bottom: 0;
}

.text-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.wide-page {
  max-width: 920px;
}

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

@media (max-width: 430px) {
  .feature-list {
    grid-template-columns: 1fr;
  }
}

.blog-list {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.blog-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 20px;
}

.blog-list-item h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.blog-list-item a {
  color: var(--ink);
  text-decoration: none;
}

.blog-list-item a:hover {
  color: var(--accent-dark);
}

.blog-list-item p {
  margin-bottom: 0;
}

.blog-post h2 {
  margin-top: 34px;
}

.related-box {
  display: grid;
  gap: 8px;
  margin-top: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.related-box a {
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
}

.related-box a:hover {
  text-decoration: underline;
}
