@font-face {
  font-family: "DepartureMono";
  src: url("https://humantooth.neocities.org/fonts/DepartureMono.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "unixel";
  src: url("https://humantooth.neocities.org/fonts/unixel-Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg: #000;
  --fg: #fff;
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.22);
  --transition: 220ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
}

body {
  overflow: hidden;
  font-family: "DepartureMono", monospace;
}

button,
input {
  font: inherit;
}

button,
h1,
h2,
h3 {
  font-family: "unixel", monospace;
  font-weight: normal;
}

#app {
  min-height: 100vh;
  background: var(--bg);
}

.screen {
  display: none;
  position: relative;
  width: 100vw;
  min-height: 100vh;
  padding: 46px 34px 34px;
}

.screen:not(#startScreen) {
  background:
    linear-gradient(rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.28)),
    url("images/background.png") center / cover no-repeat;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 260ms ease both;
}

.reveal-card {
  animation: slideUp 420ms ease both;
}

.hero-layout,
.open-section {
  width: min(1180px, 100%);
}

.hero-copy,
.open-section {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.hero-copy {
  max-width: 1100px;
  padding-top: 40px;
}

.narrow-copy {
  max-width: 760px;
}

.wide-copy {
  max-width: 1120px;
}

.center-copy {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(4.2rem, 8.5vw, 8.4rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
}

h2 {
  margin: 10px 0 0;
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  line-height: 1;
}

h3 {
  margin: 0 0 18px;
  font-size: 1.28rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-tag,
.panel-copy,
.small-note,
.selection-label,
p,
label {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.6;
}

.hero-tag,
.panel-copy,
.small-note,
.muted {
  color: var(--muted);
}

.hero-tag {
  max-width: 760px;
}

.catch-text {
  margin-top: 22px;
  color: var(--fg);
  font-weight: 600;
}

/* Start screen */
#startScreen {
  align-items: flex-start;
  justify-content: center;
  text-align: left;
}

#startScreen .hero-layout {
  width: min(1400px, 100%);
  padding-top: 3vh;
}

#startScreen .hero-copy {
  max-width: 100%;
}

#startScreen .hero-copy h1 {
  margin-bottom: 22px;
  white-space: nowrap;
  font-size: clamp(6.2rem, 18vw, 16rem);
  line-height: 0.78;
}

#dino {
  position: fixed;
  left: 7vw;
  bottom: 8vh;
  z-index: 12;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  will-change: transform;
}

.dino-image {
  display: block;
  width: clamp(190px, 22vw, 360px);
  height: auto;
  image-rendering: pixelated;
  transform-origin: center bottom;
}

#dino.facing-right .dino-image {
  transform: scaleX(1);
}

#dino.facing-left .dino-image {
  transform: scaleX(-1);
}

#dino.facing-right.walking .dino-image {
  animation: dinoStepRight 0.38s ease-in-out infinite;
}

#dino.facing-left.walking .dino-image {
  animation: dinoStepLeft 0.38s ease-in-out infinite;
}

/* Forms and buttons */
.form-card {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.form-card label {
  display: grid;
  gap: 8px;
  text-align: left;
}

.form-card label > span {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

input {
  padding: 14px 4px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  outline: none;
  background: transparent;
  color: var(--fg);
  transition: border-color var(--transition), transform var(--transition);
}

input:focus {
  border-bottom-color: var(--fg);
  transform: translateY(-1px);
}

.button-row,
.button-stack,
.camera-controls,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}

.main-btn,
.ghost-btn {
  min-width: 190px;
  min-height: 54px;
  padding: 14px 26px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-size: clamp(1.25rem, 2vw, 2rem);
  text-transform: lowercase;
  transition:
    transform var(--transition),
    background var(--transition),
    color var(--transition),
    opacity var(--transition);
}

.main-btn:hover,
.ghost-btn:hover {
  background: var(--fg);
  color: var(--bg);
  transform: translateY(-2px);
}

.artist-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  width: min(820px, 100%);
  margin: 28px auto 0;
}

.artist-option {
  width: 100%;
  min-width: 0;
}

/* Colour and birthday */
.color-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  margin-top: 10px;
}

.wheel-shell {
  position: relative;
  width: min(420px, 72vw);
  height: min(420px, 72vw);
}

#colorWheel {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  cursor: crosshair;
}

.picked-color-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 760px;
}

#pickedSwatch {
  display: inline-block;
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  border: 1px solid var(--fg);
}

.selection-label {
  margin: 0;
  color: var(--fg);
  font-weight: 600;
}

.big-input {
  width: min(500px, 80vw);
  text-align: center;
}

.image-arrow {
  position: absolute;
  right: 32px;
  bottom: 28px;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  animation: arrowMove 1.7s ease-in-out infinite;
}

.image-arrow img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(1) brightness(5);
}

.hidden-arrow {
  opacity: 0;
  pointer-events: none;
}

.hidden-arrow.show-arrow {
  opacity: 1;
  pointer-events: auto;
}

/* Camera */
.camera-wrap {
  width: min(1320px, 100%);
}

.camera-frame {
  position: relative;
  width: 100%;
  height: min(760px, 74vh);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: var(--bg);
}

.camera-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  transform: scaleX(-1);
}

.camera-status {
  position: absolute;
  z-index: 3;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--fg);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
}

.camera-status.top-left {
  top: 18px;
  left: 18px;
}

.camera-scan-overlay {
  position: absolute;
  top: -20%;
  right: 0;
  left: 0;
  height: 20%;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.35), transparent);
  pointer-events: none;
}

.camera-scan-overlay.scanning {
  opacity: 1;
  animation: fullCameraScan 1.8s ease-in-out 1;
}

/* Results */
.results-layout {
  width: min(1220px, 100%);
}

.results-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

#resultsScreen h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 0.9;
}

#resultsScreen .eyebrow {
  margin-bottom: 4px;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(360px, 520px) 1fr;
  align-items: stretch;
  gap: 26px;
}

.score-row {
  display: grid;
  grid-template-columns: 104px 1fr 32px;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.scorebar {
  height: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.scorebar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--fg);
  transition: width 650ms ease;
}

.result-text p {
  margin: 0 0 16px;
}

#finalResult {
  margin-top: 12px;
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  line-height: 1;
}

.ai-summary-title {
  margin: 24px 0 8px;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ai-description {
  max-width: 760px;
  margin-top: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.result-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 380px;
  margin-top: 32px;
  overflow: hidden;
  background: transparent;
}

.result-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.06) 0,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 1px,
    transparent 6px
  );
  pointer-events: none;
}

.result-visual.show-result-visual::before {
  opacity: 0.45;
  animation: terminalLines 1.2s linear 1;
}

.result-visual::after {
  content: "loading visual...";
  position: absolute;
  bottom: 14px;
  left: 18px;
  opacity: 0;
  color: rgba(255, 255, 255, 0.65);
  font-family: "DepartureMono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-visual.show-result-visual::after {
  animation: loadingLabel 1.4s ease 1;
}

.result-visual img {
  display: none;
  width: min(430px, 100%);
  max-height: 520px;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.96);
}

.result-visual img.has-result-image {
  display: block;
}

.result-visual img.image-loaded {
  animation:
    computerReveal 850ms steps(18, end) forwards,
    imageSettle 900ms ease forwards;
}

.typing-active::after {
  content: "_";
  display: inline-block;
  margin-left: 3px;
  animation: blinkCursor 0.8s steps(1, end) infinite;
}

/* Legal links and pages */
.legal-footer {
  position: fixed;
  right: 18px;
  bottom: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  font-size: 0.78rem;
  line-height: 1.2;
}

.legal-footer a,
.legal-consent a,
.legal-document a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-footer a:hover,
.legal-footer a:focus-visible,
.legal-consent a:hover,
.legal-consent a:focus-visible,
.legal-document a:hover,
.legal-document a:focus-visible {
  text-decoration-thickness: 2px;
}

.form-card .legal-consent {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-top: 2px;
  text-align: left;
}

.form-card .legal-consent input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  margin: 5px 0 0;
  padding: 0;
  border: 1px solid var(--fg);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
}

.form-card .legal-consent input[type="checkbox"]:checked {
  background: var(--fg);
  box-shadow: inset 0 0 0 4px var(--bg);
}

.form-card .legal-consent input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.form-card .legal-consent span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
}

.legal-page-body {
  min-height: 100vh;
  overflow-y: auto;
  background:
    linear-gradient(rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.9)),
    url("images/background.png") center / cover fixed no-repeat;
}

.legal-page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 90px;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 34px;
}

.legal-nav a {
  color: var(--fg);
  font-size: 0.92rem;
}

.legal-document {
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
}

.legal-document h1 {
  margin-bottom: 16px;
  font-size: clamp(3rem, 8vw, 6.6rem);
  line-height: 0.88;
}

.legal-document h2 {
  margin: 34px 0 10px;
  font-size: clamp(1.45rem, 3.5vw, 2.3rem);
  line-height: 1.1;
}

.legal-document p,
.legal-document li {
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.98rem;
  line-height: 1.75;
}

.legal-document ul {
  margin: 10px 0 0;
  padding-left: 22px;
}

.legal-document .legal-effective {
  margin-bottom: 28px;
  color: var(--fg);
}

.legal-document .legal-callout {
  margin: 22px 0;
  padding: 16px 18px;
  border-left: 3px solid var(--fg);
  background: rgba(255, 255, 255, 0.07);
  color: var(--fg);
}

/* Spotify callback/loading screen */
html.spotify-callback-pending #startScreen {
  display: none !important;
}

html.spotify-callback-pending #spotifyLoadingScreen,
#spotifyLoadingScreen.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#spotifyLoadingScreen {
  background:
    linear-gradient(rgba(0, 0, 0, 0.52), rgba(0, 0, 0, 0.72)),
    url("images/background.png") center / cover no-repeat;
}

.spotify-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
}

.spotify-loading-card h1 {
  margin-top: 18px;
  font-size: clamp(3.4rem, 8vw, 7.2rem);
}

.spotify-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
}

.spotify-loader span {
  width: 14px;
  height: 14px;
  border: 1px solid var(--fg);
  border-radius: 50%;
  background: var(--fg);
  animation: spotifyLoadingPulse 1.1s ease-in-out infinite;
}

.spotify-loader span:nth-child(2) {
  animation-delay: 0.16s;
}

.spotify-loader span:nth-child(3) {
  animation-delay: 0.32s;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dinoStepRight {
  0%, 100% { transform: scaleX(1) translateY(0) rotate(0deg); }
  50% { transform: scaleX(1) translateY(-6px) rotate(-1.2deg); }
}

@keyframes dinoStepLeft {
  0%, 100% { transform: scaleX(-1) translateY(0) rotate(0deg); }
  50% { transform: scaleX(-1) translateY(-6px) rotate(1.2deg); }
}

@keyframes arrowMove {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

@keyframes fullCameraScan {
  from { top: -20%; }
  to { top: 100%; }
}

@keyframes blinkCursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes computerReveal {
  0% { clip-path: inset(0 100% 0 0); opacity: 0.22; }
  25% { clip-path: inset(0 72% 0 0); opacity: 0.5; }
  60% { clip-path: inset(0 34% 0 0); opacity: 0.72; }
  100% { clip-path: inset(0); opacity: 1; }
}

@keyframes imageSettle {
  from { transform: scale(0.96); filter: brightness(1.2) contrast(1.18); }
  to { transform: scale(1); filter: brightness(1) contrast(1); opacity: 1; }
}

@keyframes terminalLines {
  from { transform: translateY(-100%); }
  to { transform: translateY(100%); }
}

@keyframes loadingLabel {
  0%, 100% { opacity: 0; }
  15%, 85% { opacity: 1; }
}

@keyframes spotifyLoadingPulse {
  0%, 70%, 100% { opacity: 0.28; transform: translateY(0) scale(0.82); }
  35% { opacity: 1; transform: translateY(-8px) scale(1); }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .screen {
    min-height: auto;
    padding-top: 34px;
    padding-bottom: 110px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .results-topline {
    flex-direction: column;
  }

  .picked-color-row {
    flex-direction: column;
    text-align: center;
  }

  .camera-frame {
    height: min(620px, 66vh);
  }

  .image-arrow {
    right: 16px;
    bottom: 18px;
    width: 72px;
    height: 72px;
  }

  .result-visual {
    min-height: 320px;
  }

  .result-visual img {
    width: min(360px, 100%);
    max-height: 460px;
  }
}

@media (max-width: 720px) {
  #startScreen .hero-copy h1 {
    white-space: nowrap;
    font-size: clamp(4.4rem, 22vw, 7rem);
  }

  .dino-image {
    width: clamp(150px, 38vw, 240px);
  }

  #dino {
    bottom: 10vh;
  }

  .artist-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: clamp(3.2rem, 14vw, 5rem);
  }

  .button-row,
  .button-stack,
  .camera-controls,
  .result-actions {
    flex-direction: column;
  }

  .main-btn,
  .ghost-btn {
    width: 100%;
    min-height: 52px;
    padding: 13px 22px;
    font-size: clamp(1.15rem, 5.5vw, 1.7rem);
  }

  .legal-footer {
    right: 12px;
    bottom: 10px;
    left: 12px;
    justify-content: center;
  }

  .legal-page {
    width: min(100% - 20px, 920px);
    padding-top: 18px;
  }

  .legal-document {
    padding: 24px 18px;
  }
}

@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;
  }
}
