/* ------------------------------------------------------ the challenge board */

/*
 * Two panels across the top, the tabs under them and a grid of cards: the
 * shape the old board had. A card is 228 wide there, so the grid is built on
 * that and fills whatever room it is given.
 */

.ch-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 16px;
  /* The character hangs 45 over the top, so the row is given that room. */
  margin: 46px 0 30px;
}

.ch-rules {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

/*
 * The vault panel, measured off the old one.
 *
 * That panel is 728 by 182 with sixteen pixel corners, a violet glow thrown
 * from the bottom left corner and a faded dot tile over it. The character is
 * a 227 pixel square hung 45 above the top edge and 20 past the left one, so
 * he stands out of the card rather than inside it. The words start where he
 * ends, at 218, and the two chips are 231 by 40.
 *
 * The numbers here are those numbers. The colour is ours.
 */
.ch-vault {
  position: relative;
  display: block;
  min-height: 182px;
  padding: 16px 16px 16px 218px;
  border: 0;
  border-radius: 16px;
  background:
    radial-gradient(69% 195% at 0 100%, rgba(204, 255, 0, 0.38), rgba(12, 18, 6, 0.9) 42%),
    linear-gradient(120deg, #141b06, var(--bg-deep));
  overflow: visible;
}

/* The faded dot tile, over the left corner the way theirs sits. */
.ch-vault::before {
  content: '';
  position: absolute;
  left: -146px;
  top: -36px;
  width: 364px;
  height: 364px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.5px, transparent 1.6px);
  background-size: 14px 14px;
  mask-image: radial-gradient(60% 60% at 50% 50%, #000 20%, transparent 72%);
  pointer-events: none;
}

.ch-vault-figure {
  position: absolute;
  left: -20px;
  top: -45px;
  width: 227px;
  height: 227px;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.ch-vault-body {
  position: relative;
  display: flex;
  flex-direction: column;
}

.ch-vault h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
}

.ch-vault p {
  margin: 8px 0 0;
  max-width: 478px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.6);
}

.ch-rules {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.ch-rules {
  background:
    radial-gradient(110% 120% at 100% 0%, rgba(204, 255, 0, 0.16), transparent 60%),
    linear-gradient(160deg, #18202f, var(--bg-deep));
}

.ch-rules h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  text-transform: uppercase;
}

/* Two dark chips under the words, the way the old panel carried them. */
.ch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.ch-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 231px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(204, 255, 0, 0.35);
  border-radius: 8px;
  background: linear-gradient(270deg, rgba(204, 255, 0, 0), rgba(204, 255, 0, 0.2));
  font-size: 13px;
  font-weight: 500;
  color: var(--lime);
}

/* The second one is the quiet one, with the dot theirs carried. */
.ch-chip + .ch-chip {
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(270deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.12));
  color: rgba(255, 255, 255, 0.82);
}

.ch-chip + .ch-chip::after {
  content: '';
  position: absolute;
  right: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(204, 255, 0, 0.16);
}

.ch-chip svg {
  width: 22px;
  height: 22px;
  color: currentColor;
}

.ch-chip em {
  font-style: normal;
}

.ch-chip b {
  margin-left: auto;
  font-size: 13px;
  color: #fff;
}

.ch-vault-sign {
  margin: 0;
  font-size: 11px;
  color: var(--text-faint);
}

.ch-vault-sign[hidden] {
  display: none;
}

.ch-rules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}

.ch-rules-list li::marker {
  color: var(--gold);
  font-weight: 700;
}

/* ------------------------------------------------------------------ tabs */

.ch-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  /* The board sits clear of the panels above it. */
  margin-top: 8px;
  margin-bottom: 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: fit-content;
  margin-inline: auto;
  background: var(--bg-deep);
}

.ch-tab {
  height: 32px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.ch-tab.is-on {
  background: var(--panel);
  color: var(--text);
}

/* ----------------------------------------------------------------- cards */

.ch-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ch-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1015;
}

.ch-card.is-done {
  opacity: 0.72;
}

.ch-art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #161922;
  overflow: hidden;
}

/*
 * Six scenes, picked by the slug.
 *
 * The old board had a painted poster behind every challenge. These are the
 * same idea done in CSS: a lit corner, a deeper floor, and the challenge
 * written across the bottom, so a card reads from across a room.
 */
.ch-scene-0 {
  background: radial-gradient(90% 70% at 50% 18%, #c9a227, transparent 68%), linear-gradient(180deg, #6b4c07, #241a06);
}

.ch-scene-1 {
  background: radial-gradient(90% 70% at 50% 18%, #2f7fd8, transparent 68%), linear-gradient(180deg, #123a68, #071627);
}

.ch-scene-2 {
  background: radial-gradient(90% 70% at 50% 18%, #e0702c, transparent 68%), linear-gradient(180deg, #6a3111, #2a1207);
}

.ch-scene-3 {
  background: radial-gradient(90% 70% at 50% 18%, #2fa96b, transparent 68%), linear-gradient(180deg, #13472c, #06190f);
}

.ch-scene-4 {
  background: radial-gradient(90% 70% at 50% 18%, #7b3ce8, transparent 68%), linear-gradient(180deg, #22300a, #120825);
}

.ch-scene-5 {
  background: radial-gradient(90% 70% at 50% 18%, #d23c5c, transparent 68%), linear-gradient(180deg, #5c1224, #23070e);
}

/* The words on the poster, over a fade so they sit on anything. */
.ch-art-caption {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 9px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.ch-art::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 62%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
}

.ch-art-caption,
.ch-art-more {
  z-index: 1;
}

.ch-art img {
  width: 74%;
  height: 74%;
  margin-bottom: 12%;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.5));
}

.ch-art-empty {
  width: 46%;
  height: 46%;
  border-radius: 10px;
  background: #1d212c;
}

.ch-art-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 160ms ease;
}

.ch-art:hover .ch-art-more {
  opacity: 1;
}

.ch-card.is-done .ch-art-more {
  display: none;
}

/*
 * Two lines and no more.
 *
 * A board where one card is three lines tall and its neighbour is one has its
 * prizes at six different heights, which is the thing the eye reads first. So
 * the title is clamped and every card below it lines up.
 */
.ch-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 34px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.ch-by {
  display: flex;
  gap: 5px;
  font-size: 12px;
}

.ch-by em {
  font-style: normal;
  color: var(--text-faint);
}

.ch-prize {
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  color: var(--on-lime);
  font-size: 16px;
  font-weight: 700;
}

.ch-clock {
  font-size: 11px;
  color: var(--text-faint);
}

.ch-empty {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

@media (max-width: 860px) {
  .ch-panels {
    grid-template-columns: minmax(0, 1fr);
  }
}
