.games {
    --game-ink: #232b3e;
    --game-muted: #50596c;
    --game-accent: #3e4d74;
    --game-sheet: #fffdfa;
    --game-paper: #f7f5f1;
    --game-rule: #c7cbd6;
    --game-mist: #e9edf4;
    --game-linen: #f0e9db;
    --game-honey: #f4dca4;
    --game-rust: #854324;
    --theme-bg: #e9edf4;
    --theme-ink: #3e4d74;
    box-sizing: border-box;
    width: min(100% - 40px, 1140px);
    margin: 0 auto;
    padding: clamp(1.5rem, 5vw, 4.6rem) 0 clamp(2.5rem, 6vw, 5rem);
    color: var(--game-ink);
    font-family: "Atkinson Hyperlegible Next", system-ui, sans-serif;
}

.games *, .games *::before, .games *::after { box-sizing: border-box; }
.games [hidden] { display: none !important; }
.games ::selection { background: var(--game-honey); color: var(--game-ink); }
.games [data-game-theme="emotions"], .games[data-game-theme="emotions"] { --theme-bg: #f2dfd8; --theme-ink: #713e36; }
.games [data-game-theme="relations"], .games[data-game-theme="relations"] { --theme-bg: #dae9df; --theme-ink: #2d594b; }
.games [data-game-theme="pauses"], .games[data-game-theme="pauses"] { --theme-bg: #f3e7c9; --theme-ink: #71521e; }
.games [data-game-theme="repos"], .games[data-game-theme="repos"] { --theme-bg: #e3e7f3; --theme-ink: #3b4d75; }
.games [data-game-theme="confiance"], .games[data-game-theme="confiance"] { --theme-bg: #ebdfeb; --theme-ink: #613f68; }
.games [data-game-theme="attention"], .games[data-game-theme="attention"] { --theme-bg: #dcebed; --theme-ink: #27595f; }
.games [data-game-theme="memoire"], .games[data-game-theme="memoire"] { --theme-bg: #e1eaf1; --theme-ink: #344d68; }
.games [data-game-theme="culture"], .games[data-game-theme="culture"] { --theme-bg: #f0e1d6; --theme-ink: #67442f; }
.games [data-game-theme="reunion"], .games[data-game-theme="reunion"] { --theme-bg: #e7edd4; --theme-ink: #465821; }
.games-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.games h1, .games h2 {
    margin: 0;
    text-wrap: balance;
    color: var(--game-ink);
    font-family: Baskervville, Georgia, serif;
    font-weight: 400;
    letter-spacing: -.028em;
}
.games h1 { font-size: clamp(2.55rem, 5.6vw, 5.55rem); line-height: 1.03; }
.games h2 { font-size: clamp(1.65rem, 3vw, 2.7rem); line-height: 1.14; }
.games p { margin: 0; }
.games a { text-underline-offset: .2em; }
.games button, .games input, .games select { font: inherit; }
.games button { cursor: pointer; }
.games button:disabled { cursor: default; }
.games a:focus-visible, .games button:focus-visible, .games input:focus-visible, .games select:focus-visible, .games summary:focus-visible {
    outline: 2px solid var(--game-rust);
    outline-offset: 4px;
}

.games-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    min-height: 44px;
    padding: .62rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    font-weight: 650;
    line-height: 1.25;
}
.games-button svg, .games-list-action svg { width: 1.2rem; height: 1.2rem; flex: none; }
.games-button-primary { background: var(--game-accent); color: var(--game-sheet); }
.games-button-primary:hover { background: #2c395a; color: var(--game-sheet); }
.games-button-outline { background: var(--game-sheet); border-color: #7c8295; color: var(--game-accent); }
.games-button-outline:hover { background: var(--game-mist); }
.games-button:disabled { opacity: .62; }
.games .games-text-link, .games .games-back {
    color: var(--game-accent);
    text-decoration: underline;
    font-weight: 650;
}
.games button.games-text-link { border: 0; background: transparent; padding: .35rem 0; text-underline-offset: .2em; }

.games-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.16fr) minmax(0, .84fr);
    background: #2c395a;
    border-radius: 4px;
    overflow: hidden;
    color: var(--game-sheet);
}
.games-hero-copy { align-self: center; padding: clamp(1.4rem, 5vw, 4.1rem); }
.games-hero h1 { max-width: 12ch; color: var(--game-sheet); }
.games-hero-copy p {
    max-width: 43ch;
    margin: 1.1rem 0 1.45rem;
    color: #e0e6f5;
    font-size: clamp(1.03rem, 1.8vw, 1.24rem);
    line-height: 1.55;
}
.games-hero-actions { display: flex; flex-wrap: wrap; gap: .65rem 1.05rem; align-items: center; }
.games .games-hero .games-button-primary { background: var(--game-honey); color: var(--game-ink); }
.games .games-hero .games-button-primary:hover { background: var(--game-sheet); }
.games .games-hero-link { color: var(--game-sheet); font-weight: 650; }
.games .games-hero a:focus-visible { outline-color: var(--game-honey); }
.games-cover {
    display: grid;
    place-items: center;
    min-width: 0;
    padding: clamp(1.55rem, 4.1vw, 3.45rem);
    background: var(--game-honey);
    background-image: linear-gradient(#85432424 1px, transparent 1px), linear-gradient(90deg, #85432424 1px, transparent 1px);
    background-size: 24px 24px;
}
.games-cover-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    width: min(100%, 320px);
    padding: 6px;
    background: #2c395a;
    transform: rotate(-6deg);
    box-shadow: 2px 11px 28px #513c3a4d;
}
.games-cover-grid span {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    background: #2c395a;
    color: var(--game-ink);
    font-size: clamp(.95rem, 2.5vw, 1.7rem);
    font-weight: 700;
}
.games-cover-grid .games-cover-open { background: var(--game-sheet); }
.games-cover-grid .games-cover-letter { background: #e7f1e8; }
.games-cover-grid .games-cover-letter:nth-child(-n+21) { background: #f5ead2; }

.games-finder { margin-top: clamp(1.35rem, 3.2vw, 2.5rem); padding: clamp(.9rem, 2vw, 1.35rem); background: var(--game-mist); border-radius: 4px; }
.games-filters { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr)) auto; gap: .65rem; align-items: end; }
.games-filter { display: grid; gap: .22rem; min-width: 0; }
.games-filter label { color: var(--game-accent); font-weight: 700; }
.games-filters .games-button { min-height: 44px; padding-block: .5rem; font-weight: 650; line-height: 1.25; }
.games-filters select {
    width: 100%;
    min-height: 44px;
    padding: .48rem .55rem;
    border: 1px solid #7c8295;
    border-radius: 4px;
    background: var(--game-sheet);
    color: var(--game-ink);
    font-weight: 500;
}
.games-filter-feedback { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; margin-top: .7rem; color: var(--game-muted); font-size: .92rem; }
.games-shelf { margin-top: clamp(2rem, 4.5vw, 3.5rem); }
.games-shelf-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 1.2rem; row-gap: .35rem; }
.games-shelf-heading p, .games-local-note { color: var(--game-muted); }
.games .games-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(1.2rem, 3.2vw, 2.65rem);
    list-style: none;
    padding: 0;
    margin: .95rem 0 0;
}
.games-list li { display: grid; min-width: 0; border-top: 1px solid var(--game-rule); }
.games .games-list-link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: clamp(.55rem, 1.4vw, 1rem);
    padding: .85rem .3rem .9rem;
    color: var(--game-ink);
    text-decoration: none;
}
.games-list-link:hover { background: var(--game-sheet); }
.games-list-mark {
    width: clamp(2.35rem, 4.2vw, 3.1rem);
    padding: .35rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    margin-top: .1rem;
    background: var(--theme-bg);
    border-radius: 4px;
}
.games-list-mark i { aspect-ratio: 1; }
.games-list-mark i:is(:nth-child(2), :nth-child(4), :nth-child(5), :nth-child(6), :nth-child(8)) { background: var(--theme-ink); }
.games-list [data-game-format="arrow"] .games-list-mark i:nth-child(2) { background: transparent; border: 1px solid var(--theme-ink); }
.games-list [data-game-format="arrow"] .games-list-mark i:nth-child(4) { background: transparent; border: 1px solid var(--theme-ink); }
.games-list-title { display: grid; gap: .18rem; min-width: 0; }
.games-list-title strong { font-family: Baskervville, Georgia, serif; font-weight: 400; font-size: clamp(1.25rem, 2.2vw, 1.68rem); line-height: 1.16; }
.games-list-format { color: var(--theme-ink); font-weight: 700; font-size: .83rem; }
.games-list-description { color: var(--game-muted); font-size: .94rem; line-height: 1.42; }
.games-list-meta { color: var(--game-accent); font-weight: 650; font-size: .85rem; }
.games-list-action { color: var(--game-accent); display: flex; margin-top: .35rem; }
.games .games-local-note { margin-top: 1.8rem; max-width: 66ch; font-size: .95rem; }

.games-player { width: min(100% - 40px, 1090px); }
.games-back { display: inline-block; margin-bottom: .9rem; }
.games-game-title { margin-bottom: clamp(.95rem, 2.7vw, 1.8rem); }
.games-game-title h1, .games-simple h1 { font-size: clamp(2.1rem, 4.25vw, 4.65rem); }
.games-game-title p, .games .games-simple-meta { margin-top: .46rem; color: var(--game-muted); }
.games-theme {
    display: inline-block;
    padding: .15rem .46rem;
    margin-right: .3rem;
    border-radius: 4px;
    background: var(--theme-bg);
    color: var(--theme-ink);
    font-size: .86rem;
    font-weight: 700;
}
.games-play-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .85fr); gap: clamp(1.25rem, 4.5vw, 4rem); align-items: start; }
.games-workspace { min-width: 0; }
.games-word-progress { display: grid; gap: .35rem; margin-bottom: .7rem; color: var(--theme-ink); font-size: .9rem; font-weight: 700; }
.games-word-progress progress { appearance: none; width: 100%; height: .43rem; border: 0; border-radius: 4px; overflow: hidden; background: var(--theme-bg); accent-color: var(--theme-ink); }
.games-word-progress progress::-webkit-progress-bar { background: var(--theme-bg); }
.games-word-progress progress::-webkit-progress-value { background: var(--theme-ink); }
.games-word-progress progress::-moz-progress-bar { background: var(--theme-ink); }
.games-current {
    min-height: 5.8rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .6rem;
    padding: .8rem .85rem;
    border: 1px solid var(--game-rule);
    border-bottom: 0;
    background: var(--theme-bg);
    line-height: 1.38;
}
.games-current-direction { font-size: .84rem; font-weight: 700; color: var(--theme-ink); }
.games .games-current-clue { margin-top: .22rem; font-size: clamp(.98rem, 1.75vw, 1.12rem); }
.games-clue-navigation { display: flex; gap: .25rem; flex: none; }
.games .games-mini-button {
    display: grid;
    place-items: center;
    border: 1px solid #7c8295;
    background: var(--game-sheet);
    color: var(--theme-ink);
    border-radius: 4px;
    min-width: 2.4rem;
    min-height: 2.55rem;
    padding: .2rem .42rem;
    font-size: .88rem;
    font-weight: 650;
}
.games-mini-button svg { width: 1rem; height: 1rem; }
.games-mini-prev svg { transform: rotate(180deg); }
.games .games-mini-button:not(:disabled):hover { background: var(--game-honey); }
.games-mini-button:disabled { opacity: .55; }
.games-board { padding: 2px; background: var(--game-ink); border: 1px solid var(--game-ink); }
.games-board-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1px; }
.games-board-row + .games-board-row { margin-top: 1px; }
.games-square { position: relative; display: grid; aspect-ratio: 1; min-width: 0; min-height: 0; }
.games-square button {
    display: grid;
    position: absolute;
    inset: 0;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    line-height: 1.02;
    color: var(--game-ink);
    touch-action: manipulation;
}
.games-square-letter button { background: var(--game-sheet); font-weight: 700; font-size: clamp(1.05rem, 3vw, 1.7rem); }
.games-square-letter .is-in-word { background: var(--theme-bg); }
.games-square-letter .is-current { background: var(--game-honey); box-shadow: inset 0 0 0 2px var(--game-rust); }
.games-square button:focus-visible { outline: 2px solid var(--game-rust); outline-offset: -3px; }
.games-square-letter .is-revealed { color: #2c5b46; }
.games-square-letter .is-incorrect { color: #93323b; text-decoration: underline wavy; text-underline-offset: 2px; }
.games-square-number { position: absolute; top: 2px; left: 2px; font-size: clamp(.52rem, 1.55vw, .7rem); font-weight: 650; color: var(--game-muted); font-variant-numeric: tabular-nums; }
.games-square-arrow button {
    align-content: center;
    gap: 2px;
    padding: 1px 2px;
    background: var(--theme-bg);
    color: var(--game-ink);
    font-size: clamp(.53rem, 1.3vw, .71rem);
    font-weight: 700;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
.games-square-clue-id { display: none; }
.games-square-arrow button.is-solved { color: #284c3a; background: #dcecdf; }
.games-square-arrow button[aria-pressed="true"] { background: var(--game-honey); }
.games-arrow { display: flex; color: var(--game-rust); }
.games-arrow svg { width: clamp(.65rem, 2vw, .88rem); height: clamp(.65rem, 2vw, .88rem); }
.games-arrow-down { transform: rotate(90deg); }

.games-keyboard { display: grid; gap: .3rem; margin-top: .8rem; }
.games-key-row { display: flex; justify-content: center; gap: .24rem; }
.games-key-row button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    max-width: 3.15rem;
    padding: 0;
    border: 1px solid #7c8295;
    border-radius: 4px;
    background: var(--game-sheet);
    color: var(--game-ink);
    font-weight: 650;
    touch-action: manipulation;
}
.games-key-row button:hover, .games-key-row button:active { background: var(--game-mist); }
.games-key-row .games-key-delete { flex: 1.75 1 0; max-width: 5.4rem; font-size: .87rem; }
.games-game-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
.games .games-result { min-height: 1.7em; margin-top: .45rem; color: var(--game-rust); }
.games-completed { margin-top: .65rem; padding: clamp(1rem, 2.5vw, 1.5rem); border: 1px solid var(--game-rule); border-radius: 4px; background: var(--theme-bg); }
.games-completed.is-fresh { animation: games-finish .55s cubic-bezier(.16, 1, .3, 1); }
@keyframes games-finish { from { background-color: var(--game-honey); } }
.games-completed p { margin: .4rem 0 .65rem; }
.games-completed .games-game-actions { align-items: center; gap: .55rem 1.1rem; }
.games-notes { border-top: 1px solid var(--game-rule); padding-top: .85rem; }
.games-notes h2 { font-size: clamp(1.65rem, 2.7vw, 2.2rem); }
.games-clue-list h3 { margin: .8rem 0 .3rem; font-size: .9rem; font-weight: 700; color: var(--game-accent); }
.games .games-clue-list ul { list-style: none; padding: 0; margin: 0; }
.games-clue-list li { margin-bottom: .15rem; }
.games .games-clue-button {
    width: 100%;
    display: grid;
    grid-template-columns: 1.55rem minmax(0, 1fr) .85rem;
    gap: .44rem;
    align-items: baseline;
    min-height: 44px;
    padding: .42rem .48rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--game-ink);
    line-height: 1.42;
    text-align: left;
}
.games-clue-button:hover { background: var(--game-sheet); }
.games-clue-button[aria-pressed="true"] { border-color: #7c8295; background: var(--game-mist); }
.games-clue-number { color: var(--game-accent); font-size: .86rem; font-weight: 700; }
.games-clue-button small { color: var(--game-muted); white-space: nowrap; }
.games-clue-solved {
    position: relative;
    display: block;
    align-self: center;
    width: .68rem;
    height: .42rem;
    border-inline-start: 2px solid #2d594b;
    border-block-end: 2px solid #2d594b;
    transform: rotate(-45deg);
}
.games-help, .games-progress { margin-top: .95rem; padding-top: .75rem; border-top: 1px solid var(--game-rule); }
.games-help summary { cursor: pointer; color: var(--game-accent); font-weight: 700; }
.games-help p { margin: .55rem 0; font-size: .95rem; color: var(--game-muted); }
.games-progress { display: grid; justify-items: start; gap: .22rem; color: var(--game-muted); font-size: .93rem; font-variant-numeric: tabular-nums; }
.games-dialog { max-width: min(440px, 100% - 30px); padding: 1.2rem; border: 1px solid var(--game-rule); border-radius: 4px; background: var(--game-sheet); color: var(--game-ink); }
.games-dialog p { margin-top: .55rem; }
.games-dialog::backdrop { background: #232b3e75; }

.games-simple { max-width: 720px; }
.games-simple > p { margin-top: .85rem; max-width: 62ch; }
.games-simple > .games-button { margin-top: 1.3rem; }
.games-access-panel { margin-top: 1.45rem; padding: clamp(1rem, 3vw, 1.75rem); border: 1px solid var(--game-rule); background: var(--game-sheet); }
.games-simple[data-game-theme] .games-access-panel { border-radius: 4px; background: var(--theme-bg); }
.games-access-panel h2 { font-size: clamp(1.4rem, 3vw, 2.25rem); }
.games-access-panel p { margin: .7rem 0; line-height: 1.5; }
.games-access-panel ol { margin: 0; padding-left: 1.4rem; }
.games-access-panel li { padding-bottom: .4rem; }
.games-code-form { display: grid; justify-items: start; gap: .65rem; margin-top: 1rem; }
.games-code-form input { width: min(100%, 28rem); padding: .62rem; color: var(--game-ink); background: var(--game-sheet); border: 1px solid #7c8295; border-radius: 4px; }
.games-checkout-form .games-help { margin-top: .15rem; }
.games-checkout-form input[type="checkbox"] { width: auto; margin-right: .35rem; }
.games-sale-terms { white-space: pre-line; overflow-wrap: anywhere; max-width: 65ch; }
.games .games-notice { margin: 1rem 0; padding: .75rem; border: 1px solid #9b7849; background: var(--game-linen); color: var(--game-ink); }

.games-embedded { margin: 0; background: #f7f5f1; }
.games-embedded .games { padding-top: .9rem; }
.games-embedded .games-back { margin-bottom: .55rem; }

@media (max-width: 740px) {
    .games, .games-player { width: calc(100% - 24px); }
    .games-hero h1 { font-size: clamp(2.25rem, 7vw, 3.55rem); }
    .games-hero-copy p { margin: .72rem 0 .95rem; }
    .games-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .games-play-layout { grid-template-columns: minmax(0, 1fr); max-width: 540px; margin-inline: auto; }
    .games-current { min-height: 5rem; }
}

@media (max-width: 580px) {
    .games-hero, .games .games-list { grid-template-columns: minmax(0, 1fr); }
    .games-hero-copy { padding: 1.2rem 1rem 1.35rem; }
    .games-cover { padding: 1.15rem 1rem 1.3rem; }
    .games-cover-grid { width: min(100%, 10.4rem); padding: 4px; }
    .games-filters .games-button { grid-column: 1 / -1; }
    .games .games-list-link { padding-inline: .2rem; }
    .games-square-short { display: none; }
    .games-square-clue-id { display: block; font-size: .68rem; }
    .games-square-arrow button { gap: 0; }
}

@media (max-width: 360px) {
    .games-filters { grid-template-columns: minmax(0, 1fr); }
    .games-current { display: grid; padding-inline: .6rem; }
    .games-clue-navigation { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
    .games-completed.is-fresh { animation: none; }
}
