/* Match screens — Entry (category + setup). Today styles stay in styles.css. */

/* Match keeps the bottom navigation available so a session never feels trapped. */
.match-entry {
  position: relative;
  z-index: 0;
  background: var(--canvas);
  padding-bottom: calc(var(--dock-h) + var(--safe-bottom) + 24px);
}
body.match-open .match-entry {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body.match-open .app-main,
body.match-open .app-top {
  visibility: hidden;
}

.match-entry__inner {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 18px calc(var(--dock-h) + var(--safe-bottom) + 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}

.match-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 4px 6px 4px 0;
  background: none;
  border: none;
  color: var(--ink-secondary);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.match-back__chev { font-size: 22px; line-height: 1; margin-top: -2px; }
.match-back:active { color: var(--ink); }

.match-lede { margin-top: -4px; }

.match-entry-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-left: 2px solid var(--primary);
  color: var(--ink-secondary);
  font-size: 13px;
  line-height: 1.4;
  background: var(--surface-muted);
}
body.match-open .match-entry__inner { padding-top: calc(var(--safe-top) + 24px); }

.match-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.match-session-state { padding-top: 0; }

.match-waiting-state { display: flex; flex-direction: column; gap: 20px; width: 100%; }
.match-waiting-state__status { display: flex; align-items: center; gap: 9px; color: var(--ink-secondary); font-size: 14px; font-weight: 600; }
.match-waiting-state__header { display: grid; gap: 10px; max-width: 520px; }
.match-waiting-state__progress { display: grid; gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.match-waiting-state__row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(70px, auto); gap: 12px; align-items: center; min-height: 48px; color: var(--ink-secondary); }
.match-waiting-state__row + .match-waiting-state__row { border-top: 1px solid var(--border); }
.match-waiting-state__row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.match-waiting-state__row em { color: var(--ink-secondary); font-size: 13px; font-style: normal; text-align: right; }
.match-waiting-state__row--liked { grid-template-columns: minmax(0, 1fr) auto; }
.match-waiting-state__steps { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; color: var(--ink-secondary); }
.match-waiting-state__steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; align-items: center; }
.match-waiting-state__steps .is-complete { color: var(--success); }
.match-waiting-state__steps .is-current { color: var(--primary); font-weight: 600; }
.match-waiting-state__actions { margin-top: 2px; }
.match-state-progress,
.swipe-done-progress {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface-solid);
}
.match-state-progress > div,
.swipe-done-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 30px;
  color: var(--ink-secondary);
  font-size: 14px;
}
.match-state-progress strong,
.swipe-done-progress strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.match-cta { margin-top: auto; }

/* ===== Deck build wait (audit §B) ===== */
.deck-wait {
  align-items: center;
  text-align: center;
  justify-content: center;
  min-height: 60vh;
  gap: 18px;
}
.deck-wait .screen-title { margin: 0; }
.deck-wait__lede { color: var(--ink-secondary); max-width: 30ch; }
.deck-wait__spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--surface-muted, rgba(255, 255, 255, 0.12));
  border-top-color: var(--primary, #6a475f);
  animation: deck-spin 0.8s linear infinite;
}
.deck-wait__spinner[hidden] { display: none; }
@keyframes deck-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .deck-wait__spinner { animation-duration: 2s; }
}

/* ===== Segmented control ===== */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: var(--surface-muted);
}
.seg__item {
  display: inline-flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 54px;
  padding: 8px 6px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.seg__item--soon {
  cursor: not-allowed;
  opacity: 0.52;
}
.seg__item--soon:disabled { color: var(--ink-muted); }
.seg__soon {
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-muted);
}
.seg__item img { display: block; opacity: 0.7; }
.seg__item.is-active {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.seg__item.is-active img { opacity: 1; }
.seg__item:focus-visible {
  outline: 3px solid rgba(106, 71, 95, 0.34);
  outline-offset: 1px;
}

/* ===== Optional deck length ===== */
.match-settings {
  margin-top: 2px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.match-settings summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  list-style: none;
}
.match-settings summary::-webkit-details-marker { display: none; }
.match-settings summary::after {
  content: "›";
  color: var(--ink-muted);
  font-size: 22px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.match-settings[open] summary::after { transform: rotate(90deg); }
.match-settings__value {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
}
.count-control {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  margin: 0 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.count-control__row {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 10px;
}
.count-btn {
  width: 52px;
  height: 52px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.count-btn:active { transform: scale(0.96); }
.count-btn:disabled { opacity: 0.32; cursor: default; }
.count-btn:focus-visible {
  outline: 3px solid rgba(106, 71, 95, 0.34);
  outline-offset: 1px;
}
.count-value {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.count-estimate {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.count-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  outline: none;
  cursor: pointer;
}
.count-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--surface-solid);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.count-range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--surface-solid);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.count-range:focus-visible {
  outline: 3px solid rgba(106, 71, 95, 0.34);
  outline-offset: 3px;
}

/* Loading state on the primary CTA */
.match-cta.is-loading { opacity: 0.7; }

/* ===== Live indicator (shared: resume panel, mood/swipe/pair waits) ===== */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

.btn-danger { color: #C0392B; }

/* ===== Today live resume panel ===== */
.resume-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
}
.resume-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
}
.resume-progress__row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 10px;
}
.resume-progress__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}
.resume-progress__track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}
.resume-progress__fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.4s ease;
}
.resume-progress__count {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: right;
}
.resume-card__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.resume-card__actions .btn-primary { width: 100%; }
.resume-card__actions .btn-danger {
  width: auto;
  min-height: 38px;
  padding: 6px 10px;
  align-self: center;
}

/* ===== Shared wait panel (mood / swipe done / pair waiting) ===== */
.wait-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 32px 18px;
}
.wait-panel__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}
.mood-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

/* ===== Mood grid ===== */
.mood-step { display: flex; flex-direction: column; gap: 14px; }
.mood-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mood-chip {
  min-height: 56px;
  padding: 14px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface-solid);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.mood-chip.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.mood-chip:focus-visible {
  outline: 3px solid rgba(106, 71, 95, 0.34);
  outline-offset: 1px;
}

/* ===== Swipe deck ===== */
.swipe-screen { background: var(--canvas); }
.swipe-inner {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 14px) 18px calc(var(--dock-h) + var(--safe-bottom) + 20px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}
.swipe-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.swipe-progress {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}
.swipe-deck {
  position: relative;
  flex: 1;
  min-height: clamp(360px, 56vh, 520px);
}
.swipe-card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-media);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: #171a21;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.swipe-card.is-peek {
  transform: scale(0.94) translateY(14px);
  opacity: 0.6;
  z-index: 1;
}
.swipe-card.is-top { z-index: 2; transition: transform 0.28s ease, opacity 0.28s ease; }
.swipe-card.is-top.is-dragging { transition: none; cursor: grabbing; }
.swipe-card.fly-right { transform: translateX(120%) rotate(10deg); opacity: 0; }
.swipe-card.fly-left { transform: translateX(-120%) rotate(-10deg); opacity: 0; }
.swipe-card.fly-up { transform: translateY(-120%); opacity: 0; }
.swipe-card__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
}
.swipe-card__scrim { position: absolute; inset: 0; background: var(--media-scrim); }
.swipe-card__body {
  position: absolute;
  inset: auto 0 0 0;
  padding: 20px;
  color: var(--ink-on-media);
}
.swipe-card__title { font-size: 24px; font-weight: 700; line-height: 1.1; }
.swipe-card__meta { font-size: 14px; font-weight: 500; opacity: 0.9; margin-top: 4px; }
.swipe-card__sub { font-size: 13px; opacity: 0.8; margin-top: 6px; }
.swipe-loading { display: grid; place-items: center; height: 100%; color: var(--ink-secondary); }

.swipe-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 0;
}
.swipe-act {
  width: 100%;
  min-height: 54px;
  padding: 8px 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.swipe-act:active { transform: scale(0.92); }
.swipe-act--no { background: transparent; color: #8C433A; }
.swipe-act--want { background: var(--surface-solid); color: var(--ink); }
.swipe-act--very-want { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.swipe-act:focus-visible { outline: 3px solid rgba(106, 71, 95, 0.34); outline-offset: 2px; }
.swipe-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 40px 18px;
  flex: 1;
  justify-content: center;
}
.swipe-done .btn { width: 100%; max-width: 320px; margin-top: 8px; }
.swipe-done.match-waiting-state {
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  padding: clamp(22px, 7vh, 64px) 0 28px;
}
.swipe-done.match-waiting-state .btn { max-width: none; }
.swipe-screen.is-done .swipe-deck { display: none; flex: 0; min-height: 0; }
.swipe-screen.is-done .swipe-inner { justify-content: flex-start; }

/* ===== Stored result: calm editorial reveal ===== */
.result-screen {
  background: var(--canvas);
}
.result-inner {
  max-width: 560px;
  min-height: 100%;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--dock-h) + var(--safe-bottom) + 20px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-loading { flex: 1; display: grid; place-items: center; color: var(--ink-secondary); text-align: center; }
.result-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-media);
  background: var(--surface-solid);
  box-shadow: var(--shadow-card);
}
.result-media { aspect-ratio: 1.92 / 1; overflow: hidden; background: var(--surface-muted); }
.result-media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.result-copy { padding: 16px; display: flex; flex-direction: column; gap: 7px; }
.result-kicker {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.result-title { color: var(--ink); font-size: 28px; line-height: 1.06; }
.result-meta { color: var(--ink-secondary); font-size: 14px; }
.result-description { color: var(--ink-secondary); }
.result-why { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.result-why h2 { color: var(--ink); font-size: 16px; margin-bottom: 5px; }
.result-why ul { margin: 7px 0 0; padding-left: 18px; color: var(--ink-secondary); }
.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.result-actions .btn { min-height: 48px; }
.result-actions #result-detail,
.result-actions #result-feedback,
.result-actions #result-no-match-rematch,
.result-actions #result-home { grid-column: 1 / -1; }
.result-actions #result-home { min-height: 40px; }
.result-no-match {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px 14px;
  align-items: start;
  max-width: 560px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-media);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-card);
}
.result-status-mark {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  background: var(--primary-soft);
}
.result-status-mark span {
  position: absolute;
  width: 23px;
  height: 23px;
  border: 2px solid var(--primary);
  border-radius: 50%;
}
.result-status-mark span:first-child { transform: translateX(-7px); }
.result-status-mark span:last-child { transform: translateX(7px); }
.result-status-mark::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-solid);
  transform: rotate(40deg);
}
.result-no-match__copy { display: grid; gap: 5px; }
.result-no-match__logic {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  color: var(--ink-secondary);
  font-size: 13px;
  line-height: 1.42;
}

@media (prefers-reduced-transparency: reduce) {
  .result-no-match { background: var(--surface-solid); }
}

/* ===== Pair Gate ===== */
.pair-body { display: flex; flex-direction: column; gap: 14px; }
.pair-title { margin-top: 4px; }
.pair-avatars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 0 6px;
}
.pair-avatar {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  overflow: hidden;
}
.pair-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pair-avatar--me { background: var(--primary-soft); color: var(--primary); }
.pair-avatar--filled { background: var(--surface-muted); color: var(--ink); }
.pair-avatar--empty {
  background: transparent;
  border: 2px dashed var(--border-strong);
  color: var(--ink-muted);
}
/* Connector between the two avatars (was a heart glyph — removed per audit §21). */
.pair-link-glyph {
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--border-strong);
}
.pair-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pair-error { text-align: center; padding: 20px 0; }
