:root {
  --gradient-bg: #1e1e1e;
  --gradient-btn: linear-gradient(135deg, #3a3f51, #2c2f3a);
  --gradient-btn-hover: linear-gradient(135deg, #4b5168, #343845);
  --text: #f5f5f5;
  --percent: 80%;
  --muted: #b8c2cc;
  --border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  background: var(--gradient-bg);
  color: var(--text);
  overflow: auto;
  position: relative;
}

canvas#background-stars {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.container {
  text-align: center;
  background: linear-gradient(
    145deg, rgba(20, 20, 20, 0.7) 0%, rgba(30, 30, 30, 0.6) 40%,
    rgba(40, 40, 40, 0.5) 70%, rgba(60, 60, 60, 0.4) 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 30px;
}

h1 {
  font-size: 2em;
  margin-bottom: 24px;
  color: var(--text);
  text-shadow: 0 0 10px rgba(0, 200, 255, 0.6);
}

.h-sm { font-size: 1.1rem; margin: 16px 0 8px; }

.drop-zone {
  position: relative;
  margin: 16px 0 12px;
  padding: 0;
  border: 2px dashed white;
  border-radius: 10px;
  background: #444;
  cursor: pointer;
  transition: border-color 0.3s, transform 0.3s, background 0.3s, box-shadow 0.3s;
  color: var(--text);
  width: 100%;
}
.drop-zone.is-dragover {
  border-color: #00c8ff;
  box-shadow: 0 0 0 2px rgba(0,200,255,0.2);
  transform: scale(1.02);
  background: #3c3c3c;
}

#uploadBox input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.processing-dots {
  font-style: italic;
  display: inline-block;
  margin: 10px 0;
}
@keyframes dots {
  0%   { content: ''; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '...'; }
}
.processing-dots::after {
  content: '...';
  display: inline-block;
  animation: dots 1s steps(3, end) infinite;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: #bbb;
  text-align: center;
}
label.inline { display: inline-block; margin-top: 10px; }

input[type="number"], input[type="range"], select {
  text-align: center;
  display: block;
  width: calc(100% - 20px);
  margin: 10px auto;
  padding: 10px;
  border: 1px solid #555;
  border-radius: 5px;
  outline: none;
  background-color: #444;
  color: white;
  transition: border-color 0.3s;
}

input[type="number"]:focus,
input[type="range"]:focus,
select:focus {
  border-color: #00c8ff;
}

button {
  padding: 10px 20px;
  background: var(--gradient-btn);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
  margin-top: 16px;
  margin-bottom: 10px;
}

button:hover {
  background: var(--gradient-btn-hover);
  transform: scale(1.05);
}

.button-group {
  display: flex;
  justify-content: center;
  gap: 10px;
}

#resetButton {
  background: linear-gradient(135deg, #6c757d, #343a40);
}
#resetButton:hover {
  background: linear-gradient(135deg, #5a6268, #23272b);
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, #00c8ff 0%, #00c8ff var(--percent), #fff var(--percent), #fff 100%);
  border-radius: 5px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  margin-top: -5px;
  cursor: pointer;
}
input[type="range"]::-moz-range-track {
  width: 100%;
  height: 6px;
  background: #fff;
  border-radius: 5px;
}
input[type="range"]::-moz-range-progress {
  background-color: #00c8ff;
  height: 6px;
  border-radius: 5px;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

#canvas {
  margin-top: 20px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #555;
  display: none;
}

#canvas.is-visible {
  animation: fadeInAndScale 0.5s ease-out forwards;
}
@keyframes fadeInAndScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.progress {
  position: relative;
  height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px auto 0;
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(255,255,255,0.1);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00c8ff, #66e0ff);
  transition: width 0.2s ease;
}
.progress-bar.indeterminate {
  width: 30%;
  animation: indet 1.2s infinite ease-in-out;
}
@keyframes indet {
  0% { margin-left: -30%; }
  50% { margin-left: 50%; }
  100% { margin-left: 100%; }
}
.progress-text {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.file-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-top: 8px;
  text-align: left;
}
.file-row { display: contents; }
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-sizes { color: var(--muted); }