/* Lanterns: a night street lit by paper lanterns */
.ak-col { gap: 6px; padding: 6px 8px; }
.ak-board {
  --n: 7;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  gap: 2px;
  direction: ltr;
  width: 280px; height: 280px;
  padding: 4px;
  border-radius: 12px;
  background: #161026;
  box-shadow: 0 0 0 2px rgba(246, 166, 193, 0.5), 0 10px 28px rgba(0, 0, 0, 0.5);
  -webkit-user-select: none; user-select: none;
  transition: box-shadow 1.2s;
}
.ak-cell {
  position: relative;
  min-width: 0; min-height: 0;
  margin: 0; padding: 0;
  border: 0;
  border-radius: 4px;
  background: #3A2F5E;
  box-shadow: inset 0 0 0 1px rgba(251, 243, 234, 0.07);
  color: inherit; font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.28s ease-out, box-shadow 0.28s ease-out;
}
.ak-cell.is-lit {
  background: #F4C56E;
  box-shadow: inset 0 0 0 1px rgba(255, 244, 214, 0.5), inset 0 0 12px rgba(255, 240, 200, 0.75), 0 0 10px rgba(244, 197, 110, 0.35);
}
.ak-cell:focus-visible { outline: 3px solid #FBF3EA; outline-offset: -3px; z-index: 2; }
.ak-cell.is-dot::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 22%; height: 22%; margin: -11% 0 0 -11%;
  border-radius: 50%; background: #9A8FB3;
}
.ak-cell.is-lit.is-dot::after { background: #8A5A1E; }
.ak-lan { position: absolute; left: 5%; top: 2%; width: 90%; height: 96%; pointer-events: none; overflow: visible;
  transform-origin: 50% 0; animation: ak-hang 0.5s cubic-bezier(.3, 1.5, .5, 1); filter: drop-shadow(0 0 4px rgba(255, 220, 150, 0.9)); }
.ak-cell.is-bad { background: #F29A7C; box-shadow: inset 0 0 0 3px #E0452F, inset 0 0 12px 3px rgba(224, 69, 47, 0.7); }
.ak-cell.is-bad .ak-lan { animation: ak-shake 0.3s; }
.ak-wall {
  background: #1D1533 linear-gradient(160deg, rgba(122, 78, 158, 0.34), rgba(22, 16, 38, 0) 60%);
  box-shadow: inset 0 0 0 1px rgba(246, 166, 193, 0.16), inset 0 -3px 0 rgba(0, 0, 0, 0.35);
  cursor: default;
}
.ak-num { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1em; line-height: 1; color: #FBF3EA; transition: color 0.2s; }
.ak-wall.is-ok .ak-num { color: #8DB255; }
.ak-wall.is-over .ak-num { color: #FF7B63; animation: ak-shake 0.3s; }
.ak-wall.is-over { box-shadow: inset 0 0 0 2px #E0452F; }
/* solved: the walls become houses with lit windows and the lanterns sway in the evening air */
.ak-board.is-won { box-shadow: 0 0 0 2px #F6A6C1, 0 0 34px rgba(244, 197, 110, 0.55), 0 10px 28px rgba(0, 0, 0, 0.5); }
.ak-board.is-won .ak-cell { cursor: default; }
.ak-board.is-won .ak-wall::before {
  content: ""; position: absolute; left: 20%; right: 20%; bottom: 14%; height: 26%;
  background: linear-gradient(90deg, #FBD98A 0 38%, transparent 38% 62%, #FBD98A 62%);
  border-radius: 1px; opacity: 0; box-shadow: 0 0 8px rgba(251, 217, 138, 0.8);
  animation: ak-window 0.6s ease-out forwards; animation-delay: calc(0.3s + var(--d, 0s));
}
.ak-board.is-won .ak-wall::after {
  content: ""; position: absolute; left: 6%; right: 6%; top: 8%; height: 16%;
  background: #E0452F; border-radius: 40% 40% 0 0 / 100% 100% 0 0; opacity: 0;
  animation: ak-window 0.6s ease-out forwards; animation-delay: var(--d, 0s);
}
.ak-board.is-won .ak-num { opacity: 0; transition: opacity 0.4s; }
.ak-board.is-won .ak-lan { animation: ak-sway 1.8s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes ak-hang { 0% { transform: translateY(-30%) scale(0.5) rotate(-14deg); opacity: 0; } 55% { transform: rotate(8deg); opacity: 1; } 80% { transform: rotate(-4deg); } 100% { transform: none; } }
@keyframes ak-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes ak-sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes ak-window { to { opacity: 1; } }
#sub { min-height: 26px; font-size: 0.95rem; }
#sizes .fa-seg button { min-height: 38px; min-width: 64px; }
@media (max-height: 600px) { #sizes .fa-seg button { min-height: 34px; } #sub { min-height: 22px; } }
@media (prefers-reduced-motion: reduce) {
  .ak-cell { transition: none; }
  .ak-lan, .ak-cell.is-bad .ak-lan, .ak-board.is-won .ak-lan, .ak-wall.is-over .ak-num { animation: none; }
  .ak-board.is-won .ak-wall::before, .ak-board.is-won .ak-wall::after { animation: none; opacity: 1; }
}
@media (max-width: 359px) { #solved-chip { display: none; } }
