:root {
  --cream: #F5F1EA;
  --ivory: #FAF7F2;
  --sage: #A8B5A0;
  --terracotta: #C97D5D;
  --dusty-rose: #C9A0A0;
  --charcoal: #2E2E2E;
  --soft-grey: #8A8A8A;
  --warm-grey: #B8AFA0;
  --gold: #B89968;
  --border: #E7E0D3;
  --lilac-wash: #ECE6F4;   /* soft lavender — small accent surfaces */
  --intro-purple: #D7CBEF; /* full-bleed bookend background (intro + conversion) */
  --lilac: #8E7BB5;        /* muted lavender accent (cousin of MDST's electric violet) */
  --lilac-border: #D8CEE8;
  --violet: #6C4EE6;       /* MDST brand violet — primary CTAs */
  --violet-deep: #5A3FD0;  /* hover */

  /* Inter is the MDST brand font — used everywhere. Hierarchy comes from weight,
     not from a second typeface. (--serif kept as an alias so existing rules work.) */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --pad: 24px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  background: var(--cream);
  transition: background-color .7s ease;  /* fade between the purple bookends and beige gameplay */
  color: var(--charcoal);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
}

img { display: block; max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* SCREENS */
.screen {
  display: none;
  padding: 66px var(--pad) 60px;  /* top clearance for the fixed brand mark + sound toggle */
  min-height: 100vh;
  min-height: 100dvh;
  animation: screenIn .55s cubic-bezier(.4, .0, .2, 1) both;
  transition: opacity .25s ease;
}
/* Center content vertically between the fixed top bar and the bottom.
   Short screens center; tall screens (min-height grows past the viewport) flow
   from the top and scroll normally. */
.screen.active { display: flex; flex-direction: column; justify-content: center; }

/* The "MDST is speaking" bookends (intro + conversion) are full-bleed purple —
   the page background goes purple (see body.bookend) and these screens stay
   transparent so it fills the whole viewport, then fades to beige on advance.
   Gameplay + results stay cream so the cream-background garments blend. */
.screen[data-screen="intro"],
.screen[data-screen="conversion"] {
  background: transparent;
}
body.bookend { background: var(--intro-purple); }
@keyframes screenIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
/* intercard has a longer, more dramatic entry */
.screen[data-screen="intercard"] {
  animation: intercardScreenIn .9s cubic-bezier(.4, .0, .2, 1) both;
}
@keyframes intercardScreenIn {
  0%   { opacity: 0; transform: translateX(40px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateX(0); }
}

/* TYPOGRAPHY */
.wordmark {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .32em;
}
.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: block;
}
/* persistent brand mark — top-left of the app rectangle (not the desktop window).
   The app is a 480px centered column; pin to its left edge via calc, clamped to 14px on mobile. */
.brand-mark {
  position: fixed;
  top: 14px;
  left: max(14px, calc(50vw - 226px));
  z-index: 50;
  width: 40px; height: 40px;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
  display: block;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo-link { display: inline-block; line-height: 0; }
.brand-logo-center-link { display: block; width: fit-content; margin: 0 auto 18px; }
.brand-logo-center { margin: 0; }
.intro-download {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6E6488;          /* muted lavender — cool, harmonizes with the purple, legible */
  text-decoration: none;
  transition: color .2s ease;
}
.intro-download:hover { color: var(--violet-deep); }
.share-card-logo { width: 88px; height: 88px; border-radius: 14px; }
.eyebrow {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: .28em;
  color: var(--soft-grey);
  text-transform: uppercase;
}
.serif-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 16px 0 14px;
}
.display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 56px;
  line-height: 1.0;
  letter-spacing: -.015em;
  margin: 24px 0 18px;
}
.italic-lede {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 20px;
  line-height: 1.45;
  margin: 0 0 28px;
}
.lede {
  font-size: 17px;
  margin: 0 0 36px;
  line-height: 1.5;
}
.footnote {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--soft-grey);
  text-transform: uppercase;
  margin-top: 32px;
}

/* BUTTONS */
.btn {
  display: inline-block;
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, opacity .2s ease, transform .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: var(--violet-deep); }
.btn-primary:disabled { background: var(--border); color: var(--soft-grey); cursor: not-allowed; }
.btn-secondary {
  background: transparent;
  color: var(--charcoal);
  border: 1px solid var(--charcoal);
  margin-bottom: 12px;
}
.btn-secondary:hover { background: var(--charcoal); color: var(--cream); }
.btn-secondary:disabled { border-color: var(--border); color: var(--soft-grey); cursor: wait; }
.btn-ghost {
  background: transparent;
  color: var(--charcoal);
  border: none;
  text-align: center;
  letter-spacing: .26em;
}
.btn-ghost::after {
  content: " →";
  letter-spacing: 0;
}

/* AUDIO TOGGLE */
.audio-toggle {
  position: fixed;
  top: 14px;
  right: max(14px, calc(50vw - 226px));
  z-index: 50;
  background: rgba(245,241,234,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--soft-grey);
  font-weight: 500;
  cursor: pointer;
}
.audio-toggle[aria-pressed="true"] { color: var(--lilac); border-color: var(--lilac); }

/* ============ INTRO ============ */
.intro-inner { padding-top: 24px; }
.intro-inner .display { margin-top: 8px; }
.intro-inner .italic-lede { font-size: 22px; margin-bottom: 22px; }
.intro-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 38px;
  color: var(--charcoal);
}
.intro-body em { font-style: italic; }
.intro-inner .intro-body { margin-bottom: 14px; }
.intro-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.4;
  color: var(--charcoal);
  margin: 0 0 32px;
}

/* ============ CHARACTER CREATOR ============ */
.screen[data-screen="creator"] { background: var(--lilac-wash); }
.creator-inner { padding-top: 40px; }
.creator-inner .eyebrow { margin-bottom: 14px; }
.creator-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 44px;
  line-height: 1.0;
  letter-spacing: -.015em;
  margin: 0 0 14px;
}
.creator-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.5;
  color: var(--charcoal);
  margin: 0 0 28px;
  max-width: 360px;
}
.creator-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.creator-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--ivory);
  cursor: pointer;
  padding: 0;
  transition: border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}
.creator-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creator-card:active { transform: scale(.97); }
.creator-card.selected {
  border-color: var(--lilac);
  box-shadow: 0 0 0 3px rgba(142,123,181,.22), 0 8px 24px -10px rgba(142,123,181,.5);
}
.creator-card .creator-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--lilac);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}
.creator-card.selected .creator-check { display: flex; }

.name-field {
  display: block;
  margin: 0 0 24px;
}
.name-label {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .26em;
  color: var(--soft-grey);
  text-transform: uppercase;
  margin-bottom: 8px;
}
#name-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--lilac-border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.5);
  font-family: var(--serif);
  font-size: 22px;
  color: var(--charcoal);
  outline: none;
  transition: border-color .2s ease, background .2s ease;
}
#name-input:focus { border-color: var(--lilac); background: #fff; }
#name-input::placeholder { color: var(--warm-grey); font-style: italic; }

/* ============ INTERCARD ============ */
.intercard-inner {
  text-align: center;
  animation: intercardIn 1s ease both;
}
@keyframes intercardIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.intercard-illustration {
  width: 78%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 22px;
  overflow: hidden;
  position: relative;
}
.intercard-illustration img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: kenBurns 3.2s cubic-bezier(.2, .0, .2, 1) both;
}
@keyframes kenBurns {
  from { transform: scale(1.06); opacity: 0; }
  20%  { opacity: 1; }
  to   { transform: scale(1.0); opacity: 1; }
}
.intercard-number {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .42em;
  color: var(--soft-grey);
  text-transform: uppercase;
  margin-bottom: 28px;
}
.intercard-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 64px;
  line-height: 1;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.intercard-place {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--soft-grey);
  margin: 0 0 36px;
}
.intercard-body {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto 56px;
  color: var(--charcoal);
}
.intercard-progress {
  width: 60px;
  height: 1px;
  background: var(--border);
  margin: 24px auto 0;
  overflow: hidden;
}
.intercard-progress-bar {
  height: 100%;
  width: 0;
  background: var(--lilac);
  transition: width linear;
}
.btn-ghost {
  font-size: 10px;
  letter-spacing: .26em;
  color: var(--soft-grey);
  padding: 12px 18px;
}
.btn-ghost:hover { color: var(--charcoal); }

/* ============ DIALOGUE ============ */
.dialogue-inner {
  padding-top: 32px;
  animation: fadeIn .4s ease both;
}
.speaker-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  animation: speakerIn .5s cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes speakerIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.speaker-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--ivory);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.speaker-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.speaker-avatar.hidden { display: none; }
.speaker-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.speaker-name-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--charcoal);
  line-height: 1.1;
}
.dialogue-word { display: inline; white-space: pre-wrap; }
.callback-chip {
  background: var(--lilac-wash);
  border: 1px solid var(--lilac-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 14px 0 18px;
  animation: speakerIn .5s cubic-bezier(.4,0,.2,1) both;
}
.callback-eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .26em;
  color: var(--lilac);
  font-weight: 600;
  margin-bottom: 6px;
}
.callback-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
  color: var(--charcoal);
  margin: 0;
}
.scene-context {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.55;
  color: var(--charcoal);
  margin: 14px 0 28px;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--border);
}
.dialogue-line {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 28px;
}
.dialogue-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dialogue-option {
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 16px 16px 14px;
  text-align: left;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .12s ease;
}
.dialogue-option:hover { border-color: var(--charcoal); background: var(--cream); }
.dialogue-option:active { transform: scale(.99); }
.dialogue-index {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--soft-grey);
  font-weight: 500;
  padding-top: 4px;
  min-width: 16px;
}
.dialogue-text {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.4;
  color: var(--charcoal);
  flex: 1;
}

/* ============ BRIEF (collapsible, shown in styling) ============ */
.brief-button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--soft-grey);
}
.brief-button[aria-expanded="true"] { color: var(--charcoal); border-color: var(--charcoal); }
.brief-panel {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0 18px;
  margin: 8px 0 18px;
}
.brief-desc {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  margin: 0 0 12px;
  color: var(--charcoal);
}
.brief-spec { display: flex; flex-direction: column; gap: 2px; }
.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  font-size: 12px;
}
.spec-row > * { min-width: 0; }
.spec-label {
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--soft-grey);
  flex-shrink: 0;
  min-width: 70px;
}
.spec-value {
  text-align: right;
  color: var(--charcoal);
  font-size: 12px;
  line-height: 1.5;
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ============ STYLING ============ */
.styling-inner { padding-top: 16px; padding-bottom: 120px; }
.styling-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.styling-header .eyebrow { display: block; }
.styling-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--charcoal);
  margin-top: 2px;
}

.composition {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
}
.slot {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: pan-x;  /* let horizontal swipes scroll the track; vertical falls through */
}
.slot-track {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.slot-track::-webkit-scrollbar { display: none; }
.slot-piece {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: var(--cream);
}
.slot-piece img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slot-piece.slot-none {
  background: var(--cream);
  border: 1px dashed var(--border);
}
.slot-none-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--soft-grey);
}
.slot-editor-eyebrow {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--cream);
  font-size: 7px;
  letter-spacing: .2em;
  padding: 3px 7px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 2;
}
.slot-meta {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px 6px;
  background: linear-gradient(to top, rgba(245,241,234,.92) 0%, rgba(245,241,234,.78) 60%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}
.slot-name {
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .26em;
  color: var(--soft-grey);
  font-weight: 500;
}
.slot-dots { display: flex; gap: 3px; }
.slot-dots .slot-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s ease, transform .2s ease;
}
.slot-dots .slot-dot.active {
  background: var(--lilac);
  transform: scale(1.3);
}
/* tiny piece-name + brand chip floating top-right when focused */
.slot-piece-name {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(245,241,234,.85);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 8px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--charcoal);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity .25s ease;
}
.slot.show-name .slot-piece-name { opacity: 1; }
/* swipe hint on first chapter — runs once on the TOP slot */
.slot-track.hint {
  animation: slotSwipeHint 1.8s cubic-bezier(.4, 0, .2, 1) 1;
}
@keyframes slotSwipeHint {
  0%   { transform: translateX(0); }
  35%  { transform: translateX(-32px); }
  70%  { transform: translateX(0); }
  100% { transform: translateX(0); }
}
.slot-headcover { aspect-ratio: 2 / 1; }
.slot-top       { aspect-ratio: 1 / 1; }
.slot-bottom    { aspect-ratio: 1 / 1; }
.slot-shoes     { aspect-ratio: 2 / 1; }

/* (tabs removed — composition slots are now the picker) */

/* PICKER (swipe-to-browse, auto-equip on settle) */
.picker {
  position: relative;
  margin: 0 calc(var(--pad) * -1) 8px;
  padding: 0;
}
.picker-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 21vw 4px;
  scrollbar-width: none;
}
.picker-track::-webkit-scrollbar { display: none; }
.tile {
  flex: 0 0 58vw;
  max-width: 280px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: border-color .25s ease, transform .35s cubic-bezier(.2,.0,.2,1), opacity .35s ease, box-shadow .25s ease;
  opacity: 0.42;
  transform: scale(.86);
  position: relative;
}
.tile:hover { border-color: var(--charcoal); }
.tile.focused {
  opacity: 1;
  transform: scale(1.0);
}
.tile.equipped {
  border-color: var(--charcoal);
  border-width: 2px;
}

/* dots indicator */
.picker-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 4px;
  padding: 0 var(--pad);
}
.picker-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s ease, transform .2s ease;
}
.picker-dot.active {
  background: var(--charcoal);
  transform: scale(1.3);
}

/* swipe hint — single auto-glide on first chapter only */
.picker-track.hint {
  animation: swipeHint 2.0s cubic-bezier(.4, 0, .2, 1) 1;
}
@keyframes swipeHint {
  0%   { scroll-snap-type: none; }
  10%  { transform: translateX(-12px); }
  35%  { transform: translateX(-44px); }
  60%  { transform: translateX(-44px); }
  100% { transform: translateX(0); scroll-snap-type: x mandatory; }
}
.tile-editor {
  border-color: var(--gold);
  position: relative;
  box-shadow: 0 0 0 1px rgba(184,153,104,.2), 0 4px 16px -8px rgba(184,153,104,.4);
}
.tile-editor.equipped { border-color: var(--gold); border-width: 2px; }
.tile-editor-eyebrow {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--cream);
  font-size: 8px;
  letter-spacing: .18em;
  padding: 3px 8px;
  border-radius: 999px;
  z-index: 1;
  font-weight: 500;
  white-space: nowrap;
}
.tile-img { aspect-ratio: 1 / 1; width: 100%; object-fit: cover; background: var(--cream); }
.tile-brand {
  font-size: 8px;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--soft-grey);
  padding: 6px 4px 0;
  line-height: 1.2;
}
.tile-name {
  font-size: 10px;
  padding: 2px 4px 8px;
  text-align: center;
  color: var(--charcoal);
  letter-spacing: .04em;
  line-height: 1.2;
}

/* SUBMIT BAR + TIMER RING */
.submit-bar {
  position: sticky;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, rgba(245,241,234,0) 0%, var(--cream) 30%);
  padding: 18px 0 8px;
  margin: 0 -2px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
}
.timer-ring { position: relative; width: 40px; height: 40px; }
.timer-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer-track { fill: none; stroke: var(--border); stroke-width: 2; }
.timer-fill {
  fill: none; stroke: var(--charcoal); stroke-width: 2;
  stroke-linecap: round; transition: stroke-dashoffset .2s linear;
  stroke-dasharray: 100.53; stroke-dashoffset: 100.53;
}
.btn-submit { padding: 14px 18px; }

/* ============ SCORE + REACTION ============ */
.score-inner {
  padding-top: 24px;
  text-align: center;
}
.look-block {
  margin: 14px 0 24px;
}
.look-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 14px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.look-strip .strip-slot {
  aspect-ratio: 1/1;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.look-strip .strip-slot img { width: 100%; height: 100%; object-fit: contain; }
.look-strip .strip-slot.empty { border-style: dashed; }
.hero-block-score {
  position: relative;
  margin: 14px -8px 24px;
  min-height: 280px;
  background: var(--ivory);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#score-hero-shot, #hero-shot {
  width: 100%; height: auto; display: block;
}
.hero-reveal {
  animation: heroWipe 1.4s cubic-bezier(.2,.0,.1,1) both;
  clip-path: inset(0 0 100% 0);
}
@keyframes heroWipe {
  0%   { clip-path: inset(0 0 100% 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 0);   opacity: 1; }
}
.hero-fallback {
  width: 100%;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.hero-fallback .strip-slot {
  aspect-ratio: 1/1; background: var(--cream);
  border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
}
.hero-fallback .strip-slot img { width: 100%; height: 100%; object-fit: contain; }
.hero-fallback .strip-slot.empty { border-style: dashed; }
.hero-loading {
  position: absolute;
  bottom: 14px; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--soft-grey);
}
.hero-loading-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--soft-grey);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.score-number {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 124px;
  line-height: 1;
  letter-spacing: -.03em;
  margin: 20px 0 4px;
}
.score-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  margin-bottom: 16px;
}
.score-sub {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--soft-grey);
  margin-bottom: 22px;
}
.score-feedback {
  font-size: 14px;
  line-height: 1.55;
  margin: 0 auto 14px;
  max-width: 320px;
  color: var(--charcoal);
}
.style-tip {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.5;
  margin: 0 auto 28px;
  max-width: 340px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.style-tip::before {
  content: "STYLIST'S NOTE";
  display: block;
  font-family: var(--sans);
  font-style: normal;
  font-size: 9px;
  letter-spacing: .26em;
  color: var(--soft-grey);
  margin-bottom: 10px;
}

/* REACTION CARD */
.reaction-card {
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px 18px;
  margin: 0 0 22px;
  text-align: left;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.0,.2,1);
}
.reaction-card.shown { opacity: 1; transform: translateY(0); }
.reaction-card .eyebrow { margin-bottom: 10px; }
.reaction-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
}

/* ACHIEVEMENT TOAST */
.achievement-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--charcoal);
  color: var(--cream);
  border-radius: 999px;
  margin: 0 auto 22px;
  width: fit-content;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .4s ease, transform .4s ease;
}
.achievement-toast.show { opacity: 1; transform: translateY(0); }
.achievement-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
}

.chapter-hook {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--lilac);
  margin: 0 0 16px;
  line-height: 1.6;
}

/* ============ RESULTS ============ */
.results-inner { padding-top: 30px; }
.triptych {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 26px 0 32px;
}
.triptych-tile {
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.triptych-tile img {
  width: 100%; height: auto; display: block;
  aspect-ratio: 3/4;
  object-fit: cover;
}
.strip-fallback {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 14px;
  background: var(--ivory);
}
.strip-fallback .strip-slot {
  aspect-ratio: 1/1;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.strip-fallback .strip-slot img { width: 100%; height: 100%; object-fit: contain; }
.strip-fallback .strip-slot.empty { border-style: dashed; }
.triptych-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 14px 12px;
  background: var(--cream);
  border-top: 1px solid var(--border);
}
.triptych-chapter {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .26em;
  color: var(--soft-grey);
}
.triptych-score {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}

.reading-card {
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 22px;
  margin: 0 0 24px;
  text-align: center;
}
.reading-card .eyebrow { margin-bottom: 10px; }
.reading-emblem {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reading-emblem img {
  width: 100%; height: 100%; object-fit: contain;
}
.reading-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 10px;
  line-height: 1.1;
}
.reading-body {
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.achievements-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 26px;
}
.achievement-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--soft-grey);
}
.achievement-chip.earned {
  color: var(--charcoal);
  border-color: var(--charcoal);
}
.achievement-chip-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border);
}
.achievement-chip.earned .achievement-chip-dot { background: var(--gold); }

/* ============ CONVERSION ============ */
.conversion-inner { padding-top: 36px; text-align: center; }
.conversion-stat {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  margin: 14px 0 8px;
}
.conversion-meta {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--soft-grey);
  margin: 0 0 22px;
  line-height: 1.5;
}
.conversion-meta span { color: var(--charcoal); }
#conv-friction {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--charcoal);
  margin-top: 12px;
  line-height: 1.5;
}
.conversion-body {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 auto 32px;
  max-width: 340px;
}
/* store download buttons */
.store-buttons {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.store-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 10px;
  background: var(--charcoal);
  color: var(--cream);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .2s ease, transform .15s ease;
}
.store-btn:hover { background: #000; }
.store-btn:active { transform: scale(.98); }
.store-glyph { font-size: 22px; line-height: 1; }
.store-glyph-play { font-size: 15px; }
.store-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.store-sub {
  font-size: 8px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .8;
}
.store-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
}

.qr-block { margin-top: 36px; }
#qr-img {
  width: 200px; height: 200px;
  margin: 0 auto;
  background: var(--ivory);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.qr-caption {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--soft-grey);
  margin-top: 14px;
}

/* ============ SHARE CARD — 1080x1920 (9:16) Instagram Stories ============ */
.share-card {
  position: fixed;
  left: -9999px; top: 0;
  width: 1080px; height: 1920px;
  display: none;
  background: var(--intro-purple);
  color: var(--charcoal);
  z-index: -1;
}
.share-card-inner {
  width: 100%; height: 100%;
  padding: 110px 90px 90px;
  display: flex; flex-direction: column;
  box-sizing: border-box;
  text-align: center;
}
.share-card-top { display: flex; flex-direction: column; align-items: center; }
.share-card-logo { width: 96px; height: 96px; border-radius: 16px; }
.share-card-kicker {
  font-family: var(--sans); font-weight: 600;
  font-size: 20px; letter-spacing: .34em; color: var(--lilac);
  margin: 28px 0 14px;
}
.share-card-title {
  font-family: var(--serif); font-weight: 500;
  font-size: 86px; line-height: .98; letter-spacing: -.01em;
}
.share-card-look {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  margin: 48px 0;
}
.share-card-brief {
  font-family: var(--sans); font-weight: 500;
  font-size: 22px; letter-spacing: .3em; color: var(--lilac);
  margin-bottom: 28px;
}
.share-card-grid {
  background: var(--cream);
  border-radius: 24px;
  padding: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-content: center;
}
.share-card-grid.solo { grid-template-columns: 1fr; }
.share-card-grid .share-slot {
  aspect-ratio: 1 / 1;
  background: var(--ivory);
  border-radius: 14px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.share-card-grid .share-slot img { width: 100%; height: 100%; object-fit: contain; }
.share-card-grid .share-slot.empty { display: none; }
/* odd count: the last tile spans the full width for a balanced bento */
.share-card-grid .share-slot.span-2 { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.share-card-grid.solo .share-slot { aspect-ratio: 3 / 4; }
.share-card-reading { margin-bottom: 36px; }
.share-card-score {
  font-family: var(--serif); font-weight: 500;
  font-size: 132px; line-height: 1; color: var(--charcoal);
}
.share-card-label {
  font-family: var(--serif); font-style: italic; font-size: 34px;
  margin-top: 4px;
}
.share-card-readingtitle {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 44px; margin-top: 18px; color: var(--charcoal);
}
.share-card-footer {
  font-family: var(--sans); font-weight: 500;
  font-size: 24px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--charcoal);
}

/* ===== Inter brand-font tuning (replaces the old serif look) ===== */
/* Big solid headings: bold + tight so Inter reads as display, not body copy */
.display, .serif-title, .intercard-title, .creator-title,
.score-number, .total-number, .triptych-score,
.share-card-title, .share-card-score {
  font-weight: 600;
  letter-spacing: -0.025em;
}
/* Inter is heavier/wider than the old serif at the same px — ease the largest down a touch */
.display { font-size: 48px; }
.intercard-title { font-size: 52px; }
.score-number { font-size: 104px; }
.share-card-title { font-size: 72px; }
.share-card-score { font-size: 116px; }
/* Editorial-voice italics: keep the italic, give the larger ones presence */
.dialogue-line, .reading-title, .share-card-readingtitle { font-weight: 500; letter-spacing: -0.01em; }

/* small-screen tweaks */
@media (max-width: 360px) {
  .display { font-size: 48px; }
  .intercard-title { font-size: 54px; }
  .serif-title { font-size: 32px; }
  .score-number { font-size: 104px; }
  :root { --pad: 20px; }
}
