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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

h1 { text-align: center; margin-bottom: 8px; font-size: 1.8rem; }

.subtitle {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 24px;
}

.nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.nav button {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    background: #1e293b;
    color: #e2e8f0;
    transition: all 0.2s;
    touch-action: manipulation;
}

.nav button:hover { background: #334155; }
.nav button.active { background: #3b82f6; color: white; }

.upload-area {
    border: 2px dashed #334155;
    border-radius: 12px;
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.upload-area:hover { border-color: #60a5fa; background: rgba(96,165,250,0.05); }
.upload-area.has-image { padding: 14px; }

input[type=file] { display: none; }

.panel { display: none; }
.panel.active { display: block; }

.preview-wrap { text-align: center; margin-bottom: 16px; }

.canvas-wrap {
    position: relative;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    max-width: 100%;
}

canvas {
    display: block;
    cursor: crosshair;
    max-width: 100%;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
}

.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
}

.preview-img {
    max-width: 100%;
    max-height: 520px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
}

.tools {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin: 16px 0;
}

.tools button, .tools a.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-block;
    touch-action: manipulation;
}

.tools button:hover, .tools a.btn:hover { opacity: 0.85; }

.btn-primary { background: #3b82f6; color: white; }
.btn-secondary { background: #475569; color: white; }
.btn-danger { background: #ef4444; color: white; }

.btn-success {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(16,185,129,0.35);
    transition: all 0.2s;
    touch-action: manipulation;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16,185,129,0.45);
    opacity: 1;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1e293b;
    padding: 10px 16px;
    border-radius: 8px;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    padding: 10px 14px;
    border-radius: 8px;
}

.input-group label { font-size: 13px; color: #cbd5e1; }

.input-group input, .input-group select {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
}

input[type=range] { width: 120px; }

.hint {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    margin: 8px 0;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #60a5fa;
}

.result-area { margin-top: 20px; text-align: center; }
.result-area img { max-width: 100%; border-radius: 8px; border: 1px solid #334155; }

.warning {
    color: #f59e0b;
    font-size: 13px;
    margin: 8px 0;
    background: #1e293b;
    padding: 10px 14px;
    border-radius: 8px;
    display: inline-block;
}

.error {
    color: #ef4444;
    font-size: 13px;
    margin: 8px 0;
    background: #1e293b;
    padding: 10px 14px;
    border-radius: 8px;
    display: inline-block;
}

.batch-list { display: grid; gap: 12px; margin-top: 16px; }

.batch-item {
    background: #1e293b;
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.batch-item .name { font-weight: 500; font-size: 14px; min-width: 140px; word-break: break-all; }
.batch-item .sizes { color: #94a3b8; font-size: 13px; }
.batch-item .percent { color: #10b981; font-weight: 600; font-size: 14px; }
.batch-item .actions { display: flex; gap: 8px; }

.batch-item .actions a {
    padding: 6px 14px;
    border-radius: 6px;
    background: #334155;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.batch-item .actions a:hover { background: #475569; }

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    transition: transform 0.3s ease;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #ef4444; color: white; }
.toast.warning { background: #f59e0b; color: white; }
.toast.success { background: #10b981; color: white; }

@media (max-width: 640px) {
    .container { padding: 16px; }
    h1 { font-size: 1.4rem; }
    .nav button { padding: 10px 16px; font-size: 14px; }
    .upload-area { padding: 24px 16px; }
    .tools { gap: 8px; }
    .tools button, .tools a.btn { padding: 8px 14px; font-size: 13px; }
    .input-group { padding: 8px 10px; }
    .slider-group { padding: 8px 10px; }
    .preview-img { max-height: 360px; }
}
