/* ─── 60fps Mockup 復刻 ─── */
:root {
  --bg: #0d0d12;
  --bg-soft: #15151d;
  --bg-card: #1c1c26;
  --text: #f0f0f6;
  --text-dim: #8b8b9c;
  --accent: #4f8ef7;
  --accent-soft: rgba(79, 142, 247, 0.14);
  --border: rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --font: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ─── Topbar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); font-size: 20px; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-tag { font-size: 12px; color: var(--text-dim); }

.ghost-btn {
  padding: 9px 20px; border-radius: 11px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.23, 1, 0.32, 1), filter 0.2s;
}
.ghost-btn:hover:not(:disabled) { filter: brightness(1.12); }
.ghost-btn:active:not(:disabled) { transform: scale(0.95); }
.ghost-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ─── Layout ─── */
.layout {
  flex: 1; display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0; max-width: 1500px; width: 100%; margin: 0 auto;
}

/* ─── Panel ─── */
.panel {
  padding: 22px 22px 30px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 93px);
  position: sticky; top: 71px;
}
.panel-sec { margin-bottom: 26px; }
.panel-sec.hidden { display: none; }
.sec-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px;
}

/* 上傳 */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 34px 18px; text-align: center; cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.2s;
  outline: none;
}
.upload-zone:hover, .upload-zone.dragover, .upload-zone:focus-visible {
  border-color: var(--accent); background: var(--accent-soft);
}
.upload-zone.dragover { transform: scale(1.01); }
.upload-zone.hidden { display: none; }
.upload-icon { font-size: 26px; color: var(--accent); transform: rotate(-90deg); margin-bottom: 10px; }
.upload-title { font-size: 14px; font-weight: 500; }
.upload-sub { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.upload-sub.small { font-size: 11px; opacity: 0.75; margin-top: 4px; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.url-input {
  width: 100%; margin-top: 14px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text);
  font-family: var(--font); font-size: 12px; outline: none;
  transition: border-color 0.2s;
}
.url-input:focus { border-color: var(--accent); }
.url-input::placeholder { color: var(--text-dim); }

.file-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 14px; margin-top: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
}
.file-meta.hidden { display: none; }
.file-name {
  font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-btn {
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); font-size: 12px; cursor: pointer;
  transition: all 0.2s;
}
.mini-btn:hover { color: #f87171; border-color: #f87171; }

/* chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text-dim); font-family: var(--font); font-size: 12.5px; cursor: pointer;
  transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip:active { transform: scale(0.94); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* swatches */
.swatch-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.2s;
  position: relative;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: var(--accent); transform: scale(1.15); }
.swatch.grad { width: 46px; border-radius: 12px; }
.color-picker { width: 34px; height: 34px; border: none; border-radius: 50%; cursor: pointer; background: transparent; padding: 0; }

/* bg options */
.bg-options { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; min-height: 34px; }
.file-pick {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border: 1px dashed var(--accent); border-radius: 10px;
  color: var(--accent); font-size: 12px; cursor: pointer; transition: background 0.2s;
}
.file-pick:hover { background: var(--accent-soft); }
.emoji-btn {
  width: 42px; height: 42px; font-size: 22px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-soft); cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.emoji-btn:hover { border-color: var(--accent); transform: scale(1.08); }
.emoji-btn.active { border-color: var(--accent); background: var(--accent-soft); }

/* toggle */
.toggle-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; cursor: pointer; }
.toggle-row input { display: none; }
.toggle-row .toggle {
  width: 40px; height: 22px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border);
  position: relative; transition: background 0.25s;
}
.toggle-row .toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim);
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1), background 0.25s;
}
.toggle-row input:checked + .toggle { background: var(--accent); border-color: var(--accent); }
.toggle-row input:checked + .toggle::after { transform: translateX(18px); background: #fff; }

/* sliders */
.slider-row { margin-bottom: 14px; }
.slider-row label {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px;
}
.slider-row .val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.slider-row input[type="range"] {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 999px; background: var(--bg-card); outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: none;
  transition: transform 0.15s;
}
.slider-row input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* export */
.export-row { display: flex; align-items: center; gap: 12px; }
.primary-btn {
  flex: 1; padding: 13px 20px; border-radius: 12px;
  border: none; background: var(--accent); color: #fff;
  font-family: var(--font); font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.23, 1, 0.32, 1), filter 0.2s;
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.12); }
.primary-btn:active:not(:disabled) { transform: scale(0.97); }
.primary-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.hint { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }

/* ─── Preview ─── */
.preview-area {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; min-height: calc(100vh - 120px);
  position: relative;
}
.preview-welcome { text-align: center; animation: fadeUp 0.6s cubic-bezier(0.23, 1, 0.32, 1) both; }
.preview-welcome.hidden { display: none; }
.welcome-orb {
  width: 84px; height: 84px; margin: 0 auto 26px;
  border-radius: 24px;
  background: radial-gradient(circle at 30% 30%, rgba(79, 142, 247, 0.5), rgba(79, 142, 247, 0.08));
  animation: orbFloat 3.5s ease-in-out infinite;
}
@keyframes orbFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.preview-welcome h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.preview-welcome p { margin-top: 12px; font-size: 14px; color: var(--text-dim); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.preview-stage {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: 100%;
  animation: fadeUp 0.5s cubic-bezier(0.23, 1, 0.32, 1) both;
}
.preview-stage.hidden { display: none; }
#previewCanvas {
  max-width: min(460px, 100%);
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 24px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.preview-controls {
  display: flex; align-items: center; gap: 12px;
  width: min(460px, 100%);
  padding: 10px 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px;
}
.round-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  border: none; background: var(--accent); color: #fff; font-size: 14px; cursor: pointer;
  transition: transform 0.15s;
}
.round-btn:hover { transform: scale(1.08); }
.round-btn:active { transform: scale(0.92); }
.time { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.seek { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px; background: var(--bg-soft); outline: none; }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; }
#liveBadge { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
#liveBadge.live { color: #34d399; }
#liveBadge.rec { color: #f87171; animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ─── Footer ─── */
.footer {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; font-size: 12px; color: var(--text-dim);
  border-top: 1px solid var(--border);
}
.footer-sep { opacity: 0.4; }

/* ─── Toast ─── */
.toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 22px; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s;
  z-index: 100; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ─── Loading overlay ─── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.loading-overlay.hidden { display: none; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { font-size: 14px; color: var(--text); }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel {
    position: static; max-height: none;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .preview-area { min-height: auto; }
  .brand-tag { display: none; }
}
@media (max-width: 480px) {
  .topbar { padding: 12px 16px; }
  .preview-area { padding: 16px; }
}

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