/* ================= نقشه‌های کامیونیتی و ادیتور ================= */

/* ---------- عمومی ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.back-link:hover { color: var(--teal-d); }
.avatar.xs { width: 22px; height: 22px; font-size: 13px; }
.linkish { font-size: var(--fs-xs); }
.btn.disabled { opacity: 0.45; pointer-events: none; }
.error { color: var(--pom); font-weight: 600; }

/* ستاره‌ها: هر ستاره با گرادیان پر می‌شود تا نیم‌ستاره هم دیده شود */
.stars { display: inline-flex; gap: 1px; line-height: 1; direction: ltr; }
.stars .star { font-size: 14px; border: 0; padding: 0; background: linear-gradient(90deg, var(--saffron) var(--f), color-mix(in oklch, var(--ink-3), transparent 55%) var(--f)); -webkit-background-clip: text; background-clip: text; color: transparent; font-family: system-ui, sans-serif; }
.stars.lg .star { font-size: 28px; }
.stars.pick .star { cursor: pointer; transition: transform 140ms var(--ease); }
.stars.pick .star:hover { transform: scale(1.18); }
.stars.pick .star:focus-visible { outline-offset: 0; }

/* ---------- دیالوگ ---------- */
.dlg-veil { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; padding: var(--sp-4); background: oklch(0.1 0.02 250 / 0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: dlgIn 200ms var(--ease); }
.dlg-veil.out { opacity: 0; transition: opacity 180ms; }
@keyframes dlgIn { from { opacity: 0; } }
.dlg { width: min(640px, 100%); max-height: min(86dvh, 760px); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: var(--sp-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--sh-lg); animation: dlgUp 320ms var(--ease); }
.dlg.small { width: min(420px, 100%); grid-template-rows: auto auto; gap: var(--sp-5); }
.dlg.small p { font-weight: 600; font-size: var(--fs-md); }
@keyframes dlgUp { from { transform: translateY(16px) scale(0.98); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-tools { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.dlg-tools .input { flex: 1; min-width: 180px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.cm-pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-2); overflow-y: auto; padding: 2px; }
.cm-pick { display: grid; grid-template-columns: 96px 1fr; gap: var(--sp-3); align-items: center; text-align: start; padding: var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); cursor: pointer; transition: border-color 160ms, transform 160ms var(--ease); }
.cm-pick:hover { border-color: var(--teal); transform: translateY(-1px); }
.cm-pick .map-mini { width: 96px; height: 72px; }
.cm-pick span { display: grid; gap: 2px; min-width: 0; }
.cm-pick small { color: var(--ink-3); font-size: var(--fs-xs); }

/* انتخابگر نقشه: گزینه‌ی کامیونیتی */
.map-opt.community { border-color: var(--saffron); }
.map-opt.more { border-style: dashed; color: var(--teal-d); }
.map-opt.more .icon { width: 28px; height: 28px; }
.empty-thumb { display: grid; place-items: center; color: var(--ink-3); background: var(--paper-2); border-radius: var(--r-sm); aspect-ratio: 4 / 3; }

/* ---------- صفحه‌ی فهرست ---------- */
.maps-page { display: grid; gap: var(--sp-5); }
.maps-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: var(--sp-5); align-items: center; padding: clamp(var(--sp-5), 4vw, var(--sp-7)); border-radius: var(--r-lg);
  background: radial-gradient(120% 140% at 0% 0%, oklch(0.5 0.09 200), oklch(0.32 0.06 220)); color: var(--on-accent); box-shadow: 0 2px 0 var(--teal-dd), var(--sh-md); }
.maps-hero::before { content: ''; position: absolute; inset: 0; opacity: 0.12; pointer-events: none;
  background: conic-gradient(from 22.5deg, var(--on-accent) 0 12.5%, transparent 0 25%, var(--on-accent) 0 37.5%, transparent 0 50%, var(--on-accent) 0 62.5%, transparent 0 75%, var(--on-accent) 0 87.5%, transparent 0) 0 0 / 40px 40px;
  mask-image: linear-gradient(to left, black, transparent 70%); }
.mh-copy { position: relative; display: grid; gap: var(--sp-3); max-width: 52ch; }
.mh-copy .eyebrow { color: var(--saffron); }
.mh-copy h1 { font-size: var(--fs-2xl); font-weight: 900; }
.mh-copy p { color: color-mix(in oklch, var(--on-accent), transparent 18%); }
.mh-actions { margin-top: var(--sp-2); }
.mh-art { position: relative; width: 220px; height: 170px; perspective: 700px; }
.mh-art i { position: absolute; width: 58px; height: 74px; border-radius: 8px; background: linear-gradient(var(--c) 0 26%, oklch(0.97 0.012 88) 26%); box-shadow: 0 18px 26px -14px oklch(0.1 0.03 240 / 0.7);
  left: calc(20px + var(--x) * 64px); top: calc(8px + var(--y) * 82px);
  transform: rotateX(38deg) rotateZ(-24deg); animation: mhFloat 4.5s var(--ease) infinite alternate; animation-delay: calc(var(--i) * -0.7s); }
@keyframes mhFloat { to { translate: 0 -10px; } }
@media (max-width: 760px) { .maps-hero { grid-template-columns: 1fr; } .mh-art { display: none; } }

.maps-toolbar { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.maps-toolbar .search-box { flex: 1; min-width: 220px; margin: 0; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--sp-4); }
.map-grid > .empty { grid-column: 1 / -1; }
.map-card { display: grid; grid-template-rows: auto 1fr; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--ink); overflow: hidden;
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color 220ms; }
.map-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--line-2); }
.mc-thumb { --mc-bg: var(--felt); position: relative; padding: var(--sp-4); background: radial-gradient(ellipse at 50% 40%, color-mix(in oklch, var(--mc-bg), white 8%), color-mix(in oklch, var(--mc-bg), black 22%)); display: grid; place-items: center; aspect-ratio: 16 / 10; }
.mc-thumb .map-mini { width: 100%; height: 100%; filter: drop-shadow(0 8px 10px oklch(0.05 0.02 250 / 0.35)); }
.mc-thumb .chip { position: absolute; top: 10px; inset-inline-start: 10px; box-shadow: var(--sh-sm); }
.mc-body { display: grid; gap: 6px; padding: var(--sp-3) var(--sp-4) var(--sp-4); align-content: start; }
.mc-name { font-size: var(--fs-md); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-author { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.mc-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: 2px; }
.mc-rate { display: inline-flex; align-items: center; gap: 4px; }
.mc-rate b { font-size: var(--fs-sm); }
.mc-rate small { color: var(--ink-3); font-size: var(--fs-xs); }

.my-maps { display: grid; gap: var(--sp-3); }
.my-maps h2 { font-size: var(--fs-lg); }
.my-maps-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 210px; gap: var(--sp-3); overflow-x: auto; padding-bottom: var(--sp-2); scroll-snap-type: x mandatory; }
.my-maps-strip .map-card { scroll-snap-align: start; }
.my-maps-strip .mc-thumb { aspect-ratio: 16 / 11; padding: var(--sp-3); }
.map-card.new { display: grid; place-content: center; justify-items: center; gap: var(--sp-2); border-style: dashed; color: var(--teal-d); background: var(--paper-2); min-height: 180px; }
.map-card.new .icon { width: 32px; height: 32px; }

/* ---------- صفحه‌ی یک نقشه ---------- */
.map-detail { display: grid; gap: var(--sp-3); }
.md-head { display: flex; justify-content: space-between; align-items: end; gap: var(--sp-4); flex-wrap: wrap; }
.md-head h1 { font-size: var(--fs-2xl); font-weight: 900; margin: 6px 0; }
.md-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.md-author { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.md-desc { color: var(--ink-2); max-width: 70ch; white-space: pre-line; }
.md-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-5); align-items: start; margin-top: var(--sp-3); }
.md-main { display: grid; gap: var(--sp-4); min-width: 0; }
.md-sub { font-size: var(--fs-lg); margin-top: var(--sp-3); }
.md-side { display: grid; gap: var(--sp-3); position: sticky; top: 88px; }
.md-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); display: grid; gap: var(--sp-2); }
.md-card h3 { font-size: var(--fs-md); }
.md-owner { display: grid; gap: var(--sp-2); }
.md-rate-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.md-rate-num { display: grid; line-height: 1.1; }
.md-rate-num b { font-size: 2.6rem; font-weight: 900; }
.md-rate-num small { color: var(--ink-3); }
.md-dist { display: grid; gap: 4px; }
.md-dist-row { display: grid; grid-template-columns: 14px 1fr 28px; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--ink-3); }
.md-dist-row i { height: 7px; border-radius: 99px; background: linear-gradient(90deg, var(--saffron) var(--w), var(--paper-2) var(--w)); direction: ltr; }
.md-mine { display: grid; gap: 6px; justify-items: center; padding-top: var(--sp-3); margin-top: var(--sp-2); border-top: 1px dashed var(--line); font-size: var(--fs-sm); font-weight: 600; }
.md-plays { font-size: var(--fs-sm); text-align: center; }
.md-facts { display: grid; grid-template-columns: 1fr auto; gap: 6px var(--sp-3); margin: 0; font-size: var(--fs-sm); }
.md-facts dt { color: var(--ink-3); }
.md-facts dd { margin: 0; font-weight: 800; }
.md-legend > div { display: flex; flex-wrap: wrap; gap: 6px; }
.md-groups { display: grid; gap: var(--sp-2); }
.md-group { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.md-group summary { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; }
.md-group summary::-webkit-details-marker { display: none; }
.md-group .sw { width: 18px; height: 18px; border-radius: 5px; background: var(--gc); box-shadow: inset 0 -2px 0 oklch(0 0 0 / 0.2); }
.md-group small { margin-inline-start: auto; }
.md-group table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.md-group th, .md-group td { padding: 8px var(--sp-4); text-align: start; border-top: 1px solid var(--line); }
.md-group th { color: var(--ink-3); font-weight: 600; font-size: var(--fs-xs); }
@media (max-width: 1000px) { .md-grid { grid-template-columns: 1fr; } .md-side { position: static; } }

/* تخته‌ی پیش‌نمایش */
.map-stage { position: relative; height: clamp(360px, 62vh, 620px); border-radius: var(--r-lg); overflow: hidden; isolation: isolate;
  background: radial-gradient(ellipse 60% 55% at 50% 42%, var(--lamp), transparent 75%), radial-gradient(ellipse 120% 90% at 50% 40%, var(--felt), var(--felt-2));
  box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.05), var(--sh-md); display: grid; }
.map-stage > .stage { grid-area: 1 / 1; }
.ms-tools { position: absolute; bottom: var(--sp-3); inset-inline: var(--sp-3); display: flex; gap: var(--sp-2); align-items: center; justify-content: center; z-index: 5; pointer-events: none; }
.ms-tools > * { pointer-events: auto; }
.ms-tools .icon-btn { background: color-mix(in oklch, var(--surface), transparent 12%); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--sh-sm); color: var(--ink); }

/* لوگوی نقشه‌های کامیونیتی */
.logo.custom { gap: 0.1em; }
.logo.custom .logo-emoji { font-style: normal; font-size: calc(var(--u) * 0.7); line-height: 1.1; }
.deco-logo .logo.custom span { font-size: calc(var(--u) * 0.46); max-width: calc(var(--u) * 7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(180deg, color-mix(in oklch, var(--inlay, oklch(0.6 0.2 25)), white 8%), color-mix(in oklch, var(--inlay, oklch(0.5 0.19 25)), black 12%)); }
.game.map-custom .logo.custom span { color: oklch(0.99 0.01 90); text-shadow: 0 1px 0 oklch(0 0 0 / 0.25); }

/* ---------- ساخت نقشه‌ی جدید ---------- */
.new-map { display: grid; gap: var(--sp-3); }
.nm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-3); }
.nm-opt { display: grid; gap: 4px; justify-items: center; text-align: center; padding: var(--sp-4) var(--sp-3); border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink);
  transition: transform 200ms var(--ease), border-color 200ms, box-shadow 200ms; }
.nm-opt:hover { transform: translateY(-3px); border-color: var(--teal); box-shadow: var(--sh-md); }
.nm-opt small { color: var(--ink-3); font-size: var(--fs-xs); }
.nm-art { width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; margin-bottom: var(--sp-2); }
.nm-art .map-mini { width: 100%; height: 100%; }
.nm-blank { width: 100%; height: 100%; display: grid; place-items: center; border: 2px dashed var(--line-2); border-radius: var(--r-md); color: var(--teal-d);
  background: repeating-linear-gradient(0deg, transparent 0 17px, var(--line) 17px 18px), repeating-linear-gradient(90deg, transparent 0 17px, var(--line) 17px 18px); }
.nm-blank .icon { width: 36px; height: 36px; background: var(--surface); border-radius: 50%; padding: 6px; }

/* ================= ادیتور ================= */
.ed { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--paper); overflow: hidden; }
.ed > .empty { align-self: center; }
.ed-top { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); background: var(--surface); border-bottom: 1px solid var(--line); min-height: 60px; position: relative; z-index: 6; }
.ed-title { display: grid; min-width: 0; flex: 1; }
.ed-name { border: 0; background: transparent; font-weight: 800; font-size: var(--fs-lg); padding: 2px 6px; border-radius: 8px; min-width: 0; outline: none; }
.ed-name:hover { background: var(--paper-2); }
.ed-name:focus { background: var(--paper-2); box-shadow: 0 0 0 2px var(--teal); }
.ed-save { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--ink-3); padding: 0 6px; }
.ed-save .icon { width: 14px; height: 14px; color: var(--ok); }
.ed-save .dot, .ed-issues-btn .dot, .ei-errors .dot, .ed-issues .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--saffron); display: inline-block; flex: none; }
.ed-save.saving .dot { animation: pulse 0.8s infinite alternate; }
.ed-save.error { color: var(--pom); } .ed-save.error .dot { background: var(--pom); }
.ed-hist { display: flex; }
.ed-hist .icon-btn:disabled { opacity: 0.3; cursor: default; background: none; }
.ed-pub { display: flex; align-items: center; gap: var(--sp-2); position: relative; }
.ed-issues-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--paper-2); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; }
.ed-issues-btn.bad { color: var(--pom); background: var(--pom-l); border-color: color-mix(in oklch, var(--pom), transparent 60%); }
.ed-issues-btn.bad .dot { background: var(--pom); }
.ed-issues-btn.ok { color: var(--ok-ink); background: var(--ok-l); border-color: transparent; }
.ed-issues-btn .icon { width: 16px; height: 16px; }
.ed-issues { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: min(380px, 92vw); max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-lg); padding: var(--sp-3); display: grid; gap: var(--sp-2); animation: dlgUp 220ms var(--ease); }
.ei-head { display: flex; align-items: center; gap: var(--sp-2); justify-content: space-between; }
.ed-issues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ed-issues li button { width: 100%; display: flex; align-items: center; gap: 8px; text-align: start; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: var(--fs-sm); }
.ed-issues li button:hover { background: var(--paper-2); }
.ed-issues li .dot { background: var(--pom); }
.ed-issues li small { color: var(--ink-3); margin-inline-start: auto; white-space: nowrap; }

.ed-body { display: grid; grid-template-columns: 320px minmax(0, 1fr) 330px; min-height: 0; }
.ed-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--surface); border-inline-end: 1px solid var(--line); min-height: 0; }
.ed-tabs { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid var(--line); }
.ed-tabs button { display: grid; justify-items: center; gap: 2px; padding: 10px 2px 8px; border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 11px; font-weight: 700; border-bottom: 2px solid transparent; transition: color 160ms, border-color 160ms; }
.ed-tabs button .icon { width: 20px; height: 20px; }
.ed-tabs button[aria-selected='true'] { color: var(--teal-d); border-bottom-color: var(--teal); }
.ed-panel-body { overflow-y: auto; padding: var(--sp-3) var(--sp-4) var(--sp-6); display: grid; gap: var(--sp-4); align-content: start; }
.ed-sec { display: grid; gap: var(--sp-2); }
.ed-sec + .ed-sec { padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.ed-sec h4 { margin: 0; font-size: var(--fs-sm); font-weight: 800; color: var(--ink-2); }
.ed-tip { font-size: var(--fs-xs); line-height: 1.7; }
.ed-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: 600; }
.ed-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.ed-field { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
.ed-field > span { color: var(--ink-2); font-size: var(--fs-xs); }
.ed-field small { font-weight: 400; font-size: var(--fs-xs); }
.ed-field .input, .ed-panel .input, .ed-insp .input { min-height: 38px; padding: 6px 10px; font-size: var(--fs-sm); border-radius: 10px; }
.ed-field textarea.input { resize: vertical; line-height: 1.7; }
.seg.block { display: flex; width: 100%; } .seg.block button { flex: 1; min-height: 36px; font-size: var(--fs-sm); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--paper-2); border-radius: var(--r-pill); padding: 2px; }
.stepper b { min-width: 28px; text-align: center; }
.stepper .icon-btn { width: 30px; height: 30px; font-weight: 900; font-size: 1.1rem; background: var(--surface); }
.ed-nudge { display: flex; gap: 2px; }
.ed-nudge .icon-btn { width: 32px; height: 32px; background: var(--paper-2); border-radius: 8px; font-weight: 900; }
.ed-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-preset { display: grid; gap: 2px; justify-items: center; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; font-size: 10px; color: var(--ink-2); }
.ed-preset:hover { border-color: var(--teal); color: var(--ink); }
.ed-preset .map-mini { width: 100%; aspect-ratio: 1; height: auto; }
.ed-btns { display: grid; gap: 6px; }
.ed-btns .btn { justify-content: flex-start; }
.ed-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-tile-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.ed-tile-list button { width: 100%; display: grid; grid-template-columns: 26px 22px 1fr auto; align-items: center; gap: 8px; padding: 5px 6px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: start; font-size: var(--fs-sm); }
.ed-tile-list button:hover { background: var(--paper-2); }
.ed-tile-list button.on { background: var(--teal-l); }
.ed-tile-list button.bad .idx { color: var(--pom); font-weight: 900; }
.ed-tile-list .idx { color: var(--ink-3); font-size: var(--fs-xs); text-align: center; }
.ed-tile-list .sw { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-size: 13px; }
.ed-tile-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-tile-list small { color: var(--ink-3); }
.ed-groups { display: grid; gap: 6px; }
.ed-group { display: grid; grid-template-columns: 34px 1fr 92px auto 32px; align-items: center; gap: 6px; }
.ed-group.bad .input { border-color: var(--pom); }
.ed-group .icon-btn { width: 32px; height: 32px; }
.ed-group .icon-btn:disabled { opacity: 0.3; }
.ed-house { display: flex; align-items: center; gap: 2px; font-size: 13px; }
.ed-house .input { padding-inline: 6px; }
.swatch-in { position: relative; width: 34px; height: 34px; border-radius: 10px; background: var(--c); box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.15), inset 0 -3px 0 oklch(0 0 0 / 0.15); cursor: pointer; overflow: hidden; flex: none; }
.swatch-in.unset { background: repeating-conic-gradient(var(--paper-3) 0 25%, var(--surface) 0 50%) 0 0 / 10px 10px; }
.swatch-in input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.ed-range { width: 100%; accent-color: var(--teal); }
.ed-skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.ed-skin { display: grid; gap: 4px; justify-items: center; padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; font-size: 11px; color: var(--ink-2); }
.ed-skin.on { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); color: var(--ink); }
.sk-sw { display: grid; grid-template-columns: repeat(2, 18px); grid-template-rows: repeat(2, 18px); border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px oklch(0 0 0 / 0.1); }
.sk-sw i.auto { grid-column: 1 / -1; grid-row: 1 / -1; background: conic-gradient(var(--felt) 0 25%, var(--tile) 0 50%, var(--board-line) 0 75%, var(--saffron) 0); }
.ed-colors { display: grid; gap: 6px; }
.ed-color { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }

/* بوم */
.ed-stage { position: relative; min-width: 0; min-height: 0; display: grid;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in oklch, var(--paper-2), var(--paper) 40%), var(--paper-3)); }
.ed-canvas { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; padding: var(--sp-4); gap: var(--sp-2); }
.ed-canvas .map-stage { height: 100%; border-radius: var(--r-lg); }
.ed-canvas > .empty { align-self: center; }
.ed-canvas-status { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.ed-canvas-status small { font-size: var(--fs-xs); }
.ed-grid { width: 100%; height: 100%; direction: ltr; touch-action: none; user-select: none; overflow: visible; }
.ed-grid .g-cell { fill: color-mix(in oklch, var(--paper), var(--ink) 4%); stroke: color-mix(in oklch, var(--line), transparent 30%); stroke-width: 0.015; }
.ed-grid.tool-draw .g-cell:hover { fill: color-mix(in oklch, var(--teal), transparent 82%); }
.ed-grid .g-in rect { fill: var(--board-in); opacity: 0.9; }
.ed-grid .g-path { fill: none; stroke: var(--saffron); stroke-width: 0.08; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 0.16 0.12; opacity: 0.85; }
.ed-grid .g-path.closed { stroke: var(--teal); stroke-dasharray: none; opacity: 0.5; }
.ed-grid .g-next { fill: var(--saffron); animation: gNext 1s ease-in-out infinite alternate; pointer-events: none; }
@keyframes gNext { to { r: 0.16; opacity: 0.5; } }
.ed-grid .g-tile { cursor: pointer; }
.ed-grid .g-t { fill: var(--tile); stroke: color-mix(in oklch, var(--board-line), var(--ink) 20%); stroke-width: 0.02; filter: drop-shadow(0 0.02px 0.03px oklch(0 0 0 / 0.3)); }
.ed-grid .t-go .g-t { fill: color-mix(in oklch, var(--saffron) 35%, var(--tile)); }
.ed-grid .t-gotojail .g-t { fill: color-mix(in oklch, var(--pom) 28%, var(--tile)); }
.ed-grid .t-parking .g-t { fill: color-mix(in oklch, var(--teal) 24%, var(--tile)); }
.ed-grid .t-jail .g-t { fill: color-mix(in oklch, var(--tile-ink) 14%, var(--tile)); }
.ed-grid .g-tile:hover .g-t { stroke: var(--teal); stroke-width: 0.04; }
.ed-grid .g-tile.sel .g-t { stroke: var(--saffron); stroke-width: 0.07; }
.ed-grid .g-tile.bad .g-t { stroke: var(--pom); stroke-width: 0.05; stroke-dasharray: 0.08 0.05; }
.ed-grid text { text-anchor: middle; dominant-baseline: middle; fill: var(--tile-ink); font-family: var(--font); pointer-events: none; }
.ed-grid .g-ic { font-size: 0.34px; }
.ed-grid .g-nm { font-size: 0.14px; font-weight: 700; direction: rtl; }
.ed-grid .g-pr { font-size: 0.13px; fill: var(--tile-ink-2); font-weight: 700; }
.ed-grid .g-idx { font-size: 0.1px; fill: var(--tile-ink-2); opacity: 0.8; text-anchor: start; }
.ed-grid .g-start { fill: var(--ok); stroke: var(--surface); stroke-width: 0.03; }
.ed-grid .g-arrows path { fill: none; stroke: var(--ink-2); stroke-width: 0.03; stroke-linecap: round; opacity: 0.55; pointer-events: none; }

/* بازرس */
.ed-insp { background: var(--surface); border-inline-start: 1px solid var(--line); overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.ed-insp > .ei-head { position: sticky; top: 0; background: var(--surface); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); z-index: 1; justify-content: flex-start; min-height: 52px; }
.ed-insp > .ei-head > div { flex: 1; text-align: center; }
.ed-insp > .ei-head > b { padding-inline: var(--sp-2); }
.ed-insp .icon-btn { width: 36px; height: 36px; }
.ei-body { padding: var(--sp-3) var(--sp-4) var(--sp-6); display: grid; gap: var(--sp-3); }
.ei-errors { display: grid; gap: 4px; margin: var(--sp-3) var(--sp-4) 0; padding: var(--sp-2) var(--sp-3); background: var(--pom-l); color: var(--pom); border-radius: 10px; font-size: var(--fs-xs); font-weight: 600; }
.ei-body .ei-errors { margin: 0; }
.ei-errors p { display: flex; gap: 6px; align-items: center; }
.ei-errors .dot { background: var(--pom); }
.ei-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ei-types button { display: grid; justify-items: center; gap: 1px; padding: 6px 2px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; }
.ei-types button i { font-style: normal; font-size: 18px; line-height: 1.2; }
.ei-types button small { font-size: 9.5px; color: var(--ink-3); white-space: nowrap; }
.ei-types button[aria-pressed='true'] { border-color: var(--teal); background: var(--teal-l); box-shadow: 0 0 0 1px var(--teal); }
.ei-types button[aria-pressed='true'] small { color: var(--ink); font-weight: 700; }
.ei-groups { display: flex; flex-wrap: wrap; gap: 5px; }
.ei-groups button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 6px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--paper); cursor: pointer; font-size: 11px; }
.ei-groups button i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 -2px 0 oklch(0 0 0 / 0.2); }
.ei-groups button.on { border-color: var(--c); box-shadow: 0 0 0 2px var(--c); font-weight: 800; }
.ei-rent { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ei-rent label { display: grid; gap: 2px; }
.ei-rent small { color: var(--ink-3); font-size: 10px; }
.ei-rent .input { padding-inline: 6px; }
.ei-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ei-stats > div { display: grid; justify-items: center; padding: 10px 4px; background: var(--paper-2); border-radius: 12px; }
.ei-stats b { font-size: var(--fs-lg); font-weight: 900; }
.ei-stats small { color: var(--ink-3); font-size: 11px; }
.ei-kbd { color: var(--ink-3); direction: ltr; text-align: center; }

@media (max-width: 1180px) { .ed-body { grid-template-columns: 290px minmax(0, 1fr) 290px; } }
@media (max-width: 920px) {
  .ed { height: auto; min-height: 100dvh; overflow: visible; }
  .ed-top { flex-wrap: wrap; position: sticky; top: 0; }
  .ed-title { order: -1; flex-basis: calc(100% - 60px); }
  .ed-view { order: 3; }
  .ed-pub { margin-inline-start: auto; }
  .ed-body { grid-template-columns: 1fr; }
  .ed-stage { order: -1; height: 62dvh; }
  .ed-panel, .ed-insp { border: 0; border-top: 1px solid var(--line); }
  .ed-panel-body { overflow: visible; }
}
