:root {
  --bg: #0b1120;
  --panel: #111827;
  --card: #1e293b;
  --border: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #0ea5e9;
  --accent: #14b8a6;
  --purple: #8b5cf6;
  --warn: #f59e0b;
  --danger: #ef4444;
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); direction: rtl; min-height: 100vh; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 16px; }
.brand-dot { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #0ea5e9, #8b5cf6); display: grid; place-items: center; font-size: 18px; }
.brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 6px; margin-inline-start: auto; flex-wrap: wrap; }
.nav button { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 7px 13px; border-radius: 10px; cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 700; transition: 0.15s; }
.nav button:hover { border-color: var(--primary); }
.nav button.active { background: linear-gradient(135deg, #0284c7, #0f766e); border-color: transparent; }

.main { max-width: 1460px; margin: 0 auto; padding: 16px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { margin: 0; font-size: 16px; color: #fff; }
.muted { color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--border); background: var(--card); color: #fff; padding: 7px 12px; border-radius: 9px; cursor: pointer; font-family: var(--font); font-size: 12.5px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.btn:hover { border-color: var(--primary); }
.btn-pri { background: #0284c7; border-color: #0284c7; }
.btn-teal { background: #0f766e; border-color: #0f766e; }
.btn-purp { background: #7c3aed; border-color: #7c3aed; }
.btn-warn { background: #b45309; border-color: #b45309; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: rgba(14,165,233,0.16); color: #7dd3fc; border: 1px solid rgba(14,165,233,0.35); padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }

/* Play + Debug Workspace */
.play-shell { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .play-shell { grid-template-columns: 1fr; } }
.stage-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.viewport-frame { background: #020617; border: 1px solid var(--border); border-radius: 16px; padding: 14px; min-height: 540px; display: flex; justify-content: center; overflow: auto; }
.viewport-canvas { width: 100%; max-width: 1120px; background: #f8fafc; color: #0f172a; border-radius: 14px; padding: 18px; box-shadow: 0 22px 50px rgba(0,0,0,0.45); transition: max-width 0.25s; }
.viewport-canvas--tablet { max-width: 768px; }
.viewport-canvas--mobile { max-width: 410px; }

.feedback-banner { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-size: 13.5px; font-weight: 700; }
.finish-banner { background: linear-gradient(135deg, #0f766e, #1d4ed8); color: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* 12-column Game Grid */
.gs-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: minmax(42px, auto); gap: 10px; align-items: stretch; }
.gs-el { position: relative; border-radius: 12px; }
.gs-el--tappable { cursor: pointer; outline: 2px dashed rgba(139, 92, 246, 0.55); outline-offset: 2px; transition: transform 0.14s ease, box-shadow 0.14s ease; }
.gs-el--tappable:hover { transform: scale(1.015); box-shadow: 0 10px 24px rgba(139, 92, 246, 0.25); }
.gs-text { line-height: 1.75; white-space: pre-wrap; font-weight: 600; }
.gs-atlas-wrap { position: relative; width: 100%; height: 100%; min-height: 220px; border-radius: 14px; background: radial-gradient(circle at 50% 80%, #e0f2fe, #f8fafc); border: 1px solid #cbd5e1; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 6px; }
.gs-atlas-canvas { max-width: 100%; max-height: 280px; width: auto; height: auto; display: block; }
.gs-atlas-cap { font-size: 12px; font-weight: 800; color: #1e293b; background: rgba(255,255,255,0.88); padding: 2px 10px; border-radius: 99px; margin-top: 4px; }
.gs-tap-pill { position: absolute; top: 8px; left: 8px; background: #7c3aed; color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; }

.gs-choices { display: flex; flex-direction: column; gap: 8px; }
.gs-choice-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: right; background: #fff; color: #0f172a; border: 2px solid #cbd5e1; border-radius: 12px; padding: 11px 14px; font-family: var(--font); font-size: 14.5px; font-weight: 800; cursor: pointer; transition: 0.15s; }
.gs-choice-btn:hover { border-color: #0f766e; background: #f0fdfa; transform: translateX(-2px); }
.gs-choice-btn--revealed { border-color: #7c3aed; background: #f5f3ff; }
.gs-ch-idx { width: 26px; height: 26px; border-radius: 8px; background: #0f766e; color: #fff; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }

.gs-scoreboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.gs-kpi { background: #fff; border: 1px solid #cbd5e1; border-top: 4px solid #0f766e; border-radius: 11px; padding: 8px; text-align: center; }
.gs-kpi-l { font-size: 11px; color: #64748b; font-weight: 700; }
.gs-kpi-v { font-size: 20px; font-weight: 900; color: #0f172a; margin-top: 2px; }
.gs-prog-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.gs-prog-track { height: 12px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.gs-prog-fill { height: 100%; background: linear-gradient(90deg, #0ea5e9, #0f766e); border-radius: 99px; transition: width 0.35s; }
.gs-timer { display: flex; justify-content: space-between; align-items: center; background: #0f172a; color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 800; }
.gs-badge { background: #fef3c7; color: #92400e; border: 1.5px solid #f59e0b; border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 800; }
.gs-card-t { font-size: 12.5px; font-weight: 800; color: #1e3a5f; margin-bottom: 6px; display: block; }
.gs-bar-row { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 4px; }
.gs-bar-row span { width: 95px; font-weight: 700; }
.gs-bar-tr { flex: 1; height: 14px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.gs-bar-fi { height: 100%; background: #0ea5e9; border-radius: 5px; }
.gs-radar { width: 100%; max-height: 195px; display: block; }
.gs-stars { display: flex; gap: 6px; }
.gs-star { border: 0; background: transparent; font-size: 26px; color: #cbd5e1; cursor: pointer; padding: 0; }
.gs-star.on { color: #f59e0b; }
.gs-slider { width: 100%; accent-color: #0f766e; }
.gs-img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; display: block; }
.gs-video { width: 100%; max-height: 240px; border-radius: 12px; background: #000; }
.gs-media-box, .gs-scene-box, .gs-avatar { background: #fff; border: 1px solid #cbd5e1; border-radius: 12px; padding: 10px; font-size: 13px; }
.gs-avatar { display: flex; align-items: center; gap: 10px; }
.gs-avatar-c { width: 42px; height: 42px; border-radius: 50%; background: #e0f2fe; display: grid; place-items: center; font-size: 22px; }
.gs-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; border-radius: 8px; overflow: hidden; }
.gs-tbl th { background: #1e3a5f; color: #fff; padding: 6px; }
.gs-tbl td { border: 1px solid #cbd5e1; padding: 6px; }
.gs-hint-btn { background: #fffbeb; border: 1.5px solid #f59e0b; color: #92400e; padding: 8px 14px; border-radius: 10px; font-family: var(--font); font-weight: 800; cursor: pointer; }
.gs-inp { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 9px; font-family: var(--font); }
.gs-placeholder { border: 1.5px dashed #94a3b8; border-radius: 12px; padding: 14px; text-align: center; color: #64748b; font-size: 12.5px; }

/* Debug Drawer */
.debug-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: 82vh; overflow-y: auto; }
.debug-sec { background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 9px; }
.debug-sec h4 { margin: 0 0 6px; font-size: 12.5px; color: #7dd3fc; }
.trace-list { max-height: 220px; overflow-y: auto; font-family: ui-monospace, monospace; font-size: 11px; direction: ltr; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.trace-item { background: rgba(15,23,42,0.7); border-left: 3px solid #14b8a6; padding: 4px 6px; border-radius: 4px; word-break: break-word; }
.trace-item--warn { border-left-color: #f59e0b; color: #fde68a; }
.sel, .inp-dark { background: #0f172a; color: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-family: var(--font); font-size: 12.5px; }

/* Atlas Preview Stage */
.checker-stage { background-image: conic-gradient(#334155 25%, #1e293b 0 50%, #334155 0 75%, #1e293b 0); background-size: 18px 18px; border-radius: 14px; border: 1px solid var(--border); padding: 14px; display: flex; justify-content: center; align-items: center; min-height: 260px; }


/* KCE Core Identity & Workspace Switcher Bar */
.identity-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: rgba(30, 41, 59, 0.75); border: 1px solid var(--border); padding: 4px 10px; border-radius: 11px; font-size: 12px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.78); backdrop-filter: blur(4px); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: 420px; max-width: 96vw; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 11px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); }
.err-box { background: rgba(239, 68, 68, 0.16); border: 1px solid #ef4444; color: #fecaca; border-radius: 9px; padding: 8px 10px; font-size: 12.5px; }
.pill-tpl { background: rgba(139, 92, 246, 0.2); color: #ddd6fe; border-color: rgba(139, 92, 246, 0.45); }
.pill-ws  { background: rgba(20, 184, 166, 0.2); color: #99f6e4; border-color: rgba(20, 184, 166, 0.45); }


/* ============================================================================
   PHASE 2 — Unity-Style Visual Game Editor & Interactive 2D Flame Board
   ============================================================================ */
.full-w { width: 100%; }
.ed-lbl { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; margin: 4px 0 3px; }
.ed-ta { width: 100%; resize: vertical; font-family: var(--font); line-height: 1.5; }
.ed-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: end; }
.ed-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; align-items: end; }
.ed-4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; align-items: end; }
.ed-checks { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }

.ed-toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 9px 12px; margin-bottom: 10px; }
.ed-status-ok { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); padding: 4px 10px; border-radius: 9px; font-size: 12px; font-weight: 700; }
.ed-status-err { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.45); padding: 4px 10px; border-radius: 9px; font-size: 12px; font-weight: 700; }
.ed-tpl-warn { background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.45); color: #fde68a; border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }

.ed-shell { display: grid; grid-template-columns: 315px minmax(0, 1fr) 295px; gap: 12px; align-items: start; }
@media (max-width: 1240px) { .ed-shell { grid-template-columns: 280px minmax(0, 1fr); } .ed-inspector { grid-column: 1 / -1; } }
@media (max-width: 900px) { .ed-shell { grid-template-columns: 1fr; } }

.ed-left, .ed-inspector { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 10px; max-height: 78vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ed-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #0f172a; padding: 4px; border-radius: 10px; }
.ed-tabs button { border: 0; background: transparent; color: var(--muted); font-family: var(--font); font-size: 11.5px; font-weight: 800; padding: 6px 4px; border-radius: 7px; cursor: pointer; }
.ed-tabs button.on { background: #1e293b; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.ed-left-body { display: flex; flex-direction: column; gap: 8px; }
.ed-sec, .ed-insp-sec { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 9px; }
.ed-sec h4, .ed-insp-sec h4 { margin: 0 0 7px; font-size: 12px; color: #7dd3fc; }
.ed-insp-empty { text-align: center; padding: 26px 12px; }

.ed-pal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.ed-pal-item { display: flex; align-items: center; gap: 5px; padding: 6px 7px; background: #0f172a; border: 1px solid var(--border); border-radius: 9px; font-size: 11.5px; font-weight: 700; cursor: grab; transition: 0.12s; }
.ed-pal-item:hover { border-color: var(--primary); background: #172554; transform: translateY(-1px); }
.ed-pal-item:active { cursor: grabbing; }
.ed-pal-ic { font-size: 14px; }

.ed-clip-list { display: flex; flex-direction: column; gap: 5px; }
.ed-pal-clip { display: flex; align-items: center; justify-content: space-between; padding: 6px 9px; background: linear-gradient(135deg, rgba(139,92,246,0.22), rgba(14,165,233,0.16)); border: 1px solid rgba(139,92,246,0.5); border-radius: 9px; font-size: 12px; font-weight: 800; cursor: grab; }
.ed-pal-clip:hover { border-color: #c4b5fd; }

.ed-hier-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.ed-hier-item { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px; background: #0f172a; border: 1px solid transparent; border-radius: 8px; font-size: 12px; cursor: pointer; }
.ed-hier-item:hover { border-color: var(--border); }
.ed-hier-item.on { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.2); }
.ed-hier-t { font-family: ui-monospace, monospace; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }

.ed-rule-card { background: #0f172a; border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin-bottom: 7px; display: flex; flex-direction: column; gap: 4px; }
.ed-mchk-list { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; }
.ed-mchk { display: flex; align-items: center; gap: 6px; font-size: 11.5px; background: #0f172a; padding: 4px 7px; border-radius: 7px; cursor: pointer; }
.ed-mchk code { margin-inline-start: auto; color: var(--muted); font-size: 10px; }
.ed-graph-svg { width: 100%; background: #020617; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 8px; display: block; }

/* Center Canvas */
.ed-center { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ed-float-bar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; background: rgba(15, 23, 42, 0.96); border: 1px solid #475569; border-radius: 11px; padding: 5px 9px; font-size: 12px; }
.ed-fb-id { font-family: ui-monospace, monospace; font-size: 11px; color: #7dd3fc; margin-inline-end: 4px; }
.ed-fb-btn { border: 1px solid #334155; background: #1e293b; color: #fff; border-radius: 7px; padding: 3px 7px; cursor: pointer; font-family: var(--font); font-size: 11.5px; font-weight: 800; }
.ed-fb-btn:hover { border-color: #0ea5e9; }
.ed-fb-btn--purp { background: #6d28d9; border-color: #7c3aed; }
.ed-fb-btn--del { color: #fca5a5; }
.ed-fb-val { font-size: 11.5px; font-weight: 800; min-width: 24px; text-align: center; }
.ed-fb-sep { width: 1px; height: 18px; background: #334155; margin: 0 2px; }
.ed-fb-color { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px; border-radius: 6px; border: 1px solid #334155; cursor: pointer; }
.ed-fb-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.ed-vp-wrap { background: #020617; border: 1px solid var(--border); border-radius: 16px; padding: 16px; min-height: 580px; display: flex; justify-content: center; overflow: auto; }
.ed-board { position: relative; width: 100%; max-width: 1060px; min-height: 560px; background: #f8fafc; color: #0f172a; border-radius: 14px; padding: 14px; box-shadow: 0 20px 46px rgba(0,0,0,0.45); transition: max-width 0.2s; }
.ed-board--tablet { max-width: 740px; }
.ed-board--mobile { max-width: 400px; }
.ed-board--drop { outline: 4px dashed #8b5cf6; outline-offset: 4px; }

.ed-col-guides { position: absolute; inset: 14px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; pointer-events: none; z-index: 0; }
.ed-col-guide { background: rgba(148, 163, 184, 0.08); border: 1px dashed rgba(148, 163, 184, 0.25); border-radius: 6px; text-align: center; }
.ed-col-guide span { font-size: 9.5px; color: #94a3b8; font-weight: 700; }

.ed-grid { position: relative; z-index: 1; grid-auto-rows: minmax(52px, auto); }
.ed-el { cursor: move; transition: outline-color 0.12s; border-radius: 10px; }
.ed-el:hover { outline: 2px dashed rgba(139, 92, 246, 0.55); outline-offset: 2px; }
.ed-el--sel { outline: 2.5px solid #7c3aed !important; outline-offset: 3px; box-shadow: 0 0 0 5px rgba(124, 58, 237, 0.16); }
.ed-el--locked { cursor: not-allowed; }
.ed-el-inner { width: 100%; height: 100%; }
.ed-inline-editing { outline: 2px solid #0f766e !important; background: #fff !important; border-radius: 6px; padding: 4px; cursor: text !important; }
.ed-coord-pill { position: absolute; top: -24px; right: 2px; z-index: 30; background: #0f172a; color: #fff; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 99px; white-space: nowrap; pointer-events: none; }

/* Generous 28px Hit-Area Resize Handles (solves sticky handles from Batch 24!) */
.ed-rh { position: absolute; z-index: 35; display: flex; align-items: center; justify-content: center; }
.ed-rh-dot { background: #fff; border: 2.5px solid #7c3aed; border-radius: 99px; box-shadow: 0 2px 6px rgba(0,0,0,0.35); transition: transform 0.12s; }
.ed-rh:hover .ed-rh-dot { transform: scale(1.25); background: #7c3aed; }
.ed-rh--end { top: 50%; left: -14px; transform: translateY(-50%); width: 28px; height: 38px; cursor: ew-resize; }
.ed-rh--end .ed-rh-dot { width: 8px; height: 24px; }
.ed-rh--bottom { bottom: -14px; left: 50%; transform: translateX(-50%); width: 38px; height: 28px; cursor: ns-resize; }
.ed-rh--bottom .ed-rh-dot { width: 24px; height: 8px; }
.ed-rh--corner { bottom: -15px; left: -15px; width: 30px; height: 30px; cursor: nesw-resize; }
.ed-rh--corner .ed-rh-dot { width: 14px; height: 14px; }

/* Badge tones & Interactive 2D Flame Card Board + Map */
.gs-badge--info { background: #e0f2fe; color: #075985; border-color: #0284c7; }
.gs-badge--success { background: #dcfce7; color: #166534; border-color: #16a34a; }
.gs-badge--danger { background: #fee2e2; color: #991b1b; border-color: #dc2626; }
.gs-map-nodes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gs-map-node { background: #f1f5f9; border: 1px solid #cbd5e1; padding: 4px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; color: #1e293b; }

.gs-flame-board { background: #0f172a; color: #f8fafc; border-radius: 14px; padding: 12px; height: 100%; display: flex; flex-direction: column; gap: 10px; }
.gs-flame-head { font-size: 13px; font-weight: 800; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gs-flame-head span { font-size: 11.5px; font-weight: 500; color: #94a3b8; }
.gs-flame-body { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; flex: 1; align-items: stretch; }
.gs-flame-drop { border: 2px dashed #38bdf8; background: rgba(14,165,233,0.12); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 800; font-size: 13.5px; color: #7dd3fc; min-height: 120px; transition: 0.15s; }
.gs-flame-drop.over { background: rgba(20,184,166,0.28); border-color: #2dd4bf; transform: scale(1.02); }
.gs-flame-drop small { font-size: 11px; opacity: 0.85; }
.gs-flame-cards { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.gs-flame-card { background: #1e293b; color: #fff; border: 1px solid #334155; border-inline-start: 5px solid #0ea5e9; border-radius: 10px; padding: 9px 11px; font-size: 12.5px; font-weight: 800; cursor: grab; transition: 0.14s; }
.gs-flame-card:hover { background: #334155; transform: translateX(-3px); }


/* ============================================================================
   PHASE 4 — Multi-Category Template Studio & Rich Visual Cards
   ============================================================================ */
.tpl-hero { background: linear-gradient(135deg, #1e1b4b 0%, #0f766e 60%, #0284c7 100%); border: 1px solid rgba(125,211,252,0.28); border-radius: 20px; padding: 20px 22px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; box-shadow: 0 18px 42px rgba(2,6,23,0.45); }
.tpl-hero-txt { max-width: 720px; }
.tpl-hero-txt h1 { margin: 8px 0 6px; font-size: 21px; font-weight: 900; color: #fff; line-height: 1.45; }
.tpl-hero-txt p { margin: 0; font-size: 13px; color: rgba(248,250,252,0.9); line-height: 1.75; }
.tpl-steps { display: flex; flex-direction: column; gap: 7px; min-width: 240px; }
.tpl-step { background: rgba(15,23,42,0.45); border: 1px solid rgba(255,255,255,0.18); border-radius: 11px; padding: 7px 12px; font-size: 12.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.tpl-step span { width: 22px; height: 22px; border-radius: 50%; background: #38bdf8; color: #0f172a; display: grid; place-items: center; font-size: 11.5px; font-weight: 900; flex-shrink: 0; }

.tpl-cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 8px; margin-bottom: 14px; }
.tpl-cat-pill { display: flex; align-items: center; gap: 9px; text-align: right; background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 9px 11px; border-radius: 13px; cursor: pointer; font-family: var(--font); transition: 0.15s; }
.tpl-cat-pill:hover { border-color: var(--cat-acc, #38bdf8); transform: translateY(-1px); }
.tpl-cat-pill.on { background: var(--cat-grad, linear-gradient(135deg, #0284c7, #0f766e)); border-color: transparent; box-shadow: 0 10px 24px rgba(2,132,199,0.28); }
.tpl-cat-ic { font-size: 21px; line-height: 1; }
.tpl-cat-pill b { display: block; font-size: 12px; font-weight: 800; }
.tpl-cat-pill small { display: block; font-size: 10.5px; opacity: 0.8; margin-top: 1px; }

.tpl-cat-banner { border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 12px; color: #fff; box-shadow: 0 10px 26px rgba(0,0,0,0.25); }
.tpl-cat-banner b { display: block; font-size: 14.5px; font-weight: 900; margin-bottom: 2px; }
.tpl-cat-banner div { font-size: 12.5px; opacity: 0.94; }

.tpl-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.tpl-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
.tpl-card:hover { transform: translateY(-3px); border-color: #38bdf8; box-shadow: 0 18px 38px rgba(2,6,23,0.45); }
.tpl-card-cover { padding: 14px 16px 12px; color: #fff; display: flex; flex-direction: column; gap: 9px; position: relative; }
.tpl-cover-cat { background: rgba(15,23,42,0.38); padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; backdrop-filter: blur(4px); }
.tpl-cover-meta { font-size: 11px; opacity: 0.9; font-weight: 700; }
.tpl-cover-title { font-size: 16px; font-weight: 900; line-height: 1.45; }
.tpl-cover-mini { background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.22); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.tpl-mini-bar { height: 7px; width: 62%; border-radius: 99px; background: rgba(255,255,255,0.65); }
.tpl-mini-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tpl-mini-row span { height: 22px; border-radius: 6px; background: rgba(255,255,255,0.22); }

.tpl-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tpl-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tpl-tag { background: rgba(14,165,233,0.12); color: #bae6fd; border: 1px solid rgba(14,165,233,0.28); padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }


/* ============================================================================
   EDITOR LAB v2 — 8-Studio Home Hub + Dedicated Per-Section Studio + Presets
   ============================================================================ */
.hub-hero { background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 45%, #0f766e 100%); border: 1px solid rgba(125,211,252,0.28); border-radius: 22px; padding: 24px 26px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; box-shadow: 0 22px 48px rgba(2,6,23,0.5); }
.hub-hero-main { max-width: 720px; }
.hub-hero-main h1 { margin: 4px 0 8px; font-size: 24px; font-weight: 900; color: #fff; }
.hub-hero-main p { margin: 0; font-size: 13.5px; color: rgba(248,250,252,0.9); line-height: 1.8; }
.hub-stats { display: grid; grid-template-columns: repeat(2, minmax(125px, 1fr)); gap: 10px; }
.hub-stat { background: rgba(15,23,42,0.52); border: 1px solid rgba(255,255,255,0.16); border-radius: 14px; padding: 11px 14px; text-align: center; transition: 0.15s; }
.hub-stat:hover { border-color: #38bdf8; }
.hub-stat b { display: block; font-size: 22px; font-weight: 900; color: #fff; }
.hub-stat span { display: block; font-size: 11px; color: #cbd5e1; margin-top: 2px; }

.hub-sec-title { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.hub-sec-title h2 { margin: 0; font-size: 18px; font-weight: 900; }

.hub-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1220px) { .hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .hub-grid { grid-template-columns: 1fr; } }

.hub-card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.hub-card:hover { transform: translateY(-5px); border-color: var(--hc-acc, #38bdf8); box-shadow: 0 22px 44px rgba(2,6,23,0.55); }
.hub-card-top { padding: 16px 16px 14px; display: flex; align-items: center; justify-content: space-between; color: #fff; }
.hub-card-ic { width: 48px; height: 48px; border-radius: 14px; background: rgba(15,23,42,0.32); border: 1px solid rgba(255,255,255,0.28); display: grid; place-items: center; font-size: 26px; backdrop-filter: blur(4px); }
.hub-card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hub-b { background: rgba(255,255,255,0.22); color: #fff; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; }
.hub-b--dark { background: rgba(15,23,42,0.45); }

.hub-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.hub-card-body h3 { margin: 0; font-size: 15.5px; font-weight: 900; color: #fff; }
.hub-en { font-size: 11px; color: #7dd3fc; font-weight: 700; letter-spacing: 0.3px; }
.hub-card-body p { margin: 2px 0 4px; font-size: 12px; }
.hub-caps { list-style: none; margin: 2px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: #cbd5e1; }
.hub-enter-btn { margin-top: auto; width: 100%; justify-content: center; padding: 9px 12px; border-radius: 11px; font-size: 12.5px; font-weight: 900; color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,0.25); }

/* Dedicated Section Studio View */
.sec-switcher-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 8px 10px; }
.sec-sw-pills { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.sec-sw-btn { border: 1px solid var(--border); background: #0f172a; color: #cbd5e1; padding: 5px 10px; border-radius: 99px; font-family: var(--font); font-size: 11.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: 0.14s; }
.sec-sw-btn:hover { border-color: #38bdf8; color: #fff; }
.sec-sw-btn.on { background: var(--sw-grad); border-color: transparent; color: #fff; font-weight: 900; }

.sec-banner { border-radius: 20px; padding: 20px 22px; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; box-shadow: 0 18px 38px rgba(2,6,23,0.4); }
.sec-banner-info { display: flex; align-items: center; gap: 16px; max-width: 760px; }
.sec-banner-ic { width: 64px; height: 64px; border-radius: 18px; background: rgba(15,23,42,0.34); border: 1px solid rgba(255,255,255,0.28); display: grid; place-items: center; font-size: 34px; flex-shrink: 0; }
.sec-banner-info h1 { margin: 5px 0 4px; font-size: 21px; font-weight: 900; }
.sec-banner-info p { margin: 0; font-size: 13px; opacity: 0.94; line-height: 1.7; }
.sec-banner-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sec-create-btn { background: #fff; color: #0f172a; border: 0; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 900; box-shadow: 0 10px 26px rgba(0,0,0,0.25); }
.sec-create-btn:hover { transform: scale(1.02); background: #f8fafc; }
.sec-cta-sub { font-size: 11px; opacity: 0.88; }

.sec-caps-strip { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 9px 13px; margin-bottom: 16px; font-size: 12px; }
.sec-block-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sec-block-head h2 { margin: 0; font-size: 16.5px; font-weight: 900; }

/* Category-Customized Editor Accents & Quick Presets */
.ed-cat-bar { border-radius: 13px; padding: 8px 14px; margin-bottom: 10px; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.ed-sec--presets { background: linear-gradient(160deg, rgba(124,58,237,0.16), rgba(14,165,233,0.12)); border-color: rgba(139,92,246,0.45); }
.ed-preset-list { display: flex; flex-direction: column; gap: 5px; }
.ed-preset-btn { width: 100%; text-align: right; background: rgba(15,23,42,0.82); color: #f8fafc; border: 1px solid rgba(139,92,246,0.45); border-radius: 9px; padding: 7px 9px; font-family: var(--font); font-size: 11.5px; font-weight: 800; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: 0.13s; }
.ed-preset-btn:hover { background: #4c1d95; border-color: #c4b5fd; transform: translateX(-2px); }
.ed-pal-item--pri { border-color: rgba(56,189,248,0.55); background: rgba(14,165,233,0.12); }
