/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0a0a0d;
  --surface: #14141a;
  --border:  #252530;
  --yellow:  #e8ff47;
  --text:    #f5f5f8;
  --muted:   #8a8a9a;
  --red:     #f0524f;
  --green:   #3ecf8e;
  --mono:    'JetBrains Mono', 'Fira Mono', monospace;
  --sans:    'Inter', system-ui, sans-serif;
  --r:       12px;
  --shadow:  0 10px 30px rgba(0,0,0,0.3);
}

body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); min-height: 100vh;
  display: flex; flex-direction: column;
  font-size: 15px; -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
header {
  padding: 0 32px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  background: rgba(14,14,17,0.92); backdrop-filter: blur(12px);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-box {
  width: 28px; height: 28px; background: var(--yellow);
  border-radius: 7px; display: flex; align-items: center;
  justify-content: center; font-size: 13px; color: #000; font-weight: 900;
}
.logo-name { font-size: 14px; font-weight: 700; color: var(--text); }
.logo-dot  { color: var(--muted); font-weight: 400; }
.badge {
  font-family: var(--mono); font-size: 10px; color: var(--green);
  border: 1px solid rgba(62,207,142,.25); padding: 4px 10px;
  border-radius: 20px; background: rgba(62,207,142,.08);
}

/* ── Main ── */
main { flex: 1; max-width: 720px; margin: 0 auto; width: 100%; padding: 48px 24px 80px; }

/* ── Hero ── */
.hero { margin-bottom: 40px; }
.hero h1 {
  font-size: clamp(34px, 5vw, 54px); font-weight: 800;
  line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 12px;
}
.hero h1 .y { color: var(--yellow); }
.hero p { color: var(--muted); font-size: 15px; line-height: 1.7; }
.hero p strong { color: var(--text); }

/* ── Card ── */
.card {
  background: var(--surface); 
  border: 1px solid var(--border);
  border-radius: var(--r); 
  overflow: hidden; 
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-head {
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: .1em; text-transform: uppercase;
}

/* ── Upload zone ── */
.upload-zone {
  position: relative; padding: 40px 24px; text-align: center;
  cursor: pointer; transition: all .2s ease;
  min-height: 140px; display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--r);
}
.upload-zone:hover { 
  background: rgba(232,255,71,.02); 
  border-color: var(--yellow);
}
.upload-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0;
  cursor: pointer; width: 100%; height: 100%; z-index: 2;
}
#upload-placeholder {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; pointer-events: none;
}
.upload-icon  { font-size: 28px; color: var(--yellow); }
.upload-title { font-size: 16px; font-weight: 600; }
.upload-meta  { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── Thumbnail ── */
#thumb-state { display: flex; align-items: center; gap: 16px; padding: 4px 0; pointer-events: none; width: 100%; }
#thumb-wrap  {
  position: relative; width: 140px; height: 88px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px solid var(--border);
}
#thumb-video { width: 140px; height: 88px; object-fit: cover; display: block; pointer-events: none; }
.thumb-loading {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 20px; background: var(--bg); color: var(--muted);
}
.thumb-info   { text-align: left; min-width: 0; }
.thumb-filename { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 5px; word-break: break-all; line-height: 1.4; }
.thumb-meta   { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.thumb-hint   { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .05em; }

/* ── Controls ── */
.controls { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--border); }
.ctrl { background: var(--surface); padding: 10px 14px 12px; }
.ctrl label { display: block; font-family: var(--mono); font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.ctrl select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 7px 10px; border-radius: 6px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  appearance: none; cursor: pointer; outline: none; transition: border-color .15s;
}
.ctrl select:focus { border-color: var(--yellow); }

/* ── Trim ── */
.trim-section { padding: 16px; }
.trim-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.trim-row span { font-family: var(--mono); font-size: 10px; color: var(--muted); width: 32px; flex-shrink: 0; }
.trim-row input[type=range] { flex: 1; accent-color: var(--yellow); height: 4px; cursor: pointer; }
.trim-time { font-family: var(--mono); font-size: 12px; font-weight: 700; width: 56px; text-align: center; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 4px 6px; }
.trim-bar  { height: 4px; background: var(--border); border-radius: 2px; position: relative; margin: 4px 0 8px; overflow: hidden; }
.trim-fill { position: absolute; top: 0; height: 100%; background: var(--yellow); border-radius: 2px; max-width: 100%; }

/* ── Estimate ── */
.est-info {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: rgba(232,255,71,.04); border: 1px solid rgba(232,255,71,.12);
  border-radius: 6px; padding: 7px 12px; letter-spacing: .03em;
}
.est-info strong { color: var(--yellow); }

/* ── Submit ── */
.btn-submit {
  width: 100%; padding: 17px; background: var(--yellow); color: #000;
  border: none; border-radius: var(--r); font-family: var(--mono);
  font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; cursor: pointer; transition: all .18s;
}
.btn-submit:hover   { background: #f0ff5a; transform: translateY(-1px); }
.btn-submit:active  { transform: translateY(0) scale(.99); }
.btn-submit:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; transform: none; }

/* ── Progress ── */
.progress-content { padding: 4px 0 8px; }
.progress-bar-wrap { margin-bottom: 10px; }
.progress-bar-track {
  height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; width: 2%;
  background: linear-gradient(90deg, #7c6fff, var(--yellow), #7c6fff);
  background-size: 200%;
  border-radius: 2px;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.progress-label { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: center; }
.progress-timer { font-family: var(--mono); font-size: 11px; color: var(--yellow); text-align: center; margin-top: 4px; min-height: 16px; }

/* ── Error ── */
.msg-error {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px; margin-bottom: 4px;
  background: rgba(240,82,79,.08); border: 1px solid rgba(240,82,79,.25);
  border-radius: var(--r); font-family: var(--mono); font-size: 12px; color: var(--red);
}

/* ── Success / multi-part ── */
.msg-success-multi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin-bottom: 4px;
}
.multi-head {
  display: flex; align-items: flex-end; gap: 14px;
  padding: 20px 18px 16px; border-bottom: 1px solid var(--border);
}
.multi-num {
  font-family: var(--mono); font-size: 44px; font-weight: 700;
  color: var(--yellow); line-height: 1; letter-spacing: -.04em;
}
.multi-meta { padding-bottom: 3px; }
.multi-meta p { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.success-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.success-tags span {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border); padding: 3px 8px; border-radius: 20px;
}
.success-tags span.tag-local {
  color: #b6f09c; border-color: #3a5a2a; background: rgba(120,200,90,0.08);
}
.mode-indicator {
  display: none; margin-top: 8px; font-family: var(--mono); font-size: 11px;
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border);
}
.mode-indicator.visible { display: block; }
.mode-indicator.local  { color: #b6f09c; border-color: #3a5a2a; background: rgba(120,200,90,0.06); }
.mode-indicator.server { color: #58a6ff; border-color: rgba(88,166,255,0.25); background: rgba(88,166,255,0.06); }

.part-list { padding: 4px 0; }
.part-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.part-row:last-child { border-bottom: none; }
.part-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.part-name { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.part-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.part-dl {
  flex-shrink: 0; font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  color: #000; background: var(--yellow); padding: 10px 20px;
  border-radius: 8px; transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(232, 255, 71, 0.3);
}
.part-dl:hover { 
  background: #f0ff5a; 
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 255, 71, 0.4);
}

/* ── How it works ── */
.how-section { margin-top: 48px; padding-bottom: 16px; }
.how-title { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 16px; }
.how-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.how-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 16px; display: flex; gap: 14px; align-items: flex-start; }
.how-icon  { font-size: 18px; color: var(--yellow); flex-shrink: 0; margin-top: 1px; width: 22px; text-align: center; }
.how-head  { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 7px; }
.how-body p { font-size: 12px; color: var(--muted); line-height: 1.65; }
.how-body strong { color: var(--text); font-weight: 600; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border); padding: 14px 32px;
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--yellow); }

/* ── Responsive ── */
@media(max-width:580px){
  header  { padding: 0 16px; }
  main    { padding: 28px 14px 60px; }
  .controls { grid-template-columns: 1fr 1fr; }
  #thumb-state { flex-direction: column; text-align: center; }
  #thumb-wrap  { width: 100%; height: 120px; }
  .thumb-info  { text-align: center; }
  .how-grid { grid-template-columns: 1fr; }
}
