:root {
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --fog: rgba(148, 163, 184, 0.12);
  --card: rgba(255, 255, 255, 0.92);
  --card-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(30, 41, 59, 0.1);
  --line-strong: rgba(30, 41, 59, 0.16);
  --text: #1e293b;
  --muted: #64748b;
  --muted-strong: #475569;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --radius-board: 28px;
  --radius-card: 18px;
  --radius-input: 12px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 32px rgba(15, 23, 42, 0.07);
  --shadow-board: 0 1px 2px rgba(15, 23, 42, 0.04), 0 20px 48px rgba(15, 23, 42, 0.05);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Helvetica Neue", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
}

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.navbar-logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.navbar-links {
  display: flex;
  gap: 24px;
}

.navbar-link {
  color: var(--muted-strong);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s var(--ease-out);
}

.navbar-link:hover {
  color: var(--accent);
}

@media (max-width: 768px) {
  .navbar-links {
    gap: 16px;
  }
  
  .navbar-link {
    font-size: 13px;
  }
  
  .navbar-container {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .navbar-links {
    display: none;
  }
  
  .navbar-logo {
    font-size: 16px;
  }
}

.app {
  max-width: 1200px;
  width: 100%;
  margin: 24px auto 32px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* 主要内容：导入 SRT */
.main-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.card-import {
  width: 100%;
  max-width: 1200px;
}

/* 次要内容：三个卡片组件 */
.secondary-content {
  width: 100%;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* 确保卡片在网格中正确显示 */
.cards-grid .card {
  width: 100%;
  box-sizing: border-box;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .card-import {
    max-width: 600px;
  }
}

@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  
  .card-import {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .app {
    margin: 20px auto 28px;
    padding: 0 16px;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .app {
    margin: 16px auto 24px;
    padding: 0 12px;
    gap: 16px;
  }
}

.hero {
  margin-bottom: 16px;
  padding: 8px 0;
  text-align: center;
}

.hero-title {
  margin: 0;
  font-size: clamp(24px, 5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
}

.hero-icon {
  width: clamp(28px, 4.4vw, 44px);
  height: clamp(28px, 4.4vw, 44px);
  flex: 0 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.hero-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  margin-top: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: all 0.2s var(--ease-out);
}

.card:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  border-color: var(--accent);
}

.mega-board {
  margin-bottom: 24px;
}

.board-grid {
  display: grid;
  gap: 20px;
}

h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: clamp(22px, 2vw, 32px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 620;
}

.card-head {
  margin-bottom: 16px;
}

.card-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.upload {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  display: block;
  padding: 18px 16px;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  background: rgba(247, 250, 253, 0.72);
}

.upload.drop-active {
  border-color: var(--accent);
  background: rgba(239, 245, 250, 0.98);
  transform: translateY(-1px);
}

.upload input {
  display: none;
}

.textarea-wrap label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

textarea {
  width: 100%;
  min-height: 176px;
  border-radius: var(--radius-input);
  border: 1px solid var(--line);
  background: rgba(249, 251, 253, 0.96);
  color: var(--text);
  padding: 13px 14px;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 500;
}

input {
  border-radius: var(--radius-input);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  border-radius: var(--radius-input);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

button {
  border: none;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #ffffff;
  transition: transform 0.18s var(--ease-out), opacity 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), background 0.18s var(--ease-out);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.25);
  font-size: 14px;
  line-height: 1.4;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

button:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2);
}

button:disabled {
  background: #94a3b8;
  color: #e2e8f0;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.status {
  margin: 14px 0 0;
  color: var(--muted-strong);
  min-height: 22px;
  font-size: 13px;
  line-height: 1.5;
}

.preview-tip {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.preview-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #f4f7fa 0%, #ebf0f5 100%);
}

#previewCanvas {
  width: 100%;
  height: auto;
  display: block;
}

.preview-meta {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.batch-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.subs-list {
  display: grid;
  gap: 10px;
  max-height: 380px;
  overflow: auto;
  padding-right: 4px;
}

.sub-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(248, 251, 254, 0.86);
}

.sub-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.sub-row textarea {
  min-height: 78px;
}

.sub-delete-btn {
  background: #9d5e5e;
  color: #fff1f1;
  box-shadow: none;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}

.preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.preset-label {
  font-size: 12px;
  font-weight: 600;
  color: #516274;
  letter-spacing: 0.04em;
  margin-right: 2px;
}

.preset-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.18);
  box-shadow: none;
  transition: transform 0.18s var(--ease-out), background 0.18s var(--ease-out), color 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}

.preset-btn:hover {
  background: rgba(59, 130, 246, 0.16);
  transform: translateY(-1px);
  box-shadow: none;
}

.preset-btn.active {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

.preview-wrap {
  margin-top: 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding-top: 14px;
}

.preview-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #516274;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.fcpx-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background:
    repeating-linear-gradient(45deg, #1b2230 0 12px, #1f2735 12px 24px);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
}

.fcpx-preview-text {
  position: absolute;
  left: 0;
  right: 0;
  padding: 0 24px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  line-height: 1.25;
  white-space: pre-wrap;
  word-break: break-word;
}

.draggable-card {
  cursor: grab;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}

.draggable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 16px 36px rgba(15, 23, 42, 0.08);
}

.draggable-card.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.draggable-card.drop-target {
  outline: 2px dashed rgba(63, 95, 124, 0.45);
  outline-offset: 4px;
}

[data-reveal],
.split-word {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out);
}

[data-reveal].is-visible,
.split-word.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal="fade"] {
  transform: translateY(0);
}

.split-line {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.16em;
}

.split-word {
  display: inline-block;
  will-change: transform, opacity;
}

/* 移除可能影响卡片布局的媒体查询规则 */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal],
  .split-word {
    opacity: 1;
    transform: none;
  }
}

.footer {
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 24px 0;
  margin-top: auto;
  width: 100%;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-copyright {
  text-align: center;
  color: #999;
  font-size: 12px;
  line-height: 1.6;
}

.footer-copyright p {
  margin: 0;
  white-space: nowrap;
}

.footer-copyright a {
  color: #999;
  text-decoration: none;
}

.footer-copyright a:hover {
  text-decoration: underline;
}

.beian {
  display: inline;
  white-space: nowrap;
}

.beian + .beian {
  margin-left: 16px;
}

@media (max-width: 768px) {
  .footer {
    padding: 20px 0;
    margin-top: 32px;
  }
  
  .footer-container {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .footer {
    padding: 16px 0;
    margin-top: 24px;
  }
  
  .footer-copyright {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .batch-grid {
    grid-template-columns: 1fr;
  }

  .inspector-grid {
    grid-template-columns: 1fr;
  }
}
