@font-face {
  font-family: Pixel;
  src: url("./assets/pixel.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Nunito;
  src: url("./assets/nunito.woff2") format("woff2");
  font-display: swap;
  font-weight: 400 900;
}
:root {
  color-scheme: light;
  --ink: #41314d;
  --purple: #72568a;
  --lilac: #d7c5ed;
  --paper: #fffdf6;
  --pink: #f4cce0;
  --muted: #7a6883;
  --line: #b7a1c7;
  font-family: Nunito, "Trebuchet MS", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: #e4d6ef;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 64px 28px;
  background-image:
    linear-gradient(90deg, #fff5 1px, transparent 1px),
    linear-gradient(#fff5 1px, transparent 1px);
  background-size: 24px 24px;
}
button,
select {
  font: inherit;
}
button {
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: wait;
}
button:focus-visible,
select:focus-visible {
  outline: 3px solid #9660b6;
  outline-offset: 6px;
}
button {
  -webkit-tap-highlight-color: transparent;
}
[hidden] {
  display: none !important;
}
.app-window {
  width: min(1100px, 100%);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 7px 8px 0 #aa8ebe;
  overflow: hidden;
}
.titlebar {
  height: 43px;
  background: var(--lilac);
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-family: Pixel, "Courier New", monospace;
  font-size: 1.1rem;
}
.titlebar > span:first-child {
  display: flex;
  gap: 9px;
  align-items: center;
}
.window-heart {
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  width: 25px;
  height: 25px;
  background: #f4ebfb;
  font-family: Arial, sans-serif;
  font-weight: bold;
}
.window-body {
  padding: 40px 48px 0;
  background-image: radial-gradient(#b39cb41a 0.8px, transparent 0.8px);
  background-size: 7px 7px;
}
.heading {
  display: flex;
  justify-content: center;
  gap: 27px;
  align-items: center;
  margin-bottom: 46px;
}
h1 {
  font-family: Pixel, "Courier New", monospace;
  font-size: clamp(2.7rem, 5vw, 4.4rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.06em;
  margin: 0;
  text-shadow: 3px 3px 0 #e6d2ef;
}
.sparkle {
  color: #a583b8;
  font-size: 2.5rem;
  transform: rotate(12deg);
}
.sparkle:last-child {
  font-size: 1.6rem;
  transform: rotate(-12deg);
}
.pair-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: -20px 0 30px;
}
.pair-picker label {
  font-size: 0.875rem;
}
.pair-picker select {
  min-height: 44px;
  max-width: 70%;
  background: var(--paper);
  color: var(--ink);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr);
  align-items: center;
  gap: 26px;
  padding: 12px 0;
}
.postcard {
  position: relative;
  padding: 12px 12px 3px;
  background: #fffdf8;
  border: 1.5px solid var(--ink);
  box-shadow: 4px 5px 0 #ded3e1;
  transition:
    transform 0.3s,
    box-shadow 0.3s,
    border-color 0.3s;
  min-width: 0;
  align-self: center;
}
.postcard-left {
  transform: rotate(-4deg);
}
.postcard-right {
  transform: rotate(4deg);
}
.tape {
  position: absolute;
  z-index: 2;
  top: -13px;
  left: calc(50% - 35px);
  width: 70px;
  height: 26px;
  transform: rotate(3deg);
  background: #d8c5e8d4;
  border-left: 1px dashed #c4b1d4;
  border-right: 1px dashed #c4b1d4;
  box-shadow: 0 1px 0 #a893b433;
}
.postcard-right .tape {
  background: #f2d4dedc;
  transform: rotate(-8deg);
}
.postcard-photo {
  position: relative;
  aspect-ratio: 1.28;
  overflow: hidden;
  border: 1px solid #c4b4ce;
  background: #e6d6ef;
  isolation: isolate;
}
.postcard-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.image-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: Pixel, "Courier New", monospace;
  font-size: clamp(0.875rem, 2vw, 1.125rem);
  color: var(--purple);
  background: repeating-conic-gradient(#e8dcef 0 25%, #e1d2e9 0 50%) 50%/28px
    28px;
}
.side-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 4px 10px;
  line-height: 1;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 2px 2px 0 #41314d36;
  font-family: Pixel, "Courier New", monospace;
  font-size: 1rem;
}
.postcard-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 10px 4px;
}
.postcard-label h2 {
  font-size: clamp(1.1rem, 2.05vw, 1.6rem);
  line-height: 1.15;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}
.postcard-label > span {
  font-family: Georgia, serif;
  font-size: 1.8rem;
  color: #9c729c;
}
.winner-sticker {
  display: none;
  position: absolute;
  top: 15px;
  right: -11px;
  z-index: 3;
  padding: 8px 11px;
  background: var(--pink);
  border: 1.5px solid var(--ink);
  box-shadow: 2px 3px 0 #41314d28;
  transform: rotate(9deg);
  font-family: Pixel, "Courier New", monospace;
  font-size: 1rem;
}
.postcard.is-winner {
  transform: rotate(0deg) translateY(-7px);
  box-shadow: 5px 7px 0 #baa0ce;
  border-color: #72568a;
}
.postcard.is-winner .winner-sticker {
  display: block;
}
.coin-area {
  --toss-height: -76px;
  display: flex;
  align-items: center;
  flex-direction: column;
  position: relative;
  z-index: 3;
  align-self: center;
  padding-top: 1px;
}
.versus {
  font-family: Georgia, serif;
  font-style: italic;
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 19px;
}
.coin-button {
  --coin-size: 126px;
  display: block;
  width: var(--coin-size);
  height: var(--coin-size);
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 800px;
  border-radius: 50%;
  transition: transform 0.2s;
  touch-action: manipulation;
}
@media (hover: hover) {
  .coin-button:hover:not(:disabled) {
    transform: translateY(-5px) rotate(-8deg);
  }
}
.coin-toss {
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}
.coin {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-16deg) rotateY(-18deg) rotateX(0deg);
  border-radius: 50%;
}
.coin-edge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--coin-size) * 0.067);
  height: 10px;
  margin-left: calc(var(--coin-size) * -0.0335);
  margin-top: -5px;
  background: repeating-linear-gradient(
    90deg,
    #82768f 0 1px,
    #ddd5e8 1px 2px,
    #a89bb8 2px 3px
  );
  transform: rotateZ(var(--edge-angle))
    translateY(calc(var(--coin-size) * -0.5 + 1px)) rotateX(90deg);
}
.coin-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 3px solid #756d83;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    #fff 0%,
    #dad5e4 28%,
    #f8f6fc 48%,
    #c4bdd4 72%,
    #eeeaf4 100%
  );
  box-shadow:
    inset 0 0 0 4px #efedf5,
    inset 0 0 0 6px #a29bb2;
  transform: translateZ(5px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  color: #776c89;
  text-shadow: 1px 1px 0 white;
}
.coin-face:after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px dashed #a49aad;
  border-radius: 50%;
}
.coin-back {
  transform: rotateX(180deg) translateZ(5px);
}
.coin-dots {
  font-family: Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  line-height: 1;
}
.coin-symbol {
  font-family: Georgia, serif;
  font-size: 3.1rem;
  line-height: 1.12;
  filter: drop-shadow(1px 2px 0 #b1a7c1);
}
.coin-word {
  font-family: Pixel, "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.2;
}
.coin-shadow {
  display: block;
  width: 70px;
  height: 8px;
  background: #d3c6dc77;
  border-radius: 50%;
  margin: 17px 0 24px;
}
.flip-button {
  min-height: 44px;
  background: var(--ink);
  color: #fff9fa;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 3px 4px 0 #be9fcf;
  font-family: Pixel, "Courier New", monospace;
  font-size: 1.05rem;
  white-space: nowrap;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  touch-action: manipulation;
}
.flip-button span {
  color: #e6bee8;
  margin-left: 5px;
}
@media (hover: hover) {
  .flip-button:hover:not(:disabled) {
    background: #604670;
    transform: translateY(-2px);
    box-shadow: 3px 6px 0 #be9fcf;
  }
}
.flip-button:active:not(:disabled) {
  transform: translate(2px, 3px);
  box-shadow: 1px 1px 0 #be9fcf;
}
.flip-button:disabled {
  background: #735e80;
  border-color: #735e80;
}
/* Keep the coin flip animated even when other motion is reduced. */
.coin.is-spinning {
  animation: coin-spin var(--flip-duration) linear !important;
}
.coin-area.is-flipping .coin-toss {
  animation: coin-toss var(--flip-duration) linear !important;
}
.coin-area.is-flipping .coin-shadow {
  animation: coin-shadow var(--flip-duration) linear !important;
}
.result-area {
  display: grid;
  place-items: center;
  min-height: 108px;
  padding: 24px 0 15px;
}
.result {
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.idle-heart {
  font-family: Georgia, serif;
  font-size: 1.6rem;
  color: #bda3c7;
}
.result.reveal {
  animation: result-in 0.4s ease-out;
}
footer {
  border-top: 1px dashed #c9b7d2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 0;
  font-family: Pixel, "Courier New", monospace;
  font-size: 0.875rem;
  color: var(--muted);
}
.footer-names {
  color: #9c79ae;
  letter-spacing: 0.15em;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.noscript {
  position: fixed;
  bottom: 0;
  background: var(--paper);
  padding: 10px;
  border: 1px solid var(--ink);
}
@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes coin-toss {
  0%, 100% {
    transform: translateY(0);
  }
  10% {
    transform: translateY(6px);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  }
  44% {
    transform: translateY(var(--toss-height));
    animation-timing-function: cubic-bezier(0.6, 0, 0.85, 0.5);
  }
  78% {
    transform: translateY(0);
    animation-timing-function: ease-out;
  }
  89% {
    transform: translateY(-12px);
    animation-timing-function: ease-in;
  }
}
@keyframes coin-spin {
  from {
    transform: rotateX(-16deg) rotateY(-18deg) rotateX(var(--flip-start));
  }
  to {
    transform: rotateX(-16deg) rotateY(-18deg) rotateX(var(--flip-end));
  }
}
@keyframes coin-shadow {
  0%, 78%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  44% {
    transform: scale(0.45);
    opacity: 0.25;
  }
  89% {
    transform: scale(0.8);
    opacity: 0.7;
  }
}
@media (min-width: 1400px) {
  .app-window {
    width: 1160px;
  }
  .window-body {
    padding: 46px 56px 0;
  }
  .heading {
    margin-bottom: 52px;
  }
  .matchup {
    gap: 36px;
  }
  .postcard-photo {
    aspect-ratio: 1.3;
  }
  .result-area {
    min-height: 119px;
  }
}
@media (max-width: 800px) {
  body {
    padding: 40px 20px;
  }
  .window-body {
    padding: 34px 28px 0;
  }
  .matchup {
    grid-template-columns: minmax(0, 1fr) 124px minmax(0, 1fr);
    gap: 18px;
  }
  .postcard {
    padding: 8px 8px 0;
  }
  .postcard-photo {
    aspect-ratio: 0.95;
  }
  .postcard-label {
    min-height: 64px;
  }
  .postcard-label h2 {
    font-size: 1.2rem;
  }
  .coin-button {
    --coin-size: 104px;
  }
  .coin-symbol {
    font-size: 2.5rem;
  }
  .coin-face:after {
    inset: 9px;
  }
  .flip-button {
    font-size: 0.9rem;
    padding: 10px;
  }
  .coin-shadow {
    margin: 16px 0 20px;
  }
  .heading {
    margin-bottom: 38px;
  }
  .winner-sticker {
    font-size: 0.875rem;
    padding: 6px;
    right: -7px;
  }
  .side-badge {
    font-size: 0.875rem;
    left: 6px;
    bottom: 7px;
    padding: 4px 6px;
  }
}
@media (max-width: 580px) {
  body {
    padding: 24px 13px;
  }
  .app-window {
    box-shadow: 4px 5px 0 #aa8ebe;
    border-radius: 9px;
  }
  .titlebar {
    height: 39px;
    font-size: 1rem;
    padding: 0 12px;
  }
  .window-body {
    padding: 26px 17px 0;
  }
  .heading {
    gap: 17px;
    margin-bottom: 30px;
  }
  h1 {
    font-size: 3rem;
  }
  .sparkle {
    font-size: 1.8rem;
  }
  .matchup {
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
    gap: 0;
    position: relative;
    padding-bottom: 211px;
    align-items: start;
  }
  .postcard-left {
    grid-column: 1;
    grid-row: 1;
    transform: rotate(-4deg);
    margin-right: -8px;
  }
  .postcard-right {
    grid-column: 3;
    grid-row: 1;
    transform: rotate(4deg);
    margin-left: -8px;
  }
  .postcard {
    padding: 7px 7px 0;
  }
  .postcard-photo {
    aspect-ratio: 1.03;
  }
  .postcard-label {
    min-height: 66px;
    padding: 10px 1px;
    gap: 2px;
  }
  .postcard-label h2 {
    font-size: 1.06rem;
    letter-spacing: -0.045em;
  }
  .postcard-label > span {
    font-size: 1.25rem;
  }
  .tape {
    height: 21px;
    width: 54px;
    left: calc(50% - 27px);
    top: -11px;
  }
  .coin-area {
    --toss-height: -36px;
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    padding: 0;
  }
  .versus {
    position: absolute;
    top: -47px;
    font-size: 0.95rem;
    display: none;
  }
  .coin-button {
    --coin-size: 99px;
  }
  .coin-dots {
    font-size: 0.7rem;
  }
  .coin-word {
    font-size: 0.8rem;
  }
  .coin-shadow {
    height: 6px;
    margin: 12px 0 13px;
  }
  .flip-button {
    font-size: 1rem;
    padding: 10px 18px;
  }
  .result-area {
    min-height: 81px;
    padding: 23px 0 17px;
  }
  .result {
    font-size: 1.12rem;
  }
  footer {
    padding: 14px 0;
    font-size: 0.875rem;
  }
  .pair-picker {
    margin: -9px 0 28px;
    flex-direction: column;
    gap: 5px;
  }
  .pair-picker select {
    max-width: 100%;
  }
  .winner-sticker {
    top: 10px;
    font-size: 0.8rem;
    padding: 5px;
  }
  .side-badge {
    font-size: 0.8rem;
  }
  .postcard.is-winner {
    transform: rotate(0) translateY(-4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
