/* begin license *
 *
 * Small browser games on swl and swindl
 *
 * All rights reserved.
 *
 * Copyright (C) 2026 moatley moatley@lost-monkeys.net
 *
 * This file is part of "Games"
 *
 * end license */

/* Lights: one screen, the level on top, the board, restart and hint below. */
:root {
    --li-bg: #f3f1ec;
    --li-bg-glow: #fffdf8;
    --li-panel: #ffffff;
    --li-frame: #cdc5b6;
    --li-cell-top: #e2ddd2;
    --li-cell: #d3ccbe;
    --li-text: #2a2a33;
    --li-muted: #77737f;
    --li-hint: #1b9a9a;
}
:root[data-theme="dark"] {
    --li-bg: #161a24;
    --li-bg-glow: #232a3b;
    --li-panel: #1f2533;
    --li-frame: #0e1118;
    --li-cell-top: #2a3244;
    --li-cell: #222938;
    --li-text: #eceef4;
    --li-muted: #8d93a5;
    --li-hint: #3ad4c8;
}

body.lights-page {
    margin: 0;
    background: radial-gradient(ellipse at 50% 40%, var(--li-bg-glow), var(--li-bg) 70%) var(--li-bg);
    min-height: 100vh;
    color: var(--li-text);
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.li {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    max-width: 34rem;
    margin: 0 auto;
    padding: env(safe-area-inset-top) .75rem env(safe-area-inset-bottom);
    box-sizing: border-box;
}

.li-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .75rem 0 .25rem;
}
.li-back, .li-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--li-panel);
    color: var(--li-text);
    font-size: 1.2rem;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
}
.li-round:disabled { opacity: .3; cursor: default; }
.li-scores { display: flex; gap: .75rem; }
.li-score { display: flex; flex-direction: column; align-items: center; min-width: 3.2rem; }
.li-score > span:last-child { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.li-label { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--li-muted); }

.li-levels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 20rem;
    padding: .25rem 0;
}
.li-levels .li-round { width: 2.2rem; height: 2.2rem; font-size: 1rem; }
.li-level-name { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.li-level-name strong { font-size: 1.05rem; }
.li-level-name span { font-size: .8rem; color: var(--li-muted); }

.li-board {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.li-board-svg {
    display: block;
    /* a small board not larger than a big one's triangles */
    width: min(100%, calc((100dvh - 14rem) * var(--li-aspect, 1.15)), calc(var(--li-units, 10) * 5rem));
    max-height: 100%;
    height: auto;
    touch-action: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.li-panel polygon, .li-panel-shadow polygon {
    fill: var(--li-frame);
    stroke: var(--li-frame);
    stroke-width: .6;
    stroke-linejoin: round;
}
.li-panel-shadow { transform: translateY(.12px); opacity: .18; }
.li-panel-shadow polygon { fill: #000; stroke: #000; stroke-width: .7; }

.li-cell {
    fill: url(#li-off);
    stroke: transparent;
    stroke-width: .05;
    stroke-linejoin: round;
    transform-box: fill-box;
    transform-origin: center;
    transition: fill .15s;
}
.li-cell.li-on {
    fill: url(#li-on);
    stroke: #ffe9a3;
    stroke-width: .02;
    filter: url(#li-glow);
}
.li-cell.li-flip { animation: li-flip .22s ease-out; }
@keyframes li-flip {
    40% { transform: scale(.78); }
    100% { transform: scale(1); }
}
.li-cell.li-hint {
    stroke: var(--li-hint);
    stroke-width: .07;
    animation: li-hint 1s ease-in-out infinite alternate;
}
@keyframes li-hint {
    from { stroke-opacity: .35; }
    to { stroke-opacity: 1; }
}

.li-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    padding: .75rem 0 1.25rem;
    flex: 0 0 auto;
}
.li-action {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border: 0;
    border-radius: 2rem;
    background: var(--li-panel);
    color: var(--li-text);
    font-size: 1rem;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.li-over {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
}
.li-over[hidden] { display: none; }
.li-over-box {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .5rem 1rem;
    margin: 0 1rem;
    padding: 1.5rem 1.5rem;
    border-radius: 1rem;
    background: var(--li-panel);
    color: var(--li-text);
}
.li-over-box h2 { margin-top: 0; }
.li-over-box p { margin: 0 0 .3rem; }
.li-over-best { color: #e0a100; font-weight: 700; }
.li-over-mascot { width: 7rem; height: auto; }
.li-over-buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }

/* the mascot's portrait in the header */
.li-mascot {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 50%;
    overflow: hidden;
    background: var(--li-panel);
    flex: 0 0 auto;
}

@media (prefers-reduced-motion: reduce) {
    .li-cell { transition: none; }
    .li-cell.li-flip, .li-cell.li-hint { animation: none; }
}
