:root {
    --background: #ffffff;
    --foreground: #09090b;
    --card: #ffffff;
    --card-foreground: #09090b;
    --primary: #18181b;
    --primary-foreground: #fafafa;
    --secondary: #f4f4f5;
    --secondary-foreground: #18181b;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --border: #e4e4e7;
    --input: #e4e4e7;
    --ring: #18181b;
    --radius: 0.5rem;
}

body.dark-mode {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #09090b;
    --card-foreground: #fafafa;
    --primary: #fafafa;
    --primary-foreground: #18181b;
    --secondary: #27272a;
    --secondary-foreground: #fafafa;
    --muted: #27272a;
    --muted-foreground: #a1a1aa;
    --border: #27272a;
    --input: #27272a;
    --ring: #d4d4d8;
}

body {
    transition: background-color 0.3s, color 0.3s;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--foreground);
    font-size: 1.1rem;
}

.theme-toggle:hover {
    background-color: var(--secondary);
}

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

.setting-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    cursor: pointer;
}

.speed-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
}

.btn-group-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    margin: 0;
    padding: 40px 20px;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    margin-bottom: 40px;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.lang-selector {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--foreground);
    cursor: pointer;
    outline: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-home {
    text-decoration: none;
    font-size: 1.25rem;
    color: var(--foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.btn-home:hover {
    background-color: var(--secondary);
}

footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.btn-footer-tool {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.btn-footer-tool:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    transform: translateY(-2px);
}

.btn-repo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.btn-repo:hover {
    background-color: var(--secondary);
    color: var(--foreground);
}

.btn-repo svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

@media (max-width: 640px) {
    .footer-links {
        flex-direction: column;
        width: 100%;
    }
    .btn-footer-tool, .btn-repo {
        width: 100%;
        justify-content: center;
    }
}

h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.nav-menu {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.nav-link {
    text-decoration: none;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: var(--secondary);
    color: var(--foreground);
}

.nav-link.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.status-badge {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* Card Style */
.card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.card-header {
    padding: 24px 24px 0 24px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.card-content {
    padding: 24px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover {
    background-color: var(--accent);
    border-color: var(--muted-foreground);
}

.upload-area.dragover {
    border-color: var(--primary);
    background-color: var(--accent);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.upload-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

/* Video Preview */
.video-preview-card {
    margin-bottom: 24px;
}

.video-wrapper {
    position: relative;
    width: fit-content;
    margin: 0 auto;
    background: #000;
    border-radius: calc(var(--radius) - 2px);
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.crop-box {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    cursor: move;
    box-sizing: border-box;
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #fff;
    border: 1px solid var(--primary);
}

.crop-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.crop-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.crop-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.crop-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }

#video-preview {
    display: block;
    max-width: 100%;
    max-height: 500px;
}

.current-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.time-val { font-weight: 600; }
.frame-val { color: var(--muted-foreground); }

/* Controls */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.timeline-container {
    position: relative;
    height: 20px;
    margin: 32px 0;
}

.timeline-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background-color: var(--secondary);
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
}

.timeline-range {
    position: absolute;
    height: 6px;
    background-color: var(--primary);
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.range-slider {
    position: absolute;
    width: 100%;
    appearance: none;
    background: none;
    pointer-events: none;
    margin: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
}

.range-slider::-webkit-slider-thumb {
    appearance: none;
    pointer-events: auto;
    width: 20px;
    height: 20px;
    background-color: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.input-box label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-box input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.input-box input:focus {
    outline: none;
    border-color: var(--ring);
}

.button-group {
    display: flex;
    gap: 8px;
}

/* Buttons */
button {
    height: 36px;
    padding: 0 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover {
    background-color: #e4e4e7;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--input);
    color: var(--foreground);
}

.btn-outline:hover {
    background-color: var(--accent);
}

.btn-full {
    width: 100%;
    height: 44px;
    font-size: 1rem;
}

/* Progress */
.progress-section {
    margin-top: 32px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.progress-bar-bg {
    height: 8px;
    background-color: var(--secondary);
    border-radius: 4px;
    overflow: hidden;
}

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

.download-section {
    margin-top: 24px;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    background-color: #059669;
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-download:hover { opacity: 0.9; }

.hidden { display: none !important; }

/* Result Preview Section */
.result-preview-card {
    margin-bottom: 24px;
    padding: 20px;
    background-color: var(--secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

.result-preview-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 12px;
}

.result-video-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: #000;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.result-video-wrapper video {
    width: 100%;
    height: 100%;
    display: block;
}

/* Grid for Actions */
.action-card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
