/* ==========================================================================
   LOUIS-OS 2026: THE MULTIVERSE HOLODECK & DESKTOP OPERATING SYSTEM
   100% Redesigned • Draggable Windows • Retro-Futuristic Cyberpunk • Arcade Mini-Games
   ========================================================================== */

:root {
  --os-primary: #00F5FF;
  --os-accent: #FFD700;
  --os-success: #10FFA0;
  --os-danger: #FF0055;
  --os-purple: #C77DFF;
  --os-dark: #070913;
  --os-surface: rgba(13, 17, 32, 0.88);
  --os-titlebar: linear-gradient(90deg, #16203B, #0E1428);
  --os-border: rgba(0, 245, 255, 0.35);
  --os-border-glow: 0 0 15px rgba(0, 245, 255, 0.3);
  --font-os-sans: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  --font-os-display: 'Space Grotesk', system-ui, sans-serif;
  --font-os-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--os-dark);
  font-family: var(--font-os-sans);
  color: #F8FAFC;
  user-select: none;
  -webkit-user-select: none;
}

/* ==========================================================================
   DESKTOP VIEWPORT & DYNAMIC WALLPAPER
   ========================================================================== */
#desktop {
  width: 100vw;
  height: calc(100vh - 48px);
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  transition: background-image 0.5s ease;
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(0, 245, 255, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(199, 125, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(16, 255, 160, 0.08) 0%, transparent 50%),
    linear-gradient(to bottom, #060913, #0C1226 50%, #05070F);
}

/* CRT Scanlines Overlay */
.os-crt-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.os-crt-overlay.disabled {
  opacity: 0;
}

/* Desktop Icon Grid */
.desktop-icons-grid {
  position: absolute;
  top: 20px;
  left: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 16px;
  z-index: 10;
}

.desktop-icon {
  width: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 245, 255, 0.3);
  transform: scale(1.05);
}

.desktop-icon.selected {
  background: rgba(0, 245, 255, 0.18);
  border-color: var(--os-primary);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.4);
}

.icon-graphic {
  font-size: 2.2rem;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}

.icon-label {
  font-family: var(--font-os-mono);
  font-size: 0.72rem;
  color: #FFFFFF;
  text-shadow: 0 2px 4px #000;
  word-break: break-word;
  line-height: 1.2;
}

/* ==========================================================================
   DRAGGABLE WINDOW SYSTEM
   ========================================================================== */
.os-window {
  position: absolute;
  background: var(--os-surface);
  border: 1px solid var(--os-border);
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), var(--os-border-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.15s ease, opacity 0.15s ease;
  min-width: 320px;
  min-height: 200px;
}

.os-window.active-window {
  border-color: var(--os-primary);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 25px rgba(0, 245, 255, 0.35);
}

.os-window.minimized {
  opacity: 0;
  transform: scale(0.6) translateY(200px);
  pointer-events: none;
}

/* Titlebar */
.window-titlebar {
  height: 38px;
  background: var(--os-titlebar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  cursor: grab;
}

.window-titlebar:active {
  cursor: grabbing;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-os-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.2px;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.win-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: transparent;
  transition: all 0.15s ease;
}

.win-btn:hover {
  color: rgba(0, 0, 0, 0.7);
}

.win-close { background: #FF5F56; }
.win-min   { background: #FFBD2E; }
.win-max   { background: #27C93F; }

/* Window Body */
.window-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem;
  position: relative;
  user-select: text;
  -webkit-user-select: text;
}

/* ==========================================================================
   APP 1: 3D HOLODECK CANVAS
   ========================================================================== */
.holodeck-viewport {
  width: 100%;
  height: 380px;
  background: #000;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-hairline);
}

.holodeck-dock-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.os-pill-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #F8FAFC;
  font-family: var(--font-os-display);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.os-pill-btn:hover, .os-pill-btn.active {
  background: var(--os-primary);
  color: #060913;
  border-color: var(--os-primary);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.4);
}

/* ==========================================================================
   APP 2: PENNY CATCHER MINI-GAME (CANVAS ARCADE)
   ========================================================================== */
.penny-game-box {
  width: 100%;
  height: 380px;
  background: #0A0414;
  border: 2px solid var(--os-purple);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.penny-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-os-mono);
  font-size: 0.85rem;
  color: var(--os-accent);
  pointer-events: none;
  z-index: 5;
}

/* ==========================================================================
   APP 3: DR. DAVIS PHYSICS LAB
   ========================================================================== */
.davis-chalkboard-os {
  background: #0C1E19;
  border: 1px solid #20B2AA;
  border-radius: 10px;
  padding: 1.5rem;
  color: #FDF6E2;
  margin: 1rem 0;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
}

/* ==========================================================================
   APP 4: CINEMA THEATRE
   ========================================================================== */
.os-video-player-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--os-border);
}

.os-tape-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 1rem;
}

.os-tape-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.os-tape-card:hover, .os-tape-card.active {
  background: rgba(0, 245, 255, 0.15);
  border-color: var(--os-primary);
  color: #FFF;
}

/* ==========================================================================
   BOTTOM TASKBAR & DOCK
   ========================================================================== */
.os-taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(6, 9, 18, 0.92);
  border-top: 1px solid var(--os-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 10000;
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.8);
}

.taskbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.os-start-btn {
  background: linear-gradient(135deg, var(--os-primary), #0077ED);
  color: #060913;
  font-family: var(--font-os-display);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.os-start-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.6);
}

.taskbar-running-apps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.taskbar-app-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  font-family: var(--font-os-mono);
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.taskbar-app-tab:hover, .taskbar-app-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-color: var(--os-primary);
}

.taskbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tray-item {
  font-family: var(--font-os-mono);
  font-size: 0.75rem;
  color: #94A3B8;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.tray-item:hover {
  color: #FFFFFF;
  border-color: var(--os-primary);
}

/* ==========================================================================
   START MENU MODAL
   ========================================================================== */
.os-start-menu {
  position: fixed;
  bottom: 56px;
  left: 12px;
  width: 320px;
  background: rgba(10, 14, 28, 0.95);
  border: 1px solid var(--os-border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), var(--os-border-glow);
  backdrop-filter: blur(20px);
  z-index: 10001;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.os-start-menu.open {
  display: flex;
}

.start-menu-header {
  padding: 1rem;
  background: linear-gradient(90deg, #16203B, #0E1428);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.start-menu-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #F8FAFC;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.85rem;
}

.start-menu-item:hover {
  background: var(--os-primary);
  color: #060913;
  font-weight: 700;
}

/* Panic Mode Overlay (UNCW Classroom Shield) */
#panicOverlay {
  position: fixed;
  inset: 0;
  background: #0B1914;
  color: #FDF6E2;
  font-family: serif;
  padding: 4rem;
  z-index: 99999;
  display: none;
}

#panicOverlay.active {
  display: block;
}

/* ==========================================================================
   WORDLE.EXE STYLING
   ========================================================================== */
.wordle-board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  padding: 4px;
  box-sizing: border-box;
}

.wordle-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.wordle-tile {
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-os-display);
  font-size: 1.35rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #FFFFFF;
  background: rgba(10, 15, 30, 0.6);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.wordle-tile.pop {
  transform: scale(1.14);
  border-color: var(--os-primary);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.4);
}

.wordle-tile.correct {
  background-color: #10B981 !important;
  border-color: #10B981 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.wordle-tile.present {
  background-color: #F59E0B !important;
  border-color: #F59E0B !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.wordle-tile.absent {
  background-color: #334155 !important;
  border-color: #334155 !important;
  color: #94A3B8 !important;
}

.wordle-row.shake {
  animation: wordleShake 0.4s ease-in-out;
}

@keyframes wordleShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.wordle-keyboard {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  user-select: none;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

.kb-key {
  height: 38px;
  flex: 1;
  min-width: 25px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: #1E293B;
  color: #F8FAFC;
  font-family: var(--font-os-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.kb-key:hover {
  background: #334155;
  border-color: rgba(255, 255, 255, 0.25);
}

.kb-key:active {
  transform: scale(0.95);
}

.kb-key.wide {
  flex: 1.5;
  font-size: 0.7rem;
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.kb-key.correct {
  background: #10B981 !important;
  border-color: #10B981 !important;
  color: #FFF !important;
}

.kb-key.present {
  background: #F59E0B !important;
  border-color: #F59E0B !important;
  color: #FFF !important;
}

.kb-key.absent {
  background: #0F172A !important;
  border-color: transparent !important;
  color: #475569 !important;
}

/* Mobile Warning Pill */
@media (max-width: 768px) {
  .desktop-icons-grid {
    flex-direction: row;
    width: calc(100% - 40px);
    height: auto;
  }
  .os-window {
    width: 95vw !important;
    left: 2.5vw !important;
    top: 10px !important;
  }
}
