* { box-sizing: border-box; }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --error: #dc2626;
  --success: #059669;
  --hint-bg: #eff6ff;
  --hint-border: #bfdbfe;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}

.tab-bar .tab {
  padding: 12px 16px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  width: 100%;
  text-align: center;
}

.tab-bar .tab:hover:not(.active) {
  background: #f3f4f6;
  color: var(--text);
  border-color: transparent;
}

.tab-bar .tab.active,
.tab-bar .tab.active:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel .card:first-child {
  margin-top: 0;
}

.tab-panel .card-desc:first-child {
  margin-top: 0;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  font-weight: 400;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.tool-card { border-color: var(--border-strong); }

.card-title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.card-desc {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.sub-heading {
  margin: 16px 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

input[type=text] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type=text]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button, .btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

button:hover:not(:disabled), .btn:hover:not(.disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
}

button.primary, .btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button.primary:hover:not(:disabled), .btn.primary:hover:not(.disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button:disabled, .btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

#submitBtn { margin-top: 16px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.status {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 12px 0 0;
  min-height: 1.2em;
}

.status.error { color: var(--error); font-weight: 500; }
.status.ok { color: var(--success); font-weight: 500; }

.meta {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.link-row { margin-top: 12px; }

.link-row a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.link-row a:hover { text-decoration: underline; }

video {
  width: 100%;
  max-width: 360px;
  border-radius: 8px;
  margin-top: 8px;
  background: #edece8;
  border: 1px solid var(--border);
}

.video-preview-shell {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin-top: 8px;
}

.video-preview-shell video {
  width: 100%;
  max-width: none;
  margin-top: 0;
  display: block;
}

.video-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #edece8;
  z-index: 1;
  pointer-events: auto;
  cursor: pointer;
}

.video-cover::after {
  content: "缓冲中…";
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.video-cover.video-cover--ready::after {
  content: "▶ 点按播放";
}

.video-cover[hidden] {
  display: none !important;
}

audio {
  width: 100%;
  max-width: 360px;
  margin-top: 8px;
}

.options {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 8px;
  margin: 0 0 16px;
  background: #fafafa;
}

.options-legend {
  padding: 0 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  margin: 0;
}

.check-row:last-child { border-bottom: none; }

.check-row input {
  margin-top: 3px;
  grid-row: 1 / span 2;
  accent-color: var(--primary);
}

.check-row > span:first-of-type {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text);
}

.check-hint {
  grid-column: 2;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.check-hint strong {
  font-weight: 700;
  color: var(--text-secondary);
}

.tag-soon { color: #d97706; font-weight: 600; }

.compose-uploads {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.compose-field {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
}

.file-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.compose-field input[type="file"].file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-picker-row {
  position: relative;
  margin-bottom: 4px;
}

.file-picker-btn {
  display: inline-block;
  margin: 0;
  cursor: pointer;
}

.compose-field input[type="file"] {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 100%;
}

.compose-duration { margin-bottom: 16px; }

.compose-visual-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.compose-visual-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.compose-visual-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid var(--border);
}

.compose-visual-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.compose-visual-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}

.compose-visual-remove {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.file-meta {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hint-box {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.hint-box strong {
  font-weight: 700;
  color: var(--text);
}

.transcript-panel { margin-top: 12px; }

.voice-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
}

.voice-panel-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.voice-fieldset {
  border: none;
  margin: 0 0 10px;
  padding: 0;
}

.voice-radio-row {
  margin-bottom: 4px;
}

.voice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.voice-list[hidden],
.voice-fieldset[hidden] {
  display: none !important;
}

.voice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.voice-item.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.voice-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 180px;
  min-width: 0;
}

.voice-item-label {
  font-weight: 600;
}

.voice-item-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.btn.voice-preview-btn {
  padding: 4px 10px;
  font-size: 0.85rem;
}

textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
  resize: vertical;
  min-height: 120px;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.remix-result {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
