@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");

:root {
  --green: #1ed760;
  --green-dark: #007c2c;
  --baby-blue: #42e0ff;
  --baby-darkblue: #00c4eb;
  --orange: #ffa742;
  --dark-orange: #ff8800;
  --black: #000000;
  --white: #ffffff;
  --dark-grey: #1a1a1a;
  --light-grey: #282828;
  --text-muted: #cccccc;
  --red: #ff4444;
  --radius: 500px;
}

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

img {
  max-width: 100%;
  display: block;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--black);
  color: var(--white);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1,
.h1 {
  font-size: 42px;
  font-weight: 700;
  line-height: 1.2;
}

h2,
.h2 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

h3,
.h3 {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
}

h4,
.h4,
.overlay-content h4 {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.p {
  font-size: 21px;
  font-weight: 400;
  line-height: 1.2;
}

.p2 {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
}

.p2-bold {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.p3 {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
}

.p4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
}

.background-image {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    var(--black) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: -1;
  pointer-events: none;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 16px;
  flex-grow: 1;
}

#game-grid {
  display: grid;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  gap: 10px;
}

.board-container {
  display: grid;
  gap: 20px;
}

.site-header {
  position: relative;
  width: 100%;
  padding: 60px 10px 0px;
  display: flex;
  justify-content: center;
  z-index: 100;
  flex-shrink: 0;
}

.header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  height: 60px;
  margin-bottom: 8px;
}

.tagline {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.header-actions {
  position: absolute;
  right: 24px;
  top: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-toggle-btn {
  background-color: var(--black);
  border: 2px solid var(--green);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  /* right: 24px;
  top: 24px; */
  transition: all 0.3s ease;
}

.mode-toggle-btn:hover {
  transform: scale(1.05);
  background-color: var(--green);
  box-shadow: 0 0 10px rgba(12, 78, 35, 0.5);
}

.icon-visual {
  width: 22px;
  height: 22px;
  background-color: var(--white);
  -webkit-mask-image: url("https://unpkg.com/@phosphor-icons/core@2.1.1/assets/regular/sun.svg");
  mask-image: url("https://unpkg.com/@phosphor-icons/core@2.1.1/assets/regular/sun.svg");
  mask-repeat: no-repeat;
  mask-size: contain;
  mask-position: center;
  -webkit-mask-position: center;
  transition:
    background-color 0.3s ease,
    transform 0.4s ease;
}

.svg-icon {
  width: 22px;
  height: 22px;
  display: block;
}

#instructions-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

button,
.button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 18px 30px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.btn-primary {
  background-color: var(--green);
  color: var(--black);
  border-color: var(--green);
  width: 200px;
}

.btn-primary:hover {
  background-color: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--black);
  color: var(--white);
  border: 2px solid var(--green);
  width: 200px;
}

.btn-secondary:hover {
  background-color: var(--green);
  color: var(--black);
  border-color: var(--green);
  transform: translateY(-2px);
}

.btn-reset {
  background-color: var(--green);
  color: var(--black);
  border-color: var(--green);
  width: 45px;
  height: 45px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-reset:hover {
  background-color: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
  transform: rotate(-180deg);
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  align-items: center;
}

#btn-spotify {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--green);
  color: var(--black);
  border: 2px solid var(--green);
  border-radius: var(--radius);
  width: 200px;
  font-weight: 700;
  text-decoration: none;
  padding: 18px 30px;
  transition: all 0.2s ease;
}

#btn-spotify:hover {
  background-color: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
  transform: translateY(-2px);
  text-decoration: none;
}

.setup-form {
  width: 100%;
  max-width: 200px;
}
.setup-form label {
  display: block;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.2;
}

#playerName {
  width: 100%;
  height: 60px;
  border-radius: var(--radius);
  border: none;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--black);
  background-color: var(--white);
  line-height: 1.2;
}

.screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hidden {
  display: none !important;
}

dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  background: transparent;
}

dialog.overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  margin: auto;
  z-index: 1000;
  color: var(--white);
}

dialog.overlay[open] {
  display: flex;
}

dialog::backdrop {
  background-color: var(--black);
  opacity: 0.8;
}

.overlay-content {
  background-color: var(--dark-grey);
  border: 2px solid var(--green);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  max-width: 600px;
  margin: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.overlay-stats {
  display: flex;
  flex-direction: column;
  background: var(--black);
  padding: 20px;
  border-radius: 12px;
  width: auto;
}

.grad {
  background-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    var(--black) 50%,
    rgba(0, 0, 0, 0) 100%
  );
}
.overlay-stats p {
  width: 100%;
  text-align: left;
  margin: 4px 0;
  font-size: 14px;
}

.overlay-stats-split {
  display: flex;
  flex-direction: row;
  width: 100%;
  gap: 10px;
  justify-content: center;
}

.overlay-stats-split h4 {
  width: 100%;
  text-align: left;
  color: var(--green);
  margin-bottom: 10px;
  font-size: 14px;
}

.overlay-content ul {
  text-align: center;
  list-style: none;
  margin: 10px 0;
}

.overlay-content li {
  margin-bottom: 10px;
  font-size: 14spx;
  line-height: 1.4;
  background-color: var(--black);
  border-radius: 12px;
  padding: 20px;
}

.overlay-content li strong {
  color: var(--green);
  display: block;
  font-size: 14px;
  text-transform: uppercase;
  line-height: 1.4;
}

.overlay-actions {
  display: flex;
  gap: 12px;
}

#start-time-limit {
  color: var(--green);
  font-weight: inherit;
}

#overlay-level-start .overlay-content {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.4s ease;
}

#overlay-level-start[open] .overlay-content {
  opacity: 1;
  transform: scale(1);
}

#overlay-loss .overlay-content {
  border-color: var(--red);
}

#match-examples {
  display: flex;
  gap: 24px;
  margin-bottom: 30px;
}

.match-pair {
  position: relative;
  display: flex;
  gap: 8px;
}

.match-pair img {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  border: 2px solid var(--green);
}

.check-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--green);
  color: var(--black);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 900;
}

.score-panel {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  max-width: 800px;
  border: 1px solid var(--green);
  padding: 15px 25px;
  border-radius: 12px;
  background: var(--black);
}

.stat-details {
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin: 5px;
}

.stat-level span,
.stat-time span,
.stat-score span,
.stat-moves span {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--green);
  line-height: 1.2;
}

.card {
  position: relative;
  width: 100px;
  aspect-ratio: 1;
  cursor: pointer;
  background-color: transparent;
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-front,
.card-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--green);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* transition: opacity 0.2s ease-in-out; */
}

.card-front {
  background-color: var(--dark-grey);
  z-index: 2;
}

.card-back {
  background-color: var(--green-dark);
  color: var(--white);
  padding: 8px;
  font-size: 14px;
  text-align: center;
  transform: rotateY(180deg);
}

.card.flipped {
  transform: rotateY(180deg);
}
/* .card.flipped .card-front {
  opacity: 0;
}
.card.flipped .card-back {
  opacity: 1;
} */

.card:hover:not(.flipped) .card-front {
  border-color: var(--white);
}

.card-front svg {
  width: 40%;
  height: auto;
  color: var(--green);
}

.card-artist .card-back {
  background-color: var(--baby-blue);
  border-color: var(--baby-darkblue);
  color: var(--black);
}

.card-title .card-back {
  background-color: var(--orange);
  border-color: var(--dark-orange);
  color: var(--black);
}

.card.matched .card-back {
  background-color: var(--green-dark);
  border-color: var(--green);
  color: var(--white);
  opacity: 1;
}

.card.matched {
  cursor: default;
}

.card.shuffling {
  animation: shuffle-jiggle 0.5s ease-in-out;
  opacity: 0.5;
  transform: scale(0.8);
  pointer-events: none;
  transition:
    transform 0.5s ease-in-out,
    opacity 0.5s ease-in-out;
}

.stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
}

.stat span {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--green);
  line-height: 1.2;
}

.persona-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.persona-img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  margin: 10px 0;
}

.persona-label,
.persona-message {
  display: flex;
  color: var(--white);
  align-items: center;
}

.persona-description {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

@keyframes shuffle-jiggle {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1) rotate(5deg);
  }
  100% {
    transform: scale(1);
  }
}
