/* Akari (/akari): only what is the game's own - the grid of walls and white cells, the light, the bulbs and the dots.
   Tiles, buttons, fields and the accent come from the app kit (css/app-kit, docs/app-kit.md), the button row from
   css/app-kit/games.css (every game). Loaded only on this page (StylePaths). The board's colours are custom properties,
   so Save image and the pencil paint the same ones. */

.akari-landing-app {
    --ar-grid: #94a3b8;
    --ar-wall: #1e293b;
    --ar-number: #ffffff;
    --ar-light: #fef3c7;
    --ar-ray: rgba(245, 158, 11, 0.5);
    --ar-bulb: #f59e0b;
    --ar-bad: #dc2626;
}

.akari-landing-app[data-theme="dark"] {
    --ar-grid: #334155;
    --ar-wall: #020617;
    --ar-number: #e2e8f0;
    --ar-light: #4a3a12;
    --ar-ray: rgba(251, 191, 36, 0.55);
    --ar-bulb: #fbbf24;
    --ar-bad: #f87171;
}

.akari-board {
    display: grid;
    grid-template-columns: repeat(var(--ar-n, 10), 1fr);
    gap: 1px;
    width: min(100%, calc(100vh - 300px));
    min-width: min(100%, 260px);
    margin-inline: auto;
    padding: 1px;
    border-radius: 6px;
    background: var(--ar-grid);
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

.akari-board.is-making {
    opacity: 0.55;
}

.ar-wall,
.ar-cell {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    min-width: 0;
    overflow: hidden;
}

.ar-wall {
    background: var(--ar-wall);
    color: var(--ar-number);
    font: 700 clamp(11px, calc(40px - var(--ar-n, 10) * 1.7px), 28px) / 1 var(--ak-font, system-ui, sans-serif);
}

/* A number with exactly its bulbs fades; one that cannot be right any more turns red. */
.ar-wall.is-done {
    color: color-mix(in srgb, var(--ar-number) 45%, var(--ar-wall));
}

.ar-wall.is-bad {
    color: var(--ar-bad);
    text-decoration: underline wavy;
}

.ar-cell {
    padding: 0;
    border: 0;
    background: var(--ak-field);
    color: var(--ak-text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ar-cell:hover {
    background: var(--ak-hover);
}

.ar-cell.is-lit {
    background: var(--ar-light);
}

/* The rays: a line along the row and the column of every bulb. */
.ar-cell.ray-h::before,
.ar-cell.ray-v::after {
    content: "";
    position: absolute;
    background: var(--ar-ray);
    pointer-events: none;
}

.ar-cell.ray-h::before {
    left: -1px;
    right: -1px;
    top: calc(50% - 2px);
    height: 4px;
}

.ar-cell.ray-v::after {
    top: -1px;
    bottom: -1px;
    left: calc(50% - 2px);
    width: 4px;
}

/* The mark inside a cell (over the rays): a glowing bulb, or a dot for "no bulb here". */
.ar-mark {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.ar-cell.is-bulb .ar-mark {
    inset: 20%;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 36%, #ffffff 0, var(--ar-bulb) 35%, var(--ar-bulb) 100%);
    box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.35), 0 0 10px 2px color-mix(in srgb, var(--ar-bulb) 60%, transparent);
}

.ar-cell.is-bulb.is-clash .ar-mark {
    --ar-bulb: var(--ar-bad);
}

.ar-cell.is-dot .ar-mark {
    inset: 42%;
    border-radius: 50%;
    background: var(--ak-muted);
}

.ar-cell.is-selected {
    box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--ak-accent) 70%, transparent);
    outline: none;
}

.ar-cell:focus-visible {
    outline: 3px solid var(--ak-accent);
    outline-offset: -3px;
}

.ar-cell.is-hint {
    animation: ar-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes ar-pulse {
    from { box-shadow: inset 0 0 0 2px var(--ak-info); }
    to { box-shadow: inset 0 0 0 5px var(--ak-info); }
}

.akari-board.is-solving {
    pointer-events: none;
}

.akari-status.is-solved {
    color: var(--ak-success);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .ar-cell.is-hint { animation: none; box-shadow: inset 0 0 0 4px var(--ak-info); }
}
