/* =====================================================================
   NaijaRelief — Memory Match game skin
   Mounts inside .nr-game-mount inside the launcher modal.
   Design: Deep purple / gold — consistent with NaijaRelief brand.
   ===================================================================== */

/* ── Wrapper ────────────────────────────────────────────────── */
.tm-wrap {
  font-family: 'Sora', sans-serif;
  color: #F6EFE0;
  width: 100%;
  box-sizing: border-box;
}

/* ── Screens ────────────────────────────────────────────────── */
.tm-screen {
  display: none;
  padding: 4px 0 8px;
  animation: tmFadeUp .22s ease both;
}
.tm-screen.is-active { display: block; }

@keyframes tmFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Token screen (standalone only) ────────────────────────── */
.tm-token-screen {
  padding: 24px 0 8px;
  text-align: center;
}
.tm-token-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  color: #F6EFE0;
  margin: 0 0 6px;
}
.tm-token-hint {
  font-size: 12.5px;
  color: rgba(246,239,224,0.65);
  margin: 0 0 18px;
  line-height: 1.5;
}
.tm-token-input {
  width: 100%;
  background: rgba(8,2,26,0.5);
  border: 1.5px solid rgba(245,166,35,0.2);
  border-radius: 12px;
  padding: 13px 16px;
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  color: #F6EFE0;
  text-align: center;
  box-sizing: border-box;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .2s ease;
}
.tm-token-input:focus { border-color: rgba(245,166,35,0.5); }
.tm-token-input::placeholder { color: rgba(246,239,224,0.28); }
.tm-token-error {
  font-size: 12px;
  color: #F9A8A8;
  background: rgba(193,80,46,0.15);
  border: 1px solid rgba(193,80,46,0.3);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  display: none;
}

/* ── Shared button ──────────────────────────────────────────── */
.tm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 14px;
  padding: 13px 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  width: 100%;
  box-sizing: border-box;
}
.tm-btn:hover { transform: translateY(-1px); }
.tm-btn:active { transform: translateY(0); }

.tm-btn--gold {
  background: linear-gradient(180deg, #FFD680, #F5A623);
  color: #08021A;
  box-shadow: 0 8px 22px -8px rgba(245,166,35,0.5);
}
.tm-btn--ghost {
  background: transparent;
  color: #F6EFE0;
  border: 1.5px solid rgba(245,166,35,0.2);
}

/* ── Get ready countdown screen ─────────────────────────────── */
.tm-ready-screen {
  text-align: center;
  padding: 32px 0 24px;
}
.tm-ready-countdown {
  font-family: 'Fraunces', serif;
  font-size: 72px;
  font-weight: 700;
  color: #F5A623;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 24px rgba(245,166,35,0.5));
  animation: tmPulse 1s ease infinite;
}
@keyframes tmPulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
.tm-ready-subtitle {
  font-size: 13px;
  color: rgba(246,239,224,0.6);
  margin-bottom: 20px;
}
.tm-ready-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tm-tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245,166,35,0.25);
  background: rgba(245,166,35,0.1);
  color: #F5A623;
}

/* ── HUD ────────────────────────────────────────────────────── */
.tm-game-screen { padding-bottom: 8px; }

.tm-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.tm-hud-cell {
  background: rgba(8,2,26,0.45);
  border: 1px solid rgba(245,166,35,0.15);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
}
.tm-hud-cell__lbl {
  font-size: 8px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(246,239,224,0.45);
  display: block;
  margin-bottom: 3px;
}
.tm-hud-cell__val {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 600;
  color: #FFD680;
  line-height: 1;
}

/* ── Progress bar ───────────────────────────────────────────── */
.tm-progress-wrap {
  margin-bottom: 10px;
  background: rgba(8,2,26,0.45);
  border: 1px solid rgba(245,166,35,0.15);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tm-progress-label {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(246,239,224,0.4);
  white-space: nowrap;
  flex: none;
}
.tm-progress-track {
  flex: 1;
  height: 5px;
  background: rgba(246,239,224,0.1);
  border-radius: 99px;
  overflow: hidden;
}
.tm-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F5A623, #FFD680);
  border-radius: 99px;
  transition: width .35s ease;
  width: 0%;
}
.tm-progress-level {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #F5A623;
  white-space: nowrap;
  flex: none;
}

/* ── Card board ─────────────────────────────────────────────── */
.tm-board {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}
.tm-board--3col { grid-template-columns: repeat(3, 1fr); }
.tm-board--4col { grid-template-columns: repeat(4, 1fr); }
.tm-board--5col { grid-template-columns: repeat(5, 1fr); }

/* ── Card ───────────────────────────────────────────────────── */
.tm-card {
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: pointer;
  perspective: 600px;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.tm-card:focus-visible .tm-card-inner {
  box-shadow: 0 0 0 2px #F5A623;
}

.tm-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .38s cubic-bezier(.4,0,.2,1);
  border-radius: 12px;
}
.tm-card.tm-flipped .tm-card-inner,
.tm-card.tm-matched .tm-card-inner {
  transform: rotateY(180deg);
}

.tm-card-back,
.tm-card-front {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

/* Card back — dark indigo with NR watermark */
.tm-card-back {
  background: linear-gradient(145deg, #1B2849 0%, #0E1A35 100%);
  border: 1.5px solid rgba(245,166,35,0.2);
}
.tm-card-back::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(245,166,35,0.07) 1px, transparent 1.5px);
  background-size: 10px 10px;
}
.tm-card-back svg {
  width: 36%;
  height: 36%;
  color: rgba(245,166,35,0.4);
  position: relative;
  z-index: 1;
}

/* Card front — ivory/cream with icon */
.tm-card-front {
  background: linear-gradient(145deg, #F0E8D5, #F6EFE0);
  border: 1.5px solid rgba(245,166,35,0.45);
  transform: rotateY(180deg);
}
.tm-card-front svg {
  width: 42%;
  height: 42%;
  color: #2D0A6B;
}
.tm-card-front .tm-card-label {
  font-family: 'Sora', sans-serif;
  font-size: 8px;
  font-weight: 600;
  color: #2D0A6B;
  text-align: center;
  letter-spacing: 0.5px;
  line-height: 1.2;
  padding: 0 4px;
}
.tm-card-image {
  width: 62%;
  height: 62%;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 4px;
  pointer-events: none;
}

/* Matched state */
.tm-card.tm-matched .tm-card-front {
  background: linear-gradient(145deg, #D4F0D4, #B8EABB);
  border-color: rgba(34,197,94,0.5);
}
.tm-card.tm-matched .tm-card-front svg { color: #15803d; }

/* ── Level complete screen ──────────────────────────────────── */
.tm-level-complete-screen {
  text-align: center;
  padding: 32px 0 24px;
}
.tm-level-complete-screen .tm-check {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 12px;
  animation: tmBounce .4s ease both;
}
@keyframes tmBounce {
  0%   { transform: scale(.5); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.tm-level-complete-screen .tm-level-title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  color: #F6EFE0;
  margin: 0 0 6px;
}
.tm-level-complete-screen .tm-level-score {
  font-family: 'Fraunces', serif;
  font-size: 36px;
  font-weight: 600;
  color: #F5A623;
  margin: 10px 0 4px;
  filter: drop-shadow(0 0 16px rgba(245,166,35,0.4));
}
.tm-level-complete-screen .tm-level-sub {
  font-size: 12px;
  color: rgba(246,239,224,0.5);
}

/* ── Result screen (standalone mode) ───────────────────────── */
.tm-result-screen {
  text-align: center;
  padding: 24px 0 16px;
}
.tm-result-trophy {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 10px;
}
.tm-result-title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  color: #F6EFE0;
  margin: 0 0 16px;
}
.tm-result-score-val {
  font-family: 'Fraunces', serif;
  font-size: 48px;
  font-weight: 600;
  color: #F5A623;
  display: block;
  filter: drop-shadow(0 0 20px rgba(245,166,35,0.45));
}
.tm-result-score-lbl {
  font-size: 9.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(246,239,224,0.45);
  display: block;
  margin: 6px 0 20px;
}
.tm-result-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ── Error screen ───────────────────────────────────────────── */
.tm-error-screen {
  text-align: center;
  padding: 24px 0;
}
.tm-error-screen p {
  font-size: 13px;
  color: #F9A8A8;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 380px) {
  .tm-board { gap: 5px; }
  .tm-card-back svg { width: 32%; height: 32%; }
  .tm-hud { gap: 4px; }
  .tm-hud-cell__val { font-size: 15px; }
  .tm-board--5col { grid-template-columns: repeat(4, 1fr); }
}
