:root {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f2430;
  --border: #2d3444;
  --text: #e8ecf3;
  --muted: #9aa4b2;
  --primary: #4f8cff;
  --primary-hover: #3d79ea;
  --success: #3ecf8e;
  --warning: #f5b942;
  --error: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1a2233 0%, var(--bg) 45%);
  color: var(--text);
  min-height: 100vh;
}

.container {
  width: min(960px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
}

.login-card {
  width: min(360px, 92vw);
  margin: 4rem auto 0;
  text-align: center;
}

.brand {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.login-card h2 {
  margin: 0 0 0.35rem;
}

.login-form {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.code-input {
  flex: 1;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.25rem;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.code-input:focus {
  outline: none;
  border-color: var(--primary);
}

.login-error {
  margin: 0.75rem 0 0;
  color: var(--error);
  font-size: 0.9rem;
}

.header p,
.muted {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(79, 140, 255, 0.08);
}

.dropzone-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.dropzone-subtitle,
.dropzone-hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
}

.controls label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.controls select {
  min-width: 180px;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: white;
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn.secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn.copied {
  border-color: var(--success);
  color: var(--success);
}

.status-header,
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.badge {
  display: inline-flex;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.badge.pending,
.badge.processing {
  color: var(--warning);
}

.badge.done {
  color: var(--success);
}

.badge.error {
  color: var(--error);
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0 0.75rem;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7aa7ff);
  transition: width 0.3s ease;
}

.status-message {
  margin: 0;
}

.full-text {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface-2);
  border-radius: 10px;
  line-height: 1.6;
}

.segments {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 0.75rem;
}

.segment {
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.segment-time {
  color: var(--primary);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.segment-text {
  margin: 0;
  line-height: 1.5;
}

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

.error-card {
  border-color: rgba(255, 107, 107, 0.4);
}

.hidden {
  display: none;
}

@media (max-width: 640px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls select,
  .btn {
    width: 100%;
  }

  .status-header,
  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
