/* The Astronomer's Sanctum: premium layer (chat, HUD, pop-ups, phone).
   Loaded after the game's own stylesheet; `#neural-waifu-panel#neural-waifu-panel` is expanded by sanctum-polish/apply.mjs to
   `#neural-waifu-panel#neural-waifu-panel` so these rules outrank the game's own (one id) rules.
   The game injects some <style> tags at runtime (roam, pill, telescope); those are beaten with `html body #id`. */

:root {
  --lx-glass: rgba(13, 11, 21, 0.62);
  --lx-glass-strong: rgba(13, 11, 21, 0.84);
  --lx-glass-sheet: rgba(12, 10, 19, 0.9);
  --lx-line: rgba(232, 206, 156, 0.14);
  --lx-line-2: rgba(232, 206, 156, 0.28);
  --lx-fill: rgba(255, 242, 216, 0.045);
  --lx-fill-2: rgba(255, 242, 216, 0.08);
  --lx-gold: #e6c27c;
  --lx-gold-soft: rgba(230, 194, 124, 0.16);
  --lx-gold-grad: linear-gradient(180deg, #f4dca6 0%, #ddb46b 52%, #bf914a 100%);
  --lx-ink: #1b130a;
  --lx-text: #f4ebdc;
  --lx-muted: #c2b59f;
  --lx-faint: #8f8572;
  --lx-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.75), 0 4px 18px rgba(0, 0, 0, 0.28);
  --lx-hi: inset 0 1px 0 rgba(255, 244, 222, 0.07);
  --lx-blur: blur(22px) saturate(1.35);
  --lx-serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --lx-caps: Cinzel, 'Cormorant Garamond', Georgia, serif;
  --lx-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, system-ui, sans-serif;
  --lx-kb: 0px;
  --lx-vh: 100dvh;
  --lx-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ------------------------------------------------------------ no accidental selection, no page zoom */

html,
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: #07070d;
}

canvas {
  touch-action: none;
  outline: none;
}

input,
textarea,
select,
[contenteditable='true'] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: rgba(230, 194, 124, 0.32);
  color: #fff8ea;
}

/* With a mouse her words can still be selected and copied. */
@media (hover: hover) and (pointer: fine) {
  #neural-waifu-panel#neural-waifu-panel .nw-chat .nw-msg span {
    -webkit-user-select: text;
    user-select: text;
  }
}

/* ------------------------------------------------------------ loading screen */

#splash {
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(74, 56, 112, 0.32), transparent 62%),
    radial-gradient(80% 50% at 50% 115%, rgba(230, 194, 124, 0.1), transparent 60%),
    #07070d !important;
  gap: 34px !important;
}

#splash .splash-card {
  filter: drop-shadow(0 0 42px rgba(230, 194, 124, 0.16)) !important;
}

#splash .splash-track {
  height: 1px !important;
  background: rgba(230, 194, 124, 0.16) !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

#splash .splash-fill {
  background: linear-gradient(90deg, rgba(230, 194, 124, 0.15), #f0d39a) !important;
  box-shadow: 0 0 10px rgba(240, 211, 154, 0.7) !important;
}

#splash .splash-status {
  font: 500 10px/1.2 var(--lx-caps) !important;
  letter-spacing: 0.24em !important;
  text-transform: uppercase;
  color: var(--lx-faint) !important;
}

#splash .splash-hint {
  font: 500 11px/1 var(--lx-caps) !important;
  letter-spacing: 0.38em !important;
  color: #ead8b0 !important;
}

#splash .splash-quick {
  background: rgba(13, 11, 21, 0.55) !important;
  border: 1px solid var(--lx-line-2) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 11px 20px !important;
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px)) !important;
}

/* ------------------------------------------------------------ title */

#overlay {
  top: max(26px, env(safe-area-inset-top)) !important;
  left: max(28px, env(safe-area-inset-left)) !important;
  color: var(--lx-text) !important;
  transition: opacity 0.5s;
}

#overlay h1 {
  font: 600 13px/1.25 var(--lx-caps) !important;
  letter-spacing: 0.34em !important;
  color: #f2e3c3 !important;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.7);
}

#overlay h1::after {
  content: '';
  display: block;
  width: 34px;
  height: 1px;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--lx-gold), transparent);
}

#overlay p {
  margin-top: 8px !important;
  font: italic 400 16px/1.3 var(--lx-serif) !important;
  color: #d4c6a8 !important;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
}

/* ------------------------------------------------------------ HUD buttons (game-injected styles) */

html body #roam-btn {
  top: max(22px, env(safe-area-inset-top));
  left: auto;
  right: max(24px, env(safe-area-inset-right));
  height: 40px;
  padding: 0 16px 0 13px;
  gap: 9px;
  font: 500 13px/1 var(--lx-sans);
  letter-spacing: 0.02em;
  color: var(--lx-text);
  border: 1px solid var(--lx-line-2);
  background: var(--lx-glass);
  box-shadow: var(--lx-shadow), var(--lx-hi);
  -webkit-backdrop-filter: var(--lx-blur);
  backdrop-filter: var(--lx-blur);
  transition: border-color 0.2s, background 0.2s, opacity 0.5s;
}

html body #roam-btn.on {
  border-color: var(--lx-line-2);
  background: var(--lx-glass);
}

html body #roam-btn:hover,
html body #roam-btn:focus-visible {
  border-color: rgba(230, 194, 124, 0.55);
  background: var(--lx-glass-strong);
  box-shadow: var(--lx-shadow), var(--lx-hi);
}

html body #roam-btn i {
  color: var(--lx-gold);
  font-size: 15px;
}

/* How to move: a small glass caption that fades on its own. */
html body #roam-hint {
  top: auto;
  right: auto;
  left: max(28px, env(safe-area-inset-left));
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
  max-width: 340px;
  padding: 10px 14px;
  border-radius: 14px;
  font: 400 12.5px/1.55 var(--lx-sans);
  color: var(--lx-muted);
  text-align: left;
  text-shadow: none;
  background: var(--lx-glass);
  border: 1px solid var(--lx-line);
  box-shadow: var(--lx-shadow);
  -webkit-backdrop-filter: var(--lx-blur);
  backdrop-filter: var(--lx-blur);
}

html body #roam-hint b {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  border: 1px solid var(--lx-line-2);
  color: var(--lx-gold);
  font: 700 11px/1 var(--lx-sans);
}

/* The joystick: a fine ring and a soft knob, crisp instead of smudged. */
html body #roam-stick {
  width: 124px;
  height: 124px;
  border: 1px solid rgba(232, 206, 156, 0.26);
  background:
    radial-gradient(circle, rgba(13, 11, 21, 0) 54%, rgba(13, 11, 21, 0.32) 100%),
    rgba(13, 11, 21, 0.18);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 0 0 6px rgba(232, 206, 156, 0.04), 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* The camera stays free while you chat (no close-up), so roaming stays on: on phones the joystick would sit on the
   chat sheet. It steps aside while the chat is open; dragging the scene above the sheet still turns the camera. */
html.lx-chat-open body #roam-stick {
  display: none;
}

html body #roam-stick::before {
  content: '';
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 1px dashed rgba(232, 206, 156, 0.12);
}

html body #roam-stick i {
  width: 48px;
  height: 48px;
  margin: -24px;
  background: radial-gradient(circle at 38% 32%, rgba(255, 240, 210, 0.35), rgba(230, 194, 124, 0.16) 60%, rgba(230, 194, 124, 0.1));
  border: 1px solid rgba(240, 214, 160, 0.7);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 18px rgba(230, 194, 124, 0.2);
}

/* "E  Talk to Luna" / "Spin the globe": one refined glass pill. */
html body #ix-pill {
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px));
  height: 46px;
  gap: 12px;
  padding: 0 22px 0 8px;
  font: 500 18px/1 var(--lx-serif);
  letter-spacing: 0.03em;
  color: var(--lx-text);
  border: 1px solid var(--lx-line-2);
  background: var(--lx-glass);
  box-shadow: var(--lx-shadow), var(--lx-hi);
  -webkit-backdrop-filter: var(--lx-blur);
  backdrop-filter: var(--lx-blur);
}

html body #ix-pill b {
  color: var(--lx-gold);
  font-weight: 600;
}

html body #ix-pill kbd {
  min-width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid rgba(230, 194, 124, 0.5);
  background: var(--lx-gold-soft);
  color: #f3d999;
  font: 700 12px/1 var(--lx-sans);
  box-shadow: none;
}

html body #ix-pill small {
  font: 12px/1.2 var(--lx-sans);
  color: var(--lx-muted);
  opacity: 1;
}

html body #ix-cross::after {
  border-color: rgba(240, 214, 160, 0.95);
}

/* "Peek through the telescope" and its kin. */
html body #sc-btn {
  height: 46px;
  padding: 0 22px;
  font: 500 18px/1 var(--lx-serif);
  color: var(--lx-text);
  border: 1px solid var(--lx-line-2);
  background: var(--lx-glass);
  box-shadow: var(--lx-shadow), var(--lx-hi);
  -webkit-backdrop-filter: var(--lx-blur);
  backdrop-filter: var(--lx-blur);
}

html body #sc-btn:hover,
html body #sc-btn:focus-visible {
  border-color: rgba(230, 194, 124, 0.55);
  box-shadow: var(--lx-shadow), var(--lx-hi);
}

/* The letterbox when you sit down to talk: slimmer, so the chat card sits cleanly. */
#talk-veil i {
  height: 5vh !important;
}

/* ------------------------------------------------------------ Luna's button (chat folded) */

#lx-fab {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 23;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.35s var(--lx-ease), transform 0.35s var(--lx-ease);
}

html.lx-ready #lx-fab {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

html.lx-chat-open #lx-fab,
html.lx-busy #lx-fab,
body.ix-talk #lx-fab {
  opacity: 0 !important;
  transform: translateY(10px) scale(0.92) !important;
  pointer-events: none !important;
}

#lx-fab .lx-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 1.5px rgba(240, 214, 160, 0.85),
    0 0 0 5px rgba(13, 11, 21, 0.55),
    0 0 0 6px rgba(240, 214, 160, 0.18),
    0 18px 40px -10px rgba(0, 0, 0, 0.8),
    0 0 34px rgba(230, 194, 124, 0.22);
  transition: transform 0.2s var(--lx-ease), box-shadow 0.3s;
}

#lx-fab img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  -webkit-user-drag: none;
}

#lx-fab:hover .lx-ring,
#lx-fab:focus-visible .lx-ring {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1.5px rgba(246, 222, 172, 1),
    0 0 0 5px rgba(13, 11, 21, 0.55),
    0 0 0 6px rgba(240, 214, 160, 0.3),
    0 22px 44px -10px rgba(0, 0, 0, 0.85),
    0 0 44px rgba(230, 194, 124, 0.32);
}

#lx-fab:focus-visible {
  outline: none;
}

#lx-fab:active .lx-ring {
  transform: scale(0.95);
}

/* A slow breath of light around her portrait. */
#lx-fab::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(240, 214, 160, 0.45);
  opacity: 0;
  animation: lx-breathe 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes lx-breathe {
  0% {
    opacity: 0;
    transform: scale(0.94);
  }
  40% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

/* She said something while the chat was folded. */
#lx-fab .lx-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--lx-gold-grad);
  box-shadow: 0 0 0 2.5px #0d0b15, 0 0 12px rgba(240, 214, 160, 0.8);
  transform: scale(0);
  transition: transform 0.3s var(--lx-ease);
}

#lx-fab.lx-unread .lx-dot {
  transform: scale(1);
}

#lx-fab .lx-cap {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  white-space: nowrap;
  border-radius: 999px;
  font: italic 500 17px/1 var(--lx-serif);
  letter-spacing: 0.02em;
  color: var(--lx-text);
  background: var(--lx-glass);
  border: 1px solid var(--lx-line-2);
  box-shadow: var(--lx-shadow), var(--lx-hi);
  -webkit-backdrop-filter: var(--lx-blur);
  backdrop-filter: var(--lx-blur);
  opacity: 0;
  transform: translate(8px, -50%);
  transition: opacity 0.3s, transform 0.3s var(--lx-ease);
  pointer-events: none;
}

#lx-fab .lx-cap::before {
  content: '✦';
  font: normal 11px/1 var(--lx-sans);
  color: var(--lx-gold);
}

#lx-fab:hover .lx-cap,
#lx-fab.lx-invite .lx-cap {
  opacity: 1;
  transform: translate(0, -50%);
}

/* On a phone the caption would sit on the "Talk to Luna" pill: one or the other. */
@media (max-width: 640px) {
  html:has(#ix-pill.on) #lx-fab .lx-cap {
    opacity: 0;
  }
}

/* ------------------------------------------------------------ the chat card */

#neural-waifu-panel#neural-waifu-panel {
  position: fixed;
  top: auto;
  left: auto;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
  width: 392px;
  max-width: calc(100vw - 32px);
  height: auto !important;
  max-height: min(700px, calc(100vh - 48px));
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--lx-line);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(230, 194, 124, 0.07), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgba(98, 76, 150, 0.12), transparent 60%),
    var(--lx-glass);
  -webkit-backdrop-filter: var(--lx-blur);
  backdrop-filter: var(--lx-blur);
  box-shadow: var(--lx-shadow), var(--lx-hi);
  color: var(--lx-text);
  font: 400 14px/1.45 var(--lx-sans);
  pointer-events: auto;
  inset: auto max(24px, env(safe-area-inset-right)) max(24px, calc(env(safe-area-inset-bottom) + 12px)) auto;
  transform-origin: 100% 100%;
  transition: opacity 0.38s var(--lx-ease), transform 0.45s var(--lx-ease), max-height 0.5s var(--lx-ease);
}

#neural-waifu-panel#neural-waifu-panel.nw-away {
  opacity: 0;
  transform: translateY(18px) scale(0.97);
}

#neural-waifu-panel#neural-waifu-panel * {
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 194, 124, 0.22) transparent;
}

#neural-waifu-panel#neural-waifu-panel ::-webkit-scrollbar-thumb {
  background: rgba(230, 194, 124, 0.22) padding-box;
}

#neural-waifu-panel#neural-waifu-panel ::-webkit-scrollbar-thumb:hover {
  background: rgba(230, 194, 124, 0.42) padding-box;
}

#neural-waifu-panel#neural-waifu-panel .nw-talk {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

#neural-waifu-panel#neural-waifu-panel .nw-talk > * {
  flex-shrink: 0;
}

/* Header: her portrait, her name, the tradition she reads in, close. */
#neural-waifu-panel#neural-waifu-panel .auth-head {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 14px 12px 13px 14px;
  border-bottom: 1px solid var(--lx-line);
  text-shadow: none;
  position: relative;
}

#neural-waifu-panel#neural-waifu-panel .auth-head > strong {
  display: none;
}

#neural-waifu-panel#neural-waifu-panel .lx-ava {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(240, 214, 160, 0.7), 0 0 0 4px rgba(13, 11, 21, 0.6), 0 0 22px rgba(230, 194, 124, 0.18);
}

#neural-waifu-panel#neural-waifu-panel .lx-ava img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
  -webkit-user-drag: none;
}

/* Her presence: a gold star-dot, breathing while she composes a reply. */
#neural-waifu-panel#neural-waifu-panel .lx-ava i {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--lx-gold-grad);
  box-shadow: 0 0 0 2.5px #0f0d18;
}

#neural-waifu-panel#neural-waifu-panel.lx-thinking .lx-ava i {
  animation: lx-pulse 1.1s ease-in-out infinite alternate;
}

@keyframes lx-pulse {
  to {
    opacity: 0.35;
    box-shadow: 0 0 0 2.5px #0f0d18, 0 0 10px rgba(240, 214, 160, 0.9);
  }
}

#neural-waifu-panel#neural-waifu-panel .lx-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#neural-waifu-panel#neural-waifu-panel .lx-who b {
  font: 600 15px/1 var(--lx-caps);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #f2e0b6;
}

#neural-waifu-panel#neural-waifu-panel .lx-who small {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font: italic 400 14.5px/1 var(--lx-serif);
  color: var(--lx-muted);
  white-space: nowrap;
}

#neural-waifu-panel#neural-waifu-panel .lx-who small .lx-state {
  overflow: hidden;
  text-overflow: ellipsis;
}

#neural-waifu-panel#neural-waifu-panel .nw-tradition {
  flex: none;
  margin: 0;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--lx-line-2);
  background: transparent;
  color: var(--lx-gold);
  font: 600 10.5px/20px var(--lx-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 0;
  pointer-events: auto;
  transition: background 0.2s, border-color 0.2s;
}

#neural-waifu-panel#neural-waifu-panel .nw-tradition:hover,
#neural-waifu-panel#neural-waifu-panel .nw-tradition:focus-visible {
  background: var(--lx-gold-soft);
  border-color: rgba(230, 194, 124, 0.55);
  outline: none;
}

#neural-waifu-panel#neural-waifu-panel .nw-close {
  position: static;
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--lx-muted);
  pointer-events: auto;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#neural-waifu-panel#neural-waifu-panel .nw-close svg {
  width: 16px;
  height: 16px;
}

#neural-waifu-panel#neural-waifu-panel .nw-close:hover,
#neural-waifu-panel#neural-waifu-panel .nw-close:focus-visible {
  background: var(--lx-fill-2);
  border-color: var(--lx-line);
  color: var(--lx-text);
  outline: none;
}

/* "She remembers you" line. */
#neural-waifu-panel#neural-waifu-panel .nw-memory {
  margin: 0;
  padding: 8px 16px 0;
  gap: 10px;
  font: italic 400 14px/1.3 var(--lx-serif);
  color: var(--lx-muted);
}

#neural-waifu-panel#neural-waifu-panel .nw-memory button {
  color: var(--lx-faint);
  text-decoration-color: rgba(230, 194, 124, 0.35);
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------ messages */

#neural-waifu-panel#neural-waifu-panel .nw-chat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  min-height: 0;
  max-height: min(46vh, 440px);
  margin: 0;
  padding: 18px 18px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: none;
  border: 0;
  border-radius: 0;
  pointer-events: auto;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 100%);
}

#neural-waifu-panel#neural-waifu-panel .nw-msg {
  margin: 0 0 14px;
  padding: 0;
  background: none;
  border: 0;
  text-shadow: none;
  font-size: inherit;
  animation: lx-in 0.6s var(--lx-ease) both;
}

@keyframes lx-in {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(3px);
  }
}

#neural-waifu-panel#neural-waifu-panel .nw-msg em {
  display: none;
}

#neural-waifu-panel#neural-waifu-panel .nw-msg b {
  display: none;
}

/* Her words: set like a letter, in the serif. */
#neural-waifu-panel#neural-waifu-panel .nw-bot,
#neural-waifu-panel#neural-waifu-panel .nw-guest {
  align-self: flex-start;
  max-width: 96%;
  margin-left: 0;
  margin-right: 0;
  padding-left: 14px;
  border: 0 !important;
  border-left: 1px solid rgba(230, 194, 124, 0.38) !important;
  background: none !important;
}

#neural-waifu-panel#neural-waifu-panel .nw-bot span,
#neural-waifu-panel#neural-waifu-panel .nw-guest span {
  color: #f7eedd;
  font: 400 18.5px/1.5 var(--lx-serif);
  text-shadow: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Your words: a small warm glass bubble on the right. */
#neural-waifu-panel#neural-waifu-panel .nw-user {
  align-self: flex-end;
  max-width: 84%;
  margin-left: 0;
  margin-right: 0;
  padding: 9px 14px;
  border-radius: 18px 18px 5px 18px;
  background: linear-gradient(180deg, rgba(230, 194, 124, 0.2), rgba(230, 194, 124, 0.12)) !important;
  border: 1px solid rgba(230, 194, 124, 0.24) !important;
  text-align: left;
}

#neural-waifu-panel#neural-waifu-panel .nw-user span {
  color: #fbf1e0;
  font: 400 14.5px/1.45 var(--lx-sans);
  overflow-wrap: anywhere;
}

#neural-waifu-panel#neural-waifu-panel .nw-user span::before {
  content: none;
}

#neural-waifu-panel#neural-waifu-panel .nw-sys {
  align-self: center;
  max-width: 92%;
  margin: 2px auto 18px;
  text-align: center;
  opacity: 1;
}

#neural-waifu-panel#neural-waifu-panel .nw-sys span {
  font: italic 400 16px/1.45 var(--lx-serif);
  color: var(--lx-muted);
}

#neural-waifu-panel#neural-waifu-panel .nw-share {
  margin: -2px 0 14px;
}

#neural-waifu-panel#neural-waifu-panel .nw-share button {
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--lx-line-2);
  background: var(--lx-fill);
  color: var(--lx-text);
  font: italic 500 15px/1 var(--lx-serif);
  transition: background 0.2s, border-color 0.2s;
}

#neural-waifu-panel#neural-waifu-panel .nw-share button:hover {
  background: var(--lx-gold-soft);
  border-color: rgba(230, 194, 124, 0.55);
}

#neural-waifu-panel#neural-waifu-panel .nw-chart-chip {
  margin: 0;
  padding: 2px 18px 8px;
  font: 12px/1.45 var(--lx-sans);
  color: var(--lx-faint);
  opacity: 1;
  text-shadow: none;
  text-align: left;
}

/* Download offers and progress (rare). */
#neural-waifu-panel#neural-waifu-panel #nw-hd-offer {
  margin: 8px 14px 0;
  align-items: center;
}

#neural-waifu-panel#neural-waifu-panel .ns-progress {
  margin: 6px 16px;
  height: 2px;
  background: rgba(230, 194, 124, 0.14);
}

#neural-waifu-panel#neural-waifu-panel .ns-progress > div {
  background: var(--lx-gold);
}

/* ------------------------------------------------------------ tools: chart, tarot, match */

#neural-waifu-panel#neural-waifu-panel .lx-tools {
  display: flex;
  gap: 7px;
  padding: 10px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#neural-waifu-panel#neural-waifu-panel .lx-tools::-webkit-scrollbar {
  display: none;
}

#neural-waifu-panel#neural-waifu-panel .lx-tools button {
  flex: none !important;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  margin: 0;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  border: 1px solid var(--lx-line);
  background: var(--lx-fill);
  color: var(--lx-muted);
  font: 500 12.5px/1 var(--lx-sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#neural-waifu-panel#neural-waifu-panel .lx-tools button svg {
  width: 15px;
  height: 15px;
  color: var(--lx-gold);
}

#neural-waifu-panel#neural-waifu-panel .lx-tools button:hover,
#neural-waifu-panel#neural-waifu-panel .lx-tools button:focus-visible,
#neural-waifu-panel#neural-waifu-panel .lx-tools button.lx-on {
  color: var(--lx-text);
  border-color: rgba(230, 194, 124, 0.5);
  background: var(--lx-gold-soft);
  outline: none;
}

/* ------------------------------------------------------------ the input row */

#neural-waifu-panel#neural-waifu-panel .nw-talk > .np-row:last-child {
  display: flex;
  align-items: center;
  justify-content: stretch;
  gap: 8px;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 10px 12px 12px 14px;
  pointer-events: auto;
}

#neural-waifu-panel#neural-waifu-panel #nw-input {
  flex: 1 1 auto !important;
  min-width: 0;
  height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--lx-line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--lx-text);
  font: 400 15px/1 var(--lx-sans);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#neural-waifu-panel#neural-waifu-panel #nw-input::placeholder {
  color: var(--lx-faint);
  font: italic 400 17px/1 var(--lx-serif);
  opacity: 1;
}

#neural-waifu-panel#neural-waifu-panel #nw-input:focus {
  border-color: rgba(230, 194, 124, 0.5);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(230, 194, 124, 0.1);
}

#neural-waifu-panel#neural-waifu-panel #nw-send {
  display: grid !important;
  place-items: center;
  flex: 0 0 46px !important;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lx-gold-grad);
  color: var(--lx-ink);
  box-shadow: 0 8px 22px -8px rgba(230, 194, 124, 0.75), inset 0 1px 0 rgba(255, 250, 235, 0.6);
  font-size: 0;
  transition: transform 0.12s, filter 0.2s;
}

#neural-waifu-panel#neural-waifu-panel #nw-send svg {
  width: 19px;
  height: 19px;
}

#neural-waifu-panel#neural-waifu-panel #nw-send:hover {
  filter: brightness(1.06);
}

#neural-waifu-panel#neural-waifu-panel #nw-send:active {
  transform: scale(0.94);
}

#neural-waifu-panel#neural-waifu-panel #nw-mic {
  flex: 0 0 46px !important;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--lx-line);
  background: var(--lx-fill);
  color: var(--lx-gold);
  font-size: 0;
  place-items: center;
}

#neural-waifu-panel#neural-waifu-panel #nw-mic svg {
  width: 19px;
  height: 19px;
}

#neural-waifu-panel#neural-waifu-panel #nw-mic:not([style*='none']) {
  display: grid !important;
}

/* ------------------------------------------------------------ forms inside the card (birth, match, tarot) */

#neural-waifu-panel#neural-waifu-panel .nw-birth,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: auto;
  max-width: none;
  margin: 10px 12px 0;
  padding: 16px;
  gap: 10px;
  border-radius: 18px;
  border: 1px solid var(--lx-line);
  background: rgba(255, 242, 216, 0.035);
  box-shadow: none;
  pointer-events: auto;
}

#neural-waifu-panel#neural-waifu-panel .nw-birth-title,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-head {
  margin: 0 0 4px;
  font: 600 12px/1.3 var(--lx-caps);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f0d9a6;
}

#neural-waifu-panel#neural-waifu-panel .nw-birth-title span {
  display: block;
  margin-top: 5px;
  font: italic 400 15px/1.3 var(--lx-serif);
  letter-spacing: 0;
  text-transform: none;
  color: var(--lx-muted);
  opacity: 1;
}

#neural-waifu-panel#neural-waifu-panel .nw-birth label {
  gap: 6px;
  font: 600 10.5px/1.2 var(--lx-sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lx-faint);
}

#neural-waifu-panel#neural-waifu-panel .nw-birth .np-row {
  margin: 0;
  gap: 8px;
  align-items: flex-end;
}

#neural-waifu-panel#neural-waifu-panel .nw-birth input,
#neural-waifu-panel#neural-waifu-panel .nw-birth select,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q input {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--lx-line);
  background: rgba(0, 0, 0, 0.24);
  color: var(--lx-text);
  color-scheme: dark;
  font: 400 15px/1.2 var(--lx-sans);
  letter-spacing: 0;
  text-transform: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#neural-waifu-panel#neural-waifu-panel .nw-birth select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--lx-gold) 50%), linear-gradient(135deg, var(--lx-gold) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

#neural-waifu-panel#neural-waifu-panel .nw-birth input::placeholder,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q input::placeholder {
  color: var(--lx-faint);
}

#neural-waifu-panel#neural-waifu-panel .nw-birth input:focus,
#neural-waifu-panel#neural-waifu-panel .nw-birth select:focus,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q input:focus {
  border-color: rgba(230, 194, 124, 0.55);
  box-shadow: 0 0 0 4px rgba(230, 194, 124, 0.1);
}

#neural-waifu-panel#neural-waifu-panel .nw-birth-places {
  gap: 4px;
}

#neural-waifu-panel#neural-waifu-panel .nw-birth-places button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--lx-line);
  background: var(--lx-fill);
  color: var(--lx-text);
  font: 400 14.5px/1.2 var(--lx-sans);
}

#neural-waifu-panel#neural-waifu-panel .nw-birth-places button:hover,
#neural-waifu-panel#neural-waifu-panel .nw-birth-places button:focus-visible {
  background: var(--lx-gold-soft);
  border-color: rgba(230, 194, 124, 0.45);
}

#neural-waifu-panel#neural-waifu-panel #nw-birth-msg,
#neural-waifu-panel#neural-waifu-panel #nm-msg {
  font: 12px/1.35 var(--lx-sans) !important;
  letter-spacing: 0;
  text-transform: none;
  color: #e8b9a0;
}

/* Every button in the card: quiet glass, or gold when it's the main one (no cyan anywhere). */
#neural-waifu-panel#neural-waifu-panel .np-row button,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .ya-row button,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .ya-row a,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q div button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--lx-line-2);
  background: var(--lx-fill);
  color: var(--lx-text);
  font: 500 14px/1 var(--lx-sans);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, filter 0.2s;
}

#neural-waifu-panel#neural-waifu-panel .np-row button:hover,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .ya-row button:hover,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q div button:hover {
  border-color: rgba(230, 194, 124, 0.55);
  background: var(--lx-fill-2);
}

#neural-waifu-panel#neural-waifu-panel .np-row button.np-primary,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .np-primary {
  border: 0;
  background: var(--lx-gold-grad);
  color: var(--lx-ink);
  font: 600 12.5px/1 var(--lx-caps);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 8px 22px -10px rgba(230, 194, 124, 0.8), inset 0 1px 0 rgba(255, 250, 235, 0.55);
}

#neural-waifu-panel#neural-waifu-panel .np-row button.np-primary:hover,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .np-primary:hover {
  filter: brightness(1.06);
  background: var(--lx-gold-grad);
}

/* Luna's deck */
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu > button {
  min-height: 46px;
  margin: 0 0 6px;
  padding: 10px 14px;
  border-radius: 13px;
  border: 1px solid var(--lx-line);
  background: var(--lx-fill);
  align-items: baseline;
  transition: background 0.2s, border-color 0.2s;
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu > button:hover,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu > button:focus-visible {
  background: var(--lx-gold-soft);
  border-color: rgba(230, 194, 124, 0.45);
  outline: none;
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu > button b {
  font: 600 17px/1.2 var(--lx-serif);
  color: var(--lx-text);
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu > button i {
  font: italic 400 14px/1.2 var(--lx-serif);
  color: var(--lx-muted);
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu > button.tm-year {
  border-color: rgba(230, 194, 124, 0.4);
  background: linear-gradient(90deg, rgba(230, 194, 124, 0.16), rgba(230, 194, 124, 0.03));
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu > button.tm-year b {
  color: #f3dba5;
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q label {
  font: 600 16px/1.3 var(--lx-serif);
  color: var(--lx-text);
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q small {
  color: var(--lx-muted);
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q div,
#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .ya-row {
  gap: 8px;
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .ya-box p {
  font: 16px/1.45 var(--lx-serif);
  color: var(--lx-text);
}

#neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .ya-box .ya-cost {
  color: var(--lx-gold);
}

/* A form or the deck is open: it gets the room, the conversation steps back. */
#neural-waifu-panel#neural-waifu-panel:has(.nw-birth:not([hidden]), #nw-tarot-menu:not([hidden])) .nw-chat {
  max-height: min(18vh, 150px);
}

/* ------------------------------------------------------------ pop-up cards over the room */

#match-card {
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(230, 194, 124, 0.08), transparent 60%),
    var(--lx-glass-strong) !important;
  border: 1px solid var(--lx-line-2) !important;
  border-radius: 22px !important;
  box-shadow: var(--lx-shadow), var(--lx-hi) !important;
  -webkit-backdrop-filter: var(--lx-blur);
  backdrop-filter: var(--lx-blur);
  padding: 20px 20px 16px !important;
}

#match-card small {
  color: var(--lx-gold) !important;
}

#match-card .mc-total {
  background: radial-gradient(closest-side, #120f1c 80%, transparent 81% 100%), conic-gradient(#e6c27c calc(var(--p) * 1%), rgba(255, 255, 255, 0.07) 0) !important;
}

#match-card .mc-total i,
#match-card h3 span {
  color: var(--lx-muted) !important;
}

#match-card .mc-bars em i {
  background: linear-gradient(90deg, #a77d3c, #f0d39a) !important;
}

#match-card .mc-bars li,
#match-card .mc-doshas li,
#match-card .mc-mg {
  font-family: var(--lx-sans) !important;
  color: var(--lx-muted) !important;
}

#match-card .mc-x {
  color: var(--lx-muted) !important;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  top: 10px !important;
  right: 10px !important;
}

/* ------------------------------------------------------------ tablets and touch laptops */

@media (width <= 820px), (pointer: coarse) and (hover: none) {
  #neural-waifu-panel#neural-waifu-panel {
    border-radius: 24px;
    padding: 0;
  }

  #neural-waifu-panel#neural-waifu-panel .nw-chat {
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 100%);
  }

  #neural-waifu-panel#neural-waifu-panel .nw-msg,
  #neural-waifu-panel#neural-waifu-panel .nw-user,
  #neural-waifu-panel#neural-waifu-panel .nw-bot {
    text-shadow: none;
    font-size: inherit;
  }

  #neural-waifu-panel#neural-waifu-panel #nw-input,
  #neural-waifu-panel#neural-waifu-panel .nw-birth input,
  #neural-waifu-panel#neural-waifu-panel .nw-birth select,
  #neural-waifu-panel#neural-waifu-panel #nw-tarot-menu .tm-q input {
    font-size: 16px; /* 16 px or more: iOS doesn't zoom into the field */
  }

  #neural-waifu-panel#neural-waifu-panel #nw-tarot-open,
  #neural-waifu-panel#neural-waifu-panel #nw-birth-open,
  #neural-waifu-panel#neural-waifu-panel #nw-match-open {
    height: 34px;
    font-size: 13px;
    border-radius: 999px;
  }
}

/* ------------------------------------------------------------ phones: a bottom sheet */

@media (max-width: 640px) {
  #overlay {
    top: max(16px, calc(env(safe-area-inset-top) + 6px)) !important;
    left: 18px !important;
    max-width: calc(100vw - 186px);
  }

  #overlay h1 {
    font-size: 11px !important;
    letter-spacing: 0.26em !important;
    line-height: 1.5 !important;
  }

  #overlay h1::after {
    margin-top: 7px;
    width: 26px;
  }

  #overlay p {
    display: none;
  }

  html body #roam-btn {
    top: max(12px, calc(env(safe-area-inset-top) + 4px));
    right: max(14px, env(safe-area-inset-right));
    height: 38px;
    padding: 0 14px 0 12px;
    font-size: 12.5px;
  }

  /* The how-to sits just above the joystick it describes. */
  html body #roam-hint {
    left: 18px;
    right: auto;
    top: auto;
    bottom: calc(env(safe-area-inset-bottom) + 92px + 124px + 12px);
    max-width: 230px;
    padding: 9px 12px;
    font-size: 12px;
    text-align: left;
  }

  html body #roam-stick {
    left: max(18px, env(safe-area-inset-left));
  }

  html body #ix-pill {
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
    height: 46px;
    max-width: calc(100vw - 2 * (16px + 58px + 12px));
    padding: 0 18px;
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html body #sc-btn {
    top: calc(max(12px, env(safe-area-inset-top)) + 78px);
    height: 44px;
    font-size: 17px;
    padding: 0 18px;
  }

  #lx-fab {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px));
    width: 58px;
    height: 58px;
  }

  #lx-fab .lx-cap {
    font-size: 16px;
    height: 36px;
    right: calc(100% + 12px);
  }

  #neural-waifu-panel#neural-waifu-panel {
    left: 0;
    right: 0;
    bottom: var(--lx-kb);
    inset: auto 0 var(--lx-kb) 0;
    width: 100%;
    max-width: none;
    max-height: min(56dvh, calc(var(--lx-vh) - 48px));
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background:
      radial-gradient(120% 50% at 100% 0%, rgba(230, 194, 124, 0.07), transparent 60%),
      var(--lx-glass-sheet);
    transform-origin: 50% 100%;
  }

  html.lx-kb-open #neural-waifu-panel#neural-waifu-panel {
    max-height: calc(var(--lx-vh) - 16px);
    padding-bottom: 0;
  }

  #neural-waifu-panel#neural-waifu-panel.nw-away {
    transform: translateY(104%);
    opacity: 1;
  }

  /* A grab bar, so it reads as a sheet. */
  #neural-waifu-panel#neural-waifu-panel .auth-head::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 2px;
    background: rgba(255, 242, 216, 0.16);
  }

  #neural-waifu-panel#neural-waifu-panel .auth-head {
    padding: 18px 10px 12px 16px;
  }

  #neural-waifu-panel#neural-waifu-panel .lx-ava {
    width: 38px;
    height: 38px;
  }

  #neural-waifu-panel#neural-waifu-panel .lx-who b {
    font-size: 14px;
  }

  #neural-waifu-panel#neural-waifu-panel .nw-chat {
    max-height: none;
    padding: 16px 18px 6px;
  }

  #neural-waifu-panel#neural-waifu-panel .nw-bot span,
  #neural-waifu-panel#neural-waifu-panel .nw-guest span {
    font-size: 18px;
  }

  #neural-waifu-panel#neural-waifu-panel .nw-user span {
    font-size: 15px;
  }

  #neural-waifu-panel#neural-waifu-panel .lx-tools {
    padding: 8px 14px 0;
  }

  #neural-waifu-panel#neural-waifu-panel .nw-talk > .np-row:last-child {
    padding: 10px 12px 12px 14px;
  }

  /* A form or the deck gets most of the screen; the conversation hides until it's done. */
  #neural-waifu-panel#neural-waifu-panel:has(.nw-birth:not([hidden]), #nw-tarot-menu:not([hidden])) {
    max-height: min(86dvh, calc(var(--lx-vh) - 24px));
  }

  #neural-waifu-panel#neural-waifu-panel:has(.nw-birth:not([hidden]), #nw-tarot-menu:not([hidden])) .nw-chat {
    display: none;
  }

  /* Cards spread above her: the sheet steps down so they show. */
  body.ix-reading #neural-waifu-panel#neural-waifu-panel {
    max-height: 36dvh !important;
  }

  #match-card {
    top: max(12px, env(safe-area-inset-top)) !important;
  }
}

/* ------------------------------------------------------------ phones held sideways */

#lx-rotate {
  display: none;
}

@media (orientation: landscape) and (pointer: coarse) and (max-height: 540px) {
  #lx-rotate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 24px;
    text-align: center;
    color: var(--lx-text);
    background:
      radial-gradient(90% 80% at 50% 0%, rgba(74, 56, 112, 0.35), transparent 65%),
      radial-gradient(70% 60% at 50% 110%, rgba(230, 194, 124, 0.1), transparent 60%),
      #07070d;
  }

  #lx-rotate svg {
    width: 64px;
    height: 64px;
    color: var(--lx-gold);
    animation: lx-turn 2.8s var(--lx-ease) infinite;
  }

  #lx-rotate b {
    font: 600 13px/1.3 var(--lx-caps);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #f2e0b6;
  }

  #lx-rotate span {
    font: italic 400 18px/1.4 var(--lx-serif);
    color: var(--lx-muted);
  }

  #lx-rotate i {
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--lx-gold), transparent);
  }
}

@keyframes lx-turn {
  0%,
  20% {
    transform: rotate(-90deg);
  }
  55%,
  100% {
    transform: rotate(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #lx-fab::before,
  #lx-rotate svg,
  #neural-waifu-panel#neural-waifu-panel .nw-msg {
    animation: none !important;
  }
}

/* ------------------------------------------------------------ phones: "Tap" chip on the interact pill */

html.lx-touch body #ix-pill {
  gap: 10px;
  padding-left: 7px;
}

html.lx-touch body #ix-pill::before {
  content: 'Tap';
  flex: none;
  display: inline-grid;
  place-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(230, 194, 124, 0.5);
  background: var(--lx-gold-soft);
  color: #f3d999;
  font: 700 11px/1 var(--lx-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html.lx-touch body #ix-pill.on::before {
  animation: lxTapGlow 2.4s ease-in-out infinite;
}

@keyframes lxTapGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230, 194, 124, 0); }
  50% { box-shadow: 0 0 12px 1px rgba(230, 194, 124, 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  html.lx-touch body #ix-pill.on::before { animation: none; }
}

/* The walk hint never sits on top of her chat, a book or the telescope. */
html.lx-chat-open body #roam-hint,
html.lx-busy body #roam-hint {
  display: none !important;
}

/* ============================================================ phones: the chat sheet gets room to breathe */

@media (max-width: 640px) {
  #neural-waifu-panel#neural-waifu-panel {
    max-height: min(64dvh, calc(var(--lx-vh, 100dvh) - 48px));
  }

  /* The cards are shown full screen on phones now, so a reading no longer squeezes the sheet. */
  html.lx-touch body.ix-reading #neural-waifu-panel#neural-waifu-panel {
    max-height: min(64dvh, calc(var(--lx-vh, 100dvh) - 48px)) !important;
  }

  html.lx-sheet-tall #neural-waifu-panel#neural-waifu-panel,
  html.lx-sheet-tall.lx-touch body.ix-reading #neural-waifu-panel#neural-waifu-panel {
    max-height: calc(var(--lx-vh, 100dvh) - max(64px, calc(env(safe-area-inset-top) + 52px))) !important;
  }

  #neural-waifu-panel#neural-waifu-panel .auth-head {
    position: relative;
    padding: 16px 10px 8px 16px;
  }

  /* The grab bar is a real (larger) target now. */
  #neural-waifu-panel#neural-waifu-panel .auth-head::before {
    width: 44px;
    height: 5px;
    margin-left: -22px;
    background: rgba(255, 242, 216, 0.28);
    pointer-events: none;
  }

  #neural-waifu-panel#neural-waifu-panel .lx-grab {
    position: absolute;
    top: 0;
    left: 50%;
    width: 120px;
    height: 22px;
    margin-left: -60px;
    padding: 0;
    border: 0;
    background: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* The chart summary: one quiet line, tap to read it all. */
  #neural-waifu-panel#neural-waifu-panel .nw-chart-chip {
    padding: 2px 18px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  #neural-waifu-panel#neural-waifu-panel .nw-chart-chip.lx-open {
    white-space: normal;
  }

  #neural-waifu-panel#neural-waifu-panel .nw-chat {
    min-height: 120px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* The floating 3D card title and spread labels are replaced by the full-screen reveal on phones. */
html.lx-touch #card-title,
html.lx-touch #spread-labels {
  display: none !important;
}

/* ============================================================ phones: tarot on the whole screen */

#lx-tarot {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: stretch;
  justify-content: center;
  color: var(--lx-text);
  opacity: 0;
  transition: opacity 0.38s var(--lx-ease);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#lx-tarot[hidden] {
  display: none;
}

#lx-tarot.on {
  opacity: 1;
}

#lx-tarot .lt-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 45% at 50% 34%, rgba(150, 110, 230, 0.22), transparent 70%),
    radial-gradient(90% 60% at 50% 40%, rgba(230, 194, 124, 0.1), transparent 75%),
    rgb(8, 7, 16);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* drifting gold motes */
#lx-tarot .lt-motes {
  position: absolute;
  inset: 0 0 -40px;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255, 222, 160, 0.9), transparent 60%),
    radial-gradient(1px 1px at 82% 14%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(1.5px 1.5px at 70% 62%, rgba(255, 222, 160, 0.7), transparent 60%),
    radial-gradient(1px 1px at 26% 74%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(2px 2px at 48% 8%, rgba(255, 222, 160, 0.6), transparent 60%),
    radial-gradient(1px 1px at 92% 46%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 6% 52%, rgba(255, 222, 160, 0.6), transparent 60%);
  animation: ltDrift 14s linear infinite;
}

@keyframes ltDrift {
  from { transform: translateY(0); }
  to { transform: translateY(-40px); }
}

#lx-tarot .lt-x {
  position: absolute;
  z-index: 3;
  top: max(14px, calc(env(safe-area-inset-top) + 8px));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--lx-line-2);
  background: rgba(13, 11, 21, 0.6);
  color: var(--lx-text);
}

#lx-tarot .lt-x svg {
  width: 18px;
  height: 18px;
}

#lx-tarot .lt-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(22px, calc(env(safe-area-inset-top) + 14px)) 18px max(16px, calc(env(safe-area-inset-bottom) + 12px));
  min-height: 0;
}

#lx-tarot .lt-kicker {
  margin: 4px 56px 10px;
  font: italic 500 17px/1.25 var(--lx-serif);
  color: rgba(214, 196, 255, 0.85);
  text-align: center;
  letter-spacing: 0.02em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

#lx-tarot .lt-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 14px 10px;
  perspective: 1400px;
}

/* ---- one card */

#lx-tarot .lt-card {
  position: relative;
  aspect-ratio: 720 / 1240;
  opacity: 0;
  transform: translateY(46px) scale(0.72);
  transition: opacity 0.6s var(--lx-ease), transform 0.9s cubic-bezier(0.2, 0.9, 0.2, 1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#lx-tarot .lt-card.in {
  opacity: 1;
  transform: none;
}

#lx-tarot.single .lt-card {
  height: 100%;
  max-height: 60dvh;
  max-width: 76vw;
}

#lx-tarot .lt-inner {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: transform 0.95s cubic-bezier(0.3, 0.7, 0.2, 1);
}

#lx-tarot .lt-card.flipped .lt-inner {
  transform: rotateY(180deg);
}

#lx-tarot .lt-card.tremble .lt-inner {
  animation: ltTremble 0.16s ease-in-out infinite alternate;
}

@keyframes ltTremble {
  from { transform: rotateY(-2.5deg) translateY(-1px); }
  to { transform: rotateY(2.5deg) translateY(1px); }
}

#lx-tarot .lt-side {
  position: absolute;
  inset: 0;
  border-radius: 4.5% / 2.6%;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: #15123a;
  box-shadow: 0 0 0 1px rgba(230, 194, 124, 0.55), 0 18px 40px rgba(0, 0, 0, 0.6);
}

#lx-tarot .lt-front {
  transform: rotateY(180deg);
}

#lx-tarot .lt-side img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* the glow behind it: builds while it trembles, flashes as it turns, then breathes */
#lx-tarot .lt-card::before {
  content: '';
  position: absolute;
  inset: -16%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 222, 160, 0.55), rgba(170, 130, 255, 0.22) 55%, transparent 100%);
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

#lx-tarot .lt-card.tremble::before {
  opacity: 0.8;
}

#lx-tarot .lt-card.flipped::before {
  opacity: 0.6;
  animation: ltFlash 1.1s ease-out 1, ltBreathe 3.2s ease-in-out 1.1s infinite;
}

@keyframes ltFlash {
  0% { opacity: 0.8; transform: scale(1); }
  30% { opacity: 1; transform: scale(1.18); }
  100% { opacity: 0.6; transform: scale(1); }
}

@keyframes ltBreathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.75; }
}

/* ---- a spread: a grid, sized by how many cards there are */

#lx-tarot.spread .lt-card { width: 26vw; max-width: 150px; }
#lx-tarot.spread.n1 .lt-card { width: auto; height: 100%; max-height: 54dvh; max-width: 70vw; }
#lx-tarot.spread.n2 .lt-card { width: 38vw; max-width: 190px; }
#lx-tarot.spread.n3 .lt-card { width: 28vw; max-width: 170px; }
#lx-tarot.spread.n5 .lt-card,
#lx-tarot.spread.n6 .lt-card { width: 27vw; max-width: 140px; }
#lx-tarot.spread.n7 .lt-card,
#lx-tarot.spread.n8 .lt-card,
#lx-tarot.spread.n9 .lt-card,
#lx-tarot.spread.n10 .lt-card { width: 17vw; max-width: 100px; }

#lx-tarot .lt-pos {
  position: absolute;
  left: -8px;
  right: -8px;
  top: calc(100% + 6px);
  margin: 0;
  text-align: center;
  line-height: 1.15;
  opacity: 0;
  transition: opacity 0.5s ease 0.5s;
}

#lx-tarot .lt-card.flipped .lt-pos {
  opacity: 1;
}

#lx-tarot .lt-pos b {
  display: block;
  font: 600 10px/1.2 var(--lx-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lx-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#lx-tarot .lt-pos i {
  display: block;
  font: italic 12px/1.2 var(--lx-serif);
  color: var(--lx-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#lx-tarot.spread .lt-stage {
  row-gap: 42px;
  padding-bottom: 30px;
}

#lx-tarot.spread.n7 .lt-pos i,
#lx-tarot.spread.n8 .lt-pos i,
#lx-tarot.spread.n9 .lt-pos i,
#lx-tarot.spread.n10 .lt-pos i { display: none; }

/* ---- the name, then her reading */

#lx-tarot .lt-title {
  flex: none;
  margin: 14px 0 4px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s var(--lx-ease), transform 0.7s var(--lx-ease);
}

#lx-tarot.named .lt-title {
  opacity: 1;
  transform: none;
}

#lx-tarot .lt-title b {
  display: block;
  font: 600 clamp(21px, 6.6vw, 30px)/1.12 'Cinzel', var(--lx-serif);
  letter-spacing: 0.07em;
  color: #f3e0b0;
  text-shadow: 0 0 22px rgba(230, 194, 124, 0.45);
}

#lx-tarot .lt-title i {
  display: block;
  margin-top: 5px;
  font: italic 15px/1.3 var(--lx-serif);
  color: var(--lx-muted);
}

#lx-tarot .lt-read {
  flex: 0 1 auto;
  width: 100%;
  max-height: 24dvh;
  margin: 4px 0 10px;
  padding: 0 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 0.6s ease;
  -webkit-mask-image: linear-gradient(transparent, #000 12px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(transparent, #000 12px, #000 calc(100% - 14px), transparent);
  -webkit-user-select: text;
  user-select: text;
}

#lx-tarot.named .lt-read {
  opacity: 1;
}

#lx-tarot .lt-read p {
  margin: 10px 0;
  font: 18px/1.5 var(--lx-serif);
  color: var(--lx-text);
  text-align: center;
}

#lx-tarot .lt-read .lt-wait {
  color: var(--lx-muted);
  font-style: italic;
  font-size: 16px;
}

#lx-tarot.reading .lt-wait {
  display: none;
}

#lx-tarot .lt-wait span {
  animation: ltDot 1.2s infinite;
}

#lx-tarot .lt-wait span:nth-child(2) { animation-delay: 0.2s; }
#lx-tarot .lt-wait span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ltDot {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

#lx-tarot .lt-acts {
  flex: none;
  display: flex;
  justify-content: center;
  width: 100%;
  opacity: 0;
  transition: opacity 0.6s ease 0.3s;
}

#lx-tarot.named .lt-acts {
  opacity: 1;
}

#lx-tarot .lt-chat {
  min-width: 220px;
  height: 50px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1px solid rgba(240, 214, 160, 0.7);
  background: linear-gradient(180deg, rgba(240, 210, 150, 0.96), rgba(205, 163, 92, 0.96));
  color: #1a1206;
  font: 600 16px/1 var(--lx-sans);
  letter-spacing: 0.02em;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 22px rgba(230, 194, 124, 0.3);
  -webkit-tap-highlight-color: transparent;
}

#lx-tarot .lt-chat:active {
  transform: scale(0.97);
}

/* a card up close */
#lx-tarot .lt-zoom {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  background: rgba(5, 4, 10, 0.94);
}

#lx-tarot .lt-zoom[hidden] {
  display: none;
}

#lx-tarot .lt-zoom .lt-card {
  height: 66dvh;
  max-width: 84vw;
  opacity: 1;
  transform: none;
}

#lx-tarot .lt-zcap {
  margin: 0;
  text-align: center;
}

#lx-tarot .lt-zcap b {
  display: block;
  font: 600 22px/1.2 'Cinzel', var(--lx-serif);
  letter-spacing: 0.06em;
  color: #f3e0b0;
}

#lx-tarot .lt-zcap i {
  display: block;
  margin-top: 4px;
  font: italic 15px/1.3 var(--lx-serif);
  color: var(--lx-muted);
}

/* short phones (SE, mini): a little less card, a little more reading */
@media (max-height: 680px) {
  #lx-tarot.single .lt-card { max-height: 50dvh; }
  #lx-tarot .lt-read { max-height: 22dvh; }
  #lx-tarot .lt-read p { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  #lx-tarot .lt-motes,
  #lx-tarot .lt-card.tremble .lt-inner,
  #lx-tarot .lt-card.flipped::before { animation: none; }
}

/* while her birth details are being read from a chat message */
#neural-waifu-panel#neural-waifu-panel #nw-input.lx-casting {
  opacity: 0.55;
}
