
:root {
  color-scheme: dark;
  --bg: #060817;
  --bg2: #0a0e2f;
  --violet: #7a5cff;
  --purple: #a34bff;
  --blue: #2b6fff;
  --cyan: #55ddff;
  --ice: #e8f7ff;
  --muted: #9ca9c7;
  --panel: rgba(10, 14, 46, .58);
  --panel2: rgba(14, 20, 62, .76);
  --line: rgba(150, 185, 255, .22);
  --glow: 0 0 30px rgba(71, 118, 255, .34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { overflow-x: hidden; color: #fff; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(106,74,255,.25), transparent 35%),
    radial-gradient(circle at 85% 20%, rgba(31,100,255,.20), transparent 32%),
    linear-gradient(180deg, #07091b 0%, #070b21 42%, #08102b 100%);
}

.ambient {
  position: absolute;
  border-radius: 999px;
  filter: blur(50px);
  opacity: .45;
  pointer-events: none;
}
.ambient-a { width: 240px; height: 240px; background: #653cff; top: 8%; left: -120px; }
.ambient-b { width: 280px; height: 280px; background: #0f6cff; right: -150px; bottom: 8%; }

.noise {
  position: absolute; inset: 0; pointer-events: none; opacity: .08;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.6), transparent 85%);
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100svh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}
.screen-active { display: flex; }

.intro-screen {
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}

.brand-row, .mini-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 900; letter-spacing: -.04em;
  background: linear-gradient(135deg, #8b6dff, #2674ff);
  box-shadow: 0 0 30px rgba(80,98,255,.38);
}
.brand-copy, .mini-brand > div:last-child { display: flex; flex-direction: column; }
.brand-copy strong, .mini-brand strong { font-size: 14px; letter-spacing: .15em; }
.brand-copy span, .mini-brand span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.brand-mark-small { width: 36px; height: 36px; border-radius: 11px; font-size: 12px; }

.hero-orb {
  position: relative;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  margin: 18px auto 0;
  display: grid;
  place-items: center;
}
.hero-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(130, 162, 255, .36);
}
.ring-1 { width: 100%; height: 100%; animation: spin 14s linear infinite; }
.ring-2 { width: 76%; height: 76%; border-style: dashed; animation: spinReverse 9s linear infinite; }
.ring-3 { width: 56%; height: 56%; border-width: 2px; animation: pulseRing 3s ease-in-out infinite; }
.hero-ring::before, .hero-ring::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px; border-radius: 50%;
  background: #86b6ff;
  box-shadow: 0 0 18px #5f8cff;
}
.hero-ring::before { top: -5px; left: 50%; }
.hero-ring::after { bottom: -5px; left: 26%; }
.hero-core {
  width: 34%; height: 34%; border-radius: 28%;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #a666ff, #2778ff);
  box-shadow: 0 0 45px rgba(92,111,255,.65), inset 0 0 20px rgba(255,255,255,.15);
  animation: floaty 4s ease-in-out infinite;
}

.intro-copy { text-align: left; }
.eyebrow {
  display: inline-flex;
  color: #91c9ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
  margin-bottom: 10px;
}
.intro-copy h1, .text-mode-copy h2 {
  font-size: clamp(36px, 10vw, 60px);
  line-height: .98;
  letter-spacing: -.055em;
  margin: 0;
  max-width: 720px;
  background: linear-gradient(180deg, #fff 5%, #aebfff 78%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-copy p, .text-mode-copy p {
  color: #a9b5d3;
  font-size: 15px;
  line-height: 1.6;
  max-width: 620px;
  margin: 18px 0 0;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.mode-card {
  width: 100%;
  min-height: 82px;
  border: 1px solid rgba(255,255,255,.10);
  color: #fff;
  border-radius: 22px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(132,75,255,.16), rgba(35,112,255,.10)),
    rgba(255,255,255,.035);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px rgba(255,255,255,.05);
  transition: transform .18s ease, border-color .18s ease, filter .18s ease;
}
.mode-card-primary {
  background:
    linear-gradient(135deg, rgba(133,81,255,.32), rgba(38,111,255,.28)),
    rgba(255,255,255,.045);
  border-color: rgba(122,157,255,.24);
}
.mode-card:active { transform: scale(.985); filter: brightness(1.08); }
.mode-icon {
  width: 48px; height: 48px; border-radius: 15px;
  display: grid; place-items: center;
  flex: 0 0 auto;
  font-weight: 900;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, rgba(152,99,255,.94), rgba(42,116,255,.94));
  box-shadow: 0 0 25px rgba(80,102,255,.28);
}
.mode-copy { display: flex; flex-direction: column; min-width: 0; }
.mode-copy strong { font-size: 16px; letter-spacing: -.02em; }
.mode-copy small { color: #9faed0; line-height: 1.4; margin-top: 4px; }

.primary-btn, .secondary-btn, .icon-btn {
  border: 0;
  color: #fff;
  cursor: pointer;
}
.primary-btn {
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, #7a57ff 0%, #276dff 58%, #1ca7ff 100%);
  box-shadow: 0 12px 40px rgba(55,80,255,.34), inset 0 1px rgba(255,255,255,.18);
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}
.primary-btn:active { transform: scale(.98); filter: brightness(1.08); }
.primary-btn.compact { min-height: 52px; border-radius: 16px; }
.primary-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
  filter: saturate(.55);
  box-shadow: none;
}
.btn-icon { font-size: 20px; }
.secondary-btn {
  min-height: 52px;
  border-radius: 16px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(12px);
}
.microcopy {
  color: #7180a7;
  font-size: 12px;
  text-align: center;
  margin: -10px 0 0;
}

.text-screen {
  flex-direction: column;
  gap: 20px;
}
.text-composer {
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(153,93,255,.45), rgba(47,144,255,.38), rgba(255,255,255,.06));
  box-shadow: 0 16px 48px rgba(38,72,255,.14);
}
.text-composer textarea {
  display: block;
  width: 100%;
  min-height: 190px;
  resize: none;
  border: 0;
  outline: none;
  color: #fff;
  font-size: 18px;
  line-height: 1.55;
  padding: 20px 18px 12px;
  border-radius: 23px 23px 10px 10px;
  background:
    radial-gradient(circle at 85% 0%, rgba(106,69,255,.12), transparent 32%),
    rgba(7,10,30,.90);
}
.text-composer textarea::placeholder { color: #5f6f95; }
.text-composer-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px 12px;
  border-radius: 8px 8px 23px 23px;
  background: rgba(8,12,35,.95);
  color: #8594b7;
  font-size: 10px;
  letter-spacing: .08em;
}
.text-status { color: #77c8ff; }
.text-visual {
  position: relative;
  width: 150px;
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.text-orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(118,169,255,.34);
}
.orbit-a { inset: 0; animation: spin 9s linear infinite; }
.orbit-b { inset: 24px; border-style: dashed; animation: spinReverse 6s linear infinite; }
.text-sigil {
  width: 62px; height: 62px;
  display: grid; place-items: center;
  border-radius: 19px;
  font-size: 35px;
  font-weight: 900;
  background: linear-gradient(135deg,#9d62ff,#2f8cff);
  box-shadow: 0 0 32px rgba(77,104,255,.48);
  transform: rotate(-8deg);
}

.scanner-screen {
  flex-direction: column;
  gap: 16px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 26px;
}
.scanner-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 0;
}
.scanner-copy h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.scanner-copy p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.status-dot {
  width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto;
  background: #4b82ff;
  box-shadow: 0 0 18px #4d8dff;
  animation: pulseDot 1.5s ease-in-out infinite;
}

.camera-stage {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 420px;
  max-height: 72svh;
  overflow: hidden;
  border-radius: 28px;
  background: #02040d;
  border: 1px solid rgba(144,169,255,.20);
  box-shadow: 0 20px 70px rgba(0,0,0,.34), inset 0 0 0 1px rgba(255,255,255,.025);
}
#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.camera-overlay { position: absolute; inset: 0; pointer-events: none; }
.camera-overlay::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(32,25,78,.18), transparent 34%, transparent 70%, rgba(5,8,30,.34));
}
.scan-frame {
  position: absolute;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.corner {
  position: absolute;
  width: 44px; height: 44px;
  border-color: rgba(164,198,255,.95);
  filter: drop-shadow(0 0 8px rgba(57,123,255,.75));
}
.corner-tl { top: 0; left: 0; border-left: 3px solid; border-top: 3px solid; border-radius: 15px 0 0 0; }
.corner-tr { top: 0; right: 0; border-right: 3px solid; border-top: 3px solid; border-radius: 0 15px 0 0; }
.corner-bl { bottom: 0; left: 0; border-left: 3px solid; border-bottom: 3px solid; border-radius: 0 0 0 15px; }
.corner-br { bottom: 0; right: 0; border-right: 3px solid; border-bottom: 3px solid; border-radius: 0 0 15px 0; }
.scan-line {
  position: absolute;
  left: 6%; right: 6%;
  height: 2px;
  top: 12%;
  background: linear-gradient(90deg, transparent, #76d6ff, #7e6cff, transparent);
  box-shadow: 0 0 16px #37b8ff;
  animation: scanLine 2.2s ease-in-out infinite;
}

.hud-label {
  position: absolute;
  z-index: 2;
  font-size: 9px;
  letter-spacing: .16em;
  color: rgba(225,238,255,.70);
}
.hud-top-left { top: 14px; left: 14px; }
.hud-top-right { top: 14px; right: 14px; }
.hud-bottom-left { bottom: 14px; left: 14px; }
.hud-bottom-right { bottom: 14px; right: 14px; }

.detected-area {
  position: absolute;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.75);
  opacity: 0;
  transition: opacity .22s ease, transform .32s cubic-bezier(.2,.9,.2,1.1);
}
.detected-area.visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.detected-area.pulse { animation: detectorPulse .28s ease; }

.platform {
  position: absolute;
  left: 50%; top: 50%;
  width: 72%; height: 72%;
  transform: translate(-50%, -50%) rotateX(62deg);
  transform-style: preserve-3d;
}
.platform-ring, .platform-core {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}
.platform-ring {
  border: 2px solid rgba(96,195,255,.88);
  box-shadow: 0 0 20px rgba(31,139,255,.85), inset 0 0 18px rgba(27,106,255,.45);
}
.ring-a { width: 100%; height: 100%; animation: spin 4s linear infinite; }
.ring-b { width: 72%; height: 72%; border-style: dashed; animation: spinReverse 3s linear infinite; }
.ring-c { width: 44%; height: 44%; animation: pulseRing 2.4s ease-in-out infinite; }
.platform-core {
  width: 24%; height: 24%;
  background: radial-gradient(circle, rgba(132,223,255,.98), rgba(35,109,255,.22) 55%, transparent 72%);
  box-shadow: 0 0 30px #329cff;
}
.platform-rays {
  position: absolute;
  inset: 16%;
  background: repeating-conic-gradient(from 0deg, rgba(81,180,255,.65) 0 3deg, transparent 3deg 22deg);
  border-radius: 50%;
  opacity: .55;
  animation: spin 8s linear infinite;
}

.reveal-panel {
  display: grid;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: rgba(10,15,51,.78);
  border: 1px solid rgba(111,157,255,.20);
  backdrop-filter: blur(16px);
  box-shadow: var(--glow);
}
.reveal-panel.updating { animation: qrSwap .32s ease; }
.reveal-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.reveal-info strong { font-size: 15px; }
.reveal-info small { color: #9fb0d0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.success-pill {
  width: fit-content;
  color: #9edaff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .18em;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(50,140,255,.12);
  border: 1px solid rgba(100,188,255,.22);
}

.error-box {
  display: none;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(164,54,92,.14);
  border: 1px solid rgba(255,114,165,.18);
  color: #ffdbe7;
  font-size: 13px;
}
.error-box.visible { display: block; }

.reveal-screen {
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.reveal-backdrop {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 36%, rgba(44,125,255,.28), transparent 24%),
    radial-gradient(circle at 20% 15%, rgba(148,82,255,.22), transparent 35%),
    radial-gradient(circle at 85% 70%, rgba(61,80,255,.18), transparent 36%);
  pointer-events: none;
}
.reveal-topbar { z-index: 3; }

.entity-stage-wrap {
  position: relative;
  flex: 1;
  min-height: 390px;
  display: grid;
  place-items: center;
}
#threeCanvas {
  width: 100%;
  height: 100%;
  min-height: 390px;
  display: block;
  touch-action: none;
}
.result-platform {
  position: absolute;
  left: 50%; bottom: 13%;
  width: min(64vw, 300px);
  aspect-ratio: 1;
  transform: translateX(-50%) rotateX(68deg);
  pointer-events: none;
  z-index: 0;
}
.result-ring, .result-core {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  border-radius: 50%;
}
.result-ring { border: 2px solid rgba(84,181,255,.64); box-shadow: 0 0 26px rgba(41,121,255,.56); }
.rr1 { width: 100%; height: 100%; animation: spin 5s linear infinite; }
.rr2 { width: 72%; height: 72%; border-style: dashed; animation: spinReverse 3s linear infinite; }
.rr3 { width: 40%; height: 40%; animation: pulseRing 2.5s ease-in-out infinite; }
.result-core {
  width: 20%; height: 20%;
  background: radial-gradient(circle, #aee9ff, #3676ff 50%, transparent 72%);
  box-shadow: 0 0 34px #2e7fff;
}
.energy-beam {
  position: absolute;
  left: 50%; bottom: 20%;
  width: 24%;
  height: 45%;
  transform: translateX(-50%) scaleY(0);
  transform-origin: bottom;
  background: linear-gradient(180deg, transparent 0%, rgba(77,175,255,.10) 20%, rgba(79,113,255,.38) 68%, rgba(166,218,255,.75) 100%);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  filter: blur(2px);
  opacity: 0;
}
.energy-beam.active {
  animation: beamIn 1s ease-out forwards;
}
.burst {
  position: absolute;
  left: 50%; bottom: 26%;
  width: 10px; height: 10px;
  border-radius: 50%;
  transform: translate(-50%,50%);
  opacity: 0;
  background: #bcecff;
  box-shadow: 0 0 20px 5px #63b9ff, 0 0 70px 25px rgba(97,92,255,.42);
}
.burst.active { animation: burst 1s ease-out forwards; }

.entity-panel {
  position: relative;
  z-index: 3;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(13,20,60,.76), rgba(8,12,37,.90));
  border: 1px solid rgba(113,155,255,.18);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0,0,0,.24);
}
.entity-panel h2 {
  font-size: 34px;
  letter-spacing: -.04em;
  margin: 0 0 14px;
}
.entity-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.entity-meta > div {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  min-width: 0;
}
.entity-meta span {
  display: block;
  color: #7f91ba;
  font-size: 8px;
  letter-spacing: .14em;
  margin-bottom: 5px;
}
.entity-meta strong {
  display: block;
  color: #eef5ff;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.interaction-tip {
  color: #7f90b2;
  font-size: 11px;
  margin: 12px 0;
}
.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(70,86,255,.22), transparent 32%),
    rgba(4,6,19,.92);
  backdrop-filter: blur(18px);
}
.loading-overlay.visible { display: flex; }
.loading-glyph {
  position: relative;
  width: 92px; height: 92px;
  margin-bottom: 22px;
}
.loading-glyph span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(105,161,255,.34);
}
.loading-glyph span:nth-child(1) { animation: spin 2s linear infinite; border-top-color: #8d6aff; }
.loading-glyph span:nth-child(2) { inset: 12px; animation: spinReverse 1.4s linear infinite; border-right-color: #3ba3ff; }
.loading-glyph span:nth-child(3) { inset: 27px; animation: pulseRing 1.5s ease-in-out infinite; border-color: #aeeaff; }
.loading-overlay strong { font-size: 18px; margin-bottom: 6px; }
.loading-overlay small { color: #6f81a7; font-size: 9px; letter-spacing: .18em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  z-index: 40;
  max-width: calc(100% - 34px);
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(12,17,48,.90);
  border: 1px solid rgba(125,162,255,.16);
  color: #eaf2ff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  backdrop-filter: blur(14px);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinReverse { to { transform: rotate(-360deg); } }
@keyframes pulseRing { 50% { transform: scale(1.08); opacity: .65; } }
@keyframes floaty { 50% { transform: rotate(45deg) translateY(-10px) scale(1.05); } }
@keyframes pulseDot { 50% { transform: scale(.68); opacity: .45; } }
@keyframes scanLine {
  0%,100% { top: 10%; opacity: .3; }
  50% { top: 88%; opacity: 1; }
}
@keyframes beamIn {
  0% { transform: translateX(-50%) scaleY(0); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateX(-50%) scaleY(1); opacity: .9; }
}
@keyframes burst {
  0% { opacity: 0; transform: translate(-50%,50%) scale(.5); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,50%) scale(10); }
}
@keyframes qrSwap {
  0% { transform: scale(.985); filter: brightness(1); }
  50% { transform: scale(1.015); filter: brightness(1.25); }
  100% { transform: scale(1); filter: brightness(1); }
}
@keyframes detectorPulse {
  0% { transform: translate(-50%, -50%) scale(.95); }
  50% { transform: translate(-50%, -50%) scale(1.03); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@media (min-width: 720px) {
  .screen { max-width: 520px; margin: 0 auto; width: 100%; }
  .intro-screen { justify-content: center; min-height: 100svh; }
  .intro-screen .brand-row { margin-bottom: 8px; }
  .hero-orb { width: 260px; }
  .reveal-panel { grid-template-columns: 1fr auto; }
  .reveal-panel .primary-btn { width: auto; min-width: 180px; }
  .result-actions { grid-template-columns: 1.25fr .75fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}


/* === v4 navigation, persistence, gallery === */
.menu-btn {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 60;
  width: 42px; height: 42px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(7,10,30,.55);
  backdrop-filter: blur(14px);
  display: grid;
  place-content: center;
  gap: 4px;
  cursor: pointer;
  opacity: .72;
}
.menu-btn span {
  display: block;
  width: 17px; height: 1.5px;
  background: #fff;
  border-radius: 99px;
}
.side-menu {
  position: fixed;
  top: 0; right: 0;
  z-index: 70;
  width: min(82vw, 320px);
  height: 100%;
  padding: max(18px, env(safe-area-inset-top)) 18px 24px;
  background: linear-gradient(180deg, rgba(10,14,42,.97), rgba(6,9,26,.985));
  border-left: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(22px);
  transform: translateX(105%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: -25px 0 70px rgba(0,0,0,.28);
}
.side-menu.open { transform: translateX(0); }
.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.menu-item {
  width: 100%;
  min-height: 50px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 15px;
  color: #fff;
  text-align: left;
  padding: 0 15px;
  background: rgba(255,255,255,.035);
}
.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(1,3,12,.52);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.menu-scrim.visible { opacity: 1; pointer-events: auto; }

.saved-section {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.saved-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.saved-head h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.03em;
}
.saved-count {
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #cfe7ff;
  background: rgba(63,121,255,.12);
  border: 1px solid rgba(104,158,255,.18);
  font-size: 12px;
  font-weight: 800;
}
.saved-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.saved-card {
  position: relative;
  min-width: 0;
  border-radius: 18px;
  padding: 12px;
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border: 1px solid rgba(255,255,255,.07);
}
.saved-preview {
  height: 80px;
  border-radius: 14px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, var(--c1), transparent 32%),
    radial-gradient(circle at 75% 75%, var(--c2), transparent 38%),
    linear-gradient(135deg, var(--c3), rgba(10,12,30,.94));
}
.saved-preview::before,
.saved-preview::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.5);
  opacity: .45;
}
.saved-preview::before { inset: 14px; }
.saved-preview::after { inset: 26px; border-style: dashed; }
.saved-card strong {
  display: block;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-card small {
  color: #8292b3;
  display: block;
  margin-top: 4px;
  font-size: 10px;
}
.saved-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}
.saved-card-actions button {
  flex: 1;
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.04);
  color: #dce8ff;
  font-size: 10px;
}
.saved-empty {
  grid-column: 1 / -1;
  color: #7180a7;
  font-size: 12px;
  margin: 0;
  padding: 10px 0;
}

.result-actions {
  grid-template-columns: repeat(2, 1fr);
}
.full-row { grid-column: 1 / -1; }

@media (max-width: 390px) {
  .saved-grid { grid-template-columns: 1fr; }
}
