:root {
  color-scheme: light dark;
  --glass-bg: rgba(255, 255, 255, 0.14);
  --glass-bg-strong: rgba(255, 255, 255, 0.22);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-highlight: rgba(255, 255, 255, 0.65);
  --text-primary: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.72);
  --text-faint: rgba(255, 255, 255, 0.5);
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.35);
  --shadow-color: rgba(0, 20, 60, 0.45);
}

* {
  box-sizing: border-box;
}

.sound-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 22, 28, 0.55);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.sound-toggle:hover {
  background: rgba(20, 22, 28, 0.75);
  transform: translateY(-1px);
}

.sound-toggle[aria-pressed="true"] {
  color: rgba(255, 255, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.2);
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(160deg, #0d1550 0%, #341d7a 26%, #5c1e8c 52%, #8a1e78 76%, #b32e5c 100%);
  background-size: 250% 250%;
  animation: gradient-shift 24s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes gradient-shift {
  0% { background-position: 0% 30%; }
  50% { background-position: 100% 70%; }
  100% { background-position: 0% 30%; }
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.aurora {
  position: absolute;
  inset: -60%;
  background: conic-gradient(
    from 0deg,
    rgba(120, 180, 255, 0.75),
    rgba(255, 130, 220, 0.75),
    rgba(180, 130, 255, 0.75),
    rgba(255, 200, 120, 0.75),
    rgba(120, 180, 255, 0.75)
  );
  filter: blur(50px);
  animation: spin 30s linear infinite;
  opacity: 0.9;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(6px);
  opacity: 1;
  mix-blend-mode: normal;
  box-shadow: 0 0 120px 40px currentColor;
  animation: float 34s ease-in-out infinite, pulse 11s ease-in-out infinite;
  will-change: transform, opacity;
  cursor: pointer;
  pointer-events: auto;
}

/* Pop replaces float/pulse entirely so the burst is actually visible
   instead of being masked by the still-running float animation. */
.orb.popped {
  animation: pop-burst 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.orb-1 {
  width: 420px;
  height: 420px;
  top: -100px;
  left: -100px;
  color: #4fd8ff;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #4fd8ff 42%, transparent 72%);
  animation-duration: 34s, 11s;
  animation-delay: 0s, 0s;
}

.orb-2 {
  width: 460px;
  height: 460px;
  bottom: -120px;
  right: -120px;
  color: #ff2fb0;
  background: radial-gradient(circle at 60% 40%, #ffffff 0%, #ff2fb0 42%, transparent 72%);
  animation-duration: 38s, 12.5s;
  animation-delay: -5s, -2s;
}

.orb-3 {
  width: 340px;
  height: 340px;
  top: 38%;
  left: 55%;
  color: #a52fff;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #a52fff 42%, transparent 72%);
  animation-duration: 28s, 9.5s;
  animation-delay: -10s, -4s;
}

.orb-4 {
  width: 280px;
  height: 280px;
  top: 62%;
  left: 6%;
  color: #ffb100;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #ffb100 42%, transparent 72%);
  animation-duration: 32s, 11.8s;
  animation-delay: -2.5s, -4.5s;
}

/* A single smooth loop (ease-in-out, no direction reversals mid-segment)
   instead of a jagged multi-waypoint zig-zag, so the drift reads as
   calm rather than erratic. */
@keyframes float {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  25% { transform: translate(16vw, -10vh) scale(1.2) rotate(6deg); }
  50% { transform: translate(6vw, 12vh) scale(0.9) rotate(-4deg); }
  75% { transform: translate(-14vw, -4vh) scale(1.1) rotate(5deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

@keyframes pop-burst {
  0% { transform: scale(1); opacity: 1; }
  35% { transform: scale(1.5); opacity: 0.75; }
  70% { transform: scale(2.1); opacity: 0.25; }
  100% { transform: scale(2.6); opacity: 0; }
}

.stage {
  animation: shimmer-sweep 9s ease-in-out infinite;
}

@keyframes shimmer-sweep {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.1) saturate(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .orb,
  .aurora,
  .stage {
    animation: none !important;
  }
}

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* .stage spans the full viewport width/height as an invisible flex
     box around the card, which would otherwise sit above the orbs and
     swallow every click meant for them. Make it click-through and only
     re-enable pointer events on the card itself. */
  pointer-events: none;
}

.glass-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 40px 32px 32px;
  border-radius: 32px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 8px 32px var(--shadow-color),
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  overflow: hidden;
  pointer-events: auto;
}

.glass-card__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.15) 100%);
  pointer-events: none;
}

.brand {
  position: relative;
  text-align: center;
  margin-bottom: 28px;
}

.brand__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 4px 16px rgba(0, 0, 0, 0.15);
}

.brand h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  padding-left: 4px;
}

.field input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:focus {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field__password {
  position: relative;
}

.field__password input {
  padding-right: 44px;
}

.toggle-visibility {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.2s ease, background 0.2s ease;
}

.toggle-visibility:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.15);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  display: none;
}

.checkbox__box {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.checkbox__box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.checkbox input:checked + .checkbox__box {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox input:checked + .checkbox__box::after {
  opacity: 1;
}

.link-muted {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.link-muted:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.btn-primary {
  margin-top: 6px;
  padding: 14px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(160deg, #4fa3ff, #0a6cff);
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(10, 108, 255, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow:
    0 8px 26px rgba(10, 108, 255, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px;
  color: var(--text-faint);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
}

.social-row {
  display: flex;
  gap: 12px;
}

.btn-social {
  flex: 1;
  padding: 11px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-social:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

.signup-hint {
  position: relative;
  margin: 24px 0 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.link-accent {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.link-accent:hover {
  text-decoration: underline;
}

@media (max-width: 420px) {
  .glass-card {
    padding: 32px 22px 26px;
    border-radius: 26px;
  }
}

/* Transition out of the sign-in screen once the bubbles have popped. */
body.leaving .backdrop,
body.leaving .stage {
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

body.leaving {
  animation: none;
  background: #000;
  transition: background 0.6s ease;
}

/* Freeze every still-running background animation once the matrix
   screen's own crack/shatter sequence starts, so it isn't fighting them
   for the main thread on slower devices. */
body.frozen .orb,
body.frozen .aurora,
body.frozen .stage {
  animation-play-state: paused !important;
}

/* --- Matrix screen --- */

.matrix-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  opacity: 0;
  animation: matrix-fade-in 1s ease forwards;
}

.matrix-screen[hidden] {
  display: none;
}

@keyframes matrix-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.matrix-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-inner.shaking {
  animation: screen-shake 0.5s ease-in-out;
}

@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-8px, 4px); }
  20% { transform: translate(7px, -6px); }
  30% { transform: translate(-6px, 7px); }
  40% { transform: translate(8px, -3px); }
  50% { transform: translate(-7px, 4px); }
  60% { transform: translate(6px, -7px); }
  70% { transform: translate(-4px, 3px); }
  80% { transform: translate(7px, -4px); }
  90% { transform: translate(-3px, 5px); }
}

#matrix-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.matrix-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 32px;
  margin: 0 16px;
  text-align: center;
  font-family: "Courier New", Courier, monospace;
  color: #00ff41;
  border: 1px solid rgba(0, 255, 65, 0.4);
  background: rgba(0, 10, 0, 0.55);
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.25), inset 0 0 40px rgba(0, 255, 65, 0.08);
}

.matrix-line {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.3em;
  opacity: 0.8;
  animation: matrix-flicker 2.4s ease-in-out infinite;
}

.matrix-title {
  margin: 0 0 28px;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-shadow: 0 0 8px #00ff41, 0 0 20px rgba(0, 255, 65, 0.6);
}

@keyframes matrix-flicker {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.4; }
}

.matrix-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}

.matrix-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  letter-spacing: 0.05em;
}

.matrix-field input {
  font-family: inherit;
  font-size: 15px;
  color: #00ff41;
  background: rgba(0, 255, 65, 0.06);
  border: 1px solid rgba(0, 255, 65, 0.4);
  padding: 10px 12px;
  outline: none;
  caret-color: #00ff41;
}

.matrix-field input:focus {
  background: rgba(0, 255, 65, 0.12);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.35);
}

.matrix-field input::placeholder {
  color: rgba(0, 255, 65, 0.4);
}

.matrix-btn {
  margin-top: 6px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: #00ff41;
  background: rgba(0, 255, 65, 0.1);
  border: 1px solid #00ff41;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.matrix-btn:hover {
  background: rgba(0, 255, 65, 0.2);
  box-shadow: 0 0 16px rgba(0, 255, 65, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .matrix-screen,
  .matrix-line {
    animation: none !important;
  }
}

/* --- Screen-crack transition: fracture forms, then the glass shatters --- */

.crack-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
}

.crack-overlay.show {
  opacity: 1;
}

.impact-flash {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.4) 40%, transparent 72%);
  opacity: 0;
  transform: scale(0.4);
}

.crack-overlay.show .impact-flash {
  animation: impact-pop 0.35s ease-out forwards;
}

@keyframes impact-pop {
  0% { opacity: 0; transform: scale(0.2); }
  25% { opacity: 1; transform: scale(1.6); }
  100% { opacity: 0; transform: scale(3.2); }
}

.crack-overlay svg {
  width: 100%;
  height: 100%;
}

.crack-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

/* The 8 main fractures, radiating from the impact point. */
.crack-path--fine {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 0.4;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  filter:
    drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.9))
    drop-shadow(0.15px 0 0.5px rgba(0, 229, 255, 0.55))
    drop-shadow(-0.15px 0 0.5px rgba(255, 46, 151, 0.4));
}

/* Secondary offshoots branching off the main fractures, drawn slightly
   after so the break reads as spreading rather than appearing at once. */
.crack-path--branch {
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 0.28;
  stroke-dasharray: 18;
  stroke-dashoffset: 18;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.75));
}

/* Fine hairline cracks right at the impact point. */
.crack-path--hair {
  stroke: rgba(255, 255, 255, 0.65);
  stroke-width: 0.15;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  filter: drop-shadow(0 0 0.8px rgba(255, 255, 255, 0.7));
}

.crack-overlay.show .crack-path {
  opacity: 1;
  animation: crack-draw 0.22s ease-out forwards;
}

.crack-overlay.show .crack-path--fine { animation-duration: 0.26s; }
.crack-overlay.show .crack-path--fine:nth-of-type(2) { animation-delay: 0.015s; }
.crack-overlay.show .crack-path--fine:nth-of-type(3) { animation-delay: 0.035s; }
.crack-overlay.show .crack-path--fine:nth-of-type(4) { animation-delay: 0.02s; }
.crack-overlay.show .crack-path--fine:nth-of-type(5) { animation-delay: 0.04s; }
.crack-overlay.show .crack-path--fine:nth-of-type(6) { animation-delay: 0.01s; }
.crack-overlay.show .crack-path--fine:nth-of-type(7) { animation-delay: 0.045s; }
.crack-overlay.show .crack-path--fine:nth-of-type(8) { animation-delay: 0.025s; }

.crack-overlay.show .crack-path--branch {
  animation-delay: 0.15s;
}

.crack-overlay.show .crack-path--branch:nth-of-type(3n) { animation-delay: 0.17s; }
.crack-overlay.show .crack-path--branch:nth-of-type(4n) { animation-delay: 0.2s; }

.crack-overlay.show .crack-path--hair {
  animation-delay: 0.02s;
}

@keyframes crack-draw {
  to { stroke-dashoffset: 0; }
}

/* Shards fly apart along the fracture once it has formed. Generated at
   runtime (script.js) so the break pattern is different every time. */
.shatter-shards {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.shatter-shards[hidden] {
  display: none;
}

.shard {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(160, 220, 255, 0.06) 30%, rgba(0, 0, 0, 0.94) 78%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  opacity: 1;
  transform: translate(0, 0) rotate(0deg) scale(1);
  transition: transform 0.62s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.62s ease-in;
  will-change: transform, opacity;
}

.shatter-shards.fly .shard {
  opacity: 0;
  transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.5);
}

.transition-veil {
  position: fixed;
  inset: 0;
  z-index: 21;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.transition-veil.show {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .matrix-inner.shaking,
  .crack-overlay.show .crack-path,
  .crack-overlay.show .impact-flash,
  .shard {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Notes screen: cyberpunk terminal ---
   Grounded, not arcade: one dark base, two neon accents (cyan + magenta),
   used as light sources (glow/borders/text) rather than filled color. */

.notes-screen {
  --np-cyan: #00e5ff;
  --np-magenta: #ff2e97;
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  background: #05070a;
  color: #c9d1d9;
  font-family: "IBM Plex Mono", "Courier New", Consolas, monospace;
  opacity: 0;
  animation: notes-fade-in 0.5s ease forwards;
  overflow: hidden;
}

.notes-screen[hidden] {
  display: none;
}

@keyframes notes-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* City silhouette + perspective neon grid horizon, the classic
   cyberpunk skyline cue, kept low-contrast so it reads as backdrop. */
.notes-skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  height: 30%;
  opacity: 0.55;
}

.notes-skyline svg {
  width: 100%;
  height: 100%;
}

.notes-skyline rect {
  fill: #0d1520;
}

.notes-skyline .skyline-windows rect {
  fill: var(--np-cyan);
  opacity: 0.5;
  animation: window-flicker 5s ease-in-out infinite;
}

.notes-skyline .skyline-windows rect:nth-child(3n) {
  fill: var(--np-magenta);
  animation-delay: -1.4s;
}

.notes-skyline .skyline-windows rect:nth-child(4n) {
  animation-delay: -3s;
}

@keyframes window-flicker {
  0%, 40%, 100% { opacity: 0.55; }
  45% { opacity: 0.1; }
  50% { opacity: 0.55; }
}

.notes-grid {
  position: absolute;
  left: -25%;
  right: -25%;
  bottom: 0;
  height: 20%;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 46, 151, 0.28) 1px, transparent 1px);
  background-size: 42px 42px, 42px 42px;
  transform: perspective(220px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, black 0%, transparent 92%);
  -webkit-mask-image: linear-gradient(to top, black 0%, transparent 92%);
}

.notes-horizon-glow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--np-cyan) 30%, var(--np-magenta) 70%, transparent);
  box-shadow: 0 0 18px 3px rgba(0, 229, 255, 0.5);
}

.notes-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.notes-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.3);
  background: linear-gradient(to bottom, rgba(0, 229, 255, 0.06), transparent);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8b96a1;
}

.notes-header__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notes-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logout-btn {
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  padding: 6px 12px;
  color: var(--np-magenta);
  background: rgba(255, 46, 151, 0.08);
  border: 1px solid rgba(255, 46, 151, 0.45);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255, 46, 151, 0.18);
  box-shadow: 0 0 14px rgba(255, 46, 151, 0.4);
}

.notes-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--np-cyan);
  box-shadow: 0 0 8px 2px rgba(0, 229, 255, 0.8);
  animation: dot-pulse 2.4s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.notes-glitch {
  position: relative;
  color: #e8fbff;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.7);
  letter-spacing: 0.16em;
}

.notes-glitch::before,
.notes-glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  opacity: 0;
}

.notes-glitch::before {
  color: var(--np-cyan);
  animation: glitch-slice 6s steps(1) infinite;
}

.notes-glitch::after {
  color: var(--np-magenta);
  animation: glitch-slice 6s steps(1) infinite reverse;
}

@keyframes glitch-slice {
  0%, 92%, 100% { opacity: 0; transform: translate(0, 0); clip-path: inset(0 0 0 0); }
  93% { opacity: 0.8; transform: translate(-2px, 0); clip-path: inset(10% 0 70% 0); }
  94% { opacity: 0.8; transform: translate(2px, 0); clip-path: inset(60% 0 10% 0); }
  95% { opacity: 0; }
}

.notes-body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 28px;
  overflow: hidden;
}

.notes-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #5b6570;
  text-transform: uppercase;
}

.accent-cyan {
  color: var(--np-cyan);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
}

.accent-magenta {
  color: var(--np-magenta);
  text-shadow: 0 0 6px rgba(255, 46, 151, 0.5);
}

.notes-area-frame {
  position: relative;
  flex: 1;
  display: flex;
  padding: 3px;
}

.hud-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 2;
}

.hud-corner--tl {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--np-cyan);
  border-left: 2px solid var(--np-cyan);
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.7));
}

.hud-corner--tr {
  top: -1px;
  right: -1px;
  border-top: 2px solid var(--np-magenta);
  border-right: 2px solid var(--np-magenta);
  filter: drop-shadow(0 0 4px rgba(255, 46, 151, 0.7));
}

.hud-corner--bl {
  bottom: -1px;
  left: -1px;
  border-bottom: 2px solid var(--np-magenta);
  border-left: 2px solid var(--np-magenta);
  filter: drop-shadow(0 0 4px rgba(255, 46, 151, 0.7));
}

.hud-corner--br {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--np-cyan);
  border-right: 2px solid var(--np-cyan);
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.7));
}

.notes-area {
  flex: 1;
  resize: none;
  outline: none;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(8, 12, 18, 0.85);
  color: #d7dee5;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  padding: 18px;
  caret-color: var(--np-cyan);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.08), inset 0 0 30px rgba(0, 0, 0, 0.4);
}

.notes-area::placeholder {
  color: #454e56;
}

.notes-area:focus {
  border-color: rgba(0, 229, 255, 0.7);
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.25), inset 0 0 30px rgba(0, 0, 0, 0.4);
}

.notes-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  padding: 12px 28px;
  border-top: 1px solid rgba(255, 46, 151, 0.25);
  background: linear-gradient(to top, rgba(255, 46, 151, 0.05), transparent);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #5b6570;
  text-transform: uppercase;
}

@media (max-width: 560px) {
  .notes-header,
  .notes-body,
  .notes-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notes-glitch::before,
  .notes-glitch::after,
  .notes-dot,
  .skyline-windows rect {
    animation: none !important;
  }
}

/* --- Saloon-door transition: swings shut, screens swap behind it,
   swings back open onto the western screen. --- */

.saloon-doors {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  perspective: 1400px;
  visibility: hidden;
}

.saloon-doors.active {
  visibility: visible;
}

.saloon-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background:
    repeating-linear-gradient(90deg, #5c3a22 0px, #5c3a22 10px, #4a2e1a 10px, #4a2e1a 20px);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.65);
  backface-visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.6, 0, 0.4, 1);
}

.saloon-door::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e8c07a, #8a6a2f 70%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}

.saloon-door--left {
  left: 0;
  transform-origin: left center;
  transform: rotateY(-105deg);
}

.saloon-door--left::before {
  right: 14px;
}

.saloon-door--right {
  right: 0;
  transform-origin: right center;
  transform: rotateY(105deg);
}

.saloon-door--right::before {
  left: 14px;
}

.saloon-doors.closed .saloon-door--left,
.saloon-doors.closed .saloon-door--right {
  transform: rotateY(0deg);
}

@media (prefers-reduced-motion: reduce) {
  .saloon-door {
    transition: none !important;
  }
}

/* --- Western screen: logged-out / wanted-poster scene --- */

.western-screen {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(to bottom, #f2c877 0%, #e8a856 35%, #c97b3f 65%, #8a4f2a 100%);
  font-family: "Special Elite", "Courier New", monospace;
}

.western-screen[hidden] {
  display: none;
}

.western-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 38%, rgba(255, 235, 190, 0.5), transparent 70%);
}

.western-sun {
  position: absolute;
  left: 50%;
  top: 26%;
  width: 130px;
  height: 130px;
  margin: -65px 0 0 -65px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3d6 0%, #ffcf6b 55%, #f2a53c 100%);
  box-shadow: 0 0 60px 20px rgba(255, 190, 90, 0.5);
}

.western-mesas {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14%;
  height: 22%;
  opacity: 0.85;
}

.western-mesas svg {
  width: 100%;
  height: 100%;
}

.western-mesas polygon {
  fill: #7a3f22;
}

.western-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  background: linear-gradient(to bottom, #6b3a1f, #4a2712);
}

.tumbleweed {
  position: absolute;
  bottom: 15%;
  left: -60px;
  color: #5a3a1c;
  opacity: 0.8;
  animation: tumbleweed-roll 9s linear infinite;
}

@keyframes tumbleweed-roll {
  0% { left: -60px; transform: rotate(0deg); }
  100% { left: 105%; transform: rotate(900deg); }
}

.wanted-poster {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 20px;
  padding: 40px 32px 34px;
  text-align: center;
  background: #f2e2b8;
  background-image:
    radial-gradient(circle at 20% 25%, rgba(139, 94, 43, 0.12), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(139, 94, 43, 0.12), transparent 40%);
  border: 10px solid #4a2712;
  outline: 2px solid #2b1608;
  outline-offset: -16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color: #3a2412;
}

.wanted-poster__pin {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d8d8d8, #6b6b6b 75%);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.5);
}

.wanted-badge {
  display: inline-block;
  color: #8a1f1f;
  margin-bottom: 6px;
}

.wanted-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.25em;
  color: #8a1f1f;
}

.wanted-title {
  font-family: "Rye", "Georgia", serif;
  font-weight: 400;
  font-size: 34px;
  line-height: 1.15;
  margin: 6px 0 18px;
  letter-spacing: 0.03em;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
}

.wanted-rule {
  height: 2px;
  margin: 0 auto 18px;
  width: 70%;
  background: repeating-linear-gradient(90deg, #3a2412 0 8px, transparent 8px 14px);
}

.wanted-body {
  margin: 0 0 26px;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.wanted-btn {
  font-family: "Rye", "Georgia", serif;
  font-size: 15px;
  letter-spacing: 0.06em;
  padding: 12px 28px;
  color: #f2e2b8;
  background: linear-gradient(to bottom, #7a3f22, #4a2712);
  border: 2px solid #2b1608;
  cursor: pointer;
  box-shadow: 0 4px 0 #2b1608, 0 6px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wanted-btn:hover {
  transform: translateY(1px);
  box-shadow: 0 3px 0 #2b1608, 0 5px 8px rgba(0, 0, 0, 0.35);
}

.wanted-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #2b1608, 0 2px 4px rgba(0, 0, 0, 0.35);
}

@media (max-width: 420px) {
  .wanted-poster {
    padding: 32px 22px 26px;
  }
  .wanted-title {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tumbleweed {
    animation: none !important;
  }
}
