:root {
    color-scheme: light;
    --ink: #17152b;
    --muted: #68657c;
    --purple: #7455ee;
    --blue: #3e8ef7;
    --cyan: #42d5dd;
    --cream: #fbfaff;
    --line: rgba(61, 48, 106, 0.12);
    --surface: #ffffff;
    --card: #fcfbff;
    --control: rgba(255, 255, 255, .75);
    --board: rgba(255, 255, 255, .62);
    --board-line: rgba(255, 255, 255, .85);
    --chip: rgba(255, 255, 255, .78);
    --chip-ink: #393254;
    --chip-line: rgba(255, 255, 255, .8);
    --store-ink: #ffffff;
    --store-background: #17152b;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --ink: #f4f1ff;
        --muted: #bbb5ce;
        --purple: #aa91ff;
        --blue: #71adff;
        --cyan: #69e3e8;
        --cream: #12101f;
        --line: rgba(218, 208, 255, .15);
        --surface: #191626;
        --card: #211d31;
        --control: rgba(36, 31, 52, .85);
        --board: rgba(31, 27, 47, .72);
        --board-line: rgba(224, 215, 255, .15);
        --chip: rgba(35, 30, 52, .86);
        --chip-ink: #f0ebff;
        --chip-line: rgba(224, 215, 255, .18);
        --store-ink: #17152b;
        --store-background: #f4f1ff;
    }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 88% 10%, rgba(86, 202, 239, .20), transparent 24rem),
        radial-gradient(circle at 10% 17%, rgba(159, 105, 245, .17), transparent 28rem),
        var(--cream);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 10px 14px; border-radius: 10px; color: var(--surface); background: var(--ink); font-weight: 700; text-decoration: none; transform: translateY(calc(-100% - 20px)); }
.skip-link:focus { transform: translateY(0); }
:where(a, select):focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.beta-banner { padding: 10px 20px; color: white; background: linear-gradient(90deg, #5e3ed3, #397fe5 55%, #168e9c); }
.beta-banner a { max-width: 1160px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 14px; text-align: center; text-decoration: none; font-size: .9rem; }
.beta-banner-badge { padding: 5px 9px; border: 1px solid rgba(255,255,255,.42); border-radius: 999px; background: rgba(255,255,255,.14); font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.beta-banner strong { white-space: nowrap; }
.beta-banner a:hover strong { text-decoration: underline; }
.site-header {
    width: min(1160px, calc(100% - 40px));
    margin: 0 auto;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; text-decoration: none; font-size: 1.12rem; }
.brand img { display: block; border-radius: 10px; box-shadow: 0 5px 15px rgba(60, 42, 120, .18); }
.language-picker select { width: 18rem; max-width: 100%; padding: 9px 30px 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--control); font: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[dir="rtl"] .copyright { margin-left: 0; margin-right: auto; }
[dir="rtl"] .puzzle-board { transform: rotate(3deg); }
[dir="rtl"] .skip-link { right: 12px; left: auto; }
[dir="rtl"] .beta-card ul { padding-right: 1.25rem; padding-left: 0; }
nav { display: flex; align-items: center; gap: 30px; }
nav a { color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 600; }
nav a:hover { color: var(--ink); }
.hero {
    width: min(1160px, calc(100% - 40px));
    min-height: 680px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 70px;
    padding: 60px 0 100px;
}
.eyebrow { margin: 0 0 15px; color: var(--purple); font-size: .78rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1 { max-width: 650px; margin: 0; font-size: clamp(3.7rem, 6.5vw, 6.5rem); line-height: .92; letter-spacing: -.068em; }
h1 span { color: var(--purple); }
.lede { max-width: 570px; margin: 28px 0 0; color: var(--muted); font-size: clamp(1.15rem, 2vw, 1.42rem); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 34px; }
.store-button { display: inline-flex; align-items: center; gap: 10px; min-width: 178px; padding: 10px 17px; border-radius: 13px; color: var(--store-ink); background: var(--store-background); font-size: 1.16rem; font-weight: 600; line-height: 1.05; box-shadow: 0 12px 30px rgba(23, 21, 43, .18); }
a.store-button { text-decoration: none; }
a.store-button:hover { filter: brightness(1.1); }
a.store-button:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }
.store-button svg { width: 28px; fill: currentColor; }
.store-button small { display: block; font-size: .62rem; font-weight: 500; margin-bottom: 3px; }
.text-link { color: var(--purple); font-weight: 700; text-decoration: none; }

.puzzle-stage { position: relative; min-height: 520px; display: grid; place-items: center; }
.glow { position: absolute; width: 90%; height: 90%; border-radius: 50%; background: linear-gradient(135deg, rgba(103, 196, 250, .33), rgba(159, 96, 241, .28)); filter: blur(25px); }
.puzzle-board { position: relative; width: min(430px, 82vw); aspect-ratio: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 12px; border-radius: 38px; background: var(--board); box-shadow: 0 35px 90px rgba(57, 38, 121, .22), inset 0 0 0 1px var(--board-line); transform: rotate(-3deg); backdrop-filter: blur(16px); }
.tile { position: relative; border-radius: 21px; background: linear-gradient(135deg, #5598ea, #8056df 60%, #ac79e8); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 5px 10px rgba(40, 34, 92, .12); }
.tile:nth-child(3n + 2) { background: linear-gradient(145deg, #7988ee, #925ce0 65%, #c082e9); }
.tile:nth-child(3n) { background: linear-gradient(125deg, #58b7d3, #7660d9 60%, #966ce4); }
.tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background-image: var(--piece-image, url("assets/chiki-puzzle.jpeg")); background-size: var(--piece-size, 335.403727% 419.254658%); background-position: var(--piece-x) var(--piece-y); background-repeat: no-repeat; opacity: 0; transition: opacity 900ms ease; }
.image-ready .tile::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .tile::after { transition: none; } }
/* Map the nine 322px pieces from the supplied 1080 × 1350 image. */
.t1, .t4, .t7 { --piece-x: 7.124011%; }
.t2, .t5, .t8 { --piece-x: 50%; }
.t3, .t6, .t9 { --piece-x: 93.007916%; }
.t1, .t2, .t3 { --piece-y: 18.093385%; }
.t4, .t5, .t6 { --piece-y: 49.708171%; }
.t7, .t8, .t9 { --piece-y: 81.420233%; }
.t9 { transform: translate(23px, 18px) rotate(8deg); box-shadow: 0 18px 28px rgba(40, 34, 92, .26); }
.floating-chip { position: absolute; padding: 12px 17px; border: 1px solid var(--chip-line); border-radius: 999px; color: var(--chip-ink); background: var(--chip); box-shadow: 0 12px 34px rgba(41,31,81,.13); backdrop-filter: blur(14px); font-weight: 700; font-size: .86rem; }
.chip-one { top: 48px; right: -10px; transform: rotate(4deg); }.chip-two { bottom: 47px; left: -20px; transform: rotate(-4deg); }

.intro { padding: 110px max(20px, calc((100vw - 1160px)/2)); background: var(--surface); text-align: center; }
h2 { margin: 0; font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1; letter-spacing: -.055em; }
.feature-grid { margin-top: 62px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; text-align: start; }
.feature-grid article { padding: 30px; border: 1px solid var(--line); border-radius: 26px; background: var(--card); }
.feature-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; font-size: 1.5rem; font-weight: 800; }
.photo { color: #2b78dd; background: #e7f2ff; }.sparkle { color: #7e4ddb; background: #f1e9ff; }.grid { color: #007f89; background: #ddf9fa; }.library { color: #d25279; background: #ffe9f0; }
@media (prefers-color-scheme: dark) {
    .photo { color: #8bc0ff; background: #183452; }
    .sparkle { color: #c5a9ff; background: #352753; }
    .grid { color: #7be5eb; background: #173d40; }
    .library { color: #ff9dbc; background: #4a2432; }
}
h3 { margin: 23px 0 10px; font-size: 1.16rem; }
.feature-grid p { margin: 0; color: var(--muted); line-height: 1.62; font-size: .96rem; }

.experiments { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 120px 0 30px; }
.experiment-intro { display: grid; grid-template-columns: minmax(260px, .8fr) 1.2fr; column-gap: 70px; align-items: start; }
.experiment-intro .eyebrow { grid-column: 1 / -1; }
.experiment-intro h2 { max-width: 570px; }
.experiment-intro > p:last-child { margin: 4px 0 0; max-width: 560px; }
.experiment-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 75px; border: 1px solid var(--line); border-radius: 32px; overflow: hidden; background: var(--line); }
.experiment-grid article { padding: 38px; background: var(--card); }
.experiment-grid h3 { margin: 13px 0 11px; font-size: 1.3rem; }
.experiment-grid p { margin: 0; color: var(--muted); line-height: 1.65; }
.experiment-grid ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.experiment-grid li { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: .78rem; font-weight: 650; }
.experiment-grid li:has(a) { padding: 0; }
.experiment-grid li a { display: block; padding: 7px 10px; color: var(--purple); text-decoration: none; }
.experiment-grid li a:hover { text-decoration: underline; }
.experiment-number { color: var(--purple); font-size: .75rem; font-weight: 800; letter-spacing: .13em; }

.beta { width: min(1160px, calc(100% - 40px)); margin: 110px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 70px; align-items: center; }
.beta-copy h2 { max-width: 650px; font-size: clamp(2.4rem, 4.8vw, 4.2rem); }
.beta-copy > p:not(.eyebrow) { max-width: 600px; color: var(--muted); line-height: 1.7; }
.beta-card { padding: 38px; border: 1px solid var(--line); border-radius: 32px; background: var(--card); box-shadow: 0 24px 60px rgba(57, 38, 121, .10); }
.beta-card h3 { margin-top: 0; font-size: 1.45rem; }
.beta-card > p, .beta-card li { color: var(--muted); line-height: 1.6; }
.beta-card ul { margin: 18px 0 28px; padding-left: 1.25rem; }
.beta-card li + li { margin-top: 9px; }
.beta-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 21px; border-radius: 999px; color: white; background: var(--purple); text-decoration: none; font-weight: 750; box-shadow: 0 12px 28px rgba(80, 55, 175, .22); }
.beta-button:hover { filter: brightness(1.08); }
.beta-guide-link { display: block; width: fit-content; margin-top: 16px; color: var(--muted); font-size: .84rem; font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.beta-guide-link:hover { color: var(--text); }
.beta-card .privacy-note { margin: 18px 0 0; font-size: .8rem; }

.cta { width: min(1160px, calc(100% - 40px)); margin: 110px auto; padding: 65px; border-radius: 38px; background: linear-gradient(135deg, #262040, #4a367b); color: white; display: flex; align-items: center; justify-content: space-between; gap: 40px; overflow: hidden; position: relative; }
.cta::after { content: ""; position: absolute; width: 330px; height: 330px; right: -100px; top: -160px; border-radius: 50%; background: rgba(99, 213, 238, .2); }
.cta .eyebrow { color: #8deaf1; }.cta h2 { max-width: 660px; font-size: clamp(2.2rem, 4.5vw, 4rem); }.cta p:not(.eyebrow) { color: #d9d3e9; line-height: 1.6; }
.socials { min-width: 220px; display: grid; gap: 12px; position: relative; z-index: 1; }
.socials a { padding: 15px 20px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; text-align: center; text-decoration: none; font-weight: 700; background: rgba(255,255,255,.09); }
.socials a:hover { background: rgba(255,255,255,.17); }
.socials span { margin-right: 5px; }

footer { width: min(1160px, calc(100% - 40px)); margin: 0 auto; min-height: 120px; padding: 28px 0; display: flex; align-items: center; gap: 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.footer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; }
.footer-links.footer-link-rows { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.footer-site-links { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.footer-social-icons { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.footer-social-link { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: inherit; text-decoration: none; }
.footer-social-link svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
.footer-social-link:hover { background: var(--line); }
.footer-social-link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.footer-brand { color: var(--ink); }.copyright { margin-left: auto; } footer a:hover { color: var(--ink); }

.legal { width: min(720px, calc(100% - 40px)); margin: 80px auto 120px; }
.open-page { width: min(760px, calc(100% - 40px)); min-height: calc(100vh - 208px); margin: 0 auto; padding: 80px 0 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.open-page h1 { max-width: 720px; font-size: clamp(3rem, 8vw, 5.8rem); }
.open-page .lede { max-width: 590px; }
.open-page-icon { display: block; margin-bottom: 28px; }
.open-page-icon img { display: block; border-radius: 25px; box-shadow: 0 20px 55px rgba(60, 42, 120, .22); }
.open-app-button { display: inline-flex; align-items: center; justify-content: center; margin-top: 34px; padding: 15px 25px; border-radius: 999px; color: white; background: var(--purple); text-decoration: none; font-weight: 750; box-shadow: 0 12px 28px rgba(80, 55, 175, .22); }
.open-app-button:hover { filter: brightness(1.08); }
.store-badges { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 12px; max-width: 100%; }
.store-badges .store-button { flex: 0 1 auto; text-align: start; max-width: 100%; }
.store-badges .store-button svg { flex-shrink: 0; }
.store-badges .store-button small { line-height: 1.5; }
.open-page-stores { margin-top: 24px; }
.legal h1 { font-size: clamp(3rem, 8vw, 5rem); overflow-wrap: anywhere; }.legal h2 { margin-top: 44px; font-size: 1.5rem; letter-spacing: -.025em; }.legal p, .legal li { color: var(--muted); line-height: 1.75; }.legal .updated { margin: 20px 0 50px; }

@media (max-width: 850px) {
    nav { display: none; }
    .hero { grid-template-columns: 1fr; gap: 15px; padding-top: 70px; text-align: center; }
    .hero-copy { display: grid; justify-items: center; }.hero-actions { justify-content: center; }.puzzle-stage { min-height: 500px; }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .experiment-intro { grid-template-columns: 1fr; gap: 24px; }
    .beta { grid-template-columns: 1fr; gap: 36px; }
    .cta { padding: 50px 35px; flex-direction: column; align-items: flex-start; }.socials { width: 100%; grid-template-columns: 1fr 1fr; }
    footer { flex-wrap: wrap; }.copyright { margin-left: 0; }
}
@media (max-width: 540px) {
    .beta-banner a { align-items: flex-start; gap: 7px; flex-direction: column; text-align: left; }
    [dir="rtl"] .beta-banner a { text-align: right; }
    .site-header { height: 74px; }.brand img { width: 36px; height: 36px; }
    .hero { padding-top: 55px; }.hero-actions { flex-direction: column; }.puzzle-stage { min-height: 410px; }.puzzle-board { border-radius: 28px; }.tile { border-radius: 14px; }
    .floating-chip { font-size: .72rem; }.chip-one { right: 0; top: 25px; }.chip-two { left: 0; bottom: 20px; }
    .intro { padding-top: 80px; padding-bottom: 80px; }.feature-grid { grid-template-columns: 1fr; margin-top: 45px; }
    .experiments { padding-top: 85px; }.experiment-grid { grid-template-columns: 1fr; margin-top: 48px; }.experiment-grid article { padding: 30px; }
    .beta { margin-top: 75px; }.beta-card { padding: 28px; }.beta-button { width: 100%; }
    .cta { margin-top: 75px; margin-bottom: 75px; }.socials { grid-template-columns: 1fr; }
    footer { display: grid; gap: 15px; padding: 35px 0; }.footer-links { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Translation reviewer credits */
.credits-page { max-width: 1000px; margin: 60px auto 100px; padding: 0 24px; min-height: 45vh; }
.credits-page h1 { font-size: clamp(2.8rem, 7vw, 5rem); overflow-wrap: anywhere; }
.credits-page .lede { max-width: 720px; }
.credits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 20px; margin-top: 48px; }
.credits-grid:empty { display: none; }
.credits-grid section { padding: 28px; border: 1px solid var(--line); border-radius: 26px; background: var(--card); min-width: 0; }
.credits-grid h2 { margin: 0 0 18px; font-size: 1.25rem; font-weight: 700; }
.credits-grid h2 a { color: inherit; text-decoration: none; font-weight: inherit; }
.credits-grid ul { margin: 0; padding: 0; list-style: none; }
.credits-grid li { color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.credits-grid li + li { margin-top: 8px; }
.credits-grid a { color: var(--purple); text-underline-offset: 3px; }
body[data-page="credits"] { min-height: 100vh; }
body[data-page="credits"] .site-header { gap: 16px; }
body[data-page="credits"] .language-picker { min-width: 0; }
body[data-page="credits"] .language-picker select { width: 100%; }

/* Give connected scripts and stacked vowel marks room in display text. */
html:is(:lang(ta), :lang(te), :lang(gu), :lang(kn), :lang(ml), :lang(mr), :lang(or), :lang(pa), :lang(ur)) :is(h1, h2, h3, .eyebrow, .beta-banner-badge) { letter-spacing: normal; }
html:is(:lang(ta), :lang(te), :lang(gu), :lang(kn), :lang(ml), :lang(mr), :lang(or), :lang(pa), :lang(ur)) :is(h1, h2) { line-height: 1.35; overflow-wrap: anywhere; }
html:is(:lang(ta), :lang(te), :lang(gu), :lang(kn), :lang(ml), :lang(mr), :lang(or), :lang(pa)) h1 { font-size: clamp(2.2rem, 5vw, 4.7rem); }
html:is(:lang(ta), :lang(te), :lang(gu), :lang(kn), :lang(ml), :lang(mr), :lang(or), :lang(pa)) h2 { font-size: clamp(1.8rem, 4vw, 3.4rem); }
html:is(:lang(ta), :lang(te), :lang(gu), :lang(kn), :lang(ml), :lang(mr), :lang(or), :lang(pa)) .legal h2 { font-size: 1.5rem; }
.site-header { gap: 16px; }
.site-header .brand { flex-shrink: 0; }
.site-header .language-picker { min-width: 0; }
.site-header .language-picker select { width: 18rem; max-width: 100%; }
.site-header nav { flex-wrap: wrap; justify-content: flex-end; gap: 12px 22px; }

/* Isolate the Latin wordmark from right-to-left page layout. */
.brand-word-swap { display: inline-flex; direction: ltr; unicode-bidi: isolate; position: relative; }
.brand-word-swap > span { display: inline-block; flex: none; }

/* Shared hero frame: crossfade puzzle sizes without moving surrounding content. */
.puzzle-board { grid-area: 1 / 1; transition: opacity 800ms ease; }
.puzzle-board--alternate { grid-template-columns: repeat(var(--grid-size), 1fr); opacity: 0; pointer-events: none; }
.puzzle-stage:has(.puzzle-controls) .puzzle-board { opacity: 0; }
.puzzle-stage:has(.puzzle-controls) .puzzle-board.is-active { opacity: 1; }
.puzzle-board--alternate .tile { border-radius: var(--tile-radius); }

.puzzle-controls { position: absolute; bottom: -25px; display: flex; gap: 6px; padding: 5px; border: 1px solid var(--chip-line); border-radius: 999px; background: var(--chip); }
.puzzle-controls button { border: 0; border-radius: 999px; min-width: 44px; min-height: 44px; padding: 8px 12px; font: inherit; font-size: .8rem; font-weight: 700; color: var(--chip-ink); background: transparent; cursor: pointer; }
.puzzle-controls button[aria-pressed="true"] { background: var(--board-line); }
.puzzle-controls button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .puzzle-board { transition: none; } }

/* Fit and gently tilt the caption pill as its text fades with the puzzle. */
.puzzle-caption { box-sizing: border-box; max-width: calc(100% - 20px); transform: rotate(var(--caption-tilt, -4deg)); transform-origin: center; transition: width 800ms ease, height 800ms ease, transform 1100ms cubic-bezier(.22, 1, .36, 1); }
.puzzle-caption > span { position: absolute; inset-inline-start: 17px; top: 12px; width: max-content; opacity: 0; transition: opacity 800ms ease; }
.puzzle-caption > span.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .puzzle-caption, .puzzle-caption > span { transition: none; } }

/* Each showcase settles into its own angle and releases a different piece. */
.puzzle-stage:has(.puzzle-controls) .puzzle-board { transform: rotate(0deg); transition: opacity 800ms ease, transform 1100ms cubic-bezier(.22, 1, .36, 1); }
.puzzle-stage:has(.puzzle-controls) .puzzle-board.is-active { transform: rotate(var(--board-tilt)); }
.puzzle-stage:has(.puzzle-controls) .tile--loose { transform: translate(0, 0) rotate(0deg); transition: transform 1200ms cubic-bezier(.22, 1, .36, 1), box-shadow 800ms ease; }
.puzzle-stage:has(.puzzle-controls) .is-active .tile--loose { transform: translate(var(--loose-x), var(--loose-y)) rotate(var(--loose-turn)); box-shadow: 0 18px 28px rgba(40, 34, 92, .26); }
@media (prefers-reduced-motion: reduce) {
    .puzzle-stage:has(.puzzle-controls) .puzzle-board,
    .puzzle-stage:has(.puzzle-controls) .tile--loose { transition: none; }
}

/* Both labels share the board’s responsive coordinate system. */
.puzzle-frame { position: relative; display: grid; width: min(430px, 82vw, 90%); aspect-ratio: 1; min-width: 0; }
.puzzle-frame .puzzle-board { width: 100%; min-width: 0; }
.puzzle-frame .chip-one { top: 2%; right: -2%; bottom: auto; left: auto; z-index: 2; }
.puzzle-frame .chip-two { bottom: 2%; left: -2%; top: auto; right: auto; z-index: 2; }

/* The count refers to website languages, including regional variants. */
.locale-count-badge { display: inline-block; max-width: 100%; margin: 0; padding: 8px 14px; border: 1px solid var(--purple); border-radius: 999px; color: var(--purple); background: var(--surface); font-size: .875rem; font-weight: 650; line-height: 1.5; letter-spacing: normal; overflow-wrap: anywhere; }

/* Keep the language count beside its picker. */
.language-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.language-controls .language-picker { flex: 0 0 auto; min-width: 0; max-width: 100%; }
.language-controls .locale-count-badge { flex: 0 1 auto; text-align: center; }
@media (max-width: 540px) {
    .site-header:has(.language-controls) { height: auto; min-height: 74px; padding-block: 16px; flex-wrap: wrap; }
    .language-controls { flex: 1 1 100%; justify-content: space-between; }
    .language-controls .language-picker { max-width: 100%; }
    .language-controls .locale-count-badge { max-width: 45%; }
}

/* Preserve full language names; wrap header controls instead of squeezing the select. */
.site-header { height: auto; min-height: 88px; padding-block: 16px; flex-wrap: wrap; }
.site-header > .language-picker { flex: 0 0 auto; max-width: 100%; }
@media (max-width: 540px) { .site-header { min-height: 74px; } }

/* Abbreviate only the collapsed mobile control; native options retain full names. */
.language-picker { position: relative; }
.language-code { display: none; }
@media (max-width: 540px) {
    .site-header:has(.language-controls) { gap: 10px; }
    .language-controls { flex: 0 1 auto; justify-content: flex-end; }
    .language-controls .locale-count-badge { max-width: none; padding-inline: 10px; font-size: .8rem; }
    .site-header .language-picker select { width: 7.5rem; min-height: 44px; appearance: none; color: transparent; }
    .language-picker select option { color: var(--ink); background: var(--control); }
    .language-code { display: block; position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink); font-size: .85rem; font-weight: 650; direction: ltr; pointer-events: none; }
    .language-picker::after { content: ""; position: absolute; inset-inline-end: 13px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
}

.language-picker-group { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.language-favorite { flex: 0 0 36px; width: 36px; min-height: 44px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: inherit; font-size: 1.35rem; cursor: pointer; }
.language-favorite:not([hidden]) { display: inline-grid; place-items: center; }
.language-favorite[aria-pressed="true"] { color: var(--purple); }
.language-favorite:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
@media (max-width: 540px) { .site-header .language-picker select { width: 6rem; padding-inline-start: 10px; padding-inline-end: 23px; } .language-code { inset-inline-start: 10px; font-size: .78rem; } .language-picker::after { inset-inline-end: 9px; } }

button.open-app-button { border: 0; font-family: inherit; font-size: inherit; cursor: pointer; }
.open-app-dialog { width: min(440px, calc(100vw - 40px)); box-sizing: border-box; padding: 28px; border: 0; border-radius: 22px; background: var(--store-background); color: var(--store-ink); box-shadow: 0 24px 80px rgba(0,0,0,.3); text-align: start; }
.open-app-dialog::backdrop { background: rgba(15,12,30,.55); }
.open-app-dialog h2 { margin: 0; font-size: 1.35rem; line-height: 1.4; }
.open-app-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 24px; }
.open-app-dialog-actions .open-app-button { margin: 0; }
.open-app-cancel { padding: 12px 18px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: inherit; cursor: pointer; }

/* Gently introduce app-opening guidance after the fallback delay. */
#open-app-status:not([hidden]) {
    animation: open-app-status-reveal 420ms cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes open-app-status-reveal {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    #open-app-status:not([hidden]) { animation: none; }
}

/* Website Analytics is optional; the two consent choices have equal emphasis. */
.analytics-choice {
    position: fixed; inset-inline: 16px; bottom: 16px; z-index: 1000;
    max-width: 520px; margin-inline: auto; padding: 20px;
    border: 1px solid #c9c3de; border-radius: 18px;
    background: #fff; color: #242035; box-shadow: 0 8px 40px #0002;
    font: 15px/1.5 system-ui, sans-serif;
    max-height: calc(100dvh - 32px); overflow: auto;
}
.analytics-choice[hidden] { display: none; }
html .analytics-choice h2 { margin: 0 0 8px; font-size: 18px; line-height: 1.5; letter-spacing: normal; overflow-wrap: anywhere; }
.analytics-choice p { margin: 0 0 16px; color: inherit; }
.analytics-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.analytics-actions button {
    min-height: 44px; padding: 9px 18px; border-radius: 9px;
    border: 1px solid #7455ee; background: #f3f0ff; color: #392579;
    font: inherit; cursor: pointer;
}
.analytics-choice a { color: #5138aa; }
.analytics-preferences { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.analytics-actions button:focus-visible, .analytics-preferences:focus-visible { outline: 3px solid #7455ee; outline-offset: 4px; }
@media (prefers-color-scheme: dark) {
    .analytics-choice { background: #242035; color: #f5f2ff; border-color: #625776; }
    .analytics-choice a { color: #cbbcff; }
}

.beta-platforms { display: grid; gap: 20px; margin-top: 24px; }
.beta-platform { padding-top: 20px; border-top: 1px solid var(--border, rgba(116,85,238,.18)); }
.beta-platform h4 { margin: 0 0 8px; font-size: 1rem; }
.beta-platform p { margin: 0 0 16px; }
.beta-platform .beta-button { flex-wrap: wrap; text-align: center; }
