:root {
    --bg-color: #f5f5f7;
    --card-bg: rgba(255, 255, 255, 0.7);
    --primary-color: #007aff;
    --primary-hover: #0063cc;
    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-blur: 20px;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
    --border-radius: 20px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Header */
.header {
    text-align: center;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 18px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 32px;
}

/* Card Style - Liquid/Glassmorphism */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Sections */
.hidden {
    display: none !important;
}

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

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.4);
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.05);
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.upload-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* Video Preview */
.video-wrapper {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin-bottom: 24px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

video {
    width: 100%;
    height: 100%;
    max-height: 400px;
}

.frame-selector {
    margin-bottom: 24px;
}

.frame-selector label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    cursor: pointer;
}

.time-display {
    font-family: monospace;
    font-size: 14px;
    background: #eee;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 80px;
    text-align: center;
}

.frame-preview {
    width: 160px;
    height: 90px;
    background: #000;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto;
}

.duration-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
}

.duration-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="number"] {
    width: 60px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
    font-size: 16px;
}

.duration-hint {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.btn-text {
    background: transparent;
    color: var(--primary-color);
    padding: 0 12px;
    height: 36px;
}

.btn-text:hover {
    background: rgba(0, 122, 255, 0.1);
}

.btn-small {
    height: 28px;
    font-size: 12px;
    padding: 0 8px;
}

/* Progress Section */
.content-id-card {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.content-id-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.content-id-value {
    font-family: monospace;
    font-size: 14px;
    word-break: break-all;
    font-weight: 600;
}

.content-id-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.progress-wrapper {
    margin-bottom: 24px;
}

.progress-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Log Container */
.log-container {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #2d2d2d;
    color: #eee;
    font-size: 12px;
}

.log-content {
    height: 150px;
    padding: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: #00ff41;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.4;
}

.log-entry-info { color: #aaa; }
.log-entry-success { color: #00ff41; }
.log-entry-error { color: #ff3b30; }

/* Download Section */
.success-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.download-section h2 {
    text-align: center;
    margin-bottom: 8px;
}

.success-text {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.file-list {
    margin-bottom: 32px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    margin-bottom: 8px;
    gap: 12px;
}

.file-icon { font-size: 24px; }
.file-name { flex: 1; font-weight: 500; font-size: 14px; }
.file-size { color: var(--text-secondary); font-size: 12px; }

.download-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-hint {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.usage-hint h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.usage-hint ol {
    padding-left: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 122, 255, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Footer */
.footer {
    text-align: center;
    padding-bottom: 40px;
}

.footer p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.tech-stack {
    font-weight: 500;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}
