:root {
  --mp-ink: #162133;
  --mp-soft: rgba(31, 45, 66, 0.66);
  --mp-faint: rgba(39, 53, 74, 0.44);
  --mp-cell-gap: 10px;
  --mp-group-gap: 18px;
  --mp-edge-size: 8px;
}

html,
body {
  background:
    radial-gradient(circle at 17% 13%, rgba(255,255,255,0.98), transparent 28%),
    radial-gradient(circle at 81% 10%, rgba(232,237,244,0.88), transparent 31%),
    radial-gradient(circle at 52% 87%, rgba(255,255,255,0.95), transparent 36%),
    linear-gradient(135deg, #edf0f4 0%, #f8f9fb 47%, #e7ebf0 100%) !important;
  color: var(--mp-ink) !important;
}

body {
  position: relative;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  background:
    linear-gradient(112deg, rgba(255,255,255,0.62), transparent 23% 72%, rgba(177,188,207,0.12)),
    radial-gradient(ellipse at 52% 47%, rgba(255,255,255,0.22), transparent 60%);
}

.memory-art-scene {
  --scene-x: 0px;
  --scene-y: 0px;
  position: fixed;
  inset: -12px;
  z-index: -3;
  overflow: hidden;
  pointer-events: none;
  transform: translate3d(var(--scene-x), var(--scene-y), 0);
  transition: transform 0.56s cubic-bezier(.2,.72,.2,1);
}

.memory-art-scene::before,
.memory-art-scene::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(91, 106, 130, 0.13);
  background: transparent;
  box-shadow:
    inset -22px -24px 46px rgba(93, 108, 132, 0.045),
    24px 26px 50px rgba(122, 137, 159, 0.05),
    inset 1px 1px 0 rgba(255,255,255,0.9);
}

.memory-art-scene::before {
  left: -11vw;
  top: 5vh;
  width: 43vw;
  height: 45vw;
  border-radius: 34% 45% 49% 28%;
}

.memory-art-scene::after {
  right: -8vw;
  bottom: -18vh;
  width: 48vw;
  height: 60vh;
  border-radius: 35% 39% 0 0;
}

.memory-art-scene span {
  position: absolute;
  display: block;
  pointer-events: none;
}

.art-line {
  height: 1px;
  border-radius: 999px;
  transform-origin: left center;
  background: rgba(82, 100, 130, 0.19);
  box-shadow: 0 1px 0 rgba(255,255,255,0.66);
}

.line-1 {
  left: -6vw;
  top: 57%;
  width: 48vw;
  height: 9px;
  background: linear-gradient(90deg, #228fe5 0 68%, rgba(57,144,225,0.16) 68% 100%);
}

.line-2 {
  left: 23%;
  top: -7vh;
  width: 43vh;
  transform: rotate(90deg);
  background: linear-gradient(90deg, transparent, rgba(53,190,105,0.74) 63%, transparent);
}

.line-3 {
  left: 4vw;
  top: 79%;
  width: 63vw;
  transform: rotate(-28deg);
  background: linear-gradient(90deg, transparent, rgba(83,98,127,0.18) 14% 77%, transparent);
}

.line-4 { left: 37%; top: 28%; width: 52vw; transform: rotate(-9deg); opacity: 0.52; }
.line-5 { left: 71%; top: -2%; width: 43vw; transform: rotate(129deg); opacity: 0.42; }
.line-6 { left: 43%; top: 52%; width: 29vw; height: 2px; transform: rotate(2deg); opacity: 0.68; }
.line-7 { left: 8%; top: 34%; width: 20vw; transform: rotate(17deg); opacity: 0.50; }
.line-8 { right: 2%; top: 71%; width: 32vw; height: 3px; transform: rotate(88deg); background: linear-gradient(90deg, transparent, rgba(82,98,126,0.15), transparent); }
.line-9 { left: 28%; top: 93%; width: 34vw; transform: rotate(-46deg); opacity: 0.46; }
.line-10 {
  left: 63%;
  top: 40%;
  width: 25vw;
  height: 7px;
  background: linear-gradient(90deg, #26a7de, #5b48dd 33%, #df258f 67%, #e5f432);
  opacity: 0.84;
}

.art-spectrum { border-radius: 999px; }
.spectrum-1 { left: 16%; top: 68%; width: 55vw; height: 2px; transform: rotate(-18deg); background: linear-gradient(90deg, transparent, #1db2ec 24%, #8364ff 48%, #fa5aaa 68%, transparent 92%); opacity: 0.58; }
.spectrum-2 { right: -5%; top: 33%; width: 32vw; height: 3px; transform: rotate(112deg); background: linear-gradient(90deg, transparent, #23c8bb, #8f7bff, #ff6a8b, transparent); opacity: 0.48; }
.spectrum-3 { left: 51%; top: 16%; width: 39vw; height: 1px; transform: rotate(-34deg); background: linear-gradient(90deg, transparent, #39a3f2, #895bf7, transparent); opacity: 0.46; }

.art-orbit {
  border: 1px solid rgba(88, 104, 132, 0.11);
  border-radius: 50%;
  background: transparent;
}

.orbit-1 { left: 7%; top: 15%; width: 17vw; aspect-ratio: 1; }
.orbit-2 { left: 10.5%; top: 20%; width: 9vw; aspect-ratio: 1; }
.orbit-3 { right: 4%; top: 22%; width: 18vw; aspect-ratio: 1; }
.orbit-4 { right: 11%; bottom: 12%; width: 27vw; height: 34vw; border-radius: 38% 48% 42% 34%; }

.art-node {
  border: 1px solid rgba(255,255,255,0.94);
  border-right-color: rgba(123,139,164,0.15);
  border-bottom-color: rgba(110,127,153,0.14);
  background: transparent;
  box-shadow:
    0 18px 38px rgba(85,99,122,0.10),
    inset 1px 1px 0 rgba(255,255,255,0.98),
    inset -1px -1px 0 rgba(100,115,139,0.12);
}

.node-1 { left: 26%; top: 22%; width: 16vw; height: 8vw; min-height: 56px; border-radius: 999px; }
.node-2 { right: 16%; top: 19%; width: 25vw; height: 9vw; min-height: 64px; border-radius: 999px 999px 42% 999px; }

.memory-brand {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  top: max(16px, env(safe-area-inset-top));
  z-index: 125;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mp-ink);
  pointer-events: none;
}

.memory-brand__mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.98);
  border-right-color: rgba(115,132,157,0.17);
  border-bottom-color: rgba(102,119,146,0.15);
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 12px 28px rgba(74,89,112,0.12), inset 1px 1px 0 #fff, inset -1px -1px 0 rgba(91,107,132,0.12);
  font-size: 18px;
}

.memory-brand__text strong,
.memory-brand__text span { display: block; }
.memory-brand__text strong { font-size: 15px; line-height: 1.15; font-weight: 680; letter-spacing: .03em; }
.memory-brand__text span { margin-top: 3px; font-size: 10px; color: rgba(40,53,73,0.46); letter-spacing: .04em; }

.glass {
  z-index: 1;
  padding: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overscroll-behavior: none;
}

.glass.is-middle-panning,
.glass.is-middle-panning * { cursor: grabbing !important; }

.viewport-pan-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  height: max-content;
  transform: translate3d(0,0,0);
  transform-origin: 0 0;
  will-change: transform;
}

.glass-strip {
  height: 100vh;
  height: 100dvh;
  width: max-content;
  padding: 82px 24px 24px !important;
  overflow: visible !important;
  transform: none !important;
  transform-origin: 0 0;
  will-change: auto !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.glass-strip::before,
.glass-strip::after,
.group::before,
.group::after { display: none !important; }

.map:not(.is-focus) {
  height: calc(100% - 82px);
  gap: var(--mp-cell-gap);
  overflow: visible;
}

.map:not(.is-focus) .row { gap: var(--mp-group-gap); overflow: visible; }
.map:not(.is-focus) .group { gap: var(--mp-cell-gap); overflow: visible; }

/* The center is physically transparent. Only the outer ring refracts the backdrop. */
.cell {
  isolation: isolate;
  contain: layout paint style;
  content-visibility: visible !important;
  flex-basis: 118px !important;
  min-width: 118px !important;
  overflow: hidden !important;
  padding: 6px 8px !important;
  color: var(--mp-ink) !important;
  border: 1px solid rgba(255,255,255,0.94) !important;
  border-right-color: rgba(108,127,157,0.22) !important;
  border-bottom-color: rgba(98,117,148,0.19) !important;
  border-radius: 20px !important;
  background: transparent !important;
  background-color: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  box-shadow:
    0 17px 34px rgba(67,81,104,0.115),
    0 3px 9px rgba(75,89,111,0.055),
    inset 1px 1px 0 rgba(255,255,255,0.99),
    inset -1px -1px 0 rgba(99,119,150,0.14) !important;
  transform: none !important;
  transition: box-shadow .18s ease, border-color .18s ease !important;
}

.cell::before,
.cell::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: inherit;
}

/* 8px optical meniscus: stronger displacement is clipped to the border ring. */
.cell::before {
  z-index: 0;
  inset: 0;
  padding: var(--mp-edge-size);
  background: rgba(255,255,255,0.002);
  backdrop-filter: url(#memory-edge-refraction) saturate(132%) contrast(1.16) brightness(1.035);
  -webkit-backdrop-filter: url(#memory-edge-refraction) saturate(132%) contrast(1.16) brightness(1.035);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* Refined edge light and chromatic fringe, with an empty center. */
.cell::after {
  z-index: 1;
  inset: 0;
  padding: 1px;
  background:
    linear-gradient(126deg,
      rgba(255,255,255,1) 0%,
      rgba(255,255,255,0.16) 18%,
      rgba(67,169,255,0.48) 41%,
      rgba(135,97,255,0.34) 57%,
      rgba(255,92,174,0.26) 72%,
      rgba(255,215,90,0.34) 84%,
      rgba(255,255,255,0.92) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.72;
  box-shadow:
    inset 0 2px 1px rgba(255,255,255,0.76),
    inset 2px 0 1px rgba(255,255,255,0.48),
    inset -2px 0 2px rgba(81,142,219,0.10),
    inset 0 -2px 2px rgba(112,89,188,0.08);
}

.cell > * { position: relative; z-index: 2; }

.cell .num {
  z-index: 3;
  top: 6px !important;
  left: 8px !important;
  color: var(--mp-faint) !important;
  font-size: 8px !important;
  font-weight: 500;
  text-shadow: none !important;
}

.cell .en {
  color: var(--mp-ink) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: -.01em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.72) !important;
}

.cell .zh {
  margin-top: 2px;
  color: var(--mp-soft) !important;
  font-size: 8px !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.58) !important;
}

.cell .obj {
  margin-top: 5px !important;
  padding: 2px 7px !important;
  border: 1px solid rgba(255,255,255,0.84);
  border-right-color: rgba(118,135,160,0.16);
  border-bottom-color: rgba(108,126,151,0.13);
  color: rgba(31,45,65,0.72) !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 4px 12px rgba(76,89,110,0.065), inset 1px 1px 0 rgba(255,255,255,0.88) !important;
  text-shadow: none !important;
}

.cell:hover,
.cell.is-active {
  background: transparent !important;
  border-top-color: #fff !important;
  border-left-color: rgba(255,255,255,0.98) !important;
  box-shadow:
    0 22px 42px rgba(70,84,108,0.15),
    0 5px 12px rgba(71,84,106,0.075),
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 rgba(94,114,146,0.16) !important;
  transform: none !important;
}

.cell:hover::before,
.cell.is-active::before {
  backdrop-filter: url(#memory-edge-refraction-strong) saturate(138%) contrast(1.20) brightness(1.045);
  -webkit-backdrop-filter: url(#memory-edge-refraction-strong) saturate(138%) contrast(1.20) brightness(1.045);
}

.cell:hover::after,
.cell.is-active::after { opacity: 0.94; }
.cell:hover .en,
.cell.is-active .en { color: #101a2b !important; }
.cell:hover .num,
.cell.is-active .num { color: rgba(36,50,70,0.50) !important; }
.cell:hover .zh,
.cell.is-active .zh { color: rgba(34,47,67,0.68) !important; }
.cell:hover .obj,
.cell.is-active .obj { color: rgba(28,41,60,0.78) !important; background: transparent !important; }

/* At extreme overview scales, avoid 1000 simultaneous backdrop filters. */
body.memory-overview-mode .cell::before {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.view-controls {
  top: max(18px, env(safe-area-inset-top)) !important;
  right: max(20px, env(safe-area-inset-right)) !important;
  padding: 5px !important;
  border: 1px solid rgba(255,255,255,0.97) !important;
  border-right-color: rgba(128,144,168,0.18) !important;
  border-bottom-color: rgba(112,128,153,0.16) !important;
  background: rgba(255,255,255,0.035) !important;
  backdrop-filter: blur(0.8px) saturate(112%) !important;
  -webkit-backdrop-filter: blur(0.8px) saturate(112%) !important;
  box-shadow: 0 16px 34px rgba(70,84,106,0.14), inset 1px 1px 0 #fff, inset -1px -1px 0 rgba(104,120,146,0.12) !important;
}

.view-controls button {
  color: rgba(25,38,58,0.72) !important;
  background: transparent !important;
  text-shadow: none !important;
}

.view-controls .sort-switch {
  background: rgba(130,145,167,0.07) !important;
  box-shadow: inset 0 1px 3px rgba(96,111,135,0.08) !important;
}

.view-controls button.is-selected,
.view-controls .recall-toggle[aria-pressed="true"] {
  color: #132039 !important;
  background: rgba(255,255,255,0.58) !important;
  box-shadow: 0 5px 14px rgba(74,88,110,0.10), inset 1px 1px 0 #fff !important;
}

.view-controls button:hover,
.view-controls button:focus-visible {
  color: #101c31 !important;
  background: rgba(255,255,255,0.34) !important;
}

.view-controls .group-label { color: rgba(31,45,65,0.55) !important; text-shadow: none !important; }

.viewport-zoom-button,
.viewport-zoom-readout {
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.78) !important;
  color: rgba(25,39,60,0.68) !important;
  background: transparent !important;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.90), 0 3px 9px rgba(72,87,110,0.06) !important;
}

.viewport-zoom-button {
  min-width: 28px !important;
  width: 28px;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 17px !important;
  font-weight: 430 !important;
  line-height: 1 !important;
}

.viewport-zoom-readout {
  min-width: 49px;
  padding: 0 8px !important;
  border-radius: 999px !important;
  font: 650 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace !important;
  cursor: pointer;
}

.viewport-zoom-button:hover,
.viewport-zoom-button:focus-visible,
.viewport-zoom-readout:hover,
.viewport-zoom-readout:focus-visible {
  color: #10203a !important;
  background: rgba(255,255,255,0.48) !important;
  outline: none;
}

.viewport-zoom-button:disabled { opacity: 0.30; cursor: default; }

.glass-panel {
  color: var(--mp-ink) !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.97) !important;
  border-right-color: rgba(126,142,167,0.19) !important;
  border-bottom-color: rgba(111,128,153,0.16) !important;
  backdrop-filter: blur(1px) saturate(112%) !important;
  -webkit-backdrop-filter: blur(1px) saturate(112%) !important;
  box-shadow: 0 22px 48px rgba(70,84,107,0.16), inset 1px 1px 0 #fff, inset -1px -1px 0 rgba(103,120,146,0.13) !important;
}

.glass-panel .gp-en { color: #142037 !important; }
.glass-panel .gp-zh,
.glass-panel .gp-obj,
.glass-panel .gp-audio-status { color: rgba(32,46,67,0.60) !important; }
.glass-panel .gp-pos { color: rgba(30,45,65,0.62) !important; background: transparent !important; }
.glass-panel .gp-note { color: #17243a !important; background: rgba(255,255,255,0.16) !important; border-color: rgba(255,255,255,0.80) !important; }
.glass-panel .gp-audio,
.glass-panel .gp-close { color: #1e2c42 !important; background: transparent !important; }

.focus-image-wrap,
.focus-title,
.focus-cells .cell {
  background: transparent !important;
  color: var(--mp-ink) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.focus-title .name { color: rgba(31,45,65,0.56) !important; }

body.mp-hide-english .cell .en::after { border-bottom-color: rgba(26,39,58,0.44) !important; }
body.mp-hide-english .cell.is-english-revealed .en,
body.mp-hide-english.mp-panel-english-revealed .glass-panel .gp-en { color: #162133 !important; text-shadow: none !important; }
body.mp-hide-english .glass-panel .gp-en::after { color: rgba(31,45,65,0.46) !important; }

@media (max-width: 768px) {
  :root { --mp-cell-gap: 7px; --mp-group-gap: 11px; --mp-edge-size: 7px; }
  .memory-brand { display: none; }
  .glass-strip { padding: 62px 8px 14px !important; }
  .map:not(.is-focus) { height: calc(100% - 62px); }
  .cell { flex-basis: clamp(78px, 21vw, 94px) !important; min-width: clamp(78px, 21vw, 94px) !important; border-radius: 17px !important; padding: 5px !important; }
  .cell .en { font-size: 10px !important; }
  .cell .zh { font-size: 7px !important; }
  .cell .obj { font-size: 7px !important; padding-inline: 5px !important; }
  .view-controls { top: max(8px, env(safe-area-inset-top)) !important; right: max(8px, env(safe-area-inset-right)) !important; gap: 3px !important; }
  .viewport-zoom-button { width: 25px; min-width: 25px !important; height: 25px; }
  .viewport-zoom-readout { min-width: 43px; height: 25px; padding-inline: 6px !important; font-size: 9px !important; }
}

@media (max-width: 480px) {
  .view-controls { left: max(7px, env(safe-area-inset-left)); }
  .cell { flex-basis: clamp(68px, 19vw, 80px) !important; min-width: clamp(68px, 19vw, 80px) !important; }
}

@media (prefers-reduced-motion: reduce) {
  .memory-art-scene,
  .cell,
  .glass-panel { transition: none !important; }
}
