/* !IMPORTANT! 👹 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --darkgrey: #828282;
  --grey: #C3C3C3;
  --white: #fff;
  --black: #000;
  --red: #f00;
  --yellow: #ff0;
  --blue: #00f;
  --darkblue: #0000C3;
}

body {
  margin: 0;
  padding: 0;
  background-color: #111111;
  font-family: sans-serif;
  height: 100vh;
  &:has(dialog[open]) {
    overflow-x: hidden;
  }
}

.action-letter {
  text-decoration: underline !important;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 100%;
  height: 2rem;

  h1, h2 {
    background: var(--darkblue);
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: var(--white);
    font-family: "Cascadia code", monospace;
  }

  & .winCL {
    aspect-ratio: 1/1;
    min-height: 100%;
  }

}

.game-menu {
  min-width: 100%;
  height: 2.25rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--black);
  background: var(--white);
  position: relative;

  & label {
    font-size: 1.7rem;
    padding: 0 0.5rem;
    font-family: "Cascadia code", monospace;
    color: var(--black);
    cursor: pointer;
    width: 100%;
    height: 100%;
  }

  & select {
    cursor: pointer;
    position: absolute;
    width: 50%;
    height: 100%;
    opacity: 0;

    &:last-child {
      right: 0;
    }
  }
}

header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
  background: var(--grey);
  color: var(--red);
  font-size: 2rem;
  box-shadow: inset -4px -4px var(--white), inset 4px 4px var(--darkgrey);
  padding: 0.25rem 1rem;

  #minesLeft,
  #seconds {
    background: var(--black);
    box-shadow:
      inset -2px -2px var(--white),
      inset 2px 2px var(--darkgrey);
    padding: 0.25rem;
    font-variant-numeric: tabular-nums;
    user-select: none;
  }
}

#faceContainer {
  cursor: pointer;
  aspect-ratio: 1/1;
  font-size: 2rem;
  background: var(--grey);
  box-sizing: content-box;
  padding: 0.35rem;
  border: none;
  box-shadow:
    inset 3px 3px var(--white),
    inset -4px -4px var(--darkgrey),
    -2px -2px var(--darkgrey),
    2px 2px var(--darkgrey);
  transition: scale 50ms;

  &:hover {
    scale: 1.05;
  }

  &:active {
    scale: 0.95;
  }
}

#happyFace {
  width: 2rem;
  height: 2rem;
  aspect-ratio: 1/1;
  background: var(--yellow);
  border-radius: 50%;
  border: 2px solid var(--black);
  position: relative;
  font-family: sans-serif !important;
}

#happyFace.happy {
  &::before {
    content: "☺";
    color: var(--black);
    position: absolute;
    font-size: 3.2rem;
    left: -0.74rem;
    top: -1.25rem;
  }
}

#happyFace.sad {
  &::before {
    content: "☹";
    color: var(--black);
    position: absolute;
    left: -0.1rem;
    top: -0.56rem;
  }
}

#happyFace.pacman {
  &::before {
    content: "⍩";
    color: var(--black);
    position: absolute;
    left: 0.19rem;
    top: -0.5rem;
    transform: scaleX(-1);
  }
}

#happyFace.meh {
  &::before {
    content: "⍨";
    color: var(--black);
    position: absolute;
    left: 0.15rem;
    top: -0.4rem;
  }

}

#happyFace.shruggie {
  &::before {
    content: "ツ";
    font-size: 1.58rem;
    color: var(--black);
    position: absolute;
    left: 0.15rem;
    top: -0.2rem;
  }
}

td {
  background: var(--grey);
  aspect-ratio: 1 / 1 !important;
  width: 2rem !important;
  height: 2rem !important;
  font-family: monospace !important;
  text-align: center;
  position: relative;
  font-size: 1.6rem;
  font-weight: 900;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  cursor: pointer;

  &::before,
  &::after {
    font-size: 1.5rem;
  }
}

td.active {
  color: var(--color, #fffffffd);
  cursor: default !important;
}

td.revealed {
  cursor: default;

  &::before {
    content: "" !important;
  }

  &::after {
    z-index: 2;
    content: "☣";
    position: absolute;
    width: 100%;
    height: 100%;
    top: -2px;
    left: 0;
    text-align: center;
    color: #000;
    font-weight: 900;
  }
}

td.devReveal {
  &::before {
    content: "⚠" !important;
    color: #300;
  }
}

td.flagged {
  &::after {
    z-index: 2;
    content: "⚐";
    position: absolute;
    width: 100%;
    height: 100%;
    top: -1px;
    left: -1px;
    text-align: center;
    color: #f00;
  }
}

td.flagged.revealed {
  &::after {
    color: var(--yellow) !important;
    cursor: default !important;
  }
}

td.hide {
  &::before {
    z-index: 1;
    content: "";
    position: absolute;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    top: -1px;
    left: -1px;
    background: var(--grey);
    box-shadow: inset -3px -3px var(--darkgrey), inset 4px 4px var(--white);
  }
}

.rainbow {
  background: #fff;
  mix-blend-mode: multiply;
  overflow: hidden;

  &::after {
    content: "";
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    bottom: 0;
    left: -100%;
    background: white repeating-linear-gradient(90deg, #14ffe9 0%, #ffc800 16.66666%, #ff00e0 33.33333%, #14ffe9 50.0%);
    mix-blend-mode: screen;
    pointer-events: none;
    animation: move 1s linear infinite;
  }
}

dialog {
  position: relative;
  background: transparent;
  border: none;

  &>div {
    display: flex;
    flex-direction: column;
    background: var(--white);
    padding: 0.25rem;
    border: 2px solid var(--black);
    box-shadow: inset 0.25rem 0.25rem var(--grey), inset -0.25rem -0.25rem var(--grey),
      inset 5px 5px var(--black), inset -5px -5px var(--black);
    ;
    & div {
      max-height: 20rem;
      max-width: 50rem;
      overflow-y: scroll;
      padding: 1rem 2.25rem;
      border: 1px solid var(--black);
    }
  }

}

.winCL {
  border: 1px solid #000;
  padding: 3px 6px 3px 7px;
  background: #c6c6c6;

  box-shadow: inset -1px -1px #848484, inset 1px 1px #fff;

  &:active {
    box-shadow: inset -1px -1px #fff, inset 1px 1px #848484;
  }
}

@keyframes move {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(50%);
  }
}

@supports not (mix-blend-mode: multiply) {
  .rainbow-text {
    -webkit-text-fill-color: transparent;
    background-clip: text !important;
    background: white repeating-linear-gradient(90deg, #14ffe9, #ffc800, #ff00e0, #14ffe9);
    text-shadow: none;
  }

  .rainbow-text::before {
    content: none;
  }
}