* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
    padding: 20px;
}

.container {
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    text-decoration: none;
    color: #51607a;
    font-size: 14px;
}

h1 {
    font-size: 28px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: #86868b;
    font-size: 14px;
    margin-top: 6px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.drop-zone {
    position: relative;
    width: 100%;
    min-height: 320px;
    border: 2px dashed #d2d2d7;
    border-radius: 14px;
    background: #fafafa;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}

.drop-zone.dragover {
    border-color: #0071e3;
    background: #f0f4ff;
}

.drop-zone.is-busy {
    border-color: #9db8e8;
    background: #f5f8ff;
}

.drop-zone.has-image .drop-hint {
    display: none;
}

.drop-hint {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 24px;
    color: #86868b;
}

.drop-hint svg {
    opacity: 0.5;
}

.drop-hint span {
    font-size: 15px;
}

.drop-sub {
    font-size: 12px !important;
    opacity: 0.8;
    max-width: 520px;
    line-height: 1.6;
}

#previewCanvas {
    display: none;
    width: 100%;
    max-height: 480px;
    object-fit: contain;
}

.drop-zone.has-image #previewCanvas {
    display: block;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(250, 251, 255, 0.9);
    backdrop-filter: blur(2px);
    z-index: 2;
}

.loading-overlay.is-visible {
    display: flex;
}

.loading-card {
    min-width: 240px;
    max-width: 80%;
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #dbe4f4;
    box-shadow: 0 12px 30px rgba(28, 49, 94, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: #445066;
}

.loading-card strong {
    font-size: 16px;
}

.loading-card span {
    font-size: 13px;
    line-height: 1.5;
}

.spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #d9e3f4;
    border-top-color: #2f6fed;
    animation: spin 0.8s linear infinite;
}

.toolbar {
    margin-top: 20px;
    display: grid;
    gap: 12px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-row.actions {
    justify-content: flex-end;
}

label {
    font-size: 14px;
}

#qualityRange {
    width: 180px;
}

#qualityText {
    min-width: 42px;
    color: #86868b;
    font-family: monospace;
    font-size: 13px;
}

.btn {
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid #d2d2d7;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
}

.btn:hover:not(:disabled) {
    background: #f5f5f7;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: #0071e3;
    color: #fff;
    border-color: #0071e3;
}

.btn-primary:hover:not(:disabled) {
    background: #0077ed;
}

.status-card,
.result-card {
    margin-top: 20px;
    border: 1px solid #ececf0;
    border-radius: 14px;
    padding: 16px;
    background: #fcfcfd;
}

.status-head,
.result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 14px;
}

.status-text {
    color: #5d6470;
    line-height: 1.6;
    word-break: break-word;
}

.result-list {
    list-style: none;
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
}

.result-item {
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #ececf0;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    word-break: break-all;
}

.ppt-sandbox {
    position: absolute;
    left: -20000px;
    top: 0;
    width: 1600px;
    pointer-events: none;
}

.ppt-render-host {
    background: #fff;
}

.server-badge {
    text-align: center;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    margin: 0 auto 16px;
    width: fit-content;
}

.container > .server-badge {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.server-badge-ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.server-badge-off {
    background: #fff3e0;
    color: #e65100;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 720px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 24px;
    }

    .toolbar-row.actions {
        justify-content: stretch;
    }

    .toolbar-row.actions .btn {
        flex: 1 1 auto;
    }

    #qualityRange {
        width: 100%;
    }
}
