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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #e4e4e4;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #00d4ff, #7b2cbf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

header p {
  color: #888;
  font-size: 1rem;
}

main {
  flex: 1;
}

.upload-area {
  border: 2px dashed #444;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #00d4ff;
  background: rgba(0, 212, 255, 0.05);
}

.upload-icon {
  color: #666;
  margin-bottom: 1rem;
}

.upload-area p {
  margin-bottom: 0.5rem;
  color: #aaa;
}

.file-types {
  font-size: 0.85rem;
  color: #666;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(0, 212, 255, 0.1);
  border-radius: 8px;
  margin-top: 1rem;
}

.file-name {
  color: #00d4ff;
  font-weight: 500;
}

.remove-file {
  background: none;
  border: none;
  color: #ff6b6b;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.options {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.options label {
  color: #888;
}

.options select {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1a1a2e;
  color: #e4e4e4;
  font-size: 1rem;
  cursor: pointer;
}

.options select:focus {
  outline: none;
  border-color: #00d4ff;
}

button[type="submit"] {
  width: 100%;
  padding: 1rem;
  margin-top: 1.5rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #00d4ff, #7b2cbf);
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-2px);
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result {
  margin-top: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(0, 212, 255, 0.1);
}

.result-header h2 {
  font-size: 1.1rem;
  color: #00d4ff;
}

#copyBtn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

#copyBtn:hover {
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.1);
}

.result-actions {
  display: flex;
  gap: 0.5rem;
}

.result-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  color: #666;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: #aaa;
}

.tab-btn.active {
  color: #00d4ff;
  border-bottom-color: #00d4ff;
}

.result-content {
  max-height: 500px;
  overflow-y: auto;
}

.result-text {
  padding: 1.5rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.subtitle-block {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 3px solid #7b2cbf;
}

.subtitle-time {
  display: inline-block;
  font-size: 0.8rem;
  font-family: monospace;
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.subtitle-text {
  color: #e4e4e4;
  line-height: 1.6;
}

.download-buttons {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.download-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  color: #00d4ff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: #00d4ff;
}

.new-upload-btn {
  background: rgba(123, 44, 191, 0.1);
  border-color: rgba(123, 44, 191, 0.3);
  color: #a855f7;
}

.new-upload-btn:hover {
  background: rgba(123, 44, 191, 0.2);
  border-color: #a855f7;
}

.processing-info {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 8px;
  text-align: center;
}

.processing-info p {
  margin-bottom: 0.5rem;
  color: #aaa;
}

.processing-info p:last-child {
  margin-bottom: 0;
}

.processing-info strong {
  color: #00d4ff;
  font-size: 1.2rem;
}

.processing-hint {
  font-size: 0.85rem;
  color: #666 !important;
}

.error {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  color: #ff6b6b;
}

.error-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.error-toggle {
  background: none;
  border: none;
  color: #ff9b9b;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
}

.error-toggle:hover {
  color: #ffd1d1;
}

.error-details {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 107, 107, 0.08);
  border-radius: 6px;
  color: #ffd1d1;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

footer {
  text-align: center;
  padding: 2rem 0 1rem;
  color: #555;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  header h1 {
    font-size: 2rem;
  }

  .upload-area {
    padding: 2rem 1rem;
  }

  .options {
    flex-direction: column;
    align-items: stretch;
  }
}
