*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    margin: 0;
    padding: 0;
    background: #f0f2f5;
    color: #333;
}

.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px;
}

h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a2e;
}

/* ── Image URL input bar ──────────────────────────────────────────── */

.image-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.image-selector label {
    font-weight: 600;
    white-space: nowrap;
    color: #444;
}

.form-control {
    flex: 1;
    min-width: 280px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0,120,212,0.2);
}

.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #0078d4;
    color: #fff;
}

.btn-primary:hover {
    background: #005fa3;
}

/* ── Zoomage viewer wrapper ───────────────────────────────────────── */

.zoomage-wrapper {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

/* ── Toolbar (hints + buttons in one bar) ─────────────────────────── */

.zoomage-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 12px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
    user-select: none;
}

.zoomage-hints {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: #888;
    font-size: 11px;
}

.zoomage-hints span {
    white-space: nowrap;
}

.zoomage-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.zoomage-btn {
    padding: 3px 10px;
    background: #2d2d2d;
    color: #ddd;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    line-height: 1.6;
}

.zoomage-btn:hover {
    background: #0078d4;
    color: #fff;
    border-color: #0078d4;
}

.zoomage-btn:active {
    transform: scale(0.95);
}

.zoomage-separator {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: #444;
    margin: 0 4px;
}

.btn-sm {
    padding: 2px 10px;
    font-size: 12px;
}

/* ── Drawn rectangles panel ─────────────────────────────────────────────── */

.drawn-rects {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.drawn-rects-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.drawn-rects ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawn-rects li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-family: monospace;
    color: #333;
}

.rect-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.15);
}
