/* ========== RESET & BASE (1920×1080 canvas) ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f0e6ef;
    --panel: #fffaf5;
    --panel-stroke: #b8a8e0;
    --pink: #f0a6ca;
    --pink-deep: #e88bb8;
    --lavender: #d9c8f2;
    --purple: #9c89b8;
    --purple-deep: #5b4d70;
    --tile: #efc3e6;
    --tile-shadow: #f0a6ca;
    --teal: #6ed0cf;
    --teal-shadow: #5bbdbb;
    --green: #75cf6b;
    --green-shadow: #6bb944;
    --white: #ffffff;
    --font: 'Nunito', system-ui, sans-serif;
    --base-w: 1920;
    --base-h: 1080;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    inset: 0;
    background: #1a1224;
    font-family: var(--font);
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: auto;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 1.6.1.6 / 1.6.2.5 — never show the native media player */
audio {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scaled game canvas */
.game-screen {
    position: absolute;
    width: 1920px;
    height: 1080px;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    background: var(--bg);
    overflow: hidden;
    display: none;
}

.game-screen.is-active {
    display: block;
}

.game-screen[hidden] {
    display: none !important;
}

button {
    font-family: inherit;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    background: none;
    touch-action: manipulation;
}

button:disabled { opacity: 0.5; pointer-events: none; }

img { display: block; max-width: 100%; pointer-events: none; }

/* ========== BUTTONS ========== */
.btn-pink {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 108px;
    padding: 22px 36px;
    border-radius: 22px;
    background: var(--pink);
    color: #fff;
    font-weight: 900;
    font-size: 64px;
    letter-spacing: 0.01em;
    line-height: 1;
    box-shadow: inset 0 -7px 0 0 var(--pink-deep);
}
.btn-pink--wide { width: 605px; height: 140px; font-size: 80px; border-radius: 22px; }
.btn-pink--mid { width: 370px; height: 140px; font-size: 80px; }

.btn-white {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 108px;
    padding: 20px 36px;
    border-radius: 25px;
    background: var(--white);
    color: var(--purple-deep);
    font-weight: 900;
    font-size: 48px;
    letter-spacing: 0.01em;
    box-shadow: inset 0 -7px 0 0 var(--lavender);
}
.btn-white--icon {
    width: 345px;
    min-width: 160px;
    padding: 20px 30px;
}

.btn-circle {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 120px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 -7px 0 0 var(--lavender);
    flex-shrink: 0;
}

/* Shared hover: brightness only, no move/scale */
.btn-pink,
.btn-white,
.btn-circle,
.hint-btn {
    transition: filter 0.12s ease;
}

.btn-pink:hover,
.btn-white:hover,
.btn-circle:hover,
.hint-btn:hover {
    filter: brightness(1.08);
}

.btn-pink:active,
.btn-white:active,
.btn-circle:active,
.hint-btn:active {
    filter: brightness(0.95);
}

.btn-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    padding: 0 36px;
    border-radius: 107px;
    background: var(--purple);
    color: #fff;
    font-weight: 900;
    font-size: 36px;
    box-shadow: inset 0 -7px 0 0 #8573a3;
}
.btn-pill--back { min-width: 180px; }

.icon-64 { width: 64px; height: 64px; }
.icon-40 { width: 40px; height: 40px; }

/* ========== LOADER ========== */
#loader-screen {
    background: #f0e6ef;
    z-index: 50;
    pointer-events: auto;
}

.loader-bg {
    position: absolute;
    inset: 0;
    background: url('assets/ui/bg-menu.png') center / 100% 100% no-repeat;
    z-index: 0;
    pointer-events: none;
}

.loader-ui {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    pointer-events: none;
}

.loader-bar {
    width: 520px;
    height: 28px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 -7px 0 0 var(--lavender);
    overflow: hidden;
}

.loader-bar__fill {
    width: 8%;
    height: 100%;
    border-radius: 20px;
    background: var(--pink);
    box-shadow: inset 0 -7px 0 0 var(--pink-deep);
    transition: width 0.28s ease;
}

.loader-text {
    font-weight: 900;
    font-size: 40px;
    color: var(--purple-deep);
    letter-spacing: 0.02em;
}

/* ========== MENU ========== */
#menu-screen {
    background: #f0e6ef;
}

.menu-bg {
    position: absolute;
    inset: 0;
    background: url('assets/ui/BG.webp') center / 100% 100% no-repeat;
    z-index: 0;
    pointer-events: none;
}

.menu-logo {
    position: absolute;
    left: 50%;
    top: 64px;
    transform: translateX(-50%);
    width: 304px;
    height: 203px;
    object-fit: contain;
    z-index: 3;
    pointer-events: none;
}

.menu-stickers {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.menu-sticker {
    position: absolute;
    overflow: visible;
    pointer-events: none;
}

.menu-sticker img {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    animation: menuLevitate var(--dur, 6s) linear infinite;
    animation-delay: var(--delay, 0s);
    will-change: transform;
}

.menu-sticker:nth-child(even) img {
    animation-direction: reverse;
}

/* Figma 11:512 — node AABB (x/y) + unrotated size, rotation in export */
.menu-sticker--1 { left: 172.517px; top: 81.055px; width: 227.397px; height: 245.06px; --dur: 5.8s; --delay: 0s; }
.menu-sticker--2 { left: 8px; top: 317.695px; width: 296.286px; height: 310.432px; --dur: 6.4s; --delay: 0.4s; }
.menu-sticker--3 { left: 204.37px; top: 589.997px; width: 202.019px; height: 204.604px; --dur: 6.1s; --delay: 0.9s; }
.menu-sticker--4 { left: 19.673px; top: 798.439px; width: 248.874px; height: 241.173px; --dur: 6.7s; --delay: 0.15s; }
.menu-sticker--5 { left: 1516.419px; top: 17.521px; width: 337.707px; height: 316.807px; --dur: 5.9s; --delay: 0.6s; }
.menu-sticker--6 { left: 1648.583px; top: 303.693px; width: 193.14px; height: 168.317px; --dur: 6.3s; --delay: 1.1s; }
.menu-sticker--7 { left: 1594.493px; top: 537.892px; width: 194.875px; height: 215.048px; --dur: 6.6s; --delay: 0.3s; }
.menu-sticker--8 { left: 1586.767px; top: 771.583px; width: 293.909px; height: 301.375px; --dur: 6s; --delay: 0.8s; }

@keyframes menuLevitate {
    0%      { transform: translate(0, -4px); }
    8.33%   { transform: translate(2px, -3.5px); }
    16.67%  { transform: translate(3.5px, -2px); }
    25%     { transform: translate(4px, 0); }
    33.33%  { transform: translate(3.5px, 2px); }
    41.67%  { transform: translate(2px, 3.5px); }
    50%     { transform: translate(0, 4px); }
    58.33%  { transform: translate(-2px, 3.5px); }
    66.67%  { transform: translate(-3.5px, 2px); }
    75%     { transform: translate(-4px, 0); }
    83.33%  { transform: translate(-3.5px, -2px); }
    91.67%  { transform: translate(-2px, -3.5px); }
    100%    { transform: translate(0, -4px); }
}

/* Overlay fills the canvas; children pinned to Figma coords (1920×1080) */
.menu-ui {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.menu-ui > * {
    pointer-events: auto;
    position: absolute;
}

/* Figma desktop: Continue 605×140 @ y=376, centered */
.menu-btn-continue {
    left: 50%;
    top: 376px;
    transform: translateX(-50%);
    width: 605px;
    height: 140px;
    font-size: 80px;
    min-height: 0;
}

.menu-btn-continue span,
.menu-btn-levels span,
.menu-btn-games span {
    display: block;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
}

/* Levels 370×140 @ y=547 */
.menu-btn-levels {
    left: 50%;
    top: 547px;
    transform: translateX(-50%);
    width: 370px;
    height: 140px;
    font-size: 80px;
    min-height: 0;
}

/* Language bar 777×108 @ y=730 */
.menu-lang {
    left: 50%;
    top: 730px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    width: 777px;
    height: 108px;
    padding: 12px 16px 18px 24px;
    background: var(--white);
    border-radius: 25px;
    box-shadow: inset 0 -7px 0 0 var(--lavender);
}

.lang-bar__label {
    font-weight: 900;
    font-size: 44px;
    color: var(--purple-deep);
    white-space: nowrap;
    width: 156px;
    flex-shrink: 0;
    overflow: hidden;
    line-height: 1;
}

.lang-bar__options {
    display: flex;
    gap: 10px;
    height: 81px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.lang-chip {
    width: 105px;
    height: 81px;
    border-radius: 20px;
    background: var(--lavender);
    color: #fff;
    font-weight: 900;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lang-chip.is-active {
    background: var(--pink);
    box-shadow: inset 0 -7px 0 0 var(--pink-deep);
}

#menu-screen .btn-pink {
    box-shadow: inset 0 -7px 0 0 var(--pink-deep);
}
#menu-screen .btn-white,
#menu-screen .menu-lang {
    box-shadow: inset 0 -7px 0 0 var(--lavender);
}
#menu-screen .lang-chip.is-active {
    box-shadow: inset 0 -7px 0 0 var(--pink-deep);
}

/* Menu: only brightness hover, no move/scale effects */
#menu-screen .btn-pink,
#menu-screen .btn-white,
#menu-screen .lang-chip {
    transition: filter 0.12s ease;
}

#menu-screen .btn-pink:hover,
#menu-screen .btn-white:hover,
#menu-screen .lang-chip:hover {
    filter: brightness(1.08);
}

#menu-screen .btn-pink:active,
#menu-screen .btn-white:active,
#menu-screen .lang-chip:active {
    filter: brightness(0.95);
}

/* Keep absolute centering (not a visual effect) */
#menu-screen .menu-btn-continue:hover,
#menu-screen .menu-btn-continue:active,
#menu-screen .menu-btn-levels:hover,
#menu-screen .menu-btn-levels:active,
#menu-screen .menu-lang:hover,
#menu-screen .menu-lang:active,
#menu-screen .menu-bottom:hover,
#menu-screen .menu-bottom:active {
    transform: translateX(-50%);
}

/* Bottom row: Our games + Music @ y=857, gap 24, total ~709 */
.menu-bottom {
    left: 50%;
    top: 857px;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    align-items: center;
    height: 108px;
}

.menu-btn-games {
    width: 340px;
    height: 108px;
    min-height: 0;
    font-size: 48px;
    padding: 0 30px;
}

.menu-btn-music {
    width: 345px;
    height: 108px;
    min-height: 0;
    padding: 0 30px;
}

/* ========== LEVELS — Figma 19:222 (1920×1080) ========== */
#levels-screen {
    background: #f0e6ef;
}

.levels-header {
    display: contents;
}

.levels-back {
    position: absolute;
    left: 59px;
    top: 50px;
    height: 100px;
    padding: 0 45px;
    border-radius: 15px;
    background: #fff;
    box-shadow: inset 0 -4.167px 0 0 rgba(226, 108, 160, 0.44);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #5b4d70;
    font-weight: 900;
    font-size: 40px;
    letter-spacing: 0.4px;
    line-height: 1;
    text-transform: capitalize;
    min-height: 0;
    transition: filter 0.12s ease;
}

.levels-back:hover { filter: brightness(1.04); }
.levels-back:active { filter: brightness(0.96); }

.levels-back__icon {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex-shrink: 0;
}

.levels-title {
    position: absolute;
    left: 50%;
    top: 67.63px;
    transform: translateX(-50%);
    margin: 0;
    font-weight: 900;
    font-size: 64px;
    line-height: 1;
    color: #5b4d70;
    text-transform: capitalize;
    white-space: nowrap;
}

.levels-stars-total {
    position: absolute;
    left: 1613px;
    top: 49.63px;
    height: 100px;
    min-width: 258px;
    padding: 0 45px;
    border-radius: 75px;
    background: #fff;
    box-shadow: inset 0 -7px 0 0 #d9c8f2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #5b4d70;
    font-weight: 900;
    font-size: 40px;
    letter-spacing: 0.4px;
    line-height: 1;
    transition: filter 0.12s ease;
}

button.levels-stars-total:hover { filter: brightness(1.06); }
button.levels-stars-total:active { filter: brightness(0.96); }

.levels-stars-total__icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    flex-shrink: 0;
}

.levels-board {
    position: absolute;
    left: 50%;
    top: 223px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 36px;
}

.levels-arrow {
    width: 62px;
    height: 84px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
    transition: filter 0.12s ease, opacity 0.12s ease;
}

.levels-arrow img {
    width: 84px;
    height: 62px;
    max-width: none;
    object-fit: contain;
    pointer-events: none;
}

.levels-arrow--prev img { transform: rotate(-90deg); }
.levels-arrow--next img { transform: rotate(90deg); }

.levels-arrow:hover:not(:disabled) { filter: brightness(1.08); }
.levels-arrow:active:not(:disabled) { filter: brightness(0.94); }
.levels-arrow:disabled {
    opacity: 0.35;
    pointer-events: none;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(7, 200px);
    grid-auto-rows: 140px;
    column-gap: 32.47px;
    row-gap: 24px;
    width: 1594.82px;
    overflow: visible;
}

.level-cell {
    width: 200px;
    height: 140px;
    border-radius: 25px;
    background: #fff;
    box-shadow: inset 0 -4.167px 0 0 rgba(226, 108, 160, 0.44);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #5b4d70;
    font-weight: 900;
    font-size: 38px;
    letter-spacing: 0.38px;
    line-height: 1;
    transition: filter 0.12s ease;
}

.level-cell:hover:not(.is-locked) { filter: brightness(1.04); }
.level-cell:active:not(.is-locked) { filter: brightness(0.97); }

.level-cell__num {
    display: block;
    text-align: center;
    width: 100%;
}

.level-cell__stars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 46px;
    padding: 8px 24px;
    border-radius: 15px;
    background: #fff0f7;
    box-sizing: border-box;
}

.level-cell__star {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}

.level-cell__star.is-empty { opacity: 0.4; }

.level-cell.is-locked {
    background: #a9a9a9;
    color: #444444;
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: inset 0 -4.167px 0 0 rgba(68, 68, 68, 0.45);
}

.level-cell.is-locked .level-cell__stars {
    background: #737373;
    gap: 8px;
}

.level-cell.is-locked .level-cell__star.is-empty { opacity: 1; }

/* ========== GAMEPLAY ========== */
#gameplay-screen {
    background: #f0e6ef;
}

/* Figma 11:165 — equal side gutters 39px, columns 359px */
.play-layout {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 359px 1fr 359px;
    align-items: center;
    column-gap: 53px; /* (1920 - 78 - 718 - 1018) / 2 ≈ board centered between cols */
    padding: 0 39px;
    box-sizing: border-box;
}

.play-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px;
    width: 359px;
    margin: 0;
    padding: 0;
    justify-self: stretch;
}

.level-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 359px;
    height: 95px;
    border-radius: 107px;
    background: linear-gradient(90deg, #9c89b8, #9c89b8);
    color: #fff;
    font-weight: 900;
    font-size: 40px;
    text-transform: capitalize;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: inset 0 -7px 0 0 #8573a3;
}

.play-icon-row {
    display: flex;
    gap: 44px;
    align-items: center;
}

.play-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px;
    width: 359px;
}

.stat-card {
    width: 359px;
    height: 254px;
    border-radius: 75px;
    background: var(--white);
    box-shadow: inset 0 -7px 0 0 var(--lavender);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px;
}

.stat-card__icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.stat-card__value {
    font-weight: 900;
    font-size: 56px;
    color: var(--purple-deep);
    line-height: 1.1;
}

.stat-card__label {
    font-weight: 800;
    font-size: 32px;
    color: #8a7a9e;
}

.play-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Figma 11:165 — panel always 1018×1018; cards form edge shapes inside via spacers */
.board-frame {
    position: relative;
    width: 1018px;
    height: 1018px;
    min-width: 1018px;
    min-height: 1018px;
    max-width: 1018px;
    max-height: 1018px;
    flex-shrink: 0;
    background: var(--purple);
    border-radius: 35px;
    padding: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 0 rgba(91, 77, 112, 0.25);
    box-sizing: border-box;
}

.grid-board {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 8px;
    /* Keep cells square: equal track size from min(row,col) space */
    align-content: center;
    justify-content: center;
    justify-items: center;
    align-items: center;
}

.grid-board.is-memory-complete .memory-card {
    pointer-events: none;
}

.memory-card.is-trap-zone { z-index: 3; }
.memory-card.is-trap-hit { z-index: 4; }

.memory-card.is-spinning {
    z-index: 6;
    pointer-events: none;
}

.memory-card.is-spinning .memory-card__inner,
.memory-card.is-spinning.is-face-up .memory-card__inner,
.memory-card.is-spinning.is-matched .memory-card__inner,
.memory-card.is-spinning.is-peek .memory-card__inner,
.memory-card.is-spinning:hover .memory-card__inner,
.memory-card.is-spinning:active .memory-card__inner {
    transition: none !important;
    animation: trapSpin 0.55s cubic-bezier(0.45, 0.08, 0.25, 1);
}

.memory-card.is-spinning .memory-card__art,
.memory-card.is-spinning .memory-card__badge,
.memory-card.is-spinning .memory-card__trap-icon {
    visibility: hidden !important;
    opacity: 0 !important;
}

@keyframes trapSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* Cards — square; only __inner does rotateY. */
.memory-card {
    position: relative;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    perspective: 1000px;
    cursor: pointer;
    min-width: 0;
    min-height: 0;
    touch-action: manipulation;
}

.memory-card:not(.is-face-up):not(.is-matched):not(.is-spacer):not(.is-spinning):hover {
    z-index: 2;
}

.memory-card:not(.is-face-up):not(.is-matched):not(.is-spacer):not(.is-spinning):hover .memory-card__inner {
    transform: rotateY(0deg) translateY(-3px) scale(1.02);
}

.memory-card:not(.is-face-up):not(.is-matched):not(.is-spacer):not(.is-spinning):active .memory-card__inner {
    transform: rotateY(0deg) scale(0.98);
}

.memory-card.is-spacer {
    visibility: hidden;
    pointer-events: none;
    cursor: default;
}

.memory-card__inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform: rotateY(0deg);
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.4, 0.05, 0.2, 1);
}

.memory-card.is-face-up .memory-card__inner,
.memory-card.is-matched .memory-card__inner,
.memory-card.is-peek .memory-card__inner {
    transform: rotateY(180deg);
}

/* Same pink base both faces — soft 3D lip only */
.memory-card__face {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #efc3e6;
    box-shadow: inset 0 -5.25px 0 0 #f0a6ca;
    transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

.memory-card.is-trap-zone--T1 .memory-card__face { background: #ff9f43; box-shadow: inset 0 -5.25px 0 0 #e67e22; }
.memory-card.is-trap-zone--T2 .memory-card__face { background: #ff6bcb; box-shadow: inset 0 -5.25px 0 0 #e84393; }
.memory-card.is-trap-zone--T3 .memory-card__face { background: #4dabf7; box-shadow: inset 0 -5.25px 0 0 #1c7ed6; }
.memory-card.is-trap-zone--T4 .memory-card__face { background: #ffe066; box-shadow: inset 0 -5.25px 0 0 #fab005; }
.memory-card.is-trap-zone--T5 .memory-card__face { background: #b197fc; box-shadow: inset 0 -5.25px 0 0 #7950f2; }
.memory-card.is-trap-zone--T6 .memory-card__face { background: #ff6b6b; box-shadow: inset 0 -5.25px 0 0 #fa5252; }
.memory-card.is-trap-zone--T7 .memory-card__face { background: #38d9a9; box-shadow: inset 0 -5.25px 0 0 #12b886; }
.memory-card.is-trap-zone--T8 .memory-card__face { background: #ff922b; box-shadow: inset 0 -5.25px 0 0 #fd7e14; }

.memory-card.is-trap-zone--out .memory-card__face {
    background: #efc3e6;
    box-shadow: inset 0 -5.25px 0 0 #f0a6ca;
}

/* Closed face: plain pink (pattern is on the board, not cards) */
.memory-card__back {
    background: #efc3e6;
    transform: rotateY(0deg) translateZ(1px);
}

/* Open: same pink + sticker art only */
.memory-card__front {
    background: #efc3e6;
    transform: rotateY(180deg) translateZ(1px);
    padding: 10%;
}

.memory-card__art-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    transform: scale(0.88);
    transform-origin: center center;
    transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1) 0.08s;
}

.memory-card.is-face-up .memory-card__art-wrap,
.memory-card.is-matched .memory-card__art-wrap,
.memory-card.is-peek .memory-card__art-wrap {
    transform: scale(1);
}

.memory-card__art {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* Figma Tile Front: x3/x4 — same look per grid, pinned 15×17 from card corner */
.memory-card__front .memory-card__badge {
    position: absolute;
    right: 15px;
    bottom: 17px;
    left: auto;
    font-family: var(--font);
    font-weight: 900;
    font-size: 32px;
    line-height: 1;
    color: #ffffff;
    letter-spacing: 0.01em;
    z-index: 3;
    pointer-events: none;
    text-transform: lowercase;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    -webkit-text-stroke: 0.055em #5b4d70;
    paint-order: stroke fill;
    text-shadow:
        -0.04em -0.04em 0 #5b4d70,
         0.04em -0.04em 0 #5b4d70,
        -0.04em  0.04em 0 #5b4d70,
         0.04em  0.04em 0 #5b4d70;
}

.grid-board[data-cols="3"] .memory-card__badge { font-size: 71.5px; }
.grid-board[data-cols="4"] .memory-card__badge { font-size: 48.25px; }
.grid-board[data-cols="5"] .memory-card__badge { font-size: 37.44px; }
.grid-board[data-cols="6"] .memory-card__badge { font-size: 32px; }
.grid-board[data-cols="7"] .memory-card__badge { font-size: 26px; }

.memory-card.is-matched {
    animation: matchGlow 0.5s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.memory-card.is-trap-icon .memory-card__front {
    background: #efc3e6;
}

.memory-card__trap-icon {
    width: 78%;
    height: 78%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(91, 77, 112, 0.15));
}

.memory-card--mismatch {
    animation: cardShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes cardShake {
    0%, 100% { left: 0; }
    20% { left: -8px; }
    40% { left: 8px; }
    60% { left: -5px; }
    80% { left: 4px; }
}

.memory-card--match-pop .memory-card__art-wrap {
    animation: matchPop 0.42s cubic-bezier(0.34, 1.5, 0.64, 1);
}

@keyframes matchPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes matchGlow {
    0% { filter: brightness(1); }
    45% { filter: brightness(1.12); }
    100% { filter: brightness(1); }
}

/* Trap warning — bottom of the board, stays readable */
.trap-notice {
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 28px;
    top: auto;
    z-index: 20;
    padding: 22px 28px;
    border-radius: 22px;
    background: rgba(91, 77, 112, 0.94);
    color: #fff;
    font-weight: 900;
    font-size: 36px;
    line-height: 1.15;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 0.28s ease,
        transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.trap-notice.trap-notice--visible {
    opacity: 1;
    transform: translateY(0);
}

.peek-timer {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 15;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-weight: 900;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 -7px 0 var(--teal-shadow);
    pointer-events: none;
}

.peek-timer[hidden] {
    display: none !important;
}

/* Right hints — Figma gap 50px between peek and “Найти пару” */
.play-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px;
    width: 359px;
    margin: 0;
    padding: 0;
    justify-self: stretch;
}

.hint-btn {
    width: 359px;
    height: 324px;
    border-radius: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 25px 30px;
    color: #fff;
    font-weight: 900;
    font-size: 42px;
    line-height: 1.05;
    text-align: center;
    transition: filter 0.12s ease;
}

.hint-btn--teal {
    background: var(--teal);
    box-shadow: inset 0 -7px 0 0 var(--teal-shadow);
}

.hint-btn--green {
    background: var(--green);
    box-shadow: inset 0 -7px 0 0 var(--green-shadow);
}

.hint-btn__icon {
    width: 140px;
    height: 110px;
    object-fit: contain;
}

.hint-btn__text {
    display: block;
    min-height: 96px;
    line-height: 1.05;
}

/* ========== MODALS ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] { display: none !important; }

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(40, 28, 60, 0.55);
}

/* All modals — one size (same as hint ad modal) */
.modal__card {
    position: relative;
    z-index: 1;
    width: min(420px, 88vw);
    padding: 20px 20px 16px;
    border-radius: 28px;
    background: var(--panel);
    border: 6px solid var(--panel-stroke);
    box-shadow: 0 10px 0 rgba(91, 77, 112, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.modal__title {
    font-weight: 900;
    font-size: clamp(24px, 3.2vw, 30px);
    color: var(--purple-deep);
    margin: 0;
}

.modal__text {
    font-weight: 700;
    font-size: 17px;
    color: #7a6b90;
    line-height: 1.3;
    margin: 0;
    padding: 0 4px;
}

/* Hint: text closer to title, a bit farther from buttons */
#hint-modal .modal__card {
    gap: 0;
}

#hint-modal .modal__title {
    margin: 0 0 2px;
}

#hint-modal .modal__text {
    margin: 0 0 16px;
}

.modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.modal__actions--col {
    flex-direction: column;
    align-items: stretch;
}

.modal__actions .btn-pink,
.modal__actions .btn-white {
    width: 100%;
    font-size: 24px;
    min-height: 56px;
    height: 56px;
    padding: 0 20px;
    border-radius: 16px;
    box-shadow: inset 0 -7px 0 0 var(--lavender);
}

.modal__actions .btn-pink {
    box-shadow: inset 0 -7px 0 0 var(--pink-deep);
}

#win-retry[hidden] {
    display: none !important;
}

/* Win content inside same modal shell */
.modal__card--win {
    gap: 12px;
}

.win-stars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 10px 12px;
    background: var(--white);
    border-radius: 18px;
    box-shadow: inset 0 -7px 0 0 var(--lavender);
}

.win-stars__icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.win-stars__icon.is-empty {
    opacity: 0.4;
}

.win-stats {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.win-stat {
    flex: 1;
    background: var(--white);
    border-radius: 14px;
    padding: 8px 6px 10px;
    box-shadow: inset 0 -7px 0 0 var(--lavender);
}

.win-stat__label {
    display: block;
    font-weight: 800;
    font-size: 13px;
    color: #8a7a9e;
    margin-bottom: 2px;
}

.win-stat__value {
    font-weight: 900;
    font-size: 20px;
    color: var(--purple-deep);
}

/* ========== TUTORIAL ========== */
#gameplay-screen.is-tutorial .play-right {
    opacity: 0;
    pointer-events: none;
}

.tutorial-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tutorial-overlay[hidden] { display: none !important; }

.tutorial-overlay__dim {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 42%, rgba(255, 214, 236, 0.28) 0%, transparent 52%),
        rgba(40, 28, 60, 0.58);
}

.tutorial-overlay__stickers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.tutorial-float {
    position: absolute;
    display: block;
    object-fit: contain;
    animation: menuLevitate var(--dur, 6s) linear infinite;
    animation-delay: var(--delay, 0s);
    filter: drop-shadow(0 16px 0 rgba(91, 77, 112, 0.12));
}

.tutorial-float--1 { left: 118px; top: 96px; width: 248px; --dur: 5.8s; --delay: 0s; }
.tutorial-float--2 { left: 86px; bottom: 78px; width: 220px; --dur: 6.4s; --delay: 0.5s; animation-direction: reverse; }
.tutorial-float--3 { right: 72px; top: 64px; width: 280px; --dur: 6.1s; --delay: 0.3s; }
.tutorial-float--4 { right: 96px; bottom: 52px; width: 268px; --dur: 6.6s; --delay: 0.9s; animation-direction: reverse; }

.tutorial-card {
    position: relative;
    z-index: 2;
    width: 820px;
    padding: 48px 56px 36px;
    border-radius: 40px;
    background: var(--panel);
    border: 8px solid var(--panel-stroke);
    box-shadow: 0 10px 0 rgba(91, 77, 112, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    opacity: 0;
    transform: translateY(28px) scale(0.92);
}

.tutorial-overlay.is-open .tutorial-card {
    animation: tutorialCardIn 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) forwards;
}

.tutorial-card__glow {
    position: absolute;
    left: -20%;
    top: -40%;
    width: 140%;
    height: 90%;
    background: radial-gradient(circle, rgba(240, 166, 202, 0.38) 0%, transparent 64%);
    pointer-events: none;
}

.tutorial-card__stars {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 18px;
    padding: 16px 28px 14px;
    background: var(--white);
    border-radius: 28px;
    box-shadow: inset 0 -7px 0 0 var(--lavender);
}

.tutorial-card__stars img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    animation: tutorialStarPop 1.6s ease-in-out infinite;
}

.tutorial-card__stars img:nth-child(2) { animation-delay: 0.18s; }
.tutorial-card__stars img:nth-child(3) { animation-delay: 0.36s; }

.tutorial-overlay--welcome .tutorial-card__stars {
    display: none;
}

.tutorial-overlay--done .tutorial-card__stars img {
    animation-duration: 1.15s;
}

.tutorial-card__title {
    position: relative;
    z-index: 1;
    margin: 0 0 16px;
    font-weight: 900;
    font-size: 72px;
    line-height: 1.05;
    color: var(--purple-deep);
    letter-spacing: 0.01em;
}

.tutorial-card__text {
    position: relative;
    z-index: 1;
    margin: 0 0 32px;
    max-width: 680px;
    font-weight: 800;
    font-size: 32px;
    line-height: 1.28;
    color: #7a6b90;
}

.tutorial-card__btn {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 120px;
    min-height: 120px;
    font-size: 64px;
    border-radius: 24px;
    box-shadow: inset 0 -7px 0 0 var(--pink-deep);
}

.tutorial-card__skip {
    position: relative;
    z-index: 1;
    margin-top: 14px;
    padding: 8px 18px;
    background: none;
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 28px;
    color: #9c89b8;
    cursor: pointer;
    transition: filter 0.12s ease, color 0.12s ease;
}

.tutorial-card__skip:hover {
    color: var(--purple-deep);
    filter: brightness(1.08);
}

.tutorial-card__skip:active { filter: brightness(0.95); }

.tutorial-card__skip[hidden] { display: none !important; }

@keyframes tutorialCardIn {
    0% { opacity: 0; transform: translateY(28px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tutorialStarPop {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.08); }
}

/* ========== LEADERBOARD ========== */
#leaderboard-screen {
    background: #f0e6ef;
}

.leaderboard-panel {
    position: absolute;
    left: 50%;
    top: 200px;
    transform: translateX(-50%);
    width: 1240px;
    height: 780px;
    padding: 28px 32px;
    border-radius: 40px;
    background: var(--panel);
    border: 8px solid var(--panel-stroke);
    box-shadow: 0 16px 0 rgba(91, 77, 112, 0.18);
    box-sizing: border-box;
}

.leaderboard-list {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 8px;
}

.leaderboard-status {
    margin: auto;
    padding: 36px 24px;
    text-align: center;
    font-weight: 900;
    font-size: 36px;
    color: #8a7a9e;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 110px 1fr 180px;
    align-items: center;
    min-height: 92px;
    padding: 12px 28px;
    border-radius: 24px;
    background: var(--white);
    box-shadow: inset 0 -7px 0 var(--lavender);
    color: var(--purple-deep);
    font-weight: 900;
}

.leaderboard-row.is-you {
    background: #fff3fa;
    box-shadow: inset 0 -7px 0 var(--pink-deep);
}

.leaderboard-row__rank {
    font-size: 36px;
    letter-spacing: 0.02em;
}

.leaderboard-row__name {
    font-size: 34px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 16px;
}

.leaderboard-row__score {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-size: 36px;
}

.leaderboard-row__star {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* ========== PORTRAIT (1080×2220) ========== */
html.is-portrait,
body.is-portrait {
    background: #F0E6EF;
}

.game-screen.is-portrait {
    width: 1080px;
    height: 2220px;
    background: #F0E6EF;
}

/* --- Loader --- */
body.is-portrait .loader-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

body.is-portrait #menu-screen .menu-bg {
    background-image: url('mobile_bg.webp');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

body.is-portrait .loader-bar {
    width: 640px;
    height: 36px;
}

body.is-portrait .loader-text {
    font-size: 44px;
}

/* --- Menu: panel image 47 @ 62.32 / 198.61 / 955.35×1509.14 --- */

body.is-portrait .menu-logo {
    top: 252px;
    width: 320px;
    height: 214px;
    z-index: 3;
}

body.is-portrait .menu-btn-continue {
    top: 699.73px;
    width: 605px;
    height: 140px;
    font-size: 80px;
    border-radius: 21.76px;
}

body.is-portrait .menu-btn-levels {
    top: 899.73px;
    width: 370px;
    height: 140px;
    font-size: 80px;
    border-radius: 21.76px;
}

body.is-portrait .menu-lang {
    top: 1166.79px;
    width: 621px;
    height: 184px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    padding: 12px 12px 15px 24px;
}

body.is-portrait .lang-bar__label {
    width: auto;
    text-align: center;
    font-size: 48px;
}

body.is-portrait .lang-bar__options {
    width: 585px;
    height: 84px;
    gap: 10px;
    justify-content: center;
}

body.is-portrait .lang-chip {
    width: 109px;
    height: 84px;
    font-size: 36px;
    border-radius: 20px;
}

body.is-portrait .menu-bottom {
    top: 1410.79px;
    height: 108px;
    gap: 24px;
}

body.is-portrait .menu-btn-games {
    width: 340px;
    height: 108px;
    font-size: 48px;
}

body.is-portrait .menu-btn-music {
    width: 345px;
    height: 108px;
}

body.is-portrait .menu-stickers {
    display: block;
}

body.is-portrait .menu-sticker {
    display: none;
}

body.is-portrait .menu-sticker img {
    width: 100%;
    height: auto;
    animation: menuLevitate var(--dur, 6s) linear infinite;
    animation-delay: var(--delay, 0s);
}

/* Mask group — fan */
body.is-portrait .menu-sticker--5 {
    display: block;
    left: 48px;
    top: 1788px;
    width: 294px;
    height: 276px;
    --dur: 5.9s;
    --delay: 0.6s;
    filter: drop-shadow(-4px 20px 0 rgba(91, 77, 112, 0.45));
    transform: rotate(17.17deg);
}

/* image 6 — kitsune */
body.is-portrait .menu-sticker--2 {
    display: block;
    left: 406px;
    top: 1788px;
    width: 258px;
    height: 270px;
    --dur: 6.4s;
    --delay: 0.4s;
    filter: drop-shadow(-4.75884px 23.7942px 0 rgba(91, 77, 112, 0.45));
    transform: rotate(-14.4deg);
}

/* image 5 — daruma */
body.is-portrait .menu-sticker--1 {
    display: block;
    left: 828px;
    top: 1800px;
    width: 198px;
    height: 213px;
    --dur: 5.8s;
    --delay: 0s;
    filter: drop-shadow(-5.07936px 25.3968px 0 rgba(91, 77, 112, 0.45));
    transform: rotate(11.76deg);
}

/* --- Levels: Frame 2136139339 — 1053.88×1616, centered, gap 64 --- */
body.is-portrait .levels-header {
    position: absolute;
    left: 50%;
    top: calc(50% - 808px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: 49px;
    width: 876px;
    height: 100px;
    flex: none;
}

body.is-portrait .levels-back,
body.is-portrait #leaderboard-screen .levels-back {
    position: relative;
    left: auto;
    top: auto;
    width: 280px;
    height: 100px;
    padding: 0 45px;
    font-size: 40px;
    gap: 20px;
    flex: none;
}

body.is-portrait .levels-title,
body.is-portrait #leaderboard-screen .levels-title {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: 240px;
    font-size: 64px;
    text-align: center;
    flex: none;
}

body.is-portrait .levels-stars-total,
body.is-portrait #leaderboard-screen .levels-stars-total {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 258px;
    min-width: 258px;
    height: 100px;
    padding: 0 45px;
    font-size: 40px;
    flex: none;
}

body.is-portrait .levels-board {
    left: 13.06px;
    top: calc(50% - 808px + 164px);
    transform: none;
    width: 1053.88px;
    height: 1452px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

body.is-portrait .levels-grid {
    order: 1;
    flex: none;
    width: 905.88px;
    height: 1452px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(7, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 24px;
}

body.is-portrait .level-cell {
    width: 100%;
    height: 100%;
    font-size: 38px;
    gap: 10px;
    padding: 16px 12px;
}

body.is-portrait .level-cell__stars {
    height: 46px;
    padding: 8px 16px;
    gap: 8px;
}

body.is-portrait .level-cell__star {
    width: 28px;
    height: 28px;
}

body.is-portrait .levels-arrow--prev { order: 0; }
body.is-portrait .levels-arrow--next { order: 2; }

body.is-portrait .levels-arrow {
    width: 62px;
    height: 84px;
}

body.is-portrait .levels-arrow img {
    width: 84px;
    height: 62px;
}

/* --- Leaderboard --- */
body.is-portrait .leaderboard-panel {
    left: 13.06px;
    top: calc(50% - 808px + 164px);
    transform: none;
    width: 1053.88px;
    height: 1452px;
    padding: 24px 24px 24px 20px;
    border-radius: 36px;
}

body.is-portrait .leaderboard-row {
    grid-template-columns: 90px 1fr 160px;
    min-height: 88px;
    padding: 12px 22px;
    border-radius: 22px;
}

body.is-portrait .leaderboard-row__rank,
body.is-portrait .leaderboard-row__score {
    font-size: 32px;
}

body.is-portrait .leaderboard-row__name {
    font-size: 30px;
}

body.is-portrait .leaderboard-status {
    font-size: 32px;
}

/* --- Gameplay: Figma 524:1738 — 1018 column, HUD | board | hints --- */
body.is-portrait .play-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 31px;
    gap: 64px;
    transform: scale(var(--play-scale, 1));
    transform-origin: center center;
}

body.is-portrait .play-left {
    display: grid;
    grid-template-columns: 359px 585px;
    grid-template-rows: 95px 150px;
    column-gap: 74px;
    row-gap: 36px;
    width: 1018px;
    height: 281px;
    align-items: stretch;
    justify-self: center;
    margin: 0;
    flex-shrink: 0;
}

body.is-portrait .play-icon-row {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    gap: 44px;
    align-items: center;
    justify-content: center;
    width: 359px;
}

body.is-portrait #btn-music-game,
body.is-portrait #btn-pause {
    width: 150px;
    height: 150px;
}

body.is-portrait .level-badge {
    grid-column: 1;
    grid-row: 1;
    width: 359px;
    height: 95px;
    font-size: 48px;
}

body.is-portrait .play-stats {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 24px;
    width: 585px;
    height: 281px;
}

body.is-portrait .stat-card {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 281px;
    border-radius: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 25px 30px;
}

body.is-portrait .stat-card__icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    margin-bottom: 20px;
}

body.is-portrait .stat-card__value {
    font-size: 64px;
    line-height: 1;
    letter-spacing: 0.01em;
    color: #5b4d70;
}

body.is-portrait .stat-card__label {
    font-weight: 900;
    font-size: 40px;
    line-height: 1;
    color: #5b4d70;
}

body.is-portrait .play-center {
    width: 1018px;
    flex: 0 0 auto;
}

body.is-portrait .board-frame {
    width: 1018px;
    height: 1018px;
    min-width: 1018px;
    min-height: 1018px;
    max-width: 1018px;
    max-height: 1018px;
    border-radius: 35px;
    padding: 36px;
}

body.is-portrait .play-right {
    flex-direction: row;
    width: 1018px;
    height: 324px;
    gap: 50px;
    justify-content: stretch;
    align-items: stretch;
    flex-shrink: 0;
}

body.is-portrait .hint-btn {
    width: auto;
    flex: 1 1 0;
    height: 324px;
    border-radius: 75px;
    font-size: 48px;
    gap: 17px;
    padding: 25px 30px;
}

body.is-portrait #btn-hint-peek .hint-btn__icon {
    width: 157px;
    height: 99px;
}

body.is-portrait #btn-hint-auto {
    gap: 20px;
}

body.is-portrait #btn-hint-auto .hint-btn__icon {
    width: 189px;
    height: 140px;
}

body.is-portrait .hint-btn__text {
    min-height: 96px;
    line-height: 1;
}

body.is-portrait #gameplay-screen.is-tutorial .play-right {
    visibility: hidden;
}

/* --- Tutorial --- */
body.is-portrait .tutorial-card {
    width: 920px;
    padding: 40px 40px 28px;
    border-radius: 36px;
}

body.is-portrait .tutorial-card__title {
    font-size: 56px;
}

body.is-portrait .tutorial-card__text {
    font-size: 28px;
    max-width: 800px;
    margin-bottom: 28px;
}

body.is-portrait .tutorial-card__btn {
    height: 112px;
    min-height: 112px;
    font-size: 48px;
}

body.is-portrait .tutorial-card__skip {
    font-size: 28px;
}

body.is-portrait .tutorial-card__stars img {
    width: 64px;
    height: 64px;
}

body.is-portrait .tutorial-float--1 { left: 12px; top: 200px; width: 196px; }
body.is-portrait .tutorial-float--2 { left: 8px; bottom: 320px; width: 176px; }
body.is-portrait .tutorial-float--3 { right: 8px; top: 180px; width: 210px; }
body.is-portrait .tutorial-float--4 { right: 10px; bottom: 300px; width: 200px; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    .memory-card__inner { transition: none; }
    .menu-sticker img { animation: none; }
    .tutorial-float { animation: none; }
    .tutorial-card__stars img { animation: none; }
    .tutorial-overlay.is-open .tutorial-card { animation: none; opacity: 1; transform: none; }
    * { animation-duration: 0.01ms !important; }
}
