/* Added for hosting: Cinzel is self-hosted so the page has no third-party
   dependency and no render-blocking request to fonts.googleapis.com. */
@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/cinzel-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/cinzel-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* The game is a fixed-ratio cabinet centred in the window. 16:10 is measured,
   not chosen: every card image is square, so the 6x3 board is exactly 2:1, and
   a square board plus the banner strip and stats bar lands the whole frame at
   1.6:1. Cards stay square from a 1920 monitor down to 900px. */
body {
  min-block-size: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  background-color: #06060a;
  background-image: url("images/background.jpg");
  background-repeat: repeat;
  background-blend-mode: multiply;
}

.page {
  inline-size: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.cabinet {
  --cab-ratio: 1.6;
  --chrome: 88px;

  /* Fits by width and by height, so the frame never runs off the bottom. */
  inline-size: min(1160px, 100%, (100dvh - var(--chrome)) * var(--cab-ratio));
  aspect-ratio: var(--cab-ratio);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: clamp(4px, 0.6vw, 12px);
  padding: clamp(6px, 0.8vw, 14px);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 14px;
  background: rgb(8 8 10 / 62%);
  box-shadow: 0 24px 60px rgb(0 0 0 / 55%);
  container-type: inline-size;
}

/* Without a floor the banner row is the first thing to collapse: on a short
   landscape phone the board plus readable stats already exceed a 16:10 frame,
   and the strip was being squeezed to zero height. The frame goes a little
   taller than 1.6 there instead, which nobody notices; a missing banner they do.
   The floor is in cqw so it scales with the frame, not the viewport. */
.header {
  display: grid;
  grid-template-columns: 9fr 91fr;
  gap: 1%;
  min-block-size: clamp(9px, 2.2cqw, 46px);
}

.logo {
  background-image: url("images/logo.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.banner {
  background-image: url("images/banner.jpg");
  background-size: cover;
  border-radius: 8px;
}

.gameInfoArea {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(4px, 1cqw, 14px);
  padding: clamp(4px, 0.7cqw, 10px) clamp(6px, 1.4cqw, 18px);
  background-color: #ffffff69;
  border-radius: 8px;
  font-family: "Cinzel", serif;
  font-weight: bold;
  font-size: clamp(8px, 1.15cqw, 15px);
  line-height: 1.2;
  text-align: center;
}

.gameInfoArea > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-inline-size: 0;
}

/* The numbers are the point of the bar; they used to sit at the same size as
   their own caption. */
#gamesPlayed,
#attempts,
#accuracy {
  font-size: 1.2em;
}

.reset {
  cursor: pointer;
}

.gameArea {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(3px, 0.45cqw, 7px);
  aspect-ratio: 2 / 1;
  min-block-size: 0;
}

.cardContainer {
  perspective: 1000px;
  cursor: pointer;
}

.cardContainer .card {
  height: 100%;
  position: relative;
  transition: transform 1s;
  transform-style: preserve-3d;
}

.cardContainer.click .card {
  transform: rotateY(180deg);
}

.cardContainer:hover .vibrate {
  -webkit-animation: vibrate-1 0.5s linear infinite both;
  animation: vibrate-1 0.5s linear infinite both;
}

.front,
.back {
  height: 100%;
  width: 100%;
  position: absolute;
  border-radius: 8px;
  backface-visibility: hidden;
}

.front {
  transform: rotateY(180deg);
}

.resetButton {
  display: block;
  cursor: pointer;
  background: url("images/button1.png");
  inline-size: clamp(16px, 2.6cqw, 30px);
  block-size: clamp(16px, 2.6cqw, 30px);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.resetButton:hover {
  background-image: url("images/button3.png");
}

.resetButton:active {
  background-image: url("images/button2.png");
  transform: translateY(4px);
}

.soundButton {
  font-size: clamp(12px, 1.7cqw, 20px);
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgb(0 0 0 / 70%);
}

.modal-content {
  inline-size: min(400px, 100%);
  border-radius: 10px;
  overflow: hidden;
}

/* The animation is 400x219. It used to be forced into a 50% x 50% box with no
   object-fit, which squashed it by about 12%. */
.modal-picture {
  display: block;
  inline-size: 100%;
  block-size: auto;
  object-fit: contain;
}

.overlay {
  display: none;
}

/* ----------------------------------------------
 * Generated by Animista on 2019-7-15 11:57:58
 * w: http://animista.net, t: @cssanimista
 * ---------------------------------------------- */

/**
 * ----------------------------------------
 * animation vibrate-1
 * ----------------------------------------
 */
@-webkit-keyframes vibrate-1 {
  0% {
    -webkit-transform: translate(0);
    transform: translate(0);
  }

  20% {
    -webkit-transform: translate(-2px, 2px);
    transform: translate(-2px, 2px);
  }

  40% {
    -webkit-transform: translate(-2px, -2px);
    transform: translate(-2px, -2px);
  }

  60% {
    -webkit-transform: translate(2px, 2px);
    transform: translate(2px, 2px);
  }

  80% {
    -webkit-transform: translate(2px, -2px);
    transform: translate(2px, -2px);
  }

  100% {
    -webkit-transform: translate(0);
    transform: translate(0);
  }
}

@keyframes vibrate-1 {
  0% {
    -webkit-transform: translate(0);
    transform: translate(0);
  }

  20% {
    -webkit-transform: translate(-2px, 2px);
    transform: translate(-2px, 2px);
  }

  40% {
    -webkit-transform: translate(-2px, -2px);
    transform: translate(-2px, -2px);
  }

  60% {
    -webkit-transform: translate(2px, 2px);
    transform: translate(2px, 2px);
  }

  80% {
    -webkit-transform: translate(2px, -2px);
    transform: translate(2px, -2px);
  }

  100% {
    -webkit-transform: translate(0);
    transform: translate(0);
  }
}

@media (orientation: portrait) {
  .overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: black;
    position: fixed;
    inset: 0;
    z-index: 100;
  }

  .overlay-content {
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    font-family: "Cinzel", serif;
    font-weight: bold;
    /* A fixed 55px did not fit a phone, which is the one device that sees this. */
    max-inline-size: 100%;
    font-size: clamp(20px, 7vw, 55px);
    line-height: 1.15;
  }

  /* Set as a background rather than an <img> so desktop never downloads it;
     the request only happens once this media query matches. */
  .overlay-content::before {
    content: "";
    display: block;
    inline-size: min(240px, 58vw);
    aspect-ratio: 550 / 400;
    margin: 0 auto 16px;
    background: url("images/landscape.gif") center / contain no-repeat;
  }
}

/* ------------------------------------------------------------------
 * Added for hosting on phongtruong.com -- not part of the 2019 original.
 * Original rules above are untouched.
 * ------------------------------------------------------------------ */

/* It used to be position: fixed, which put it on top of the banner art once the
   frame was centred. It now sits in the page flow above the cabinet. */
.backlink {
  align-self: flex-end;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-family: "Cinzel", serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.backlink:hover,
.backlink:focus-visible {
  background: #e3872d;
  color: #000;
}

.backlink:focus-visible {
  outline: 2px solid #e3872d;
  outline-offset: 2px;
}

/* The volume icon was a FontAwesome glyph; it is inline SVG now. */
.soundButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.soundButton svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.soundButton:focus-visible {
  outline: 2px solid #e3872d;
  outline-offset: 2px;
}
