*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F3F4F6; --panel: #FFFFFF; --panel2: #F9FAFB;
  --border: #0f172a; --text: #111827; --text-muted: #64748b;
  --brand: #2563eb; --brand-dark: #2563eb; --brand-light: #EDE9FE;
  --radius: 10px; --shadow: 0 2px 8px rgba(0,0,0,.08);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; min-height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* HEADER */
.site-header { background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; background: linear-gradient(135deg,#2563eb,#EC4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.header-badges { display: flex; gap: 6px; }
.badge { background: var(--brand-light); color: var(--brand); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }

/* MAIN */
.app-main { max-width: 1200px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .app-main { grid-template-columns: 1fr; } }

/* TYPE TABS */
.type-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.ttab { flex: 1; padding: 10px; border: 2px solid var(--border); border-radius: 8px; background: var(--panel); font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--text-muted); transition: all .15s; }
.ttab.active { background: var(--brand); border-color: var(--brand); color: white; }
.ttab:hover:not(.active) { border-color: var(--brand); color: var(--brand); }

/* CARDS */
.controls-card, .export-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 14px; }
.ctrl-group { margin-bottom: 18px; }
.ctrl-group:last-child { margin-bottom: 0; }
.ctrl-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px; }

/* ANGLE ROW */
.angle-row { display: grid; grid-template-columns: 1fr 60px 28px; gap: 8px; align-items: center; }
.range-inp { width: 100%; accent-color: var(--brand); height: 6px; cursor: pointer; }
.num-inp { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-weight: 700; text-align: center; outline: none; font-family: inherit; }
.num-inp:focus { border-color: var(--brand); }
.unit-tag { font-size: 13px; color: var(--text-muted); text-align: center; }

/* RADIO GROUP */
.radio-group { display: flex; gap: 16px; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.radio-group input { accent-color: var(--brand); }

/* CHECKBOX */
.checkbox-group { margin-bottom: 0; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check-label input { accent-color: var(--brand); width: 15px; height: 15px; }

/* STOPS */
.stops-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.btn-add-stop { padding: 4px 12px; border: 1px solid var(--brand); border-radius: 6px; background: var(--brand-light); color: var(--brand); font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .12s; }
.btn-add-stop:hover { background: var(--brand); color: white; }

.stops-list { display: flex; flex-direction: column; gap: 8px; }
.stop-row { display: grid; grid-template-columns: 36px 1fr 56px 28px; gap: 8px; align-items: center; }
.stop-color { width: 36px; height: 36px; padding: 2px; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; background: none; }
.stop-pos { width: 100%; }
.stop-pos-num { padding: 6px 4px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; text-align: center; width: 100%; outline: none; font-family: inherit; }
.stop-pos-num:focus { border-color: var(--brand); }
.btn-del-stop { width: 28px; height: 28px; border: none; border-radius: 6px; background: #FEE2E2; color: #EF4444; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .12s; }
.btn-del-stop:hover { background: #EF4444; color: white; }

/* EXPORT */
.export-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.etab { padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; background: none; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text-muted); transition: all .12s; }
.etab.active { background: var(--brand); color: white; border-color: var(--brand); }
.etab:hover:not(.active) { border-color: var(--brand); color: var(--brand); }

.export-code-wrap { position: relative; }
.export-code { background: #1E1E2E; color: #CDD6F4; padding: 14px; border-radius: 8px; font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; min-height: 60px; }
.btn-copy-export { position: absolute; top: 8px; right: 8px; padding: 4px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 6px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .12s; }
.btn-copy-export:hover, .btn-copy-export.copied { background: #A6E3A1; color: #1E1E2E; border-color: #A6E3A1; }

/* PREVIEW */
.preview-card, .presets-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 14px; }
.preview-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pane-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.shape-sel { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-family: inherit; cursor: pointer; background: var(--panel); }

.preview-wrap { background: repeating-conic-gradient(#0f172a 0% 25%, white 0% 50%) 0/16px 16px; border-radius: 8px; padding: 20px; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.preview-box { border-radius: 8px; transition: background .15s; }
.preview-box.shape-rect { width: 280px; height: 160px; }
.preview-box.shape-circle { width: 180px; height: 180px; border-radius: 50%; }
.preview-box.shape-card { width: 260px; height: 160px; border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.2); display: flex; align-items: flex-end; padding: 16px; }
.preview-box.shape-button { width: 160px; height: 50px; border-radius: 25px; box-shadow: 0 4px 16px rgba(0,0,0,.2); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: white; }

/* PRESETS */
.presets-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.preset-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.pfil { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: none; font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text-muted); transition: all .12s; }
.pfil.active { background: var(--brand); color: white; border-color: var(--brand); }

.presets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.preset-item { border-radius: 8px; height: 70px; cursor: pointer; transition: transform .15s, box-shadow .15s; border: 2px solid transparent; position: relative; overflow: hidden; }
.preset-item:hover { transform: scale(1.05); box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.preset-item.active { border-color: white; box-shadow: 0 0 0 3px var(--brand); }
.preset-name { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.5); color: white; font-size: 9px; font-weight: 600; text-align: center; padding: 3px; }

/* FOOTER */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 14px; color: var(--text-muted); font-size: 12px; margin-top: 4px; }
