:root {
  --paper: #f4efe5;
  --ink: #151515;
  --muted: #6f6a62;
  --red: #ed4a38;
  --purple: #6458e8;
  --green: #087d5b;
  --line: rgba(21, 21, 21, 0.18);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Manrope", Arial, sans-serif;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(237, 74, 56, .09), transparent 28%),
    radial-gradient(circle at 92% 80%, rgba(100, 88, 232, .10), transparent 27%),
    var(--paper);
  font-family: var(--sans);
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  opacity: .19;
  pointer-events: none;
  z-index: 30;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.11'/%3E%3C/svg%3E");
}

.site-header {
  width: min(1200px, calc(100% - 40px));
  height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 31;
}

.wordmark, .text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.wordmark {
  padding: 0;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.06em;
}

.wordmark span {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 6px;
  transform: rotate(-2deg);
  margin-left: 2px;
}

.text-button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
}

.text-button:hover { border-color: var(--ink); }

main {
  min-height: calc(100vh - 142px);
  display: grid;
  place-items: center;
  padding: 44px 20px 60px;
}

.hidden { display: none !important; }

.intro, .results {
  width: min(760px, 100%);
  text-align: center;
  animation: appear .55s ease both;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  margin-bottom: 22px;
}

h1 {
  max-width: 750px;
  margin: 0 auto 20px;
  font-family: var(--serif);
  font-size: clamp(52px, 7.3vw, 92px);
  line-height: .91;
  letter-spacing: -.045em;
  font-weight: 400;
}

h1 em { color: var(--red); font-weight: 400; }

.dek {
  max-width: 520px;
  margin: 0 auto 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.intro-card {
  width: 206px;
  height: 246px;
  margin: 32px auto 30px;
  position: relative;
  background: var(--ink);
  padding: 9px;
  box-shadow: 11px 11px 0 var(--purple), -10px -8px 0 var(--red);
  transform: rotate(2deg);
}

.intro-portrait {
  position: relative;
  height: 181px;
  overflow: hidden;
  background: #1a1a1a;
}

.intro-portrait img,
.portrait-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-portrait img {
  z-index: 1;
  object-fit: cover;
  object-position: 50% 25%;
  filter: grayscale(1) contrast(1.05);
}

.portrait-placeholder {
  height: 181px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: linear-gradient(145deg, #555 0%, #1a1a1a 60%);
  font-family: var(--serif);
  font-size: 130px;
  line-height: 1;
  filter: grayscale(1);
}

.intro-card-copy {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 12px 4px 0;
  color: white;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
}

.intro-card-copy small { font-family: var(--mono); font-size: 8px; color: #aaa; }

.intro-stamp {
  position: absolute;
  z-index: 2;
  padding: 4px 7px;
  border: 3px solid;
  font-size: 15px;
  font-weight: 800;
  opacity: .9;
}

.stamp-left { left: -37px; top: 55px; color: var(--purple); transform: rotate(-14deg); }
.stamp-right { right: -31px; top: 130px; color: var(--red); transform: rotate(13deg); }

.primary-button, .secondary-button {
  border: 1px solid var(--ink);
  min-height: 52px;
  padding: 0 22px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.primary-button {
  color: var(--paper);
  background: var(--ink);
  box-shadow: 5px 5px 0 var(--red);
}

.primary-button span { margin-left: 24px; }
.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--red); }
.primary-button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--red); }

.secondary-button { background: transparent; }
.secondary-button:hover { background: rgba(21,21,21,.06); }

.tiny-note {
  margin: 20px 0 0;
  min-height: 16px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}

.game { width: min(520px, 100%); animation: appear .4s ease both; }

.game-meta {
  display: grid;
  grid-template-columns: 62px 1fr 62px;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  font-family: var(--mono);
}

.game-meta > div:first-child span { font-size: 18px; }
.game-meta small { color: var(--muted); font-size: 9px; }
.score { text-align: right; display: flex; flex-direction: column; }
.score span { font-size: 18px; line-height: 1; }

.progress-track { height: 3px; background: rgba(21,21,21,.15); }
.progress-fill { width: 0; height: 100%; background: var(--ink); transition: width .3s ease; }

.card-stage { height: min(590px, 64vh); min-height: 450px; position: relative; perspective: 1100px; }

.philosopher-card {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(21,21,21,.2);
  background: #222;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(30,20,10,.16);
}

.card-shadow { pointer-events: none; background: #ddd5c8; }
.shadow-one { transform: rotate(2.4deg) translate(5px, 7px); }
.shadow-two { transform: rotate(-2deg) translate(-4px, 10px); background: #d9d0c3; }

.active-card {
  cursor: grab;
  touch-action: none;
  user-select: none;
  will-change: transform;
  transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .3s ease;
}

.active-card.dragging { cursor: grabbing; transition: none; }
.active-card.exit-left { transform: translate(-130%, 20px) rotate(-20deg) !important; opacity: 0; }
.active-card.exit-right { transform: translate(130%, 20px) rotate(20deg) !important; opacity: 0; }

.active-card img, .portrait-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.03);
  pointer-events: none;
}

.portrait-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #76716a, #1b1b1b 72%);
  color: rgba(255,255,255,.7);
  font-family: var(--serif);
  font-size: 240px;
}

.image-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.08) 35%, rgba(0,0,0,.86) 100%);
  pointer-events: none;
}

.card-number {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 7px 9px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}

.card-copy { position: absolute; left: 24px; right: 24px; bottom: 24px; color: white; }
.card-copy h2 { margin: 6px 0 0; font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 8vw, 64px); line-height: .9; letter-spacing: -.03em; }
.clue { margin: 0 0 8px; max-width: 430px; font-size: 13px; line-height: 1.45; color: rgba(255,255,255,.82); }
.lifespan { margin-top: 12px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: rgba(255,255,255,.62); }

.swipe-label {
  position: absolute;
  z-index: 5;
  top: 52px;
  padding: 7px 10px;
  border: 4px solid;
  font-size: 22px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
}

.not-label { left: 26px; color: #ff745f; transform: rotate(-8deg); }
.virgin-label { right: 26px; color: #9e92ff; transform: rotate(8deg); }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.choice-button {
  height: 58px;
  border: 1px solid var(--ink);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  transition: .18s ease;
}

.choice-button:hover { transform: translateY(-2px); }
.virgin-choice:hover { background: var(--purple); color: white; border-color: var(--purple); }
.not-choice:hover { background: var(--red); color: white; border-color: var(--red); }
.choice-icon { width: 31px; height: 31px; border: 1px solid currentColor; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 19px; }
kbd { margin-left: auto; font-family: var(--mono); font-size: 12px; font-weight: 400; }
.drag-hint { margin: 13px 0 0; text-align: center; font-family: var(--mono); color: var(--muted); font-size: 8px; letter-spacing: .08em; }

.reveal-backdrop { position: fixed; inset: 0; background: rgba(15,12,9,.58); backdrop-filter: blur(4px); z-index: 50; animation: fade .25s ease; }
.reveal-sheet {
  position: fixed;
  z-index: 51;
  left: 50%;
  bottom: 0;
  width: min(680px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 18px 34px 32px;
  background: var(--paper);
  transform: translate(-50%, 105%);
  transition: transform .42s cubic-bezier(.16,.8,.25,1);
  box-shadow: 0 -20px 80px rgba(0,0,0,.25);
}

.reveal-sheet.open { transform: translate(-50%, 0); }
.sheet-grabber { width: 44px; height: 3px; background: rgba(21,21,21,.24); margin: 0 auto 26px; }
.reveal-topline { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; }
#revealPoints { color: var(--green); font-weight: 700; }
.reveal-sheet h2 { margin: 18px 0 22px; font-family: var(--serif); font-weight: 400; font-size: clamp(48px, 9vw, 74px); line-height: .91; letter-spacing: -.035em; }
.confidence-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 8px; letter-spacing: .05em; }
.confidence-track { height: 5px; background: rgba(21,21,21,.12); }
#confidenceFill { height: 100%; background: var(--ink); }
.reveal-sheet > p { font-family: var(--serif); font-size: 24px; line-height: 1.25; }
.epistemic-note { padding: 14px; background: rgba(21,21,21,.055); font-size: 11px; line-height: 1.5; color: var(--muted); }
.epistemic-note strong { color: var(--ink); }
.sheet-actions { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 26px; }
.sheet-actions a { color: var(--ink); font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-underline-offset: 4px; }

.results { max-width: 650px; }
.result-mark { width: 132px; height: 132px; margin: 0 auto 26px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-family: var(--serif); font-size: 46px; transform: rotate(-5deg); box-shadow: 9px 7px 0 var(--red); }
.results h1 { font-size: clamp(44px, 6vw, 72px); }
.share-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 350px; margin: 28px auto; }
.share-dot { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--ink); font-family: var(--mono); font-size: 10px; font-weight: 700; }
.share-dot.correct { background: var(--green); color: white; border-color: var(--green); }
.share-dot.wrong { background: var(--red); color: white; border-color: var(--red); }
.share-dot.unknown { background: var(--purple); color: white; border-color: var(--purple); }
.result-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

dialog {
  width: min(610px, calc(100% - 32px));
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 48px;
  box-shadow: 12px 12px 0 var(--purple);
}
dialog::backdrop { background: rgba(15,12,9,.66); backdrop-filter: blur(5px); }
dialog h2 { margin: 0 0 24px; font-family: var(--serif); font-weight: 400; font-size: 49px; line-height: .95; }
dialog p { color: var(--muted); font-size: 13px; line-height: 1.65; }
dialog .secondary-button { margin-top: 14px; width: 100%; }
.dialog-close { position: absolute; top: 15px; right: 18px; border: 0; background: transparent; font-size: 30px; cursor: pointer; }

footer { height: 60px; width: min(1200px, calc(100% - 40px)); margin: 0 auto; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 8px; letter-spacing: .08em; color: var(--muted); }

@keyframes appear { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 620px) {
  .site-header { height: 66px; }
  main { padding: 26px 14px 44px; min-height: calc(100vh - 112px); }
  .intro-card { margin-top: 28px; }
  .card-stage { min-height: 420px; height: 59vh; max-height: 600px; }
  .game-meta { margin-inline: 4px; }
  .choice-row { margin-top: 17px; gap: 8px; }
  .choice-button { padding: 0 9px; height: 54px; }
  .choice-button kbd { display: none; }
  .card-copy { left: 18px; right: 18px; bottom: 20px; }
  .card-copy h2 { font-size: 36px; }
  .reveal-sheet { padding: 14px 20px 24px; }
  .sheet-actions { align-items: stretch; flex-direction: column-reverse; }
  .sheet-actions .primary-button, .sheet-actions a { width: 100%; text-align: center; }
  .sheet-actions a { padding: 10px; }
  dialog { padding: 40px 24px 26px; }
  dialog h2 { font-size: 39px; }
  footer { height: 46px; }
  footer span:last-child { display: none; }
}

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