@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  --box: #fbd515;
  --box-hover: #ffe560;
  --box-active: #dabc25;
  --bg: #f4eef1;
  --button: #4f43ae;
  --button-hover: rgb(98, 82, 221);
  --button-active: #251f53;
  --border-default: rgb(56, 56, 56);
  --border-hover: rgb(80, 80, 80);
  --card-selected-border: rgb(182, 182, 182);
  --text-color: #000;
  --text-light: #f6f4f5;
  --text-dark: #000;
  --text-light-hover: #eee;
  --stroke-color: rgb(18, 18, 18);
  --bg-image: url("/images/lightMario.png");
}

* {
  font-family: "Press Start 2P", monospace;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html[data-theme="dark"] {
  --bg: #1f1d1e;
  --bg-image: url("/images/darkMario.png");
  --box: #269698;
  --box-hover: #38d6d9;
  --box-active: #1a8384;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;

  min-height: 100vh;

  background: var(--bg);
  background-image: var(--bg-image);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;

  image-rendering: pixelated;
  image-rendering: crisp-edges;
  color: var(--text-color);

  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;

  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  filter: brightness(0.8);
}

.header {
  display: flex;
  flex-direction: column;
  font-size: clamp(18px, 5vw, 30px);

  margin: 3% 1% 3% 1%;
  color: var(--text-light);

  text-shadow:
    -2px 0 0 var(--stroke-color),
    2px 0 0 var(--stroke-color),
    0 -2px 0 var(--stroke-color),
    0 2px 0 var(--stroke-color);
  text-align: center;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 120px);
  gap: 20px;
}

.footer {
  display: flex;
  flex-direction: column;

  margin: 20px 0 20px 0;
  color: var(--text-light);

  text-align: center;
  align-items: center;
  font-size: clamp(10px, 3vw, 20px);
}

.footer span {
  font-size: 25px;
  text-shadow:
    -2px 0 0 var(--stroke-color),
    2px 0 0 var(--stroke-color),
    0 -2px 0 var(--stroke-color),
    0 2px 0 var(--stroke-color);
}

.button {
  display: flex;
  justify-content: center;
  align-items: center;

  margin-top: 10px;
  padding: 16px 32px;

  background-color: var(--button);
  border: 1px solid var(--border-default);
  border-radius: 0%;

  color: var(--text-light);
  text-align: center;
  text-decoration: none;

  width: 250px;


  cursor: pointer;
  transition:
    background-color 0.3s,
    border 0.3s;
}

.button:hover {
  background-color: var(--button-hover);
  border: 1px solid var(--border-hover);
}

.button:active {
  background-color: var(--button-active);
}

.card {
  display: flex;
  justify-content: center;
  align-items: center;

  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;

  background-color: var(--box);
  border: 1px solid var(--border-default);
  border-radius: 5%;

  color: var(--text-light);
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  text-shadow:
    -1px 0 0 var(--stroke-color),
    1px 0 0 var(--stroke-color),
    0 -1px 0 var(--stroke-color),
    0 1px 0 var(--stroke-color);
  cursor: pointer;
  transition:
    background-color 0.1s,
    border 0.1s;
}

.card:hover {
  background-color: var(--box-hover);
  color: var(--text-light-hover);
}
.card:active {
  background-color: var(--box-active);
}
.card.selected::after {
  background: var(--card-selected-border);
  font-size: 40px;
}

.pixel-corners,
.pixel-corners--wrapper {
  clip-path: polygon(
    0px calc(100% - 8px),
    4px calc(100% - 8px),
    4px calc(100% - 4px),
    8px calc(100% - 4px),
    8px 100%,
    calc(100% - 8px) 100%,
    calc(100% - 8px) calc(100% - 4px),
    calc(100% - 4px) calc(100% - 4px),
    calc(100% - 4px) calc(100% - 8px),
    100% calc(100% - 8px),
    100% 8px,
    calc(100% - 4px) 8px,
    calc(100% - 4px) 4px,
    calc(100% - 8px) 4px,
    calc(100% - 8px) 0px,
    8px 0px,
    8px 4px,
    4px 4px,
    4px 8px,
    0px 8px
  );
  position: relative;
}
.pixel-corners {
  border: 4px solid transparent;
}
.pixel-corners--wrapper {
  width: fit-content;
  height: fit-content;
}
.pixel-corners--wrapper .pixel-corners {
  display: block;
  clip-path: polygon(
    4px 8px,
    8px 8px,
    8px 4px,
    calc(100% - 8px) 4px,
    calc(100% - 8px) 8px,
    calc(100% - 4px) 8px,
    calc(100% - 4px) calc(100% - 8px),
    calc(100% - 8px) calc(100% - 8px),
    calc(100% - 8px) calc(100% - 4px),
    8px calc(100% - 4px),
    8px calc(100% - 8px),
    4px calc(100% - 8px)
  );
}
.pixel-corners::after,
.pixel-corners--wrapper::after {
  content: "";
  position: absolute;
  clip-path: polygon(
    0px calc(100% - 8px),
    4px calc(100% - 8px),
    4px calc(100% - 4px),
    8px calc(100% - 4px),
    8px 100%,
    calc(100% - 8px) 100%,
    calc(100% - 8px) calc(100% - 4px),
    calc(100% - 4px) calc(100% - 4px),
    calc(100% - 4px) calc(100% - 8px),
    100% calc(100% - 8px),
    100% 8px,
    calc(100% - 4px) 8px,
    calc(100% - 4px) 4px,
    calc(100% - 8px) 4px,
    calc(100% - 8px) 0px,
    8px 0px,
    8px 4px,
    4px 4px,
    4px 8px,
    0px 8px,
    0px 50%,
    4px 50%,
    4px 8px,
    8px 8px,
    8px 4px,
    calc(100% - 8px) 4px,
    calc(100% - 8px) 8px,
    calc(100% - 4px) 8px,
    calc(100% - 4px) calc(100% - 8px),
    calc(100% - 8px) calc(100% - 8px),
    calc(100% - 8px) calc(100% - 4px),
    8px calc(100% - 4px),
    8px calc(100% - 8px),
    4px calc(100% - 8px),
    4px 50%,
    0px 50%
  );
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--border-default);
  display: block;
  pointer-events: none;
}
.pixel-corners::after {
  margin: -4px;
}

@media (max-width: 650px) {
  .board {
    grid-template-columns: repeat(3, 120px);
    gap: 10px;
  }
}

@media (max-width: 400px) {
  .board {
    grid-template-columns: repeat(3, 100px);
    gap: 8px;
  }

  .card {
    font-size: 15px;
  }
}
