:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --accent: #5e72e4;
  --accent-hover: #4a5fc1;
  --link: #58a6ff;
  --border: #30363d;
  --border-hover: #484f58;
  --shadow: 0 4px 12px rgba(1, 4, 9, 0.8);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --transition: all 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  --success: #238636;
  --error: #f85149;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  padding: 2rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: var(--transition);
}

h1 {
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.8rem;
}

.subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.upload-area:hover, .upload-area:focus {
  border-color: var(--accent);
  background: rgba(94, 114, 228, 0.05);
  outline: none;
}

.upload-area i {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.upload-area h3 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

#file-name {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
  word-break: break-all;
}

#file-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

input[type="file"] {
  display: none;
}

.preview-container {
  margin: 1.5rem 0;
  text-align: center;
  display: none;
}

.preview-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

#preview {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-primary);
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 17, 23, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: white;
  display: none;
}

.spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 3px solid var(--accent);
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin-bottom: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.size-info {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
}

.control-group {
  flex: 1;
  min-width: 150px;
}

.control-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.control-group select,
.control-group input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.control-group select:focus,
.control-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(94, 114, 228, 0.2);
}

.split-method {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.split-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.split-btn:hover, .split-btn:focus {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.split-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.btn:hover, .btn:focus {
  background: var(--accent-hover);
  transform: translateY(-1px);
  outline: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--accent);
  border: 1px solid var(--accent);
  margin-top: 0.5rem;
}

.btn-secondary:hover, .btn-secondary:focus {
  background: rgba(94, 114, 228, 0.1);
}

#result {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-align: center;
  display: none;
  border: 1px solid transparent;
}

.split-preview {
  margin: 1.5rem 0;
  display: none;
}

.split-preview h4 {
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-primary);
}

.split-grid {
  display: grid;
  gap: 0.5rem;
  border: 1px solid var(--border);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  max-height: 500px;
  overflow-y: auto;
}

.split-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  position: relative;
}

.split-item img {
  width: 100%;
  display: block;
}

.split-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  text-align: center;
}

.download-options {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.download-btn {
  background: var(--bg-primary);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.download-btn:hover, .download-btn:focus {
  background: rgba(94, 114, 228, 0.1);
  outline: none;
}

@media (max-width: 768px) {
  body {
    padding: 1.5rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .controls {
    flex-direction: column;
  }
  
  .control-group {
    width: 100%;
  }
  
  .split-method {
    flex-wrap: wrap;
  }
  
  .download-options {
    flex-direction: column;
  }
  
  h1 {
    font-size: 1.5rem;
  }
}
