:root {
    --primary: #0071e3;
    --success: #34c759;
    --bg-body: #f5f5f7;
    --bg-card: #ffffff;
    --text-main: #1d1d1f;
    --text-sub: #86868b;
    --border: #d2d2d7;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 40px;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

header { text-align: center; margin-bottom: 30px; }
h1 { font-size: 28px; margin: 0; }
.badge { background: var(--primary); color: white; font-size: 12px; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.subtitle { color: var(--text-sub); margin-top: 5px; }

/* Status Bar */
.status-bar {
    text-align: center;
    padding: 10px;
    background: #fff3cd;
    color: #856404;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    transition: all 0.3s;
}
.status-bar.ready { background: #d4edda; color: #155724; }
.spinner {
    display: inline-block; width: 12px; height: 12px;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Upload */
#drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 60px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}
#drop-zone:hover { border-color: var(--primary); background: #f0f8ff; }
.icon-upload { font-size: 48px; margin-bottom: 10px; }

/* Workspace */
.workspace {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}
@media (max-width: 768px) { .workspace { grid-template-columns: 1fr; } }

.canvas-wrapper {
    position: relative;
    background: #eee;
    border-radius: var(--radius);
    overflow: hidden;
    line-height: 0;
    user-select: none;
}
canvas { max-width: 100%; height: auto; cursor: crosshair; }

#selection-box {
    position: absolute;
    border: 1px solid red;
    background: rgba(255, 0, 0, 0.2);
    display: none;
    pointer-events: none;
}

/* Controls */
.controls { background: #fafafa; padding: 20px; border-radius: var(--radius); }
.tabs { display: flex; gap: 5px; margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab-btn {
    background: none; border: none; padding: 8px 12px; cursor: pointer; color: var(--text-sub);
    font-weight: 500; border-radius: 6px;
}
.tab-btn.active { background: #fff; color: var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.tab-panel { display: none; animation: fadeIn 0.2s; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.control-group { margin-bottom: 15px; }
label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=range] { width: 100%; }

.btn {
    width: 100%; padding: 10px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #0062c3; }
.btn-success { background: var(--success); color: white; margin-top: 10px;}
.btn-secondary { background: #e5e5ea; color: black; }
.global-actions { margin-top: 30px; border-top: 1px solid var(--border); padding-top: 20px; display: flex; gap: 10px;}
.desc, .alert-box { font-size: 12px; color: var(--text-sub); margin-top: 8px; line-height: 1.4; }
.alert-box { background: #e8f0fe; color: #1967d2; padding: 10px; border-radius: 6px; }
