:root {
  --bg: #f7f1e8;
  --card: rgba(255, 252, 246, 0.92);
  --text: #2d241f;
  --muted: #7a6a60;
  --line: rgba(58, 43, 31, 0.12);
  --accent: #ffb84d;
  --accent-2: #ffdf9a;
  --shadow: 0 22px 70px rgba(83, 56, 24, 0.14);
  --radius: 28px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 217, 130, 0.44), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(255, 181, 124, 0.36), transparent 32%),
    linear-gradient(135deg, #f8efe2 0%, #fff7ea 52%, #f5eadf 100%);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  padding: 34px 34px 30px;
  margin-bottom: 24px;
}

.eyebrow {
  color: #a06921;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  margin-top: 10px;
  font-size: clamp(34px, 7vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.hero p {
  margin-top: 14px;
  max-width: 680px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.form-card {
  padding: 26px;
  position: sticky;
  top: 24px;
}

.form-card h2,
.result-content h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.field {
  display: block;
  margin-top: 20px;
}

.field span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 800;
}

.field small {
  color: var(--muted);
  font-weight: 500;
}

input, select, button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  font: inherit;
}

input, select {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 14px 14px;
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(255, 174, 52, 0.85);
  box-shadow: 0 0 0 4px rgba(255, 184, 77, 0.18);
}

button {
  margin-top: 24px;
  border: none;
  background: linear-gradient(135deg, #ffb84d, #ff8e3c);
  color: #2b1804;
  padding: 15px 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(255, 142, 60, 0.26);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-card {
  min-height: 520px;
  padding: 26px;
}

.empty-state {
  min-height: 466px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.egg {
  font-size: 70px;
  margin-bottom: 12px;
  filter: drop-shadow(0 14px 18px rgba(127, 83, 31, 0.18));
}

.hidden { display: none !important; }

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

#finalCopy {
  margin-top: 8px;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.18;
}

.avg-pill {
  flex: 0 0 auto;
  min-width: 86px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 184, 77, 0.18);
  text-align: center;
}

.avg-pill span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.avg-pill strong {
  display: block;
  margin-top: 2px;
  font-size: 30px;
}

.chart-wrap {
  display: grid;
  place-items: center;
  margin: 24px 0 18px;
}

#radarCanvas {
  width: min(320px, 100%);
  height: auto;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.score-item {
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
}

.score-item .dim {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score-item .score {
  margin-top: 8px;
  font-size: 32px;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.score-item .keyword {
  margin-top: 6px;
  display: inline-block;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 184, 77, 0.17);
  font-size: 13px;
  font-weight: 800;
}

.debug-box {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.debug-box summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(42, 32, 25, 0.06);
  padding: 14px;
  border-radius: 16px;
  color: #4c3a2f;
  font-size: 12px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 32px));
  padding: 13px 16px;
  border-radius: 999px;
  background: #2d241f;
  color: #fff7ea;
  box-shadow: var(--shadow);
  z-index: 20;
}

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .form-card { position: static; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .page-shell { width: min(100% - 20px, 1120px); padding-top: 18px; }
  .hero, .form-card, .result-card { padding: 22px; border-radius: 24px; }
  .score-grid { grid-template-columns: 1fr; }
  .result-header { flex-direction: column; }
  .avg-pill { width: 100%; }
}
