@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@400;600;700;800;900&display=swap');

@font-face {
    font-family: 'Libras2020';
    src: url('./Libras2020-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-1: #05070f;
    --bg-2: #091328;
    --panel-border: rgba(255, 255, 255, 0.22);
    --text-main: #f8fbff;
    --text-soft: rgba(239, 247, 255, 0.72);
    --shadow-panel: 0 24px 56px rgba(2, 8, 32, 0.38);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --transition-smooth: 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--text-main);
    font-family: 'Nunito', 'Trebuchet MS', sans-serif;
    background:
        radial-gradient(circle at 20% 20%, rgba(77, 188, 255, 0.12), transparent 30%),
        radial-gradient(circle at 80% 15%, rgba(155, 109, 255, 0.14), transparent 26%),
        radial-gradient(circle at 50% 90%, rgba(28, 121, 178, 0.2), transparent 28%),
        linear-gradient(130deg, var(--bg-1) 0%, #090b17 28%, var(--bg-2) 52%, #0b1f3d 72%, #060a14 100%);
    background-attachment: fixed;
}

body:not(.game-on) {
    overflow-y: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        linear-gradient(125deg, rgba(255, 255, 255, 0.05), transparent 30%),
        radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 60%);
    pointer-events: none;
    z-index: -1;
}

button,
input,
select,
textarea {
    font: inherit;
}

.hidden {
    display: none !important;
}

.font-libras {
    font-family: 'Libras2020', sans-serif;
}

.glass-panel {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06)),
        rgba(8, 18, 53, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.08));
    pointer-events: none;
}

.page-shell {
    position: relative;
    z-index: 2;
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 18px 16px 32px;
}

.app-footer {
    position: fixed;
    left: 50%;
    bottom: 2px;
    z-index: 3;
    transform: translateX(-50%);
    padding: 0;
}

.app-footer span {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.03em;
    color: rgba(239, 247, 255, 0.66);
    white-space: nowrap;
}

.scene-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.decor-robo {
    position: fixed;
    right: -3.6vw;
    bottom: 0;
    z-index: 1;
    height: 66.67vh;
    width: auto;
    max-width: none;
    object-fit: contain;
    object-position: right bottom;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.scene-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(10px);
    opacity: 0.85;
    animation: orbFloat 18s ease-in-out infinite;
}

.scene-orb-left {
    top: -8%;
    left: -5%;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(113, 128, 255, 0.42), transparent 68%);
}

.scene-orb-right {
    top: 10%;
    right: -6%;
    width: 420px;
    height: 420px;
    animation-duration: 22s;
    background: radial-gradient(circle, rgba(78, 188, 255, 0.44), transparent 68%);
}

.scene-orb-bottom {
    bottom: -14%;
    left: 22%;
    width: 520px;
    height: 520px;
    animation-duration: 28s;
    background: radial-gradient(circle, rgba(64, 136, 255, 0.2), transparent 70%);
}

.scene-grid,
.scene-stars {
    position: absolute;
    inset: 0;
}

.scene-grid {
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(circle at center, black 24%, transparent 92%);
}

.scene-stars {
    opacity: 0.55;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px),
        radial-gradient(circle at 25% 60%, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px),
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.95) 0 1px, transparent 2px),
        radial-gradient(circle at 85% 65%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
        radial-gradient(circle at 52% 42%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px);
    animation: starsPulse 8s ease-in-out infinite;
}

.screen-flash {
    position: fixed;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.36), transparent 56%);
}

.screen-flash.is-visible {
    animation: screenFlash 0.65s ease forwards;
}

.screen-flash.is-soft {
    animation: screenFlashSoft 1.35s ease-out forwards;
}

.screen-flash.is-win {
    background:
        radial-gradient(circle at center, rgba(255, 244, 186, 0.58), transparent 40%),
        linear-gradient(135deg, rgba(87, 223, 255, 0.24), rgba(255, 110, 199, 0.22));
}

.hero-tag,
.board-pill,
.progress-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    color: #fef7ff;
    background: linear-gradient(120deg, rgba(87, 223, 255, 0.24), rgba(255, 110, 199, 0.28));
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-tag-center {
    margin: 0 auto;
}

.game-header {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    margin-bottom: 6px;
}

.hero-copy h1,
.modal-copy h1,
.win-modal-card h2,
.board-stage-copy h2,
.difficulty-heading h2 {
    margin: 0 0 10px;
    font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
    font-weight: 800;
    line-height: 0.96;
    letter-spacing: 0.02em;
}

.hero-copy h1 {
    font-size: clamp(1.6rem, 3.35vw, 2.14rem);
}

.hero-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.hero-title-stacked {
    display: block;
    text-align: left;
    margin: 0;
    line-height: 1;
    color: #35d9ff;
    text-shadow:
        0 0 8px rgba(53, 217, 255, 0.85),
        0 0 18px rgba(24, 163, 255, 0.55),
        0 6px 14px rgba(5, 22, 52, 0.42);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    height: auto;
    overflow: visible;
}

.hero-logo-name {
    display: block;
    width: 58px;
    height: 58px;
    object-fit: contain;
    transform: scale(2.4) translateY(-20px);
    transform-origin: top left;
    filter: drop-shadow(0 0 10px rgba(210, 235, 255, 0.35));
}

.hero-copy p,
.modal-copy p,
.board-stage-copy p,
.progress-copy p,
#final-message,
.difficulty-heading p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.78rem;
    line-height: 1.25;
}

.hud-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
}

.hud-card {
    position: relative;
    padding: 9px 10px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -10px 22px rgba(4, 10, 28, 0.28);
}

.hud-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.01) 55%);
    pointer-events: none;
}

.hud-card-score {
    background:
        radial-gradient(circle at 16% 10%, rgba(255, 210, 150, 0.52), transparent 38%),
        linear-gradient(155deg, rgba(255, 126, 18, 0.95), rgba(184, 78, 0, 0.96));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 12px 30px rgba(255, 125, 20, 0.34);
}

.hud-card-combo {
    background:
        radial-gradient(circle at 16% 10%, rgba(255, 242, 172, 0.52), transparent 38%),
        linear-gradient(155deg, rgba(255, 198, 24, 0.95), rgba(194, 141, 3, 0.96));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 12px 30px rgba(255, 201, 28, 0.34);
}

.hud-card-pairs {
    background:
        radial-gradient(circle at 16% 10%, rgba(255, 248, 188, 0.56), transparent 38%),
        linear-gradient(155deg, rgba(255, 220, 46, 0.96), rgba(214, 166, 0, 0.97));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 12px 30px rgba(255, 222, 52, 0.38);
}

.hud-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #0d2f63;
}

.hud-value {
    display: block;
    margin-top: 4px;
    font-size: clamp(1.22rem, 2.25vw, 1.62rem);
    line-height: 1;
    color: #08224a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

.hud-value-soft {
    color: rgba(9, 39, 81, 0.82);
    font-size: 0.74em;
}

.hud-footnote {
    margin: 4px 0 0;
    color: rgba(10, 43, 88, 0.9);
    font-size: 0.76rem;
}

.progress-shell {
    padding: 14px 18px;
    margin-bottom: 12px;
}

.progress-track {
    position: relative;
    height: 18px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(7, 15, 41, 0.55);
    box-shadow: inset 0 4px 18px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.progress-bar {
    position: relative;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.36) 0%, rgba(255, 255, 255, 0.05) 38%, rgba(0, 0, 0, 0.08) 100%),
        linear-gradient(90deg, #00c7ff 0%, #00e0ff 42%, #34f0ff 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.42),
        inset 0 -8px 14px rgba(0, 82, 114, 0.25),
        0 0 18px rgba(0, 219, 255, 0.75),
        0 0 34px rgba(0, 184, 255, 0.52);
    transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.progress-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 10%, rgba(255, 255, 255, 0.86) 50%, transparent 90%);
    transform: translateX(-120%);
    animation: progressSweep 2s linear infinite;
}

.board-stage {
    padding: 14px 16px 16px;
}

.board-stage-copy {
    max-width: 520px;
    margin-bottom: 10px;
}

.board-stage-copy h2 {
    font-size: clamp(1.2rem, 2.6vw, 1.6rem);
}

.game-grid {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    width: min(100%, 1120px);
    margin: 0 auto;
}

.layout-8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 680px;
}

.layout-12 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: 980px;
}

.layout-16 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    max-width: 1120px;
}

.layout-24 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    max-width: 1120px;
}

.card {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    cursor: pointer;
    perspective: 1600px;
    transform-style: preserve-3d;
    border: 0;
    padding: 0;
    background: transparent;
}

.card::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 24px;
    opacity: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.34), transparent 68%);
    transition: opacity var(--transition-smooth);
}

.card:hover::before {
    opacity: 1;
    background: radial-gradient(circle, rgba(24, 126, 255, 0.5), rgba(24, 126, 255, 0.16) 42%, transparent 72%);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 22px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.78s cubic-bezier(0.22, 1, 0.36, 1), filter var(--transition-smooth), box-shadow var(--transition-smooth);
    will-change: transform;
}

.card:hover .card-inner:not(.is-flipped):not(.is-matched) {
    transform: translateY(-5px) rotateX(6deg) rotateY(-7deg) scale(1.01);
    filter: brightness(1.08) saturate(1.08);
    box-shadow: 0 0 16px rgba(19, 117, 255, 0.6), 0 0 30px rgba(12, 86, 215, 0.42);
}

.card-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    border-radius: inherit;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
}

.card-front {
    transform: rotateY(0deg);
    z-index: 2;
    opacity: 1;
    padding: 0;
    background: #0d1733;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 12px 24px rgba(5, 14, 40, 0.32);
    transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s linear 0.14s;
}

.card-front-core {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-front-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.card-back {
    transform: rotateY(-180deg);
    z-index: 1;
    opacity: 0;
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.48);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 24px rgba(14, 24, 49, 0.16);
    transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s linear 0.14s;
}

.card-back.card-back-letter {
    background:
        radial-gradient(circle at 20% 14%, rgba(255, 255, 255, 0.22), transparent 22%),
        linear-gradient(155deg, #182f59 0%, #143663 38%, #144570 100%);
}

.card-back.card-back-sign {
    background:
        radial-gradient(circle at 20% 14%, rgba(255, 255, 255, 0.24), transparent 20%),
        linear-gradient(155deg, #2d1f59 0%, #2b2a75 34%, #214a76 100%);
}

.card-content-shell {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 8px;
}

.card-value {
    position: relative;
    font-size: clamp(2.8rem, 5vw, 4.4rem);
    line-height: 1;
    text-shadow: 0 12px 30px rgba(4, 10, 26, 0.34);
}

.card-value-letter {
    font-weight: 800;
    color: #d5e6ff;
    letter-spacing: -0.04em;
}

.card-value-sign {
    width: 100%;
    font-weight: 400;
    font-size: clamp(4.8rem, 9vw, 7.4rem);
    color: #ece2ff;
    letter-spacing: 0;
    transform: translateY(-1%);
}

.card-content-letter {
    align-content: center;
}

.card-content-sign {
    align-content: center;
    padding: 2px;
}

.card-inner.is-flipped {
    transform: none;
}

.card-inner.is-flipped .card-front {
    transform: rotateY(180deg);
    z-index: 1;
    opacity: 0;
}

.card-inner.is-flipped .card-back {
    transform: rotateY(0deg);
    z-index: 2;
    opacity: 1;
}

.card.matched {
    pointer-events: none;
}

.card.matched .card-inner {
    filter: saturate(0.88) brightness(1.05);
}

.card.matched .card-back {
    border-color: rgba(255, 240, 172, 0.95);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46), 0 0 0 1px rgba(255, 243, 176, 0.4), 0 22px 40px rgba(255, 202, 72, 0.3);
}

.card.matched::after {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 32px;
    background: radial-gradient(circle at center, rgba(255, 246, 173, 0.45), rgba(255, 246, 173, 0.04) 56%, transparent 70%);
    animation: matchedHalo 1.8s ease forwards;
}

.card.is-miss .card-inner {
    animation: missShake 0.62s ease;
    filter: saturate(1.1);
}

.card.is-miss .card-back {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.44), 0 0 0 1px rgba(255, 99, 146, 0.42), 0 0 30px rgba(255, 99, 146, 0.28);
}

.card.is-unflipping .card-front,
.card.is-unflipping .card-back {
    transition-duration: 0.28s, 0.12s;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(4, 9, 26, 0.58);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow-y: auto;
}

.start-modal-card {
    width: min(100%, 620px);
    padding: 16px;
    display: grid;
    gap: 12px;
}

.instruction-modal-card {
    width: min(100%, 520px);
    padding: 18px;
}

.instruction-modal-content {
    display: grid;
    gap: 12px;
    text-align: center;
}

.instruction-robo {
    width: min(100%, 140px);
    justify-self: center;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.instruction-modal-content h2 {
    margin: 0;
    font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
    font-size: clamp(1.3rem, 3.2vw, 1.9rem);
    line-height: 1;
    color: #35d9ff;
    text-shadow: 0 0 8px rgba(53, 217, 255, 0.55);
}

.instruction-modal-content p {
    margin: 0;
    color: rgba(239, 247, 255, 0.92);
    font-size: 1.22rem;
    font-weight: 700;
}

.win-modal-card {
    width: min(100%, 520px);
    padding: 20px;
}

.modal-glow,
.victory-ring {
    position: absolute;
    pointer-events: none;
}

.modal-glow {
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 110, 199, 0.42), transparent 68%);
    filter: blur(8px);
}

.modal-copy {
    text-align: center;
}

.modal-copy h1 {
    font-size: clamp(1.85rem, 5vw, 2.8rem);
    color: #35d9ff;
    text-shadow:
        0 0 8px rgba(53, 217, 255, 0.85),
        0 0 18px rgba(24, 163, 255, 0.55),
        0 6px 14px rgba(5, 22, 52, 0.42);
}

.modal-preview {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 104px;
}

.preview-card {
    position: absolute;
    width: 68px;
    aspect-ratio: 3 / 4;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(5, 15, 41, 0.2);
    animation: previewFloat 5.2s ease-in-out infinite;
}

.preview-card.font-libras {
    font-family: 'Libras2020', sans-serif;
    font-size: 4rem;
}

.preview-card-back {
    transform: translateX(-24px) rotate(-14deg);
    background: linear-gradient(155deg, #26238a, #05cec9);
}

.preview-card-letter {
    color: #104596;
    background: linear-gradient(155deg, #f8fdff, #a1dfff);
    transform: translateX(0) rotate(-4deg);
    animation-delay: -1.5s;
}

.preview-card-sign {
    color: #7b28d3;
    background: linear-gradient(155deg, #fff6fd, #cef3ff);
    transform: translateX(24px) rotate(8deg);
    animation-delay: -3s;
}

.feature-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.feature-chip {
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(246, 251, 255, 0.88);
    font-size: 0.68rem;
    font-weight: 800;
}

.difficulty-heading {
    text-align: center;
}

.difficulty-heading h2 {
    margin: 0;
    font-size: clamp(1.2rem, 3vw, 1.7rem);
}

.difficulty-heading p {
    max-width: 500px;
    margin-inline: auto;
    font-size: 0.82rem;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.difficulty-card,
.primary-cta {
    position: relative;
    border: 0;
    color: white;
    cursor: pointer;
    overflow: hidden;
}

.difficulty-card {
    display: grid;
    gap: 4px;
    min-height: 94px;
    padding: 12px;
    border-radius: 16px;
    text-align: left;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), filter var(--transition-smooth);
    box-shadow: 0 12px 20px rgba(5, 14, 40, 0.14);
}

.difficulty-card strong {
    position: relative;
    z-index: 1;
    font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow:
        0 2px 0 rgba(255, 255, 255, 0.2),
        0 10px 18px rgba(0, 0, 0, 0.34);
}

.difficulty-card span,
.difficulty-card small {
    position: relative;
    z-index: 1;
}

.difficulty-card span {
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.05;
}

.difficulty-card small {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.84rem;
    line-height: 1.3;
}

.difficulty-card:hover {
    transform: translateY(-2px) scale(1.005);
    filter: brightness(1.08);
    box-shadow:
        0 12px 20px rgba(5, 14, 40, 0.14),
        0 0 12px rgba(40, 193, 255, 0.42),
        0 0 24px rgba(16, 128, 224, 0.28);
}

.difficulty-glow {
    position: absolute;
    inset: auto auto -40px -20px;
    width: 58px;
    height: 58px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    filter: blur(10px);
}

.difficulty-level-art {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 108px;
    height: 108px;
    object-fit: contain;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.difficulty-easy {
    background: linear-gradient(145deg, #00b78f, #52e5ac);
}

.difficulty-medium {
    background: linear-gradient(145deg, #2076ff, #55d5ff);
}

.difficulty-hard {
    background: linear-gradient(145deg, #7b3df1, #ff6cd0);
}

.difficulty-epic {
    background: linear-gradient(145deg, #ff7a18, #ff3cac);
}

.win-modal-card {
    position: relative;
    text-align: center;
}

.victory-ring {
    top: -80px;
    left: 50%;
    width: 160px;
    height: 160px;
    border-radius: 999px;
    transform: translateX(-50%);
    background: radial-gradient(circle at center, rgba(255, 244, 186, 0.78), rgba(255, 244, 186, 0.12) 46%, transparent 72%);
    filter: blur(6px);
}

.win-modal-card h2 {
    font-size: clamp(2rem, 6vw, 3rem);
}

.victory-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 14px;
}

.victory-stat {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.victory-stat span {
    display: block;
    color: rgba(236, 245, 255, 0.72);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.victory-stat strong {
    display: block;
    margin-top: 10px;
    font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
    font-size: clamp(1.6rem, 5vw, 2.5rem);
    line-height: 1;
}

.victory-stars {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}

.victory-star {
    position: relative;
    width: 22px;
    height: 22px;
    transform: rotate(45deg) scale(0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.victory-star.is-active {
    background: linear-gradient(145deg, #ffe675, #ff9f4a);
    box-shadow: 0 0 20px rgba(255, 214, 104, 0.66), 0 0 36px rgba(255, 151, 78, 0.35);
}

.primary-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 12px 18px;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.06) 42%, rgba(0, 0, 0, 0.08) 100%),
        linear-gradient(135deg, #0077d9 0%, #0094e6 52%, #1caef5 100%);
    box-shadow:
        0 0 18px rgba(0, 139, 230, 0.66),
        0 0 36px rgba(0, 112, 205, 0.44),
        0 18px 34px rgba(0, 76, 145, 0.36),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    font-weight: 900;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), filter var(--transition-smooth);
}

.primary-cta:hover {
    transform: translateY(-4px);
    filter: brightness(1.08);
}

.particle,
.shockwave,
.praise-badge,
.confetti {
    position: fixed;
    pointer-events: none;
    z-index: 55;
}

.particle {
    border-radius: 999px;
    animation: particleBurst 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.shockwave {
    width: 26px;
    height: 26px;
    margin-left: -13px;
    margin-top: -13px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 0 25px rgba(255, 221, 129, 0.6), inset 0 0 18px rgba(255, 255, 255, 0.48);
    animation: shockwavePulse 0.75s ease-out forwards;
}

.praise-badge {
    padding: 10px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 234, 148, 0.96), rgba(255, 148, 82, 0.95));
    color: #5a2100;
    font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 18px 32px rgba(255, 154, 73, 0.34);
    animation: praiseRise 1.15s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.confetti {
    width: 10px;
    height: 18px;
    opacity: 0.98;
}

.animate-bounce-in {
    animation: bounceIn 0.75s cubic-bezier(0.18, 0.9, 0.32, 1.25);
}

.animate-combo {
    animation: comboPulse 0.52s ease;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translateY(22px) scale(0.92); }
    60% { opacity: 1; transform: translateY(-4px) scale(1.03); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.22); text-shadow: 0 0 26px rgba(255, 224, 126, 0.75); }
    100% { transform: scale(1); }
}

@keyframes orbFloat {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(18px, -22px, 0) scale(1.08); }
}

@keyframes starsPulse {
    0%, 100% { opacity: 0.38; }
    50% { opacity: 0.72; }
}

@keyframes progressSweep {
    from { transform: translateX(-120%); }
    to { transform: translateX(120%); }
}

@keyframes matchedHalo {
    0% { opacity: 0.9; transform: scale(0.84); }
    100% { opacity: 0; transform: scale(1.28); }
}

@keyframes missShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

@keyframes particleBurst {
    0% { transform: translate(-50%, -50%) scale(0.1); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.35); opacity: 0; }
}

@keyframes shockwavePulse {
    0% { transform: scale(0.2); opacity: 0.92; }
    100% { transform: scale(4.4); opacity: 0; }
}

@keyframes praiseRise {
    0% { transform: translate(-50%, 6px) scale(0.85); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translate(-50%, -62px) scale(1.06); opacity: 0; }
}

@keyframes screenFlash {
    0% { opacity: 0; }
    28% { opacity: 0.95; }
    100% { opacity: 0; }
}

@keyframes screenFlashSoft {
    0% { opacity: 0; }
    30% { opacity: 0.42; }
    100% { opacity: 0; }
}

@keyframes previewFloat {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -10px; }
}

@media (max-width: 960px) {
    .game-header,
    .progress-shell {
        grid-template-columns: 1fr;
    }

    .hud-grid {
        grid-template-columns: 1fr;
    }

    .layout-16,
    .layout-24 {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .page-shell {
        padding: 14px 12px 24px;
    }

    .game-header,
    .progress-shell,
    .board-stage,
    .start-modal-card,
    .win-modal-card {
        padding: 16px 14px;
    }

    .difficulty-grid,
    .victory-stats {
        grid-template-columns: 1fr;
    }

    .layout-12,
    .layout-16,
    .layout-24 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .modal-preview {
        min-height: 88px;
    }

    .preview-card {
        width: 58px;
        font-size: 1.75rem;
    }

    .preview-card-back {
        transform: translateX(-18px) rotate(-14deg);
    }

    .preview-card-sign {
        transform: translateX(18px) rotate(8deg);
    }

    .layout-8,
    .layout-12,
    .layout-16,
    .layout-24 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .card-badge {
        font-size: 0.64rem;
        letter-spacing: 0.12em;
    }

    .card-hint {
        font-size: 0.72rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
