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

:root {
  --bg: #0a0a0a;
  --bg-panel: #111118;
  --magenta: #FF00FF;
  --cyan: #00FFFF;
  --lime: #39FF14;
  --red: #FF003C;
  --yellow: #FFD700;
  --border: #222;
  --text: #ccc;
  --text-bright: #fff;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'VT323', monospace;
  font-size: 18px;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    linear-gradient(rgba(255,0,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,0,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}

#app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* HEADER */
header {
  text-align: center;
  padding: 32px 16px 24px;
  position: relative;
}

.header-inner {
  position: relative;
}

.title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 4vw, 28px);
  color: var(--magenta);
  text-shadow: 0 0 20px rgba(255,0,255,0.5), 2px 2px 0 #000;
  letter-spacing: 1px;
  line-height: 1.4;
}

.skull {
  display: inline-block;
  animation: skullBounce 1s ease infinite;
}

@keyframes skullBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(5deg); }
}

.subtitle {
  font-family: 'Comic Neue', cursive;
  font-size: 20px;
  color: var(--cyan);
  margin-top: 12px;
  font-style: italic;
  text-shadow: 0 0 10px rgba(0,255,255,0.3);
}

.badge {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 20px;
  background: var(--red);
  color: var(--text-bright);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  border-radius: 2px;
  animation: badgeBlink 0.8s ease-in-out infinite;
  box-shadow: 0 0 15px rgba(255,0,60,0.6);
}

@keyframes badgeBlink {
  0%, 100% { opacity: 1; background: var(--red); }
  50% { opacity: 0.7; background: var(--yellow); color: #000; }
}

/* UPLOAD ZONE */
.upload-zone {
  margin: 24px auto;
  max-width: 560px;
  border: 3px dashed var(--lime);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(57,255,20,0.02);
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  box-shadow: inset 0 0 30px rgba(57,255,20,0.05);
  pointer-events: none;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--magenta);
  background: rgba(255,0,255,0.05);
  box-shadow: 0 0 30px rgba(255,0,255,0.15);
}

.flash-icon {
  margin-bottom: 16px;
  animation: iconGlitch 3s steps(1) infinite;
}

@keyframes iconGlitch {
  0%, 95%, 100% { transform: none; filter: none; }
  96% { transform: translate(-2px, 1px) skewX(2deg); filter: hue-rotate(90deg); }
  97% { transform: translate(1px, -1px) skewX(-1deg); filter: hue-rotate(180deg); }
  98% { transform: translate(-1px, 2px); filter: hue-rotate(270deg); }
}

.upload-text {
  font-size: 22px;
  color: var(--lime);
  margin-bottom: 8px;
}

.upload-sub {
  font-size: 15px;
  color: #666;
  margin-bottom: 20px;
  font-family: 'Comic Neue', cursive;
}

.file-btn {
  display: inline-block;
  padding: 10px 28px;
  background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
  color: var(--cyan);
  border: 2px solid var(--cyan);
  border-radius: 2px;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 0 #000, inset 0 1px 0 rgba(255,255,255,0.1);
}

.file-btn:hover {
  background: linear-gradient(180deg, #444 0%, #222 100%);
  box-shadow: 0 0 15px rgba(0,255,255,0.3), 0 2px 0 #000;
}

.file-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 10px rgba(0,255,255,0.2);
}

/* FILE INFO */
.file-info {
  text-align: center;
  padding: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 12px auto;
  max-width: 560px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  font-size: 15px;
}

.file-info span {
  padding: 2px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
}

.corruption-score {
  color: var(--red) !important;
  font-weight: bold;
  border: 1px solid var(--red) !important;
  animation: pulseScore 1.5s ease infinite;
}

@keyframes pulseScore {
  0%, 100% { box-shadow: 0 0 5px rgba(255,0,60,0.3); }
  50% { box-shadow: 0 0 15px rgba(255,0,60,0.6); }
}

/* CONTROLS */
.controls-panel {
  margin: 16px auto;
  max-width: 560px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 4px 12px rgba(0,0,0,0.5);
}

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

.control-group label {
  font-size: 13px;
  color: var(--cyan);
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 0.5px;
}

.control-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #222;
  border-radius: 4px;
  outline: none;
  border: 1px solid #333;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--magenta);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255,0,255,0.5);
}

.val {
  font-size: 20px;
  color: var(--lime);
  text-align: center;
}

select {
  background: #1a1a1a;
  color: var(--text);
  border: 1px solid #333;
  padding: 8px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  border-radius: 2px;
  cursor: pointer;
}

select:focus {
  outline: 1px solid var(--magenta);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #222;
  border-radius: 26px;
  border: 1px solid #444;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background: #666;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(255,0,255,0.3);
  border-color: var(--magenta);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background: var(--magenta);
  box-shadow: 0 0 8px rgba(255,0,255,0.5);
}

.control-buttons {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 24px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  border: 2px solid;
  border-radius: 2px;
  transition: all 0.2s;
  box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.btn-corrupt {
  background: linear-gradient(180deg, #440000 0%, #220000 100%);
  color: var(--red);
  border-color: var(--red);
}

.btn-corrupt:hover {
  box-shadow: 0 0 20px rgba(255,0,60,0.4), 0 3px 0 #000;
}

.btn-download {
  background: linear-gradient(180deg, #2a0044 0%, #150022 100%);
  color: var(--magenta);
  border-color: var(--magenta);
}

.btn-download:hover {
  box-shadow: 0 0 20px rgba(255,0,255,0.4), 0 3px 0 #000;
}

.btn-export {
  background: linear-gradient(180deg, #003300 0%, #001a00 100%);
  color: var(--lime);
  border-color: var(--lime);
}

.btn-export:hover {
  box-shadow: 0 0 20px rgba(57,255,20,0.3), 0 3px 0 #000;
}

/* CANVAS */
.canvas-wrapper {
  margin: 24px auto;
  max-width: 660px;
}

.flash-player-chrome {
  background: #c0c0c0;
  border: 2px solid #888;
  border-radius: 0;
  box-shadow: 
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 #808080,
    2px 2px 8px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

.fp-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: white;
  font-family: 'VT323', monospace;
  font-size: 14px;
  padding: 3px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.fp-buttons {
  display: flex;
  gap: 2px;
}

.fp-btn {
  display: inline-block;
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #808080 #808080 #fff;
  text-align: center;
  line-height: 12px;
  font-size: 10px;
  color: #000;
  cursor: pointer;
}

.fp-close {
  color: #000;
}

#canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
  image-rendering: auto;
}

.fp-watermark {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: 'VT323', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.08);
  pointer-events: none;
  user-select: none;
}

/* CRT effect on canvas wrapper */
.flash-player-chrome::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.06) 0px,
    rgba(0,0,0,0.06) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: crtFlicker 0.1s steps(2) infinite;
  z-index: 10;
}

@keyframes crtFlicker {
  0% { opacity: 0.7; }
  50% { opacity: 0.85; }
  100% { opacity: 0.7; }
}

/* CONSOLE */
.console {
  margin: 16px auto;
  max-width: 660px;
  background: #050510;
  border: 1px solid #1a1a2e;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,255,0,0.03);
}

.console-header {
  padding: 6px 12px;
  background: #0a0a1a;
  color: #444;
  font-size: 12px;
  font-family: 'Press Start 2P', monospace;
  border-bottom: 1px solid #1a1a2e;
}

.console-output {
  padding: 10px 12px;
  max-height: 160px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
}

.console-output::-webkit-scrollbar {
  width: 6px;
}

.console-output::-webkit-scrollbar-track {
  background: #050510;
}

.console-output::-webkit-scrollbar-thumb {
  background: #222;
  border-radius: 3px;
}

.log-line {
  color: var(--lime);
  opacity: 0.8;
}

.log-line.warn {
  color: var(--yellow);
}

.log-line.error {
  color: var(--red);
}

/* FOOTER */
.footer {
  text-align: center;
  padding: 32px 16px;
  color: #444;
  font-size: 14px;
  font-family: 'Comic Neue', cursive;
}

.footer a {
  color: var(--cyan);
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  display: inline-block;
  margin-top: 8px;
  padding: 6px 16px;
  border: 1px solid var(--cyan);
  border-radius: 2px;
  transition: all 0.2s;
}

.footer a:hover {
  background: rgba(0,255,255,0.1);
  box-shadow: 0 0 12px rgba(0,255,255,0.2);
}

/* UTILITY */
.hidden {
  display: none !important;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .controls-panel {
    grid-template-columns: 1fr;
    padding: 14px;
  }
  
  .title {
    font-size: 14px;
  }
  
  .subtitle {
    font-size: 16px;
  }
  
  .upload-zone {
    padding: 28px 14px;
  }
  
  .file-info {
    font-size: 13px;
    gap: 6px;
  }
  
  .btn {
    font-size: 9px;
    padding: 8px 16px;
  }
}