/* ==========================================================================
   Roof-16 · 每个人心中都有一个房顶
   Clean, high-contrast modern gallery UI · clear focal hierarchy.
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --agree: #2d8a62;
  --agree-dark: #1e6848;
  --agree-ring: rgba(45, 138, 98, 0.16);
  --disagree: #74518c;
  --disagree-dark: #56386b;
  --disagree-ring: rgba(116, 81, 140, 0.16);
  --neutral: #9ca3af;
  --neutral-ring: rgba(156, 163, 175, 0.22);

  --fam: #2d8a62;
  --fam-dark: #1e6848;
  --fam-soft: #e6f5ee;
  --fam-border: #c0e4d3;

  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
  --header-h: 60px;
  --container: 1080px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

#app {
  outline: none;
  min-height: calc(100vh - var(--header-h));
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.container.narrow {
  max-width: 720px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
}

.skip-link:focus {
  top: 12px;
}

.noscript {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Buttons & shared atoms                                              */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.is-busy {
  opacity: 0.65;
  cursor: progress;
}

.btn-lg {
  min-height: 50px;
  padding: 0 26px;
  font-size: 16px;
  border-radius: 12px;
}

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

.btn-primary:hover:not(:disabled) {
  background: #27303f;
}

.btn-fam {
  background: var(--fam);
  color: #fff;
}

.btn-fam:hover:not(:disabled) {
  background: var(--fam-dark);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: rgba(17, 24, 39, 0.05);
  color: var(--ink);
}

.inline-link {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.inline-link.muted {
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

.inline-link.muted:hover {
  color: var(--ink);
}

/* Roof art */
.roof-art {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: var(--fam-soft);
}

.roof-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ------------------------------------------------------------------ */
/* Header & footer                                                     */
/* ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

.brand-text {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--bg);
}

.nav-link.is-active:not(.nav-cta) {
  color: var(--ink);
  font-weight: 700;
}

.nav-cta {
  margin-left: 6px;
  padding: 8px 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.nav-cta:hover,
.nav-cta.is-active {
  background: #27303f;
  color: #fff;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

body[data-route="test"] .site-footer {
  display: none;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 24px;
  padding-bottom: 24px;
  font-size: 13.5px;
  color: var(--muted);
}

.footer-nav {
  display: flex;
  gap: 20px;
  color: var(--ink-2);
  font-weight: 500;
}

.footer-nav a:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------------ */
/* Home                                                                */
/* ------------------------------------------------------------------ */

.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 64px 0 60px;
}

.hero-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-title {
  font-size: clamp(34px, 4.4vw, 52px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-lead {
  margin-top: 16px;
  font-size: clamp(16px, 1vw + 10px, 18px);
  color: var(--ink-2);
  max-width: 520px;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.saved-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--ink-2);
}

.saved-pill b {
  color: var(--ink);
}

.saved-pill svg {
  width: 15px;
  height: 15px;
}

.saved-pill code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.id-lookup {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 440px;
  margin-top: 22px;
}

.id-lookup-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
}

.id-lookup-input:focus {
  outline: none;
  border-color: var(--ink);
}

.id-lookup-btn {
  flex: none;
}

.hero-strip {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 44px;
}

.hero-mini {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}

.hero-mini:hover {
  transform: translateY(-3px);
  border-color: var(--fam);
}

.hero-mini-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
}

.hero-mini-label b {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
}

.hero-mini-label em {
  font-style: normal;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--fam-dark);
}

/* Home gallery */
.gallery-section {
  padding: 56px 0 72px;
}

.gallery-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
}

.gallery-bar h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.gallery-sub {
  margin-top: 4px;
  font-size: 14.5px;
  color: var(--muted);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.filter-tab i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fam);
}

.filter-tab:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.filter-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.roof-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.roof-tile {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}

.roof-tile:hover {
  transform: translateY(-3px);
  border-color: var(--fam);
}

.roof-tile.is-mine {
  border: 2px solid var(--fam);
}

.roof-tile-media {
  position: relative;
}

.tile-mine {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

.roof-tile-info {
  padding: 14px 16px 16px;
}

.roof-tile-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.roof-tile-name {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
}

.roof-tile-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--fam-dark);
}

.roof-tile-arch {
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Test                                                                */
/* ------------------------------------------------------------------ */

.test-view {
  padding-bottom: 84px;
}

.test-progress {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  padding: 12px 0 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.progress-count {
  font-weight: 700;
  color: var(--ink);
}

.progress-page {
  color: var(--muted);
  font-weight: 500;
}

.progress-track {
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--ink);
  transition: width 0.35s var(--ease);
}

.test-head {
  padding: 36px 0 24px;
  text-align: center;
}

.test-title {
  font-size: clamp(24px, 2vw + 12px, 30px);
  font-weight: 800;
  color: var(--ink);
}

.test-tip {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}

.restore-note {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--ink-2);
}

.q-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.q {
  padding: 30px 32px 32px;
  border-radius: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  text-align: center;
  transition: opacity 0.25s var(--ease), border-color 0.25s;
  scroll-margin-top: calc(var(--header-h) + 88px);
}

.q[data-state="current"] {
  border-color: var(--ink);
}

.q[data-state="future"] {
  opacity: 0.62;
}

.q[data-state="future"]:hover,
.q[data-state="future"]:focus-within {
  opacity: 1;
}

.q-text {
  max-width: 600px;
  margin: 0 auto;
  font-size: clamp(17px, 0.5vw + 14px, 19px);
  line-height: 1.65;
  font-weight: 600;
  color: var(--ink);
  text-wrap: pretty;
}

.q-num {
  display: inline-block;
  margin-right: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.q[data-state="current"] .q-num {
  color: var(--agree-dark);
}

.likert {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  max-width: 560px;
  margin: 24px auto 0;
}

.likert-pole {
  font-weight: 700;
  font-size: 15px;
}

.likert-pole.is-disagree {
  color: var(--disagree-dark);
  text-align: right;
}

.likert-pole.is-agree {
  color: var(--agree-dark);
  text-align: left;
}

.likert-opts {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 20px);
}

.likert-btn {
  --c: var(--neutral);
  --ring: var(--neutral-ring);
  --s: 30px;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--s);
  height: var(--s);
  padding: 0;
  border-radius: 50%;
  border: 2.2px solid var(--c);
  background: #fff;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.15s, box-shadow 0.18s var(--ease);
}

.likert-btn.size-lg {
  --s: 50px;
  border-width: 2.5px;
}

.likert-btn.size-md {
  --s: 38px;
}

.likert-btn.size-sm {
  --s: 28px;
}

.likert-btn.side-disagree {
  --c: var(--disagree);
  --ring: var(--disagree-ring);
}

.likert-btn.side-agree {
  --c: var(--agree);
  --ring: var(--agree-ring);
}

.likert-btn svg {
  width: 54%;
  height: 54%;
  opacity: 0;
  transform: scale(0.45);
  transition: opacity 0.15s, transform 0.2s var(--ease);
}

.likert-btn:hover {
  box-shadow: 0 0 0 5px var(--ring);
  transform: scale(1.06);
}

.likert-btn[aria-checked="true"] {
  background: var(--c);
  box-shadow: 0 0 0 5px var(--ring);
}

.likert-btn[aria-checked="true"] svg {
  opacity: 1;
  transform: scale(1);
}

.q.is-flagged {
  border-color: #d97706;
  animation: shake 0.45s ease;
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-5px);
  }
  40%,
  80% {
    transform: translateX(5px);
  }
}

.test-foot {
  margin-top: 24px;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.test-foot-extra {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

/* Reveal overlay */
.reveal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: var(--surface);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}

.reveal.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease;
}

.reveal-inner {
  text-align: center;
}

.reveal-roof {
  width: 120px;
  margin: 0 auto;
}

.reveal-line {
  fill: none;
  stroke: var(--fam, var(--ink));
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
}

.reveal.is-active .l1 {
  animation: draw 0.34s var(--ease) forwards;
}

.reveal.is-active .l2 {
  animation: draw 0.3s var(--ease) 0.1s forwards;
}

.reveal.is-active .l3 {
  animation: draw 0.22s var(--ease) 0.2s forwards;
}

.reveal-text {
  margin-top: 14px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink-2);
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Result: collectible showcase                                        */
/* ------------------------------------------------------------------ */

.result-page {
  padding: 36px 0 64px;
}

.result-wrap {
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-card {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 36px;
  align-items: center;
  padding: 28px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.hero-card-art {
  border-radius: 18px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fam-badge {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--fam-soft);
  color: var(--fam-dark);
  font-size: 13px;
  font-weight: 700;
}

.code-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.rarity-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.hero-card-title {
  margin-top: 14px;
  font-size: clamp(32px, 3vw + 14px, 44px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-card-arch {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fam-dark);
}

.hero-card-tagline {
  margin-top: 14px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-2);
  text-wrap: pretty;
}

.kw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.kw-chips li {
  padding: 4px 11px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.hero-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* Unique ID, Owner line, Visitor banner, Editor, Village teaser */
.owner-line {
  margin-bottom: 10px;
  font-size: 15px;
  color: var(--ink-2);
}

.owner-line b {
  color: var(--ink);
  font-weight: 700;
}

.owner-sig {
  margin-left: 6px;
  color: var(--muted);
}

.id-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.id-chip {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 13.5px;
  color: var(--muted);
  margin-right: 4px;
}

.id-chip b {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.06em;
}

.id-action {
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.id-action:hover {
  border-color: var(--ink);
}

.visitor-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 16px 22px;
  border-radius: 16px;
  background: var(--surface);
  border: 1.5px solid var(--fam-border);
  font-size: 14.5px;
  color: var(--ink-2);
}

.visitor-banner b {
  color: var(--ink);
}

.editor-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.field input {
  height: 44px;
  padding: 0 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
}

.field input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--ink);
}

.teaser-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 24px 28px;
  border-radius: 20px;
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
}

.teaser-copy {
  max-width: 600px;
}

.teaser-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.teaser-card h3 {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.teaser-card p {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

.loading-state,
.not-found {
  padding: 96px 24px;
  text-align: center;
  color: var(--muted);
}

.not-found h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}

.not-found p {
  margin-top: 10px;
  font-size: 15px;
}

.not-found-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

/* Share Card Preview Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.58);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.18s ease;
}

.modal-sheet {
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--ink);
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  text-align: center;
}

.card-preview-img {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 0 auto;
}

.modal-hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* Panels */
.panel {
  padding: 28px 32px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.panel-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.panel-note {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.panel-note a {
  color: var(--fam-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Compact 4-axis spectrum inside one card */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 36px;
  margin-top: 22px;
}

.spec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.spec-dim {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.spec-val {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--fam-dark);
  font-variant-numeric: tabular-nums;
}

.spec-track {
  position: relative;
  height: 8px;
  margin: 10px 0 8px;
  border-radius: 999px;
  background: #e5e7eb;
}

.spec-mid {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 2px;
  margin-left: -1px;
  background: #fff;
}

.spec-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: var(--fam);
}

.spec-fill.fill-left {
  left: 0;
}

.spec-fill.fill-right {
  right: 0;
}

.spec-fill.is-canonical {
  opacity: 0.45;
}

.spec-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--fam);
}

.spec-poles {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.spec-poles .is-win {
  color: var(--ink);
  font-weight: 700;
}

/* Portrait prose */
.pull-quote {
  margin-top: 16px;
  padding: 14px 18px;
  border-left: 3.5px solid var(--fam);
  border-radius: 0 12px 12px 0;
  background: var(--fam-soft);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--ink);
}

.prose {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15.5px;
  line-height: 1.88;
  color: var(--ink-2);
}

/* Split panels */
.split-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.trait-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trait-list li {
  padding-left: 14px;
  border-left: 3px solid var(--fam);
}

.trait-list.is-muted li {
  border-left-color: var(--border-strong);
}

.trait-list strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.trait-list p {
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

.panel-copy {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-2);
}

/* Sanctuary */
.sanctuary-card {
  padding: 28px 32px;
  border-radius: 20px;
  background: var(--fam-soft);
  border: 1px solid var(--fam-border);
}

.sanctuary-kicker {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: var(--fam-dark);
}

.sanctuary-copy {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.8;
  color: var(--ink);
}

/* Matches */
.match-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.match-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color 0.18s, background-color 0.18s;
}

.match-card:hover {
  border-color: var(--fam);
  background: var(--surface);
}

.match-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fam-dark);
}

.match-top {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.match-thumb {
  border-radius: 10px;
}

.match-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.match-code {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.match-reason {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

/* Bottom pager */
.result-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
}

.result-bottom-mid {
  display: flex;
  gap: 8px;
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background-color 0.15s, color 0.15s;
}

.pager-btn:hover {
  background: var(--surface);
  color: var(--ink);
}

.pager-btn svg {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------------ */
/* Types page                                                          */
/* ------------------------------------------------------------------ */

.types-page {
  padding: 40px 0 72px;
}

.types-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.types-header h1 {
  font-size: clamp(28px, 2.5vw + 12px, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.types-header p {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}

.family-section {
  padding-top: 40px;
  scroll-margin-top: var(--header-h);
}

.family-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 18px;
}

.family-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fam);
  align-self: center;
}

.family-section-head h2 {
  font-size: 21px;
  font-weight: 800;
}

.family-section-head p {
  font-size: 14.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Toast                                                               */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 150;
  max-width: min(92vw, 460px);
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-tone="success"] {
  background: var(--agree-dark);
}

.toast[data-tone="error"] {
  background: #b91c1c;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 960px) {
  .hero-strip,
  .roof-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .hero-card-media {
    max-width: 360px;
    width: 100%;
    margin: 0 auto;
  }

  .match-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  :root {
    --header-h: 56px;
  }

  .container {
    padding: 0 18px;
  }

  .nav-home {
    display: none;
  }

  .hero {
    padding: 40px 0 44px;
  }

  .hero-strip {
    gap: 12px;
    margin-top: 32px;
  }

  .gallery-section {
    padding: 40px 0 56px;
  }

  .roof-grid {
    gap: 12px;
  }

  .roof-tile-info {
    padding: 10px 12px 12px;
  }

  .roof-tile-name {
    font-size: 15px;
  }

  .roof-tile-arch {
    font-size: 12.5px;
  }

  .q {
    padding: 24px 18px 26px;
  }

  .likert {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "opts opts"
      "disagree agree";
    gap: 10px 8px;
    margin-top: 20px;
  }

  .likert-opts {
    grid-area: opts;
    justify-content: center;
    gap: 12px;
  }

  .likert-pole {
    font-size: 13.5px;
  }

  .likert-pole.is-disagree {
    grid-area: disagree;
    text-align: left;
  }

  .likert-pole.is-agree {
    grid-area: agree;
    text-align: right;
  }

  .hero-card {
    padding: 20px;
  }

  .panel,
  .sanctuary-card {
    padding: 22px 20px;
  }

  .spec-grid,
  .split-panels,
  .editor-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .teaser-card {
    padding: 20px;
  }

  .result-bottom {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
