.memory-match-experience {
  background:linear-gradient(180deg, #0b1124 0%, #0c101a 100%);
}

.memory-match-main {
  max-width:1200px;
  margin:0 auto;
  padding:40px 24px 90px;
  display:flex;
  flex-direction:column;
  gap:26px;
  position:relative;
}

.memory-match-toplink {
  position:absolute;
  top:22px;
  right:24px;
}

.memory-match-back {
  color:#8cd0ff;
  text-decoration:none;
  font-weight:700;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.12em;
}

.memory-match-back:hover,
.memory-match-back:focus-visible {
  text-decoration:underline;
}

.memory-match-hero h1 {
  margin-bottom:8px;
}

.memory-match-hero p {
  margin:0;
  color:#c8d0f0;
  max-width:680px;
  line-height:1.6;
}

.memory-match-settings,
.memory-match-game {
  background:#101827;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.08);
  padding:24px;
  display:flex;
  flex-direction:column;
  gap:18px;
}

.memory-match-settings h2 {
  margin:0;
  font-size:20px;
}

.memory-match-settings-grid {
  display:grid;
  gap:16px;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
}

.memory-match-field {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.memory-match-label {
  font-weight:700;
  color:#f5f6fb;
}

.memory-match-helper {
  margin:0;
  color:#aeb3c7;
  font-size:13px;
}

.memory-match-toggle {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.memory-match-toggle-btn {
  border:1px solid rgba(255,255,255,.12);
  background:#141a30;
  color:#f5f6fb;
  padding:8px 16px;
  border-radius:999px;
  font-weight:700;
}

.memory-match-toggle-btn.is-active {
  background:#2f6cff;
  border-color:rgba(95,161,255,.9);
  color:#0b1124;
}

.memory-match-select {
  background:#111624;
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  color:#f5f6fb;
  padding:6px 10px;
}

.memory-match-select:focus-visible {
  outline:2px solid rgba(95,161,255,.8);
}

.memory-match-issuer-list {
  display:grid;
  gap:10px;
  grid-template-columns:repeat(auto-fit, minmax(160px, 1fr));
}

.memory-match-issuer {
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  background:#141a30;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.06);
  font-weight:600;
}

.memory-match-issuer input {
  accent-color:#2f6cff;
}

.memory-match-actions {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.memory-match-message {
  margin:0;
  min-height:22px;
  color:#ffd659;
  font-weight:700;
}

.memory-match-issuer-field.is-hidden {
  display:none;
}

.memory-match-header {
  display:flex;
  flex-direction:column;
  gap:14px;
  align-items:flex-start;
}

.memory-match-subtitle {
  margin:6px 0 0;
  color:#9aa3c4;
  font-size:13px;
}

.memory-match-stats {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));
  gap:14px;
}

.memory-match-stat {
  background:#141a30;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.06);
  padding:12px 14px;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.memory-match-stat-label {
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.memory-match-controls {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}

.memory-match-grid {
  display:grid;
  gap:4px;
  grid-template-columns:repeat(var(--columns, 4), minmax(20px, 1fr));
  width:100%;
  max-width:600px;
  margin:0 auto;
}

.memory-match-tile {
  border:none;
  background:transparent;
  padding:0;
  perspective:900px;
  width:100%;
  cursor:pointer;
}

.memory-match-tile-inner {
  display:block;
  position:relative;
  width:100%;
  aspect-ratio:1 / 1;
  transform-style:preserve-3d;
  transition:transform .45s ease;
}

.memory-match-tile-face {
  position:absolute;
  inset:0;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:12px;
  backface-visibility:hidden;
  border:1px solid rgba(255,255,255,.08);
}

.memory-match-tile-front {
  background:linear-gradient(135deg, #151d33 0%, #0e1527 100%);
  color:#8cd0ff;
  letter-spacing:.2em;
}

.memory-match-tile-back {
  background:#1b2540;
  color:#f5f6fb;
  transform:rotateY(180deg);
}

.memory-match-tile.is-flipped .memory-match-tile-inner {
  transform:rotateY(180deg);
}

.memory-match-tile.is-matched .memory-match-tile-face {
  filter:grayscale(.2) brightness(.82);
  border-color:rgba(148,155,175,.6);
}

.memory-match-tile.is-matched .memory-match-tile-back::after {
  content:"✓";
  position:absolute;
  bottom:6px;
  right:8px;
  font-size:10px;
  color:#9aa3c4;
}

.memory-match-tile.is-matched .memory-match-tile-back {
  background:#2a2f3c;
  color:#c5c9d9;
}

.memory-match-tile.is-match-flash .memory-match-tile-inner {
  border-radius:12px;
  box-shadow:0 0 0 2px rgba(255,214,89,.9), 0 0 14px rgba(255,214,89,.8);
  animation:memory-match-flash .6s ease-in-out;
}

.memory-match-modal {
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(6,10,20,.72);
  opacity:0;
  pointer-events:none;
  transition:opacity .3s ease;
  padding:24px;
}

.memory-match-modal.is-visible {
  opacity:1;
  pointer-events:auto;
}

.memory-match-modal-content {
  background:#101827;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.1);
  padding:24px;
  max-width:420px;
  width:100%;
  display:flex;
  flex-direction:column;
  gap:16px;
  text-align:center;
}

.memory-match-modal-actions {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.memory-match-confetti {
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:0;
}

.memory-match-confetti.is-active {
  opacity:1;
}

.memory-match-confetti-piece {
  position:absolute;
  top:-10px;
  width:10px;
  height:14px;
  background:linear-gradient(180deg, #8cd0ff 0%, #ffd659 100%);
  animation:memory-match-fall 1.4s ease-in forwards;
}

@keyframes memory-match-fall {
  0% {
    transform:translateY(-10px) rotate(0deg);
    opacity:1;
  }
  100% {
    transform:translateY(120vh) rotate(180deg);
    opacity:0;
  }
}

@keyframes memory-match-flash {
  0% {
    box-shadow:0 0 0 0 rgba(255,214,89,.95), 0 0 0 rgba(255,214,89,0);
  }
  55% {
    box-shadow:0 0 0 2px rgba(255,214,89,.95), 0 0 16px rgba(255,214,89,.9);
  }
  100% {
    box-shadow:0 0 0 0 rgba(255,214,89,.4), 0 0 0 rgba(255,214,89,0);
  }
}

@media (min-width:900px) {
  .memory-match-header {
    flex-direction:row;
    align-items:center;
    justify-content:space-between;
  }
  .memory-match-controls {
    justify-content:flex-start;
  }
  .memory-match-modal-actions {
    flex-direction:row;
    justify-content:center;
  }
}

@media (max-width:700px) {
  .memory-match-grid {
    grid-template-columns:repeat(auto-fit, minmax(32px, 1fr));
  }
  .memory-match-tile-face {
    font-size:10px;
  }
}

body.light .memory-match-experience {
  background:#f4f6fb;
}

body.light .memory-match-hero p {
  color:#4b526b;
}

body.light .memory-match-settings,
body.light .memory-match-game {
  background:#ffffff;
  border-color:rgba(0,0,0,.08);
}

body.light .memory-match-toggle-btn {
  background:#f1f3fb;
  border-color:rgba(0,0,0,.08);
  color:#1d2030;
}

body.light .memory-match-toggle-btn.is-active {
  color:#08111f;
}

body.light .memory-match-select {
  background:#ffffff;
  border-color:rgba(0,0,0,.12);
  color:#1d2030;
}

body.light .memory-match-issuer,
body.light .memory-match-stat {
  background:#f6f7fb;
  border-color:rgba(0,0,0,.08);
}

body.light .memory-match-tile-back {
  background:#ffffff;
  color:#1d2030;
}

body.light .memory-match-tile-front {
  color:#2f6cff;
}

body.light .memory-match-tile.is-matched .memory-match-tile-back {
  background:#e3e6ef;
  color:#5c647a;
}

body.light .memory-match-message {
  color:#946200;
}

body.light .memory-match-modal-content {
  background:#ffffff;
  border-color:rgba(0,0,0,.08);
}
