:root {
    --accent:       #16a34a;
    --accent-h:     #15803d;
    --accent-light: #dcfce7;
    --accent-faint: #f0fdf4;
    --bg:           #f1f5f9;
    --surface:      #ffffff;
    --border:       #e2e8f0;
    --border-2:     #cbd5e1;
    --text:         #0f172a;
    --text-2:       #475569;
    --text-3:       #94a3b8;
    --red:          #dc2626;
    --red-bg:       #fef2f2;
    --red-border:   #fecaca;
    --radius:       12px;
    --radius-sm:    7px;
    --shadow:       0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.05);
    --shadow-md:    0 4px 12px rgba(15,23,42,.10);
    --t:            .15s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* ── Drop zone (empty state) ──────────── */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 340px;
    border: 2px dashed var(--border-2);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    text-align: center;
    padding: 48px 32px;
    transition: border-color var(--t), background var(--t), transform var(--t);
    user-select: none;
}
.dropzone:hover, .dropzone.over {
    border-color: var(--accent);
    background: var(--accent-faint);
    transform: translateY(-2px);
}
.dz-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 6px;
}
.dz-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.4px;
}
.dz-sub {
    font-size: 15px;
    color: var(--text-2);
}
.dz-hint {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 6px;
}

/* ── Workspace ────────────────────────── */
.workspace { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* toolbar */
.ws-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}

/* Resize control */
.resize-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}
.rc-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.rc-num {
    width: 60px;
    padding: 5px 8px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
    -moz-appearance: textfield;
}
.rc-num::-webkit-inner-spin-button,
.rc-num::-webkit-outer-spin-button { -webkit-appearance: none; }
.rc-num:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.rc-num:disabled { background: #f8fafc; color: var(--text-3); cursor: not-allowed; }
.rc-unit { font-size: 12px; color: var(--text-3); }

.rc-lock {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    transition: all var(--t);
    flex-shrink: 0;
}
.rc-lock svg { width: 15px; height: 15px; stroke: var(--text-3); transition: stroke var(--t); }
.rc-lock.locked { border-color: var(--accent); background: var(--accent-faint); }
.rc-lock.locked svg { stroke: var(--accent); }

.rc-mode {
    display: flex;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}
.rc-mode-btn {
    padding: 5px 10px;
    border: none;
    background: var(--surface);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-2);
    transition: background var(--t), color var(--t);
}
.rc-mode-btn + .rc-mode-btn { border-left: 1px solid var(--border-2); }
.rc-mode-btn:hover:not(.active) { background: #f8fafc; }
.rc-mode-btn.active { background: var(--accent); color: #fff; }

/* Summary */
.ws-summary {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-2);
    white-space: nowrap;
}
.ws-summary strong { color: var(--accent); font-weight: 700; }

/* Actions */
.ws-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--t);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-outline { background: var(--surface); border-color: var(--border-2); color: var(--text-2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-faint); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-ghost { background: transparent; color: var(--text-3); border-color: transparent; }
.btn-ghost:hover { color: var(--red); background: var(--red-bg); }

/* ── File list ────────────────────────── */
.file-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

/* ── File card ────────────────────────── */
.fc {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color var(--t), box-shadow var(--t);
    animation: slideUp .18s ease both;
    min-width: 0;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.fc:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); }
.fc.error { border-color: var(--red-border); background: var(--red-bg); }

/* thumbnail */
.fc-thumb-w {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg);
}
.fc-thumb { width: 44px; height: 44px; object-fit: cover; display: block; }
.fc-spin {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.85);
    opacity: 0;
    transition: opacity var(--t);
}
.fc.loading .fc-spin { opacity: 1; }
.spin-ring {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--accent-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* name + type badge */
.fc-name-w {
    flex: 1 1 0;
    min-width: 60px;
    display: flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
}
.fc-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.fc-type {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 5px;
    letter-spacing: .05em;
    flex-shrink: 0;
}

/* dimensions */
.fc-dims {
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* size: orig → compressed */
.fc-size {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.fc-orig { color: var(--text-3); text-decoration: line-through; }
.fc-arr  { color: var(--border-2); }
.fc-new  { font-weight: 700; color: var(--text); }

/* savings badge */
.fc-badge {
    flex-shrink: 0;
    width: 52px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 0;
    border-radius: 100px;
    letter-spacing: .02em;
}
.fc-badge.saving { background: var(--accent-light); color: var(--accent-h); }
.fc-badge.bigger { background: #fee2e2; color: var(--red); }

/* action buttons */
.fc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.fc-dl {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--t), opacity var(--t);
}
.fc-dl svg { width: 14px; height: 14px; }
.fc-dl:hover:not(:disabled) { background: var(--accent-h); }
.fc-dl:disabled { opacity: .3; cursor: default; }
.fc-rm {
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    transition: all var(--t);
}
.fc-rm svg { width: 12px; height: 12px; }
.fc-rm:hover { border-color: var(--red-border); color: var(--red); background: var(--red-bg); }

/* ── Responsive ───────────────────────── */
@media (max-width: 600px) {
    .app { padding: 16px 12px 48px; }
    .dropzone { min-height: 260px; padding: 40px 16px; }
    .dz-title { font-size: 18px; }
    .ws-summary { display: none; }
    .fc-dims { display: none; }
    .fc-orig { display: none; }
    .fc-arr  { display: none; }
}
