.thespl-muxer-app {
	font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
	line-height: 1.6;
	max-width: 1200px;
	background: #0d1117;
	color: #e6edf3;
	font-size: 1rem;
	padding: 20px;
	border-radius: 8px;
	margin: 20px 0;
	border-top: 0;
}

.thespl-muxer-app * { box-sizing: border-box; }

.thespl-muxer-app h1 { color: #58a6ff; margin-bottom: 30px; font-size: 1.8rem; text-align: center; font-weight: 600; }

.thespl-muxer-app .section-box { position: relative; border: 1px solid #30363d; border-radius: 8px; padding: 35px 25px 25px 25px; margin-top: 30px; background: transparent; }
.thespl-muxer-app .section-title { position: absolute; top: 0; left: 20px; transform: translateY(-50%); background: #0d1117; padding: 0 10px; font-weight: 600; font-size: 1rem; color: #c9d1d9; margin: 0; line-height: 1; z-index: 5; }

.thespl-muxer-app #file-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; align-items: stretch; }

.thespl-muxer-app fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
.thespl-muxer-app fieldset.section-box { border: 1px solid #30363d; padding: 35px 25px 25px 25px; position: relative; }
.thespl-muxer-app legend.section-title { position: absolute; top: 0; left: 20px; transform: translateY(-50%); background: #0d1117; padding: 0 10px; margin: 0; font-weight: 600; font-size: 1rem; color: #c9d1d9; float: none; }

.thespl-muxer-app label { display: block; margin-bottom: 20px; font-size: 14px; cursor: pointer; color: #e6edf3; }
.thespl-muxer-app label strong { display: block; margin-bottom: 8px; color: #e6edf3; font-weight: 600; font-size: 14px; }
.thespl-muxer-app .radio-group { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; padding: 6px 8px; border: 1px solid #30363d; border-radius: 8px; background: #161b22; }
.thespl-muxer-app label.group-label { display: inline-block; margin-bottom: 0; white-space: nowrap; font-size: 14px; font-weight: 600; padding: 0 8px 0 0; border: 0; background: transparent; color: #e6edf3; }
.thespl-muxer-app .radio-group label.radio-option { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 0; white-space: nowrap; font-size: 14px; font-weight: 600; padding: 6px 10px; border: 1px solid #30363d; border-radius: 6px; background: #21262d; color: #e6edf3; cursor: default; }
.thespl-muxer-app .radio-group label.radio-option:not(.disabled-option):hover { border-color: #58a6ff; color: #58a6ff; cursor: pointer; }
.thespl-muxer-app .radio-group label.radio-option.is-selected { border-color: #58a6ff; box-shadow: inset 0 0 0 1px #58a6ff; }
.thespl-muxer-app .radio-group label.is-selected { border-color: #58a6ff; box-shadow: inset 0 0 0 1px #58a6ff; }
.thespl-muxer-app .radio-group label.disabled-option { opacity: 0.6; filter: grayscale(25%); }
.thespl-muxer-app .config-note { font-size: 12px; color: #8b949e; line-height: 1.5; display: block; margin-top: 4px; margin-bottom: 20px; padding-left: 2px; }
.thespl-muxer-app input[type="number"] { padding: 8px 12px; border: 1px solid #30363d; border-radius: 6px; width: 80px; background: #0d1117; color: #e6edf3; text-align: center; font-size: 14px; }
.thespl-muxer-app input[type="checkbox"] { margin-right: 8px; width: 16px; height: 16px; cursor: pointer; }
.thespl-muxer-app input[type="radio"] { margin: 0; cursor: pointer; width: 16px; height: 16px; }

.thespl-muxer-app .hidden { display: none !important; }
.thespl-muxer-app #log { background: #0d1117; border: none; padding: 10px; min-height: 180px; max-height: 300px; overflow-y: auto; font: 12px 'SF Mono', Monaco, 'Cascadia Code', monospace; color: #8b949e; white-space: pre-wrap; }
.thespl-muxer-app .log-line { display: block; }
.thespl-muxer-app .status-display { padding: 15px; border-radius: 6px; margin-top: 25px; margin-bottom: 20px; font-size: 14px; color: #e6edf3; border: 1px solid #30363d; background: #161b22; transition: all 0.3s ease; border-left-width: 4px; }
.thespl-muxer-app .status-display.status-ready { background: rgba(35, 134, 54, 0.3); border-left-color: #3fb950; }
.thespl-muxer-app .status-display.status-idle { background: #161b22; border-left-color: #30363d; }
.thespl-muxer-app .status-display.status-error { background: rgba(248, 81, 73, 0.2); border-left-color: #f85149; }
.thespl-muxer-app .status-display.status-warning { background: rgba(210, 153, 34, 0.15); border-left-color: #d29922; }

.thespl-muxer-app .button-group { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 10px 0; justify-content: flex-end; }
.thespl-muxer-app button { padding: 12px 24px; cursor: pointer; border: 1px solid #30363d; border-radius: 6px; font-size: 14px; font-weight: 600; transition: all 0.2s ease; background: #21262d; color: #c9d1d9; }
.thespl-muxer-app button:not(:disabled):hover { transform: translateY(-2px); border-color: #58a6ff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.thespl-muxer-app button:disabled { opacity: 0.5; cursor: not-allowed; }
.thespl-muxer-app #run { background: #238636; border-color: #2ea44f; color: #f0f6fc; }
.thespl-muxer-app #run:hover:not(:disabled) { background: #2ea44f; }
.thespl-muxer-app #reset { background: #8b949e; border-color: #6e7681; color: #0d1117; }
.thespl-muxer-app #reset:hover:not(:disabled) { background: #9da6b1; }

.thespl-muxer-app .file-slot { background: #161b22; border: 2px dashed #30363d; border-radius: 8px; padding: 20px; min-height: 196px; height: 196px; transition: all 0.3s ease; position: relative; color: #e6edf3; display: flex; flex-direction: column; }
.thespl-muxer-app .file-slot input[type="file"]{position:absolute;opacity:0;width:1px;height:1px;pointer-events:none;margin:0;padding:0;border:0;clip:rect(0,0,0,0);clip-path:inset(50%)}
.thespl-muxer-app .file-slot.drag-over { border-color: #58a6ff; background: #21262d; transform: scale(1.02); }
.thespl-muxer-app .file-slot.has-file { border-style: solid; border-color: #3fb950; }
.thespl-muxer-app .file-slot.loading { border-color: #58a6ff; border-style: dashed; }
.thespl-muxer-app .file-slot.error { border-color: #f85149; border-style: solid; background: rgba(248, 81, 73, 0.05); }
.thespl-muxer-app .file-slot.warning,
.thespl-muxer-app .file-slot.duplicate-warning { border-color: #d29922; border-style: solid; background: rgba(210, 153, 34, 0.1); }
.thespl-muxer-app .file-slot.dragging { opacity: 0.7; cursor: move; }
.thespl-muxer-app .slot-header { font-weight: 600; margin-bottom: 10px; color: #8b949e; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.thespl-muxer-app .slot-number { background: #58a6ff; color: #0d1117; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.thespl-muxer-app .drop-zone { flex: 1; border: 2px dashed #484f58; border-radius: 6px; padding: 30px; text-align: center; color: #8b949e; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.thespl-muxer-app .drop-zone:focus{border-color:#58a6ff; box-shadow:0 0 0 2px rgba(88,166,255,0.3)}
.thespl-muxer-app .drop-zone:hover { border-color: #58a6ff; color: #58a6ff; background: #21262d; }
.thespl-muxer-app .file-info { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: calc(100% - 40px); display: none; }
.thespl-muxer-app .file-badge { background: rgba(35, 134, 54, 0.16); border: 1px solid rgba(63, 185, 80, 0.5); color: #f0f6fc; padding: 10px 40px 10px 12px; border-radius: 6px; user-select: none; font-weight: 500; font-size: 0.86rem; position: relative; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); min-height: 66px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.thespl-muxer-app .file-badge.loading { background: #58a6ff; animation: pulse 1.5s ease-in-out infinite; }
.thespl-muxer-app .file-badge.error { background: rgba(48, 18, 20, 0.92); border-color: rgba(248, 81, 73, 0.7); color: #f0f6fc; }
.thespl-muxer-app .file-badge.warning { background: rgba(210, 153, 34, 0.18); border-color: rgba(210, 153, 34, 0.7); color: #f0f6fc; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.thespl-muxer-app .file-name { font-weight: 600; word-break: break-all; font-size: 0.82rem; margin-bottom: 2px; }
.thespl-muxer-app .file-size { font-size: 0.72rem; opacity: 0.92; line-height: 1.35; }
.thespl-muxer-app .remove-file { position: absolute; top: 12px; right: 12px; cursor: pointer; width: 24px; height: 24px; padding: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; opacity: 0.96; color: #f0f6fc; font-weight: 700; background: rgba(13, 17, 23, 0.6); border: 1px solid rgba(240, 246, 252, 0.18); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease; transform: translateZ(0); }
.thespl-muxer-app .remove-file:hover,
.thespl-muxer-app .remove-file:focus { opacity: 1; background: rgba(13, 17, 23, 0.82); border-color: rgba(240, 246, 252, 0.28); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.04); transform: translateZ(0); }
.thespl-muxer-app .remove-file:focus-visible { outline: 2px solid rgba(88, 166, 255, 0.7); outline-offset: 2px; }
.thespl-muxer-app #progress { display: none; margin: 20px 0; }
.thespl-muxer-app #progress-bar { position: relative; width: 100%; height: 28px; background: #30363d; border-radius: 14px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); }
.thespl-muxer-app #progress-fill { height: 100%; background: linear-gradient(90deg, #238636, #2ea44f); width: 0%; transition: width 0.2s linear; }
.thespl-muxer-app #progress-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #ffffff; font-weight: 600; font-size: 12px; text-shadow: 0 1px 3px rgba(0,0,0,0.8); z-index: 5; pointer-events: none; }
.thespl-muxer-app #result { margin-top: 20px; }
.thespl-muxer-app #result a { display: inline-block; padding: 12px 24px; background: #2ea44f; color: #f0f6fc; text-decoration: none; border-radius: 6px; font-weight: 600; transition: all 0.2s ease; margin-top: 10px; margin-right: 10px; }
.thespl-muxer-app #result a:hover { background: #3fb950; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.thespl-muxer-app .control-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.thespl-muxer-app #size-estimate { display: inline-block; min-width: 220px; }
.thespl-muxer-app .footnote { font-size: 12px; color: #8b949e; margin-top: 2px; }

/* Layout helpers */
.thespl-muxer-app .muxer-flex { display: flex; gap: 20px; align-items: flex-start; }
.thespl-muxer-app .flex-1 { flex: 1; }

/* Config footer */
.thespl-muxer-app .config-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; border-top: 1px solid #30363d; padding-top: 10px; }
#upload-limit-info { font-size: 12px; color: #8b949e; }
#config-limit-warning { margin-top: 8px; display: none; }
.thespl-muxer-app #thespl-waveform-output-box { padding-left: 20px; }

/* Controls */
.thespl-muxer-app .control-row label.control-label { display: inline-block; margin-right: 12px; font-size: 14px; margin-bottom: 0; }
.thespl-muxer-app .control-row #comp { vertical-align: middle; margin: 0 8px; }
.thespl-muxer-app #comp-val { display: inline-block; width: 24px; text-align: center; }
.thespl-muxer-app .muted-label { margin-left: 12px; color: #8b949e; }
.thespl-muxer-app #size-estimate { font-weight: 600; margin-left: 6px; }

/* Tighter spacing for explanatory note directly below the slider controls */
.thespl-muxer-app .control-row + .config-note { margin-top: 2px; }

/* Radio groups */
#sr-group,
#bd-group {
	width: 320px;
}

#sr-group { margin-top: 15px; }

#bd-group {
	margin-left: 0;
	padding-left: 8px;
	border-left: 0;
}

#sr-note,
#bd-note {
	width: 320px;
}

.thespl-muxer-app .muted { color: #8b949e; }
.thespl-muxer-app .disabled-option { opacity: 0.5; }
.thespl-muxer-app .disabled-option-soft { opacity: 0.7; }

.thespl-muxer-app .thespl-muxer-metafoot { margin-top: 10px; font-size: 11px; color: #ffffff; opacity: 0.85; text-align: right; }
.thespl-muxer-app .thespl-muxer-metafoot-prefix { font-weight: 500; }
.thespl-muxer-app .thespl-muxer-metafoot-sep { opacity: 0.7; }

/* Pro badge */
.thespl-pro-badge { display: inline-block; margin-left: 6px; padding: 2px 6px; font-size: 12px; line-height: 1.4; border-radius: 4px; background: #21262d; border: 1px solid #30363d; color: #8b949e; }
.thespl-pro-badge.thespl-pro-badge--right { margin-left: auto; }

/* Locked slots */
.thespl-muxer-app .file-slot.pro-locked { opacity: 0.6; pointer-events: none; }

/* Subdirectory Input Style */
.thespl-muxer-app .upload-config {
    /* Background and border handled by .section-box now for consistency */
    margin-bottom: 20px;
}
.thespl-muxer-app .upload-config input[type="text"] {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    padding: 8px 12px;
    border-radius: 6px;
    width: 100%;
    max-width: 300px;
}

/* Filename input (auto-resize to content, capped to container width) */
.thespl-muxer-app input#flac-filename {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    padding: 8px 12px;
    border-radius: 6px;
    width: auto;
    max-width: 100%;
    min-width: 240px;
    transition: width 0.1s ease;
}

.thespl-muxer-app input[type="range"] {
	accent-color: #C6730D;
}
