/* Styles CSS for Icon-Matching.html */

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

body {
  height: 100vh;
  display: flex;
  background: #efefef;
  font-family: Arial, Helvetica, sans-serif;
}
/* Top Bar */
.gameTop {
  width: 95%;
  max-width: 1400px;
  margin: 1rem auto 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.gameStatus {
  display: flex;
  gap: 18px;
  align-items: center;
  color: #333;
}

.gameStatus .timer,
.gameStatus .turns {
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  font-weight: 600;
  font-size: 14px;
}

/* Game Area */
.gameWrap {
  width: 95%;
  max-width: 1400px;
  margin: 2rem auto;
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  align-items: stretch;
}
.gameWrap.withSidebar {
  grid-template-columns: 1fr 320px;
  align-items: stretch;
}
.gameWrap.shrinking .cardInnerScale {
  transform: scale(.95);
}

.memoryGame {
  --cols: 2; 
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr); 
  gap: 10px;
  min-height: 320px;
  min-width: 0;
  perspective: 1000px;
}
.solvedPairs {
  width: 100%;
  border: 2px solid #ccc;
  border-radius: 10px;
  background: #fafafa;
  align-self: stretch;
  box-sizing: border-box;
  min-width: 0;
}

@media (min-width: 480px) {
  .memoryGame {
    --cols: 3; 
  }
}
@media (min-width: 600px) {
  .memoryGame {
    --cols: 4; 
  }
}
@media (max-width: 799px) {
  .solvedPairs {
    margin-top: 8px
  }
}
@media (min-width: 800px) {
  .memoryGame {
    --cols: 6; 
  }
}
@media (min-width: 2500px) {
    .memoryGame { 
      --cols: 8; 
    }
}

.memoryCard {
  aspect-ratio: 1 / 1; 
  width: 100%;
  height: 100%;
  margin: 0;
  position: relative;
  background: #54aaf0;
  border-radius: 3%;
  box-shadow: 1px 1px 1px rgba(0,0,0,.3);
  overflow: hidden;
  min-width: 0;
}
.memoryCard:active {
   transform: scale(0.97);
   transition: transform .2s;
 }
.memoryCard:hover {
  cursor: pointer;
  box-shadow: 2px 2px 5px rgba(0,0,0,.4);
  transition: box-shadow .2s;
}

.cardInnerScale {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform .18s ease;
  transform-origin: center center;
  will-change: transform;
}
.cardInnerFlip {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.2,.9,.2,1); 
}
.memoryCard.flip .cardInnerFlip {
  transform: rotateY(180deg);
}
.memoryCard.solvedCard {
  pointer-events: none;
  transform: scale(0.8);
  transition: transform .3s;
  filter: grayscale(100%);
}


.front-face,
.back-face {
  width: 100%;
  height: 100%;
  padding: 6%;
  position: absolute;
  backface-visibility: hidden;
}
.front-face {
  transform: rotateY(180deg);
}
.front-icon, .back-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.front-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8%;
  text-align: center;
  font-weight: 700;
  font-size: clamp(12px, 2.2vw, 18px);
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: none;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  white-space: normal;
  line-height: 1.05;
  word-spacing: 0.05em;
}


/* Solved List */
.solvedPairs h3 {
  margin: 8px 0;
  font-size: 14px;
  padding-left: 8px;
}

.solvedList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 12px;
  align-items: start;
}

/* solved icon thumbnail */
.solvedList .solvedIcon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  min-height: 100px;
  overflow: hidden;
  position: relative;
}
.solvedList .solvedIcon img {
  width: 60%;
  height: auto;
  max-height: 60%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.solvedList .solvedIcon .solvedName {
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 700;
  color: #222;
  line-height: 1.1;
  text-align: center;
  width: 100%;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  white-space: normal;
  line-height: 1.1;
  margin-top: 2px;
}
.solvedPairs {
  z-index: 2;
}
/* Button Styles */
.printBtn {
  appearance: none;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  color: #222;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  margin-right: 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.printBtn:hover { filter: brightness(.98); }
.printBtn.hidden {
  display: none !important;
}
.print-root {
  display: none;
}
@media print {
  /* hide everything by removing it from layout */
  body * { display: none !important; }

  /* show only the print root and its children */
  .print-root { 
    display: block !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    padding: 12px !important;
    background: #fff !important;
  }
  .print-root * { display: block !important; }

  .print-root .print-header h1 { margin: 0 0 8px; font-size: 18px; }
  .print-root .print-header .print-meta { margin-bottom: 12px; font-weight: 700; }

  .print-root .print-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 12px !important;
  }
  .print-root .solvedIcon { 
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 10px !important;
    border-radius: 6px !important;
    background: #fff !important;
    border: 1px solid #e6e6e6 !important;
  }
  .print-root .solvedIcon img {
    width: 48px !important;
    height: 48px !important;
    object-fit: contain !important;
    filter: none !important;
    margin-bottom: 8px !important;
  }
  .print-root .solvedName { font-size: 12px !important; font-weight: 700 !important; text-align: center !important; }

  /* hide UI controls that shouldn't print */
  .printBtn, .no-print { display: none !important; }
}