/* ==========================================================================
   FOTOSTEP 1999-2001 - RETRO CRT MONITOR SIMULATOR (800x600 SVGA)
   ========================================================================== */

:root {
  --crt-bg: #07090e;
  --crt-case-light: #dcd6c8;
  --crt-case-mid: #c5bead;
  --crt-case-dark: #9e9684;
  --crt-case-shadow: #2a2824;
  --crt-bezel-inner: #15181c;
  --crt-led-on: #39ff14;
  --crt-led-glow: rgba(57, 255, 20, 0.65);
  --crt-led-off: #204020;
  --crt-accent-gold: #f59e0b;
  --crt-accent-cyan: #00e5ff;
  --screen-width: 800px;
  --screen-height: 600px;
}

/* Reset & Base Layout */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  background-color: var(--crt-bg);
  background-image: 
    radial-gradient(circle at 50% 35%, rgba(30, 41, 59, 0.45) 0%, rgba(7, 9, 14, 0.95) 75%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e2e8f0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Top App Bar */
.retro-top-bar {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.retro-top-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.retro-brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #fff;
}

.retro-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.retro-brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.retro-brand-title span {
  color: var(--crt-accent-gold);
}

.retro-badge-year {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.retro-top-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.retro-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}

.retro-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.retro-nav-btn.gold {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

.retro-nav-btn.gold:hover {
  background: rgba(245, 158, 11, 0.22);
  color: #fff;
}

/* Main Workspace / Room */
.retro-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
  position: relative;
  width: 100%;
}

/* Ambient glow around the monitor */
.monitor-ambient-glow {
  position: absolute;
  width: 860px;
  height: 660px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.08) 0%, rgba(245, 158, 11, 0.03) 40%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.4s ease;
}

/* Monitor Outer Scaler Container */
.monitor-scaler-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
  transform-origin: center center;
}

/* ==========================================================================
   VINTAGE CRT MONITOR HARDWARE CHASSIS
   ========================================================================== */

.crt-monitor {
  width: 920px;
  background: linear-gradient(145deg, #e4ded0 0%, #cac2b2 35%, #b2aa98 100%);
  border-radius: 28px 28px 20px 20px;
  padding: 24px 24px 18px 24px;
  box-shadow: 
    0 0 0 2px #5f594b,
    0 20px 50px rgba(0, 0, 0, 0.7),
    0 40px 90px rgba(0, 0, 0, 0.85),
    inset 0 2px 4px rgba(255, 255, 255, 0.8),
    inset 0 -4px 8px rgba(0, 0, 0, 0.35);
  position: relative;
  display: flex;
  flex-direction: column;
  user-select: none;
}

/* Monitor Top Vent Grille & Details */
.crt-top-vents {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  opacity: 0.6;
}

.crt-vent-slot {
  width: 32px;
  height: 3px;
  background: #736b5d;
  border-radius: 2px;
  box-shadow: inset 0 1px 1px #333, 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Inner Bezel (Dark Border Framing the CRT Tube) */
.crt-bezel {
  width: 100%;
  background: linear-gradient(135deg, #1c2024 0%, #101215 50%, #1a1e22 100%);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 
    inset 0 4px 12px rgba(0, 0, 0, 0.9),
    inset 0 -2px 6px rgba(255, 255, 255, 0.05),
    0 2px 4px rgba(255, 255, 255, 0.4),
    0 -1px 2px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* The 800x600 CRT Glass Screen Tube */
.crt-screen-tube {
  width: var(--screen-width);
  height: var(--screen-height);
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 
    inset 0 0 35px rgba(0, 0, 0, 0.95),
    inset 0 0 10px rgba(0, 0, 0, 0.8);
  margin: 0 auto;
}

/* Actual Frame / Iframe Content */
.crt-iframe-content {
  width: 800px;
  height: 600px;
  border: none;
  background: #000;
  display: block;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Screen OFF state */
.crt-monitor.is-off .crt-iframe-content {
  opacity: 0;
  pointer-events: none;
}

.crt-monitor.is-off .monitor-ambient-glow {
  opacity: 0;
}

/* Glass Reflection Curvature Overlay */
.crt-glass-reflection {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: 
    radial-gradient(ellipse at 50% -10%, rgba(255, 255, 255, 0.12) 0%, transparent 60%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, transparent 40%, rgba(255, 255, 255, 0.02) 80%, transparent 100%);
  border-radius: 12px;
  z-index: 20;
}

/* Vignette Corner Shadow Overlay */
.crt-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: 
    inset 0 0 60px rgba(0, 0, 0, 0.75),
    inset 0 0 15px rgba(0, 0, 0, 0.9);
  border-radius: 12px;
  z-index: 21;
}

/* Optional CRT Scanlines Overlay */
.crt-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.28) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 3px, 4px 100%;
  z-index: 22;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.crt-scanlines.disabled {
  opacity: 0;
}

/* OSD (On Screen Display) HUD Alert */
.crt-osd-badge {
  position: absolute;
  top: 24px;
  left: 24px;
  background: rgba(0, 180, 0, 0.9);
  color: #000;
  font-family: 'Courier New', monospace;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  letter-spacing: 1px;
  z-index: 30;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0, 255, 0, 0.8);
  box-shadow: 0 0 12px rgba(0, 255, 0, 0.5);
}

.crt-osd-badge.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Degauss Animation */
@keyframes degaussWobble {
  0% { transform: scale(1) rotate(0deg); filter: hue-rotate(0deg) contrast(1); }
  15% { transform: scale(1.02) rotate(-0.6deg) skewX(2deg); filter: hue-rotate(90deg) contrast(1.6) brightness(1.3); }
  30% { transform: scale(0.98) rotate(0.6deg) skewX(-2deg); filter: hue-rotate(180deg) contrast(1.8) brightness(1.4); }
  50% { transform: scale(1.01) rotate(-0.3deg); filter: hue-rotate(270deg) contrast(1.3); }
  75% { transform: scale(0.99) rotate(0.1deg); filter: hue-rotate(360deg) contrast(1.1); }
  100% { transform: scale(1) rotate(0deg); filter: hue-rotate(0deg) contrast(1); }
}

.crt-screen-tube.degaussing {
  animation: degaussWobble 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

/* CRT Turn ON / Turn OFF Effect */
@keyframes crtTurnOn {
  0% {
    transform: scaleY(0.005) scaleX(0);
    filter: brightness(30);
  }
  40% {
    transform: scaleY(0.008) scaleX(1);
    filter: brightness(20);
  }
  70% {
    transform: scaleY(1) scaleX(1);
    filter: brightness(3);
  }
  100% {
    transform: scaleY(1) scaleX(1);
    filter: brightness(1);
  }
}

.crt-screen-tube.turn-on {
  animation: crtTurnOn 0.55s ease-out forwards;
}

/* ==========================================================================
   FRONT BEZEL BADGES & PHYSICAL CONTROL PANEL
   ========================================================================== */

.crt-control-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

/* Left: Vintage Brand Badge */
.crt-badge-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.crt-brand-logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  color: #4b463b;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.crt-spec-badge {
  font-size: 0.68rem;
  font-family: monospace;
  font-weight: 700;
  color: #635d51;
  background: #b5ad9b;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.6);
}

/* Center / Right: Physical Hardware Buttons */
.crt-hardware-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.crt-hw-btn {
  background: linear-gradient(180deg, #dfd8cb 0%, #b8b09f 100%);
  border: 1px solid #7c7465;
  border-radius: 5px;
  padding: 0.35rem 0.65rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #3b372e;
  box-shadow: 
    0 2px 0 #6e6758,
    0 3px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.1s ease;
  user-select: none;
}

.crt-hw-btn:hover {
  background: linear-gradient(180deg, #eae4d8 0%, #c2baab 100%);
  color: #1a1814;
}

.crt-hw-btn:active {
  transform: translateY(2px);
  box-shadow: 
    0 0 0 #6e6758,
    0 1px 2px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Power Button & LED Combo */
.crt-power-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid #9e9684;
}

.crt-power-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--crt-led-on);
  box-shadow: 0 0 8px var(--crt-led-glow), inset 0 1px 1px #fff;
  transition: all 0.25s ease;
}

.crt-monitor.is-off .crt-power-led {
  background: var(--crt-led-off);
  box-shadow: inset 0 1px 2px #000;
}

.crt-power-btn {
  background: linear-gradient(180deg, #d34b4b 0%, #9e1f1f 100%);
  border: 1px solid #6b1414;
  color: #fff;
  font-weight: 800;
  border-radius: 6px;
  padding: 0.38rem 0.8rem;
  box-shadow: 
    0 2px 0 #520f0f,
    0 3px 4px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.crt-power-btn:hover {
  background: linear-gradient(180deg, #e45a5a 0%, #b32626 100%);
}

.crt-power-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #520f0f, 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   MONITOR PEDESTAL STAND & NECK
   ========================================================================== */

.crt-stand-neck {
  width: 260px;
  height: 24px;
  background: linear-gradient(180deg, #8a8272 0%, #a49c8c 50%, #6e6758 100%);
  margin: 0 auto;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.6);
  border-radius: 0 0 6px 6px;
  position: relative;
  z-index: 5;
}

.crt-stand-base {
  width: 440px;
  height: 26px;
  background: linear-gradient(180deg, #d8d2c3 0%, #b8b09f 60%, #8c8474 100%);
  margin: 0 auto;
  border-radius: 8px 8px 18px 18px;
  box-shadow: 
    0 8px 25px rgba(0, 0, 0, 0.85),
    0 15px 40px rgba(0, 0, 0, 0.95),
    inset 0 2px 2px rgba(255, 255, 255, 0.8),
    inset 0 -2px 4px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 4;
}

/* ==========================================================================
   BOTTOM INFO BAR & HINTS
   ========================================================================== */

.retro-bottom-guide {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: #94a3b8;
  font-size: 0.82rem;
  z-index: 10;
}

.guide-key-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.kbd-badge {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   RESPONSIVE AUTO-SCALING FOR ANY SCREEN RESOLUTION
   ========================================================================== */

@media (max-width: 1024px) {
  .monitor-scaler-wrapper {
    transform: scale(0.85);
  }
}

@media (max-width: 860px) {
  .monitor-scaler-wrapper {
    transform: scale(0.72);
  }
  .retro-top-bar {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 680px) {
  .monitor-scaler-wrapper {
    transform: scale(0.55);
  }
  .crt-brand-logo-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .monitor-scaler-wrapper {
    transform: scale(0.42);
  }
}

/* Fullscreen Immersion Mode */
body.is-fullscreen {
  overflow: hidden;
}

body.is-fullscreen .retro-top-bar,
body.is-fullscreen .retro-bottom-guide,
body.is-fullscreen .crt-stand-neck,
body.is-fullscreen .crt-stand-base {
  display: none !important;
}

body.is-fullscreen .retro-workspace {
  padding: 0;
}
