/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #f5f5f7;
    --card-bg:   #ffffff;
    --text:      #1d1d1f;
    --text-muted:#6e6e73;
    --accent:    #0071e3;
    --accent-hv: #0060c0;
    --border:    #d2d2d7;
    --danger:    #e53935;
    --success:   #2e7d32;
    --shadow:    0 2px 12px rgba(0,0,0,.06);
    --radius:    12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* ── Header ────────────────────────────────────────────────── */
header { text-align: center; margin-bottom: 36px; }

header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 6px; }
.subtitle  { color: var(--text-muted); font-size: 1.05rem; }

/* ── Language Selector ─────────────────────────────────────── */
.lang-selector {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 14px;
    font-size: .92rem; font-weight: 500;
}

.lang-selector select {
    padding: 6px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-size: .9rem;
    background: #fff; cursor: pointer;
}

/* ── Form / Cards ──────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    transition: border-color .2s;
}

.prompt-card:focus-within { border-color: var(--accent); }

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.card-header h2 { font-size: 1.15rem; font-weight: 600; }

/* ── Checkbox ──────────────────────────────────────────────── */
.checkbox-label {
    display: flex; align-items: center; cursor: pointer; user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkmark {
    width: 22px; height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
}

.checkbox-label input:checked + .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-label input:checked + .checkmark::after {
    content: "✓";
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

/* ── Textarea ──────────────────────────────────────────────── */
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: .95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 72px;
    transition: border-color .15s;
    background: #fafafa;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
}

/* ── Captcha Input ────────────────────────────────────────── */
.captcha-input {
    width: 100%;
    max-width: 200px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .92rem;
    font-family: inherit;
    margin-top: 10px;
    background: #fafafa;
    transition: border-color .15s;
}
.captcha-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
}

/* ── Submit Button ─────────────────────────────────────────── */
#submit-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 14px 0;
    margin-top: 8px;
    font-size: 1.1rem; font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none; border-radius: var(--radius);
    cursor: pointer;
    transition: background .2s, opacity .2s;
}

#submit-btn:hover:not(:disabled) { background: var(--accent-hv); }
#submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Loading Spinner ───────────────────────────────────────── */
.btn-spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

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

.hidden { display: none !important; }

/* ── Error Banner ──────────────────────────────────────────── */
.error-banner {
    background: #fdecea;
    color: var(--danger);
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
}

/* ── Results ───────────────────────────────────────────────── */
.results-container { margin-top: 36px; }
.results-title    { font-size: 1.3rem; margin-bottom: 16px; font-weight: 700; }

#results-list { display: flex; flex-direction: column; gap: 16px; }

/* ── Result Card (通用) ────────────────────────────────────── */
.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 20px 24px;
}

.result-card .result-type {
    display: inline-block;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 10px;
    border-radius: 99px;
    margin-bottom: 10px;
}

.result-card .result-type.pptx   { background: #e8f0fe; color: #1967d2; }
.result-card .result-type.image  { background: #e6f4ea; color: #137333; }
.result-card .result-type.youtube{ background: #fce8e6; color: #c5221f; }

.result-card .result-title   { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.result-card .result-message { color: var(--text-muted); font-size: .92rem; margin-bottom: 12px; }

.result-card .result-error   { color: var(--danger); font-weight: 500; }

/* Download button */
.btn-download {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 20px;
    font-size: .92rem; font-weight: 600;
    color: #fff; background: var(--accent);
    border: none; border-radius: 8px;
    cursor: pointer; text-decoration: none;
    transition: background .2s;
}

.btn-download:hover { background: var(--accent-hv); }

/* ── Image Preview ────────────────────────────────────────── */
.image-preview {
    display: block;
    max-width: 100%;
    max-height: 480px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
    object-fit: contain;
    background: #fafafa;
}

/* ── Slide Viewer (paginated) ─────────────────────────────── */
.slide-viewer { outline: none; margin-bottom: 14px; }

.slide-stage {
    aspect-ratio: 16 / 9;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 5% 7%;
}

.slide-inner {
    width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center;
    overflow: hidden;
}

.slide-viewer-title {
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 3%;
    line-height: 1.3;
}

.slide-viewer-body {
    font-size: clamp(.75rem, 1.6vw, 1rem);
    color: #444;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 10;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Navigation */
.slide-nav {
    display: flex; align-items: center; justify-content: center;
    gap: 14px; margin-top: 10px;
}

.slide-nav-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: .85rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}

.slide-nav-btn:hover:not(:disabled) {
    background: var(--accent); color: #fff; border-color: var(--accent);
}

.slide-nav-btn:disabled { opacity: .3; cursor: default; }

.slide-counter {
    font-size: .85rem; font-weight: 600;
    color: var(--text-muted); min-width: 60px; text-align: center;
}

.result-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
}

/* ── YouTube Video Cards ──────────────────────────────────── */
.video-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

.video-card {
    display: flex; gap: 14px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: background .15s;
}

.video-card:hover { background: #f0f0f3; }

.video-thumb {
    width: 160px; height: 90px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #ddd;
}

.video-info { flex: 1; min-width: 0; }
.video-info .video-title {
    font-weight: 600; font-size: .95rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-info .video-channel { color: var(--text-muted); font-size: .82rem; margin-bottom: 6px; }

.video-info .video-link {
    font-size: .82rem; color: var(--accent); text-decoration: none;
}

.video-info .video-link:hover { text-decoration: underline; }

/* YouTube embed (toggled) */
.video-embed {
    width: 100%; aspect-ratio: 16/9;
    border: none; border-radius: 8px;
    margin-top: 10px;
}

/* ── YouTube Tab Interface ────────────────────────────────── */
.yt-tab-bar {
    display: flex; gap: 4px; overflow-x: auto;
    padding-bottom: 8px; margin-bottom: 12px;
    border-bottom: 2px solid var(--border);
    -webkit-overflow-scrolling: touch;
}

.yt-tab {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: .82rem; font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    cursor: pointer;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden; text-overflow: ellipsis;
    transition: all .15s;
}

.yt-tab:hover { background: #f0f0f3; color: var(--text); }

.yt-tab.active {
    color: var(--accent);
    background: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.yt-content-area { }

.yt-embed-container {
    border-radius: 8px; overflow: hidden;
    margin-bottom: 12px;
    background: #000;
}

.yt-embed-container .video-embed {
    margin-top: 0; display: block;
}

.yt-info-area { }

.yt-info-title {
    font-size: 1.05rem; font-weight: 600;
    margin-bottom: 6px;
}

.yt-info-desc {
    font-size: .88rem; color: var(--text-muted);
    margin-bottom: 8px; line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yt-info-link {
    font-size: .85rem; color: var(--accent);
    text-decoration: none;
}

.yt-info-link:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .container { padding: 16px 12px 40px; }
    header h1  { font-size: 1.5rem; }
    .video-card { flex-direction: column; }
    .video-thumb { width: 100%; height: auto; aspect-ratio: 16/9; }
    .yt-tab { max-width: 120px; font-size: .75rem; padding: 5px 10px; }
}
