/* Spot the difference (js/spotDifference.js). Colours come from the --bia-* tokens where
   a token exists so high-contrast mode swaps them for free. */

.sdGameContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 10px 8px 8px;
    max-width: 1000px;
    margin: 0 auto;
}

/* ── Progress ───────────────────────────────────────────────────────────── */

.sdPhaseLabel {
    font-size: 13px;
    font-weight: 600;
    color: var(--bia-muted, #595959);
}

.sdStatusRow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sdCount {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--bia-fg, #1f2937);
}

.sdDots {
    display: flex;
    gap: 7px;
}

.sdDot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ded9f4;
    transition: background 0.25s ease, transform 0.25s ease;
}

.sdDotFound {
    background: #237355;
    transform: scale(1.15);
}

/* ── The pair ───────────────────────────────────────────────────────────── */

.sdPair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    border-radius: 12px;
}

/* Landscape pictures get a column each, one above the other, so a small change is still
   big enough on screen to pick out. */
.sdPair.sdPairStacked {
    grid-template-columns: 1fr;
}

.sdPair:focus-visible {
    outline: 3px solid var(--bia-focus, #4a3fb0);
    outline-offset: 4px;
}

.sdPane {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sdPaneLabel {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--bia-muted, #595959);
    text-align: center;
}

/* The markers layer sits exactly over the picture, so it has to be the same box. */
.sdCanvas {
    position: relative;
    line-height: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--bia-border, #767676);
    cursor: crosshair;
    -webkit-tap-highlight-color: transparent;
}

.sdImage {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.sdMarkers {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Circles are sized as a percentage of the WIDTH and squared off with padding-bottom,
   so they stay round and stay on target however the picture is scaled. */
.sdMark {
    position: absolute;
    display: block;
    height: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-sizing: border-box;
}

.sdMark.sdMarkFound {
    border: 3px solid #237355;
    background: rgba(35, 115, 85, 0.14);
    animation: sdPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* The hint ring is dashed and a different colour, so it never reads as "already found".
   It stays until the player actually taps that difference. */
.sdMark.sdMarkHint {
    border: 3px dashed var(--bia-accent, #6c5fc0);
    background: rgba(108, 95, 192, 0.12);
    animation: sdPulse 1.6s ease-in-out infinite;
}

.sdMiss {
    position: absolute;
    display: block;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    border: 2px solid var(--bia-muted, #595959);
    opacity: 0.75;
    animation: sdRipple 0.6s ease-out forwards;
}

@keyframes sdPop {
    0%   { transform: translate(-50%, -50%) scale(0.55); opacity: 0; }
    70%  { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes sdPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

@keyframes sdRipple {
    0%   { transform: scale(0.4); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ── Help, tools, found list ────────────────────────────────────────────── */

.sdHelp {
    margin: 0;
    font-size: 14px;
    color: var(--bia-muted, #595959);
    text-align: center;
    max-width: 62ch;
}

.sdToolBar {
    display: flex;
    justify-content: center;
}

.sdHintBtn {
    min-height: 44px;
    padding: 10px 22px;
    background: transparent;
    color: var(--bia-link, #5b4fb8);
    border: 2px solid var(--bia-border, #767676);
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.sdHintBtn:hover:not(:disabled) {
    background: #f2f0fb;
    border-color: var(--bia-link, #5b4fb8);
}

.sdHintBtn:disabled {
    opacity: 0.5;
    cursor: default;
}

.sdFoundList {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Each found difference is confirmed in words, not only by a ring on the picture. */
.sdFoundList li {
    position: relative;
    padding: 7px 12px 7px 30px;
    border-radius: 8px;
    background: #e8f3ee;
    color: #14513c;
    font-size: 14px;
}

.sdFoundList li::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 50%;
    width: 6px;
    height: 11px;
    margin-top: -7px;
    border: solid #237355;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.sdError {
    color: #b3261e;
    text-align: center;
    padding: 24px;
}

/* ── High contrast ──────────────────────────────────────────────────────── */

html[data-a11y-contrast="high"] .sdMark.sdMarkFound {
    border-color: #14513c;
    background: rgba(20, 81, 60, 0.2);
}

html[data-a11y-contrast="high"] .sdMark.sdMarkHint {
    border-color: #2a1f8c;
    background: rgba(42, 31, 140, 0.18);
}

html[data-a11y-contrast="high"] .sdFoundList li {
    background: #d7ece3;
    color: #0f3b2c;
}

/* ── Reduced motion (OS preference; the account toggle also neutralises motion
      globally via html[data-a11y-motion]) ───────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .sdDot, .sdHintBtn { transition: none; }
    .sdMark.sdMarkFound, .sdMiss { animation: none; }
    /* The hint must still stand out without the pulse carrying it. */
    .sdMark.sdMarkHint {
        animation: none;
        border-style: dashed;
        border-width: 4px;
    }
}

/* Stack the two pictures on a phone: side by side would make each one too small to
   pick a difference out of. */
@media only screen and (max-width: 720px) {
    .sdPair { grid-template-columns: 1fr; gap: 10px; }
    .sdCount { font-size: 15px; }
}
