/* ============================================================
   NUMEX STUDIO X — Tasarım Editörü
   Tema değişkenleri tek yerde toplandı.
   ============================================================ */

:root {
  /* Yüzeyler */
  --bg:            #08080b;
  --surface-1:     #0f0f14;
  --surface-2:     #15151c;
  --surface-3:     #1c1c25;
  --surface-4:     #262632;
  --border:        #24242f;
  --border-soft:   #1a1a22;

  /* Metin */
  --text:          #f2f0ea;
  --text-dim:      #9a978f;
  --text-faint:    #64625c;

  /* Vurgu — tek aktif renk */
  --accent:        #ff4d5e;
  --accent-soft:   rgba(255, 77, 94, 0.14);
  --accent-line:   rgba(255, 77, 94, 0.42);

  /* Tipografi */
  --font-ui:       'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, monospace;

  /* Ölçü */
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --topbar-h:      60px;
  --panel-w:       246px;
  --panel-w-right: 292px;
  --gap:           12px;

  --shadow-panel:  0 18px 44px rgba(0,0,0,.55);
  --ease:          cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Ekran okuyucu için gizli etiket: görünmez ama taşma üretmez */
.sr-only-label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---------- ÜST BAR ---------- */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 14px;
  background: linear-gradient(180deg, var(--surface-1), var(--surface-1) 60%, #0c0c11);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 60;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-mark {
  color: var(--accent);
  display: grid; place-items: center;
  filter: drop-shadow(0 0 12px var(--accent-line));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name {
  font-size: 14px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.brand-name em {
  font-style: normal;
  color: var(--accent);
  font-weight: 700;
  margin-left: 1px;
}
.brand-sub {
  font-size: 10.5px; color: var(--text-faint);
  letter-spacing: .06em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 190px;
}

.top-center {
  display: flex; align-items: center; gap: 14px;
  flex: 1 1 auto; justify-content: center;
  min-width: 0;
}

.size-picker select,
.input {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  outline: none;
  transition: border-color .18s var(--ease), background .18s var(--ease);
  width: 100%;
}
.size-picker select { min-width: 168px; width: auto; cursor: pointer; }
.size-picker select:hover, .input:hover { border-color: #33333f; }
.size-picker select:focus-visible, .input:focus-visible {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.zoom-group {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
}
.zoom-group input[type="range"] { width: 92px; }
.zoom-value {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text-dim);
  min-width: 38px; text-align: right;
}

.top-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- DÜĞMELER ---------- */
.ghost-btn, .primary-btn, .icon-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 8px 13px;
  min-height: 34px;
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease), color .16s var(--ease);
  white-space: nowrap;
}
.ghost-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.ghost-btn:hover { background: var(--surface-3); color: var(--text); border-color: #33333f; }
.ghost-btn.full { width: 100%; }
.primary-btn {
  background: var(--surface-4);
  color: var(--text);
  border-color: #31313e;
}
.primary-btn:hover { background: #30303d; }
.primary-btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #150408;
  font-weight: 600;
}
.primary-btn.accent:hover { filter: brightness(1.08); }
.icon-btn {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text-dim);
  width: 28px; height: 28px; min-height: 28px;
  padding: 0;
  display: grid; place-items: center;
  font-size: 15px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); background: var(--surface-4); }
.icon-btn:active, .primary-btn:active, .ghost-btn:active { transform: translateY(1px); }

button:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.export-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 5px;
  min-width: 200px;
  z-index: 90;
  animation: dropIn .16s var(--ease);
}
.menu button {
  display: block; width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12.5px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.menu button:hover { background: var(--surface-4); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- ÇALIŞMA ALANI ---------- */
.workspace {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--panel-w) minmax(0,1fr) var(--panel-w-right);
  gap: 1px;
  background: var(--border-soft);
  min-height: 620px;
  height: calc(100vh - var(--topbar-h));
}

.panel {
  background: var(--surface-1);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #2c2c38 transparent;
}
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: #2c2c38; border-radius: 8px; }

.panel-block {
  padding: 14px 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  animation: fadeUp .3s var(--ease);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-title {
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 62px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 11.5px;
  transition: all .18s var(--ease);
}
.tool-btn:hover {
  background: var(--surface-3);
  border-color: var(--accent-line);
  color: var(--text);
  transform: translateY(-1px);
}
.tool-btn:active { transform: translateY(0) scale(.98); }

.shape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.shape-btn {
  aspect-ratio: 1.4;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .18s var(--ease);
  min-height: 40px;
}
.shape-btn:hover { background: var(--surface-3); border-color: var(--accent-line); }
.shape-btn:active { transform: scale(.95); }

.sw { display: block; background: var(--text-dim); }
.shape-btn:hover .sw { background: var(--accent); }
.sw-rect { width: 20px; height: 14px; border-radius: 2px; }
.sw-ellipse { width: 20px; height: 14px; border-radius: 50%; }
.sw-triangle { width: 0; height: 0; background: transparent; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 16px solid var(--text-dim); }
.shape-btn:hover .sw-triangle { border-bottom-color: var(--accent); }
.sw-line { width: 22px; height: 2px; border-radius: 2px; }
.sw-star { width: 18px; height: 18px; clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.sw-circle { width: 18px; height: 18px; border-radius: 50%; }

.field-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin: 12px 0 6px;
}
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row .hint { font-size: 11px; color: var(--text-faint); }

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 38px; height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 3px; }

.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.swatch {
  width: 20px; height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.14);
  background: var(--c);
  cursor: pointer;
  padding: 0;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease);
}
.swatch:hover { transform: scale(1.16); box-shadow: 0 0 0 2px var(--accent-line); }
.swatches.big { margin-top: 8px; }
.swatches.big .swatch { width: 26px; height: 26px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--surface-4);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--surface-1);
  box-shadow: 0 0 0 1px var(--accent-line);
  cursor: grab;
  transition: transform .15s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--text); border: 2px solid var(--surface-1);
  cursor: grab;
}

.keys { list-style: none; margin: 0; padding: 0; font-size: 11px; color: var(--text-dim); }
.keys li { padding: 3px 0; }
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--text);
}

/* ---------- TUVAL ---------- */
.canvas-area {
  position: relative;
  background:
    radial-gradient(900px 500px at 50% 0%, #131320 0%, transparent 70%),
    var(--bg);
  overflow: hidden;
  min-height: 0;
}
.canvas-viewport {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 34px;
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 26px 26px;
}
.canvas-stage {
  position: relative;
  transition: width .25s var(--ease), height .25s var(--ease);
  /* Sahne kutusunun kendi arka planı yok: tuvalin altında gri/lekeli bir
     kutu görünmesin (eski ölçü artığı sahne alanı olarak kalıyordu). */
  background: transparent;
}
.canvas {
  position: relative;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(0,0,0,.62), 0 0 0 1px rgba(255,255,255,.06);
  background: #101014;
  outline: none;
  transition: width .25s var(--ease), height .25s var(--ease);
  transform-origin: center center;
}
.canvas-bg { position: absolute; inset: 0; z-index: 0; }
.objects { position: absolute; inset: 0; z-index: 1; }

.canvas-hint {
  position: absolute;
  bottom: 14px;
  z-index: 55;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  color: var(--text-faint);
  background: rgba(12,12,17,.82);
  border: 1px solid var(--border-soft);
  padding: 6px 14px;
  border-radius: 20px;
  pointer-events: none;
  transition: opacity .25s var(--ease);
  white-space: nowrap;
}
.canvas-hint.hide { opacity: 0; }

/* Nesneler */
.obj {
  position: absolute;
  cursor: move;
  user-select: none;
  transition: none;
}
.obj.selected { }
.obj .obj-inner { width: 100%; height: 100%; pointer-events: none; }
/* Metinler tuvalin kendi ölçeğinde çizilsin: üstteki küçültme .canvas'ta,
   çocuk öğe kendi boyutunda kalır (dev punto küçük pencerede çökmüş görünmesin) */
.obj[data-type="text"] { will-change: transform; }
/* Ölçeklenmiş katmanlarda yazı bulanıklaşmasın: metin kutuları kendi
   piksel ızgarasında çizilir */
.canvas, .objects, .obj { -webkit-font-smoothing: subpixel-antialiased; }
.obj[data-type="text"] .obj-inner,
.obj[data-type="shape"] .obj-inner { width: 100%; height: 100%; }
.obj .obj-inner img,
.obj .obj-inner svg { width: 100%; height: 100%; display: block; object-fit: fill; pointer-events: none; }

/* Seçim çerçevesi (CSS, ekranda 1px sabit görünür) */
.sel-box {
  position: absolute;
  border: 1.5px solid var(--accent);
  pointer-events: none;
  z-index: 40;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.sel-handle {
  position: absolute;
  width: 9px; height: 9px;
  background: var(--accent);
  border: 1.5px solid #0c0c11;
  border-radius: 50%;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  cursor: nwse-resize;
  transition: transform .12s var(--ease);
}
.sel-handle:hover { transform: translate(-50%, -50%) scale(1.35); }
.sel-handle[data-h="rot"] {
  background: var(--surface-1);
  border-color: var(--accent);
  border-radius: 50%;
  cursor: grab;
}
.sel-handle[data-h="n"], .sel-handle[data-h="s"] { cursor: ns-resize; }
.sel-handle[data-h="e"], .sel-handle[data-h="w"] { cursor: ew-resize; }
.sel-rotline {
  position: absolute;
  width: 1.5px;
  background: var(--accent);
  pointer-events: none;
  z-index: 39;
}

/* Nesne üstünde mini araç çubuğu */
.object-toolbar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(20,20,27,.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(10px);
  z-index: 50;
  animation: dropIn .16s var(--ease);
}
.object-toolbar button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 11.5px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.object-toolbar button:hover { background: var(--surface-4); color: var(--text); }
.object-toolbar button.danger:hover { background: rgba(255,77,94,.16); color: var(--accent); }
.tb-sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; }

/* ---------- SAĞ PANEL ---------- */
.tabbar {
  display: flex;
  gap: 2px;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--surface-1);
  z-index: 2;
}
.tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 9px 8px 10px;
  cursor: pointer;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.tab:hover { color: var(--text-dim); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.empty-state { padding: 34px 20px; text-align: center; }
.empty-title { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.empty-desc { margin: 0; font-size: 11.5px; color: var(--text-faint); line-height: 1.6; }

/* minmax(0,1fr): içerik sütunu şişirip paneli taşırmasın */
.grid-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; margin-bottom: 10px; }
.mini-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* Aralık çubuğu, gizli panelden çıkınca 0 genişlikte kalmasın: sütun içinde esnesin */
.mini-field input[type="range"] { width: 100%; min-width: 0; flex: 1 1 auto; }
.mini-field span { font-size: 10px; color: var(--text-faint); letter-spacing: .04em; }
.mini-field output { font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }
.input.sm { padding: 5px 7px; font-size: 11.5px; }
.input.sm[type="number"] { -moz-appearance: textfield; }
.hex { flex: 1; font-family: var(--font-mono); text-transform: uppercase; }
.textarea { resize: vertical; min-height: 58px; font-family: var(--font-ui); line-height: 1.45; }

.seg-row { display: flex; gap: 8px; margin-top: 10px; }
.seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  padding: 7px 9px;
  min-width: 32px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.seg button:hover { background: var(--surface-3); color: var(--text); }
.seg button.active { background: var(--accent-soft); color: var(--accent); }

.chk-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 11px; }
.chk {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-dim); cursor: pointer;
}
.chk input { accent-color: var(--accent); cursor: pointer; }

.layers-head {
  padding: 12px 14px 8px;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.layers { list-style: none; margin: 0; padding: 0 8px 14px; }
.layer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .14s var(--ease);
}
.layer:hover { background: var(--surface-2); }
.layer.active { background: var(--accent-soft); }
.layer.active .layer-name { color: var(--text); }
.layer-ico {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 10px;
  color: var(--text-faint);
  flex: 0 0 auto;
  background: var(--surface-2);
}
.layer-name {
  flex: 1;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layer-btn {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
}
.layer-btn:hover { background: var(--surface-4); color: var(--text); }
.layer-btn.on { color: var(--accent); }

/* ---------- MODAL ---------- */
/* hidden niteliği display'den ÖNCE gelmeli: aksi hâlde .modal{display:grid}
   gizlemeyi ezer ve modal açık başlar. */
[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6,6,9,.78);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 120;
  padding: 20px;
  animation: fadeIn .18s var(--ease);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal-card {
  width: min(880px, 96vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  animation: popIn .22s var(--ease);
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--surface-1);
  z-index: 1;
}
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; }

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 12px;
  padding: 16px 18px 20px;
}
.tpl-card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: var(--text);
  font-family: var(--font-ui);
  transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.tpl-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.tpl-preview {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.tpl-preview .tp-frame {
  position: absolute;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  overflow: hidden;
}
.tpl-meta { padding: 9px 11px 11px; }
.tpl-name { font-size: 12.5px; font-weight: 600; }
.tpl-size { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; font-family: var(--font-mono); }

/* ---------- TOAST ---------- */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 15px;
  font-size: 12.5px;
  color: var(--text);
  box-shadow: var(--shadow-panel);
  animation: toastIn .24s var(--ease);
  max-width: 320px;
}
.toast.out { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1180px) {
  :root { --panel-w: 208px; --panel-w-right: 258px; }
  .brand-sub { display: none; }
  .zoom-group input[type="range"] { width: 64px; }
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 62vh) auto;
    height: auto;
    min-height: 0;
  }
  .panel {
    overflow: visible;
    border-bottom: 1px solid var(--border-soft);
  }
  .panel-left .tool-grid { grid-template-columns: repeat(4, 1fr); }
  .panel-left .keys-block { display: none; }
  .panel-left, .panel-right { display: flex; flex-wrap: wrap; }
  .panel-left .panel-block { flex: 1 1 220px; }
  .panel-right { display: block; }
  .canvas-area { min-height: 420px; }
  .canvas-viewport { padding: 18px; }
  .top-center { order: 3; width: 100%; flex-basis: 100%; }
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
  }
  .top-actions { margin-left: auto; flex-wrap: wrap; }
}

@media (max-width: 620px) {
  :root { --gap: 8px; }
  .brand-name { font-size: 13px; }
  .panel-left .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-left .panel-block { flex: 1 1 140px; }
  .object-toolbar button { padding: 7px 8px; font-size: 11px; }
  .size-picker select { min-width: 0; width: 100%; }
  .top-center { gap: 8px; }
  .zoom-group { flex-wrap: nowrap; }
  .zoom-group input[type="range"] { width: 56px; }
  .tpl-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .toast-wrap { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Dokunma hedefi: mobilde butonlar en az 44px */
@media (pointer: coarse) {
  .icon-btn { min-height: 40px; min-width: 40px; }
  .layer-btn { min-height: 40px; min-width: 40px; }
  .seg button { min-height: 40px; }
  .sel-handle { width: 13px; height: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
