html,
body {
    min-height: 100%;
    margin: 0;
    background: #121820;
    color: #eef3f7;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    padding: 12px 12px 84px;
    box-sizing: border-box;
}

body.file-drag {
    background: #172230;
}

button,
input {
    font: inherit;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#appName {
    margin: 0 0 3px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

#commsInfo,
#backToAppsButton {
    color: #9ed7ff;
    font-size: 13px;
    text-decoration: none;
}

#backToAppsButton {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    line-height: 36px;
}

main {
    max-width: 560px;
    margin: 0 auto;
}

section {
    margin-bottom: 12px;
}

#summaryPanel,
#filePanel,
#durationPanel,
#displayPanel,
#effectPanel,
#queueSection {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    background: #18232d;
}

#currentTitle {
    overflow: hidden;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#summaryLine,
#fileHint,
#chunkStatus,
#controlProgressText {
    margin: 8px 0 0;
    color: #b9c7d4;
    font-size: 13px;
    line-height: 1.35;
}

#controlProgress {
    display: none;
    margin-top: 10px;
}

#controlProgressTrack {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 4px;
    background: #101820;
}

#controlProgressBar {
    width: 0;
    height: 8px;
    background: #f7c948;
}

#controlProgressText {
    font-weight: 700;
}

#imageFiles {
    display: none;
}

#selectFilesButton,
#clearButton {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    color: #111;
    cursor: pointer;
    font-weight: 700;
}

#selectFilesButton {
    width: 100%;
    background: #f7c948;
}

#clearButton {
    min-width: 76px;
    background: #ffb3bd;
}

#durationPanel {
    overflow: hidden;
}

#durationPanel label {
    display: block;
    margin-bottom: 8px;
    color: #d7e0e8;
    font-size: 13px;
    font-weight: 700;
}

#durationValue {
    color: #f7c948;
}

#durationSlider {
    float: left;
    width: 72%;
    margin: 8px 0;
}

#durationInput {
    float: right;
    width: 24%;
    min-height: 38px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: #101820;
    color: #eef3f7;
    text-align: center;
}

#displayPanel {
    display: flex;
    gap: 8px;
}

#displayPanel button {
    flex: 1 1 50%;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: #263542;
    color: #eef3f7;
    cursor: pointer;
    font-weight: 700;
}

#displayPanel button.active {
    background: #f7c948;
    color: #111;
}

.controlGroup {
    margin-bottom: 12px;
}

.controlGroup:last-child {
    margin-bottom: 0;
}

.controlLabel {
    margin-bottom: 8px;
    color: #d7e0e8;
    font-size: 13px;
    font-weight: 700;
}

.segmentedControl {
    display: flex;
    gap: 6px;
}

.segmentedControl button {
    flex: 1 1 33%;
    min-height: 42px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: #263542;
    color: #eef3f7;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.segmentedControl button.active {
    background: #f7c948;
    color: #111;
}

#queueHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

#queueHeader h2 {
    margin: 0;
    font-size: 18px;
}

#queueList {
    margin: 0;
    padding: 0;
    list-style: none;
}

.emptyQueue {
    padding: 18px 8px;
    color: #aebdca;
    text-align: center;
}

.queueItem {
    display: flex;
    align-items: stretch;
    min-height: 68px;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: #101820;
    will-change: transform;
}

.queueItem.current {
    border-color: #f7c948;
}

.queueItem.pending {
    border-color: rgba(158, 215, 255, 0.45);
}

.dragHandle,
.removeButton,
.queueTitle {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
}

.dragHandle {
    width: 38px;
    color: #9ed7ff;
    cursor: grab;
    font-size: 22px;
    touch-action: none;
}

.dragHandle:active {
    cursor: grabbing;
}

.thumbWrap {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    margin: 2px 8px 2px 0;
    overflow: hidden;
    background: #263542;
}

.thumbWrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbFallback {
    display: block;
    width: 64px;
    height: 64px;
    color: #9aa8b3;
    font-size: 11px;
    font-weight: 700;
    line-height: 64px;
    text-align: center;
}

.queueTitle {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 8px 8px 0;
    text-align: left;
    touch-action: pan-y;
}

.queueLabel {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queueMeta {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #aebdca;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.removeButton {
    width: 44px;
    color: #ff8a96;
    font-size: 24px;
}

.queueItem.dragging {
    opacity: 0.65;
}

body.queue-reordering {
    -webkit-user-select: none;
    user-select: none;
}

#bottomPanel {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    min-height: 56px;
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    background: #101820;
}

.bottomPanelCell {
    min-width: 0;
}

.bottomPanelCell:first-child {
    flex: 1 1 auto;
}

.roomCell {
    flex: 0 0 auto;
    text-align: right;
}

.bottomPanelLabel {
    display: block;
    margin-bottom: 2px;
    color: #81919f;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

#roomLabel,
#statusLine {
    display: block;
    overflow: hidden;
    color: #d7e0e8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 360px) {
    body {
        padding-right: 8px;
        padding-left: 8px;
    }

    .thumbWrap,
    .thumbFallback {
        width: 54px;
        height: 54px;
        line-height: 54px;
    }

    .dragHandle {
        width: 34px;
    }
}
