/* Trivia (tq-). Tokens only, so light and dark mode both work. */

.tq {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* --------------------------------------------------------- intro */

.tq-intro .round-no {
  font-size: clamp(46px, 8.5vw, 104px);
  max-width: 100%;
}
.tq-intro .round-no span {
  overflow-wrap: anywhere;
}
.tq-intro-badge {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 5px 5px 0 var(--shadow);
  animation: pop-in 0.5s var(--ease) both;
}
.tq-intro-badge .ic {
  width: 40px;
  height: 40px;
}
.tq-tips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  animation: fade-up 0.6s 0.55s var(--ease) both;
}

/* --------------------------------------------------- question card */

.tq-card {
  display: grid;
  gap: 14px;
  padding: clamp(16px, 2.4vw, 26px);
  animation: fade-up 0.35s var(--ease) both;
}
.tq-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.tq-grow {
  flex: 1;
}
.tq-set {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tq-q {
  font-size: clamp(23px, 2.9vw, 33px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.tq-reveal .tq-q {
  font-size: clamp(19px, 2.2vw, 24px);
}
.tq-reveal .tq-card {
  animation: none;
}

.tq-diff {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink-2);
}
.tq-diff-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}
.tq-diff-bars i {
  width: 5px;
  border: 1.5px solid var(--ink-2);
  border-radius: 2px;
}
.tq-diff-bars i:nth-child(1) {
  height: 8px;
}
.tq-diff-bars i:nth-child(2) {
  height: 12px;
}
.tq-diff-bars i:nth-child(3) {
  height: 16px;
}
.tq-diff-bars i.on {
  background: var(--ink);
  border-color: var(--ink);
}

.tq-bar {
  height: 10px;
  border: var(--bw) solid var(--line);
  border-radius: 99px;
  background: var(--paper-2);
  overflow: hidden;
}
.tq-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transition: transform 0.2s linear, background-color 0.3s;
}
.tq-bar.low i {
  background: var(--danger);
}

/* ---------------------------------------------------------- tiles */

.tq-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tq-tile {
  --sh: 4px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 78px;
  margin: 0;
  padding: 12px 16px 12px 12px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.2;
  text-align: left;
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), background-color 0.2s, color 0.2s, opacity 0.25s;
  -webkit-tap-highlight-color: transparent;
  /* backwards, not both: a held end frame would block the hover and pressed transforms */
  animation: fade-up 0.35s var(--ease) backwards;
}
.tq-tile:nth-child(2) {
  animation-delay: 40ms;
}
.tq-tile:nth-child(3) {
  animation-delay: 80ms;
}
.tq-tile:nth-child(4) {
  animation-delay: 120ms;
}
button.tq-tile {
  cursor: pointer;
  user-select: none;
}
button.tq-tile:not(:disabled):hover {
  transform: translate(-1px, -1px);
  box-shadow: calc(var(--sh) + 1px) calc(var(--sh) + 1px) 0 var(--shadow);
}
button.tq-tile:not(:disabled):active {
  transform: translate(var(--sh), var(--sh));
  box-shadow: 0 0 0 var(--shadow);
}
button.tq-tile:disabled {
  cursor: default;
}
.tq-tile:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.tq-key {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 11px 0 9px;
  border: var(--bw) solid var(--line);
  border-radius: 99px;
  background: var(--paper-2);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}
.tq-shape {
  width: 15px;
  height: 15px;
  flex: none;
  fill: currentColor;
}
.tq-ans {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.tq-mark {
  width: 24px;
  height: 24px;
}

/* your locked pick */
.tq-tile.picked {
  background: var(--ink);
  color: var(--paper);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
  opacity: 1;
}
.tq-tile.dim {
  opacity: 0.5;
}

/* reveal */
.tq-tile.correct {
  background: var(--accent);
  color: var(--accent-ink);
  animation: tq-pop 0.55s var(--ease);
}
.tq-tile.wrong {
  background: var(--danger);
  color: var(--danger-ink);
}
.tq-tile.picked .tq-key,
.tq-tile.correct .tq-key,
.tq-tile.wrong .tq-key {
  background: transparent;
  border-color: currentColor;
}
.tq-reveal .tq-tile {
  min-height: 64px;
  font-size: 17px;
}
.tq-reveal .tq-tile.dim {
  opacity: 0.6;
}
.tq-count {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: var(--bw) solid currentColor;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.tq-count .ic {
  width: 15px;
  height: 15px;
}
.tq-you {
  flex: none;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------- status row */

.tq-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
}
.tq-foot-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.tq-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--r-ctl);
  font-weight: 750;
}
.tq-hint {
  padding-inline: 2px;
  color: var(--ink-2);
}
.tq-locked {
  border: var(--bw) solid var(--line);
  background: var(--ink);
  color: var(--paper);
  animation: pop-in 0.35s var(--ease) both;
}
.tq-watch {
  border: var(--bw) dashed var(--ink-2);
  color: var(--ink-2);
}
.tq-streak .ic,
.tq-streak-won .ic {
  color: inherit;
}
@media (hover: none) {
  .tq-keys {
    display: none;
  }
}

/* ------------------------------------------------ reveal details */

.tq-reveal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: stretch;
}
.tq-reveal-row.solo {
  grid-template-columns: minmax(0, 1fr);
}
.tq-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  padding: 16px 18px;
  animation: fade-up 0.4s 0.1s var(--ease) both;
}
.tq-result-txt {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}
.tq-result-txt strong {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.tq-result-txt span {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.tq-points {
  font-family: var(--meme);
  font-size: clamp(38px, 4.6vw, 52px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  animation: slam 0.55s 0.2s var(--ease) both;
}
.tq-result.no .tq-points,
.tq-result.none .tq-points {
  color: var(--ink-2);
}
.tq-streak-won {
  grid-column: 1 / -1;
  justify-self: start;
}

.tq-badge {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: var(--bw) solid var(--line);
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink);
}
.tq-badge .ic {
  width: 24px;
  height: 24px;
}
.tq-badge.ok,
.tq-badge.fact {
  background: var(--accent);
  color: var(--accent-ink);
}
.tq-badge.no {
  background: var(--danger);
  color: var(--danger-ink);
}

.tq-fact {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  animation: fade-up 0.4s 0.2s var(--ease) both;
}
.tq-fact strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.tq-fact p {
  margin-top: 2px;
  font-weight: 600;
  line-height: 1.4;
}

/* standings */
.tq-board {
  display: grid;
  gap: 4px;
  padding: 14px clamp(12px, 2vw, 18px) 12px;
}
.tq-board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 6px;
}
.tq-board-head h3 {
  font-size: 20px;
}
.tq-board-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tq-row {
  display: grid;
  grid-template-columns: 24px auto minmax(0, 1fr) auto minmax(46px, auto) minmax(52px, auto);
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 12px;
  animation: fade-up 0.4s var(--ease) both;
}
.tq-row.me {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}
.tq-row .rank {
  font-family: var(--meme);
  font-size: 19px;
  text-align: center;
}
.tq-row .nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}
.tq-row .delta {
  font-size: 14px;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tq-row .total {
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tq-res-ic {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: var(--bw) solid var(--line);
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink-2);
}
.tq-res-ic .ic {
  width: 13px;
  height: 13px;
}
.tq-res-ic.ok {
  background: var(--accent);
  color: var(--accent-ink);
}
.tq-res-ic.no {
  background: var(--danger);
  color: var(--danger-ink);
}

.tq-next {
  display: flex;
  justify-content: flex-end;
}
.tq-next .waiting {
  flex: 1;
}

/* ------------------------------------------------------ final */

.tq-final .panel-head {
  flex-wrap: wrap;
}
.tq-stats {
  display: grid;
}
.tq-stat-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border-top: 2px solid var(--paper-2);
}
.tq-stat-row:first-child {
  border-top: 0;
}
.tq-stat-row.me {
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}
.tq-stat-row .nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}
.tq-stat-cells {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.tq-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: var(--bw) solid transparent;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}
.tq-stat b {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}
.tq-stat.top {
  border-color: var(--line);
  background: var(--accent);
  color: var(--accent-ink);
}
.tq-stat.top b {
  color: var(--accent-ink);
}

@keyframes tq-pop {
  0% {
    transform: scale(0.96);
  }
  45% {
    transform: scale(1.035) rotate(-0.6deg);
  }
  100% {
    transform: none;
  }
}

/* ------------------------------------------------------ phones */

@media (max-width: 760px) {
  .tq-reveal-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .tq {
    gap: 14px;
  }
  .tq-tiles {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .tq-tiles.short {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tq-tile {
    min-height: 62px;
    padding: 10px 14px 10px 10px;
    font-size: 17px;
  }
  .tq-reveal .tq-tile {
    min-height: 54px;
    font-size: 16px;
  }
  .tq-key {
    height: 36px;
  }
  .tq-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .tq-foot-side {
    justify-content: space-between;
  }
  .tq-row {
    grid-template-columns: 20px auto minmax(0, 1fr) auto auto minmax(44px, auto);
    gap: 8px;
    padding: 5px 6px;
  }
  .tq-row .av {
    --s: 30px !important;
  }
  .tq-stat-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .tq-stat-cells {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tq-bar i {
    transition: none;
  }
  .tq-tile.correct,
  .tq-tile,
  .tq-card,
  .tq-row {
    animation: none;
  }
}
