@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/source-serif-4.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/source-serif-4-italic.woff2') format('woff2');
}

:root {
  --ink: #14161a;
  --paper: #ffffff;
  --page-bg: #f2f2f0;
  --muted: #55585f;
  --rule: #1a1a1a;
  --font-serif: 'Source Serif 4', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100dvh;
}

/* ---- shared header (plain wordmark) ---- */

.topbar {
  padding: 28px 24px 20px;
}

.wordmark {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  margin: 0 0 18px;
}

.rule {
  height: 1px;
  width: 46%;
  background: var(--rule);
  border: none;
}

.result-header .rule {
  width: 100%;
  margin-top: 18px;
}

/* ---- body / footer scaffolding ---- */

.screen__body {
  padding: 4px 24px 24px;
  flex: 1;
}

.screen__body--tinted {
  background: var(--tint, var(--paper));
  padding: 24px;
}

.screen__footer {
  padding: 20px 24px 32px;
}

.lead {
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 8px 0 28px;
  color: var(--ink);
}

.screen--how .screen__body p {
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0 0 22px;
}

/* ---- buttons ---- */

.btn {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: 14px;
  padding: 16px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn--primary,
.btn--dark {
  background: var(--ink);
  color: #fff;
}

.btn--primary:active,
.btn--dark:active {
  opacity: 0.85;
}

.btn--outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

.btn--block {
  width: 100%;
}

.link-muted {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--muted);
  font-style: italic;
  font-size: 0.92rem;
  text-decoration: none;
}

/* ---- intro category list ---- */

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-list__item {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.category-list__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-list__name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

.category-list__subtitle {
  font-style: italic;
  font-size: 0.92rem;
  color: var(--muted);
}

/* ---- badge ---- */

.badge {
  --icon-fg: #1a1a1a;
  position: relative;
  border-radius: 50%;
  background: var(--badge, #ddd);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.badge--sm {
  width: 46px;
  height: 46px;
}

.badge--md {
  width: 56px;
  height: 56px;
}

.badge__inner {
  position: absolute;
  width: 64%;
  height: 64%;
  border-radius: 50%;
  background: var(--badge-inner, transparent);
}

.badge__icon {
  position: relative;
  z-index: 1;
  color: var(--icon-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- question screen ---- */

.qa-block {
  margin-top: 28px;
}

.qa-label {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.qa-text {
  font-size: 1.2rem;
  line-height: 1.45;
}

.qa-text--muted {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}

.answer-row {
  display: flex;
  gap: 14px;
}

.answer-row .btn {
  flex: 1;
}

.step-indicator {
  text-align: center;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- result screen ---- */

.result-header {
  padding: 28px 24px 0;
}

.result-header__top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-header__name {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0;
}

.result-header__subtitle {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 8px 0 0;
}

.screen__body--tinted section {
  margin-top: 22px;
}

.screen__body--tinted section:first-child {
  margin-top: 0;
}

.screen__body--tinted h2 {
  font-size: 1.02rem;
  margin: 0 0 6px;
}

.screen__body--tinted p {
  margin: 0;
  line-height: 1.55;
}

.screen__body--tinted ul {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.6;
}

.control-block {
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.control-block h2 {
  color: var(--accent, var(--ink));
}

/* ---- end / no-match screen ---- */

.end-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin: 20px 0 14px;
}

.screen--end .screen__body p {
  line-height: 1.6;
}

/*
 * On a phone, the app fills the real device screen (rules above).
 * On anything wider — a desktop browser tab, or an installed PWA window
 * that a desktop OS is happy to open at full size — pin the app to a
 * fixed phone-sized frame instead of letting it stretch to fill the
 * window. The frame's own height never changes with content; each
 * screen scrolls inside it, like a real phone app would.
 */
@media (min-width: 481px) {
  body {
    align-items: center;
    padding: 40px 16px;
  }

  .app {
    width: min(412px, calc(100vw - 32px));
    height: min(890px, calc(100dvh - 80px));
    min-height: 0;
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
  }

  .screen {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
  }
}
