/* ========================================
   Barlow Font (local)
   ======================================== */

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Barlow/Barlow-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/Barlow/Barlow-SemiBold.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/Barlow/Barlow-Bold.woff2") format("woff2");
}

/* ========================================
   Reset & Base
   ======================================== */

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

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -ms-touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  font-family: "Barlow", sans-serif;
  background-color: #002c47;
}

/* ========================================
   Game Container
   ======================================== */

.game-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #002c47;
  overflow: hidden;
}

/* Background Image */

.game-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* ========================================
   Timer Display
   ======================================== */

.timer-display {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
  padding: 8px 24px;
  border-radius: 0;
}

.timer-title {
  font-family: "Barlow", sans-serif;
  font-size: clamp(14px, 2vh, 24px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.timer-value {
  font-family: "Barlow", sans-serif;
  font-size: clamp(32px, 5vh, 64px);
  font-weight: 900;
  color: #cad400;
  line-height: 1;
}

.timer-value.warning {
  color: #ef4444;
}

/* ========================================
   Card Grid
   ======================================== */

.card-grid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: grid;
  gap: 12px;
}

/* ========================================
   Card
   ======================================== */

.card {
  position: relative;
  cursor: pointer;
  perspective: 600px;
}

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

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

.card.matched {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  overflow: hidden;
}

/* Card back: blue box with icon */
.card-back {
  background-color: #002c47;
  transform: rotateY(0deg);
}

.card-back img {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* Card front: dark bg with yellow border + icon */
.card-front {
  transform: rotateY(180deg);
  background-color: #002c47;
  position: relative;
}

.card-front-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-icon {
  position: absolute;
  width: 60%;
  height: 60%;
  object-fit: contain;
  z-index: 2;
}

/* ========================================
   CI Buttons (shared design language)
   ======================================== */

.ci-btn {
  display: inline-block;
  padding: 16px 56px;
  background: #cad400;
  color: #002c47;
  font-family: "Barlow", sans-serif;
  font-size: 22px;
  font-weight: 700;
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: opacity 150ms ease;
}

.ci-btn:hover {
  opacity: 0.9;
}

.ci-btn:active {
  opacity: 0.8;
}

/* ========================================
   Overlays (shared start / win / lose)
   ======================================== */

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 44, 71, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fadeIn 300ms ease;
  gap: 16px;
}

.overlay.active {
  display: flex;
}

.overlay-title {
  font-family: "Barlow", sans-serif;
  font-size: 56px;
  font-weight: 900;
  color: #ffffff;
  text-align: center;
  line-height: 1.1;
}

.overlay-subtitle {
  font-family: "Barlow", sans-serif;
  font-size: 22px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  margin-bottom: 16px;
}

/* ========================================
   Loading Indicator
   ======================================== */

.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  z-index: 50;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========================================
   Reduced Motion Support
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .card-inner,
  .overlay,
  .ci-btn {
    transition: none;
    animation: none;
  }
}
