:root {
  --memory-ink: #f2f3ed;
  --memory-muted: #a3adbf;
  --memory-lime: #d8f879;
}
body[data-page="memory"] {
  min-height: 100vh;
  margin: 0;
  color: var(--memory-ink);
  background:
    radial-gradient(720px 520px at 82% 10%, rgba(95, 83, 164, .18), transparent 68%),
    radial-gradient(600px 500px at 8% 55%, rgba(106, 87, 133, .13), transparent 70%),
    linear-gradient(180deg, #111624 0%, #0a0e17 68%, #090c13 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.memory-shell { width: min(970px, 100%); margin: 0 auto; padding: 0 30px; }
.memory-header { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(211,223,243,.1); }
.memory-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--memory-ink); font-size: 16px; font-weight: 780; letter-spacing: -.06em; text-decoration: none; }
.brand-mark { position: relative; display: grid; width: 32px; height: 32px; place-items: center; overflow: hidden; border: 1px solid rgba(216,248,121,.58); border-radius: 10px; color: var(--memory-lime); background: rgba(216,248,121,.09); font-size: 15px; font-weight: 850; }
.brand-mark i { position: absolute; width: 7px; height: 7px; right: 5px; bottom: 5px; border-radius: 2px; background: var(--memory-lime); transform: rotate(45deg); }
.brand-period { color: var(--memory-lime); }
.memory-back { color: #abb5c6; text-decoration: none; font-size: 12px; transition: color .18s ease; }
.memory-back:hover { color: var(--memory-lime); }
.memory-back span { margin-right: 7px; color: var(--memory-lime); }
.memory-main { padding: 44px 0 55px; }
.memory-intro { margin-bottom: 24px; }
.memory-eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: #bdc8d9; font-size: 9px; font-weight: 760; letter-spacing: .18em; }
.memory-eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: var(--memory-lime); box-shadow: 0 0 12px rgba(216,248,121,.7); }
.memory-intro h1 { margin: 0; font-size: clamp(45px, 6vw, 66px); line-height: .98; letter-spacing: -.075em; }
.memory-intro h1 span { color: var(--memory-lime); }
.memory-intro > p:last-child { margin: 10px 0 0; color: var(--memory-muted); font-size: 13px; line-height: 1.6; }
.memory-layout { display: grid; grid-template-columns: minmax(0, 1fr) 245px; align-items: start; gap: 16px; }
.memory-board-wrap, .memory-panel { border: 1px solid rgba(211,223,243,.13); border-radius: 20px; background: linear-gradient(155deg, rgba(25,33,51,.91), rgba(14,19,30,.96)); box-shadow: 0 24px 70px rgba(0,0,0,.23); }
.memory-board-wrap { padding: 17px; }
.memory-board-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 1px 12px; color: #919db0; font-size: 9px; font-weight: 750; letter-spacing: .13em; }
.memory-board-top span:last-child { color: #9ca8bb; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.memory-board { --grid-columns: 4; display: grid; width: min(100%, 520px); grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr)); gap: clamp(7px, 1.25vw, 11px); margin-inline: auto; padding: clamp(9px, 1.5vw, 14px); border: 1px solid rgba(211,223,243,.08); border-radius: 16px; background: #202938; }
.memory-card { position: relative; display: grid; min-width: 0; aspect-ratio: 1; place-items: center; padding: 0; border: 0; border-radius: 11px; color: var(--memory-ink); background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; perspective: 500px; }
.memory-card:focus-visible { outline: 2px solid var(--memory-lime); outline-offset: 3px; }
.memory-card:disabled { cursor: default; }
.memory-card-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .28s cubic-bezier(.2,.7,.2,1); }
.memory-card.is-revealed .memory-card-inner, .memory-card.is-matched .memory-card-inner { transform: rotateY(180deg); }
.memory-card-face { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(211,223,243,.12); border-radius: 11px; backface-visibility: hidden; }
.memory-card-front { color: #c7baff; background: linear-gradient(145deg, #3b385e, #292a45); font-size: clamp(20px, 3vw, 32px); font-weight: 500; }
.memory-card-front::after { color: rgba(221,214,255,.72); content: "✳"; }
.memory-card-back { border-color: rgba(216,248,121,.17); color: white; background: linear-gradient(145deg, #414b65, #293449); font-size: clamp(21px, 3.8vw, 40px); transform: rotateY(180deg); }
.memory-card.is-matched .memory-card-back { border-color: rgba(216,248,121,.55); background: linear-gradient(145deg, #344d46, #233c3a); box-shadow: 0 0 20px rgba(216,248,121,.12); }
.memory-card:hover:not(:disabled) .memory-card-inner { filter: brightness(1.12); }
.memory-status { min-height: 19px; margin: 12px 4px 0; color: #aeb9ca; font-size: 10px; line-height: 1.5; text-align: center; }
.memory-panel { display: flex; flex-direction: column; gap: 12px; padding: 13px; }
.memory-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.memory-stats > div { display: grid; gap: 5px; padding: 11px; border: 1px solid rgba(211,223,243,.09); border-radius: 13px; background: rgba(5,9,16,.26); }
.memory-stats span, .memory-record > span, .memory-how > span { color: #8996aa; font-size: 8px; font-weight: 760; letter-spacing: .14em; }
.memory-stats strong { color: #f3f4ed; font-size: 21px; letter-spacing: -.045em; }
.memory-record { display: grid; gap: 6px; padding: 12px; border: 1px solid rgba(211,223,243,.09); border-radius: 13px; background: rgba(5,9,16,.22); }
.memory-record strong { color: var(--memory-lime); font-size: 20px; }
.memory-record small { color: #7f8ba0; font-size: 9px; }
.memory-size-label { margin-top: 2px; color: #9eabbd; font-size: 10px; font-weight: 700; }
.memory-size { width: 100%; height: 39px; margin-top: -7px; padding: 0 10px; border: 1px solid rgba(211,223,243,.14); border-radius: 10px; outline: 0; color: var(--memory-ink); background: #151c2a; font: inherit; font-size: 11px; }
.memory-size:focus-visible { border-color: rgba(216,248,121,.63); box-shadow: 0 0 0 3px rgba(216,248,121,.1); }
.memory-size option { color: var(--memory-ink); background: #151c2a; }
.memory-new { display: flex; min-height: 41px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; color: #151b12; background: var(--memory-lime); font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; transition: transform .18s ease, background .18s ease; }
.memory-new:hover { transform: translateY(-1px); background: #e4ff9a; }
.memory-new span { font-size: 16px; }
.memory-how { padding: 12px; border: 1px solid rgba(211,223,243,.09); border-radius: 13px; background: rgba(5,9,16,.22); }
.memory-how p { margin: 8px 0 0; color: #a5b0c2; font-size: 10px; line-height: 1.65; }
.memory-footer { display: flex; align-items: center; gap: 20px; min-height: 68px; border-top: 1px solid rgba(211,223,243,.1); color: #7e899c; font-size: 10px; }
.memory-footer > span:first-child { color: #c5ccda; font-weight: 750; }
.memory-footer > a { margin-left: auto; color: #c8d1df; text-decoration: none; }
.memory-footer > a:hover { color: var(--memory-lime); }
.memory-footer b { margin-left: 5px; color: var(--memory-lime); }
@media (max-width: 700px) {
  .memory-shell { padding-inline: 18px; }
  .memory-main { padding-top: 34px; }
  .memory-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 11px; }
  .memory-board-wrap { padding: 12px; }
  .memory-panel { padding: 10px; gap: 9px; }
  .memory-stats > div, .memory-record, .memory-how { padding: 9px; }
}
@media (max-width: 560px) {
  .memory-shell { padding-inline: 13px; }
  .memory-layout { grid-template-columns: 1fr; }
  .memory-board-wrap { padding: 10px; }
  .memory-board { gap: clamp(5px, 2vw, 9px); padding: clamp(8px, 2.4vw, 12px); border-radius: 14px; }
  .memory-card, .memory-card-face { border-radius: 8px; }
  .memory-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .memory-stats, .memory-record, .memory-size-label, .memory-size, .memory-how { grid-column: 1 / -1; }
  .memory-new { grid-column: 1 / -1; }
}
@media (max-width: 360px) {
  .memory-shell { padding-inline: 9px; }
  .memory-board { gap: 5px; padding: 7px; }
  .memory-card-back { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-page="memory"] *, body[data-page="memory"] *::before, body[data-page="memory"] *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
