/* Memorija – snoopywap.com (prefiks mem-) */
.mem-omot {
  box-sizing: border-box;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
  font-family: var(--sans);
  color: var(--tekst);
}
.mem-omot *, .mem-omot *::before, .mem-omot *::after { box-sizing: border-box; }

/* izbor veličine */
.mem-velicine {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.mem-vel {
  flex: 1 1 0;
  min-height: 46px;
  padding: 0 8px;
  background: transparent;
  color: var(--tekst);
  border: 2px solid var(--ivica);
  border-radius: 12px;
  font: 700 17px var(--mono);
  cursor: pointer;
}
.mem-vel.mem-izabrana {
  background: var(--akcent3);
  border-color: var(--akcent3);
  color: var(--na-akcentu);
}

/* brojači */
.mem-traka {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.mem-brojka {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  background: var(--kartica);
  border: 2px solid var(--ivica);
  border-radius: 12px;
}
.mem-natpis { font-size: 15px; color: var(--slabo); line-height: 1.2; }
.mem-vrednost {
  font: 700 20px/1.3 var(--mono);
  color: var(--akcent-t);
  white-space: nowrap;
}
.mem-vrednost.mem-najbolji { color: var(--zuta-t); font-size: 17px; line-height: 26px; }

/* tabla: na telefonu uvek 4 kolone (6×4 postaje 4×6) */
.mem-tabla {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  background: var(--kartica);
  border: 2px solid var(--ivica);
  border-radius: var(--radius);
  touch-action: manipulation;
}
@media (min-width: 560px) {
  .mem-tabla-6x4 { grid-template-columns: repeat(6, 1fr); }
  .mem-tabla-6x4 .mem-lice { font-size: 32px; }
}

.mem-karta {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 600px;
  -webkit-tap-highlight-color: transparent;
}
.mem-unutra {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .35s ease;
}
.mem-otvorena .mem-unutra { transform: rotateY(180deg); }
.mem-lice {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-size: 38px;
  line-height: 1;
}
.mem-pozadi {
  background: var(--kartica2);
  border: 2px solid var(--ivica);
  color: var(--akcent2-t);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 30px;
}
.mem-napred {
  background: var(--bg);
  border: 2px solid var(--akcent3);
  transform: rotateY(180deg);
}
.mem-par .mem-napred {
  border-color: var(--akcent);
  animation: mem-pogodak .45s ease;
}
.mem-par { cursor: default; }
@keyframes mem-pogodak {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.1); }
  100% { transform: rotateY(180deg) scale(1); }
}
.mem-karta:focus-visible .mem-lice, .mem-vel:focus-visible, .mem-dugme:focus-visible {
  outline: 3px solid var(--zuta);
  outline-offset: 1px;
}
.mem-karta:focus { outline: none; }

.mem-poruka {
  min-height: 46px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  line-height: 1.35;
  color: var(--slabo);
}
.mem-poruka.mem-bravo { color: var(--akcent-t); font-weight: 700; }

.mem-dugme {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid var(--akcent);
  border-radius: 12px;
  background: var(--akcent);
  color: var(--na-akcentu);
  font: 700 16px var(--sans);
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .mem-unutra { transition: none; }
  .mem-par .mem-napred { animation: none; }
}
