:root {
    --k56fpg-navy: #17234b;
    --k56fpg-turquoise: #20bfc4;
    --k56fpg-turquoise-dark: #087f89;
    --k56fpg-sky: #eef9fb;
    --k56fpg-line: #bfe5ea;
    --k56fpg-green: #18794e;
    --k56fpg-green-soft: #e9f8ef;
    --k56fpg-amber: #f5ae28;
    --k56fpg-radius: 24px;
}

body.k56p-game-launch-view {
    margin: 0;
    background: #f4fafb;
    color: var(--k56fpg-navy);
    font-family: "Nunito", "Aptos", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.k56p-game-launch {
    width: min(100%, 1080px);
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.k56p-game-launch > header,
.k56p-game-launch > p:last-child {
    display: none;
}

.k56fpg-shell {
    box-sizing: border-box;
    width: 100%;
    min-height: calc(100dvh - 40px);
    padding: clamp(18px, 3vw, 34px);
    border: 1px solid var(--k56fpg-line);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 16px 50px rgba(23, 35, 75, .10);
}

.k56fpg-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.k56fpg-eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--k56fpg-turquoise-dark);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.k56fpg-heading h2,
.k56fpg-success h2,
.k56fpg-next h2 {
    margin: 0;
    color: var(--k56fpg-navy);
    font-size: clamp(30px, 5vw, 48px);
    line-height: 1.05;
}

.k56fpg-heading p,
.k56fpg-next > p {
    margin: 8px 0 0;
    color: #5a6380;
    font-size: clamp(16px, 2vw, 19px);
}

.k56fpg-clock {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 0 8px;
    min-width: 112px;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--k56fpg-sky);
    color: var(--k56fpg-navy);
}

.k56fpg-clock > span { grid-row: 1 / span 2; color: var(--k56fpg-turquoise-dark); font-size: 25px; }
.k56fpg-clock strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.k56fpg-clock small { color: #66708b; font-size: 11px; }

.k56fpg-feedback {
    min-height: 0;
    margin-bottom: 14px;
    border-radius: 14px;
    font-weight: 800;
}
.k56fpg-feedback:not(:empty) { min-height: 24px; padding: 12px 15px; background: var(--k56fpg-sky); }
.k56fpg-feedback[data-type="success"] { background: var(--k56fpg-green-soft); color: var(--k56fpg-green); }
.k56fpg-feedback[data-type="try"] { background: #fff5df; color: #815400; }
.k56fpg-feedback[data-type="error"], .k56fpg-error { background: #fdeaea; color: #8e2222; }

.k56fpg-game.is-busy { opacity: .65; pointer-events: none; }

.k56fpg-memory-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.k56fpg-memory-meta span {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--k56fpg-sky);
}

.k56fpg-memory {
    display: grid;
    grid-template-columns: repeat(var(--k56fpg-columns, 4), minmax(0, 1fr));
    gap: clamp(8px, 1.8vw, 16px);
}

.k56fpg-memory-card {
    position: relative;
    min-height: clamp(76px, 15vw, 130px);
    padding: 8px;
    border: 2px solid var(--k56fpg-line);
    border-radius: 18px;
    background: linear-gradient(145deg, #edf9fb, #cbeff2);
    color: var(--k56fpg-navy);
    cursor: pointer;
    box-shadow: 0 7px 18px rgba(23, 35, 75, .08);
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.k56fpg-memory-card:hover { transform: translateY(-2px); border-color: var(--k56fpg-turquoise); }
.k56fpg-memory-card:focus-visible,
.k56fpg-word-cell:focus-visible,
.k56fpg-question button:focus-visible,
.k56fpg-button:focus-visible {
    outline: 3px solid var(--k56fpg-turquoise-dark);
    outline-offset: 3px;
}
.k56fpg-memory-card.is-preview,
.k56fpg-memory-card.is-matched { background: #fff; border-color: var(--k56fpg-turquoise); }
.k56fpg-memory-card.is-matched { background: var(--k56fpg-green-soft); border-color: #67bd8f; }
.k56fpg-card-back {
    display: grid;
    place-items: center;
    min-height: 100%;
    font-size: clamp(19px, 4vw, 32px);
    font-weight: 1000;
    letter-spacing: .04em;
    color: var(--k56fpg-turquoise-dark);
}
.k56fpg-card-front { display: grid; place-items: center; gap: 3px; }
.k56fpg-card-front[hidden] { display: none; }
.k56fpg-memory-card.is-preview .k56fpg-card-back,
.k56fpg-memory-card.is-matched .k56fpg-card-back { display: none; }
.k56fpg-card-front:not(.has-text) b { font-size: clamp(28px, 7vw, 52px); line-height: 1; }
.k56fpg-card-front img { display: block; width: min(100%, 110px); aspect-ratio: 1; object-fit: contain; }
.k56fpg-card-front small { font-size: clamp(10px, 2vw, 14px); font-weight: 900; }

.k56fpg-word-layout {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(210px, .55fr);
    gap: clamp(20px, 4vw, 42px);
    align-items: start;
}
.k56fpg-word-grid {
    display: grid;
    grid-template-columns: repeat(var(--k56fpg-size), minmax(0, 1fr));
    gap: 4px;
    width: min(100%, 560px);
    padding: clamp(5px, 1.5vw, 12px);
    border-radius: 22px;
    background: var(--k56fpg-sky);
    touch-action: none;
    user-select: none;
    box-sizing: border-box;
}
.k56fpg-word-cell {
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: clamp(7px, 2vw, 13px);
    background: #fff;
    color: var(--k56fpg-navy);
    font-family: inherit;
    font-size: clamp(17px, 5vw, 28px);
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px var(--k56fpg-line);
}
.k56fpg-word-cell.is-selected,
.k56fpg-word-cell.is-preview { background: #fff2cc; box-shadow: inset 0 0 0 3px var(--k56fpg-amber); }
.k56fpg-word-cell.is-found { background: var(--k56fpg-green-soft); color: var(--k56fpg-green); box-shadow: inset 0 0 0 3px #67bd8f; }
.k56fpg-word-list { padding: 4px 0; }
.k56fpg-word-list h3 { margin: 0 0 10px; font-size: 22px; }
.k56fpg-word-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.k56fpg-word-list li { display: flex; gap: 8px; align-items: center; min-height: 42px; padding: 6px 12px; border-radius: 12px; background: var(--k56fpg-sky); font-weight: 900; letter-spacing: .06em; }
.k56fpg-word-list li.is-found { background: var(--k56fpg-green-soft); color: var(--k56fpg-green); text-decoration: line-through; }
.k56fpg-word-list p { color: #68718a; line-height: 1.5; }

.k56fpg-reading { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(20px, 4vw, 42px); }
.k56fpg-story { padding: clamp(18px, 3vw, 28px); border-radius: 20px; background: var(--k56fpg-sky); }
.k56fpg-story h3 { margin: 0 0 12px; font-size: clamp(23px, 3vw, 31px); }
.k56fpg-story p { margin: 0 0 12px; font-size: clamp(17px, 2vw, 20px); line-height: 1.65; }
.k56fpg-questions { display: grid; gap: 16px; }
.k56fpg-question { margin: 0; padding: 16px; border: 1px solid var(--k56fpg-line); border-radius: 18px; }
.k56fpg-question legend { padding: 0 4px; font-size: 17px; font-weight: 900; }
.k56fpg-question legend span { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 8px; border-radius: 50%; background: var(--k56fpg-turquoise); color: #fff; }
.k56fpg-question button {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-top: 9px;
    padding: 10px 14px;
    border: 1px solid var(--k56fpg-line);
    border-radius: 13px;
    background: #fff;
    color: var(--k56fpg-navy);
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}
.k56fpg-question button:hover { border-color: var(--k56fpg-turquoise); background: var(--k56fpg-sky); }
.k56fpg-question.is-correct { background: var(--k56fpg-green-soft); border-color: #67bd8f; }
.k56fpg-correct-label { margin: 10px 0 0; color: var(--k56fpg-green); font-weight: 900; }

.k56fpg-success,
.k56fpg-next {
    display: grid;
    place-items: center;
    min-height: min(650px, calc(100dvh - 80px));
    padding: clamp(24px, 6vw, 70px);
    border-radius: var(--k56fpg-radius);
    text-align: center;
    box-sizing: border-box;
}
.k56fpg-success { background: var(--k56fpg-green-soft); border: 2px solid #77c99c; }
.k56fpg-success-mark { display: grid; place-items: center; width: 86px; height: 86px; border-radius: 50%; background: var(--k56fpg-green); color: #fff; font-size: 52px; font-weight: 1000; }
.k56fpg-success > p { margin: 4px 0 0; font-size: 18px; color: #436352; }
.k56fpg-success-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: min(100%, 620px); margin: 24px 0; }
.k56fpg-success-stats > div { padding: 16px 10px; border-radius: 15px; background: #fff; }
.k56fpg-success-stats strong { display: block; color: var(--k56fpg-green); font-size: clamp(25px, 5vw, 36px); }
.k56fpg-success-stats span { display: block; margin-top: 3px; color: #576b60; font-size: 13px; font-weight: 800; }
.k56fpg-reward-note { max-width: 620px; }
.k56fpg-next { background: #fff; border: 1px solid var(--k56fpg-line); }
.k56fpg-next-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(100%, 680px); margin-top: 24px; }
.k56fpg-next-actions > :last-child { grid-column: 1 / -1; }
.k56fpg-replay { margin: 0; }

.k56fpg-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 15px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}
.k56fpg-button--primary { background: var(--k56fpg-turquoise); color: var(--k56fpg-navy); }
.k56fpg-button--secondary { background: var(--k56fpg-navy); color: #fff; }
.k56fpg-button--quiet { border-color: var(--k56fpg-line); background: #fff; color: var(--k56fpg-navy); }

@media (max-width: 720px) {
    .k56p-game-launch { padding: 8px; }
    .k56fpg-shell { min-height: calc(100dvh - 16px); padding: 16px; border-radius: 20px; }
    .k56fpg-heading { align-items: center; }
    .k56fpg-heading h2 { font-size: clamp(27px, 8vw, 36px); }
    .k56fpg-heading p { font-size: 15px; }
    .k56fpg-clock { min-width: 88px; padding: 8px 10px; }
    .k56fpg-clock > span { display: none; }
    .k56fpg-memory { gap: 7px; }
    .k56fpg-memory.has-avatar-motifs .k56fpg-memory-card { width: 100%; min-width: 0; box-sizing: border-box; aspect-ratio: 1; }
    .k56fpg-memory-card { min-height: 68px; border-radius: 12px; }
    .k56fpg-card-front small { display: none; }
    .k56fpg-word-layout,
    .k56fpg-reading { grid-template-columns: 1fr; }
    .k56fpg-word-grid { width: 100%; padding: 5px; gap: 3px; border-radius: 14px; }
    .k56fpg-word-list { order: -1; }
    .k56fpg-word-list p { margin-bottom: 6px; font-size: 14px; }
    .k56fpg-word-list ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .k56fpg-word-list li { min-height: 38px; }
    .k56fpg-story { padding: 16px; }
    .k56fpg-question { padding: 13px; }
    .k56fpg-success,
    .k56fpg-next { min-height: calc(100dvh - 32px); padding: 22px 14px; }
    .k56fpg-success-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .k56fpg-success-stats > div:last-child { grid-column: 1 / -1; }
    .k56fpg-next-actions { grid-template-columns: 1fr; }
    .k56fpg-next-actions > :last-child { grid-column: auto; }
}

@media (max-width: 360px) {
    .k56fpg-shell { padding: 12px; }
    .k56fpg-heading { gap: 8px; }
    .k56fpg-clock { min-width: 72px; }
    .k56fpg-card-front:not(.has-text) b { font-size: 26px; }
    .k56fpg-word-cell { border-radius: 7px; }
}

@media (prefers-reduced-motion: reduce) {
    .k56fpg-memory-card { transition: none; }
}

/* Text and picture cards share one board; each face has one typography owner. */
.k56fpg-card-front.has-text b { font-size: clamp(16px, 2vw, 21px); line-height: 1.35; overflow-wrap: anywhere; }
.k56fpg-memory.has-text-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.k56fpg-forest [hidden] { display: none; }
.k56fpg-forest .forest-cue { font-size: 64px; line-height: 1.4; text-align: center; }
.k56fpg-forest .forest-settings { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin-bottom: 18px; }
.k56fpg-forest .forest-settings label { display: grid; gap: 6px; }
.k56fpg-forest .forest-report { width: 100%; border-collapse: collapse; }
.k56fpg-forest .forest-report th, .k56fpg-forest .forest-report td { padding: 10px; border-bottom: 1px solid var(--k56fpg-line); text-align: left; }
@media(max-width:720px) { .k56fpg-memory.has-text-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
