/* SGG chrome — the tool's own UI (the preview styles itself via generated tokens). */

:root {
    --bg: #f4f7f6;
    --panel: #ffffff;
    --ink: #1f2937;
    --ink-dim: #6b7280;
    --line: #e2e6e4;
    --accent: #2c3e50;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
.hidden { display: none !important; }

header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header h1 { font-size: 1.15rem; margin: 0; }
.tagline { margin: 2px 0 0; font-size: .78rem; color: var(--ink-dim); }
.header-actions { display: flex; gap: .5rem; }

button { font: inherit; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: .4rem .85rem; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

main { display: flex; align-items: flex-start; gap: 18px; padding: 18px 20px; }

.controls { width: 290px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 14px; max-height: calc(100vh - 40px); overflow-y: auto; }
.controls section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.controls h3 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-dim); }
.controls label { display: block; margin-bottom: 10px; font-size: .85rem; }
.controls label .val { float: right; color: var(--ink-dim); font-size: .78rem; }
.controls input[type='color'] { float: right; width: 52px; height: 24px; border: 1px solid var(--line); border-radius: 5px; padding: 1px; background: var(--panel); }
.controls select, .controls input[type='text'] { width: 100%; margin-top: 4px; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; }
.controls input[type='range'] { width: 100%; margin-top: 6px; accent-color: var(--accent); }
#component-toggles label { font-size: .83rem; }
#component-toggles input { accent-color: var(--accent); margin-right: 4px; }

.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row.right { justify-content: flex-end; }
.row button { font-size: .8rem; padding: .3rem .6rem; }
#style-name { flex: 1; min-width: 0; margin-top: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.swatch-wrap { position: relative; display: inline-flex; }
.swatch { font-size: .78rem; padding: .3rem .6rem; border-width: 1.5px; border-radius: 6px; }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.swatch-del { position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%; font-size: .55rem; line-height: 1; padding: 0; color: var(--ink-dim); }

#share-text { width: 100%; height: 140px; font-family: ui-monospace, Menlo, monospace; font-size: .7rem; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; }

.contrast-report { margin-top: 6px; }
.cr-row { display: flex; justify-content: space-between; font-size: .74rem; color: var(--ink-dim); padding: 2px 0; }
.cr-row b { color: #10893e; font-weight: 600; }
.cr-row.cr-fail b { color: #d13438; }

.preview-area { flex: 1; min-width: 0; }
.viewport-controls { display: flex; gap: 6px; margin-bottom: 10px; }
.viewport-controls button { font-size: .8rem; }
#preview-frame { margin: 0 auto; transition: max-width .25s; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 2px 10px rgba(0,0,0,.05); overflow: hidden; }
#preview-container { min-height: 300px; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--panel); border-radius: 12px; padding: 22px 26px; width: min(440px, 92vw); }
.modal-card h2 { margin: 0 0 6px; font-size: 1.05rem; }
.modal-note { font-size: .8rem; color: var(--ink-dim); line-height: 1.55; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.export-grid button { padding: .7rem; }
.export-grid button small { display: block; color: var(--ink-dim); font-size: .68rem; }

@media (max-width: 760px) {
    main { flex-direction: column; }
    .controls { width: 100%; position: static; max-height: none; }
}
