       
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        :root {
            
            --navy-900: #264a6e;     
            --navy-800: #0f1f33;      
            --navy-700: #264a6e;     
            --navy-600: #264a6e;;      
            --navy-500: #264a6e;
            --steel-300: #b8c9da;     
            --steel-200: #d3dee9;     
            --steel-100: #e6eef6;     
            --steel-50: #f2f7fb;      
            --white: #ffffff;
            --brand-500: #264a6e;;     
            --brand-600: #264a6e;
            --brand-700: #0f1f33;
            --brand-50: #eef4fa;
            --brand-100: #d6e4f0;
            --emerald-600: #0e7a5c;
            --emerald-700: #0a5e47;
            --red-500: #c0392b;
            --red-700: #922b21;
            --radius-sm: 10px;
            --radius-md: 14px;
            --radius-lg: 18px;
            --shadow-sm: 0 1px 3px rgba(10,22,40,0.08);
            --shadow-md: 0 4px 14px rgba(10,22,40,0.10);
            --shadow-lg: 0 10px 30px rgba(10,22,40,0.12);
            --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
            --fs-xs: 12px;
            --fs-sm: 13px;
            --fs-md: 14px;
            --fs-lg: 16px;
            --touch-min: 44px;
        }

        @media (max-width: 640px) {
            :root {
                --fs-xs: 13px;
                --fs-sm: 14px;
                --fs-md: 15px;
                --fs-lg: 18px;
                --touch-min: 48px;
            }
        }

        html, body { height: 100%; }

        body {
            font-family: var(--font-sans);
            background: var(--steel-50);
            color: var(--navy-800);
            font-size: var(--fs-md);
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            -webkit-tap-highlight-color: transparent;
        }

        ::-webkit-scrollbar { height: 6px; width: 6px; }
        ::-webkit-scrollbar-track { background: var(--steel-100); border-radius: 4px; }
        ::-webkit-scrollbar-thumb { background: var(--steel-300); border-radius: 4px; }

        video, canvas { user-select: none; -webkit-user-drag: none; }

        
        .app-header {
            background: var(--white);
            border-bottom: 1px solid var(--steel-200);
            position: sticky;
            top: 0;
            z-index: 40;
            padding: 14px 16px;
            box-shadow: var(--shadow-sm);
        }
        @media (max-width: 640px) {
            .app-header { padding: 16px; }
        }
        .header-inner {
            max-width: 1320px;
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }
        .header-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
        .brand-icon {
            width: 42px; height: 42px;
            border-radius: var(--radius-md);
            background: linear-gradient(135deg, var(--navy-700), var(--navy-900));
            color: #fff;
            display: flex; align-items: center; justify-content: center;
            font-size: 22px; flex-shrink: 0;
            box-shadow: 0 4px 12px rgba(10,22,40,0.35);
        }
        .brand-text h1 {
            font-size: var(--fs-lg);
            font-weight: 800;
            color: var(--navy-900);
            line-height: 1.1;
            letter-spacing: -0.02em;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .brand-text p { font-size: var(--fs-xs); color: var(--steel-300); margin-top: 3px; }

        .btn-reset {
            font-size: var(--fs-sm);
            font-weight: 700;
            color: var(--navy-700);
            padding: 10px 14px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--steel-200);
            background: var(--white);
            cursor: pointer;
            display: flex; align-items: center; gap: 6px;
            transition: background 0.15s;
            white-space: nowrap;
            min-height: var(--touch-min);
        }
        .btn-reset:hover { background: var(--steel-100); }
        .btn-reset .ph { font-size: 18px; }

        
        .app-main {
            flex: 1;
            max-width: 1320px;
            width: 100%;
            margin: 0 auto;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 18px;
        }
        @media (min-width: 1024px) {
            .app-main { flex-direction: row; padding: 24px; gap: 24px; }
        }
        @media (max-width: 640px) {
            .app-main { padding: 12px; gap: 14px; }
        }

        .col-left { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
        .col-right { width: 100%; display: flex; flex-direction: column; gap: 16px; }
        @media (min-width: 1024px) {
            .col-right { width: 480px; flex-shrink: 0; }
        }

        .card {
            background: var(--white);
            border: 1px solid var(--steel-200);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-sm);
        }

        
        .player-card { padding: 14px; display: flex; flex-direction: column; }
        @media (min-width: 640px) { .player-card { padding: 18px; } }
        @media (min-width: 1024px) { .player-card { padding: 20px; } }

        .player-header {
            display: flex; align-items: center; justify-content: space-between;
            flex-wrap: wrap; gap: 10px;
            margin-bottom: 14px; padding-bottom: 12px;
            border-bottom: 1px solid var(--steel-100);
        }

        .badge {
            display: inline-flex; align-items: center;
            padding: 5px 12px; border-radius: 999px;
            font-size: var(--fs-xs); font-weight: 700;
            background: var(--brand-50); color: var(--navy-700);
            border: 1px solid var(--brand-100);
            white-space: nowrap;
        }

        .btn-crop-toggle {
            padding: 10px 14px;
            border-radius: var(--radius-sm);
            font-size: var(--fs-sm);
            font-weight: 700;
            border: 1px solid var(--steel-200);
            background: var(--steel-50);
            color: var(--navy-700);
            cursor: pointer;
            display: flex; align-items: center; gap: 6px;
            transition: all 0.15s;
            min-height: var(--touch-min);
        }
        .btn-crop-toggle:hover { background: var(--steel-100); }
        .btn-crop-toggle.active {
            background: var(--navy-600) !important;
            color: #fff !important;
            border-color: var(--navy-600) !important;
            box-shadow: 0 4px 12px rgba(10,22,40,0.35);
        }
        .btn-crop-toggle .ph { font-size: 18px; }

        #playerWrapper {
            position: relative;
            width: 100%;
            height: 60vh;
            min-height: 320px;
            max-height: 620px;
            background: var(--navy-900);
            border-radius: var(--radius-md);
            overflow: hidden;
            display: flex; align-items: center; justify-content: center;
        }
        @media (min-width: 1024px) {
            #playerWrapper { height: 68vh; min-height: 420px; max-height: 700px; }
        }
        @media (max-width: 640px) {
            #playerWrapper { height: 44vh; min-height: 220px; max-height: 380px; }
        }

        #noVideoPlaceholder {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            padding: 24px; text-align: center; color: var(--steel-300);
        }
        #noVideoPlaceholder .ph { font-size: 56px; color: var(--steel-300); margin-bottom: 10px; }
        #noVideoPlaceholder .title { font-size: var(--fs-md); font-weight: 700; color: var(--steel-200); }
        #noVideoPlaceholder .subtitle { font-size: var(--fs-sm); color: var(--steel-300); margin-top: 6px; max-width: 300px; }

        #mainVideoPlayer {
            max-width: 100%; max-height: 100%;
            object-fit: contain;
            display: none;
        }
        #mainVideoPlayer.active { display: block; }

        #cropOverlay {
            position: absolute; inset: 0;
            z-index: 20; pointer-events: none; display: none;
        }
        #cropOverlay.active { display: block; pointer-events: auto; }

        #cropBox {
            position: absolute;
            border: 2px dashed var(--steel-300);
            background: rgba(29, 58, 92, 0.18);
            box-shadow: 0 0 0 9999px rgba(10, 22, 40, 0.6);
            cursor: move;
            pointer-events: auto;
            box-sizing: border-box;
            touch-action: none;
        }

        .crop-handle {
            position: absolute;
            width: 22px; height: 22px;
            background-color: var(--navy-600);
            border: 3px solid #fff;
            border-radius: 50%;
            box-shadow: 0 2px 6px rgba(0,0,0,0.35);
            z-index: 30;
            pointer-events: auto;
            touch-action: none;
        }
        @media (max-width: 640px) {
            .crop-handle { width: 26px; height: 26px; }
        }
        .crop-handle[data-handle="tl"] { top: -11px; left: -11px; cursor: nwse-resize; }
        .crop-handle[data-handle="tr"] { top: -11px; right: -11px; cursor: nesw-resize; }
        .crop-handle[data-handle="bl"] { bottom: -11px; left: -11px; cursor: nesw-resize; }
        .crop-handle[data-handle="br"] { bottom: -11px; right: -11px; cursor: nwse-resize; }
        .crop-handle[data-handle="tm"] { top: -11px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
        .crop-handle[data-handle="bm"] { bottom: -11px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
        .crop-handle[data-handle="lm"] { left: -11px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
        .crop-handle[data-handle="rm"] { right: -11px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

        #cropDimensionLabel {
            position: absolute;
            bottom: -34px; left: 50%; transform: translateX(-50%);
            background: rgba(10, 22, 40, 0.94);
            color: #fff; padding: 4px 12px;
            border-radius: 6px;
            font-size: var(--fs-xs);
            font-family: var(--font-mono);
            font-weight: 600;
            white-space: nowrap; pointer-events: none;
        }

        
        .player-controls { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }

        .timeline-row { display: flex; align-items: center; gap: 10px; }
        .time-text {
            font-size: var(--fs-xs);
            font-family: var(--font-mono);
            font-weight: 700;
            color: var(--navy-700);
            min-width: 62px;
        }
        .time-text.right { text-align: right; color: var(--steel-300); }

        input[type="range"] {
            -webkit-appearance: none; appearance: none;
            background: var(--steel-200); border-radius: 999px;
            outline: none; cursor: pointer;
        }
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none; appearance: none;
            width: 20px; height: 20px; border-radius: 50%;
            background: var(--navy-600); border: 3px solid #fff;
            box-shadow: 0 1px 5px rgba(0,0,0,0.25); cursor: pointer;
        }
        input[type="range"]::-moz-range-thumb {
            width: 20px; height: 20px; border-radius: 50%;
            background: var(--navy-600); border: 3px solid #fff;
            box-shadow: 0 1px 5px rgba(0,0,0,0.25); cursor: pointer;
        }
        #timelineScrubber { flex: 1; height: 10px; }
        #volumeControl { width: 90px; height: 8px; }

        .transport-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
        .transport-group { display: flex; align-items: center; gap: 10px; }

        .btn-play {
            width: 46px; height: 46px;
            border-radius: var(--radius-sm);
            background: linear-gradient(135deg, var(--navy-600), var(--navy-800));
            color: #fff; border: none;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; transition: transform 0.1s;
            box-shadow: 0 4px 12px rgba(10,22,40,0.35);
            font-size: 22px;
        }
        .btn-play:active { transform: scale(0.95); }
        @media (max-width: 640px) {
            .btn-play { width: 52px; height: 52px; font-size: 24px; }
        }

        .btn-icon {
            padding: 10px; border-radius: var(--radius-sm);
            background: var(--steel-100); border: none;
            color: var(--navy-700); cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: background 0.15s; font-size: 20px;
            min-width: var(--touch-min); min-height: var(--touch-min);
        }
        .btn-icon:hover { background: var(--steel-200); color: var(--navy-900); }

        .volume-group { display: flex; align-items: center; gap: 8px; color: var(--steel-300); font-size: 20px; }

        
        .toolbar-card { padding: 10px; overflow: hidden; }
        .toolbar-scroll {
            display: flex; overflow-x: auto; overflow-y: hidden;
            gap: 8px; padding: 4px 2px 8px;
            touch-action: pan-x; -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
        }

        .tab-btn {
            padding: 12px 18px;
            border-radius: var(--radius-md);
            border: 1px solid var(--steel-200);
            background: var(--steel-50);
            color: var(--navy-700);
            font-size: var(--fs-sm);
            font-weight: 700;
            cursor: pointer; white-space: nowrap;
            display: flex; align-items: center; gap: 8px;
            transition: all 0.15s; flex-shrink: 0;
            min-height: var(--touch-min);
        }
        .tab-btn:hover { background: var(--steel-100); }
        .tab-btn.active {
            background: var(--navy-600); color: #fff;
            border-color: var(--navy-600);
            box-shadow: 0 4px 12px rgba(10,22,40,0.3);
        }
        .tab-btn .ph { font-size: 18px; }

        
        .tab-content { padding: 18px; display: flex; flex-direction: column; gap: 18px; }
        @media (max-width: 640px) { .tab-content { padding: 16px; gap: 16px; } }
        .tab-content.hidden { display: none; }

        .tab-title {
            font-size: var(--fs-md); font-weight: 800;
            color: var(--navy-900);
            display: flex; align-items: center; gap: 10px;
            letter-spacing: -0.01em;
        }
        .tab-title .ph { color: var(--navy-600); font-size: 22px; }

        .hint-text { font-size: var(--fs-sm); color: var(--steel-300); line-height: 1.6; }

        
        .drop-zone {
            border: 2px dashed var(--steel-200);
            border-radius: var(--radius-md);
            padding: 32px 24px;
            text-align: center; background: var(--steel-50);
            cursor: pointer;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            transition: all 0.15s;
        }
        .drop-zone:hover, .drop-zone.dragover { border-color: var(--navy-600); background: var(--brand-50); }
        .drop-zone .ph { font-size: 40px; color: var(--navy-600); margin-bottom: 10px; }
        .drop-zone .title { font-size: var(--fs-md); font-weight: 700; color: var(--navy-700); }
        .drop-zone .subtitle { font-size: var(--fs-sm); color: var(--steel-300); margin-top: 6px; }

        .file-info {
            background: var(--steel-50);
            border: 1px solid var(--steel-200);
            border-radius: var(--radius-md);
            padding: 14px;
            display: flex; flex-direction: column; gap: 8px;
            font-size: var(--fs-sm);
        }
        .file-info-row { display: flex; justify-content: space-between; gap: 10px; }
        .file-info-row .label { color: var(--steel-300); font-weight: 600; }
        .file-info-row .value {
            color: var(--navy-800); font-family: var(--font-mono);
            font-weight: 600; text-align: right;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px;
        }

        
        .btn {
            padding: 12px 18px;
            border-radius: var(--radius-sm);
            font-size: var(--fs-sm);
            font-weight: 700;
            border: none; cursor: pointer;
            display: inline-flex; align-items: center; justify-content: center;
            gap: 8px; transition: all 0.15s;
            white-space: nowrap;
            min-height: var(--touch-min);
        }
        .btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .btn .ph { font-size: 18px; }

        .btn-primary {
            background: linear-gradient(135deg, var(--navy-600), var(--navy-800));
            color: #fff;
            box-shadow: 0 4px 12px rgba(10,22,40,0.3);
        }
        .btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(10,22,40,0.4); }

        .btn-secondary { background: var(--steel-100); color: var(--navy-700); }
        .btn-secondary:hover:not(:disabled) { background: var(--steel-200); }

        .btn-success {
            background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
            color: #fff;
            box-shadow: 0 4px 12px rgba(14,122,92,0.3);
        }
        .btn-success:hover { transform: translateY(-1px); }

        .btn-danger-text {
            background: transparent; border: none;
            color: var(--red-500); font-weight: 800; cursor: pointer;
            padding: 6px 10px; font-size: 18px; border-radius: 6px;
            min-width: 40px; min-height: 40px;
            display: flex; align-items: center; justify-content: center;
        }
        .btn-danger-text:hover { color: var(--red-700); background: #fef2f2; }

        .btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
        .btn-row .btn { flex: 1; min-width: 120px; }
        .btn-full { width: 100%; }

        .form-group { display: flex; flex-direction: column; gap: 6px; }
        .form-label { font-size: var(--fs-sm); font-weight: 700; color: var(--navy-700); }

        select, input[type="number"] {
            width: 100%; background: var(--steel-50);
            border: 1px solid var(--steel-200);
            border-radius: var(--radius-sm);
            padding: 12px 14px;
            font-size: var(--fs-sm);
            color: var(--navy-800);
            font-family: var(--font-sans);
            outline: none; transition: border-color 0.15s;
            min-height: var(--touch-min);
        }
        select:focus, input[type="number"]:focus {
            border-color: var(--navy-600);
            box-shadow: 0 0 0 3px rgba(29,58,92,0.12);
        }
        input[type="number"] { font-family: var(--font-mono); }

        .input-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

        
        .segment-panel {
            background: var(--steel-50);
            border: 1px solid var(--steel-200);
            border-radius: var(--radius-md);
            padding: 14px;
            display: flex; flex-direction: column; gap: 10px;
        }
        .segment-panel-title { font-size: var(--fs-sm); font-weight: 800; color: var(--navy-700); }
        .segment-mark-row { display: flex; align-items: center; gap: 10px; }
        .segment-mark-row .btn { flex: 1; }
        .segment-time {
            font-family: var(--font-mono); font-size: var(--fs-xs);
            color: var(--navy-700); min-width: 62px; text-align: right; font-weight: 700;
        }

        .segments-list { display: flex; flex-direction: column; gap: 8px; max-height: 180px; overflow-y: auto; padding-right: 4px; }
        .segment-item {
            display: flex; align-items: center; justify-content: space-between;
            padding: 12px 14px;
            background: var(--white);
            border: 1px solid var(--steel-200);
            border-radius: var(--radius-sm);
            font-size: var(--fs-xs);
            font-family: var(--font-mono);
            font-weight: 600;
        }

        
        .status-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
        .status-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
        .status-title {
            font-size: var(--fs-sm); font-weight: 800; color: var(--navy-800);
            display: flex; align-items: center; gap: 8px;
        }
        .status-percent { font-size: var(--fs-sm); font-family: var(--font-mono); font-weight: 800; color: var(--navy-600); }

        .progress-bar-bg {
            width: 100%; background: var(--steel-100);
            border-radius: 999px; height: 12px; overflow: hidden;
            border: 1px solid var(--steel-200);
        }
        .progress-bar-fill {
            background: linear-gradient(90deg, var(--navy-600), var(--navy-800));
            height: 100%; width: 0%; border-radius: 999px;
            transition: width 0.2s;
        }

        .status-message { font-size: var(--fs-sm); color: var(--steel-300); line-height: 1.5; }

        .download-area { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--steel-100); }
        .download-area.hidden { display: none; }
        .exported-meta { font-size: var(--fs-xs); color: var(--steel-300); font-family: var(--font-mono); text-align: center; }

        
        .app-footer {
            background: var(--navy-900);
            border-top: 1px solid var(--navy-700);
            padding: 22px 16px 18px;
            text-align: center;
            font-size: var(--fs-xs);
            color: var(--steel-200);
            margin-top: auto;
        }
        .footer-inner {
            max-width: 1320px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
        }
        .footer-brand {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 700;
            color: var(--white);
            font-size: var(--fs-sm);
            letter-spacing: 0.3px;
        }
        .footer-brand .ph { font-size: 18px; color: var(--steel-300); }
        .footer-solutions {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: center;
            gap: 8px 14px;
            color: var(--steel-200);
        }
        .footer-solutions a {
            color: var(--steel-200);
            text-decoration: none;
            font-weight: 600;
            border-bottom: 1px dotted var(--steel-300);
            transition: color 0.15s, border-color 0.15s;
        }
        .footer-solutions a:hover {
            color: var(--white);
            border-bottom-color: var(--white);
        }
        .footer-sep {
            color: var(--navy-500);
            font-weight: 300;
            user-select: none;
        }
        .footer-copy {
            color: var(--steel-300);
            font-size: 11px;
            opacity: 0.8;
        }
        @media (max-width: 640px) {
            .app-footer { padding: 18px 12px 16px; }
            .footer-solutions { flex-direction: column; gap: 6px; }
            .footer-sep { display: none; }
        }

        @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
        .spin { display: inline-block; animation: spin 1s linear infinite; }

        .hidden { display: none !important; }
        .text-xs { font-size: var(--fs-xs); }
        .text-muted { color: var(--steel-300); }
