/* Guided map edits (static/js/mapedits.js): the "Improve this map" panel and the "Edited from" line on a map's card.
   App tokens only (app.css), so light and dark follow the site. A picked tile is blue with a tick; a tile this map
   can't take is grey. */

.me-slot:empty { display: none; }
.me-slot { margin-top: var(--s-3); display: grid; gap: var(--s-3); }

.me-panel { border: 2px solid var(--line); border-radius: var(--r); background: var(--surface-2); overflow: hidden; }
.me-panel.is-open { border-color: var(--blue); }
.me-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; background: transparent;
  color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; cursor: pointer; text-align: left; }
.me-head:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.me-head .me-icon { width: 22px; height: 22px; color: var(--blue); }
.me-title { flex: 1; }
.me-chev { transition: transform var(--t) var(--ease); }
.me-panel.is-open .me-chev { transform: rotate(180deg); }
.me-body { padding: 0 14px 14px; display: grid; gap: var(--s-3); }

.me-icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.me-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.me-grid[hidden] { display: none; }
@media (max-width: 560px) { .me-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.me-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 84px; padding: 10px 6px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-family: inherit; font-weight: 800; font-size: 0.86rem; line-height: 1.15; text-align: center;
  cursor: pointer; box-shadow: 0 3px 0 var(--drop); transition: border-color var(--t), background var(--t), color var(--t); }
.me-tile:hover:not([disabled]) { border-color: var(--blue); color: var(--ink); }
.me-tile:active:not([disabled]) { transform: translateY(2px); box-shadow: 0 1px 0 var(--drop); }
.me-tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.me-tile[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--ink); }
.me-tile[aria-pressed="true"] .me-icon { color: var(--blue); }
.me-tile[aria-pressed="true"]::after { content: ""; position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.me-tile[disabled] { cursor: not-allowed; opacity: 0.45; box-shadow: none; background: var(--surface-3); }

.me-link { border: 0; background: none; padding: 0; color: var(--blue); font-family: inherit; font-weight: 800; font-size: 0.88rem;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.me-link:hover { color: var(--blue-d); }
.me-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.me-more-btn { justify-self: start; }
.me-apply { margin-top: 2px; }
.me-rule { margin: 0; font-size: 0.86rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; }
.me-rule > span:first-child { color: var(--ink-2); font-weight: 700; }
.me-note { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink); font-size: 0.92rem; }
.me-note[hidden] { display: none; }

/* "Edited from <original>" and Before / After */
.me-lineage { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; font-size: 0.92rem; color: var(--ink-2); }
.me-from a { font-weight: 800; color: var(--blue); }
.me-ba { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-3); }
.me-ba button { border: 0; background: transparent; color: var(--ink-2); font-family: var(--font-display); font-weight: 600; padding: 5px 12px;
  border-radius: 10px; cursor: pointer; font-size: 0.9rem; }
.me-ba button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 0 var(--drop); }
.me-ba button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.me-before { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0c1228; z-index: 3; }
.gen-visual.me-showing::after { content: attr(data-me-label); position: absolute; left: 12px; bottom: 12px; z-index: 4; padding: 4px 10px;
  border-radius: 10px; background: rgba(12, 18, 40, 0.7); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }
/* the map's colours on the result (static/js/result.js: stats.palette, an OKLCH-even strip) */
.map-colours { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; }
.map-colours-strip { width: 132px; height: 14px; border-radius: 7px; border: 1px solid var(--line-2); flex: none; }
.map-colours .me-link { margin-left: 2px; }
