/* ─────────────────────────────────────────────────────────────
   JUMI PatternMaker — styles
   Design tokens sourced from the handoff brief (v1.0).
   ───────────────────────────────────────────────────────────── */

:root {
  --teal:        #3db3cb;
  --teal-deep:   #0891b2;
  --teal-tint:   #f0fbfd;
  --teal-border: #a8e6f0;
  --teal-border2:#a5f3fc;
  --ink:         #0f172a;
  --text:        #334155;
  --muted:       #64748b;
  --faint:       #94a3b8;
  --border:      #e2e8f0;
  --faint-border:#f1f5f9;
  --surface:     #e2e8f0;
  --shell:       #e8edf2;
  --card:        #f8fafc;
  --danger:      #ef4444;
  --danger-bd:   #fecaca;
  --danger-bg:   #fff3f3;
  --white:       #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--shell);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* Form controls */
input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; background: var(--border);
  outline: none; cursor: pointer; width: 100%;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; background: var(--teal);
  border-radius: 50%; cursor: pointer; border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; background: var(--teal);
  border-radius: 50%; cursor: pointer; border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input[type=color] {
  -webkit-appearance: none; appearance: none;
  border: none; padding: 0; background: transparent;
  cursor: pointer; border-radius: 4px; overflow: hidden;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 2px solid var(--border); border-radius: 5px; }
select {
  border: 1.5px solid var(--border); border-radius: 7px; padding: 7px 10px;
  font-size: 12px; font-family: 'Nunito', sans-serif; background: white;
  color: var(--text); cursor: pointer; outline: none; width: 100%;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Export toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 2000;
  background: var(--ink); color: white; padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28); animation: toastIn 0.28s ease;
  max-width: calc(100vw - 32px);
}
.toast-icon {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
  background: var(--teal); color: white; font-size: 14px; font-weight: 900;
}
.toast-msg { font-size: 13px; font-weight: 800; color: white; }
.toast-sub { font-size: 11px; font-weight: 600; color: #94a3b8; font-family: monospace; margin-top: 1px; }

/* App shell */
.app { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.spacer { flex: 1; }

/* Site footer */
.footer {
  display: flex; align-items: center; gap: 12px; height: 44px; flex-shrink: 0;
  padding: 0 18px; background: var(--ink); border-top: 1px solid rgba(255,255,255,0.06);
}
.footer-logo { height: 18px; width: auto; opacity: 0.95; }
.footer-copy { font-size: 11px; font-weight: 600; color: #64748b; letter-spacing: 0.02em; }
.footer-links { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.footer-links a {
  font-size: 11px; font-weight: 700; color: #94a3b8; text-decoration: none; cursor: pointer;
  background: none; border: none; font-family: 'Nunito', sans-serif; padding: 0;
}
.footer-links a:hover { color: var(--teal); }

.section-label {
  font-size: 9.5px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px;
}
.section-label.tight { font-size: 9px; letter-spacing: 0.07em; margin-bottom: 6px; }
.mono { font-family: monospace; font-size: 12px; font-weight: 600; color: var(--text); }
.mono.small { font-size: 9.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ─── HEADER ─── */
.header {
  display: flex; align-items: center; height: 56px; padding: 0 16px 0 14px;
  background: var(--ink); flex-shrink: 0; gap: 12px; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 28px; width: auto; }
.brand-name { font-size: 13px; font-weight: 900; color: white; letter-spacing: 0.02em; line-height: 1.1; }
.brand-eyebrow { font-size: 9px; color: var(--teal); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.header-divider { width: 1px; height: 26px; background: rgba(255,255,255,0.1); flex-shrink: 0; }
.element-counter { font-size: 11px; color: var(--muted); font-weight: 600; }
.export-status { font-size: 12px; color: var(--teal); font-weight: 700; min-width: 100px; text-align: right; }
.export-status:not(:empty) { animation: fadeIn 0.3s ease; }

.btn-svg, .btn-png {
  display: flex; align-items: center; gap: 5px; padding: 7px 14px;
  border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer;
  font-family: 'Nunito', sans-serif; white-space: nowrap;
}
.btn-svg { background: rgba(255,255,255,0.08); color: white; border: 1px solid rgba(255,255,255,0.15); }
.btn-png { background: var(--teal); color: white; border: none; box-shadow: 0 2px 8px rgba(61,179,203,0.4); border-radius: 8px 0 0 8px; }

/* PNG split button */
.btn-png-group { position: relative; display: flex; }
.btn-png-caret {
  display: flex; align-items: center; justify-content: center;
  padding: 7px 9px; background: var(--teal); color: white; border: none;
  border-left: 1px solid rgba(255,255,255,0.25); border-radius: 0 8px 8px 0;
  font-size: 11px; cursor: pointer; font-family: 'Nunito', sans-serif;
  box-shadow: 0 2px 8px rgba(61,179,203,0.4);
}
.btn-png-caret:hover { background: var(--teal-deep); }
.png-size-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
  background: #1e293b; border: 1px solid rgba(255,255,255,0.12); border-radius: 9px;
  padding: 5px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); min-width: 100px;
}
.png-size-opt {
  padding: 7px 14px; background: transparent; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.85);
  cursor: pointer; font-family: 'Nunito', sans-serif; text-align: left;
}
.png-size-opt:hover { background: rgba(255,255,255,0.1); }
.png-size-opt.active { color: var(--teal); }
.png-menu-divider { height: 1px; background: rgba(255,255,255,0.12); margin: 4px 2px; }
.png-transparent {
  display: flex; align-items: center; gap: 7px; padding: 6px 10px;
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.85);
  cursor: pointer; font-family: 'Nunito', sans-serif; white-space: nowrap;
}
.png-transparent input { accent-color: var(--teal); cursor: pointer; margin: 0; }
.png-transparent:hover { color: #fff; }

/* ─── AD BANNER (center-column leaderboard) ─── */
.ad-banner {
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 5px 0; flex-shrink: 0;
  margin: -12px -12px 0 -12px; width: calc(100% + 24px);
}
.ad-leaderboard {
  width: 728px; max-width: calc(100% - 32px); min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}

/* ─── MAIN ROW ─── */
.main-row { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* ─── LEFT PANEL ─── */
.left-panel {
  width: 230px; min-width: 230px; background: white;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.lib-tabs-wrap { padding: 10px 10px 8px; border-bottom: 1px solid var(--faint-border); flex-shrink: 0; }
.lib-tabs-wrap .section-label { margin-bottom: 7px; }
.lib-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.lib-tab {
  padding: 4px 9px; border-radius: 6px; background: transparent; color: var(--muted);
  border: none; cursor: pointer; font-size: 10.5px; font-weight: 700;
  white-space: nowrap; font-family: 'Nunito', sans-serif; transition: all 0.15s;
}
.lib-tab.active { background: var(--teal); color: #fff; }

/* Icon search bar */
.icon-search-wrap {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 4px; flex-shrink: 0;
}
.icon-search {
  flex: 1; padding: 5px 9px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 11px; font-family: 'Nunito', sans-serif; color: var(--text);
  background: var(--card); outline: none;
}
.icon-search:focus { border-color: var(--teal-border2); }
.icon-search-count {
  font-size: 9px; font-weight: 700; color: var(--muted); white-space: nowrap;
}

.lib-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 8px;
  overflow-y: auto; flex: 1; align-content: start;
}
.lib-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border-radius: 9px; cursor: pointer;
  border: 1.5px solid transparent; transition: all 0.12s; min-width: 0;
}
.lib-item:hover { background: var(--teal-tint); border-color: var(--teal-border); }
.lib-item img { width: 42px; height: 42px; object-fit: contain; }
.lib-item span {
  font-size: 9px; color: var(--muted); text-align: center; font-weight: 600;
  width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3;
}
.lib-empty { grid-column: 1 / -1; font-size: 11px; color: var(--faint); text-align: center; padding: 20px 8px; line-height: 1.6; }

.text-tool { padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; }
.field-label {
  display: block; font-size: 10px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px;
}
.text-input {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 13px; font-family: 'Nunito', sans-serif; color: var(--text); outline: none;
}
.btn-add-text {
  padding: 10px; background: var(--teal); color: white; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: 'Nunito', sans-serif;
  box-shadow: 0 2px 8px rgba(61,179,203,0.3);
}

.templates-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; overflow-y: auto; flex: 1; align-content: start; }
.template-card {
  display: flex; flex-direction: column; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--border); overflow: hidden; background: white;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.template-card:hover { border-color: var(--teal); box-shadow: 0 2px 8px rgba(61,179,203,0.15); }
.template-card img { width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover; display: block; background: white; }
.template-card .tc-body { padding: 6px 8px 8px; }
.template-card .tc-name { font-size: 10px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-card .tc-desc { font-size: 9px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.upload-panel { padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; overflow-y: auto; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 12px; border: 2px dashed var(--teal); border-radius: 12px;
  cursor: pointer; background: var(--teal-tint); text-align: center;
}
.dropzone:hover { background: #e0f7fa; }
.dropzone-title { font-size: 13px; font-weight: 700; color: var(--teal); }
.dropzone-sub { font-size: 11px; color: var(--faint); margin-top: 2px; }
.upload-hint { font-size: 11px; color: var(--faint); text-align: center; line-height: 1.6; }
.uploads-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }

/* ─── CENTER ─── */
.center {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  overflow: hidden; background: var(--surface); padding: 12px; gap: 10px; min-width: 0;
}
.toolbar {
  display: flex; align-items: center; gap: 10px; background: white; border-radius: 10px;
  padding: 8px 20px; box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  width: 100%; max-width: 840px; flex-shrink: 0;
}
.toolbar-label { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.toolbar-readout { font-size: 11px; font-weight: 700; color: var(--text); min-width: 68px; white-space: nowrap; }
.tile-slider { width: 100px; }
.tile-num {
  width: 52px; padding: 4px 6px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 11px; font-weight: 700; font-family: 'Nunito', sans-serif; color: var(--text);
  text-align: center; -moz-appearance: textfield;
}
.tile-num:focus { outline: none; border-color: var(--teal-border); background: var(--teal-tint); }
.tile-x { font-size: 11px; font-weight: 700; color: var(--faint); }
.btn-tile-link {
  display: flex; align-items: center; justify-content: center; padding: 5px;
  background: transparent; border: 1.5px solid var(--border); border-radius: 7px;
  color: var(--faint); cursor: pointer;
}
.btn-tile-link:hover { border-color: var(--teal-border); color: var(--muted); }
.btn-tile-link.active { border-color: var(--teal); color: var(--teal); background: var(--teal-tint); }
.toolbar-divider { width: 1px; height: 18px; background: var(--faint-border); flex-shrink: 0; }
.bg-color { width: 28px; height: 28px; flex-shrink: 0; padding: 0; border: none; }

.btn-undo, .btn-redo, .btn-clear {
  padding: 5px 10px; background: transparent; border-radius: 7px;
  font-size: 11px; font-weight: 600; font-family: 'Nunito', sans-serif; white-space: nowrap;
  border: 1.5px solid var(--border); color: var(--text); cursor: pointer;
}
.btn-undo:disabled, .btn-redo:disabled { color: #d1d5db; border-color: var(--faint-border); cursor: not-allowed; }
.btn-clear { padding: 5px 12px; color: var(--faint); }
.btn-clear:hover { border-color: #fca5a5; color: var(--danger); }
.btn-grid { display: flex; align-items: center; gap: 5px; padding: 5px 10px; background: transparent; border-radius: 7px; font-size: 11px; font-weight: 600; font-family: 'Nunito', sans-serif; white-space: nowrap; border: 1.5px solid var(--border); color: var(--muted); cursor: pointer; }
.btn-grid:hover { border-color: var(--teal-border); color: var(--text); }
.btn-grid.active { border-color: var(--teal); color: var(--teal); background: var(--teal-tint); }

.editor-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  width: 100%; overflow: hidden; position: relative;
}
/* Live pattern behind/around the editing tile. Dimmed by default so the tile
   stays the focus; full-strength in immersive mode. Its background-image,
   size and position are set from JS so it lines up with the editor tile. */
.surround-pattern {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-repeat: repeat; opacity: 0.16; transition: opacity 0.35s ease;
}
body.immersive .surround-pattern { opacity: 1; }
.editor-wrap > .tile-editor { position: relative; z-index: 1; }
/* empty-hint stays position:absolute (centred overlay) — only lift it above
   the surround layer; do NOT change its positioning or it becomes an in-flow
   flex item and sits beside the tile instead of over it. */
.editor-wrap > .empty-hint { z-index: 1; }
/* In immersive mode the tile reads as a focused swatch sitting on the pattern. */
body.immersive .tile-editor { box-shadow: 0 10px 60px rgba(0,0,0,0.28); }
body.immersive .empty-hint { opacity: 0; pointer-events: none; }

.immersive-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  display: flex; align-items: center; gap: 6px; padding: 6px 11px;
  background: rgba(255,255,255,0.92); border: 1.5px solid var(--border);
  border-radius: 8px; cursor: pointer; color: var(--muted);
  font-size: 11px; font-weight: 700; font-family: 'Nunito', sans-serif;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08); backdrop-filter: blur(4px);
}
.immersive-toggle:hover { border-color: var(--teal-border); color: var(--text); }
.immersive-toggle.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.tile-editor {
  display: block; box-shadow: 0 8px 48px rgba(0,0,0,0.22); border-radius: 8px;
  touch-action: none; user-select: none; cursor: default;
}
.tile-editor.dragging { cursor: grabbing; }
.empty-hint {
  position: absolute; pointer-events: none; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px; animation: fadeIn 0.5s ease;
  max-width: 280px;
}
.empty-hint svg { margin-bottom: 6px; }
.empty-title { font-size: 15px; color: var(--text); font-weight: 800; }
.empty-sub { font-size: 12px; color: var(--faint); font-weight: 600; line-height: 1.5; }

/* ─── RIGHT PANEL ─── */
.right-panel {
  width: 252px; min-width: 252px; background: white;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.preview-block { padding: 12px; border-bottom: 1px solid var(--faint-border); flex-shrink: 0; }
.preview-canvas-wrap { border-radius: 8px; overflow: hidden; background: var(--surface); min-height: 50px; }
.preview-canvas { display: block; width: 100%; height: auto; border-radius: 6px; }
.export-png-block { margin-top: 8px; }
.png-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.png-btn {
  padding: 5px; border-radius: 6px; font-size: 10px; font-weight: 700;
  cursor: pointer; font-family: 'Nunito', sans-serif;
}
.png-btn.free { background: var(--teal-tint); color: var(--teal-deep); border: 1.5px solid var(--teal-border2); }
.png-btn.free:hover { background: #e0f7fa; }

.props-scroll { flex: 1; overflow-y: auto; padding: 12px; }
.quick-colors { margin-bottom: 10px; }
.swatches { display: flex; flex-wrap: wrap; }
.swatch { margin: 2px; cursor: pointer; flex-shrink: 0; }

.props-empty { display: flex; flex-direction: column; gap: 10px; }
.props-empty-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 10px; background: var(--card); border-radius: 10px; text-align: center;
}
.props-empty-card p { font-size: 11px; color: var(--faint); line-height: 1.6; }
.color-readout-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--card); border-radius: 8px; }
.color-readout-row.tight { padding: 0; background: transparent; gap: 6px; }
.color-input { width: 30px; height: 30px; }
.prop-card .color-input { width: 28px; height: 28px; }

.props-selected { display: flex; flex-direction: column; gap: 10px; }
.fill-stroke-row { display: flex; gap: 6px; }
.prop-card { flex: 1; background: var(--card); border-radius: 8px; padding: 8px; }
.prop-card-label {
  font-size: 9px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 5px;
}
.slider-card { background: var(--card); border-radius: 8px; padding: 8px 10px; }
.slider-head { display: flex; justify-content: space-between; margin-bottom: 5px; }
.slider-head .prop-card-label { margin-bottom: 0; }
.slider-val { font-size: 10px; font-weight: 700; color: var(--text); }
.layer-label { margin-bottom: 6px; }
/* Multi-selection banner */
.multi-banner {
  background: var(--teal-tint); border: 1.5px solid var(--teal-border); color: var(--teal-deep);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 8px;
  font-size: 11px; font-weight: 700; text-align: center;
}
/* Exact size & position number inputs */
.size-pos { margin-top: 2px; }
.size-pos-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.size-field {
  display: flex; align-items: center; gap: 5px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 7px; padding: 4px 7px;
}
.size-field span {
  font-size: 10px; font-weight: 800; color: var(--faint);
  width: 11px; flex: none;
}
.size-field input {
  width: 100%; min-width: 0; border: none; background: transparent;
  font-size: 11px; font-weight: 700; color: var(--text);
  font-family: 'Nunito', sans-serif; padding: 1px 0;
}
.size-field input:focus { outline: none; }
.size-field:focus-within { border-color: var(--teal-border); background: var(--teal-tint); }
.layer-row { display: flex; gap: 5px; }
.align-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.layer-btn {
  flex: 1; padding: 6px 4px; background: var(--card); border: 1.5px solid var(--border);
  border-radius: 7px; font-size: 10px; font-weight: 700; cursor: pointer;
  color: var(--text); font-family: 'Nunito', sans-serif;
}
.layer-btn:hover { background: var(--teal-tint); border-color: var(--teal-border); }
/* Compact align + order icon grid */
.compact-controls-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 7px; background: var(--card); border: 1.5px solid var(--border);
  border-radius: 7px; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--teal-tint); border-color: var(--teal-border); color: var(--teal-deep); }

/* Fill type toggle */
.fill-type-row { display: flex; gap: 5px; margin-bottom: 8px; }
.fill-type-btn {
  flex: 1; padding: 6px 4px; background: var(--card); border: 1.5px solid var(--border);
  border-radius: 7px; font-size: 10px; font-weight: 700; cursor: pointer;
  color: var(--text); font-family: 'Nunito', sans-serif;
}
.fill-type-btn:hover { background: var(--teal-tint); border-color: var(--teal-border); }
.fill-type-btn.active {
  background: var(--teal-tint); border-color: var(--teal-border2); color: var(--teal-deep);
}

/* System fonts button */
.btn-system-fonts {
  width: 100%; padding: 7px; margin-top: 6px; background: var(--card);
  border: 1.5px solid var(--border); border-radius: 7px; font-size: 10px;
  font-weight: 700; cursor: pointer; color: var(--text); font-family: 'Nunito', sans-serif;
}
.btn-system-fonts:hover { background: var(--teal-tint); border-color: var(--teal-border); }

.btn-copy, .btn-delete {
  flex: 1; padding: 7px; border-radius: 7px; font-size: 10px; font-weight: 700;
  cursor: pointer; font-family: 'Nunito', sans-serif;
}
.btn-copy { background: var(--teal-tint); color: var(--teal-deep); border: 1.5px solid var(--teal-border2); }
.btn-copy:hover { background: #e0f7fa; }
.btn-delete { background: var(--danger-bg); color: var(--danger); border: 1.5px solid var(--danger-bd); }
.btn-delete:hover { background: #fee2e2; }

/* Keyboard shortcuts bar (full width, above the footer) */
.shortcut-bar {
  display: flex; align-items: center; gap: 18px; flex-shrink: 0;
  height: 30px; padding: 0 18px; background: white;
  border-top: 1px solid var(--border); overflow-x: auto;
}
.shortcut-bar-label {
  font-size: 9px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.1em; flex-shrink: 0;
}
.sb-item { display: flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap; }
.sb-item span { font-size: 10px; color: var(--muted); font-weight: 600; }
.sb-item code { font-size: 9px; font-weight: 700; color: var(--text); background: var(--faint-border); padding: 2px 5px; border-radius: 4px; }

.ad-rect-wrap { padding: 10px; border-top: 1px solid var(--faint-border); flex-shrink: 0; }
.ad-rect {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Layers panel ─── */
.layers-panel {
  border-top: 1px solid var(--faint-border); flex-shrink: 0;
  display: flex; flex-direction: column; max-height: 220px;
}
.layers-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 4px; flex-shrink: 0;
}
.layers-count {
  font-size: 10px; font-weight: 700; color: var(--muted);
  background: var(--shell); border-radius: 10px; padding: 1px 6px;
  border: 1px solid var(--border);
}
.layers-list {
  overflow-y: auto; padding: 0 6px 6px; display: flex; flex-direction: column; gap: 2px;
}
.layers-empty {
  font-size: 11px; color: var(--muted); text-align: center; padding: 12px 0;
}
.layer-item {
  display: flex; align-items: center; gap: 7px; padding: 4px 6px;
  border-radius: 7px; cursor: pointer; border: 1.5px solid transparent;
}
.layer-item:hover { background: var(--teal-tint); }
.layer-item.selected { background: var(--teal-tint); border-color: var(--teal-border2); }
.layer-item.layer-hidden { opacity: 0.45; }
.layer-thumb {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 5px;
  overflow: hidden; background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.layer-thumb svg { display: block; }
.layer-name {
  flex: 1; font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.layer-actions {
  flex-shrink: 0; display: flex; align-items: center; gap: 1px;
}
.layer-eye, .layer-move, .layer-dup, .layer-del, .layer-rename-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 3px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.layer-eye:hover, .layer-move:hover, .layer-dup:hover, .layer-rename-btn:hover { color: var(--teal); background: var(--teal-tint); }
.layer-del:hover { color: var(--danger); background: var(--danger-bg); }
.layer-move:disabled { opacity: 0.25; cursor: default; pointer-events: none; }
.layer-rename {
  flex: 1; min-width: 0; font-size: 11px; font-weight: 600; font-family: 'Nunito', sans-serif;
  color: var(--text); background: white; border: 1.5px solid var(--teal-border);
  border-radius: 5px; padding: 2px 5px;
}
.layer-rename:focus { outline: none; border-color: var(--teal); }

/* Left sidebar ad (3rd slot) */
.ad-side-wrap { padding: 10px; border-top: 1px solid var(--faint-border); flex-shrink: 0; }
.ad-side {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
}

/* ─── New Pattern button ─── */
.btn-new {
  padding: 5px 12px; background: transparent; border-radius: 7px;
  font-size: 11px; font-weight: 700; font-family: 'Nunito', sans-serif; white-space: nowrap;
  border: 1.5px solid var(--border); color: var(--teal-deep); cursor: pointer;
}
.btn-new:hover { border-color: var(--teal-border); background: var(--teal-tint); }
.btn-open, .btn-save {
  padding: 5px 11px; background: transparent; border-radius: 7px;
  font-size: 11px; font-weight: 700; font-family: 'Nunito', sans-serif; white-space: nowrap;
  border: 1.5px solid var(--border); color: var(--text); cursor: pointer;
}
.btn-open:hover, .btn-save:hover { border-color: var(--teal-border); background: var(--teal-tint); color: var(--teal-deep); }

/* ─── Pattern information ─── */
.pattern-info { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--faint-border); }
.info-rows { display: flex; flex-direction: column; gap: 5px; }
.info-row { display: flex; justify-content: space-between; align-items: center; }
.info-row span { font-size: 10px; color: var(--faint); font-weight: 600; }
.info-row strong { font-size: 11px; color: var(--text); font-weight: 800; }

/* ─── Focus / accessibility ─── */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}
.tile-editor:focus-visible { outline-offset: -2px; }
input[type=range]:focus-visible { outline-offset: 4px; }

/* ─── Drawer toggles (tablet) ─── */
.drawer-toggle {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  background: rgba(255,255,255,0.08); color: white;
  border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; cursor: pointer;
}
.drawer-toggle:hover { background: rgba(255,255,255,0.16); }

.drawer-backdrop {
  display: none; position: fixed; inset: 0; z-index: 1400;
  background: rgba(15,23,42,0.45);
}

/* ─── Help modal ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(15,23,42,0.55); animation: fadeIn 0.2s ease;
}
.modal {
  position: relative; background: white; border-radius: 16px; max-width: 460px; width: 100%;
  max-height: calc(100vh - 48px); overflow-y: auto; padding: 28px 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: 13px; cursor: pointer; font-family: 'Nunito', sans-serif;
}
.modal-close:hover { color: var(--text); border-color: var(--faint); }
.modal-title { font-size: 19px; font-weight: 900; color: var(--ink); margin-bottom: 16px; padding-right: 32px; }
.modal-section { margin-bottom: 14px; }
.modal-section h3 { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.modal-section p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.modal-section code { font-family: monospace; font-size: 11px; background: var(--faint-border); padding: 1px 5px; border-radius: 4px; color: var(--text); }
.modal-ok {
  margin-top: 8px; width: 100%; padding: 11px; background: var(--teal); color: white;
  border: none; border-radius: 9px; font-size: 14px; font-weight: 800; cursor: pointer;
  font-family: 'Nunito', sans-serif; box-shadow: 0 2px 8px rgba(61,179,203,0.35);
}

/* ─── Header Help button ─── */
.btn-help-top {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 30px; padding: 0 11px; border-radius: 8px;
  background: rgba(255,255,255,0.08); color: white; border: 1px solid rgba(255,255,255,0.15);
  font-family: 'Nunito', sans-serif; font-size: 12px; font-weight: 800; cursor: pointer;
  white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.btn-help-top:hover { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.3); }
.btn-help-top svg { color: var(--teal); }

/* ─── Help modal (tabbed) ─── */
.help-dialog {
  position: relative; width: 860px; max-width: 100%;
  height: 620px; max-height: calc(100vh - 48px);
  background: white; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.help-dialog__head {
  flex: none; display: flex; align-items: center; gap: 11px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.help-dialog__icon { color: var(--teal); flex: none; }
.help-dialog__title { font-size: 18px; font-weight: 900; color: var(--ink); margin: 0; letter-spacing: 0.01em; }
.help-dialog__close {
  margin-left: auto; flex: none; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 9px;
  color: var(--muted); cursor: pointer; font-family: 'Nunito', sans-serif;
  transition: color 0.15s, border-color 0.15s;
}
.help-dialog__close:hover { color: var(--text); border-color: var(--faint); }
.help-dialog__body { flex: 1; display: flex; min-height: 0; }

/* ─── Mockups: header button + modal + product cards ─── */
.btn-mockups {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 30px; padding: 0 11px; border-radius: 8px;
  background: rgba(255,255,255,0.08); color: white; border: 1px solid rgba(255,255,255,0.15);
  font-family: 'Nunito', sans-serif; font-size: 12px; font-weight: 800; cursor: pointer;
  white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.btn-mockups:hover { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.3); }
.mockup-dialog {
  position: relative; width: 940px; max-width: 100%;
  height: 660px; max-height: calc(100vh - 48px);
  background: white; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.mockup-dialog__head {
  flex: none; display: flex; align-items: center; gap: 11px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.mockup-dialog__icon { color: var(--teal); flex: none; }
.mockup-dialog__title { font-size: 18px; font-weight: 900; color: var(--ink); margin: 0; }
.mockup-dialog__close {
  margin-left: auto; flex: none; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 9px;
  color: var(--muted); cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.mockup-dialog__close:hover { color: var(--text); border-color: var(--faint); }
.mockup-dialog__body { flex: 1; overflow-y: auto; padding: 18px; }
.mockup-intro { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.mockup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mockup-card {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card);
  display: flex; flex-direction: column;
}
.mockup-art { aspect-ratio: 1 / 1; background: #eef1f4; }
.mockup-art svg { display: block; width: 100%; height: 100%; }
.mockup-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border);
}
.mockup-foot span { font-size: 12.5px; font-weight: 800; color: var(--text); }
.mockup-dl {
  padding: 6px 12px; background: var(--teal); border: none; border-radius: 7px;
  color: #fff; font-size: 11.5px; font-weight: 800; cursor: pointer; font-family: 'Nunito', sans-serif;
}
.mockup-dl:hover { background: var(--teal-deep); }
.mockup-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 14px; padding: 48px 20px; }
@media (max-width: 820px) {
  .btn-mockups__label { display: none; }
  .mockup-grid { grid-template-columns: repeat(2, 1fr); }
}
.help-nav {
  width: 196px; flex: none; border-right: 1px solid var(--border);
  background: var(--card); padding: 12px 8px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.help-tab {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0; padding: 9px 14px; cursor: pointer;
  color: var(--muted); font-family: 'Nunito', sans-serif; font-size: 13.5px; font-weight: 700;
  transition: background 0.15s, color 0.15s;
}
.help-tab:hover { background: var(--teal-tint); color: var(--ink); }
.help-tab.is-active { background: var(--teal-tint); border-left-color: var(--teal); color: var(--ink); font-weight: 800; }
.help-content { flex: 1; min-width: 0; overflow-y: auto; padding: 6px 30px 32px; }
.help-panel { display: none; }
.help-panel.is-active { display: block; }
.help-panel h3 { font-size: 16px; font-weight: 900; color: var(--ink); margin: 24px 0 10px; }
.help-panel h3:first-child { margin-top: 18px; }
.help-panel p { font-size: 13.5px; line-height: 1.6; color: var(--muted); margin: 0 0 13px; max-width: 600px; }
.help-badge {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em; color: var(--teal-deep);
  background: var(--teal-tint); border: 1px solid var(--teal-border); padding: 3px 8px; border-radius: 20px;
}
.help-list { list-style: none; margin: 0 0 15px; padding: 0; max-width: 600px; }
.help-list li {
  position: relative; font-size: 13.5px; line-height: 1.55; color: var(--muted); padding: 0 0 9px 22px;
}
.help-list li::before {
  content: ""; position: absolute; left: 4px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal);
}
.help-list li strong { color: var(--text); font-weight: 800; }
.help-list--tight li { padding-bottom: 5px; }
.help-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  vertical-align: middle; margin: 0 1px;
  outline: 2px solid rgba(0,0,0,0.04);
}
.help-dot--pink { background: #ec4899; }
.help-dot--teal { background: var(--teal); }
.help-panel code {
  font-family: monospace; font-size: 12px; background: var(--faint-border);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--text);
}
.help-tipline {
  background: var(--teal-tint); border: 1px solid var(--teal-border);
  border-radius: 10px; padding: 12px 14px !important; color: var(--text) !important;
}
.help-keys { border-collapse: collapse; margin: 0 0 6px; }
.help-keys td {
  padding: 7px 18px 7px 0; font-size: 13.5px; color: var(--muted); vertical-align: middle;
}
.help-keys td:first-child { white-space: nowrap; }
.help-panel kbd {
  display: inline-block; background: var(--card); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px;
  font-family: monospace; font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.4;
}
@media (max-width: 680px) {
  .help-dialog { height: 100%; max-height: calc(100vh - 32px); }
  .help-dialog__body { flex-direction: column; }
  .help-nav {
    width: 100%; flex: none; flex-direction: row; gap: 4px;
    border-right: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto; overflow-y: hidden;
  }
  .help-tab { border-left: 0; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; white-space: nowrap; }
  .help-tab.is-active { border-left: 0; border-bottom-color: var(--teal); }
  .help-content { padding: 6px 18px 26px; }
  .btn-help-top__label { display: none; }
  .btn-help-top { padding: 0 8px; }
}

/* ─── Mobile block (<768px) ─── */
.mobile-block {
  display: none; position: fixed; inset: 0; z-index: 5000;
  flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 32px; text-align: center; background: var(--ink);
}
.mobile-block img { height: 40px; margin-bottom: 8px; }
.mobile-block h2 { font-size: 18px; font-weight: 800; color: white; line-height: 1.4; max-width: 420px; }
.mobile-block p { font-size: 13px; font-weight: 600; color: #94a3b8; max-width: 360px; line-height: 1.5; }

/* ─── Responsive: tablet (≤1200px) — side panels become drawers ─── */
@media (max-width: 1200px) {
  .drawer-toggle { display: flex; }
  .left-panel, .right-panel {
    position: fixed; top: 56px; bottom: 0; z-index: 1500;
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
    transition: transform 0.25s ease;
  }
  .left-panel { left: 0; transform: translateX(-100%); }
  .right-panel { right: 0; transform: translateX(100%); }
  body.left-open .left-panel { transform: translateX(0); }
  body.right-open .right-panel { transform: translateX(0); }
  body.left-open .drawer-backdrop,
  body.right-open .drawer-backdrop { display: block; }
}

/* ─── Footer buttons (match the footer links) ─── */
.footer-links button {
  font-size: 11px; font-weight: 700; color: #94a3b8; text-decoration: none; cursor: pointer;
  background: none; border: none; font-family: 'Nunito', sans-serif; padding: 0;
}
.footer-links button:hover { color: var(--teal); }

/* ─── Cookie consent fallback banner (UK GDPR / PECR · Consent Mode v2) ─── */
.cookie-consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 3000;
  display: flex; justify-content: center; pointer-events: none;
}
.cookie-card {
  pointer-events: auto; width: 100%; max-width: 720px;
  background: var(--ink); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 16px 48px rgba(0,0,0,0.45);
}
.cookie-title { font-size: 15px; font-weight: 900; color: #fff; margin: 0 0 6px; }
.cookie-desc { font-size: 12.5px; line-height: 1.6; color: #cbd5e1; margin: 0; }
.cookie-desc a { color: var(--teal); font-weight: 700; text-decoration: none; }
.cookie-desc a:hover { text-decoration: underline; }

.cookie-prefs { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.cookie-pref {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 9px; padding: 9px 12px;
}
.cookie-pref span { display: flex; flex-direction: column; gap: 1px; }
.cookie-pref strong { font-size: 12.5px; font-weight: 800; color: #fff; }
.cookie-pref em { font-size: 11px; font-style: normal; color: #94a3b8; }
.cookie-pref input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; flex-shrink: 0; }
.cookie-pref input[disabled] { cursor: not-allowed; opacity: 0.6; }

.cookie-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.cookie-btn {
  font-family: 'Nunito', sans-serif; font-size: 12.5px; font-weight: 800; cursor: pointer;
  border-radius: 9px; padding: 9px 16px; border: 1.5px solid transparent; transition: all 0.12s;
}
.cookie-btn.ghost { background: transparent; color: #cbd5e1; border-color: rgba(255,255,255,0.18); }
.cookie-btn.ghost:hover { background: rgba(255,255,255,0.06); color: #fff; }
.cookie-btn.primary { background: var(--teal); color: #fff; box-shadow: 0 2px 10px rgba(61,179,203,0.4); }
.cookie-btn.primary:hover { background: #34a0b7; }

/* ─── Responsive: phone (<768px) — block with message ─── */
@media (max-width: 767px) {
  .mobile-block { display: flex; }
  .cookie-actions { justify-content: stretch; }
  .cookie-btn { flex: 1; }
}
