/* Sun & Moon board. Loaded after puzzles.css; shared play/tools/result
   styles live there. Sizes inside the board use container units so the
   symbols and badges scale with the board on every screen. */

.play-card.sm-card { background: #edf2fa; }

.sm { position: relative; display: grid; width: 100%; max-width: 480px; margin: 0 auto; aspect-ratio: 1; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--paper); container-type: inline-size; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.sm-6 { grid-template-rows: repeat(6, minmax(0, 1fr)); }
.sm-8 { grid-template-rows: repeat(8, minmax(0, 1fr)); }
.sm-row { display: grid; min-height: 0; }
.sm-6 .sm-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sm-8 .sm-row { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.sm-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.sm-cell { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; border-right: 1px solid rgba(23, 27, 30, .16); border-bottom: 1px solid rgba(23, 27, 30, .16); border-radius: 0; background-color: transparent; cursor: pointer; }
.sm-cell:last-child { border-right: 0; }
.sm-row.end .sm-cell { border-bottom: 0; }
.sm-ico { display: none; width: 74%; height: 74%; pointer-events: none; overflow: visible; }
.sm-cell.sun .sm-ico, .sm-cell.moon .sm-ico { display: block; }

/* Fixed squares: darker tile and a corner dot. */
.sm-cell.fixed { background-color: var(--tile); cursor: default; }
.sm-cell.fixed::before { content: ""; position: absolute; left: 8%; top: 8%; width: max(4px, 9%); aspect-ratio: 1; border-radius: 50%; background: rgba(23, 27, 30, .55); }

@media (hover: hover) {
  .sm:not(.solved) .sm-cell:not(.fixed):hover { background-color: rgba(248, 206, 70, .18); }
}
.sm-cell:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; border-radius: 0; z-index: 1; }

/* A broken rule: diagonal stripes (readable without colour) and a red edge. */
.sm-cell.bad { background-image: repeating-linear-gradient(135deg, rgba(180, 55, 47, .28) 0 3px, transparent 3px 8px); box-shadow: inset 0 0 0 2px rgba(180, 55, 47, .8); }

.sm-cell.hinted { box-shadow: inset 0 0 0 3px #e2a614; animation: sm-hint 1s ease 2; }
@keyframes sm-hint { 50% { background-color: rgba(248, 206, 70, .45); } }

/* Badges ride on the edge between two squares. */
.sm-badges { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sm-badge { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; width: max(17px, 6.4cqw); height: max(17px, 6.4cqw); border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); color: var(--ink); font-weight: 800; font-size: max(12px, 4.6cqw); line-height: 1; }
.sm-8 .sm-badge { width: max(16px, 5.1cqw); height: max(16px, 5.1cqw); font-size: max(11.5px, 3.8cqw); }
.sm-badge.ne { font-size: max(14px, 5.4cqw); }
.sm-8 .sm-badge.ne { font-size: max(13px, 4.5cqw); }

.sm.solved { border-color: var(--green); }
.sm.solved .sm-cell { cursor: default; }
.sm.solved .sm-cell:not(.fixed) { background-color: #eaf5ec; }
.sm.celebrate .sm-ico { animation: sm-pop .55s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: var(--d, 0ms); }
@keyframes sm-pop { 45% { transform: scale(1.22) rotate(-8deg); } }

.sm-note { display: flex; align-items: flex-start; gap: 8px; max-width: 480px; min-height: 42px; margin: 12px auto 0; font-size: 14.5px; font-weight: 700; line-height: 1.4; color: #3d4246; }
.sm-note.warn { color: var(--danger); }
.sm-note.warn::before, .sm-note.tip::before { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; font-size: 13px; font-weight: 800; line-height: 1; }
.sm-note.warn::before { content: "!"; background: var(--danger); color: #fff; }
.sm-note.tip::before { content: "i"; background: var(--yellow); color: var(--ink); }
.play-root[data-chalk-game="sun-moon"] .tool:disabled { opacity: .45; cursor: default; }

.side .sm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 14.5px; font-weight: 700; color: #3a3f43; }
.sm-legend li { display: flex; align-items: center; gap: 6px; margin: 0; }
.sm-legend .k { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); font-weight: 800; font-size: 14px; line-height: 1; }
.sm-legend .k.fx { border-radius: 6px; border: 0; background: var(--tile); position: relative; }
.sm-legend .k.fx::before { content: ""; position: absolute; left: 3px; top: 3px; width: 5px; height: 5px; border-radius: 50%; background: rgba(23, 27, 30, .55); }
