.rs-stage{
  max-width: 760px;
  margin: 14px auto 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rs-stage input[type="file"]{ display: none; }

.upload-box{
  display: flex;
  justify-content: center;
}
.upload-box label{
  width: 100%;
  border-radius: 8px;
  border: 2px dashed #c9cee5;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
  padding: 14px 18px;
}
.upload-box label:hover{
  border-style: solid;
  border-color: var(--pcolor);
  background: #f8f9ff;
}
.upload-box .upload-hint{
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  flex: 1;
  text-align: left;
}
.upload-box .xbtn{ flex-shrink: 0; }
@media screen and (max-width: 500px){
  .upload-box label{ flex-direction: column; gap: 8px; padding: 14px; }
  .upload-box .upload-hint{ text-align: center; flex: 0 0 auto; }
}

.section-title{
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.audio-card{
  background: #fff;
  border: 1px solid #eef0fa;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.audio-head{
  display: flex;
  align-items: center;
  gap: 12px;
}
.audio-head .file-name{
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #262626;
  word-break: break-all;
  min-width: 0;
}
.audio-head .file-sub{
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  white-space: nowrap;
}
.waveform-wrap{
  background: #f8f9ff;
  border-radius: 6px;
  padding: 8px;
  min-height: 100px;
  position: relative;
}
.waveform-loading{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

/* Silence regions painted by WaveSurfer Regions plugin */
#waveform .wavesurfer-region{
  background: rgba(211, 27, 90, 0.22) !important;
  border-top: 1px solid rgba(211, 27, 90, 0.5) !important;
  border-bottom: 1px solid rgba(211, 27, 90, 0.5) !important;
}
#waveform ::part(region){
  background: rgba(211, 27, 90, 0.22) !important;
}

.audio-controls{
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.audio-controls .play-btn{
  background: var(--pcolor);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-width: 70px;
}
.audio-controls .play-btn:hover{ background: #373c8f; }
.audio-controls .play-btn.playing{ background: #d31b5a; }
.legend{
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.legend-dot{
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.legend-dot.kept{ background: var(--pcolor); }
.legend-dot.cut{ background: rgba(211, 27, 90, 0.55); }

.remove-btn{
  background: #fff;
  border: 1px solid #e5e7f0;
  color: #b00d44;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.remove-btn:hover{ background: #fff5f7; border-color: #f5c5d3; }

/* Preset chips */
.preset-section{
  background: #fff;
  border: 1px solid #eef0fa;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.preset-chips{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.preset-chip{
  background: #fff;
  border: 1.5px solid #e5e7f0;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.preset-chip:hover{
  border-color: var(--pcolor);
  background: #f8f9ff;
}
.preset-chip.selected{
  border-color: var(--pcolor);
  background: #eef0fa;
  box-shadow: 0 0 0 1px var(--pcolor) inset;
}
.preset-chip .preset-name{
  font-weight: 700;
  font-size: 13px;
  color: var(--pcolor);
}
.preset-chip .preset-desc{
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
@media screen and (max-width: 600px){
  .preset-chips{ grid-template-columns: repeat(2, 1fr); }
}

.custom-controls{
  background: #f8f9ff;
  border: 1px solid #eef0fa;
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.custom-controls.hide{ display: none; }
.custom-row{
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.custom-label{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: #262626;
}
.custom-value{
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--pcolor);
  font-weight: 700;
}
.custom-row input[type="range"]{
  width: 100%;
  accent-color: var(--pcolor);
  margin: 0;
}
.custom-help{
  font-size: 11px;
  color: var(--muted);
}

.stats-line{
  background: #f1f3ff;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: #262626;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  line-height: 1.5;
}
.stats-line.empty{
  color: var(--muted);
  font-family: inherit;
}
.stats-line .pill{
  background: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--pcolor);
  font-weight: 700;
}
.stats-line .hint{
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
}

.keep-gaps{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #262626;
  cursor: pointer;
}
.keep-gaps input[type="checkbox"]{
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--pcolor);
  margin: 0;
}

.process-btn{
  background: linear-gradient(135deg, #4449a6, #373c8f);
  color: #fff;
  border: none;
  padding: 14px 26px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: block;
  width: 100%;
  box-shadow: 0 6px 18px rgba(68, 73, 166, 0.30);
  transition: transform 0.15s, box-shadow 0.15s;
}
.process-btn:hover:not(:disabled){
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(68, 73, 166, 0.42);
}
.process-btn:disabled{
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.processing{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eef0fa;
  color: var(--pcolor);
  font-size: 14px;
}
.proc-spin{
  width: 22px;
  height: 22px;
  border: 3px solid var(--pcolor);
  border-top-color: rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin{ to { transform: rotate(360deg); } }
.cancel-btn{
  margin-left: auto;
  background: #fff;
  border: 1px solid #f5c5d3;
  color: #b00d44;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cancel-btn:hover{ background: #fff5f7; border-color: #b00d44; }
.cancel-btn:disabled{ opacity: 0.4; cursor: not-allowed; }

.result-card{
  background: #fff;
  border: 1px solid #eef0fa;
  border-radius: 8px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.result-card::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4449a6, #d31b5a);
}
.result-card audio{
  width: 100%;
  margin-bottom: 10px;
}
.result-meta{
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  margin-bottom: 12px;
}
.result-actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.result-actions a, .result-actions button{
  flex: 1 1 130px;
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
}
.result-actions .download-btn{ background: var(--pcolor); color: #fff; }
.result-actions .download-btn:hover{ background: #373c8f; }
.result-actions .ctrl-btn{
  background: #fff;
  color: var(--pcolor);
  border: 1px solid #e5e7f0;
}
.result-actions .ctrl-btn:hover{ border-color: var(--pcolor); }

/* Articlesec table (reused pattern) */
.articlesec table{
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
  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: 13px;
}
.articlesec td{
  padding: 11px 14px;
  border-top: 1px solid #eef0fa;
  color: #262626;
  vertical-align: top;
}
.articlesec tbody tr:nth-child(even){ background: #f8f9ff; }

.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);
}
