:root {
  --top: 72px;
  --sub-font-size: 18px;
  --sub-line-height: 1.45;
  --sub-visible-lines: 2;
  --sub-text-height: calc(var(--sub-font-size) * var(--sub-line-height) * var(--sub-visible-lines));
  --sub-height: calc(var(--sub-text-height) + 54px);
  --blue: #1d7fe8;
  --blue2: #3b9eff;
  --blue-dark: #0b3d91;
  --bg: #0b1220;
  --line: rgba(255, 255, 255, 0.1);
  --font: "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: #eef2f7;
}

.deck {
  display: grid;
  grid-template-rows: var(--top) minmax(0, 1fr) var(--sub-height);
  height: 100vh;
}

.deck-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.96);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.sections {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: thin;
}

.section-btn {
  flex: 1 1 0;
  min-width: 120px;
  max-width: 220px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.3;
}

.section-btn:hover {
  background: rgba(29, 127, 232, 0.12);
  border-color: rgba(29, 127, 232, 0.35);
  color: #fff;
}

.section-btn.active {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(29, 127, 232, 0.35);
}

.section-btn.outro {
  min-width: 88px;
  max-width: 100px;
  text-align: center;
  border-color: rgba(16, 185, 129, 0.35);
}

.section-btn.outro.active {
  background: linear-gradient(135deg, #047857, #10b981);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.section-btn .num {
  display: block;
  font-size: 10px;
  opacity: 0.75;
  margin-bottom: 2px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.controls button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.controls button:hover { background: rgba(29, 127, 232, 0.2); }

#section-indicator {
  font-size: 12px;
  color: #94a3b8;
  min-width: 44px;
  text-align: center;
}

.audio-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
  margin-left: 4px;
  white-space: nowrap;
}

.deck-main {
  position: relative;
  min-height: 0;
  background: #000;
}

#demo-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

.deck-sub {
  height: var(--sub-height);
  min-height: 0;
  padding: 8px 20px 10px;
  border-top: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.98);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sub-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.sub-audio-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(29, 127, 232, 0.45);
  background: rgba(29, 127, 232, 0.15);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.sub-audio-btn:hover:not(:disabled) {
  background: rgba(29, 127, 232, 0.32);
  border-color: rgba(29, 127, 232, 0.7);
}

.sub-audio-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sub-audio-btn.is-playing .sub-audio-icon {
  font-size: 10px;
  letter-spacing: -1px;
}

.sub-meta strong {
  font-size: 14px;
  color: var(--blue);
  font-weight: 700;
}

#sub-index {
  font-size: 11px;
  color: #64748b;
}

.sub-audio-hint {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
  white-space: nowrap;
}

.sub-audio-hint.is-done {
  color: #34d399;
}

.sub-text-wrap {
  flex: 0 0 auto;
  height: var(--sub-text-height);
  max-height: var(--sub-text-height);
  overflow-y: auto;
  margin-right: -4px;
  padding-right: 4px;
  scrollbar-width: thin;
}

.sub-text {
  font-size: var(--sub-font-size);
  line-height: var(--sub-line-height);
  color: #e2e8f0;
  max-width: 1100px;
  white-space: pre-wrap;
}

.sub-text.is-syncing {
  color: #f8fafc;
}

.sub-progress {
  margin-top: 6px;
  height: 3px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  max-width: 1100px;
}

#sub-progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue2));
  border-radius: inherit;
  transition: width 0.08s linear;
}

@media (max-width: 900px) {
  :root {
    --top: auto;
    --sub-font-size: 16px;
    --sub-height: calc(var(--sub-text-height) + 58px);
  }
  .deck { grid-template-rows: auto minmax(0, 1fr) var(--sub-height); }
  .deck-top { flex-wrap: wrap; padding: 10px 12px; }
  .sections { width: 100%; order: 3; }
  .section-btn { min-width: 140px; }
}
