@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,500&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #1c2130;
  --ink-soft: #3a4152;
  --muted: #6b7280;
  --gold: #a8863d;
  --gold-soft: rgba(168, 134, 61, 0.14);
  --page: #f6f4ef;
  --card-bg: #ffffff;
  --hairline: rgba(28, 33, 48, 0.09);
  --shadow: 0 1px 2px rgba(28, 33, 48, 0.04), 0 12px 32px rgba(28, 33, 48, 0.07);
  --radius: 16px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  color: var(--ink);
  background: linear-gradient(180deg, #f8f6f2 0%, var(--page) 40%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold-soft); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Header / nav ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 32px;
  background: rgba(248, 246, 242, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.logo span { color: var(--gold); font-style: italic; }

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.nav > a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  transition: color 0.15s ease;
}
.nav > a:hover { color: var(--ink); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 0.88rem;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 14px 4px 5px;
}
.user-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

h1 { font-size: 2.1rem; margin: 0 0 14px; line-height: 1.15; }
h2 { margin: 0 0 10px; }
p  { line-height: 1.65; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 12px;
  padding: 12px 26px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
  background: #2a3145;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(28, 33, 48, 0.18);
}
.btn-big  { font-size: 1.05rem; padding: 15px 32px; }
.btn-small { font-size: 0.83rem; padding: 7px 16px; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(28, 33, 48, 0.22);
}
.btn-ghost:hover {
  background: rgba(28, 33, 48, 0.04);
  box-shadow: none;
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 48px 44px;
}
.hero-text { flex: 1; }
.hero h1 { font-size: 2.7rem; }
.hero em { font-style: italic; color: var(--gold); }
.hero-emoji {
  font-size: 4.2rem;
  line-height: 1;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-soft);
  border-radius: 50%;
  flex-shrink: 0;
}
.hero-points {
  list-style: none;
  padding: 0;
  margin: 20px 0 28px;
}
.hero-points li {
  margin: 8px 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .hero { flex-direction: column-reverse; text-align: center; padding: 32px 24px; }
  .hero h1 { font-size: 2.1rem; }
  .hero-emoji { width: 110px; height: 110px; font-size: 3rem; }
}

/* ---------- Type cards ---------- */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.type-card {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.type-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(28, 33, 48, 0.05), 0 16px 40px rgba(28, 33, 48, 0.10);
}
.type-card h3 { margin: 14px 0 6px; font-size: 1.15rem; }
.type-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.type-emoji {
  font-size: 1.6rem;
  line-height: 1;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 11%, white);
  border-radius: 14px;
}

.note h2 { font-size: 1.25rem; }
.note p { color: var(--muted); margin: 0; font-size: 0.92rem; }

/* ---------- Quiz ---------- */
.quiz-card { text-align: center; padding: 44px 36px; }

.progress-track {
  height: 6px;
  background: rgba(28, 33, 48, 0.08);
  border-radius: 999px;
  overflow: hidden;
  max-width: 420px;
  margin: 0 auto;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 14px 0 30px;
}

.quiz-question {
  font-size: 1.65rem;
  font-weight: 600;
  min-height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
}
.quiz-hint { color: var(--muted); margin-top: 4px; font-size: 0.92rem; }

.answer-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 26px 0 30px;
  flex-wrap: wrap;
}
.answer-btn {
  font-family: var(--font-body);
  font-size: 2.1rem;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 20px 30px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.answer-btn span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.answer-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(28, 33, 48, 0.35);
  box-shadow: 0 8px 20px rgba(28, 33, 48, 0.10);
}

/* ---------- Result ---------- */
.result-hero { text-align: center; padding: 44px 36px; }

.result-code {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}
.code-letter {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  border-radius: 12px;
  padding: 8px 18px;
  margin: 0 4px;
}

.score-bars { margin-top: 30px; }
.score-row {
  display: grid;
  grid-template-columns: 180px 1fr 52px;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
  text-align: left;
}
.score-label { font-weight: 500; font-size: 0.92rem; }
.score-track {
  height: 12px;
  background: rgba(28, 33, 48, 0.06);
  border-radius: 6px;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  transition: width 0.6s ease;
}
.score-num {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 560px) {
  .score-row { grid-template-columns: 120px 1fr 48px; }
  .score-label { font-size: 0.82rem; }
}

/* ---------- Interpreter ---------- */
.interp-eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.interp-shape {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.5;
  margin: 0 0 18px;
}
.interp-combo {
  border-top: 1px solid var(--hairline);
  padding-top: 18px;
}
.interp-combo h3,
.interp-try h3 {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.interp-combo p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}
.interp-try ul {
  margin: 0 0 18px;
  padding-left: 18px;
  line-height: 1.9;
  font-size: 0.93rem;
  color: var(--ink-soft);
}
.interp-note {
  margin: 10px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.top-type { position: relative; }
.top-type::before {
  content: '';
  position: absolute;
  left: 0;
  top: var(--radius);
  bottom: var(--radius);
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.top-type-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}
.top-type-head .type-emoji {
  background: color-mix(in srgb, var(--accent) 11%, white);
}
.top-rank {
  margin: 0 0 2px;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.top-type-head h2 { margin: 0; font-size: 1.5rem; }
.top-type > p { color: var(--ink-soft); }
.top-type-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.top-type-cols h3 {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.top-type-cols ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.9;
  font-size: 0.93rem;
  color: var(--ink-soft);
}
@media (max-width: 560px) {
  .top-type-cols { grid-template-columns: 1fr; }
}

.result-actions { text-align: center; }
.save-signin {
  display: flex;
  justify-content: center;
  margin: 18px 0 24px;
}

/* ---------- Results table ---------- */
.results-table {
  width: 100%;
  border-collapse: collapse;
}
.results-table th,
.results-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.results-table th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.results-table td { font-size: 0.93rem; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 24px;
  font-size: 0.85rem;
}
