/* Find Vegetables 3D - "farmer's market" interface: cream price-tag panels with green ink, chunky painted buttons, a hanging shop sign for the title,
   level tiles drawn as wooden crates. All sizes are in rem; js/game.js sets the root font size from the window size so everything scales together. */
@font-face {
    font-family: "VF Display";
    src: url(../assets/fonts/baloo-2-latin-800-normal.woff2) format("woff2");
    font-weight: 800;
    font-display: swap;
}
@font-face {
    font-family: "VF Text";
    src: url(../assets/fonts/quicksand-latin-700-normal.woff2) format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --ink: #1d4a2a;
    --paper: #fffdf0;
    --paper2: #f3ecc9;
    --red: #e8333a;
    --sun: #ffd23f;
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --hd: "VF Display", "Arial Rounded MT Bold", "Arial Black", sans-serif;
    --bd: "VF Text", "Segoe UI", system-ui, sans-serif;
}
* {
    box-sizing: border-box;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}
html {
    font-size: 14px;
    height: 100%;
    overflow: hidden;
    background: #3fae4c;
}
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
    height: 100%;
    overflow: hidden;
    font-family: var(--bd);
    font-weight: 700;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1.25;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    overscroll-behavior: none;
}
img {
    display: block;
    -webkit-user-drag: none;
}
button {
    font: inherit;
    color: inherit;
    border: 0;
    background: none;
    cursor: pointer;
    padding: 0;
}
[hidden] {
    display: none !important;
}
#stage {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}
#app {
    position: fixed;
    inset: 0;
    pointer-events: none;
}
#night {
    position: absolute;
    inset: 0;
    display: none;
    pointer-events: none;
    background: radial-gradient(
        circle var(--nr, 9rem) at var(--nx, 50%) var(--ny, 50%),
        rgba(6, 3, 30, 0) 0,
        rgba(6, 3, 30, 0) 62%,
        rgba(6, 3, 30, 0.93) 100%
    );
}
#night.on {
    display: block;
}

/* ---------- screens ---------- */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    padding: calc(var(--sat) + 1rem) calc(var(--sar) + 1.2rem) calc(var(--sab) + 1rem) calc(var(--sal) + 1.2rem);
    pointer-events: none;
}
.screen.active {
    display: flex;
    animation: scr 0.35s ease both;
}
@keyframes scr {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
.screen button,
.screen .ticket,
.screen .chip,
.screen .sign {
    pointer-events: auto;
}
#menu.active,
#game.active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    row-gap: 0.8rem;
}
.mid {
    position: relative;
    min-height: 0;
    pointer-events: none;
}
.side-l,
.side-r {
    width: 100%;
    max-width: 46rem;
    justify-self: center;
}

/* ---------- buttons ---------- */
.btn {
    --l: #7fe69b;
    --b: #22b95c;
    --d: #0f7a3a;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 4rem;
    padding: 0 1.1rem;
    border-radius: 1.2rem;
    color: #fff;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.02em;
    line-height: 1;
    background: linear-gradient(180deg, var(--l), var(--b) 66%);
    box-shadow:
        0 0.38rem 0 var(--d),
        0 0.8rem 1rem rgba(10, 40, 10, 0.3),
        inset 0 0.12rem 0 rgba(255, 255, 255, 0.6),
        inset 0 -0.18rem 0.3rem rgba(0, 0, 0, 0.12);
    text-shadow: 0 0.1rem 0 rgba(0, 0, 0, 0.28);
    transition: box-shadow 0.1s;
    pointer-events: auto;
    cursor: pointer;
    top: 0;
}
.btn img {
    width: 2.1rem;
    height: 2.1rem;
    flex: none;
}
.btn span {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}
.btn small {
    font-family: var(--bd);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0;
    text-shadow: 0 0.1rem 0 rgba(0, 0, 0, 0.25);
    opacity: 0.95;
}
.btn:active {
    top: 0.3rem;
    box-shadow:
        0 0.08rem 0 var(--d),
        0 0.2rem 0.4rem rgba(10, 40, 10, 0.3),
        inset 0 0.12rem 0 rgba(255, 255, 255, 0.5);
}
@media (hover: hover) {
    .btn:not(:disabled):hover::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: rgba(255, 255, 255, 0.14);
        pointer-events: none;
    }
}
.btn:focus-visible,
.tile:focus-visible,
.switch:focus-visible,
.ans:focus-visible {
    outline: 0.28rem solid #fff;
    outline-offset: 0.2rem;
}
.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}
.btn:disabled::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(120, 120, 120, 0.55);
}
.b-green {
    --l: #7fe69b;
    --b: #22b95c;
    --d: #0f7a3a;
}
.b-blue {
    --l: #8fd0ff;
    --b: #2f8bff;
    --d: #1650b8;
}
.b-violet {
    --l: #d0b2ff;
    --b: #8a55f0;
    --d: #4d26a6;
}
.b-red {
    --l: #ff9fae;
    --b: #f23d5e;
    --d: #a01634;
}
.b-orange {
    --l: #ffb36b;
    --b: #ff7a1f;
    --d: #b83a05;
}
.b-yellow {
    --l: #ffe27a;
    --b: #ffb41f;
    --d: #b87400;
    color: #5a3300;
    text-shadow: 0 0.1rem 0 rgba(255, 255, 255, 0.5);
}
.b-ink {
    --l: #4d9a5f;
    --b: #256b3a;
    --d: #0f3a1e;
}
.btn.round {
    width: 4.2rem;
    min-height: 4.2rem;
    padding: 0;
    border-radius: 1.3rem;
}
.btn.round img {
    width: 2.2rem;
    height: 2.2rem;
}
.btn.wide {
    width: 100%;
}
.btn.small {
    min-height: 3.4rem;
    font-size: 1.3rem;
    padding: 0 1.1rem;
    border-radius: 1.1rem;
}
.btn.xl {
    min-height: 5.8rem;
    font-size: 2.3rem;
    gap: 1rem;
    border-radius: 1.7rem;
    width: 100%;
    box-shadow:
        0 0.5rem 0 var(--d),
        0 1rem 1.4rem rgba(10, 40, 10, 0.34),
        inset 0 0.14rem 0 rgba(255, 255, 255, 0.65),
        inset 0 -0.22rem 0.4rem rgba(0, 0, 0, 0.12);
}
.btn.xl img {
    width: 3.2rem;
    height: 3.2rem;
}
.btn.xl small {
    font-size: 1.2rem;
}

/* ---------- price-tag panels, chips ---------- */
.ticket {
    position: relative;
    color: var(--ink);
    border-radius: 1.5rem;
    background: linear-gradient(180deg, #fffef6, var(--paper));
    border: 0.22rem solid var(--ink);
    box-shadow:
        0 0.45rem 0 #0f3a1e,
        0 1rem 1.6rem rgba(10, 40, 10, 0.3),
        inset 0 0 0 0.16rem #fff;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 1.1rem 0.4rem 0.7rem;
    border-radius: 2rem;
    background: var(--ink);
    border: 0.16rem solid rgba(255, 255, 255, 0.6);
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow: 0 0.3rem 0 rgba(8, 40, 12, 0.5);
}
.chip img {
    width: 2.1rem;
    height: 2.1rem;
}
.chip.small {
    font-size: 1.4rem;
    padding: 0.3rem 0.9rem 0.3rem 0.55rem;
}
.chip.small img {
    width: 1.8rem;
    height: 1.8rem;
}

/* ---------- the shop sign (title) ---------- */
.sign {
    --k: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: calc(0.7rem * var(--k)) calc(2.2rem * var(--k)) calc(0.9rem * var(--k));
    border-radius: calc(1.6rem * var(--k));
    background: repeating-linear-gradient(90deg, #e8b36b 0 calc(3rem * var(--k)), #dba35a calc(3rem * var(--k)) calc(6rem * var(--k)));
    border: calc(0.4rem * var(--k)) solid #6b3f17;
    box-shadow:
        0 calc(0.5rem * var(--k)) 0 #4a2a0c,
        0 1.2rem 1.6rem rgba(10, 40, 10, 0.34),
        inset 0 0 0 calc(0.2rem * var(--k)) rgba(255, 255, 255, 0.35);
    line-height: 0.95;
}
.sign::before,
.sign::after {
    content: "";
    position: absolute;
    top: calc(-1.8rem * var(--k));
    width: calc(0.35rem * var(--k));
    height: calc(1.8rem * var(--k));
    background: #7a5230;
}
.sign::before {
    left: 22%;
}
.sign::after {
    right: 22%;
}
.s1 {
    font-family: var(--hd);
    font-weight: 800;
    font-size: calc(2rem * var(--k));
    letter-spacing: 0.35em;
    margin-right: -0.35em;
    color: #fff6d8;
    text-shadow: 0 calc(0.14rem * var(--k)) 0 #6b3f17;
}
.s2 {
    font-family: var(--hd);
    font-weight: 800;
    font-size: calc(3.9rem * var(--k));
    letter-spacing: 0.02em;
    color: #ff4b3a;
    text-shadow:
        0 calc(0.2rem * var(--k)) 0 #8f1c10,
        0 0 0 #fff;
    -webkit-text-stroke: calc(0.1rem * var(--k)) #fff6d8;
    paint-order: stroke fill;
}
.sign em {
    position: absolute;
    right: calc(-0.9rem * var(--k));
    bottom: calc(-1.1rem * var(--k));
    font-style: normal;
    font-family: var(--hd);
    font-weight: 800;
    font-size: calc(1.9rem * var(--k));
    padding: calc(0.3rem * var(--k)) calc(0.9rem * var(--k));
    border-radius: calc(0.9rem * var(--k));
    background: #1d4a2a;
    color: var(--sun);
    border: calc(0.2rem * var(--k)) solid #fff;
    box-shadow: 0 calc(0.25rem * var(--k)) 0 rgba(0, 0, 0, 0.35);
}
.tagline {
    margin-top: 1.4rem;
    text-align: center;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 0.02em;
    color: #fff;
    text-shadow:
        0 0.14rem 0 rgba(10, 60, 20, 0.85),
        0 0 0.6rem rgba(10, 60, 20, 0.55);
}

/* ---------- loading ---------- */
#loader {
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #69c8ff, #fff0c9 70%, #d8b878);
    pointer-events: auto;
}
.ld-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.4rem;
    width: min(100%, 32rem);
}
.ld-bar {
    width: 100%;
    height: 1.8rem;
    border-radius: 1rem;
    background: var(--ink);
    border: 0.2rem solid #fff;
    box-shadow: 0 0.3rem 0 rgba(8, 40, 12, 0.35);
    overflow: hidden;
}
.ld-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: repeating-linear-gradient(135deg, #ffd23f 0 0.9rem, #ff9a1f 0.9rem 1.8rem);
    transition: width 0.2s;
}
.ld-txt {
    color: #fff;
    font-size: 1.5rem;
    text-shadow: 0 0.14rem 0 rgba(10, 60, 20, 0.8);
}

/* ---------- menu ---------- */
.m-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1.8rem;
    max-width: none;
}
.dock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    max-width: 36rem;
}
.row3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    width: 100%;
}
.row3 .btn {
    flex-direction: column;
    gap: 0.35rem;
    min-height: 5.4rem;
    padding: 0.6rem 0.3rem;
    font-size: 1.25rem;
}
.row3 .btn span {
    align-items: center;
}
.row3 .btn img {
    width: 2.3rem;
    height: 2.3rem;
}
.row3 .btn small {
    font-size: 1.05rem;
}
.ver {
    position: absolute;
    right: calc(var(--sar) + 1rem);
    bottom: calc(var(--sab) + 0.4rem);
    font-size: 1.1rem;
    opacity: 0.8;
    pointer-events: none;
    text-shadow: 0 0.1rem 0 rgba(10, 60, 20, 0.8);
}

/* ---------- level select ---------- */
#levels.active {
    flex-direction: column;
    gap: 0.9rem;
    align-items: center;
    pointer-events: auto;
    background: linear-gradient(180deg, var(--s0, #69c8ff) 0, var(--s1, #fff0c9) 34%, var(--g, #d8b878) 34.1%, var(--g, #d8b878) 100%);
}
#levels.active::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2.2rem;
    pointer-events: none;
    background: repeating-linear-gradient(90deg, var(--a1, #e8333a) 0 3rem, #fff 3rem 6rem);
    box-shadow: 0 0.4rem 0 rgba(0, 0, 0, 0.18);
}
#levels > * {
    position: relative;
}
#levels {
    padding-top: calc(var(--sat) + 2.8rem);
}
#levels > * {
    width: 100%;
    max-width: 62rem;
}
.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.bar h2 {
    font-family: var(--hd);
    font-weight: 800;
    font-size: 2.1rem;
    white-space: nowrap;
    color: #fff;
    text-shadow:
        0 0.16rem 0 rgba(10, 60, 20, 0.85),
        0 0 0.6rem rgba(10, 60, 20, 0.5);
}
.world-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0.8rem;
    border-radius: 1.5rem;
    background: linear-gradient(180deg, #fffef6, var(--paper));
    border: 0.22rem solid var(--ink);
    box-shadow: 0 0.4rem 0 #0f3a1e;
    color: var(--ink);
}
.w-info {
    flex: 1;
    min-width: 0;
    text-align: center;
}
.w-info small {
    font-size: 1.15rem;
    opacity: 0.75;
}
.w-info h3 {
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.8rem;
    line-height: 1.1;
    white-space: nowrap;
    color: var(--a2, #e8333a);
}
.w-info p {
    font-size: 1.15rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.arrow {
    flex: none;
}
.arrow img {
    width: 2.1rem;
    height: 2.1rem;
}
.dots {
    display: flex;
    justify-content: center;
    gap: 0.7rem;
}
.dots i {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0.12rem 0 rgba(8, 40, 12, 0.5);
}
.dots i.on {
    width: 2.6rem;
    border-radius: 1rem;
    background: var(--sun);
}
.lv-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 0.8rem;
    max-height: 46rem;
    align-content: stretch;
    padding-bottom: 0.4rem;
}
.tile {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 1.1rem;
    background: repeating-linear-gradient(180deg, #e0a45c 0 33%, #cf934d 33% 34%, #e0a45c 34% 66%, #cf934d 66% 67%, #e0a45c 67% 100%);
    border: 0.25rem solid #7a4a1c;
    box-shadow:
        0 0.38rem 0 #4a2a0c,
        0 0.8rem 1rem rgba(8, 40, 12, 0.3);
    color: #fff;
    overflow: hidden;
    pointer-events: auto;
    top: 0;
}
.tile:active {
    top: 0.3rem;
}
.tile .no {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    margin-top: -1.4rem;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.6rem;
    line-height: 1;
    box-shadow: 0 0.14rem 0 rgba(0, 0, 0, 0.35);
}
.tile .ic {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    margin-top: -1.7rem;
    width: 3.4rem;
    height: 3.4rem;
}
.tile .ts {
    position: absolute;
    left: 4.2rem;
    top: 50%;
    margin-top: -1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.tile .ts img {
    width: 1.4rem;
    height: 1.4rem;
}
.tile .st3 {
    display: flex;
}
.tile.new {
    background: linear-gradient(180deg, #ffd873, #ffb02b);
    border-color: #a05b00;
    box-shadow:
        0 0.38rem 0 #7a4300,
        0 0.8rem 1rem rgba(8, 40, 12, 0.3);
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    50% {
        box-shadow:
            0 0.38rem 0 #7a4300,
            0 0 0 0.35rem rgba(255, 255, 255, 0.7),
            0 0.8rem 1rem rgba(8, 40, 12, 0.3);
    }
}
.tile.lock {
    background: repeating-linear-gradient(135deg, #8c9a8f 0 1.2rem, #7d8b80 1.2rem 2.4rem);
    border-color: #4c5a4f;
    box-shadow:
        0 0.38rem 0 #2c382f,
        0 0.8rem 1rem rgba(8, 40, 12, 0.3);
}
.tile.lock .no {
    opacity: 0.75;
}
.tile.lock .lk {
    position: absolute;
    right: 1.1rem;
    top: 50%;
    margin-top: -1.2rem;
    width: 2.4rem;
    height: 2.4rem;
    opacity: 0.9;
}
.tile .go {
    position: absolute;
    left: 4.2rem;
    top: 50%;
    margin-top: -1.1rem;
    width: 2.2rem;
    height: 2.2rem;
    opacity: 0.9;
}

/* ---------- game HUD ---------- */
.g-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.6rem 0.7rem;
    width: 100%;
    max-width: 46rem;
    justify-self: center;
}
.g-btns {
    display: contents;
}
#pauseBtn {
    order: 1;
}
.info {
    order: 2;
}
#restartBtn {
    order: 3;
}
.goal {
    order: 4;
    grid-column: 1/-1;
}
.info {
    min-width: 0;
    padding: 0.5rem 0.9rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.i-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 0.18rem dashed rgba(29, 74, 42, 0.35);
}
.i-top b {
    white-space: nowrap;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 0.02em;
    color: var(--red);
}
.i-top small {
    font-size: 1.1rem;
    white-space: nowrap;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.i-main {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}
.timer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: none;
}
.timer img {
    width: 2rem;
    height: 2rem;
    filter: brightness(0) saturate(100%) invert(22%) sepia(40%) saturate(900%) hue-rotate(100deg);
}
.timer strong {
    font-family: var(--hd);
    font-weight: 800;
    font-size: 2.4rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    min-width: 3.4rem;
}
.tbar {
    flex: 1;
    min-width: 0;
    height: 1.2rem;
    border-radius: 1rem;
    background: rgba(29, 74, 42, 0.18);
    box-shadow: inset 0 0.1rem 0.15rem rgba(0, 0, 0, 0.2);
    overflow: hidden;
}
.tbar i {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: 1rem;
    background: linear-gradient(180deg, #8cf0a4, #27b95e);
}
.tbar.mid i {
    background: linear-gradient(180deg, #ffd77a, #ff9a1f);
}
.tbar.low i {
    background: linear-gradient(180deg, #ff9aa8, #e92f50);
    animation: blink 0.5s ease-in-out infinite alternate;
}
@keyframes blink {
    to {
        opacity: 0.55;
    }
}
.timer.low strong {
    color: var(--red);
}
.goal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem 0.6rem;
    padding: 0.55rem 0.7rem 0.65rem;
    min-height: 4.4rem;
}
.gl {
    flex: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.7rem 0.2rem 0.3rem;
    border-radius: 1.4rem;
    background: var(--paper2);
    border: 0.14rem dashed rgba(29, 74, 42, 0.45);
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1;
}
.gl img {
    width: 3.2rem;
    height: 3.2rem;
}
.gl img.sil {
    filter: brightness(0) opacity(0.8);
}
.gl b {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.gl.now {
    background: #fff3b0;
    border: 0.14rem solid #e0a000;
    box-shadow: 0 0 0 0.18rem rgba(255, 210, 63, 0.6);
}
.gl.done {
    opacity: 0.55;
    background: #c9f2cf;
}
.gl.txt {
    padding: 0.3rem 0.9rem;
    font-size: 1.35rem;
}
.gl .dot {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    border: 0.14rem solid rgba(0, 0, 0, 0.35);
    flex: none;
}
.gl .arrow-s {
    font-size: 1.2rem;
    opacity: 0.6;
}
.coach {
    position: absolute;
    left: 0;
    right: 0;
    top: 0.2rem;
    display: flex;
    justify-content: center;
    transition: opacity 0.4s;
    pointer-events: none;
}
.coach span {
    display: block;
    max-width: 100%;
    padding: 0.5rem 1.1rem;
    border-radius: 1.6rem;
    background: var(--ink);
    border: 0.16rem solid rgba(255, 255, 255, 0.6);
    font-size: 1.25rem;
    text-align: center;
    line-height: 1.2;
}
.coach span b {
    color: var(--sun);
}
.coach.hide {
    opacity: 0;
}
.g-bot {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 0.8rem;
    width: 100%;
    max-width: 46rem;
    justify-self: center;
}
.hintbtn {
    min-height: 4rem;
    min-width: 9rem;
}
.hintbtn small {
    font-size: 1.1rem;
}
.hintbtn span {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
}
.hintbtn small {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    border-radius: 1rem;
    background: #5a3300;
    color: #fff;
    text-shadow: none;
    padding: 0 0.4rem;
}
.answers {
    display: flex;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
}
.ans {
    --l: #8fd0ff;
    --b: #2f8bff;
    --d: #1650b8;
    flex: 1 1 0;
    max-width: 6rem;
    min-width: 0;
    height: 4.4rem;
    border-radius: 1.2rem;
    color: #fff;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 2.2rem;
    line-height: 1;
    background: linear-gradient(180deg, var(--l), var(--b) 66%);
    box-shadow:
        0 0.38rem 0 var(--d),
        0 0.8rem 1rem rgba(10, 40, 10, 0.3),
        inset 0 0.12rem 0 rgba(255, 255, 255, 0.6);
    text-shadow: 0 0.1rem 0 rgba(0, 0, 0, 0.28);
    pointer-events: auto;
    position: relative;
    top: 0;
}
.ans:active {
    top: 0.3rem;
    box-shadow:
        0 0.08rem 0 var(--d),
        inset 0 0.12rem 0 rgba(255, 255, 255, 0.5);
}
.ans.gone {
    opacity: 0.35;
    pointer-events: none;
}
.ans.ok {
    --l: #7fe69b;
    --b: #22b95c;
    --d: #0f7a3a;
}

#pops {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}
.pop {
    position: absolute;
    margin-left: -4rem;
    width: 8rem;
    text-align: center;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 2.2rem;
    color: #fff;
    white-space: nowrap;
    text-shadow:
        0 0.16rem 0 rgba(10, 50, 20, 0.9),
        0 0 0.5rem rgba(10, 50, 20, 0.5);
    animation: pop 0.95s ease-out both;
}
.pop.bad {
    color: #ff9a9a;
}
.pop.warn {
    color: #ffd27a;
}
.pop.good {
    color: #c8ffd4;
}
.pop.big {
    font-size: 3.2rem;
    color: var(--sun);
    margin-left: -10rem;
    width: 20rem;
}
@keyframes pop {
    0% {
        opacity: 0;
        top: calc(var(--y) + 0.8rem);
    }
    15% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        top: calc(var(--y) - 3.6rem);
    }
}

/* ---------- wide screens: game goes to three columns ---------- */
@media (min-aspect-ratio: 5/4) {
    .sign {
        --k: 0.85;
    }
    .m-title {
        padding-top: 1.6rem;
    }
    #game.active {
        grid-template-rows: auto auto minmax(0, 1fr) auto;
        grid-template-columns: minmax(0, 1fr) var(--bw, 24rem) minmax(0, 1fr);
        column-gap: 0.6rem;
        row-gap: 0.8rem;
    }
    .g-top,
    .g-bot {
        display: contents;
    }
    .info {
        grid-column: 1;
        grid-row: 1;
        justify-self: end;
        width: var(--pw, 18rem);
    }
    .goal {
        grid-column: 1;
        grid-row: 2;
        justify-self: end;
        width: var(--pw, 18rem);
        align-self: start;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
    }
    .goal .gl {
        justify-content: flex-start;
    }
    .arrow-s {
        display: none;
    }
    .i-top small {
        display: none;
    }
    .g-btns {
        display: flex;
        grid-column: 3;
        grid-row: 1;
        justify-self: start;
        width: var(--pw, 18rem);
        gap: 0.8rem;
        align-self: start;
    }
    .g-btns .btn.round {
        flex: 1;
        width: auto;
    }
    .hintbtn {
        grid-column: 3;
        grid-row: 2;
        justify-self: start;
        align-self: start;
        width: var(--pw, 18rem);
    }
    .answers {
        grid-column: 3;
        grid-row: 4;
        justify-self: start;
        align-self: end;
        width: var(--pw, 18rem);
        justify-content: stretch;
    }
    .ans {
        max-width: none;
    }
    #game .mid {
        grid-column: 2;
        grid-row: 1/5;
    }
    .dock {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: 76rem;
        justify-content: center;
        gap: 1rem;
        align-items: stretch;
    }
    .dock .btn.xl {
        width: auto;
        flex: 1 1 24rem;
    }
    .dock .row3 {
        flex: 1.5 1 36rem;
        width: auto;
    }
    .row3 .btn {
        flex-direction: row;
        gap: 0.8rem;
        min-height: 5.8rem;
        font-size: 1.5rem;
    }
    .row3 .btn span {
        align-items: flex-start;
    }
    .lv-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        max-height: 30rem;
    }
    .coach {
        top: -0.3rem;
    }
    .timer strong {
        font-size: 2.2rem;
    }
    .timer img {
        width: 1.8rem;
        height: 1.8rem;
    }
    .i-top b {
        font-size: 1.5rem;
    }
    .gl {
        font-size: 1.35rem;
    }
    .gl img {
        width: 2.5rem;
        height: 2.5rem;
    }
}
@media (min-aspect-ratio: 5/4) and (max-height: 520px) {
    .sign {
        --k: 0.62;
    }
    .m-title {
        padding-top: 1.2rem;
    }
    .tagline {
        font-size: 1.3rem;
        margin-top: 0.9rem;
    }
    .btn.xl,
    .dock .btn.xl,
    .row3 .btn {
        min-height: 4.6rem;
    }
    .btn.xl {
        font-size: 2rem;
    }
    .dock {
        gap: 0.6rem;
    }
    .lv-grid {
        max-height: 20rem;
    }
    .bar h2 {
        font-size: 2rem;
    }
    .world-card {
        padding: 0.4rem 0.7rem;
    }
    .w-info h3 {
        font-size: 1.7rem;
    }
    .w-info p {
        display: none;
    }
    .info {
        padding: 0.4rem 0.8rem 0.5rem;
        gap: 0.25rem;
    }
    .timer strong {
        font-size: 2rem;
    }
    .hintbtn {
        min-height: 3.6rem;
    }
    .goal {
        padding: 0.4rem 0.6rem 0.5rem;
        gap: 0.3rem;
    }
    .gl img {
        width: 2.2rem;
        height: 2.2rem;
    }
    .ans {
        height: 3.8rem;
    }
    #levels {
        padding-top: calc(var(--sat) + 2.4rem);
    }
    #levels.active::before {
        height: 1.6rem;
    }
}

/* ---------- dialogs ---------- */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.4rem;
    background: rgba(10, 50, 20, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.25s,
        visibility 0s 0.25s;
    z-index: 20;
    overflow: hidden;
}
.modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.25s;
}
.dlg {
    width: min(100%, 28rem);
    max-height: calc(100% - 1rem);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 3.2rem 1.4rem 1.4rem;
    overflow: visible;
    animation: dlg 0.3s ease both;
}
.modal:not(.show) .dlg {
    animation: none;
}
@keyframes dlg {
    from {
        opacity: 0;
    }
}
.dlg .btn {
    pointer-events: auto;
}
.ribbon {
    position: absolute;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: max-content;
    max-width: 94%;
    top: -1.7rem;
    white-space: nowrap;
    padding: 0.6rem 2rem;
    border-radius: 1.1rem;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: 0.03em;
    color: #fff;
    background: repeating-linear-gradient(90deg, #ff5a4a 0 1.6rem, #e8333a 1.6rem 3.2rem);
    border: 0.22rem solid #fff;
    box-shadow:
        0 0.4rem 0 #a01622,
        0 0.9rem 1.2rem rgba(10, 50, 20, 0.35);
    text-shadow: 0 0.1rem 0 rgba(0, 0, 0, 0.35);
    z-index: 2;
}
.ribbon.bad {
    background: linear-gradient(180deg, #8a9a8c, #5c6e5f);
    box-shadow:
        0 0.4rem 0 #2f3d32,
        0 0.9rem 1.2rem rgba(10, 50, 20, 0.35);
}
.dlg h3 {
    font-family: var(--hd);
    font-weight: 800;
    text-align: center;
    font-size: 2.1rem;
    line-height: 1.1;
    color: var(--ink);
}
.msg {
    text-align: center;
    font-weight: 700;
    font-size: 1.35rem;
    color: #2e6a43;
}
.stars {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
.stars img {
    width: 5rem;
    height: 5rem;
}
.stars img.on {
    animation: starpop 0.55s ease both;
}
.stars img:nth-child(2).on {
    animation-delay: 0.25s;
}
.stars img:nth-child(3).on {
    animation-delay: 0.5s;
}
@keyframes starpop {
    from {
        scale: 0;
        rotate: -120deg;
    }
}
.facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}
.facts div {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.3rem;
    border-radius: 1rem;
    background: var(--paper2);
    border: 0.14rem dashed rgba(29, 74, 42, 0.4);
}
.facts small {
    font-size: 1.05rem;
    font-weight: 700;
    opacity: 0.75;
    white-space: nowrap;
}
.facts b {
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.8rem;
}
.row2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.7rem;
}
.row2 .btn {
    font-size: 1.3rem;
    gap: 0.5rem;
    padding: 0 0.6rem;
    min-width: 0;
}
.row2 .btn img {
    width: 2rem;
    height: 2rem;
}
.how {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0;
}
.how li {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.22;
    color: var(--ink);
}
.how b {
    color: #d4302a;
}
.how .n {
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #ff7a1f;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: normal;
    font-family: var(--hd);
    font-weight: 800;
    font-size: 1.4rem;
    box-shadow: 0 0.2rem 0 #b83a05;
}
.set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 1.4rem;
    color: var(--ink);
}
.set-row span {
    display: flex;
    flex-direction: column;
}
.set-row small {
    font-size: 1.1rem;
    opacity: 0.75;
    font-weight: 700;
}
.switch {
    flex: none;
    position: relative;
    width: 5.2rem;
    height: 3rem;
    border-radius: 2rem;
    background: #a9bfae;
    box-shadow:
        inset 0 0.2rem 0.4rem rgba(0, 0, 0, 0.3),
        0 0 0 0.16rem var(--ink);
    transition: background 0.2s;
    pointer-events: auto;
}
.switch i {
    position: absolute;
    left: 0.3rem;
    top: 0.3rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0.2rem 0.3rem rgba(0, 0, 0, 0.35);
    transition: left 0.2s;
}
.switch.on {
    background: #22b95c;
}
.switch.on i {
    left: 2.5rem;
}
.ver-line {
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.65;
    color: var(--ink);
}
@media (min-aspect-ratio: 5/4) {
    .dlg {
        padding-top: 3rem;
        gap: 0.6rem;
    }
    .how {
        gap: 0.5rem;
    }
    .how li {
        font-size: 1.2rem;
    }
    .how .n {
        width: 2.2rem;
        height: 2.2rem;
    }
}
@media (max-height: 640px) {
    .dlg {
        padding: 3rem 1.3rem 1.2rem;
        gap: 0.55rem;
    }
    .how {
        gap: 0.45rem;
    }
    .how li {
        font-size: 1.15rem;
        line-height: 1.15;
    }
    .how .n {
        width: 2.1rem;
        height: 2.1rem;
        font-size: 1.2rem;
    }
    .ribbon {
        font-size: 1.6rem;
        padding: 0.5rem 1.6rem;
    }
    .btn.wide {
        min-height: 3.8rem;
    }
    .stars img {
        width: 4rem;
        height: 4rem;
    }
    .dlg h3 {
        font-size: 1.8rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
@media (max-width: 360px) {
    .sign {
        --k: 0.8;
    }
    .i-top b {
        font-size: 1.45rem;
    }
    .timer strong {
        font-size: 2.2rem;
    }
    .tagline {
        font-size: 1.4rem;
    }
    .btn.round {
        width: 4rem;
        min-height: 4rem;
    }
    .bar h2 {
        font-size: 1.9rem;
    }
    .w-info h3 {
        font-size: 1.7rem;
    }
}
@media (max-width: 600px) and (max-aspect-ratio: 5/4) {
    .ver {
        display: none;
    }
}
