:root {
  --bg: #f8faff;
  --bg-accent: #e8f0fe;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #eef3fd;
  --primary: #1a73e8;
  --primary-strong: #0b57d0;
  --primary-soft: #dbe7ff;
  --text: #1f1f1f;
  --text-muted: #5f6368;
  --outline: #d2d9e3;
  --outline-strong: #a8c7fa;
  --danger-bg: #fce8e6;
  --danger-text: #c5221f;
  --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.16), 0 1px 3px rgba(60, 64, 67, 0.1);
  --shadow-2: 0 6px 18px rgba(60, 64, 67, 0.15);
  --radius-xl: 28px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Roboto", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(26, 115, 232, 0.12), transparent 24%),
    linear-gradient(180deg, #f8faff 0%, #eef3fd 100%);
  min-width: 0;
  -webkit-user-select: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

button,
input {
  font: inherit;
}

input {
  -webkit-user-select: text;
  user-select: text;
}

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

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-wide {
  grid-template-columns: 1fr;
}

.hero-copy,
.panel {
  background: var(--surface);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-1);
}

.hero-copy {
  padding: 42px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(232, 240, 254, 0.96), rgba(255, 255, 255, 0.98));
}

.eyebrow,
.section-kicker,
.summary-label,
.card-label {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

.hero h1,
.panel h2,
.summary-card h3 {
  margin: 0;
  font-family: "Roboto Flex", "Roboto", sans-serif;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.hero-text {
  max-width: 640px;
  margin: 18px 0 28px;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--text-muted);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.hero-blog {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  text-decoration: none;
}

.hero-blog strong {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}

.hero-blog span {
  color: var(--primary);
  font-weight: 500;
  word-break: break-all;
}

.hero-blog:hover span,
.hero-blog:hover strong {
  text-decoration: underline;
}

.progress-chip,
.result-chip,
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid transparent;
  color: #174ea6;
  font-size: 0.92rem;
  font-weight: 500;
}

.content-grid {
  display: grid;
  gap: 24px;
}

.survey-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: start;
}

.result-layout {
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.18fr);
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 24px;
  align-self: start;
}

.panel {
  padding: 28px;
  border-radius: var(--radius-xl);
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  min-width: 0;
}

.panel h2 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.name-row {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.name-row label {
  font-size: 0.95rem;
  font-weight: 500;
}

.name-row input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--outline);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.name-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.15);
}

.scale-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.scale-guide-wide {
  gap: 12px;
}

.scale-guide span {
  min-width: 0;
  word-break: keep-all;
}

.scale-guide span:nth-child(2) {
  text-align: center;
}

.scale-guide span:last-child {
  text-align: right;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-stage {
  display: grid;
  gap: 18px;
}

.intro-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 20px;
  background: var(--surface-3);
  border: 1px solid var(--outline);
  margin-bottom: 18px;
}

.intro-card h3 {
  margin: 0;
  font-size: 1.3rem;
}

.intro-card p {
  margin: 0;
  line-height: 1.7;
  color: var(--text-muted);
}

.question-card {
  padding: 18px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--outline);
}

.question-card.is-complete {
  border-color: var(--outline-strong);
  box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.16);
}

.question-card header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.question-number {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.question-card p {
  margin: 0;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

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

.option-grid label {
  position: relative;
}

.option-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-grid span {
  display: grid;
  place-items: center;
  min-height: 0;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--outline);
  background: #fff;
  color: var(--text-muted);
  font-size: clamp(0.6rem, 1.4vw, 0.92rem);
  font-weight: 700;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.option-grid span:hover {
  border-color: var(--outline-strong);
  background: #f8fbff;
}

.option-grid input:checked + span {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  transform: translateY(-1px);
}

.form-actions {
  margin-top: 0;
}

.question-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  min-height: 48px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(26, 115, 232, 0.28), 0 4px 12px rgba(26, 115, 232, 0.22);
}

.ghost-btn {
  background: var(--surface-3);
  color: #174ea6;
}

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

.empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 24px;
  border-radius: 24px;
  border: 1px dashed #c7d5ea;
  text-align: center;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.7);
}

.empty-state h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.4rem;
}

.compact-empty {
  min-height: 240px;
}

.summary-card,
.visual-card,
.insight-card {
  background: var(--surface);
  border: 1px solid var(--outline);
}

.summary-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-radius: 24px;
}

.summary-description {
  margin: 12px 0 0;
  line-height: 1.7;
  color: var(--text-muted);
}

.summary-meter {
  min-width: 130px;
  padding: 18px;
  border-radius: 20px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface-3), rgba(255, 255, 255, 0.96));
}

.summary-meter span {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.summary-meter strong {
  display: block;
  margin-top: 10px;
  font-family: "Roboto Flex", "Roboto", sans-serif;
  font-size: 2rem;
}

.intensity-desc {
  margin: 8px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.meta-pill {
  border: 1px solid var(--outline);
}

.meta-pill span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.meta-pill strong {
  color: var(--text);
}

.visual-card {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 18px;
  margin-top: 18px;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.98));
  box-shadow: 0 14px 30px rgba(91, 104, 120, 0.08);
}

.radar-wrap {
  display: grid;
  place-items: center;
  min-height: 320px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(126, 166, 224, 0.12), transparent 26%),
    radial-gradient(circle at 80% 18%, rgba(156, 137, 184, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(248,250,255,0.72));
  border: 1px solid rgba(126, 166, 224, 0.16);
}

#radar-chart {
  width: 100%;
  max-width: 320px;
}

.score-bars {
  display: grid;
  gap: 14px;
  align-content: center;
}

.score-item {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(126, 166, 224, 0.12);
}

.score-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.94rem;
  font-weight: 600;
}

.bar-track {
  overflow: hidden;
  height: 13px;
  border-radius: 999px;
  background: #ebf0f6;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(126, 166, 224, 0.18);
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.insight-card {
  padding: 20px;
  border-radius: 22px;
}

.insight-card h4 {
  margin: 0 0 10px;
  font-size: 1.16rem;
}

.insight-card p {
  margin: 0;
  line-height: 1.72;
  color: var(--text-muted);
}

.trait-breakdown-wide {
  grid-column: 1 / -1;
}

.compatibility-wide {
  grid-column: 1 / -1;
}

.trait-breakdown {
  display: grid;
  gap: 14px;
}

.trait-item {
  padding-top: 14px;
  border-top: 1px solid var(--outline);
}

.trait-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.trait-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.trait-item-head strong {
  color: var(--text);
}

.trait-item-head span {
  color: var(--primary);
  font-weight: 700;
}

.trait-item h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.trait-extra {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--outline);
}

.trait-extra strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--text);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--surface-3);
  color: #174ea6;
  font-size: 0.92rem;
  font-weight: 600;
}

.mini-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--outline);
}

.mini-block strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-card-wrap {
  position: relative;
}

.history-card {
  display: grid;
  gap: 10px;
  padding: 16px 52px 16px 16px;
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--outline);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  text-decoration: none;
  color: inherit;
}

.history-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.history-card.is-active,
.history-card:hover {
  border-color: var(--outline-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.history-card-head,
.history-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-right: 6px;
  min-width: 0;
}

.history-card-head strong {
  color: var(--text);
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.history-card p {
  margin: 0;
  line-height: 1.5;
  color: var(--text-muted);
}

.history-card-meta {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.history-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #edf2fa;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.history-delete-btn:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.text-link {
  align-self: center;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.action-link {
  width: 100%;
  justify-content: center;
}

.hero-link {
  display: inline-flex;
  text-decoration: none;
}

.result-panel-standalone {
  min-height: 600px;
}

.radar-grid,
.radar-axis {
  fill: none;
  stroke: rgba(123, 137, 158, 0.22);
  stroke-width: 1;
}

.radar-shape {
  fill: rgba(126, 166, 224, 0.22);
  stroke: #7ea6e0;
  stroke-width: 3;
}

.radar-point-glow {
  fill: url(#softPointGlow);
}

.radar-point {
  fill: #ffffff;
  stroke: #7ea6e0;
  stroke-width: 2.2;
}

.radar-label {
  font-size: 13px;
  font-weight: 700;
  fill: #5f6368;
  text-anchor: middle;
}

@media (max-width: 980px) {
  .hero,
  .content-grid,
  .survey-layout,
  .result-layout,
  .visual-card,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .summary-card {
    flex-direction: column;
  }

  .page-shell {
    width: min(100% - 20px, 1240px);
  }

  .hero-copy,
  .panel {
    overflow: hidden;
  }

  /* 결과 페이지: 결과 패널 먼저, 기록 사이드바 아래 */
  .result-layout .side-stack {
    order: 2;
  }

  .result-layout .result-panel-standalone {
    order: 1;
    min-height: unset;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 16px, 1240px);
    padding: 16px 0 32px;
  }

  .hero-copy {
    padding: 20px;
  }

  .panel {
    padding: 18px;
  }

  .panel h2 {
    font-size: 1.4rem;
  }

  .hero h1 {
    font-size: clamp(1.9rem, 8vw, 2.6rem);
  }

  .hero-text {
    margin: 14px 0 22px;
    font-size: 0.98rem;
    line-height: 1.65;
  }

  .hero-blog {
    gap: 6px;
  }

  .progress-chip,
  .result-chip,
  .meta-pill {
    width: 100%;
    justify-content: space-between;
  }

  .panel-head {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
  }

  .scale-guide,
  .scale-guide-wide {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 14px;
    font-size: 0.84rem;
  }

  .scale-guide span,
  .scale-guide span:nth-child(2),
  .scale-guide span:last-child {
    text-align: left;
  }

  .question-stage {
    gap: 14px;
  }

  /* 10점 척도: 2줄 5개로 (터치 타겟 확보) */
  .option-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .option-grid span {
    min-height: 52px;
    font-size: 0.9rem;
  }

  .question-card {
    padding: 16px;
  }

  .question-card header {
    margin-bottom: 12px;
  }

  /* 이전/다음 버튼 전체 너비 */
  .question-nav {
    flex-direction: column;
    gap: 10px;
    position: sticky;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 5;
    padding: 12px;
    border-radius: 20px;
    background: rgba(248, 250, 255, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(60, 64, 67, 0.12);
  }

  .question-nav .ghost-btn,
  .question-nav .primary-btn {
    width: 100%;
    text-align: center;
  }

  .form-actions,
  .history-card-head,
  .history-card-meta,
  .result-meta {
    flex-direction: column;
  }

  .history-card {
    padding: 16px 48px 16px 14px;
  }

  .history-card-head,
  .history-card-meta {
    gap: 4px;
    padding-right: 0;
  }

  .summary-meter {
    min-width: unset;
  }

  .summary-card,
  .visual-card,
  .insight-card {
    padding: 18px;
  }

  .visual-card {
    gap: 14px;
  }

  .radar-wrap {
    min-height: 250px;
  }

  #radar-chart {
    max-width: 260px;
  }

  .score-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .insight-grid {
    gap: 12px;
  }

  .compact-empty {
    min-height: 160px;
  }

  .history-panel .history-list {
    max-height: 320px;
    overflow-y: auto;
  }
}

@media (max-width: 420px) {
  .hero-copy,
  .panel {
    padding: 16px;
  }

  .page-shell {
    width: min(100% - 12px, 1240px);
    padding: 12px 0 28px;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 9vw, 2.2rem);
  }

  .scale-guide {
    font-size: 0.78rem;
    padding: 10px 12px;
  }

  .intro-card,
  .summary-card,
  .visual-card,
  .insight-card,
  .question-card {
    border-radius: 18px;
  }

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

  .option-grid span {
    min-height: 48px;
    font-size: 0.82rem;
  }

  .question-nav {
    padding: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  .history-delete-btn {
    top: 8px;
    right: 8px;
  }

  .tag-list li {
    font-size: 0.85rem;
    padding: 7px 10px;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }
}
