/* ============================================================
   Crossfade Audio - Pi7
   Scoped under .cf-stage.

   One white card, three numbered steps down the page. The two bars show
   what the blend length means: track 1, track 2, and the overlap between
   them. Only the last button is filled.
   ============================================================ */

.cf-stage{
  margin: 12px auto 0;
  padding: 6px 12px;
  max-width: 860px;
}

.cf-card{
  background: #fff;
  border: 1px solid #e9ebf4;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(34, 37, 90, 0.04), 0 6px 20px rgba(34, 37, 90, 0.05);
  padding: 6px 22px 18px;
}

.cf-step{ padding: 16px 0; }
/* Divider only between steps that are actually on screen (hidden ones add none) */
.cf-step + .cf-step:not(.hide){ border-top: 1px solid #eef0f6; }

.cf-step-title{
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: #2d3150;
}
.cf-num{
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--pcolor);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cf-hint{
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

/* ==================== Step 1: two files ==================== */
.cf-picks{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.cf-input{
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}
.cf-drop{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  border: 2px dashed #b9bce4;
  border-radius: 12px;
  background: #fbfbff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.cf-drop:hover, .cf-drop.dragging{ border-color: var(--pcolor); background: #f5f6ff; }
.cf-drop.hide{ display: none; }
.cf-slot-tag{
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #7a7f95;
}
.cf-drop-text{ font-size: 14px; color: var(--muted); }
.cf-drop .btnsel{
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.cf-file{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 132px;
  padding: 14px 14px 14px 16px;
  border: 1px solid #dfe2f2;
  border-left: 4px solid var(--pcolor);
  border-radius: 12px;
  background: #f8f9ff;
  justify-content: center;
}
.cf-file.hide{ display: none; }
.cf-file-tag{
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #7a7f95;
}
.cf-file-name{
  font-size: 15px;
  font-weight: 600;
  color: #2d3150;
  word-break: break-word;
  line-height: 1.3;
}
.cf-file-sub{ font-size: 13px; color: var(--muted); }
.cf-remove{
  align-self: flex-start;
  margin-top: 8px;
  padding: 4px 2px;
  border: none;
  background: none;
  color: #b00d44;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ==================== Step 2: the blend ==================== */
.cf-bars{
  position: relative;
  height: 86px;
  margin-bottom: 6px;
}
.cf-track{
  position: absolute;
  box-sizing: border-box;      /* padding must not make the bar longer than the song */
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  overflow: hidden;
  transition: width 0.12s, left 0.12s;
}
.cf-track-a{
  top: 4px;
  background: linear-gradient(90deg, #5157c4 0%, #6b71d6 100%);
  color: #fff;
}
.cf-track-b{
  top: 46px;
  background: linear-gradient(90deg, #d8578a 0%, #e3789f 100%);
  color: #fff;
}
.cf-bar-label{ font-size: 13px; font-weight: 700; white-space: nowrap; }
.cf-overlap{
  position: absolute;
  box-sizing: border-box;      /* the dashed edges sit exactly on the blend edges */
  top: 0;
  height: 84px;
  border-left: 2px dashed #8a90d9;
  border-right: 2px dashed #8a90d9;
  background: rgba(138, 144, 217, 0.14);
  border-radius: 4px;
  transition: width 0.12s, left 0.12s;
}
.cf-bars-note{
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #4a4f6a;
  text-align: center;
}

.cf-row{
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 6px;
}
.cf-row-label{
  flex: 0 0 110px;
  font-size: 14px;
  font-weight: 600;
  color: #2d3150;
}
.cf-row input[type="range"]{ flex: 1; min-width: 60px; margin: 0; accent-color: var(--pcolor); }
.cf-value{
  min-width: 52px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: #2d3150;
  font-variant-numeric: tabular-nums;
}
.cf-select{
  flex: 1 1 auto;
  min-width: 0;
  max-width: 320px;
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid #e1e3ef;
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237a7f95' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color: #2d3150;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.cf-select:hover{ border-color: #c9ccf0; }
.cf-select:focus-visible{ outline: none; border-color: var(--pcolor); box-shadow: 0 0 0 3px rgba(68, 73, 166, 0.15); }

.cf-preview{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.cf-ghost-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--pcolor);
  border-radius: 999px;
  background: #fff;
  color: var(--pcolor);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cf-ghost-btn svg{ width: 13px; height: 13px; }
.cf-ghost-btn:hover:not(:disabled){ background: var(--pcolor); color: #fff; }
.cf-ghost-btn:disabled{ opacity: 0.5; cursor: not-allowed; }
.cf-preview .cf-hint{ margin: 0; }
.cf-preview-player{ width: 100%; height: 40px; margin-top: 12px; }
.cf-preview-player.hide{ display: none; }

/* ==================== Step 3: save ==================== */
.cf-make-btn{
  flex-shrink: 0;
  min-height: 42px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--pcolor);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(68, 73, 166, 0.25);
  transition: background 0.15s;
}
.cf-make-btn:hover:not(:disabled){ background: #3a3f96; }
.cf-make-btn:disabled{ opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.processing{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 8px 12px;
  background: #f6f7fc;
  border-radius: 8px;
  color: var(--pcolor);
  font-size: 13px;
  font-weight: 600;
}
.processing.hide{ display: none; }
.proc-spin{
  width: 16px;
  height: 16px;
  border: 2px solid var(--pcolor);
  border-top-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: cf-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes cf-spin{ to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce){ .proc-spin{ animation-duration: 2.4s; } }
.cancel-btn{
  margin-left: auto;
  padding: 4px 2px;
  border: none;
  background: none;
  color: #b00d44;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cancel-btn:disabled{ opacity: 0.4; cursor: not-allowed; }

.result-card{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: #f6f7fc;
  border-radius: 10px;
}
.result-card.hide{ display: none; }
.result-card audio{ width: 100%; height: 40px; }
.result-side{ display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.result-meta{ font-size: 13px; color: #3f4460; font-weight: 600; }
.result-actions{ display: flex; gap: 12px; align-items: center; }
.result-actions .download-btn{
  height: 38px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--pcolor);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.result-actions .download-btn:hover{ background: #3a3f96; }
.result-actions .ctrl-btn{
  padding: 4px 2px;
  border: none;
  background: none;
  color: #4a4f6a;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ==================== Article (content pass) ==================== */
.illus{ margin: 24px 0 36px; display: flex; justify-content: center; }
.illus img{
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(68, 73, 166, 0.14);
}
.cf-table-wrap{ overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 18px 0; }
.articlesec table{
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 15px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(68, 73, 166, 0.06);
}
.articlesec thead{ background: var(--pcolor); color: #fff; }
.articlesec th{ text-align: left; padding: 12px 14px; font-weight: 600; font-size: 14px; }
.articlesec td{ padding: 11px 14px; border-top: 1px solid #eef0fa; color: #262626; vertical-align: top; }
.articlesec tbody tr:nth-child(even){ background: #f8f9ff; }

/* ==================== Phones ==================== */
@media screen and (max-width: 640px){
  .cf-stage{ padding: 4px 4px; }
  .cf-card{ padding: 4px 14px 14px; border-radius: 14px; }
  .cf-picks{ grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .cf-drop, .cf-file{ min-height: 108px; }
  .cf-row{ flex-wrap: wrap; min-height: 44px; }
  .cf-row-label{ flex: 0 0 100%; }
  .cf-select{ max-width: none; height: 44px; }
  .cf-make-btn, .cf-ghost-btn{ min-height: 46px; }
  .cf-make-btn{ width: 100%; }
  .articlesec th{ padding: 10px 10px; font-size: 13px; }
  .articlesec td{ padding: 9px 10px; font-size: 14px; }
}
