body.portal { line-height: 1.6; }
.ae-shell { max-width: 860px; margin: 0 auto; padding: 24px 16px 56px; }
.ae-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ae-h1-sub { display: block; margin-top: 4px; color: var(--muted); font-size: .55em; font-weight: 700; letter-spacing: 0; }
.ae-intro h1 { margin-bottom: 12px; }
.ae-intro .lead { margin-bottom: 16px; font-size: 17px; }
.ae-tool { margin: 22px 0 36px; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ae-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0; }

.ae-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; color: var(--text); font-size: 14px; font-weight: 750; }
.ae-label:first-of-type { margin-top: 0; }
.ae-num { display: inline-grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; }
.ae-chips, .ae-edit, .ae-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.ae-chip { min-width: 44px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.ae-chip:hover:not(:disabled) { border-color: var(--accent); }
.ae-chip:disabled { opacity: .45; cursor: default; }
.ae-chip[aria-pressed="true"], .ae-chip-strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.ae-chip-quiet { background: transparent; color: var(--muted); }
.ae-sublabel { margin: 12px 0 8px; color: var(--text); font-size: 13px; font-weight: 700; }
.ae-sublabel span { color: var(--muted); font-weight: 600; }

.ae-status { min-height: 3.2em; margin: 12px 0 0; color: var(--text); font-size: 14px; }
.ae-solve { width: 100%; font-size: 16px; }

.ae-result { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.ae-result:focus { outline: none; }
.ae-result-title { margin: 0 0 12px; font-size: 22px; }
.ae-caption { min-height: 3.2em; margin: 0 0 10px; color: var(--text); font-size: 15px; font-weight: 650; }
.ae-controls { margin-bottom: 12px; }
.ae-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.ae-copy-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
.ae-copy-status:empty { display: none; }
.ae-problems { margin: 0 0 10px; padding-left: 20px; color: var(--text); font-weight: 650; }
.ae-problems li { margin-bottom: 4px; }
.ae-controls .ae-chip { padding: 8px 12px; }
.ae-note { margin: 8px 0 0; font-size: 13px; }

.ae-article h2 { margin: 30px 0 12px; font-size: 24px; }
.ae-article li { margin-bottom: 8px; color: var(--muted); }
.ae-article li strong { color: var(--text); }
.ae-faq details { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ae-faq summary { color: var(--text); font-weight: 750; cursor: pointer; }
.ae-faq details p { margin: 8px 0 0; }
.ae-cta { margin-top: 32px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.ae-cta h2 { margin-top: 0; }
.ae-cta .text-link { color: var(--accent-strong); }
.ae-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

@media (min-width: 640px) {
  .ae-shell { padding: 36px 24px 64px; }
  .ae-tool { padding: 22px; }
}

.ae-result-cta { margin: 14px 0 0; }

/* Board: --cols columns of square tiles; an arrow tile shows its direction. */
.ae-size { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.ae-size label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 700; }
.ae-size select { min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--text); font: inherit; font-weight: 700; }
.ae-dir { min-width: 52px; font-size: 20px; line-height: 1; }
.ae-grid { --cols: 5; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 4px; width: min(100%, calc(var(--cols) * 52px + 16px)); margin: 0 auto 12px; padding: 8px; box-sizing: border-box; border-radius: 14px; background: #2f2a3d; }
.ae-cell { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 0; border: 2px solid rgba(244, 239, 226, .14); border-radius: 18%; background: #3c3650; color: #fff6cf; font-size: clamp(13px, calc(64vw / var(--cols)), 30px); font-weight: 800; line-height: 1; cursor: pointer; touch-action: manipulation; }
.ae-cell:not(:empty) { border-color: #ffe39a; background: linear-gradient(160deg, #5b4f7a, #463d60); }
.ae-cell[data-order]::after { content: attr(data-order); position: absolute; top: 1px; left: 3px; color: #9ff0dc; font-size: 10px; font-weight: 800; }
.ae-dead, .ae-cell.ae-dead:not(:empty) { border-color: #ff7a7a; background: #6b2f3d; }
.ae-stuck, .ae-cell.ae-stuck:not(:empty) { border-color: #ffb37a; background: #5a3f3a; }
.ae-next::before { content: ''; position: absolute; inset: 8%; border: 3px solid #4fd1b5; border-radius: 50%; }
.ae-last { outline: 3px solid #ff9f7a; outline-offset: 1px; }
.ae-grid-replay .ae-cell { cursor: default; }
.ae-presets { margin-bottom: 4px; }
.ae-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.ae-step { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.ae-step[data-done="true"] { color: var(--muted); }
.ae-step[aria-current="step"] { border-color: var(--accent); background: #e2f0e9; }
.ae-step-n { margin-right: 4px; color: var(--muted); font-size: 12px; }
.ae-round { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }

/* Play mode: built-in levels. */
.ae-jump { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.ae-play-title { margin: 0 0 6px; font-size: 22px; }
.ae-play-rules { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.ae-levels { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 12px; }
.ae-level-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ae-level-row > span { min-width: 52px; color: var(--muted); font-size: 13px; font-weight: 700; }
.ae-level { min-width: 44px; padding: 8px 10px; }
.ae-level-done::after { content: '✓'; margin-left: 3px; font-size: 12px; }
.ae-play-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.ae-play-stats strong { color: var(--text); }
.ae-play-grid { overflow: hidden; width: min(100%, calc(var(--cols) * 56px + 16px)); }
.ae-play-grid .ae-cell:empty { cursor: default; }
.ae-play-grid .ae-cell:focus-visible { outline: 3px solid #9ff0dc; outline-offset: 1px; }
.ae-play-grid .ae-leaving { z-index: 1; opacity: 0; transform: translate(calc(var(--dx, 0) * (100% + 4px)), calc(var(--dy, 0) * (100% + 4px))); transition: transform .22s ease-in, opacity .22s ease-in; pointer-events: none; }
.ae-bump { animation: ae-bump .35s ease-in-out; }
.ae-play-grid .ae-blocker { border-color: #ff7a7a; background: #6b2f3d; }
@keyframes ae-bump { 0%, 100% { transform: none; } 25% { transform: translateX(-6%); } 75% { transform: translateX(6%); } }
@media (prefers-reduced-motion: reduce) { .ae-bump { animation: none; } }
.ae-play .ae-status { min-height: 2.4em; margin: 0 0 8px; }
.ae-play-handoff { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.ae-linkbtn { padding: 0; border: 0; background: none; color: var(--accent-strong); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.ae-linkbtn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.ae-play .ae-levels { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
