:root{
    --bg:#f6f7f8;
    --card:#ffffff;
    --text:#111827;
    --muted:#6b7280;
    --border:#e5e7eb;
    --accent:#111827;
    --danger:#b91c1c;
  }
  
  *{box-sizing:border-box;}
  html,body{height:100%;}
  body{
    margin:0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
    background:var(--bg);
    color:var(--text);
  }
  
  .container{
    max-width: 1050px;
    margin: 0 auto;
    padding: 16px;
  }
  
  .topbar{
    position:sticky; top:0;
    background:#fff;
    border-bottom:1px solid var(--border);
    z-index:10;
  }
  .topbar-inner{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
  }
  .brand{font-weight:800;}
  .nav a{
    color:var(--text);
    text-decoration:none;
    font-weight:600;
    padding:8px 10px;
    border-radius:10px;
  }
  .nav a:hover{background:#f3f4f6;}
  
  .card{
    background:var(--card);
    border:1px solid var(--border);
    border-radius:16px;
    padding:16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
  }
  
  .h1{font-size:18px; font-weight:800; margin:0 0 12px;}
  .row{display:flex; gap:12px; flex-wrap:wrap;}
  .col{flex:1 1 320px;}
  .label{font-size:12px; color:var(--muted); margin-bottom:6px;}
  .input, .btn{
    width:100%;
    border-radius:12px;
    border:1px solid var(--border);
    padding:12px;
    font-size:14px;
    background:#fff;
  }
  .btn{
    cursor:pointer;
    font-weight:800;
    background:var(--accent);
    color:#fff;
    border:none;
  }
  .btn:disabled{
    cursor:not-allowed;
    opacity:.6;
  }
  .btn.secondary{
    background:#fff;
    border:1px solid var(--border);
    color:var(--text);
    font-weight:700;
  }
  .small{font-size:12px; color:var(--muted);}
  
  .hr{height:1px; background:var(--border); margin:12px 0;}
  
  .preview{
    width:100%;
    aspect-ratio: 4 / 3;
    border-radius:14px;
    border:1px solid var(--border);
    background:#fafafa;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
  }
  .preview img{width:100%; height:100%; object-fit:cover;}
  
  .notice{font-size:13px; color:var(--muted);}
  .error{font-size:13px; color:var(--danger); font-weight:700;}
  
  .progress-wrap{display:flex; gap:10px; align-items:center;}
  .progress{
    width:100%;
    height:10px;
    border-radius:999px;
    background:#eef0f3;
    overflow:hidden;
    border:1px solid var(--border);
  }
  .progress > div{
    height:100%;
    background:#111827;
    width:0%;
  }
  
  .linkbox{
    padding:12px;
    background:#f9fafb;
    border:1px solid var(--border);
    border-radius:12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size:13px;
    word-break: break-all;
  }
  
  .viewer-card{padding:0; overflow:hidden;}
  .viewer{
    position:relative;
    width:100%;
    background:#000;
    user-select:none;
    touch-action: pan-y;
  }
  .viewer img{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:cover;
  }
  .viewer .after{opacity:1;}
  .viewer .before{
    clip-path: inset(0 50% 0 0);
  }
  
  .handle-line{
    position:absolute;
    top:0; bottom:0;
    width:2px;
    background:rgba(255,255,255,.95);
    left:50%;
  }
  .handle-knob{
    position:absolute;
    top:50%;
    transform: translate(-50%, -50%);
    width:42px; height:42px;
    border-radius:999px;
    background: rgba(0,0,0,.55);
    border:2px solid rgba(255,255,255,.95);
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    font-weight:900;
    letter-spacing:1px;
    left:50%;
  }
  .badge{
    position:absolute;
    top:12px;
    padding:6px 10px;
    border-radius:999px;
    background:rgba(0,0,0,.55);
    color:#fff;
    font-size:12px;
    font-weight:700;
  }
  .badge.left{left:12px;}
  .badge.right{right:12px;}
  
  .footer{color:var(--muted); font-size:12px; padding-top:0;}
  