/* Emoji Face-Off — vote cards, agreement line, live top 10, and stats extras.
   Shared page, button, and stats styles live in /assets/site.css. The red
   stays red in dark mode. */

body.game-faceoff {
  --game-bg: #E23B3B;
  --game-deep: #A82424;
  --game-accent: #C62828;
  --card-line: #FBE4E4;
  --fo-card: min(40vw, 220px);    /* each emoji card */
  --gold: #E0A800;
  --silver: #9AA3AE;
  --bronze: #C0773A;
}

/* Desktop and wide: cards grow to 280px each (the site-wide size table). */
@media (min-width: 900px) {
  body.game-faceoff { --fo-card: 280px; }
}

/* ── Layout ────────────────────────────────────────────── */

.fo-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 8px 16px 0;
}

.fo-prompt {
  margin: 4px 0 18px;
  font-size: clamp(24px, 6.6vw, 34px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
}

.fo-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.fo-side { display: none; }

/* Desktop: voting area on the left, live top 10 (340px) on the right,
   top-aligned with the cards, centered together in the 1200px container. */
@media (min-width: 900px) {
  .fo-layout {
    display: grid;
    grid-template-columns: auto 340px;
    grid-template-areas: "prompt ." "vote side";
    justify-content: center;
    align-items: start;
    column-gap: 48px;
    max-width: calc(var(--ws-container) + 2 * var(--ws-gutter));
    margin: 0 auto;
    padding: 0 var(--ws-gutter);
  }
  .fo-prompt { grid-area: prompt; }
  .fo-vote { grid-area: vote; }
  .fo-side { display: block; grid-area: side; }
}

/* ── Cards ─────────────────────────────────────────────── */

.fo-arena {
  position: relative;
  display: flex;
  justify-content: center;
  gap: max(4vw, 16px);
}

@media (min-width: 900px) { .fo-arena { gap: 36px; } }

.fo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: var(--fo-card);
  aspect-ratio: 1 / 1.12;
  padding: 10px 8px;
  border: 0;
  border-radius: 24px;
  background: #FFFFFF;
  color: var(--card-text);
  cursor: pointer;
  box-shadow: 0 6px 0 var(--game-deep), 0 12px 28px rgba(0, 0, 0, 0.2);
  transition: transform 250ms cubic-bezier(0.2, 0.9, 0.3, 1.3), opacity 300ms ease, box-shadow 250ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.fo-card:disabled { cursor: default; }

.fo-emoji {
  display: block;
  font-size: max(96px, calc(var(--fo-card) * 0.62));
  line-height: 1;
}

.fo-name {
  min-height: 2.5em;
  font-size: clamp(11px, 3vw, 14px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--card-muted);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fo-card.is-winner {
  transform: scale(1.08);
  box-shadow: 0 0 0 6px var(--game-yellow), 0 0 36px 8px rgba(255, 210, 63, 0.7);
}

.fo-card.is-loser {
  opacity: 0.3;
  transform: scale(0.9);
}

.fo-vs {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: var(--game-yellow);
  color: #3A1414;
  font: 900 19px/1 var(--ws-font);
  letter-spacing: -0.02em;
  box-shadow: 0 3px 0 #C9A21E, 0 6px 14px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

@media (min-width: 900px) {
  .fo-vs { width: 64px; height: 64px; margin: -32px 0 0 -32px; font-size: 23px; }
}

.fo-arena.slide-in { animation: fo-slide 350ms cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes fo-slide {
  from { transform: translateX(48px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Below the cards ───────────────────────────────────── */

.fo-agree {
  min-height: 2.6em;
  margin: 22px 16px 0;
  font-size: clamp(17px, 4.6vw, 21px);
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}

.fo-pct { color: var(--game-yellow); }

.fo-skip {
  margin-top: 6px;
  padding: 9px 20px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: transparent;
  color: #FFFFFF;
  font: 700 15px/1 var(--ws-font);
  cursor: pointer;
}

.fo-skip:disabled { opacity: 0.6; cursor: default; }
.fo-skip .kbd { margin-left: 8px; }

.fo-keys {
  display: none;
  margin: 12px 0 0;
  font-size: 13px;
  opacity: 0.8;
}

.fo-keys kbd {
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font: 600 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .fo-keys { display: block; }
}

/* ── Live top 10 ───────────────────────────────────────── */

.fo-side {
  padding: 16px 18px;
  border-radius: 20px;
  background: #FFFFFF;
  color: var(--card-text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.fo-side h2 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }

.fo-top { margin: 0; padding: 0; list-style: none; }

.fo-top li {
  position: relative;
  display: grid;
  grid-template-columns: 28px 40px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  transition: background 600ms ease;
}

.fo-top li.is-hot { background: #FFF6D6; }

.fo-rank { font-weight: 800; color: var(--card-muted); }
.fo-top li:nth-child(1) .fo-rank { color: var(--gold); }
.fo-top li:nth-child(2) .fo-rank { color: var(--silver); }
.fo-top li:nth-child(3) .fo-rank { color: var(--bronze); }

.fo-top-emoji { font-size: 28px; line-height: 1.15; }
.fo-top-rating { font-weight: 700; }

.fo-new {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #FBE4E4;
  color: var(--game-accent);
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}

.fo-change { font-size: 13px; font-weight: 800; }
.fo-change.up { color: var(--good); }
.fo-change.down { color: var(--bad); }

.fo-top-note {
  min-height: 1.3em;
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--card-muted);
}

.fo-top-note .emoji { font-size: 18px; }

.fo-top-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--game-accent);
  font-weight: 700;
}

/* The desktop sidebar has its own leaderboard link. */
@media (min-width: 900px) { .fo-board-link { display: none; } }

/* ── Stats page extras ─────────────────────────────────── */

.fo-board th:nth-child(2), .table td.fo-lb-emoji { text-align: left; }
.table td.fo-lb-emoji { line-height: 1.1; }
.table td.fo-lb-emoji .emoji { font-size: 26px; vertical-align: -5px; margin-right: 8px; }
.fo-lb-name { font-size: 13px; color: var(--card-muted); }
@media (max-width: 599px) { .fo-lb-name { display: none; } }
.fo-side-verdict { margin-top: 8px; }
.fo-movers .fo-change { font-size: 15px; }
.table .fo-medal-1 td:first-child { color: var(--gold); font-weight: 900; }
.table .fo-medal-2 td:first-child { color: var(--silver); font-weight: 900; }
.table .fo-medal-3 td:first-child { color: var(--bronze); font-weight: 900; }
.table .fo-medal-1 { background: #FFF8E1; }
.table .fo-medal-2 { background: #F4F6F8; }
.table .fo-medal-3 { background: #FBF1E8; }
.table .fo-dim td { color: var(--card-muted); }

.fo-show-all {
  margin-top: 12px;
  padding: 8px 16px;
  border: 2px solid var(--game-accent);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--game-accent);
  font: 700 14px/1 var(--ws-font);
  cursor: pointer;
}

.fo-pairs { margin: 0; padding: 0; list-style: none; }
.fo-pairs li { padding: 8px 0; border-bottom: 1px solid var(--card-line); font-variant-numeric: tabular-nums; }
.fo-pairs li:last-child { border-bottom: 0; }
.fo-pairs .emoji { font-size: 24px; vertical-align: -3px; }
.fo-pairs small { color: var(--card-muted); }

.fo-bottom { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.fo-bottom div { text-align: center; }
.fo-bottom .emoji { display: block; font-size: 34px; line-height: 1.1; }
.fo-bottom small { color: var(--card-muted); font-size: 12px; }

.fo-movers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fo-movers h3 { margin: 0 0 6px; font-size: 13px; color: var(--card-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.fo-movers ul { margin: 0; padding: 0; list-style: none; }
.fo-movers li { padding: 3px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.fo-movers .emoji { font-size: 24px; vertical-align: -3px; margin-right: 6px; }

/* Head-to-head lookup */
.fo-h2h-picks { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.fo-h2h-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 84px;
  padding: 8px;
  border: 2px dashed var(--card-line);
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--card-muted);
  font: 600 13px/1.2 var(--ws-font);
  cursor: pointer;
}
.fo-h2h-slot.is-active { border-style: solid; border-color: var(--game-accent); }
.fo-h2h-slot .emoji { font-size: 40px; line-height: 1.1; }
.fo-h2h-vs { font-weight: 900; color: var(--game-accent); }

.fo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 4px;
  max-height: 200px;
  margin-top: 12px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--card-line);
  border-radius: 12px;
}

.fo-grid button {
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}

.fo-grid button[aria-pressed="true"] { background: #FBE4E4; box-shadow: inset 0 0 0 2px var(--game-accent); }

.fo-h2h-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.fo-h2h-result { margin-top: 12px; min-height: 1.4em; }

@media (hover: hover) and (pointer: fine) {
  .fo-card:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 9px 0 var(--game-deep), 0 16px 32px rgba(0, 0, 0, 0.22); }
  .fo-skip:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
  .fo-grid button:hover { background: var(--card-line); }
}

@media (prefers-reduced-motion: reduce) {
  .fo-card, .fo-top li { transition: none !important; }
  .fo-card.is-winner, .fo-card.is-loser { transform: none; }
  .fo-card.is-loser { opacity: 1; }
  .fo-arena.slide-in { animation: none; }
}
