/* BarTopTV Trivia, presented by Sporcle: interactive mockup.
   The screen is laid out in native device pixels (720×1280) and scaled to fit:
   trivia owns the top 720×865, the sponsor video the bottom 720×415. */

:root {
  --orange: #ff9900;
  --orange-deep: #ffa800;
  --yellow: #ffd400;
  --ink: #000;
  --tile-edge: #e9e9e9;
  --tile-lip: #d2d2d2;
  --green: #12a312;
  --red: #c4000b;
  --font: "Figtree", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 16px 20px;
  font-family: var(--font);
  color: #fff;
  background:
    radial-gradient(60vmax 50vmax at 50% 55%, rgba(255, 153, 0, 0.22), transparent 70%),
    #0b0a10;
}

/* ───────── page chrome ───────── */
.page-head { display: flex; align-items: center; gap: 16px; }
.page-logo { height: 41px; } /* same overall width as the Sporcle logo beside it */
.page-logo--sporcle { height: 30px; }
.page-x { font-size: 22px; opacity: 0.5; }
.page-sub { margin: -4px 0 0; font-size: 14px; color: rgba(255, 255, 255, 0.6); }

.controls { display: flex; gap: 10px; align-items: center; }
.controls button {
  font: 600 13px var(--font);
  color: #fff;
  background: transparent;
  border: 0;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.seg { display: flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.seg button.is-on { background: #fff; color: #000; }
.controls .ghost { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.controls button:hover:not(.is-on) { background: rgba(255, 255, 255, 0.12); }

/* ───────── stage: device or flat screen ───────── */
.stage { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; }

/* the frame image is 373×834; its glass sits 3.5% in and 1.7% down, 93% wide, 9:16 */
.device {
  position: relative;
  height: min(100%, 1100px);
  max-height: calc(100vh - 150px);
  aspect-ratio: 373 / 834;
  filter: drop-shadow(0 40px 40px rgba(0, 0, 0, 0.8));
}
.device-frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.device-glass {
  position: absolute;
  left: 3.5%;
  top: 1.7%;
  width: 93%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #000;
}
.glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.03) 28%, transparent 45%);
}

/* flat view: no frame, just the 9:16 screen with rounded corners */
.stage[data-view="flat"] .device { aspect-ratio: 9 / 16; filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.6)); }
.stage[data-view="flat"] .device-frame,
.stage[data-view="flat"] .glare { display: none; }
.stage[data-view="flat"] .device-glass { inset: 0; width: 100%; border-radius: 18px; }

/* ───────── the 720×1280 screen ───────── */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 720px;
  height: 1280px;
  transform-origin: 0 0;
  background: var(--orange);
  color: var(--ink);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.trivia { position: absolute; inset: 0 0 auto 0; height: 865px; }

/* co-brand header, straight on the orange (no black bar): BarTopTV in the top-left corner,
   the "Trivia" title with "Presented by Sporcle" under it in the top-right, both lined up with the card's edges */
.brandbar {
  position: absolute;
  inset: 14px 44px auto 44px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.brand-logo { height: 62px; margin-top: 2px; } /* centers the BarTopTV letters on the "Trivia" letters */
.title { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.title-trivia {
  font-size: 74px;
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.02em;
}
/* "Presented by Sporcle" in Sporcle's own colors: their black bar, orange label, white wordmark */
.presented {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 7px 16px 7px 18px;
  background: #000;
  border-radius: 14px;
}
.presented span {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
}
.presented-logo { height: 36px; }

/* the white card, with the score pill riding its top edge */
.card {
  position: absolute;
  left: 44px;
  right: 44px;
  top: 198px;
  bottom: 22px;
  padding: 64px 32px 28px;
  background: #fff;
  border-radius: 30px;
  box-shadow: 0 6px 24px rgba(120, 50, 0, 0.18);
}
.score {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  min-width: 260px;
  height: 86px;
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.28em;
  font-size: 38px;
  font-weight: 800;
  color: var(--orange);
  white-space: nowrap;
  background: #fff;
  border: 10px solid #d9d9d9;
  border-radius: 999px;
}
.score b { font-weight: inherit; display: inline-block; }
.score.bump b { animation: bump 0.5s ease; }
@keyframes bump { 40% { transform: scale(1.45); color: var(--green); } }

.count {
  display: inline-block;
  padding: 7px 16px;
  font-size: 23px;
  font-weight: 700;
  border-radius: 999px;
  background: #dcdcdc;
}
.question {
  margin: 16px 0 0;
  font-size: 38px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

/* the orange-to-yellow rule doubles as the question clock: it drains as time runs out */
.rule { margin: 24px 0 30px; height: 4px; border-radius: 4px; background: #f1f1f1; overflow: hidden; }
.rule-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--yellow) 50%, var(--orange));
  transform-origin: left center;
}

/* the tiles take whatever height the question leaves, so 2- to 4-line questions all fit */
.q-view { height: 100%; display: flex; flex-direction: column; }
.q-view[hidden] { display: none; }
.count { align-self: flex-start; }
.answers { flex: 1; min-height: 0; max-height: 380px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 22px; padding-bottom: 7px; }
.answer {
  position: relative;
  padding: 0 16px;
  display: grid;
  place-items: center;
  font: 800 29px/1.15 var(--font);
  color: var(--ink);
  text-align: center;
  background: #fff;
  border: 3px solid var(--tile-edge);
  border-radius: 20px;
  box-shadow: 0 7px 0 var(--tile-lip);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.12s, opacity 0.3s;
}
.answer:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 3px 0 var(--tile-lip); }
.answer:disabled { cursor: default; }
.answer.picked { background: #fff8e1; border-color: var(--orange-deep); box-shadow: 0 7px 0 var(--orange-deep); }
.answer.right { background: #e8f9e6; border-color: var(--green); box-shadow: 0 7px 0 var(--green); }
.answer.wrong { background: #fff0f0; border-color: var(--red); box-shadow: 0 7px 0 var(--red); }
.answer.dim { opacity: 0.45; }
.answer .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.answer.right .badge { background: var(--green); }
.answer.wrong .badge { background: var(--red); }
.badge svg { width: 24px; height: 24px; }
@keyframes pop { from { transform: scale(0); } }

/* question swap */
.q-view.leaving { animation: out 0.25s ease forwards; }
.q-view.entering { animation: in 0.3s ease; }
@keyframes out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes in { from { opacity: 0; transform: translateY(10px); } }

/* ───────── end screen ───────── */
.end-view { display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; animation: in 0.4s ease; }
.end-view[hidden] { display: none; }
.end-title { margin: 0; font-size: 42px; font-weight: 800; line-height: 1.1; }
.end-sub { margin: 8px 0 0; font-size: 29px; font-weight: 700; color: var(--orange); }

.promo {
  position: relative;
  width: 100%;
  margin-top: 20px;
  height: 312px;
  padding: 26px 24px 22px 30px;
  display: flex;
  gap: 18px;
  text-align: left;
  border: 3px solid var(--orange-deep);
  border-radius: 22px;
  overflow: hidden;
}
.promo-swoosh { position: absolute; inset: 0; width: 100%; height: 100%; }
.promo-copy { position: relative; flex: 1; display: flex; flex-direction: column; }
.promo-globe { width: 44px; height: auto; }
.promo-head {
  margin: 8px 0 0;
  font-size: 46px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.promo-body { margin: auto 0 0; font-size: 23px; font-weight: 600; line-height: 1.2; }
.promo-qr { position: relative; align-self: flex-end; display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 184px; }
.promo-qr img { width: 184px; height: 184px; padding: 8px; background: #fff; border-radius: 6px; }
.promo-qr span {
  padding: 9px 6px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  color: var(--orange);
  background: #000;
  border-radius: 10px;
}

.end-foot { flex: 1; width: 100%; display: grid; place-items: center; }
.end-note { margin: 0; padding: 0 12px; font-size: 21px; font-weight: 600; line-height: 1.35; }

/* ───────── sponsor video: bottom 720×415 ───────── */
/* on the same orange, inset to line up with the card, the way the sponsor slot sits on the real screen */
.sponsor { position: absolute; inset: 865px 0 0 0; background: var(--orange); }
.sponsor-slot {
  position: absolute;
  inset: 0 44px 22px 44px;
  overflow: hidden;
  background: #000;
  border-radius: 20px;
  box-shadow: 0 6px 24px rgba(120, 50, 0, 0.18);
}
.sponsor video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sponsor-tag[hidden] { display: none; }
/* the "Sponsored by" chip, matching the BarTopTV site */
.sponsor-tag {
  position: absolute;
  top: 5%;
  left: 2.7%;
  padding: 14px 19px;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #07060c;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
