@import "tailwindcss";

@font-face {
  font-family: "Heavitas";
  src: url("/assets/quark/fonts/heavitas.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Expressway";
  src: url("/assets/quark/fonts/expressway.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Bebas Neue";
  src: url("/assets/quark/fonts/bebasneue.otf") format("opentype");
  font-display: swap;
}

:root {
  --background: hsl(0 0% 6%);
  --surface: hsl(0 0% 11%);
  --surface-raised: hsl(0 0% 17%);
  --button: hsl(0 0% 25%);
  --button-shadow: hsl(0 0% 17.5%);
  --text: hsl(0 0% 100%);
  --muted: hsl(0 0% 70%);
  --accent: #a19d95;
  --green: hsl(120 70% 45%);
  --red: hsl(0 70% 45%);
  --purple: hsl(280 60% 35%);
  --gold: hsl(42 90% 45%);
  --ambient-a: #858a8f;
  --ambient-b: #555c63;
  --ambient-c: #a1a4a7;
  --ambient-d: #70757a;
  --ambient-e: #44494e;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background: #0b0c0e;
  font-family: "Heavitas", Arial, sans-serif;
  font-weight: 400;
}

.ambient-background {
  --oa: 0.34;
  --ob: 0.31;
  --oc: 0.28;
  --od: 0.26;
  --oe: 0.24;
  position: fixed;
  z-index: 0;
  inset: 0;
  contain: strict;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(145deg, #151719 0%, #090a0c 52%, #121416 100%);
}

.ambient-orb {
  position: absolute;
  inset: -14%;
  opacity: var(--oa);
  background: radial-gradient(ellipse at var(--ambient-x, 50%) var(--ambient-y, 50%), currentColor 0 12%, transparent 82%);
  transition: color 900ms cubic-bezier(0.22, 1, 0.36, 1), opacity 720ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  animation: ambient-drift 28s ease-in-out infinite alternate;
}

.ambient-orb-a {
  --ambient-x: 0%;
  --ambient-y: 50%;
  color: var(--ambient-a);
  animation-duration: 25s;
  animation-delay: -4s;
}

.ambient-orb-b {
  --ambient-x: 100%;
  --ambient-y: 50%;
  color: var(--ambient-b);
  opacity: var(--ob);
  animation-duration: 29s;
  animation-delay: -12s;
  animation-direction: alternate-reverse;
}

.ambient-orb-c {
  --ambient-x: 50%;
  --ambient-y: 0%;
  color: var(--ambient-c);
  opacity: var(--oc);
  animation-duration: 32s;
  animation-delay: -19s;
}

.ambient-orb-d {
  --ambient-x: 0%;
  --ambient-y: 100%;
  color: var(--ambient-d);
  opacity: var(--od);
  animation-duration: 27s;
  animation-delay: -8s;
  animation-direction: alternate-reverse;
}

.ambient-orb-e {
  --ambient-x: 100%;
  --ambient-y: 100%;
  color: var(--ambient-e);
  opacity: var(--oe);
  animation-duration: 35s;
  animation-delay: -23s;
}

.ambient-background[data-count="1"] { --oa: 0.46; }
.ambient-background[data-count="2"] { --oa: 0.48; --ob: 0.46; }
.ambient-background[data-count="3"] { --oa: 0.4; --ob: 0.37; --oc: 0.34; }
.ambient-background[data-count="4"] { --oa: 0.37; --ob: 0.35; --oc: 0.32; --od: 0.29; }

.ambient-background[data-count="1"] .ambient-orb:nth-child(n + 2),
.ambient-background[data-count="2"] .ambient-orb:nth-child(n + 3),
.ambient-background[data-count="3"] .ambient-orb:nth-child(n + 4),
.ambient-background[data-count="4"] .ambient-orb:nth-child(n + 5) {
  opacity: 0;
  animation-play-state: paused;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
select,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.18em;
}

main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
}

section {
  width: min(90vw, 1180px);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  text-align: center;
}

.floating-nav {
  position: fixed;
  z-index: 80;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
}

.nav-items {
  display: none;
}

.nav-items-open {
  display: block;
  animation: nav-open 160ms ease-out;
}

.nav-button {
  position: relative;
  display: flex;
  width: clamp(3.25rem, 4vw, 4.25rem);
  height: clamp(3.25rem, 4vw, 4.25rem);
  align-items: center;
  justify-content: center;
  margin: 0 0 0.75rem;
  padding: 0.55rem;
  cursor: pointer;
  border: 0;
  border-radius: 1rem;
  background: var(--button);
  box-shadow: 0 0.45rem var(--button-shadow);
}

.nav-button:hover {
  filter: brightness(1.14);
}

.nav-button:active {
  top: 0.45rem;
  box-shadow: none;
}

.nav-button img {
  width: 100%;
  height: 100%;
}

.site-title {
  display: grid;
  width: min(76vw, 790px);
  grid-template-columns: 5rem minmax(0, 1fr) 5rem;
  align-items: start;
  margin: 0 auto;
  padding-top: 1.5rem;
}

.wordmark {
  color: white;
  font-size: clamp(2rem, 5.1vw, 4.7rem);
  line-height: 0.95;
  text-align: center;
  text-transform: uppercase;
  text-wrap: balance;
  filter: drop-shadow(0 0.4rem 0.7rem #0008);
}

.version-label,
.version-spacer {
  padding-top: 1.2rem;
  font-size: clamp(0.7rem, 1vw, 0.95rem);
  text-align: left;
}

.version-label {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-size: clamp(0.72rem, 1vw, 0.95rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro {
  max-width: 850px;
  margin: 0 auto;
  font-size: clamp(1.45rem, 2.5vw, 2.35rem);
  line-height: 1.22;
  text-transform: uppercase;
  text-wrap: balance;
}

.button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.4rem;
  padding: 1rem 1.4rem;
  cursor: pointer;
  border: 0;
  border-radius: 1rem;
  background: var(--button);
  box-shadow: 0 0.5rem var(--button-shadow);
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  touch-action: manipulation;
}

.button:hover {
  filter: brightness(1.12);
}

.button:active {
  top: 0.5rem;
  box-shadow: none !important;
}

.button img {
  width: 1.7rem;
  height: 1.7rem;
  flex: none;
  margin-right: 0.55rem;
}

.home-buttons {
  display: grid;
  width: min(100%, 690px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.6rem auto 2rem;
}

.home-buttons .button {
  width: 100%;
}

.start-button {
  grid-column: 1 / -1;
  min-height: 6.3rem;
  background: linear-gradient(145deg, #706d67, #53514d);
  box-shadow: 0 0.55rem #34322f;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.start-button img {
  width: 2.7rem;
  height: 2.7rem;
  margin: 0 0 0 0.85rem;
}

.merge-summary {
  display: grid;
  width: min(100%, 850px);
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 2.5rem auto 1.25rem;
  overflow: hidden;
  border: 1px solid #ffffff1a;
  border-radius: 1.1rem;
  background: #ffffff1a;
}

.merge-summary div {
  display: flex;
  min-height: 7rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(160deg, #232323, #171717);
}

.merge-summary strong {
  color: var(--accent);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.merge-summary span {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: clamp(0.65rem, 1vw, 0.85rem);
  text-transform: uppercase;
}

.home-note,
.tree-note,
.empty-state {
  max-width: 850px;
  margin: 1.25rem auto;
  color: var(--muted);
  font-family: "Expressway", Arial, sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.55;
}

.home-credit {
  margin: 0.4rem auto 0;
  color: var(--muted);
  font-family: "Expressway", Arial, sans-serif;
  font-size: 0.9rem;
}

.quiz-view {
  width: min(94vw, 900px);
}

.quiz-meta {
  display: flex;
  max-width: 710px;
  justify-content: space-between;
  margin: 0 auto 1.4rem;
  color: var(--muted);
  font-size: clamp(0.62rem, 1vw, 0.82rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.question {
  max-width: 900px;
  margin: 0 auto 1.5rem;
  font-size: clamp(1.55rem, 3vw, 2.7rem);
  line-height: 1.2;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.answer-button {
  width: min(100%, 650px);
  min-height: 5.3rem;
  margin: 0 auto;
  padding: 1.15rem 1.5rem;
  background: var(--answer-color, var(--button));
  box-shadow: 0 0.55rem var(--answer-shadow, var(--button-shadow));
  font-size: clamp(1.05rem, 1.6vw, 1.5rem);
}

.answer-button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.answer-button img {
  width: 2.2rem;
  height: 2.2rem;
}

.answer-1 {
  --answer-color: hsl(120 63% 38%);
  --answer-shadow: hsl(120 63% 23%);
}

.answer-2 {
  --answer-color: hsl(0 62% 42%);
  --answer-shadow: hsl(0 62% 25%);
}

.answer-3 {
  --answer-color: hsl(280 54% 34%);
  --answer-shadow: hsl(280 54% 20%);
}

.answer-4 {
  --answer-color: hsl(40 78% 38%);
  --answer-shadow: hsl(40 78% 23%);
}

.answer-5 {
  --answer-color: hsl(205 65% 36%);
  --answer-shadow: hsl(205 65% 21%);
}

.back-button {
  width: min(100%, 220px);
  min-height: 3.8rem;
  margin: 2rem auto 0;
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

.path-dots {
  display: flex;
  min-height: 0.5rem;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
}

.path-dots span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0.5rem #a19d9588;
}

.result-view {
  width: min(94vw, 980px);
}

.result-card {
  width: 100%;
  padding: 1.2rem 1rem 2rem;
  border: 1px solid #ffffff12;
  border-radius: 1.6rem;
  background: linear-gradient(160deg, #1a1a1a, #0d0d0d);
  box-shadow: 0 1.2rem 3rem #0008;
}

.match {
  max-width: 850px;
  margin: 0 auto 1.2rem;
  font-size: clamp(1.8rem, 4vw, 3.8rem);
  line-height: 1.08;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.result-switchbar {
  display: grid;
  width: 100%;
  grid-template-columns: 4.5rem minmax(0, 1fr) 4.5rem;
  align-items: center;
  gap: 1rem;
}

.flag {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 700px);
  max-height: 370px;
  margin: 0 auto;
  border-radius: 2.8rem;
  object-fit: contain;
  box-shadow: 0 0.8rem 2rem #0009;
}

.switch-button,
.switch-placeholder {
  width: 4.5rem;
  height: 8rem;
}

.switch-button {
  padding: 0.8rem;
}

.switch-button img {
  width: 100%;
  height: 100%;
  margin: 0;
}

.quote {
  position: relative;
  max-width: 780px;
  margin: 1.8rem auto 0;
  padding: 0 2rem;
  font-size: clamp(1rem, 1.8vw, 1.5rem);
  line-height: 1.35;
  text-transform: uppercase;
}

.quote::before,
.quote::after {
  position: absolute;
  top: 50%;
  color: #ffffff55;
  font-size: 3rem;
  transform: translateY(-50%);
}

.quote::before { left: 0; content: "“"; }
.quote::after { right: 0; content: "”"; }

.author {
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  text-transform: uppercase;
}

.author::before {
  content: "— ";
}

.result-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.3rem;
}

.result-details span {
  padding: 0.45rem 0.7rem;
  border: 1px solid #ffffff22;
  border-radius: 0.55rem;
  color: #ddd;
  font-size: 0.66rem;
  text-transform: uppercase;
}

.aliases {
  margin: 1.3rem auto 0;
  color: var(--muted);
  font-family: "Expressway", Arial, sans-serif;
  font-size: 0.95rem;
  line-height: 1.45;
}

.aliases span { color: white; }

.route-details {
  width: min(100%, 850px);
  margin: 1.4rem auto 0;
  padding: 1rem 1.2rem;
  border: 1px solid #ffffff1f;
  border-radius: 1rem;
  background: #151515;
  text-align: left;
}

.route-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.route-details[open] summary { margin-bottom: 1.25rem; }

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.result-actions .back-button { margin: 1.5rem 0 0; }
.retake-button { background: linear-gradient(145deg, #66635e, #4d4b47); box-shadow: 0 0.5rem #302f2c; }

.notice {
  margin: 0 auto 1.6rem;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.filters {
  display: grid;
  grid-template-columns: 2fr repeat(2, 1fr);
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid #ffffff18;
  border-radius: 1rem;
  background: #151515;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.67rem;
  text-align: left;
  text-transform: uppercase;
}

.filters input,
.filters select {
  width: 100%;
  min-height: 3.4rem;
  padding: 0.75rem 0.9rem;
  border: 0;
  border-radius: 0.7rem;
  color: white;
  background: var(--button);
  font-family: "Expressway", Arial, sans-serif;
  font-size: 1rem;
  text-align: left;
}

.catalog-count {
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: left;
  text-transform: uppercase;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.result-tile {
  position: relative;
  min-width: 0;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  border: 0;
  border-radius: 1rem;
  background: #222;
  box-shadow: 0 0.45rem #050505;
  text-align: left;
  content-visibility: auto;
  contain-intrinsic-size: 240px 160px;
}

.result-tile:hover {
  z-index: 2;
  transform: translateY(-0.15rem) scale(1.02);
  filter: brightness(1.08);
}

.result-tile:active {
  transform: translateY(0.3rem);
  box-shadow: none;
}

.result-tile > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  min-height: 52%;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2.2rem 0.8rem 0.65rem;
  background: linear-gradient(transparent, #000e);
}

.tile-overlay strong {
  font-size: clamp(0.65rem, 1vw, 0.9rem);
  line-height: 1.15;
  text-transform: uppercase;
}

.tile-overlay small {
  margin-top: 0.25rem;
  color: #ccc;
  font-size: 0.56rem;
  text-transform: uppercase;
}

.tree-view {
  width: min(95vw, 1460px);
}

.tree-info {
  display: flex;
  width: 100%;
  gap: 2rem;
}

.tree-info-half {
  width: 100%;
  min-width: 0;
}

.tree-tip {
  margin: 0 auto 1rem;
  font-size: clamp(0.8rem, 1.3vw, 1.15rem);
  text-transform: uppercase;
}

.tree-matches {
  width: min(100%, 31rem);
  min-height: 4.3rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  border: 0;
  border-radius: 1rem;
  color: white;
  background: var(--button);
  box-shadow: 0 0.5rem var(--button-shadow);
  font-family: "Expressway", Arial, sans-serif;
  font-size: 1rem;
  text-align: left;
}

.tree-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.tree-legend-box {
  display: flex;
  width: clamp(7rem, 10vw, 9.5rem);
  height: 5.8rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.3rem);
  text-transform: uppercase;
}

.tree-legend-start {
  color: #000;
  background: #fff;
  box-shadow: inset 0 -0.5rem #c0c0c0;
}

.tree-legend-question {
  background: var(--button);
  box-shadow: inset 0 -0.5rem var(--button-shadow);
}

.tree-legend-result {
  border-radius: 0.8rem;
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 -0.5rem #0006;
  text-shadow: 0 0 4px #000, 0 0 8px #000;
}

.tree-heading {
  margin-top: clamp(3rem, 6vw, 5rem);
  margin-bottom: 1rem;
}

.tree-scroller {
  position: relative;
  width: 100%;
  max-height: min(76vh, 880px);
  overflow: auto;
  border: 1px solid #ffffff20;
  border-radius: 1rem;
  background: #090909;
  box-shadow: inset 0 0 2rem #000;
  overscroll-behavior: contain;
  scrollbar-color: #555 #151515;
  -webkit-overflow-scrolling: touch;
}

.tree-canvas {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  font-family: "Bebas Neue", sans-serif;
}

.tree-links {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.tree-edge-label {
  position: absolute;
  z-index: 2;
  display: flex;
  width: 114px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.3rem;
  border-radius: 0.3rem;
  box-shadow: 0 0.18rem 0.4rem #000a;
  font-family: "Bebas Neue", sans-serif;
  font-size: 0.74rem;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 2px #000;
  text-transform: uppercase;
  pointer-events: none;
}

.tree-cell {
  position: absolute;
  z-index: 3;
  display: flex;
  width: 190px;
  height: 82px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.48rem;
  cursor: pointer;
  border: 0;
  color: white;
  font-family: "Bebas Neue", sans-serif;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}

.tree-question-cell {
  background: var(--button);
  box-shadow: inset 0 -0.38rem var(--button-shadow);
  font-size: 0.75rem;
}

.tree-start-cell {
  color: #000;
  background: #fff;
  box-shadow: inset 0 -0.38rem #c0c0c0;
}

.tree-result-cell {
  border-radius: 0.65rem;
  background: #222;
  box-shadow: inset 0 -0.38rem #0006;
  font-size: 0.9rem;
  content-visibility: auto;
  contain-intrinsic-size: 190px 82px;
}

.tree-result-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tree-result-cell::after {
  position: absolute;
  inset: 0;
  background: #0006;
  content: "";
}

.tree-result-cell span {
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
  text-shadow: 0 0 2px #000, 0 0 5px #000;
}

.tree-cell:hover {
  z-index: 5;
  filter: brightness(1.18);
  transform: scale(1.035);
}

.route-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.9rem;
  padding: 0 0 1.25rem;
  text-align: left;
}

.route-timeline li:not(:last-child)::after {
  position: absolute;
  top: 2.1rem;
  bottom: 0.15rem;
  left: 1.12rem;
  width: 0.15rem;
  background: #ffffff1f;
  content: "";
}

.route-number {
  position: relative;
  z-index: 1;
  display: flex;
  width: 2.4rem;
  height: 2.4rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  color: #000;
  background: white;
  box-shadow: inset 0 -0.3rem #bbb;
  font-size: 0.8rem;
}

.route-timeline p {
  margin: 0 0 0.4rem;
  color: #ddd;
  font-family: "Expressway", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.35;
}

.route-timeline strong {
  display: inline-flex;
  padding: 0.35rem 0.55rem;
  border-radius: 0.4rem;
  color: white;
  background: #075b83;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  text-align: left;
}

.about-grid article,
.license-panel {
  padding: clamp(1.2rem, 2.5vw, 2rem);
  border: 1px solid #ffffff15;
  border-radius: 1.2rem;
  background: linear-gradient(155deg, #1e1e1e, #111);
}

.about-grid h2,
.license-panel h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  text-transform: uppercase;
}

.about-grid p,
.license-panel p {
  margin: 0;
  color: #ddd;
  font-family: "Expressway", Arial, sans-serif;
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  line-height: 1.58;
}

.license-panel {
  margin-top: 1rem;
  text-align: left;
}

footer {
  display: flex;
  width: min(90vw, 1180px);
  justify-content: center;
  gap: 1rem;
  margin: 5rem auto 0;
  padding: 1.6rem 0 2.2rem;
  border-top: 1px solid #ffffff18;
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
}

footer p { margin: 0; }
footer div { display: flex; gap: 0.55rem; }

.view-enter {
  animation: view-in 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(0.65rem) scale(0.995); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ambient-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(0.96, 1.04); }
  to { transform: translate3d(9%, 7%, 0) scale(1.08, 0.94); }
}

@keyframes nav-open {
  from { opacity: 0; transform: translateY(-0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .site-title {
    width: min(78vw, 660px);
    grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem;
  }

  .filters { grid-template-columns: 1fr 1fr; }
  .search-label { grid-column: 1 / -1; }
  .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .floating-nav {
    top: max(0.6rem, env(safe-area-inset-top));
    left: max(0.6rem, env(safe-area-inset-left));
  }

  .nav-button {
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: 0.55rem;
    border-radius: 0.8rem;
  }

  .nav-items-open {
    display: grid;
    grid-template-columns: repeat(2, 3.25rem);
    gap: 0.55rem;
    width: max-content;
    padding: 0.55rem;
    border: 1px solid #ffffff1c;
    border-radius: 0.9rem;
    background: rgb(12 12 12 / 96%);
    box-shadow: 0 0.8rem 1.8rem #000a;
  }

  .nav-items-open .nav-button { margin: 0; }

  .site-title {
    width: 100%;
    min-height: 5.4rem;
    grid-template-columns: 3.75rem minmax(0, 1fr) 3.75rem;
    padding: max(0.85rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) 0 max(0.5rem, env(safe-area-inset-left));
  }

  .wordmark { font-size: clamp(1.65rem, 7.5vw, 2rem); line-height: 0.98; }
  .version-label { padding-top: 0.45rem; font-size: 0.55rem; text-align: right; }
  section {
    width: min(100% - 1rem, 42rem);
    padding: 0.6rem 0 max(2.5rem, env(safe-area-inset-bottom));
  }
  .eyebrow { font-size: 0.67rem; }
  .intro { font-size: clamp(1.25rem, 5.8vw, 1.65rem); }
  .home-buttons { grid-template-columns: 1fr; gap: 0.8rem; }
  .start-button { grid-column: auto; min-height: 5.2rem; }
  .small-button { min-height: 4.2rem; }
  .merge-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .merge-summary div { min-height: 4.7rem; padding: 0.55rem 0.25rem; }
  .merge-summary strong { font-size: 1.55rem; }
  .merge-summary span { font-size: 0.52rem; }
  .quiz-view { width: min(100% - 1rem, 42rem); }
  .quiz-meta { width: 100%; margin-bottom: 0.9rem; padding: 0 0.2rem; gap: 0.75rem; font-size: 0.58rem; line-height: 1.25; }
  .quiz-meta span:last-child { text-align: right; }
  .question { margin-bottom: 1.15rem; font-size: clamp(1.45rem, 7vw, 1.9rem); line-height: 1.12; }
  .question[data-length="medium"] { font-size: clamp(1.3rem, 6.2vw, 1.65rem); }
  .question[data-length="long"] { font-size: clamp(1.15rem, 5.5vw, 1.45rem); }
  .answers { gap: 0.75rem; }
  .answer-button { min-height: 4.6rem; padding: 0.9rem 1rem; font-size: 1.05rem; }
  .answer-button[data-length="long"] { font-size: 0.92rem; }
  .answer-button img { width: 2rem; height: 2rem; }
  .back-button { min-height: 3.6rem; margin-top: 1.6rem; }
  .path-dots { margin-top: 1.15rem; }
  .result-view { width: min(100% - 1rem, 42rem); }
  .result-card { padding: 1rem 0.65rem 1.45rem; border-radius: 1.25rem; }
  .match { margin-bottom: 0.9rem; font-size: 1.75rem; }
  .match[data-length="medium"] { font-size: 1.55rem; }
  .match[data-length="long"] { font-size: 1.3rem; }
  .result-switchbar { grid-template-columns: 2.7rem minmax(0, 1fr) 2.7rem; gap: 0.35rem; }
  .switch-button, .switch-placeholder { width: 2.7rem; height: 5.5rem; }
  .flag { width: 100%; height: auto; max-width: 100%; max-height: none; aspect-ratio: 3 / 2; border-radius: 1.35rem; object-fit: contain; }
  .quote { margin-top: 1.35rem; padding: 0 1.25rem; font-size: 0.96rem; }
  .quote::before, .quote::after { font-size: 2rem; }
  .author { font-size: 0.76rem; }
  .result-details { gap: 0.45rem; }
  .result-details span { font-size: 0.6rem; }
  .route-details { padding: 0.9rem; }
  .result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .result-actions .button { width: 100%; min-width: 0; padding-inline: 0.65rem; }
  .filters { grid-template-columns: 1fr; }
  .search-label { grid-column: auto; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .result-tile { border-radius: 0.75rem; }
  .tile-overlay { padding: 2rem 0.55rem 0.5rem; }
  .tile-overlay strong { font-size: 0.68rem; }
  .tree-view { width: min(100% - 1rem, 42rem); }
  .tree-info { flex-direction: column; gap: 1.4rem; }
  .tree-tip { font-size: 0.95rem; line-height: 1.15; }
  .tree-matches { width: 100%; min-height: 3.5rem; padding: 0.85rem; border-radius: 0.75rem; font-size: 0.82rem; }
  .tree-legend { gap: 0.45rem; }
  .tree-legend-box { width: 29vw; height: 4.5rem; font-size: 0.72rem; }
  .tree-scroller { max-height: 72svh; border-radius: 0.7rem; }
  .about-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 380px) {
  .site-title { grid-template-columns: 3.45rem minmax(0, 1fr) 3.45rem; }
  .wordmark { font-size: 1.55rem; }
  .question { font-size: 1.4rem; }
  .question[data-length="medium"] { font-size: 1.24rem; }
  .question[data-length="long"] { font-size: 1.1rem; }
  .result-switchbar { grid-template-columns: 2.35rem minmax(0, 1fr) 2.35rem; }
  .switch-button, .switch-placeholder { width: 2.35rem; height: 4.8rem; padding: 0.55rem; }
  .result-grid { gap: 0.5rem; }
}

@media (max-width: 950px) and (max-height: 520px) and (orientation: landscape) {
  .site-title { min-height: 3.3rem; padding-top: 0.45rem; }
  .wordmark { font-size: 1.55rem; line-height: 1; }
  .version-label { padding-top: 0.3rem; }
  section { padding-top: 0.25rem; }
  .quiz-meta { margin-bottom: 0.5rem; }
  .question,
  .question[data-length="medium"],
  .question[data-length="long"] { margin-bottom: 0.7rem; font-size: 1.2rem; }
  .answers { gap: 0.5rem; }
  .answer-button { min-height: 3.35rem; padding: 0.65rem 0.9rem; }
  .back-button { min-height: 3.15rem; margin-top: 1rem; }
  .path-dots { margin-top: 0.75rem; }
}

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