/* 全息風扇轉檔器 · 現代化科技感 UI 樣式系統 */

:root {
  --bg-base: #0c1017;
  --bg-surface: #141b24;
  --bg-surface-elevated: #1b2432;
  --bg-surface-glass: rgba(20, 27, 36, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 242, 254, 0.45);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-grad: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --accent-grad-hover: linear-gradient(135deg, #38f9d7 0%, #43e97b 100%);
  --btn-grad: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  --btn-grad-hover: linear-gradient(135deg, #00d4ff 0%, #0880ff 100%);
  --glow-cyan: 0 0 24px rgba(0, 242, 254, 0.25);
  --glow-subtle: 0 4px 20px rgba(0, 0, 0, 0.35);
  --danger: #ff4b55;
  --success: #10b981;
  --warning: #f59e0b;
  --code-bg: #1e293b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-base: #f4f6fa;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f8fafc;
    --bg-surface-glass: rgba(255, 255, 255, 0.9);
    --border-subtle: #e2e8f0;
    --border-focus: #0284c7;
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-faint: #94a3b8;
    --code-bg: #e2e8f0;
    --glow-cyan: 0 0 16px rgba(2, 132, 199, 0.15);
    --glow-subtle: 0 4px 16px rgba(0, 0, 0, 0.06);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  color-scheme: dark light;
}
body {
  background: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 背景霓虹科技感光暈 */
body::before {
  content: "";
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(0, 242, 254, 0.08) 0%, rgba(79, 172, 254, 0.03) 50%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

/* 頂部導航列 */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--bg-surface-glass);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 20px;
}
.nav-container {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.05rem;
}
.nav-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-grad);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.4);
  color: #07121f;
}
.nav-icon svg {
  width: 16px;
  height: 16px;
  animation: fanSpin 6s linear infinite;
}
@keyframes fanSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.nav-links a:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* 容器寬度 */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* Hero 區域 */
.hero {
  padding: 40px 0 28px;
  text-align: center;
}
.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.25);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
@media (prefers-color-scheme: light) {
  .hero h1 {
    background: linear-gradient(135deg, #0f172a 30%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 640px;
  margin: 0 auto 16px;
}
.specs-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.spec-pill {
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* 卡片容器 */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 24px 0;
  box-shadow: var(--glow-subtle);
  transition: border-color 0.2s ease;
}
.card:focus-within {
  border-color: var(--border-focus);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}
.card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 0.95rem;
}
.card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}
.card-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: -10px;
  margin-bottom: 20px;
}

/* 拖曳上傳區 (Dropzone) */
.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.03);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.1);
}
.dropzone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.08);
}
.dropzone-icon svg {
  width: 24px;
  height: 24px;
}
.dropzone-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 6px;
  color: var(--text-main);
}
.dropzone-sub {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-bottom: 14px;
}
.format-tags {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.format-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.hidden-file-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* 已選取檔案資訊條 */
.file-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.file-active-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
.file-badge {
  background: var(--accent-grad);
  color: #07121f;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.file-name {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.file-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* 編輯器佈局 (兩欄式) */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

/* 畫布視窗與全息風扇模擬框架 */
.canvas-card {
  background: #000000;
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.canvas-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.canvas-hud-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-cyan);
}
.canvas-container {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  user-select: none;
}
canvas#view {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

/* 控制面板 */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

/* 快速預設晶片 */
.presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chip-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.chip-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* 微調滑桿與計數器 */
.slider-group {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.slider-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}
.slider-val-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.step-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
  background: rgba(0, 242, 254, 0.1);
}
input[type=range] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #334155;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

/* 操作按鈕組 */
.action-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}
.btn-primary {
  width: 100%;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 700;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--btn-grad);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(0, 114, 255, 0.35);
  transition: all 0.25s ease;
}
.btn-primary:hover:not(:disabled) {
  background: var(--btn-grad-hover);
  box-shadow: 0 6px 24px rgba(0, 114, 255, 0.5);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

/* 進度條 */
.progress-card {
  margin-top: 18px;
  padding: 16px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}
progress#prog {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
  background: transparent;
}
progress#prog::-webkit-progress-bar {
  background: transparent;
}
progress#prog::-webkit-progress-value {
  background: var(--accent-grad);
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}
progress#prog::-moz-progress-bar {
  background: var(--accent-grad);
  border-radius: var(--radius-full);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 結果呈現卡片 */
.result-box {
  margin-top: 24px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, rgba(20, 27, 36, 0.95) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--success);
  font-size: 1.2rem;
  font-weight: 700;
}
.result-content-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: center;
}
@media (max-width: 680px) {
  .result-content-grid {
    grid-template-columns: 1fr;
  }
}
.result-preview-circle {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: #000000;
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.35);
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-preview-circle canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.result-meta-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result-stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stat-pill {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-main);
}
.stat-pill strong {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}
.btn-download-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-grad);
  color: #07121f;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
  transition: all 0.25s ease;
}
.btn-download-big:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 242, 254, 0.6);
}

/* BIN 預覽播放器專用樣式 */
.bin-player-wrap {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 20px;
}
@media (max-width: 800px) {
  .bin-player-wrap {
    grid-template-columns: 1fr;
  }
}
.bin-screen-bezel {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: #000000;
  border: 4px solid #1e293b;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 40px rgba(0, 0, 0, 0.9);
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bin-screen-bezel canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}
.bin-screen-bezel::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  border: 1px dashed rgba(0, 242, 254, 0.2);
  pointer-events: none;
}
.player-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.player-transport {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-grad);
  border: 0;
  color: #07121f;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.35);
  transition: all 0.2s ease;
}
.btn-play svg {
  width: 22px;
  height: 22px;
}
.btn-play:hover {
  transform: scale(1.06);
}
.btn-step {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-step:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.timecode-display {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.speed-toggle-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.speed-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  cursor: pointer;
}
.speed-btn.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* 測試包展示 */
.testkit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}
@media (max-width: 680px) {
  .testkit-grid {
    grid-template-columns: 1fr;
  }
}
.testkit-item-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.testkit-item-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-main);
}
.thumbs-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.thumb-item {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-subtle);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.thumb-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}
.thumb-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* 規格清單與表格 */
.table-container {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  text-align: left;
}
th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}
tr:last-child td {
  border-bottom: 0;
}

/* 提示與錯誤訊息 */
.note-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(0, 242, 254, 0.05);
  border-left: 3px solid var(--accent-cyan);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 14px 0;
}
.error-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 75, 85, 0.1);
  border-left: 3px solid var(--danger);
  color: #ff8a80;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 14px 0;
}

/* 頁尾 */
footer {
  text-align: center;
  padding: 40px 0;
  color: var(--text-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 40px;
}
