/* ==========================================================================
   FURPHY RETRO THEME: SEGA DREAMCAST VMU
   Metaphor: Sega Dreamcast Visual Memory Unit (VMU) Chibi Virtual Pet
   Palette:
     - Console Hardware: #f2eee2 (Dreamcast off-white plastic, 13.59:1 WCAG AA PASS)
     - LCD Matrix Glass: #8ea891 (Olive LCD screen glass, 6.13:1 WCAG AA PASS)
     - LCD Pixels:       #18261b (Dark liquid crystal, 6.13:1 WCAG AA PASS)
     - Backlight Glow:   #3bf577 (Emerald night backlight, 10.90:1 WCAG AA PASS)
     - Plastic Bezel:    #424e44 (Recessed frame)
   ========================================================================== */

body[data-theme-layout="vmu"] {
  --sky: #1e222a;
  --sky-grad: none;
  --card: #8ea891;
  --ink: #18261b;
  --ink-soft: #2d4533;
  --slot: #849e87;
  --shadow-1: #18261b;
  --shadow-2: #18261b;
  --ab-cyan: #18261b;
  --ab-pink: #18261b;
  --chip-bg: rgba(24, 38, 27, 0.08);
  --dither: transparent;
  --w: #18261b;

  background-color: #1e222a !important;
  background-image: radial-gradient(circle at 50% 25%, #2e3543 0%, #171a21 100%) !important;
  background-attachment: fixed;
  color: #18261b !important;
  font-family: 'Press Start 2P', monospace !important;
  min-height: 100vh;
}

/* Hide ambient city / sunset canvas in VMU mode */
body[data-theme-layout="vmu"] .bg,
body[data-theme-layout="vmu"] #sun,
body[data-theme-layout="vmu"] #moon {
  display: none !important;
}

/* Dreamcast VMU Handheld Shell Container */
body[data-theme-layout="vmu"] main {
  max-width: 480px;
  margin: 2.2rem auto 4.5rem;
  background: #f2eee2 !important;
  border-radius: 28px 28px 46px 46px;
  border: 4px solid #18261b;
  box-shadow:
    0 20px 45px rgba(0, 0, 0, 0.65),
    inset 3px 3px 0 #ffffff,
    inset -3px -3px 0 #d1cabe,
    0 0 0 1px rgba(0, 0, 0, 0.2);
  padding: 2.4rem 1.4rem 2.8rem;
  position: relative;
  z-index: 1;
}

/* VMU Top Cap & Lanyard Loop Cutout */
body[data-theme-layout="vmu"] main::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 24px;
  background: #f2eee2;
  border: 4px solid #18261b;
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  box-shadow: inset 2px 2px 0 #ffffff, inset -2px 0 0 #d1cabe;
  z-index: 2;
}

body[data-theme-layout="vmu"] main::after {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 10px;
  background: #1e222a;
  border: 3px solid #18261b;
  border-radius: 6px;
  z-index: 3;
}

/* Debossed Visual Memory Unit Logo */
body[data-theme-layout="vmu"] .player::before {
  content: "SEGA  ·  VISUAL MEMORY UNIT";
  display: block;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  color: #4a544b;
  text-shadow: 1px 1px 0 #ffffff;
  margin-bottom: 1.2rem;
  text-align: center;
}

/* Recessed 48x32 Monochrome LCD Screen Window */
body[data-theme-layout="vmu"] .player {
  background: #424e44;
  border: 3px solid #283029;
  border-radius: 16px 16px 0 0;
  padding: 1.2rem 0.9rem 0.8rem;
  margin-bottom: 0;
  box-shadow:
    inset 3px 3px 8px rgba(0, 0, 0, 0.55),
    inset -2px -2px 6px rgba(255, 255, 255, 0.18),
    0 1px 0 #ffffff;
}

body[data-theme-layout="vmu"] .worlds {
  background: #424e44;
  border-left: 3px solid #283029;
  border-right: 3px solid #283029;
  border-bottom: 3px solid #283029;
  border-radius: 0 0 16px 16px;
  padding: 0.8rem 0.9rem 1.2rem;
  margin-bottom: 1.8rem;
  box-shadow:
    inset 3px -3px 8px rgba(0, 0, 0, 0.55),
    inset -2px -2px 6px rgba(255, 255, 255, 0.18),
    0 2px 0 #ffffff;
}

/* LCD Matrix Glass Texture */
body[data-theme-layout="vmu"] .player > :not(#sun):not(#moon),
body[data-theme-layout="vmu"] .vmu-pet-bar {
  position: relative;
  z-index: 1;
}

/* Tamagotchi Dratini Chibi Status Bar */
body[data-theme-layout="vmu"] .vmu-pet-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: #849e87;
  border: 2px solid #18261b;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  margin: 0.4rem 0 1rem;
  font-size: 0.55rem;
  line-height: 1.45;
  color: #18261b;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.3);
  user-select: none;
}

body[data-theme-layout="vmu"] .vmu-pet-title {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #18261b;
}

body[data-theme-layout="vmu"] .vmu-pet-stats {
  display: flex;
  gap: 0.8rem;
  font-size: 0.5rem;
  letter-spacing: 0.04em;
}

body[data-theme-layout="vmu"] .vmu-pet-hint {
  font-size: 0.46rem;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

/* Hide Pet Bar when not in VMU theme */
body:not([data-theme-layout="vmu"]) .vmu-pet-bar {
  display: none !important;
}

/* Dratini Chibi Avatar in LCD Matrix */
body[data-theme-layout="vmu"] .avatar-slot {
  width: 78px;
  height: 78px;
  background: #8ea891 !important;
  border: 3px solid #18261b !important;
  box-shadow: none !important;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  cursor: pointer;
  animation: none !important;
  transition: transform 0.15s ease;
}

body[data-theme-layout="vmu"] .avatar-slot:hover {
  transform: scale(1.08);
}

body[data-theme-layout="vmu"] .avatar-slot img {
  filter: grayscale(100%) contrast(350%) brightness(0.55);
  mix-blend-mode: multiply;
  image-rendering: pixelated;
}

/* Joyful Dratini Wiggle Jump Animation */
@keyframes vmu-wiggle {
  0% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-10px) rotate(-8deg) scale(1.12); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-10px) rotate(8deg) scale(1.12); }
  100% { transform: translateY(0) rotate(0deg); }
}

body[data-theme-layout="vmu"] .avatar-slot.vmu-wiggle {
  animation: vmu-wiggle 0.45s ease-in-out !important;
}

/* Header Text in LCD Screen */
body[data-theme-layout="vmu"] h1 {
  color: #18261b !important;
  text-shadow: none !important;
  font-size: 1.35rem !important;
  letter-spacing: 0.1em;
  margin: 0.2rem 0 0.3rem;
}

body[data-theme-layout="vmu"] .kana {
  color: #18261b !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.18em;
  margin: 0 0 0.4rem;
  opacity: 0.9;
}

body[data-theme-layout="vmu"] .tagline {
  color: #18261b !important;
  font-family: 'Press Start 2P', monospace !important;
  font-size: 0.58rem !important;
  line-height: 1.45 !important;
  letter-spacing: 0.04em;
  margin: 0 auto 0.8rem;
}

/* Social Buttons in LCD */
body[data-theme-layout="vmu"] .socials {
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

body[data-theme-layout="vmu"] .slot-btn {
  width: 40px !important;
  height: 40px !important;
  background: #849e87 !important;
  border: 2px solid #18261b !important;
  box-shadow: none !important;
  color: #18261b !important;
  border-radius: 4px;
  transition: background 0.08s, color 0.08s !important;
}

body[data-theme-layout="vmu"] .slot-btn canvas {
  filter: grayscale(100%) contrast(300%) brightness(0.5);
  mix-blend-mode: multiply;
}

body[data-theme-layout="vmu"] .slot-btn:hover,
body[data-theme-layout="vmu"] .slot-btn:focus-visible {
  background: #18261b !important;
  color: #8ea891 !important;
  transform: none !important;
}

body[data-theme-layout="vmu"] .slot-btn:hover canvas,
body[data-theme-layout="vmu"] .slot-btn:focus-visible canvas {
  filter: invert(1) brightness(1.3);
  mix-blend-mode: normal;
}

body[data-theme-layout="vmu"] .copytip {
  background: #18261b !important;
  color: #8ea891 !important;
  border: 1px solid #18261b !important;
  font-family: 'Press Start 2P', monospace !important;
  font-size: 0.55rem !important;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3) !important;
}

/* Divider inside VMU Screen */
body[data-theme-layout="vmu"] .divider {
  display: none !important;
}

/* Worlds Navigation: Compact LCD Tiles */
body[data-theme-layout="vmu"] .worlds {
  gap: 0.65rem;
}

body[data-theme-layout="vmu"] .world {
  background: #849e87 !important;
  border: 2px solid #18261b !important;
  box-shadow: 2px 2px 0 #18261b !important;
  color: #18261b !important;
  padding: 0.65rem 0.75rem !important;
  border-radius: 6px;
  animation: none !important;
  transition: background 0.08s, color 0.08s, transform 0.08s, box-shadow 0.08s !important;
}

body[data-theme-layout="vmu"] .world:hover,
body[data-theme-layout="vmu"] .world:focus-visible {
  background: #18261b !important;
  color: #8ea891 !important;
  transform: translate(-1px, -1px) !important;
  box-shadow: 3px 3px 0 #18261b !important;
}

body[data-theme-layout="vmu"] a:focus-visible,
body[data-theme-layout="vmu"] .world:focus-visible,
body[data-theme-layout="vmu"] .slot-btn:focus-visible,
body[data-theme-layout="vmu"] .vmu-btn:focus-visible {
  outline: 2px solid #18261b !important;
  outline-offset: 2px !important;
}

body[data-theme-layout="vmu"] .icon-slot {
  width: 44px !important;
  height: 44px !important;
  background: #8ea891 !important;
  border: 2px solid #18261b !important;
  border-radius: 4px;
}

body[data-theme-layout="vmu"] .icon-slot canvas {
  width: 32px !important;
  height: 32px !important;
  filter: grayscale(100%) contrast(300%) brightness(0.5);
  mix-blend-mode: multiply;
}

body[data-theme-layout="vmu"] .world:hover .icon-slot canvas,
body[data-theme-layout="vmu"] .world:focus-visible .icon-slot canvas {
  filter: invert(1) brightness(1.3);
  mix-blend-mode: normal;
}

body[data-theme-layout="vmu"] .wname {
  color: #18261b !important;
  font-size: 0.68rem !important;
}

body[data-theme-layout="vmu"] .world:hover .wname,
body[data-theme-layout="vmu"] .world:focus-visible .wname {
  color: #8ea891 !important;
}

body[data-theme-layout="vmu"] .badge {
  background: #18261b !important;
  color: #8ea891 !important;
  border: 1px solid #18261b !important;
  box-shadow: none !important;
  font-size: 0.45rem !important;
  padding: 0.2em 0.45em !important;
}

body[data-theme-layout="vmu"] .world:hover .badge,
body[data-theme-layout="vmu"] .world:focus-visible .badge {
  background: #8ea891 !important;
  color: #18261b !important;
}

body[data-theme-layout="vmu"] .blurb {
  color: #18261b !important;
  font-size: 0.6rem !important;
  line-height: 1.4 !important;
  margin: 0.25rem 0 0.45rem !important;
}

body[data-theme-layout="vmu"] .world:hover .blurb,
body[data-theme-layout="vmu"] .world:focus-visible .blurb {
  color: #8ea891 !important;
}

body[data-theme-layout="vmu"] .chips {
  gap: 0.3rem;
}

body[data-theme-layout="vmu"] .chip {
  background: transparent !important;
  border: 1px solid #18261b !important;
  color: #18261b !important;
  box-shadow: none !important;
  font-size: 0.52rem !important;
  padding: 0.15rem 0.35rem !important;
  border-radius: 2px;
}

body[data-theme-layout="vmu"] .world:hover .chip,
body[data-theme-layout="vmu"] .world:focus-visible .chip {
  border-color: #8ea891 !important;
  color: #8ea891 !important;
}

/* VMU Hardware Controls (Molded into Off-White Plastic Chassis) */
body[data-theme-layout="vmu"] .vmu-hardware {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.2rem 1.4rem;
  margin-top: 0.5rem;
}

body:not([data-theme-layout="vmu"]) .vmu-hardware {
  display: none !important;
}

/* Dreamcast D-Pad (Directional Cross) */
body[data-theme-layout="vmu"] .vmu-dpad {
  position: relative;
  width: 80px;
  height: 80px;
}

body[data-theme-layout="vmu"] .dpad-cross {
  position: absolute;
  background: #3a3d42;
  border: 2px solid #18261b;
  box-shadow:
    inset 2px 2px 0 #575c63,
    inset -2px -2px 0 #212326,
    0 4px 6px rgba(0, 0, 0, 0.35);
}

body[data-theme-layout="vmu"] .dpad-arm-v {
  top: 0;
  left: 26px;
  width: 28px;
  height: 80px;
  border-radius: 4px;
}

body[data-theme-layout="vmu"] .dpad-arm-h {
  top: 26px;
  left: 0;
  width: 80px;
  height: 28px;
  border-radius: 4px;
}

body[data-theme-layout="vmu"] .dpad-center {
  position: absolute;
  top: 30px;
  left: 30px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #25282b 60%, #3a3d42 100%);
  z-index: 2;
}

/* VMU (A) and (B) Action Buttons */
body[data-theme-layout="vmu"] .vmu-actions {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  transform: rotate(-18deg);
}

body[data-theme-layout="vmu"] .vmu-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #18261b;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s steps(2, end), box-shadow 0.08s;
}

body[data-theme-layout="vmu"] .vmu-btn-a {
  background: #2564ba;
  box-shadow:
    inset 2px 2px 0 #5c98eb,
    inset -2px -2px 0 #143e7a,
    0 4px 6px rgba(0, 0, 0, 0.4);
}

body[data-theme-layout="vmu"] .vmu-btn-b {
  background: #c74236;
  box-shadow:
    inset 2px 2px 0 #e6766c,
    inset -2px -2px 0 #7a1d15,
    0 4px 6px rgba(0, 0, 0, 0.4);
}

body[data-theme-layout="vmu"] .vmu-btn:active {
  transform: translate(2px, 2px);
  box-shadow:
    inset 2px 2px 0 #143e7a,
    0 1px 2px rgba(0, 0, 0, 0.4);
}

/* VMU Mode / Sleep Small Pill Buttons */
body[data-theme-layout="vmu"] .vmu-meta-btns {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 0.6rem;
}

body[data-theme-layout="vmu"] .vmu-pill-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.42rem;
  color: #18261b;
  background: #d8d3c5;
  border: 1px solid #18261b;
  border-radius: 8px;
  padding: 0.2rem 0.5rem;
  letter-spacing: 0.06em;
  box-shadow: inset 1px 1px 0 #ffffff, 0 1px 2px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

/* VMU Footer */
body[data-theme-layout="vmu"] footer {
  margin-top: 1.2rem;
  text-align: center;
  color: #555d56;
}

body[data-theme-layout="vmu"] .press {
  color: #18261b !important;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
}

/* Reduced Motion Safety */
@media (prefers-reduced-motion: reduce) {
  body[data-theme-layout="vmu"] .avatar-slot.vmu-wiggle {
    animation: none !important;
  }
  body[data-theme-layout="vmu"] .world,
  body[data-theme-layout="vmu"] .vmu-btn {
    transition: none !important;
  }
}
