.atv-container {
    max-width: 720px;
    margin: 24px auto;
    padding: 32px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.atv-header { text-align: center; margin-bottom: 28px; }
.atv-header h2 { margin: 0 0 6px; font-size: 24px; color: #1a1a2e; }
.atv-subtitle { margin: 0; color: #666; font-size: 14px; }

.atv-tabs { display: flex; gap: 0; margin-bottom: 20px; border-radius: 8px; overflow: hidden; border: 1px solid #e0e0e0; }
.atv-tab { flex: 1; padding: 10px 16px; border: none; background: #f8f9fa; cursor: pointer; font-size: 14px; color: #666; transition: all .2s; }
.atv-tab.active { background: #6c5ce7; color: #fff; font-weight: 600; }

.atv-tab-content { display: none; }
.atv-tab-content.active { display: block; }

.atv-field { margin-bottom: 16px; }
.atv-field label { display: block; font-weight: 600; margin-bottom: 4px; color: #333; font-size: 13px; }

.atv-form input[type="text"],
.atv-form input[type="url"],
.atv-form input[type="password"],
.atv-form textarea,
.atv-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color .2s;
}
.atv-form input:focus,
.atv-form textarea:focus,
.atv-form select:focus {
    border-color: #6c5ce7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(108,92,231,0.12);
}
.atv-form textarea { resize: vertical; min-height: 120px; }
.atv-hint { font-size: 12px; color: #999; margin: 4px 0 0; }

#atv-fetch-result { margin-top: 8px; font-size: 13px; }

.atv-btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.atv-btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    font-size: 16px;
}
.atv-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,92,231,0.35); }
.atv-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.atv-btn-secondary { background: #e8e8e8; color: #333; }
.atv-btn-secondary:hover { background: #ddd; }
.atv-btn-download {
    padding: 12px 32px;
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 15px;
}
.atv-btn-download:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,184,148,0.35); color: #fff; }

/* Progress */
.atv-progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0 8px;
}
.atv-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #6c5ce7, #a29bfe);
    border-radius: 4px;
    transition: width .5s;
}
.atv-progress-text { font-size: 14px; color: #666; text-align: center; }
.atv-log {
    background: #1a1a2e;
    color: #00ff88;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: "Courier New", monospace;
}

/* Result */
#atv-result { text-align: center; }
.atv-result-success > p { font-size: 18px; color: #00b894; font-weight: 600; }

/* Video Player */
.atv-video-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin: 16px auto;
    max-width: 640px;
}
#atv-video-player {
    width: 100%;
    display: block;
    max-height: 400px;
}
.atv-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 16px 0;
}
.atv-file-size { font-size: 13px; color: #666; font-weight: normal !important; }
.atv-expiry-notice { font-size: 12px; color: #e17055; margin-top: 8px; }

.atv-result-error { text-align: center; padding: 24px; }
.atv-error-title { font-size: 18px; color: #d63031; font-weight: 600; }
.atv-error-msg { color: #666; margin: 8px 0 16px; }
.atv-error-log {
    background: #1a1a2e;
    color: #ff6b6b;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    max-height: 150px;
    overflow-y: auto;
    margin: 8px 0 16px;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-all;
}

.atv-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: atv-spin .6s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
}
@keyframes atv-spin { to { transform: rotate(360deg); } }

.atv-login-required {
    max-width: 480px;
    margin: 40px auto;
    padding: 32px;
    text-align: center;
    background: #fff3f3;
    border-radius: 12px;
    border: 1px solid #ffd7d7;
}
.atv-login-required a { color: #6c5ce7; font-weight: 600; }

/* History */
.atv-history {
    max-width: 720px;
    margin: 24px auto;
    padding: 24px 32px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.atv-history h3 { margin: 0 0 16px; font-size: 18px; color: #1a1a2e; }
.atv-history-list { display: flex; flex-direction: column; gap: 8px; }
.atv-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f8f9fa;
    font-size: 13px;
}
.atv-history-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.status-done { background: #00b89422; color: #00b894; }
.status-running { background: #fdcb6e22; color: #e17055; }
.status-error { background: #d6303122; color: #d63031; }
.atv-history-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #333; }
.atv-history-time { color: #999; font-size: 12px; white-space: nowrap; }

/* Mobile */

/* BGM Upload */
.atv-bgm-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}
.atv-bgm-upload input[type="file"] {
    display: none;
}
.atv-bgm-label {
    display: inline-block;
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all .2s;
}
.atv-bgm-label:hover {
    background: #e8e8e8;
    border-color: #6c5ce7;
    color: #6c5ce7;
}
.atv-bgm-name {
    font-size: 13px;
    color: #666;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .atv-container, .atv-history { padding: 16px; margin: 12px 8px; }
    .atv-header h2 { font-size: 20px; }
    .atv-result-actions { flex-direction: column; align-items: center; }
    .atv-btn-download { width: 100%; text-align: center; }
}
