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

/* Upload box (shared pattern) */
.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 with waveform */
.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;
}

/* Region styling - green fill + green handles, matches the Audio Cutter look */
#waveform ::part(region-handle-left){
  border-left: 7px solid #4CAF50;
  width: 0;
}
#waveform ::part(region-handle-right){
  border-right: 7px solid #4CAF50;
  width: 0;
}
#waveform ::part(region-handle-left)::after,
#waveform ::part(region-handle-right)::after{
  content: ".\A.\A.";
  white-space: pre;
  width: 9px;
  height: 35px;
  background: #fff8f8;
  position: absolute;
  top: calc(50% - 18px);
  transform: translateX(-8px);
  border-radius: 23px;
  color: #4CAF50;
  line-height: 9px;
  text-align: center;
  cursor: ew-resize;
}
#waveform ::part(region-handle-right)::after{
  transform: translateX(-1px);
}
.wavesurfer-region{
  fill: rgba(34, 197, 94, 0.18) !important;
  stroke: rgba(34, 197, 94, 0.95) !important;
  stroke-width: 2px !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; }

/* Live length pill - color cues for good / yellow / red ringtone length */
.length-pill{
  display: inline-flex;
  align-items: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 12px;
  background: #f1f3ff;
  color: var(--pcolor);
  font-weight: 600;
}
.length-pill.good{ background: #e7f6ed; color: #1f7a3a; }
.length-pill.warn{ background: #fef5e1; color: #8a5a09; }
.length-pill.bad{ background: #fde6ec; color: #b00d44; }

/* mm:ss time inputs */
.time-inputs{
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.time-inputs label{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.time-inputs input[type="text"]{
  width: 64px;
  height: 28px;
  padding: 0 6px;
  font-size: 13px;
  border: 1px solid #e5e7f0;
  border-radius: 4px;
  text-align: center;
  outline: none;
  font-family: ui-monospace, monospace;
  box-sizing: border-box;
}
.time-inputs input[type="text"]:focus{ border-color: var(--pcolor); }

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

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

/* Advanced disclosure */
.advanced-disclosure{
  border-top: 1px solid #eef0fa;
  padding-top: 10px;
}
.advanced-disclosure summary{
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.advanced-disclosure summary::-webkit-details-marker{ display: none; }
.advanced-disclosure summary::before{
  content: "+ ";
  color: var(--pcolor);
  font-weight: 700;
}
.advanced-disclosure[open] summary::before{ content: "- "; }
.advanced-body{
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.adv-row{
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.adv-label{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: #262626;
}
.adv-value{
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--pcolor);
  font-weight: 700;
}
.adv-row input[type="range"]{
  width: 100%;
  accent-color: var(--pcolor);
  margin: 0;
}
.adv-help{
  font-size: 11px;
  color: var(--muted);
}

.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;
  margin-bottom: 8px;
}
.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); }

/* Install instructions disclosure */
.install-disclosure{
  margin-top: 10px;
  border-top: 1px solid #eef0fa;
  padding-top: 10px;
}
.install-disclosure summary{
  cursor: pointer;
  font-size: 13px;
  color: var(--pcolor);
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.install-disclosure summary::-webkit-details-marker{ display: none; }
.install-disclosure summary::before{
  content: "+ ";
  font-weight: 700;
}
.install-disclosure[open] summary::before{ content: "- "; }
.install-panel{
  margin-top: 10px;
  background: #f8f9ff;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 13px;
  color: #262626;
  line-height: 1.5;
}
.install-panel ol{
  margin: 6px 0 0 18px;
  padding: 0;
}
.install-panel li{ margin: 4px 0; }
.install-panel strong{ color: var(--pcolor); }

/* Articlesec table */
.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);
}
