/* Sahne düzenleyici (tam ekran) — public/js/editor/editor.js
   Görsel dil: nötr grafit yüzeyler, ince çizgiler, çizgi ikonlar; altın yalnızca seçim ve birincil eylemde. */

.ed {
  --bg: #0d1114;
  --p1: #13181b;
  --p2: #1a2024;
  --p3: #20272b;
  --ln: #242c31;
  --ln2: #2e383e;
  --tx: #e6ecea;
  --mu: #8a9793;
  --dim: #5f6b68;
  --acc: #e2b65c;
  --on-acc: #17130a;
  --sea: #3fb6a8;
  --danger: #e5787a;
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  grid-template-rows: 48px 1fr;
  background: var(--bg);
  color: var(--tx);
  font: 400 13px/1.4 "Onest", "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
.ed * { box-sizing: border-box; }
.ed [hidden] { display: none !important; }
.ed button { font: inherit; color: inherit; cursor: pointer; }
.ed button:disabled { cursor: not-allowed; opacity: 0.45; }
.ed :focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.ed .ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- üst çubuk ---------- */
.ed-top { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--p1); border-bottom: 1px solid var(--ln); min-width: 0; }
.ed-title { font-weight: 600; font-size: 14px; white-space: nowrap; }
.ed-crumb { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--ln2); border-radius: 6px; color: var(--mu); white-space: nowrap; overflow: hidden; max-width: 220px; }
.ed-crumb b { color: var(--tx); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ed-live { font-size: 11px; font-weight: 600; color: var(--sea); }
.ed-sp { flex: 1; }
.ed-vr { width: 1px; height: 22px; background: var(--ln); flex: none; }
.ed-ib { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--mu); flex: none; }
.ed-ib:hover:not(:disabled) { background: var(--p3); color: var(--tx); }
.ed-ib.is-on { background: var(--p3); color: var(--tx); }
.ed-seg { display: flex; padding: 2px; gap: 2px; border: 1px solid var(--ln2); border-radius: 7px; background: var(--bg); flex: none; }
.ed-seg button { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: var(--mu); white-space: nowrap; }
.ed-seg button.is-on { background: var(--p3); color: var(--tx); }
.ed-zoom { min-width: 46px; text-align: center; color: var(--mu); }
.ed-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--ln2); border-radius: 6px; background: transparent; font-weight: 500; white-space: nowrap; }
.ed-btn:hover:not(:disabled) { background: var(--p3); }
.ed-btn-pri { background: var(--acc); border-color: var(--acc); color: var(--on-acc); font-weight: 600; }
.ed-btn-pri:hover:not(:disabled) { background: #ecc574; }
.ed-btn-danger { color: var(--danger); }
.ed-status { font-size: 12px; color: var(--mu); white-space: nowrap; }
.ed-status.is-dirty { color: var(--acc); }

/* ---------- gövde ---------- */
.ed-body { display: grid; grid-template-columns: 248px 1fr 288px; min-height: 0; }
.ed-left, .ed-right { display: flex; flex-direction: column; min-height: 0; background: var(--p1); }
.ed-left { border-right: 1px solid var(--ln); }
.ed-right { border-left: 1px solid var(--ln); overflow-y: auto; }
.ed-tabs { display: flex; gap: 18px; height: 40px; padding: 0 14px; align-items: flex-end; border-bottom: 1px solid var(--ln); flex: none; }
.ed-tabs button { height: 100%; padding: 0 0 10px; border: 0; background: transparent; color: var(--mu); font-weight: 500; display: flex; align-items: flex-end; }
.ed-tabs button.is-on { color: var(--tx); box-shadow: inset 0 -2px 0 var(--acc); }
.ed-scroll { overflow-y: auto; min-height: 0; flex: 1; }
.ed-list { display: flex; flex-direction: column; gap: 1px; padding: 6px; }
.ed-row { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 8px; border: 0; border-radius: 6px; background: transparent; color: #c9d2cf; text-align: left; width: 100%; }
.ed-row:hover { background: var(--p2); }
.ed-row.is-sel { background: rgba(226, 182, 92, 0.12); color: var(--tx); }
.ed-row.is-sel > .ic { color: var(--acc); }
.ed-row.is-hidden-layer .ed-row-name { color: var(--dim); text-decoration: line-through; }
.ed-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-row-act { display: flex; gap: 2px; }
.ed-row-act button { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--dim); }
.ed-row-act button:hover { color: var(--tx); background: var(--p3); }
.ed-row-act .ic { width: 14px; height: 14px; }
.ed-tag { font-size: 10.5px; font-weight: 600; color: var(--sea); border: 1px solid color-mix(in srgb, var(--sea) 45%, transparent); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
.ed-sec { padding: 12px 14px; border-top: 1px solid var(--ln); }
.ed-sec:first-child { border-top: 0; }
.ed-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 11.5px; font-weight: 600; color: var(--mu); }
.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ed-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 58px; padding: 0 4px; border: 1px solid var(--ln); border-radius: 7px; background: var(--p2); color: #c9d2cf; font-size: 11.5px; text-align: center; line-height: 1.2; }
.ed-tile .ic { color: var(--mu); width: 18px; height: 18px; }
.ed-tile:hover:not(:disabled) { border-color: var(--ln2); background: var(--p3); color: var(--tx); }
.ed-scene-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 14px; }
.ed-scene-actions .ed-btn { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* ---------- orta: sahne ---------- */
.ed-mid { position: relative; overflow: auto; background-color: #0a0d0f; background-image: radial-gradient(#1b2226 1px, transparent 1px); background-size: 16px 16px; }
.ed-canvas { position: relative; margin: 28px auto; }
.ed-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; overflow: hidden; box-shadow: 0 0 0 1px #2a3439, 0 20px 50px rgba(0, 0, 0, 0.5); }
.ed-stage-bg { position: absolute; inset: 0; background: linear-gradient(180deg, #152a2f 0%, #0f1f23 55%, #0b1518 100%); }
.ed-stage-bg::after { content: "Oyun görüntüsü"; position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font: 600 34px/1 "Onest", system-ui, sans-serif; color: rgba(255, 255, 255, 0.08); letter-spacing: 0.06em; text-transform: uppercase; }
.ed-stage .sl-host { pointer-events: none; }
.ed-overlay { position: absolute; inset: 0; cursor: default; touch-action: none; }
.ed-sel { position: absolute; outline: 3px solid var(--acc); pointer-events: none; }
.ed-sel.is-locked { outline-style: dashed; outline-color: var(--mu); }
.ed-handle { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; background: #fff; border: 3px solid var(--acc); border-radius: 3px; pointer-events: auto; }
.ed-handle[data-h="nw"], .ed-handle[data-h="se"] { cursor: nwse-resize; }
.ed-handle[data-h="ne"], .ed-handle[data-h="sw"] { cursor: nesw-resize; }
.ed-handle[data-h="n"], .ed-handle[data-h="s"] { cursor: ns-resize; }
.ed-handle[data-h="e"], .ed-handle[data-h="w"] { cursor: ew-resize; }
.ed-dim { position: absolute; padding: 4px 10px; border-radius: 6px; background: var(--acc); color: var(--on-acc); font: 600 22px/1.2 "Onest", system-ui, sans-serif; white-space: nowrap; pointer-events: none; transform: translate(-50%, 12px); }
.ed-guide { position: absolute; pointer-events: none; }
.ed-guide.x { top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--sea); }
.ed-guide.y { left: 0; right: 0; height: 0; border-top: 2px dashed var(--sea); }
.ed-hover { position: absolute; outline: 2px solid rgba(226, 182, 92, 0.45); pointer-events: none; }
.ed-zoombar { display: flex; align-items: center; gap: 2px; flex: none; }
.ed-zoombar .ed-ib { width: 28px; height: 28px; }
.ed.is-preview .ed-overlay { display: none; }

/* ---------- sağ: denetçi ---------- */
.ed-ins-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--ln); font-weight: 600; font-size: 14px; }
.ed-ins-head small { margin-left: auto; font-weight: 400; color: var(--mu); font-size: 12px; }
.ed-empty { margin: auto; padding: 40px 24px; text-align: center; color: var(--mu); line-height: 1.6; }
.ed-empty .ic { width: 28px; height: 28px; color: var(--dim); margin-bottom: 8px; }
.ed-field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ed-field:first-child { margin-top: 0; }
.ed-lab { font-size: 11.5px; color: var(--mu); }
.ed-in { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 1px solid var(--ln); border-radius: 6px; background: var(--bg); color: var(--tx); min-width: 0; }
.ed-in:focus-within { border-color: var(--ln2); box-shadow: 0 0 0 2px rgba(226, 182, 92, 0.25); }
.ed-in > i { font-style: normal; color: var(--dim); font-size: 11.5px; min-width: 12px; }
.ed-in > u { text-decoration: none; color: var(--dim); font-size: 11.5px; }
.ed-in input, .ed-in select, .ed-in textarea { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--tx); font: inherit; padding: 0; }
.ed-in select option { background: var(--p1); }
.ed-in.is-area { height: auto; padding: 6px 8px; }
.ed-in textarea { resize: vertical; min-height: 54px; line-height: 1.45; }
.ed-in input[type="color"] { flex: none; width: 20px; height: 20px; border-radius: 4px; padding: 0; cursor: pointer; }
.ed-in input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.ed-in input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 4px; }
.ed-hint { font-size: 11.5px; color: var(--dim); line-height: 1.4; }
.ed-sub { margin: 12px 0 6px; padding-top: 10px; border-top: 1px solid var(--ln); font-size: 11.5px; font-weight: 600; color: var(--acc); }
[data-texts] .ed-hint { margin-bottom: 8px; }
.ed-seg2 { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--ln); border-radius: 6px; background: var(--bg); }
.ed-seg2 button { flex: 1; height: 26px; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--mu); font-size: 12px; white-space: nowrap; padding: 0 4px; }
.ed-seg2 button.is-on { background: var(--p3); color: var(--tx); }
.ed-seg2 button:hover { color: var(--tx); }
.ed-toggle { display: flex; align-items: center; justify-content: space-between; height: 30px; margin-top: 6px; }
.ed-switch { position: relative; width: 30px; height: 17px; border: 0; border-radius: 9px; background: var(--ln2); padding: 0; flex: none; }
.ed-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--mu); transition: left 0.15s ease; }
.ed-switch.is-on { background: var(--acc); }
.ed-switch.is-on::after { left: 15px; background: var(--on-acc); }
.ed-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ed-actions .ed-btn { height: 30px; padding: 0 6px; font-size: 12px; }
.ed-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ed-media-cell { position: relative; }
.ed-media-item { position: relative; width: 100%; aspect-ratio: 1; border: 1px solid var(--ln); border-radius: 6px; background: var(--bg) center / contain no-repeat; padding: 0; overflow: hidden; }
.ed-media-item.is-sel { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(226, 182, 92, 0.35); }
.ed-media-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ed-media-del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 5px; background: rgba(0, 0, 0, 0.6); color: #fff; }
.ed-media-del .ic { width: 13px; height: 13px; }
.ed-media-del:hover { background: rgba(229, 120, 122, 0.85); }
.ed-upload { display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; margin-top: 8px; border: 1px dashed var(--ln2); border-radius: 6px; color: var(--mu); cursor: pointer; }
.ed-upload:hover { color: var(--tx); border-color: var(--mu); }
.ed-upload input { display: none; }
.ed-note { margin: 12px 14px; padding: 10px 12px; border-radius: 6px; background: var(--p2); border: 1px solid var(--ln); color: var(--mu); line-height: 1.5; font-size: 12.5px; }
.ed-note.ed-warn { border-color: rgba(226, 182, 92, 0.45); background: rgba(226, 182, 92, 0.08); color: #ecc87d; }

/* ---------- bildirim ---------- */
.ed-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2001; padding: 9px 16px; border-radius: 8px; background: var(--p3); border: 1px solid var(--ln2); color: var(--tx); font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.ed-toast.is-error { border-color: rgba(229, 120, 122, 0.5); }

@media (max-width: 1100px) {
  .ed-body { grid-template-columns: 210px 1fr 260px; }
  .ed-crumb { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ed-switch::after { transition: none; }
}

/* =============================================================================================
   Stüdyo — "Hediye ve uyarılar" kartı (alertsPanel.js); düzenleyiciyle aynı görsel dil
   ============================================================================================= */
.alerts-panel {
  --ln: #24343b;
  --ln2: #2f4048;
  --tx: #e6ecea;
  --mu: #8fa3a0;
  --dim: #66807b;
  --acc: #e2b65c;
  --on-acc: #17130a;
  --bg: #0b1418;
  color: var(--tx);
  font-size: 13px;
}
.alerts-panel .ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.al-list { display: flex; flex-direction: column; gap: 6px; }
.al-item { border: 1px solid var(--ln); border-radius: 10px; background: rgba(255, 255, 255, 0.015); }
.al-item.is-open { border-color: var(--ln2); background: rgba(255, 255, 255, 0.03); }
.al-item.is-sub { margin-left: 18px; }
.al-head { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 4px; }
.al-head-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.al-head-btn .ic { color: var(--mu); }
.al-item.is-open .al-head-btn .ic { color: var(--acc); }
.al-name { font-weight: 600; white-space: nowrap; }
.al-sub { flex: 1; min-width: 0; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-switch { position: relative; width: 32px; height: 18px; border: 0; border-radius: 9px; background: var(--ln2); padding: 0; flex: none; cursor: pointer; }
.al-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--mu); transition: left 0.15s ease; }
.al-switch.is-on { background: var(--acc); }
.al-switch.is-on::after { left: 16px; background: var(--on-acc); }
.al-body { padding: 4px 14px 14px; border-top: 1px solid var(--ln); display: flex; flex-direction: column; gap: 10px; }
.al-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.al-lab { font-size: 11.5px; color: var(--mu); }
.al-hint { font-size: 11.5px; color: var(--dim); margin: 0; }
.al-in { height: 34px; padding: 0 10px; border: 1px solid var(--ln); border-radius: 7px; background: var(--bg); color: var(--tx); font: inherit; min-width: 0; width: 100%; }
.al-in:focus { outline: 0; border-color: var(--ln2); box-shadow: 0 0 0 2px rgba(226, 182, 92, 0.25); }
.al-row { display: flex; align-items: center; gap: 6px; }
.al-row .al-in { flex: 1; }
.al-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.al-ib { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border: 1px solid var(--ln); border-radius: 7px; background: transparent; color: var(--mu); cursor: pointer; }
.al-ib:hover { color: var(--tx); border-color: var(--ln2); }
.al-range { flex: 1; accent-color: var(--acc); }
.al-unit { min-width: 40px; text-align: right; color: var(--mu); font-variant-numeric: tabular-nums; }
.al-acts { flex-wrap: wrap; }
.al-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--ln2); border-radius: 7px; background: transparent; color: var(--tx); font: inherit; font-weight: 500; cursor: pointer; }
.al-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }
.al-btn-ghost { border-color: transparent; color: var(--mu); }
.al-btn-pri { background: var(--acc); border-color: var(--acc); color: var(--on-acc); font-weight: 600; }
.al-btn-pri:hover:not(:disabled) { background: #ecc574; }
.al-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.al-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.al-status { color: var(--mu); font-size: 12px; }
.al-status.is-dirty { color: var(--acc); }
.alerts-panel :focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .al-switch::after { transition: none; } }

/* Stüdyo: sahne geçiş düğmeleri */
.stage-scenes-row { flex-wrap: wrap; }
.scene-switch { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.scene-switch button { height: 30px; padding: 0 12px; border: 1px solid #2f4048; border-radius: 7px; background: transparent; color: #c9d6d3; font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.scene-switch button:hover { border-color: #46606a; color: #fff; }
.scene-switch button.is-live { border-color: #e2b65c; background: rgba(226, 182, 92, 0.14); color: #fff; }
.scene-switch button.is-live::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #3fb6a8; vertical-align: 1px; }
.scene-edit-btn { flex: none; }

/* Stüdyo notları */
.rules-layers-note { margin: 0 0 12px; padding: 10px 12px; border: 1px solid #24343b; border-radius: 10px; background: rgba(255, 255, 255, 0.02); color: #9fb3af; font-size: 12.5px; line-height: 1.5; }
.rules-layers-note b { color: #e6ecea; }
.tiktok-setup-note { margin-top: 14px; padding: 12px 14px; border: 1px solid rgba(226, 182, 92, 0.3); border-radius: 12px; background: rgba(226, 182, 92, 0.06); font-size: 13px; line-height: 1.55; }
.tiktok-setup-note ol { margin: 6px 0 0; padding-left: 20px; }
.tiktok-setup-note li + li { margin-top: 3px; }
.tiktok-setup-note code { padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); }
