:root {
    --bg: #0b0f14;
    --card: #121824;
    --muted: #93a1b0;
    --accent: #6aa3ff;
    --ok: #18c29c;
    --bad: #ff5d73;
    --ink: #e8eef7;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    min-height: 100vh;
    /* full viewport height */
    display: flex;
    flex-direction: column;
    /* stack vertically */
    align-items: center;
    /* horizontal centering */
    justify-content: center;
    /* vertical centering */
    background: linear-gradient(180deg, #0a0e13, #0e1420 30%, #0b0f14);
    color: var(--ink);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
    padding: 24px;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
    border-bottom: 1px solid transparent;
}

a:hover,
a:focus {
    color: var(--ink);
    border-color: var(--accent);
}

a:active {
    color: var(--ok);
}

a.muted {
    color: var(--muted);
}

a.muted:hover {
    color: var(--accent);
}

.app {
    width: min(1100px, 100%);
    margin: 0 auto;
}

.site-logo {
    text-align: center;
    margin-bottom: 24px;
}

.site-logo h1 {
    font-family: 'Segoe UI', Roboto, sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent);
    margin: 0;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 18px;
    flex-wrap: wrap;
    text-align: left;
}

.controls {
  display: flex;
  flex-wrap: wrap;          /* allow a second line */
  align-items: center;
  justify-content: flex-end;/* keep buttons at top-right */
  gap: 8px;
}

.btn-group { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; width:100%; }

.site-footer {
    margin-top: 40px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.site-footer p {
    margin: 6px 0;
}

.title {
    font-size: clamp(20px, 4.5vw, 30px);
    font-weight: 800;
    letter-spacing: .2px
}

.muted {
    color: var(--muted);
    font-size: 15px
}

.card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    border-radius: 18px;
    padding: 16px
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.col {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.col h2 {
    margin: 2px 4px 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .12em
}

.list {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.item {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .08);
    background: #101624;
    color: var(--ink);
    padding: 16px 16px;
    text-align: left;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    isolation: isolate;
    transition: transform .06s ease, border-color .15s ease, background .2s ease;
    width: 100%;
    display: block;
    font-size: clamp(18px, 2.5vw, 22px);
    line-height: 1.4
}

.item:hover {
    transform: translateY(-1px)
}

.item[disabled] {
    opacity: .5;
    cursor: default;
    pointer-events: none
}

.item .hint {
    color: var(--muted);
    font-style: italic
}

.selected {
    outline: 2px solid var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(106, 163, 255, .18) inset
}

@keyframes pop {
    0% {
        transform: scale(1)
    }

    40% {
        transform: scale(1.09)
    }

    100% {
        transform: scale(1)
    }
}

.correct {
    border-color: var(--ok) !important;
    background: rgba(24, 194, 156, .30) !important;
    color: #eafff9 !important;
    font-weight: 700;
    box-shadow: 0 0 0 3px var(--ok) inset, 0 0 24px 2px rgba(24, 194, 156, .55) !important;
    animation: pop .3s ease both
}

@keyframes shake {

    10%,
    90% {
        transform: translateX(-3px)
    }

    20%,
    80% {
        transform: translateX(5px)
    }

    30%,
    50%,
    70% {
        transform: translateX(-9px)
    }

    40%,
    60% {
        transform: translateX(9px)
    }
}

.incorrect {
    border-color: var(--bad) !important;
    background: rgba(255, 93, 115, .30) !important;
    color: #ffeaee !important;
    font-weight: 700;
    box-shadow: 0 0 0 3px var(--bad) inset, 0 0 24px 2px rgba(255, 93, 115, .5) !important;
    animation: shake .5s ease
}

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap
}

.btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .12);
    color: var(--ink);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer
}

.btn:hover {
    border-color: var(--accent)
}

.seg {
    display: inline-flex;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    padding: 4px;
    border-radius: 12px;
    gap: 4px;
    margin-right: 8px
}

.seg button {
    border: 0;
    background: transparent;
    color: var(--ink);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600
}

.seg button[aria-pressed="true"] {
    background: var(--accent);
    color: #0b1120
}

.seg button:hover {
    filter: brightness(1.1)
}

/* Full-width settings panel that wraps items to new lines */
.seg.seg--checkboxes {
  display: flex;
  flex-wrap: wrap;                 /* ← allow wrapping */
  gap: 10px;
  width: 100%;
  max-width: 100%;
  align-items: flex-start;
  justify-content: flex-start;     /* or flex-end if you want them right-aligned */
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  padding: 8px 10px;
  border-radius: 12px;
}

/* Each checkbox "pill" */
.seg.seg--checkboxes .chk {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: transparent;
  /* sizing: sit side-by-side, but wrap when needed */
  flex: 0 1 auto;                  /* don't stretch to fill row */
  max-width: 100%;                 /* never overflow container */
  white-space: normal;             /* allow wrapping inside a long label */
  line-height: 1.2;
}

/* Let long words/phrases wrap instead of pushing layout */
.seg.seg--checkboxes .chk span {
  overflow-wrap: anywhere;         /* break long tokens if needed */
}

.dissolve {
    animation: fadeOut .45s ease both
}

#typeFilters {
  flex: 0 0 100%;           /* take the full line below */
  order: 99;                /* always after the buttons on the first row */
  margin-top: 8px;
}

.hidden { display: none !important; }

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px)
    }
}

@media (max-width: 760px) {
    body {
        justify-content: flex-start;
        /* push content to the top */
        padding-top: 20px;
        /* some breathing space */
    }

    .grid {
        grid-template-columns: 1fr 1fr;
        /* keep two columns */
        gap: 8px;
        /* tighten spacing */
    }

    .item {
        font-size: clamp(14px, 4vw, 18px);
        /* smaller text for mobile */
        padding: 12px;
    }

    .col h2 {
        font-size: 12px;
        /* smaller headers */
    }
}
/* ---------- Donation banner ---------- */
.donate-banner {
    width: min(1100px, 100%);
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(106, 163, 255, .14), rgba(24, 194, 156, .12));
    border: 1px solid rgba(106, 163, 255, .35);
    color: var(--ink);
}

.donate-banner[hidden] {
    display: none;
}

.donate-banner__text {
    margin: 0;
    flex: 1 1 320px;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
}

.donate-banner__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.donate-banner__cta {
    display: inline-block;
    background: var(--accent);
    color: #0b1120;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 12px;
    border-bottom: 0;
    white-space: nowrap;
    transition: filter .15s ease, transform .06s ease;
}

.donate-banner__cta:hover,
.donate-banner__cta:focus {
    color: #0b1120;
    border-color: transparent;
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.donate-banner__cta:active {
    color: #0b1120;
    transform: translateY(0);
}

.donate-banner__close {
    line-height: 1;
    font-size: 20px;
    padding: 6px 12px;
    color: var(--muted);
}

.donate-banner__close:hover {
    color: var(--ink);
}

@media (max-width: 760px) {
    .donate-banner {
        padding: 10px 12px;
        gap: 10px;
    }

    .donate-banner__text {
        font-size: 14px;
        flex-basis: 100%;
    }

    .donate-banner__actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ---------- Cookie / analytics consent ---------- */
.consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    padding: 14px;
    background: rgba(11, 15, 20, .96);
    border-top: 1px solid rgba(106, 163, 255, .35);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .45);
    backdrop-filter: blur(6px);
}

.consent[hidden] {
    display: none;
}

.consent__inner {
    width: min(1100px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    text-align: left;
}

.consent__copy {
    flex: 1 1 380px;
}

.consent__title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--accent);
}

.consent__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--muted);
}

.consent__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b1120;
    font-weight: 700;
}

.btn--primary:hover {
    filter: brightness(1.08);
}

/* Footer "Cookie settings" trigger, styled as a link */
.linklike {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.linklike:hover,
.linklike:focus {
    color: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 760px) {
    .consent__inner {
        gap: 12px;
    }

    .consent__actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ---------- Solved pairs stay green until the round redraws ---------- */
.item.matched,
.item.matched[disabled] {
    opacity: 1;
    border-color: var(--ok);
    background: rgba(24, 194, 156, .18);
    box-shadow: 0 0 0 2px var(--ok) inset;
    color: var(--ink);
}

.item.matched .hint {
    color: rgba(232, 238, 247, .75);
}

/* ---------- French flag in the site title ---------- */
.flag-fr {
    width: 1.05em;
    height: .7em;
    margin-right: .38em;
    vertical-align: -.02em;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}

@media (prefers-reduced-motion: reduce) {

    .correct,
    .incorrect {
        animation: none !important;
    }
}

/* ---------- Version stamp ---------- */
.site-footer .version {
    margin-top: 14px;
    text-align: right;
    font-size: 0.78rem;
    letter-spacing: .04em;
    color: var(--muted);
    opacity: .75;
    font-variant-numeric: tabular-nums;
}

.version__num {
    font-weight: 700;
    color: var(--accent);
}

.version__sep {
    margin: 0 4px;
}

@media (max-width: 760px) {
    .site-footer .version {
        text-align: center;
    }
}
