/* ============================================
   GIF98 - Windows 98/XP GIF Visualizer
   Clean stylesheet with authentic retro styling
   ============================================ */

:root {
  /* Windows 98 Classic Colors */
  --win98-gray: #c0c0c0;
  --win98-gray-light: #dfdfdf;
  --win98-gray-dark: #808080;
  --win98-gray-darker: #404040;
  --win98-white: #ffffff;
  --win98-black: #000000;
  --win98-blue: #000080;
  --win98-blue-highlight: #0a246a;
  --win98-red: #ff0000;
  --win98-green: #008000;
  --win98-yellow: #ffff00;
  --win98-teal: #008080;
  --win98-bsod-blue: #0000aa;

  /* Windows XP Luna Theme Colors */
  --winxp-blue-start: #0054e3;
  --winxp-blue-end: #3c89ff;
  --winxp-blue-bright: #5ba0ff;
  --winxp-green-start: #84c90a;
  --winxp-green-end: #63b809;
  --winxp-orange: #ff9c00;
  --winxp-silver: #ece9d8;
  --winxp-white: #ffffff;
  --winxp-black: #000000;
  --winxp-gray-light: #f1f0e8;
  --winxp-gray-medium: #d4d0c8;
  --winxp-gray-dark: #8b8b8b;
  --winxp-border-light: #ffffff;
  --winxp-border-dark: #003c74;
  --winxp-shadow: rgba(0, 0, 0, 0.25);
  --winxp-desktop: #3a6ea5;
  --winxp-taskbar-blue-start: #245edb;
  --winxp-taskbar-blue-end: #3f8cf3;
  --winxp-button-blue-start: #eef4ff;
  --winxp-button-blue-end: #b6cef5;
  --winxp-button-hover-start: #ffeec2;
  --winxp-button-hover-end: #ffe194;
  --winxp-bsod-blue: #0000aa;
}

/* ============================================
   Reset & Base
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Tahoma', 'Segoe UI', 'MS Sans Serif', sans-serif;
  font-size: 11px;
  background: var(--winxp-desktop);
  overflow: hidden;
  cursor: default;
  -webkit-font-smoothing: none;
}

.hidden {
  display: none !important;
}

/* ============================================
   Desktop
   ============================================ */
.desktop {
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, #3a6ea5 0%, #1c4e80 50%, #3a6ea5 100%);
  position: relative;
}

/* Desktop Icons */
.desktop-icons {
  position: absolute;
  top: 10px;
  left: 10px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 64px;
  margin-bottom: 20px;
  cursor: pointer;
  transition: none;
}

.desktop-icon:hover .icon-label {
  background: rgba(0, 84, 227, 0.4);
  color: var(--winxp-white);
}

.icon-image {
  width: 32px;
  height: 32px;
  background: var(--win98-gray);
  border: 2px outset var(--win98-gray);
  image-rendering: pixelated;
}

.icon-label {
  margin-top: 4px;
  color: var(--winxp-white);
  font-size: 10px;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  padding: 1px 2px;
}

/* ============================================
   Windows
   ============================================ */
.window {
  position: absolute;
  background: var(--winxp-silver);
  border: 3px solid;
  border-color: var(--winxp-border-light) var(--winxp-gray-dark) var(--winxp-gray-dark) var(--winxp-border-light);
  border-radius: 8px 8px 0 0;
  min-width: 250px;
  max-width: 600px;
  box-shadow: 0 4px 12px var(--winxp-shadow), 0 0 0 1px rgba(0, 0, 0, 0.1);
  z-index: 1;
  overflow: hidden;
}

.window-title-bar {
  background: linear-gradient(180deg, var(--winxp-blue-bright) 0%, var(--winxp-blue-start) 50%, var(--winxp-blue-end) 100%);
  color: var(--winxp-white);
  padding: 4px 6px 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 28px;
  font-size: 12px;
  font-weight: bold;
  cursor: move;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  border-radius: 8px 8px 0 0;
  user-select: none;
}

.window-title {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.window-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.window-control {
  width: 21px;
  height: 21px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  color: var(--winxp-black);
}

.window-control:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
  border-color: rgba(255, 156, 0, 0.8);
}

.window-control:active {
  background: linear-gradient(180deg, var(--winxp-button-blue-end) 0%, var(--winxp-button-blue-start) 100%);
  transform: translateY(1px);
}

.window-control.close {
  background: linear-gradient(180deg, #ff9c85 0%, #ff6347 100%);
  color: var(--winxp-white);
  font-weight: bold;
}

.window-control.close:hover {
  background: linear-gradient(180deg, #ffb8a8 0%, #ff8570 100%);
}

.window-content {
  padding: 12px;
  background: var(--winxp-silver);
}

/* ============================================
   Upload Section
   ============================================ */
.upload-section {
  margin-bottom: 10px;
}

.upload-button {
  display: inline-block;
  padding: 4px 18px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--winxp-black);
  transition: all 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  font-family: inherit;
}

.upload-button:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
  border-color: rgba(255, 156, 0, 0.9);
}

.upload-button:active {
  background: linear-gradient(180deg, var(--winxp-button-blue-end) 0%, var(--winxp-button-blue-start) 100%);
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* GIF List */
.gif-list {
  border: 2px inset var(--win98-gray);
  background: var(--winxp-white);
  padding: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.gif-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  border-bottom: 1px solid #e8e8e8;
}

.gif-item:last-child {
  border-bottom: none;
}

.gif-item:hover {
  background: #316ac5;
  color: white;
}

.gif-preview {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border: 1px solid var(--win98-gray-dark);
  image-rendering: auto;
}

.gif-info {
  flex: 1;
  font-size: 10px;
  min-width: 0;
}

.gif-info div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gif-remove {
  padding: 1px 6px;
  background: var(--win98-gray);
  border: 2px outset var(--win98-gray);
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  flex-shrink: 0;
}

.gif-remove:active {
  border: 2px inset var(--win98-gray);
}

.no-gifs {
  text-align: center;
  color: var(--win98-gray-dark);
  font-style: italic;
  padding: 20px;
}

/* ============================================
   Controls
   ============================================ */
.control-group {
  margin-bottom: 10px;
}

.control-group label {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: bold;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

input[type="range"] {
  width: 100%;
  height: 20px;
  background: linear-gradient(180deg, #e4e4e4 0%, #f8f8f8 100%);
  border: 2px inset var(--win98-gray);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 11px;
  height: 20px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 20px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  cursor: pointer;
}

input[type="number"] {
  width: 56px;
  padding: 2px 4px;
  border: 2px inset var(--win98-gray);
  background: var(--winxp-white);
  font-size: 11px;
  font-family: inherit;
}

select {
  width: 100%;
  padding: 3px 4px;
  border: 2px inset var(--win98-gray);
  background: var(--winxp-white);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}

/* Preset Buttons */
.preset-group {
  margin-bottom: 10px;
}

.preset-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: bold;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.preset-btn {
  padding: 3px 8px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.6);
  border-radius: 2px;
  cursor: pointer;
  font-size: 9px;
  font-family: inherit;
  font-weight: 600;
  color: var(--winxp-black);
  transition: all 0.1s;
  white-space: nowrap;
}

.preset-btn:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
  border-color: rgba(255, 156, 0, 0.8);
}

.preset-btn:active,
.preset-btn.active {
  background: linear-gradient(180deg, #c8dff8 0%, #8eb4ea 100%);
  border-color: #003c74;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.preset-btn.preset-danger {
  background: linear-gradient(180deg, #ffccc8 0%, #ff9c85 100%);
  border-color: rgba(180, 0, 0, 0.5);
}

.preset-btn.preset-danger:hover {
  background: linear-gradient(180deg, #ffddd8 0%, #ffb8a8 100%);
}

/* ============================================
   Launch Button
   ============================================ */
.launch-button {
  width: 100%;
  padding: 8px;
  background: linear-gradient(180deg, #5edc5a 0%, #3cb838 100%);
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  color: var(--winxp-white);
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.15s;
  font-family: inherit;
}

.launch-button:hover {
  background: linear-gradient(180deg, #7eff7a 0%, #5edc5a 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.launch-button:active {
  background: linear-gradient(180deg, #3cb838 0%, #5edc5a 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translateY(1px);
}

.launch-button:disabled {
  background: var(--win98-gray);
  color: var(--win98-gray-dark);
  text-shadow: 1px 1px 0 var(--win98-white);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   Taskbar
   ============================================ */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30px;
  background: linear-gradient(180deg, var(--winxp-taskbar-blue-end) 0%, var(--winxp-taskbar-blue-start) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  z-index: 1000;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.25);
}

.start-button {
  height: 26px;
  padding: 0 12px 0 6px;
  background: linear-gradient(180deg, #5edc5a 0%, #3cb838 100%);
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  color: var(--winxp-white);
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.1s;
}

.start-button:hover {
  background: linear-gradient(180deg, #7eff7a 0%, #5edc5a 100%);
}

.start-button:active {
  background: linear-gradient(180deg, #3cb838 0%, #5edc5a 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translateY(1px);
}

.start-icon {
  font-size: 14px;
  filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.5));
}

.taskbar-items {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin: 0 8px;
}

.taskbar-item {
  height: 22px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  display: flex;
  align-items: center;
  font-size: 10px;
  color: var(--winxp-white);
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  max-width: 160px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.taskbar-item:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.taskbar-time {
  background: rgba(18, 87, 219, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 10px;
  color: var(--winxp-white);
  font-weight: 600;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Play Page
   ============================================ */
.play-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--win98-black);
  z-index: 2000;
}

.play-area {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
}

/* Scanline overlay for retro feel */
.play-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9998;
}

/* GIF Windows in play area */
.gif-window {
  position: absolute;
  background: var(--win98-gray);
  border: 2px outset var(--win98-gray);
  min-width: 100px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);
  image-rendering: auto;
}

.gif-window .window-title-bar {
  height: 22px;
  font-size: 11px;
  padding: 2px 4px 2px 6px;
  border-radius: 0;
}

.gif-window .window-content {
  padding: 0;
  background: var(--win98-black);
}

.gif-display {
  display: block;
  max-width: 250px;
  max-height: 250px;
  width: auto;
  height: auto;
  image-rendering: auto;
}

/* Beat Indicator */
.beat-indicator {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 16px;
  height: 16px;
  background: var(--win98-red);
  border: 2px outset var(--win98-gray);
  opacity: 0.3;
  transition: opacity 0.05s, transform 0.05s;
  z-index: 9999;
}

.beat-indicator.pulse {
  opacity: 1;
  background: #ff4444;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.6);
  transform: scale(1.2);
}

/* ============================================
   Play Controls Overlay
   ============================================ */
.play-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(180deg, var(--winxp-taskbar-blue-end) 0%, var(--winxp-taskbar-blue-start) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 8px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
}

.play-controls.collapsed {
  transform: translateY(100%);
}

.play-controls-toggle {
  position: fixed;
  bottom: 38px;
  right: 8px;
  padding: 2px 8px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  font-size: 9px;
  font-family: inherit;
  font-weight: bold;
  color: var(--winxp-black);
  z-index: 9999;
  transition: bottom 0.3s ease;
}

.play-controls.collapsed + .play-controls-toggle {
  bottom: 0;
}

.play-controls-toggle:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--winxp-white);
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.ctrl-group label {
  font-weight: bold;
}

.ctrl-group input[type="range"] {
  width: 80px;
  height: 14px;
  border: 1px inset var(--win98-gray);
}

.ctrl-group select {
  font-size: 10px;
  padding: 1px 2px;
  max-width: 140px;
  border: 1px inset var(--win98-gray);
}

.ctrl-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.ctrl-btn {
  padding: 2px 10px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  border-radius: 2px;
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  font-weight: 600;
  color: var(--winxp-black);
  transition: all 0.1s;
  white-space: nowrap;
}

.ctrl-btn:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
}

.ctrl-btn:active {
  transform: translateY(1px);
}

.ctrl-btn.ctrl-back {
  background: linear-gradient(180deg, #ff9c85 0%, #ff6347 100%);
  color: white;
  font-weight: bold;
}

.ctrl-btn.ctrl-back:hover {
  background: linear-gradient(180deg, #ffb8a8 0%, #ff8570 100%);
}

.ctrl-info {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.6);
  margin-left: auto;
}

/* ============================================
   Back Button (fallback)
   ============================================ */
.back-button {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 6px 16px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  border-radius: 3px;
  color: var(--winxp-black);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  z-index: 9999;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.15s;
  display: none; /* Hidden by default, play-controls replaces it */
}

/* ============================================
   Error Dialog
   ============================================ */
.error-dialog {
  position: absolute;
  background: var(--winxp-silver);
  border: 3px solid;
  border-color: var(--winxp-border-light) var(--winxp-gray-dark) var(--winxp-gray-dark) var(--winxp-border-light);
  border-radius: 8px 8px 0 0;
  width: 340px;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.error-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 12px 12px;
  flex-wrap: wrap;
}

.error-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.error-message {
  flex: 1;
  font-size: 11px;
  line-height: 1.5;
  min-width: 180px;
}

.error-ok-btn {
  display: block;
  margin: 0 auto;
  padding: 4px 24px;
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.1s;
}

.error-ok-btn:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
}

.error-ok-btn:active {
  background: linear-gradient(180deg, var(--winxp-button-blue-end) 0%, var(--winxp-button-blue-start) 100%);
  transform: translateY(1px);
}

/* ============================================
   BSOD
   ============================================ */
.bsod {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--win98-bsod-blue);
  color: var(--win98-white);
  font-family: 'Lucida Console', 'Courier New', monospace;
  font-size: 14px;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
}

.bsod-content {
  text-align: left;
  line-height: 1.6;
  padding: 40px;
  max-width: 700px;
}

.bsod-content h2 {
  margin-bottom: 20px;
  font-size: 16px;
  color: var(--win98-white);
  background: var(--win98-gray);
  color: var(--win98-bsod-blue);
  display: inline-block;
  padding: 2px 8px;
}

.bsod-content p {
  margin-bottom: 8px;
}

/* ============================================
   Glitch Effects
   ============================================ */

/* Screen Corruption */
.glitch-corruption {
  animation: corruption 0.08s infinite alternate;
}

@keyframes corruption {
  0% {
    filter: hue-rotate(180deg) saturate(3) brightness(1.5);
    transform: translateX(-3px) skewX(2deg);
  }
  25% {
    filter: hue-rotate(90deg) saturate(2) brightness(1.2) contrast(1.5);
    transform: translateX(2px) skewX(-1deg) skewY(0.5deg);
  }
  50% {
    filter: invert(1) hue-rotate(180deg);
    transform: translateX(-1px) translateY(1px);
  }
  75% {
    filter: hue-rotate(270deg) saturate(4) brightness(0.8);
    transform: translateX(3px) skewX(1deg);
  }
  100% {
    filter: hue-rotate(0deg) saturate(1) brightness(2);
    transform: translateX(-2px) skewY(-0.5deg);
  }
}

/* System Freeze */
.glitch-freeze {
  animation: freeze 2s ease-in-out;
  pointer-events: none;
}

@keyframes freeze {
  0%, 80% {
    filter: grayscale(1) brightness(0.7);
    transform: scale(0.998);
  }
  85% {
    filter: grayscale(1) brightness(0.4);
  }
  90% {
    filter: grayscale(0.5) brightness(0.5);
    transform: scale(0.997);
  }
  100% {
    filter: none;
    transform: scale(1);
  }
}

/* Memory Leak */
.memory-leak {
  opacity: 0.6;
  filter: blur(0.8px) saturate(0.5);
  transition: opacity 0.5s, filter 0.5s;
}

/* ============================================
   Effect-Specific Window Styles
   ============================================ */

/* Matrix Rain - green CRT glow */
.matrix-fall {
  filter: hue-rotate(120deg) brightness(1.3) contrast(1.2);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.6), 0 0 30px rgba(0, 255, 0, 0.2);
}

.matrix-fall .window-title-bar {
  background: linear-gradient(180deg, #00ff00 0%, #008800 50%, #00cc00 100%);
}

/* Kaleidoscope - psychedelic */
.kaleidoscope-segment {
  filter: saturate(2.5) brightness(1.2) contrast(1.1);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.5), 0 0 40px rgba(255, 100, 255, 0.2);
}

/* Vortex Spiral - cyan void */
.vortex-spiral {
  filter: hue-rotate(180deg) saturate(1.8) brightness(1.1);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.6), 0 0 40px rgba(0, 200, 255, 0.2);
}

/* DNA Helix - bio blue */
.dna-helix {
  filter: brightness(1.2) saturate(1.5) hue-rotate(200deg);
  box-shadow: 0 0 15px rgba(50, 100, 255, 0.6);
}

/* Particle Fireworks - golden sparks */
.particle-firework {
  filter: brightness(1.4) saturate(2) contrast(1.1);
  box-shadow: 0 0 20px rgba(255, 200, 50, 0.8), 0 0 40px rgba(255, 150, 0, 0.3);
}

/* Wave Motion - ocean */
.wave-motion {
  filter: hue-rotate(200deg) brightness(1.1) saturate(1.3);
  box-shadow: 0 0 15px rgba(0, 150, 255, 0.5);
}

/* 3D Cube - purple depth */
.cube-face {
  perspective: 800px;
  backface-visibility: visible;
  filter: brightness(1.1) contrast(1.1);
  box-shadow: 0 0 25px rgba(150, 50, 255, 0.6), 0 0 50px rgba(150, 50, 255, 0.2);
}

/* Mosaic Grid - warm tiles */
.mosaic-tile {
  filter: saturate(1.5) contrast(1.15);
  box-shadow: 0 0 10px rgba(255, 150, 50, 0.5);
}

/* Orbit System */
.orbit-sun {
  filter: brightness(1.6) saturate(2.5);
  box-shadow: 0 0 40px rgba(255, 200, 0, 0.9), 0 0 80px rgba(255, 150, 0, 0.4);
  animation: orbitPulse 1.5s ease-in-out infinite;
}

.orbit-planet {
  filter: brightness(1.2);
  box-shadow: 0 0 12px rgba(100, 150, 255, 0.6);
}

@keyframes orbitPulse {
  0%, 100% { transform: scale(1.5); box-shadow: 0 0 40px rgba(255, 200, 0, 0.9); }
  50% { transform: scale(1.7); box-shadow: 0 0 60px rgba(255, 200, 0, 1); }
}

/* Tunnel Vision - depth */
.tunnel-ring {
  filter: blur(0.5px) brightness(0.8);
  box-shadow: 0 0 20px rgba(150, 100, 255, 0.5);
}

/* Flip Book */
.flipbook-frame {
  filter: contrast(1.2) brightness(1.1);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.4), 4px 4px 12px rgba(0, 0, 0, 0.6);
  border: 3px solid rgba(255, 255, 255, 0.2);
}

/* ============================================
   Window Entrance Animations
   ============================================ */
@keyframes windowCascade {
  from {
    transform: translateX(-80px) translateY(-40px) rotate(-3deg);
    opacity: 0;
  }
  to {
    transform: translateX(0) translateY(0) rotate(0deg);
    opacity: 1;
  }
}

.cascade-animation {
  animation: windowCascade 0.25s ease-out;
}

/* Error dialog shake */
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-4px); }
  20% { transform: translateX(4px); }
  30% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
  80% { transform: translateX(1px); }
}

.error-shake {
  animation: errorShake 0.4s ease-in-out;
}

/* ============================================
   Keyboard Shortcuts Tooltip
   ============================================ */
.shortcuts-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--winxp-silver);
  border: 3px solid;
  border-color: var(--winxp-border-light) var(--winxp-gray-dark) var(--winxp-gray-dark) var(--winxp-border-light);
  border-radius: 8px 8px 0 0;
  z-index: 10000;
  min-width: 300px;
  box-shadow: 6px 6px 20px rgba(0, 0, 0, 0.5);
}

.shortcuts-overlay .window-content {
  padding: 12px 16px;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #d4d0c8;
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-key {
  background: var(--winxp-white);
  border: 1px solid var(--win98-gray-dark);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: 'Lucida Console', monospace;
  font-size: 10px;
  font-weight: bold;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 1px 0 var(--win98-gray-dark);
}

.shortcut-desc {
  font-size: 11px;
  color: var(--winxp-black);
}

/* ============================================
   Scrollbar (XP style)
   ============================================ */
.gif-list::-webkit-scrollbar {
  width: 16px;
}

.gif-list::-webkit-scrollbar-track {
  background: linear-gradient(90deg, #e4e4e4 0%, #f8f8f8 100%);
  border: 1px solid #999;
}

.gif-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--winxp-button-blue-start) 0%, var(--winxp-button-blue-end) 100%);
  border: 1px solid rgba(0, 60, 116, 0.8);
  border-radius: 2px;
}

.gif-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--winxp-button-hover-start) 0%, var(--winxp-button-hover-end) 100%);
}

/* ============================================
   Dragging State
   ============================================ */
.dragging {
  cursor: move !important;
  user-select: none;
  opacity: 0.9;
}

/* ============================================
   Status Bar in window
   ============================================ */
.window-status {
  background: var(--winxp-gray-light);
  border-top: 1px solid var(--win98-gray-dark);
  padding: 2px 6px;
  font-size: 10px;
  color: var(--winxp-black);
  display: flex;
  justify-content: space-between;
}

/* ============================================
   CRT / Glitch Screen Effects
   ============================================ */

/* VHS tracking lines */
@keyframes vhsTracking {
  0% { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

.vhs-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: vhsTracking 8s linear infinite;
  pointer-events: none;
  z-index: 9997;
}

/* Screen tear effect */
@keyframes screenTear {
  0%, 95%, 100% { clip-path: none; }
  96% { clip-path: inset(40% 0 30% 0); transform: translateX(5px); }
  97% { clip-path: inset(60% 0 10% 0); transform: translateX(-3px); }
  98% { clip-path: inset(20% 0 50% 0); transform: translateX(4px); }
}

/* ============================================
   Notification toast
   ============================================ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--winxp-silver);
  border: 2px outset var(--win98-gray);
  padding: 8px 16px;
  font-size: 11px;
  z-index: 10000;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   Responsive adjustments for play controls
   ============================================ */
@media (max-width: 900px) {
  .play-controls {
    flex-wrap: wrap;
    height: auto;
    padding: 4px 6px;
  }

  .ctrl-group select {
    max-width: 100px;
  }

  .ctrl-info {
    display: none;
  }
}
