/* ============================================================
   The Hook-Up Game — styles
   Palette: peach canvas, teal-blue + coral workhorses,
   lavender + sage accents, near-black ink.
   ============================================================ */

:root {
  --peach:  #F4D9BD;
  --blue:   #3E92A8;
  --coral:  #E6552E;
  --lav:    #C8B7E8;
  --sage:   #D7E0C4;
  --cream:  #FBF6EE;
  --ink:    #1A1A1A;
  --grey:   #6f6a63;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 0 rgba(26,26,26,.08), 0 18px 40px rgba(26,26,26,.10);
  --line: 3px solid var(--ink);
  --maxw: 720px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Arial", "Helvetica Neue", Helvetica, sans-serif;
  color: var(--ink);
  background-color: var(--peach);
  background-image: url("img/bg-pattern.png");
  background-size: 360px;
  background-repeat: repeat;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 18px 80px;
}

/* ---------- Screens (wizard) ---------- */
.screen { display: none; width: 100%; max-width: var(--maxw); animation: rise .4s ease; }
.screen--active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Card ---------- */
.card {
  background: var(--cream);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 30px 26px;
}
.card.center { text-align: center; }

.step-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--blue);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 14px;
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.12; }
h2 { font-size: 28px; }
h3 { font-size: 20px; }
.muted { color: var(--grey); margin: 0 0 20px; font-size: 15.5px; }

/* ---------- Hero ---------- */
.hero-card { text-align: center; }
.hero-logo { width: 92px; height: 92px; object-fit: contain; margin-bottom: 4px; }
.title { font-size: 42px; letter-spacing: -.01em; }
.subtitle { color: var(--grey); font-size: 17px; max-width: 460px; margin: 6px auto 18px; }
.hero-art {
  width: 100%; max-width: 520px; border-radius: var(--radius-sm);
  border: var(--line); margin: 0 auto 22px; display: block;
}
.fineprint { font-size: 12.5px; color: var(--grey); margin-top: 16px; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 700; font-size: 16px;
  border: var(--line); border-radius: 999px;
  padding: 13px 26px; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
  box-shadow: 0 4px 0 var(--ink);
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn--primary { background: var(--coral); color: var(--cream); }
.btn--ghost { background: var(--cream); color: var(--ink); box-shadow: 0 4px 0 rgba(26,26,26,.25); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: 0 4px 0 rgba(26,26,26,.2); }
.btn:disabled:active { transform: none; }

.nav-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.nav-row--center { justify-content: center; }

/* ---------- Top bar (About + Restart, persistent) ---------- */
.topbar { position: fixed; top: 16px; right: 16px; z-index: 50; display: flex; gap: 10px; }
.topbar-btn {
  font: inherit; font-weight: 700; font-size: 14px;
  background: var(--cream); color: var(--ink); text-decoration: none;
  border: 2px solid var(--ink); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; box-shadow: 0 3px 0 var(--ink);
  display: inline-flex; align-items: center; white-space: nowrap;
}
.topbar-btn:active { transform: translateY(3px); box-shadow: none; }

/* ---------- Choice grids (anatomy / condom) ---------- */
.choice-grid { display: grid; gap: 16px; }
.choice-grid--2 { grid-template-columns: 1fr 1fr; }
.choice-grid--3 { grid-template-columns: 1fr 1fr 1fr; }

.choice {
  font: inherit; cursor: pointer;
  background: var(--peach);
  border: var(--line); border-radius: var(--radius-sm);
  padding: 16px 10px; display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  transition: transform .1s, background .15s, box-shadow .1s;
  box-shadow: 0 4px 0 rgba(26,26,26,.18);
}
.choice img, .choice .sprite { width: 96px; height: 96px; object-fit: contain; border-radius: 10px; }
.choice span { font-weight: 700; font-size: 16px; }
.choice:hover { transform: translateY(-2px); }
.choice.selected { background: var(--sage); box-shadow: 0 4px 0 var(--ink); outline: 3px solid var(--ink); }

/* Wide cards for the banner-shaped partner-anatomy icons */
.choice--wide img { width: 100%; height: auto; max-height: 92px; }

/* Vaccine choice: HPV microbe with a status badge */
.microbe-badge { position: relative; width: 96px; height: 96px; }
.badge {
  position: absolute; bottom: -6px; right: -6px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: var(--cream);
  border: 2px solid var(--ink);
}
.badge--ok { background: #4f9a4f; }
.badge--no { background: var(--coral); }

/* ---------- Tiers (partners) ---------- */
.banner-art { width: 100%; border-radius: var(--radius-sm); border: var(--line); margin-bottom: 20px; }

/* Tier cards: large, selectable, mutually exclusive */
.tier-grid { gap: 16px; }
.choice--tier { padding: 18px 14px 16px; gap: 8px; }
.choice--tier img { width: 150px; height: 150px; object-fit: contain; border-radius: 12px; }
.choice--tier .tier-name { font-size: 18px; font-weight: 800; }
.choice--tier small { color: var(--grey); font-size: 13px; font-weight: 400; line-height: 1.35; }

/* Count control (appears after a tier is picked) */
.count-control {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-top: 22px; padding: 18px; border: var(--line); border-radius: var(--radius-sm);
  background: var(--sage); animation: rise .3s ease;
}
.count-control[hidden] { display: none; }
.count-control label { font-weight: 800; font-size: 17px; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 44px; height: 44px; font-size: 24px; font-weight: 700; line-height: 1;
  border: var(--line); border-radius: 12px; background: var(--cream); cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.stepper button:active { transform: translateY(3px); box-shadow: none; }
.stepper button:disabled { opacity: .3; cursor: not-allowed; box-shadow: 0 3px 0 rgba(26,26,26,.3); }
.stepper .count { min-width: 44px; text-align: center; font-size: 28px; font-weight: 800; }
.stepper--lg button { width: 52px; height: 52px; font-size: 28px; }
.stepper--lg .count { min-width: 56px; font-size: 34px; }

/* ---------- Sprites (cropped from sprite-sheet PNGs) ----------
   --n = number of cells across, --i = which cell (0-based)        */
.sprite {
  background-repeat: no-repeat;
  background-size: calc(var(--n) * 100%) 100%;
  background-position: calc(var(--i) / (var(--n) - 1) * 100%) 50%;
}
.sprite--condom  { background-image: url("img/condom-toggle.png"); }

/* Single-image microbe artwork (result reveal + HPV vaccine step) */
.microbe-img {
  width: 84px; height: 84px; border: 2px solid var(--ink); border-radius: 12px;
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.microbe-img--hpv { width: 96px; height: 96px; background-image: url("img/sti-HPV.png"); }

/* ---------- Rolling ---------- */
.dice-art { width: 160px; height: 160px; object-fit: contain; margin-bottom: 10px; }
.spin { animation: tumble .7s ease-in-out infinite; }
@keyframes tumble {
  0%   { transform: rotate(0deg) translateY(0); }
  50%  { transform: rotate(180deg) translateY(-12px); }
  100% { transform: rotate(360deg) translateY(0); }
}

/* ---------- Results ---------- */
.odds-meter {
  position: relative; height: 46px; border: var(--line); border-radius: 999px;
  background: var(--cream); overflow: hidden; margin: 10px 0 26px;
}
.odds-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--sage), var(--blue) 55%, var(--coral));
  border-right: 3px solid var(--ink);
  transition: width 1s cubic-bezier(.2,.8,.2,1);
}
.odds-num {
  position: absolute; top: 50%; right: 16px; transform: translateY(-50%);
  font-weight: 800; font-size: 22px; color: var(--ink);
  background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px;
}

.outcome {
  background: var(--peach); border: var(--line); border-radius: var(--radius-sm);
  padding: 18px; margin-bottom: 18px;
}
.outcome[hidden] { display: none; }
.outcome.clear { background: var(--sage); }
.outcome.hit   { background: #f6e2d6; }
.result-content { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }

/* inline dice animation while rolling */
.rolling-inline { display: none; flex-direction: column; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; padding: 8px; }
.rolling-inline .dice-art { width: 120px; height: 120px; margin: 0; }
.outcome.rolling { text-align: center; }
.outcome.rolling .result-content { display: none; }
.outcome.rolling .rolling-inline { display: flex; }

/* Roll buttons */
.roll-zone { text-align: center; margin: 22px 0 18px; }
.btn--dice { font-size: 19px; padding: 16px 38px; }

/* Respec menu (text-only) */
.respec { border: var(--line); border-radius: var(--radius-sm); background: var(--cream); padding: 14px 18px 16px; margin-bottom: 18px; }
.respec-title { font-size: 18px; margin-bottom: 6px; }
.respec-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-top: 2px dashed rgba(26,26,26,.15); flex-wrap: wrap;
}
.respec-row:first-of-type { border-top: none; }
.respec-label { font-weight: 700; font-size: 15px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 8px 15px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--cream); color: var(--ink); cursor: pointer; transition: background .12s, color .12s;
}
.pill:hover { background: var(--peach); }
.pill.active { background: var(--blue); color: var(--cream); }
.outcome-art { width: 100%; border-radius: 10px; border: 2px solid var(--ink); }
.outcome-text h3 { font-size: 22px; }
.outcome-text p { margin: 6px 0 0; color: var(--ink); font-size: 15px; line-height: 1.5; }
.microbe-wrap { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.microbe-item { display: flex; align-items: center; gap: 14px; }
.microbe-name { font-weight: 800; font-size: 18px; }

/* ---------- Breakdown bars ---------- */
.breakdown { margin-bottom: 20px; }
.breakdown summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.bars { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.bar-row { display: grid; grid-template-columns: 128px 1fr 56px; align-items: center; gap: 10px; font-size: 14px; }
.bar-track { height: 18px; background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar-val { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.bar-pct { font-weight: 700; text-align: right; }

/* ---------- CTA ---------- */
.cta {
  display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center;
  background: var(--lav); border: var(--line); border-radius: var(--radius-sm);
  padding: 16px; margin: 30px 0 22px;
}
.cta img { width: 100%; border-radius: 10px; border: 2px solid var(--ink); }
.cta h3 { font-size: 19px; }
.cta p { margin: 4px 0 0; font-size: 14.5px; line-height: 1.5; }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .card { padding: 22px 18px; }
  .title { font-size: 32px; }
  h2 { font-size: 23px; }
  .choice-grid--3 { grid-template-columns: 1fr; }
  .choice img, .choice .sprite { width: 80px; height: 80px; }
  .result-content, .cta { grid-template-columns: 1fr; text-align: center; }
  .outcome-art, .cta img { max-width: 220px; margin: 0 auto; }
  .choice--tier img { width: 120px; height: 120px; }
  .bar-row { grid-template-columns: 96px 1fr 48px; }
}
