﻿:root {
  --blue-1: #03111f;
  --blue-2: #082846;
  --blue-3: #0b4478;
  --felt-1: #115e97;
  --felt-2: #0a3456;
  --line: rgba(211, 237, 255, 0.35);
  --text: #ecf7ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 700px at 15% 20%, rgba(92, 193, 255, 0.24), transparent 60%),
    radial-gradient(1000px 700px at 80% 80%, rgba(11, 91, 147, 0.3), transparent 62%),
    linear-gradient(155deg, var(--blue-1), var(--blue-2) 55%, #021328);
  overflow-x: hidden;
}

.wallpaper {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(2, 16, 31, 0.58), rgba(2, 16, 31, 0.58)), url("assets/bg/wall.jpg");
  background-size: cover;
  background-position: center;
  filter: saturate(1.08);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1220px, 96vw);
  margin: 14px auto;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(8, 23, 40, 0.75), rgba(8, 23, 40, 0.75)),
    url("assets/bg/table.jpg") center/cover;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.58);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 95, 151, 0.58), rgba(9, 42, 70, 0.58));
}

h1 {
  margin: 0;
  font-size: 1.7rem;
}

.topbar p {
  margin: 2px 0 0;
  opacity: 0.9;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.level-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.level-select {
  border: 1px solid rgba(210, 238, 255, 0.52);
  background: rgba(7, 29, 49, 0.8);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}

.btn {
  border: 1px solid rgba(210, 238, 255, 0.52);
  background: linear-gradient(180deg, #2e8acc, #115b93);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.btn:hover { filter: brightness(1.06); }

.hud {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(7, 29, 49, 0.65);
}

.board {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(206, 235, 255, 0.42);
  background: linear-gradient(180deg, rgba(17, 94, 151, 0.56), rgba(10, 52, 86, 0.62));
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
  gap: 12px;
  perspective: 900px;
}

.card {
  border: 0;
  background: transparent;
  aspect-ratio: 0.9;
  cursor: pointer;
  padding: 0;
}

.card[disabled] {
  cursor: default;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.48s ease;
}

.card.is-flipped .card-inner,
.card.is-matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 1px solid rgba(225, 244, 255, 0.45);
  backface-visibility: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(150deg, #f8fbff, #dbefff);
  display: grid;
  place-items: center;
}

.card-front .symbol {
  width: 72%;
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: clamp(2.1rem, 4.6vw, 3.6rem);
  font-weight: 700;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25) 65%, rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.42), 0 8px 16px rgba(0, 0, 0, 0.18);
  text-shadow: 0 2px 7px rgba(0, 0, 0, 0.38);
}

.pair-0.card-front { background: linear-gradient(135deg, #ffe0dd, #ffbdb5); color: #7d1200; }
.pair-1.card-front { background: linear-gradient(135deg, #fbe8ba, #ffe28a); color: #7f5200; }
.pair-2.card-front { background: linear-gradient(135deg, #dbf3c4, #b8e995); color: #275800; }
.pair-3.card-front { background: linear-gradient(135deg, #d4f2ff, #9de1ff); color: #004d72; }
.pair-4.card-front { background: linear-gradient(135deg, #dfdeff, #b9b6ff); color: #2f2a83; }
.pair-5.card-front { background: linear-gradient(135deg, #f2ddff, #ddb0ff); color: #5d188f; }
.pair-6.card-front { background: linear-gradient(135deg, #ffe8d3, #ffc89a); color: #7e3c00; }
.pair-7.card-front { background: linear-gradient(135deg, #d9ffef, #a5f2d2); color: #00593b; }
.pair-8.card-front { background: linear-gradient(135deg, #f0dcff, #d4a8ff); color: #4f0e7b; }
.pair-9.card-front { background: linear-gradient(135deg, #d8edff, #afdbff); color: #003a69; }

.card.is-flipped {
  transform: translateY(-2px);
}

.card-back {
  background-image: url("assets/cards/back_logo.png");
  background-color: #f8f8f8;
}

.card.is-matched {
  filter: drop-shadow(0 0 10px rgba(118, 208, 255, 0.75));
}

.message {
  margin: 12px 0 4px;
  font-size: 0.95rem;
  opacity: 0.92;
}

@media (max-width: 700px) {
  .board {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 9px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-controls {
    width: 100%;
  }
}
