/* The mini-game dialogs (share sheet, power-up offer) and the badge of a
   round played without power-ups (kits/arcade). A site sets the colors on
   :root: --arcade-ink, --arcade-paper, --arcade-accent, --arcade-accent-ink,
   --arcade-line, --arcade-badge, --arcade-font; the moment's prompt also
   reads a few more (see .arcade-prompt below), each with a default. */

.arcade-dialog {
  --_ink: var(--arcade-ink, #1f2328);
  --_paper: var(--arcade-paper, #ffffff);
  --_accent: var(--arcade-accent, #d23a63);
  --_accent-ink: var(--arcade-accent-ink, #ffffff);
  --_line: var(--arcade-line, #e5e7eb);
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--_ink);
  background: var(--_paper);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: var(--arcade-font, inherit);
}

.arcade-dialog::backdrop {
  background: rgba(20, 12, 10, 0.55);
}

.arcade-card {
  position: relative;
  padding: 22px 20px 18px;
}

.arcade-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  font-size: 26px;
  line-height: 1;
  color: inherit;
  background: none;
  cursor: pointer;
}

.arcade-close:hover {
  background: var(--_line);
}

.arcade-title {
  margin: 0 40px 6px 0;
  font-size: 22px;
  line-height: 1.2;
}

.arcade-note {
  margin: 0 0 12px;
  font-size: 15px;
}

.arcade-preview {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 15px;
  background: color-mix(in srgb, var(--_line) 45%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--_line);
}

.arcade-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: 0.08em;
  color: #fff;
  background: var(--arcade-badge, #1f8a5b);
}

.arcade-targets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.arcade-target {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--target, var(--_ink));
  cursor: pointer;
}

.arcade-target:hover {
  filter: brightness(1.1);
}

.arcade-copy {
  color: var(--_ink);
  background: var(--_paper);
  box-shadow: inset 0 0 0 2px var(--_ink);
}

.arcade-status {
  min-height: 1.4em;
  margin: 10px 0 0;
  font-size: 14px;
}

.arcade-actions {
  display: grid;
  gap: 8px;
}

.arcade-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  padding: 9px 14px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  text-align: left;
  color: var(--_ink);
  background: var(--_paper);
  box-shadow: inset 0 0 0 2px var(--_ink);
  cursor: pointer;
}

.arcade-action span {
  font-size: 14px;
  opacity: 0.8;
}

.arcade-action.is-primary {
  color: var(--_accent-ink);
  background: var(--_accent);
  box-shadow: none;
}

.arcade-action:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* the short code, the extras (challenge, images, QR, reminder) and what
   they show */
/* the short code, last in the sheet */
.arcade-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--_line);
  font-size: 14px;
}

.arcade-code[hidden] {
  display: none;
}

/* each network's icon before its name (icons.js, in currentColor) */
.arcade-icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.arcade-target,
.arcade-mini {
  gap: 7px;
}

.arcade-targets[hidden] {
  display: none;
}

.arcade-code strong {
  font-size: 17px;
  letter-spacing: 0.06em;
}

.arcade-code-hint {
  opacity: 0.8;
}

.arcade-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.arcade-mini {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  color: var(--_ink);
  background: var(--_paper);
  box-shadow: inset 0 0 0 1.5px var(--_ink);
  cursor: pointer;
}

.arcade-mini:disabled {
  opacity: 0.6;
  cursor: progress;
}

.arcade-panel:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.arcade-card-preview {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  box-shadow: 0 0 0 1.5px var(--_line);
}

.arcade-qr {
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
}

@media (max-width: 420px) {
  .arcade-targets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- the moment's share prompt (promptShare): a card, not a form ----
   The page's tokens dress it: --arcade-ink, --arcade-ink-soft,
   --arcade-paper, --arcade-accent, --arcade-accent-ink,
   --arcade-accent-strong, --arcade-accent-soft, --arcade-line,
   --arcade-radius, --arcade-shadow, --arcade-scrim, --arcade-font. */
.arcade-prompt {
  --_ink-soft: var(
    --arcade-ink-soft,
    color-mix(in srgb, var(--_ink) 68%, var(--_paper))
  );
  --_accent-strong: var(
    --arcade-accent-strong,
    color-mix(in srgb, var(--_accent) 78%, #000)
  );
  --_accent-soft: var(
    --arcade-accent-soft,
    color-mix(in srgb, var(--_accent) 14%, var(--_paper))
  );
  width: min(360px, calc(100vw - 32px));
  border-radius: var(--arcade-radius, 24px);
  box-shadow: var(
    --arcade-shadow,
    0 24px 60px rgba(16, 20, 40, 0.32),
    0 2px 0 rgba(16, 20, 40, 0.06)
  );
  overflow: hidden;
}
.arcade-prompt::backdrop {
  background: var(--arcade-scrim, rgba(20, 12, 10, 0.55));
}
.arcade-prompt .arcade-card {
  display: grid;
  justify-items: center;
  padding: 0 22px 20px;
  text-align: center;
}
/* the close button sits inside the card's corner, small and quiet */
.arcade-prompt .arcade-close {
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 700;
  color: var(--_ink-soft);
  background: color-mix(in srgb, var(--_paper) 72%, transparent);
  box-shadow: none;
}
.arcade-prompt .arcade-close:hover {
  color: var(--_ink);
  background: var(--_paper);
}
/* the moment's picture on a soft band of the accent */
.arcade-prompt-hero {
  display: grid;
  place-items: center;
  width: calc(100% + 44px);
  margin: 0 -22px 14px;
  padding: 22px 0 18px;
  background: linear-gradient(
    180deg,
    var(--_accent-soft),
    color-mix(in srgb, var(--_accent-soft) 40%, var(--_paper))
  );
}
.arcade-prompt-image {
  width: 112px;
  height: 112px;
  object-fit: contain;
  border-radius: 28px;
  filter: drop-shadow(0 8px 14px rgba(16, 20, 40, 0.18));
}
/* without a picture the heading clears the close button */
.arcade-prompt .arcade-close + .arcade-title {
  margin-top: 26px;
}
.arcade-prompt .arcade-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
  text-wrap: balance;
}
.arcade-prompt-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 8px;
}
.arcade-prompt-score strong {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--_accent-strong);
}
.arcade-prompt-score span {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--_ink-soft);
}
.arcade-prompt .arcade-badge {
  margin: 0 0 10px;
}
.arcade-prompt .arcade-note {
  max-width: 30ch;
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--_ink-soft);
  text-wrap: pretty;
}
.arcade-prompt-actions {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 100%;
}
.arcade-prompt-share {
  min-width: 180px;
  min-height: 46px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 17px;
  font-weight: 900;
  color: var(--_accent-ink);
  background: var(--_accent);
  box-shadow: 0 4px 0 var(--_accent-strong);
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}
.arcade-prompt-share:hover {
  filter: brightness(1.06);
}
.arcade-prompt-share:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--_accent-strong);
}
.arcade-prompt-later {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--_ink-soft);
  background: none;
  cursor: pointer;
}
.arcade-prompt-later:hover {
  color: var(--_ink);
  background: color-mix(in srgb, var(--_line) 55%, transparent);
}
.arcade-prompt:focus {
  outline: none;
}
.arcade-prompt :focus-visible {
  outline: 3px solid color-mix(in srgb, var(--_accent) 55%, transparent);
  outline-offset: 2px;
}
/* a light entrance: the card rises and the picture pops; none with less
   motion */
@media (prefers-reduced-motion: no-preference) {
  .arcade-prompt[open] {
    animation: arcade-prompt-in 260ms cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  }
  .arcade-prompt[open]::backdrop {
    animation: arcade-prompt-fade 200ms ease both;
  }
  .arcade-prompt[open] .arcade-prompt-image {
    animation: arcade-prompt-pop 520ms 80ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
  }
}
@keyframes arcade-prompt-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}
@keyframes arcade-prompt-fade {
  from {
    opacity: 0;
  }
}
@keyframes arcade-prompt-pop {
  from {
    transform: scale(0.6) rotate(-6deg);
  }
}
@media (max-width: 420px) {
  .arcade-prompt .arcade-card {
    padding: 0 18px 16px;
  }
  .arcade-prompt-hero {
    width: calc(100% + 36px);
    margin: 0 -18px 12px;
  }
  .arcade-prompt-share {
    width: 100%;
  }
}

/* ---- combo (combo.js): a big badge over the board ---- */
.arcade-combo {
  --_paper: var(--arcade-paper, #ffffff);
  --_accent: var(--arcade-accent, #d23a63);
  --_accent-ink: var(--arcade-accent-ink, #ffffff);
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 7;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 18px 12px;
  border-radius: 20px;
  color: var(--_accent-ink);
  background: var(--_accent);
  box-shadow:
    0 0 0 4px var(--_paper),
    0 14px 30px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: arcade-combo 1250ms cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.arcade-combo.is-still {
  animation: arcade-combo-still 1600ms ease both;
}
.arcade-combo-words {
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.arcade-combo-times {
  font-size: 15px;
  font-weight: 900;
}
.arcade-combo-points {
  font-size: 14px;
  font-weight: 800;
  opacity: 0.9;
}
@keyframes arcade-combo {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(-8deg);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15) rotate(3deg);
  }
  30% {
    transform: translate(-50%, -50%) scale(0.95) rotate(-1deg);
  }
  42%,
  78% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -90%) scale(0.9);
  }
}
@keyframes arcade-combo-still {
  0%,
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---- power-ups (powerups.js) ---- */
.arcade-powerups {
  --_ink: var(--arcade-ink, #1f2328);
  --_paper: var(--arcade-paper, #ffffff);
  --_accent: var(--arcade-accent, #d23a63);
  --_line: var(--arcade-line, #e5e7eb);
  margin-top: 10px;
}
.arcade-powerups-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.arcade-powerup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--_ink);
  background: var(--_paper);
  box-shadow: inset 0 0 0 2px var(--_line);
  cursor: pointer;
}
.arcade-powerup[aria-pressed='true'] {
  color: var(--_paper);
  background: var(--_accent);
  box-shadow: none;
}
.arcade-powerup.is-empty {
  opacity: 0.6;
}
.arcade-powerup-count {
  min-width: 1.4em;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 13px;
  text-align: center;
  background: var(--_line);
  color: var(--_ink);
}
.arcade-powerups-hint {
  min-height: 1.3em;
  margin: 6px 0 0;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}
