:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f8fbff;
  background: #040712;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 12%, rgba(0, 218, 255, .16), transparent 28rem),
    radial-gradient(circle at 85% 8%, rgba(184, 53, 255, .19), transparent 30rem),
    linear-gradient(155deg, #050916 0%, #090d1c 56%, #040611 100%);
}

button { font: inherit; }
.game-shell { width: min(1080px, 100%); max-width: 100vw; margin: 0 auto; padding: clamp(14px, 2.6vw, 30px); overflow: hidden; }
.game-header, .score-strip, footer, .keyboard-note { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-lockup img { width: 53px; height: 53px; flex: 0 0 53px; object-fit: contain; filter: drop-shadow(0 0 18px rgba(93, 217, 255, .26)); }
.brand-lockup h1 { margin: -2px 0 0; font-size: clamp(1.3rem, 4vw, 2rem); letter-spacing: .12em; font-style: italic; }
.eyebrow, .panel-tag { color: #75edff; font-size: .67rem; font-weight: 900; letter-spacing: .2em; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.status-label { position:relative; padding:8px 12px 8px 25px; border:1px solid rgba(125,236,255,.2); border-radius:999px; color:#a9f7ff; background:rgba(8,21,40,.72); font-size:.62rem; font-weight:900; letter-spacing:.12em; }
.status-label::before { content:""; position:absolute; left:10px; top:50%; width:7px; height:7px; border-radius:50%; background:#68f0cf; box-shadow:0 0 9px #68f0cf; transform:translateY(-50%); animation:signalBlink 1.6s ease-in-out infinite alternate; }
.icon-button, .primary-button {
  border: 1px solid rgba(112, 224, 255, .4); border-radius: 10px; color: #f8fbff;
  background: rgba(13, 19, 39, .9); font-size: .75rem; font-weight: 900; letter-spacing: .08em; cursor: pointer;
}
.icon-button { padding: 10px 13px; }
.icon-button[aria-pressed="false"] { color: #8791a6; border-color: rgba(137, 146, 167, .25); }
.icon-button:focus-visible, .primary-button:focus-visible, .memory-card:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.score-strip {
  margin: 20px 0 12px; padding: 12px clamp(10px, 3vw, 28px);
  border: 1px solid rgba(130, 235, 255, .17); border-radius: 14px;
  background: rgba(7, 12, 28, .8); box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.score-strip div { display: grid; flex: 1 1 0; min-width: 68px; text-align: center; }
.score-strip span { color: #8791a8; font-size: .61rem; font-weight: 800; letter-spacing: .13em; }
.score-strip strong { margin-top: 2px; font-size: clamp(1.1rem, 4vw, 1.75rem); font-variant-numeric: tabular-nums; }
.score-strip strong span { color: inherit; font: inherit; letter-spacing: 0; }

.board-wrap {
  position: relative; min-height: 610px; padding: clamp(18px, 4vw, 42px);
  overflow: hidden; border: 1px solid rgba(84, 218, 255, .3); border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 115%, rgba(70, 113, 255, .2), transparent 48%),
    linear-gradient(150deg, rgba(5, 9, 28, .98), rgba(8, 14, 34, .95));
  box-shadow: 0 24px 80px rgba(0,0,0,.48), 0 0 44px rgba(0,205,255,.06), inset 0 0 0 1px rgba(255,255,255,.025);
}
.board-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .38;
  background-image: linear-gradient(rgba(103, 221, 255, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(103, 221, 255, .055) 1px, transparent 1px);
  background-size: 54px 54px;
}
.board-wrap::after { content: ""; position: absolute; inset: auto 5% 3%; height: 26%; border: 1px solid rgba(90, 218, 255, .13); border-radius: 50%; background: radial-gradient(ellipse, rgba(56, 88, 196, .12), transparent 67%); transform: perspective(300px) rotateX(67deg); pointer-events: none; }
.board-glow { position: absolute; inset: 13% 14%; border: 1px solid rgba(94, 225, 255, .08); border-radius: 50%; background: radial-gradient(circle, rgba(92, 73, 255, .19), transparent 65%); box-shadow: inset 0 0 80px rgba(63, 213, 255, .06); pointer-events: none; animation: breathe 4s ease-in-out infinite alternate; }
.signal-canopy { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 14px; max-width: 840px; height: 29px; margin: -11px auto 15px; color: rgba(119, 232, 255, .58); font-size: .52rem; font-weight: 900; letter-spacing: .2em; }
.signal-canopy::before, .signal-canopy::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(95, 229, 255, .4)); }
.signal-canopy::after { transform: scaleX(-1); }
.signal-canopy i { width: 5px; height: 5px; border-radius: 50%; background: #66eaff; box-shadow: 0 0 10px #66eaff; animation: signalBlink 1.6s ease-in-out infinite alternate; }
.signal-canopy i:nth-child(2) { animation-delay: -.4s; }.signal-canopy i:nth-child(3) { animation-delay: -.8s; }.signal-canopy i:nth-child(4) { animation-delay: -1.2s; }
.card-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(10px, 2vw, 17px); max-width: 840px; margin: 0 auto; perspective: 1200px; }
.memory-card {
  position: relative; min-width: 0; aspect-ratio: 1.24 / 1; padding: 0; border: 0; border-radius: 15px;
  color: #f9fdff; background: transparent; cursor: pointer; perspective: 900px; touch-action: manipulation;
}
.card-inner { position: absolute; inset: 0; border-radius: inherit; transform-style: preserve-3d; transition: transform .36s cubic-bezier(.2,.75,.25,1); }
.memory-card.is-revealed .card-inner, .memory-card.is-matched .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
}
.card-back {
  border: 1px solid rgba(107, 232, 255, .3);
  background:
    linear-gradient(135deg, transparent 19%, rgba(106, 235, 255, .06) 20% 21%, transparent 22% 78%, rgba(176, 78, 255, .07) 79% 80%, transparent 81%),
    radial-gradient(circle at 50% 45%, rgba(45, 102, 190, .32), transparent 49%),
    linear-gradient(145deg, rgba(24, 37, 76, .98), rgba(8, 13, 34, .99));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -18px 30px rgba(1,4,15,.35), 0 13px 28px rgba(0,0,0,.28);
}
.card-back::before { content: "W"; display: grid; place-items: center; width: 43%; aspect-ratio: 1; border: 1px solid rgba(116, 239, 255, .58); border-radius: 50%; color: #b8f9ff; background: radial-gradient(circle at 40% 32%, rgba(107, 231, 255, .18), rgba(12, 22, 53, .86) 68%); box-shadow: 0 0 0 5px rgba(111, 76, 255, .08), 0 0 24px rgba(92, 218, 255, .26), inset 0 0 13px rgba(99, 226, 255, .16); font-family: Georgia, serif; font-size: clamp(1.1rem, 4vw, 2rem); font-weight: 900; font-style: italic; }
.card-back::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(176, 74, 255, .13); border-radius: 11px; clip-path: polygon(0 0, 34% 0, 34% 2px, 2px 2px, 2px 31%, 0 31%, 0 100%, 66% 100%, 66% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 69%, 100% 69%, 100% 0); }
.card-front {
  align-content: center; gap: 8px; transform: rotateY(180deg); border: 1px solid color-mix(in srgb, var(--card-colour) 62%, transparent);
  background: radial-gradient(circle at 50% 25%, color-mix(in srgb, var(--card-colour) 25%, transparent), transparent 60%), #0a1024;
  box-shadow: inset 0 0 25px color-mix(in srgb, var(--card-colour) 12%, transparent);
}
.card-symbol { position: relative; display: block; width: clamp(42px, 7vw, 68px); aspect-ratio: 1; color: var(--card-colour); filter: drop-shadow(0 0 9px color-mix(in srgb, var(--card-colour) 75%, transparent)); }
.card-symbol i { position: absolute; display: block; }
.symbol-beacon { border: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 14px currentColor; }
.symbol-beacon::before, .symbol-beacon::after { content: ""; position: absolute; inset: 21%; border: 2px solid currentColor; border-radius: 50%; }.symbol-beacon::after { inset: 40%; background: currentColor; box-shadow: 0 0 14px currentColor; }
.symbol-beacon i { left: 48%; bottom: 4%; width: 4%; height: 38%; background: currentColor; transform-origin: 50% 100%; opacity: .55; }
.symbol-beacon i:nth-child(1) { transform: rotate(-36deg); opacity: .2; }.symbol-beacon i:nth-child(2) { transform: rotate(-18deg); opacity: .36; }.symbol-beacon i:nth-child(3) { transform: rotate(0); opacity: .52; }.symbol-beacon i:nth-child(4) { transform: rotate(18deg); opacity: .68; }.symbol-beacon i:nth-child(5) { transform: rotate(36deg); opacity: .84; }
.symbol-spark { border: 2px solid currentColor; border-radius: 13px; background: repeating-linear-gradient(90deg, transparent 0 12%, currentColor 13% 17%, transparent 18% 27%); }
.symbol-spark::before { content: ""; position: absolute; inset: 21% 17%; border: 1px solid currentColor; border-radius: 5px; background: rgba(6,12,29,.8); }.symbol-spark::after { content: ""; position: absolute; left: 43%; top: 34%; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent currentColor; }
.symbol-spark i { width: 2px; background: currentColor; transform: rotate(45deg); opacity: .65; }.symbol-spark i:nth-child(1){right:-4px;top:-5px;height:5px}.symbol-spark i:nth-child(2){right:1px;top:-2px;height:7px}.symbol-spark i:nth-child(3){right:6px;top:1px;height:9px}.symbol-spark i:nth-child(4){right:11px;top:4px;height:11px}.symbol-spark i:nth-child(5){right:16px;top:7px;height:13px}
.symbol-portal { border: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 19px currentColor; }.symbol-portal::before { content: ""; position: absolute; inset: 13%; border: 2px dashed currentColor; border-radius: 50%; animation: portalSpin 4s linear infinite; }.symbol-portal::after { content: "W"; position: absolute; inset: 31%; display: grid; place-items: center; border-radius: 50%; color: #fff; background: color-mix(in srgb, currentColor 45%, #070d22); font: italic 900 clamp(.65rem, 2vw, 1rem) Georgia,serif; }.symbol-portal i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }.symbol-portal i:nth-child(1){left:8%;top:35%}.symbol-portal i:nth-child(2){left:26%;top:42%}.symbol-portal i:nth-child(3){left:44%;top:49%}.symbol-portal i:nth-child(4){left:62%;top:56%}.symbol-portal i:nth-child(5){left:80%;top:63%}
.symbol-pulse::before { content: ""; position: absolute; inset: 9% 4% 24%; border: 2px solid currentColor; border-radius: 16px; background: color-mix(in srgb, currentColor 12%, #071024); }.symbol-pulse::after { content: ""; position: absolute; left: 19%; bottom: 11%; width: 17%; height: 19%; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: skewY(-36deg); }.symbol-pulse i { top: 39%; width: 8%; border-radius: 3px; background: currentColor; }.symbol-pulse i:nth-child(1){left:17%;height:8%;transform:translateY(6px)}.symbol-pulse i:nth-child(2){left:31%;height:11%;transform:translateY(3px)}.symbol-pulse i:nth-child(3){left:45%;height:14%}.symbol-pulse i:nth-child(4){left:59%;height:17%;transform:translateY(-3px)}.symbol-pulse i:nth-child(5){left:73%;height:20%;transform:translateY(-6px)}
.symbol-wave { border: 2px solid currentColor; border-radius: 12px; background: rgba(5,11,29,.7); }.symbol-wave::before, .symbol-wave::after { content: ""; position: absolute; top: 15%; bottom: 15%; width: 3px; background: currentColor; box-shadow: 0 0 9px currentColor; }.symbol-wave::before { left: 12%; }.symbol-wave::after { right: 12%; }.symbol-wave i { bottom: 18%; width: 7%; border-radius: 4px; background: currentColor; }.symbol-wave i:nth-child(1){left:23%;height:18%}.symbol-wave i:nth-child(2){left:35%;height:34%}.symbol-wave i:nth-child(3){left:47%;height:50%}.symbol-wave i:nth-child(4){left:59%;height:34%}.symbol-wave i:nth-child(5){left:71%;height:18%}
.symbol-signal::before { content: ""; position: absolute; left: 14%; right: 14%; top: 48%; height: 3px; background: currentColor; box-shadow: 0 -16px 0 color-mix(in srgb,currentColor 55%,transparent), 0 16px 0 color-mix(in srgb,currentColor 55%,transparent); }.symbol-signal i { width: 15%; aspect-ratio: 1; border: 2px solid currentColor; border-radius: 50%; background: #091126; box-shadow: 0 0 9px currentColor; }.symbol-signal i:nth-child(1){left:7%;top:22%}.symbol-signal i:nth-child(2){left:27%;top:62%}.symbol-signal i:nth-child(3){left:47%;top:22%}.symbol-signal i:nth-child(4){left:67%;top:62%}.symbol-signal i:nth-child(5){left:82%;top:22%}
.card-name { color: #dce8f7; font-size: clamp(.58rem, 1.6vw, .8rem); font-weight: 900; letter-spacing: .11em; }
.memory-card.is-matched { pointer-events: none; }
.memory-card.is-matched .card-front { border-color: #7df2d7; box-shadow: inset 0 0 28px rgba(74, 239, 207, .21), 0 0 18px rgba(74, 239, 207, .15); }
.memory-card.is-matched .card-front::after { content: "MATCH"; position: absolute; top: 7px; right: 8px; color: #82f4d9; font-size: .47rem; font-weight: 900; letter-spacing: .13em; }
.memory-card:disabled { cursor: default; }

.game-panel {
  position: absolute; inset: 50% auto auto 50%; z-index: 4; width: min(570px, calc(100% - 30px));
  transform: translate(-50%, -50%); padding: clamp(22px, 5vw, 42px); text-align: center;
  border: 1px solid rgba(115, 227, 255, .28); border-radius: 18px; background: rgba(5, 9, 22, .95);
  box-shadow: 0 22px 70px rgba(0,0,0,.66), inset 0 1px 0 rgba(255,255,255,.05); backdrop-filter: blur(12px);
}
.game-panel::before { content: ""; position: absolute; left: 16%; right: 16%; top: -1px; height: 2px; background: linear-gradient(90deg,transparent,#72edff,transparent); box-shadow: 0 0 18px rgba(82,224,255,.55); }
#result.game-panel { background: radial-gradient(circle at 50% 0, rgba(68, 235, 213, .12), transparent 45%), rgba(5, 9, 22, .96); }
#result.game-panel::after { content: "SESSION VERIFIED"; display: block; width: max-content; margin: 18px auto -22px; color: rgba(119, 238, 255, .46); font-size: .5rem; font-weight: 900; letter-spacing: .2em; }
.match-emblem { position: relative; display: grid; width: 72px; height: 72px; margin: 0 auto 13px; place-items: center; border: 1px solid rgba(107,235,255,.55); border-radius: 50%; background: radial-gradient(circle,#1b3d79,#090f27 66%); box-shadow: 0 0 0 7px rgba(116,77,255,.07),0 0 30px rgba(76,218,255,.2); }
.match-emblem span { color: #fff; font: italic 900 1.7rem Georgia,serif; }.match-emblem i { position: absolute; inset: 9px; border: 1px dashed rgba(145,105,255,.5); border-radius: 50%; animation: portalSpin 7s linear infinite; }.match-emblem i:last-child { inset: -7px; border-style: solid; border-color: transparent #64eaff; animation-direction: reverse; }
.game-panel h2 { margin: 9px 0; font-size: clamp(1.5rem, 4.5vw, 2.35rem); }
.game-panel > p { margin: 0 auto 18px; max-width: 470px; color: #bac4d9; line-height: 1.5; }
.rule-row, .result-stats { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 0 0 21px; }
.rule-row span, .result-stats span { padding: 7px 9px; border: 1px solid rgba(113, 234, 255, .17); border-radius: 8px; color: #8996ad; background: rgba(255,255,255,.03); font-size: .62rem; font-weight: 800; letter-spacing: .06em; }
.result-stats strong { display: block; color: #8ff7e5; font-size: 1rem; }
.primary-button { padding: 14px 20px; border: 0; color: #030711; background: linear-gradient(110deg, #82f45b 0%, #55edcf 42%, #55d6ff 100%); box-shadow: 0 10px 30px rgba(75, 226, 211, .22); }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.hidden { display: none; }
.callout { position: absolute; left: 50%; top: 44%; z-index: 3; transform: translate(-50%, -8px) scale(.95); opacity: 0; pointer-events: none; color: #fff; font-size: clamp(1.2rem, 4vw, 2rem); font-weight: 1000; font-style: italic; letter-spacing: .1em; text-align: center; text-shadow: 0 0 18px #16e5ff, 0 4px 0 rgba(0,0,0,.35); transition: opacity .15s ease, transform .18s ease; }
.callout.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.keyboard-note { padding: 12px 4px 3px; color: #7f8aa2; font-size: .72rem; }
.keyboard-note strong { color: #cbd5e8; }
footer { padding: 11px 4px 0; border-top: 1px solid rgba(129, 220, 255, .08); color: #69768f; font-size: .7rem; }

@keyframes breathe { to { opacity: .65; transform: scale(1.03); } }
@keyframes signalBlink { to { opacity: .25; } }
@keyframes portalSpin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .game-shell { padding: 11px; }
  .game-header { gap: 6px; }
  .brand-lockup { min-width: 0; gap: 8px; }
  .brand-lockup img { width: 43px; height: 43px; flex-basis: 43px; }
  .brand-lockup h1 { font-size: 1rem; letter-spacing: .06em; }
  .brand-lockup .eyebrow { font-size: .52rem; letter-spacing: .12em; }
  .status-label { display: none; }
  .icon-button { flex: 0 1 auto; padding: 8px 6px; font-size: .53rem; white-space: nowrap; }
  .score-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin-top: 14px; padding-inline: 4px; }
  .score-strip div { min-width: 0; }
  .score-strip span { font-size: .46rem; letter-spacing: .05em; }
  .score-strip strong { font-size: 1rem; }
  .board-wrap { min-height: 520px; padding: 12px; }
  .signal-canopy { height: 22px; margin: -3px auto 8px; font-size: .42rem; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .memory-card { aspect-ratio: 1.08 / 1; }
  .game-panel { padding: 15px 13px; }
  .match-emblem { width: 52px; height: 52px; margin-bottom: 8px; }
  .game-panel h2 { margin: 6px 0; font-size: 1.3rem; }
  .game-panel > p { margin-bottom: 11px; overflow-wrap: anywhere; font-size: .76rem; line-height: 1.35; }
  .panel-tag { font-size: .53rem; }
  .rule-row { margin-bottom: 12px; }
  .rule-row span { padding: 5px 6px; font-size: .49rem; }
  .primary-button { padding: 11px 13px; font-size: .66rem; }
  .result-stats { margin-bottom: 11px; }
  .keyboard-note, footer { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
