:root {
    --paper: #fffaf0;
    --paper-strong: #fffdf7;
    --cream: #fff3dc;
    --cream-soft: rgba(255, 248, 235, 0.78);
    --mint: #69d7c6;
    --mint-soft: #dff9ee;
    --sky: #74b7ff;
    --sky-soft: #e0f4ff;
    --purple: #9b78f2;
    --purple-soft: #efe8ff;
    --gold: #ffc75d;
    --gold-soft: #fff2c6;
    --peach: #ff9e8f;
    --peach-soft: #ffe5db;
    --rose: #ef7192;
    --ink: #28344f;
    --ink-soft: #67708a;
    --line: rgba(141, 115, 86, 0.14);
    --white-line: rgba(255, 255, 255, 0.86);
    --shadow-panel: 0 18px 44px rgba(141, 115, 86, 0.16);
    --shadow-card: 0 12px 24px rgba(111, 86, 136, 0.14);
    --shadow-pop: 0 28px 70px rgba(120, 91, 138, 0.24);
    --radius-panel: 22px;
    --radius-card: 8px;
    --duration-fast: 160ms;
    --duration-base: 260ms;
}

* {
    letter-spacing: 0;
}

html {
    min-height: 100%;
    background: var(--cream);
}

body {
    min-height: 100%;
    margin: 0;
    font-family: 'Prompt', 'Helvetica Neue', Arial, sans-serif;
    color: var(--ink);
    background-color: var(--cream);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 245, 228, 0.18)),
        url('../img/game-table-background.svg');
    background-position: center top, center top;
    background-repeat: no-repeat, no-repeat;
    background-size: cover, cover;
    background-attachment: fixed, fixed;
    overflow-x: hidden;
}

a,
button {
    transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease, background var(--duration-fast) ease, transform var(--duration-base) ease, box-shadow var(--duration-base) ease, opacity var(--duration-base) ease;
}

button {
    font-family: inherit;
}

.game-shell {
    width: min(100%, 1500px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px 18px 24px;
}

.game-topbar {
    position: sticky;
    top: 12px;
    z-index: 50;
    display: grid;
    grid-template-columns: minmax(270px, 360px) minmax(360px, 1fr) minmax(320px, 320px);
    align-items: center;
    gap: 18px;
    min-height: 108px;
    margin-bottom: 22px;
    padding: 14px 20px;
    border: 2px solid var(--white-line);
    border-radius: var(--radius-panel);
    background: rgba(255, 253, 248, 0.9);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(18px);
}

.brand-lockup {
    display: grid;
    grid-template-columns: auto 1px 1fr;
    align-items: center;
    gap: 18px;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

.brand-lockup:hover,
.brand-lockup:focus {
    color: var(--ink);
    text-decoration: none;
    outline: none;
}

.brand-kme {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 134px;
    font-size: 3.25rem;
    font-weight: 900;
    line-height: 1;
}

.brand-kme img {
    display: block;
    width: 150px;
    max-width: 100%;
    height: auto;
}

.brand-kme span:nth-child(1) {
    color: #5fd6c7;
}

.brand-kme span:nth-child(2) {
    color: #ffbc54;
}

.brand-kme span:nth-child(3) {
    color: #a98af5;
}

.brand-divider {
    display: block;
    width: 1px;
    height: 62px;
    background: linear-gradient(180deg, transparent, rgba(92, 79, 112, 0.22), transparent);
}

.brand-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.brand-copy strong,
.brand-copy small,
.metric-copy small,
.card-modal .modal-header small {
    display: block;
}

.brand-copy strong {
    color: var(--ink);
    font-size: 1.03rem;
    font-weight: 800;
}

.brand-copy small {
    color: var(--purple);
    font-size: 1rem;
    font-weight: 800;
}

.game-title-mark {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    min-height: 78px;
}

.game-title-mark img {
    display: block;
    width: min(100%, 430px);
    max-height: 92px;
    object-fit: contain;
    filter: drop-shadow(0 8px 10px rgba(111, 86, 136, 0.16));
}

.game-title-mark>strong {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-size: 2.7rem;
    font-weight: 900;
    line-height: 0.96;
    text-transform: uppercase;
    text-shadow: 0 4px 0 rgba(255, 255, 255, 0.96), 0 10px 18px rgba(111, 86, 136, 0.14);
}

.game-title-mark>strong span:first-child {
    color: #34b7a6;
}

.game-title-mark>strong span:last-child {
    color: #d36c8f;
}

.game-title-mark small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 28px;
    margin-top: 7px;
    padding: 3px 22px 4px;
    color: #935d2c;
    border: 2px solid rgba(220, 155, 86, 0.32);
    border-radius: 999px 999px 14px 14px;
    background: linear-gradient(180deg, #fff3c4, #ffd88c);
    box-shadow: 0 7px 14px rgba(199, 142, 73, 0.18);
    font-size: 1.02rem;
    font-weight: 800;
}

.game-title-mark small i {
    color: #8fd9ee;
    font-size: 1rem;
}

.spark {
    position: absolute;
    top: 12px;
    color: #ffc356;
    font-size: 1rem;
    text-shadow: 0 4px 8px rgba(236, 162, 45, 0.2);
}

.spark-left {
    left: 62px;
}

.spark-right {
    right: 62px;
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-width: 0;
}

.top-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 142px;
    min-height: 52px;
    padding: 12px 18px;
    color: #ffffff;
    border: 0;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(105, 86, 140, 0.18), inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.top-action-btn:hover,
.top-action-btn:focus {
    color: #ffffff;
    transform: translateY(-3px);
    outline: none;
}

.action-purple {
    background: linear-gradient(135deg, #9e7cf5, #8061df);
}

.action-gold {
    color: #8f6422;
    background: linear-gradient(135deg, #ffe08a, #ffc75d);
}

.action-gold:hover,
.action-gold:focus {
    color: #8f6422;
}

.action-mint {
    background: linear-gradient(135deg, #74dbcb, #48c2b7);
}

.game-layout {
    display: grid;
    gap: 22px;
}

.game-status-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px;
}

.status-metric,
.status-progress,
.board-panel,
.system-message {
    color: var(--ink);
    border: 2px solid var(--white-line);
    border-radius: var(--radius-panel);
    background: rgba(255, 253, 247, 0.86);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(16px);
}

.status-metric,
.status-progress {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 108px;
    padding: 10px;
}

.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    color: #9b61e6;
    border: 3px solid #ffffff;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--purple-soft), #f7f1ff);
    box-shadow: 0 11px 21px rgba(121, 89, 191, 0.12);
    font-size: 1.55rem;
}

.metric-teal {
    color: #42b8aa;
    background: linear-gradient(135deg, var(--mint-soft), #eefdf8);
}

.metric-coral {
    color: #ed7a65;
    background: linear-gradient(135deg, var(--peach-soft), #fff4e9);
}

.metric-blue {
    color: #6898ee;
    background: linear-gradient(135deg, var(--sky-soft), #f2f7ff);
}

.metric-icon i {
    font-size: 40px;
}

.metric-copy {
    display: grid;
    min-width: 0;
}

.metric-copy small {
    color: var(--ink-soft);
    font-size: 1rem;
    font-weight: 900;
}

.metric-copy strong {
    display: block;
    margin-top: 2px;
    color: var(--ink-soft);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.metric-copy span {
    font-size: 2rem;
    font-weight: 900;
    color: var(--purple);
}

.progress-copy {
    width: 100%;
}

.progress-copy strong {
    color: #638ee9;
}

.progress-track {
    height: 13px;
    margin-top: 7px;
    overflow: hidden;
    border: 3px solid #ffffff;
    border-radius: 999px;
    background: rgba(195, 214, 230, 0.62);
    box-shadow: inset 0 2px 8px rgba(74, 115, 157, 0.08);
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6ea6ff, #7d8df1);
    transition: width 360ms ease;
}

.board-panel {
    overflow: hidden;
    background: rgba(255, 253, 247, 0.76);
}

.board-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 30px 10px;
}

.board-heading h1 {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: #6a5e93;
    font-size: 1.22rem;
    font-weight: 900;
    line-height: 1.2;
}

.board-heading h1::before {
    content: '\f005';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #ffd25e;
    font-family: 'Font Awesome 5 Free';
    font-size: 1.04rem;
    font-weight: 900;
    text-shadow: 0 2px 0 #ffffff, 0 7px 12px rgba(255, 177, 79, 0.28);
}

.board-heading p,
.board-actions,
.random-btn,
.float-action-btn {
    display: none;
}

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
    padding: 14px 30px 32px;
}

.bingo-card {
    min-width: 0;
    margin: 0;
}

.bingo-card-link {
    --card-a: #bfeee5;
    --card-b: #88d8cf;
    --card-accent: #5ccbbb;
    position: relative;
    display: block;
    min-height: 242px;
    aspect-ratio: 5 / 7;
    overflow: hidden;
    color: var(--ink);
    border: 4px solid #ffffff;
    border-radius: var(--radius-card);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 40%),
        linear-gradient(145deg, var(--card-a), var(--card-b));
    box-shadow: var(--shadow-card);
    text-decoration: none;
    isolation: isolate;
}

.bingo-card:nth-child(4n + 1) .bingo-card-link {
    --card-a: #dff9ee;
    --card-b: #90ddd3;
    --card-accent: #56c4b8;
}

.bingo-card:nth-child(4n + 2) .bingo-card-link {
    --card-a: #ffe6d6;
    --card-b: #ffd58e;
    --card-accent: #ffb65f;
}

.bingo-card:nth-child(4n + 3) .bingo-card-link {
    --card-a: #eee8ff;
    --card-b: #d7ccff;
    --card-accent: #a88bf1;
}

.bingo-card:nth-child(4n) .bingo-card-link {
    --card-a: #fff3b8;
    --card-b: #ddf4cf;
    --card-accent: #e5c44f;
}

.bingo-card-link::before {
    content: '';
    position: absolute;
    inset: 11px;
    border: 2px solid rgba(255, 255, 255, 0.78);
    border-radius: 6px;
    pointer-events: none;
    z-index: 4;
}

.bingo-card-link::after {
    content: '';
    position: absolute;
    inset: 23px;
    border-radius: 6px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 45%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0));
    pointer-events: none;
    z-index: 1;
}

.bingo-card-link:hover,
.bingo-card-link:focus {
    color: var(--ink);
    text-decoration: none;
    transform: translateY(-8px);
    box-shadow: 0 20px 34px rgba(116, 85, 137, 0.22), 0 0 0 4px rgba(255, 255, 255, 0.78);
    outline: none;
}

.card-back-mark {
    position: absolute;
    inset: 36px 18px 52px;
    z-index: 3;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: #ffffff;
    text-align: center;
    text-shadow: 0 2px 5px rgba(57, 137, 128, 0.22);
}

.card-back-mark i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    border: 4px solid rgba(255, 255, 255, 0.68);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    font-size: 2.2rem;
}

.card-back-mark span {
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 0.95;
}

.bingo-card-art {
    position: absolute;
    inset: 11px;
    z-index: 2;
    width: calc(100% - 22px);
    height: calc(100% - 22px);
    object-fit: contain;
    opacity: 0;
    transform: scale(0.96);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition:
        transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 260ms ease,
        opacity 240ms ease;
    will-change: transform, opacity;
}

.bingo-card-link:hover .bingo-card-art {
    transform: scale(1.02);
}

.bingo-card-title {
    position: absolute;
    left: 30px;
    right: 0;
    bottom: 35px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-height: 40px;
    width: 70%;
    padding: 5px 12px;
    color: var(--ink);
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    background: rgba(255, 253, 247, 0.9);
    box-shadow: 0 9px 18px rgba(133, 103, 145, 0.12);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0.92rem;
    font-weight: 800;
}

.overlay-mask {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 34%),
        linear-gradient(0deg, rgba(76, 149, 143, 0.2), transparent 35%);
    opacity: 0.8;
    pointer-events: none;
}

/* .card-corner {
    position: absolute;
    z-index: 6;
    width: 35px;
    height: 35px;
    border-color: #ffffff;
    pointer-events: none;
    filter: drop-shadow(0 2px 1px rgba(55, 77, 96, 0.34));
}

.card-corner-top {
    top: 13px;
    left: 13px;
    border-top: 4px solid;
    border-left: 4px solid;
}

.card-corner-bottom {
    right: 13px;
    bottom: 13px;
    border-right: 4px solid;
    border-bottom: 4px solid;
} */

.bingo-card.is-revealed .bingo-card-link {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.bingo-card.is-revealed .card-back-mark,
.bingo-card.is-revealed .overlay-mask {
    opacity: 0;
}

.bingo-card.is-revealed .bingo-card-art {
    opacity: 1;
    filter: saturate(1.06);
}

.bingo-card.is-revealed .bingo-card-art.is-image-swapping {
    opacity: 0;
    filter: saturate(0.92) blur(0.5px);
    transform: scale(0.975) rotateY(-10deg);
}

.bingo-card.is-revealed .bingo-card-title {
    color: #347bb7;
    background: rgba(255, 255, 255, 0.94);
}

.card-modal.fade .modal-dialog {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.985);
    transition:
        transform 300ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 220ms ease;
    will-change: transform, opacity;
}

.card-modal.show .modal-dialog {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.modal-backdrop.fade {
    transition: opacity 220ms ease;
}

.modal-backdrop.show {
    opacity: 0.58;
}

.card-modal .modal-dialog {
    max-width: min(640px, calc(100vw - 30px));
}

.card-modal .modal-content {
    overflow: visible;
    color: var(--ink);
    border: 4px solid #ffffff;
    border-radius: 26px;
    background: rgba(255, 251, 239, 0.96);
    box-shadow: var(--shadow-pop);
    transform: translateZ(0);
    backface-visibility: hidden;
}

.card-modal .modal-header {
    align-items: flex-start;
    padding: 26px 34px 10px;
    border-bottom: 0;
}

.card-modal .modal-header small {
    color: #cc5f88;
    font-size: 0.82rem;
    font-weight: 800;
}

.card-modal .modal-title {
    margin: 7px 0 0;
    color: var(--ink);
    font-size: 1.55rem;
    font-weight: 900;
}

.card-modal .close {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 3;
    width: 56px;
    height: 56px;
    padding: 0;
    color: #7a6c5e;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: rgba(255, 252, 246, 0.98);
    opacity: 1;
    box-shadow: 0 8px 18px rgba(130, 102, 86, 0.24);
}

.card-modal .close:hover,
.card-modal .close:focus {
    color: var(--ink);
    transform: rotate(7deg);
    outline: none;
}

.card-modal .modal-body {
    display: grid;
    place-items: center;
    padding: 8px 34px 24px;
}

.card-modal .modal-body img {
    display: block;
    width: min(100%, 540px);
    max-height: 68vh;
    object-fit: contain;
    padding: 12px;
    border: 4px solid #ffffff;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(229, 249, 245, 0.74));
    box-shadow: 0 15px 34px rgba(103, 126, 147, 0.17), inset 0 0 0 3px rgba(149, 215, 255, 0.25);
    backface-visibility: hidden;
    transform: translateZ(0);
    transition:
        transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 220ms ease,
        filter 220ms ease;
    will-change: transform, opacity;
}

.card-modal .modal-body img.is-flipping {
    opacity: 0.22;
    filter: blur(0.5px) saturate(0.92);
    transform: perspective(900px) rotateY(82deg) scale(0.985);
}

.card-modal .modal-footer {
    justify-content: stretch;
    padding: 0 34px 32px;
    border-top: 0;
}

.reveal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    color: #ffffff;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #62a5ff, #706de4);
    font-size: 1.05rem;
    font-weight: 900;
    box-shadow: 0 15px 24px rgba(85, 121, 216, 0.24), inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.reveal-btn:hover,
.reveal-btn:focus {
    color: #ffffff;
    transform: translateY(-2px);
    outline: none;
}

.reveal-btn:disabled {
    color: #ffffff;
    cursor: default;
    background: linear-gradient(135deg, #42b8aa, #347bb7);
    box-shadow: none;
    opacity: 0.94;
}

.game-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 18px 6px 0;
    color: rgba(64, 69, 89, 0.64);
    font-size: 0.9rem;
    font-weight: 600;
}

.footer-credits {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.footer-credit-link {
    color: var(--purple);
    font-weight: 800;
    text-decoration: none;
}

.footer-credit-link:hover,
.footer-credit-link:focus {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    outline: none;
}

.footer-credit-link.is-disabled {
    color: rgba(64, 69, 89, 0.72);
}

html.onboarding-lock,
body.onboarding-lock {
    overflow: hidden;
    overscroll-behavior: none;
}

.onboarding-preloader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: 24px;
    background-color: var(--cream);
    background-image:
        linear-gradient(135deg, rgba(255, 253, 247, 0.95), rgba(226, 249, 244, 0.9) 46%, rgba(255, 241, 220, 0.92)),
        url('../img/game-table-background.svg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 320ms ease, visibility 320ms ease;
}

.onboarding-preloader::before {
    content: '';
    position: absolute;
    inset: 15px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    box-shadow:
        inset 0 0 0 1px rgba(141, 115, 86, 0.08),
        0 18px 46px rgba(141, 115, 86, 0.12);
    pointer-events: none;
}

.onboarding-preloader.is-leaving {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.onboarding-preloader__panel {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 20px;
    width: min(100%, 610px);
    min-height: 390px;
    padding: 54px 42px 42px;
    overflow: hidden;
    color: var(--ink);
    text-align: center;
    border: 3px solid var(--white-line);
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent 42%),
        rgba(255, 253, 248, 0.9);
    box-shadow:
        0 28px 70px rgba(120, 91, 138, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(18px);
}

.onboarding-preloader__panel::before,
.onboarding-preloader__panel::after {
    content: '';
    position: absolute;
    z-index: 0;
    width: 118px;
    height: 166px;
    border: 4px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 18px 28px rgba(111, 86, 136, 0.12);
    opacity: 0.86;
}

.onboarding-preloader__panel::before {
    top: 26px;
    left: -26px;
    background: linear-gradient(145deg, #dff9ee, #91ddd3);
    transform: rotate(-12deg);
}

.onboarding-preloader__panel::after {
    right: -24px;
    bottom: 36px;
    background: linear-gradient(145deg, #fff3b8, #ffd58e);
    transform: rotate(11deg);
}

.onboarding-preloader__deck,
.onboarding-preloader__logo,
.onboarding-preloader__progress,
.onboarding-preloader__sparkles {
    position: relative;
    z-index: 1;
}

.onboarding-preloader__deck {
    width: 196px;
    height: 84px;
}

.onboarding-card {
    position: absolute;
    top: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 78px;
    color: #ffffff;
    border: 4px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 14px 24px rgba(111, 86, 136, 0.14);
}

.onboarding-card i {
    font-size: 1.45rem;
    text-shadow: 0 2px 6px rgba(72, 93, 118, 0.18);
}

.onboarding-card--mint {
    left: 25px;
    background: linear-gradient(145deg, #8de1d4, #55c4b8);
    transform: rotate(-11deg);
    animation: onboarding-card-left 1800ms ease-in-out infinite;
}

.onboarding-card--gold {
    left: 66px;
    z-index: 2;
    background: linear-gradient(145deg, #ffe79b, #ffc75d);
    transform: translateY(-8px);
    animation: onboarding-card-center 1700ms ease-in-out infinite;
}

.onboarding-card--rose {
    right: 25px;
    background: linear-gradient(145deg, #ffb0a4, #ef7192);
    transform: rotate(11deg);
    animation: onboarding-card-right 1850ms ease-in-out infinite;
}

.onboarding-preloader__logo {
    display: block;
    width: min(100%, 470px);
    max-height: 152px;
    object-fit: contain;
    filter: drop-shadow(0 16px 19px rgba(111, 86, 136, 0.18));
    animation: onboarding-float 1500ms ease-in-out infinite;
}

.onboarding-preloader__progress {
    position: relative;
    width: min(100%, 410px);
    height: 16px;
    padding: 3px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    background: rgba(199, 214, 230, 0.58);
    box-shadow: inset 0 2px 8px rgba(74, 115, 157, 0.08);
}

.onboarding-preloader__progress span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--mint), var(--sky), var(--purple), var(--gold));
    transform: scaleX(0);
    transform-origin: left center;
    animation: onboarding-progress 1200ms linear forwards;
}

.onboarding-preloader__sparkles {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.onboarding-preloader__sparkles span {
    position: absolute;
    width: 18px;
    height: 18px;
    color: var(--gold);
    filter: drop-shadow(0 4px 8px rgba(236, 162, 45, 0.18));
    animation: onboarding-sparkle 1200ms ease-in-out infinite;
}

.onboarding-preloader__sparkles span::before,
.onboarding-preloader__sparkles span::after {
    content: '';
    position: absolute;
    inset: 7px 0;
    border-radius: 999px;
    background: currentColor;
}

.onboarding-preloader__sparkles span::after {
    transform: rotate(90deg);
}

.onboarding-preloader__sparkles span:nth-child(1) {
    top: 44px;
    left: 78px;
}

.onboarding-preloader__sparkles span:nth-child(2) {
    top: 76px;
    right: 88px;
    color: var(--mint);
    animation-delay: 180ms;
}

.onboarding-preloader__sparkles span:nth-child(3) {
    right: 138px;
    bottom: 76px;
    color: var(--purple);
    animation-delay: 360ms;
}

.onboarding-preloader__sparkles span:nth-child(4) {
    bottom: 98px;
    left: 112px;
    color: var(--peach);
    animation-delay: 540ms;
}

.loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(255, 248, 231, 0.66);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--duration-base) ease, visibility var(--duration-base) ease;
}

.loader::after {
    content: '';
    width: 76px;
    height: 76px;
    border: 7px solid rgba(255, 255, 255, 0.72);
    border-top-color: var(--rose);
    border-right-color: var(--sky);
    border-bottom-color: var(--mint);
    border-radius: 50%;
    animation: spin 720ms linear infinite;
    box-shadow: 0 10px 30px rgba(115, 88, 184, 0.16);
}

.loader.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.system-message {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px;
}

.system-message i {
    color: var(--rose);
    font-size: 2rem;
}

.system-message h1 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 900;
}

.system-message p {
    margin: 0;
    color: var(--ink-soft);
}

.pulse {
    animation: pulse 680ms ease;
}

.swal-modal {
    border: 4px solid #ffffff;
    border-radius: 20px;
    background: var(--paper-strong);
    box-shadow: var(--shadow-pop);
}

.swal-title {
    color: var(--ink);
    font-family: 'Prompt', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 900;
}

.swal-text {
    color: var(--ink-soft);
    font-family: 'Prompt', 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
}

.swal-button {
    border-radius: 999px;
    background: var(--mint);
    font-family: 'Prompt', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 800;
}

.swal-button:not([disabled]):hover {
    background: #45bcb0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes onboarding-progress {
    to {
        transform: scaleX(1);
    }
}

@keyframes onboarding-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

@keyframes onboarding-card-left {

    0%,
    100% {
        transform: rotate(-11deg) translateY(0);
    }

    50% {
        transform: rotate(-15deg) translateY(-5px);
    }
}

@keyframes onboarding-card-center {

    0%,
    100% {
        transform: translateY(-8px);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes onboarding-card-right {

    0%,
    100% {
        transform: rotate(11deg) translateY(0);
    }

    50% {
        transform: rotate(15deg) translateY(-5px);
    }
}

@keyframes onboarding-sparkle {

    0%,
    100% {
        opacity: 0.42;
        transform: scale(0.72) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.08) rotate(45deg);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .onboarding-preloader__logo {
        transform: none;
    }

    .onboarding-card,
    .onboarding-preloader__sparkles span {
        animation: none !important;
    }
}

@media (max-width: 1480px) {
    .game-topbar {
        grid-template-columns: minmax(250px, 330px) minmax(320px, 1fr) minmax(300px, 300px);
    }

    .brand-kme {
        min-width: 116px;
        font-size: 2.82rem;
    }

    .brand-kme img {
        width: 108px;
    }

    .game-title-mark>strong {
        font-size: 2.35rem;
    }

    .game-title-mark img {
        width: min(100%, 390px);
        max-height: 86px;
    }

    .top-action-btn {
        min-width: 128px;
        padding-inline: 14px;
    }
}

@media (max-width: 1200px) {
    .game-topbar {
        grid-template-columns: 1fr;
        position: static;
    }

    .brand-lockup,
    .top-actions {
        justify-self: center;
    }

    .game-status-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }
}

@media (max-width: 860px) {
    body {
        background-attachment: scroll, scroll;
    }

    .onboarding-preloader {
        padding: 14px;
    }

    .onboarding-preloader::before {
        inset: 10px;
        border-radius: 22px;
    }

    .onboarding-preloader__panel {
        gap: 16px;
        min-height: 350px;
        padding: 34px 22px 30px;
        border-radius: 22px;
    }

    .onboarding-preloader__deck {
        width: 164px;
        height: 72px;
    }

    .onboarding-card {
        width: 56px;
        height: 66px;
    }

    .onboarding-card--mint {
        left: 18px;
    }

    .onboarding-card--gold {
        left: 54px;
    }

    .onboarding-card--rose {
        right: 18px;
    }

    .onboarding-preloader__logo {
        max-height: 112px;
    }

    .game-shell {
        padding: 12px;
    }

    .game-topbar {
        gap: 14px;
        min-height: auto;
        padding: 14px;
    }

    .brand-lockup {
        width: 100%;
        grid-template-columns: auto 1px 1fr;
    }

    .brand-kme {
        min-width: 98px;
        font-size: 2.36rem;
    }

    .brand-kme img {
        width: 92px;
    }

    .brand-divider {
        height: 52px;
    }

    .brand-copy strong {
        font-size: 0.96rem;
    }

    .brand-copy small {
        font-size: 0.9rem;
    }

    .game-title-mark>strong {
        flex-wrap: wrap;
        justify-content: center;
        gap: 7px;
        font-size: 2rem;
    }

    .game-title-mark img {
        width: min(100%, 330px);
        max-height: 78px;
    }

    .game-title-mark small {
        font-size: 0.94rem;
    }

    .spark {
        display: none;
    }

    .top-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .top-action-btn {
        flex: 1 1 150px;
        min-width: 0;
        min-height: 50px;
        font-size: 0.94rem;
    }

    .game-status-panel {
        grid-template-columns: 1fr;
    }

    .status-metric,
    .status-progress {
        min-height: 94px;
        padding: 10px;
    }

    .board-heading {
        padding: 18px 18px 8px;
    }

    .bingo-grid {
        grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
        gap: 12px;
        padding: 12px 14px 18px;
    }

    .bingo-card-link {
        min-height: 198px;
    }

    .card-back-mark {
        inset: 32px 13px 48px;
    }

    .card-back-mark i {
        width: 52px;
        height: 52px;
        font-size: 1.75rem;
    }

    .card-back-mark span {
        font-size: 0.86rem;
    }

    .card-modal .modal-dialog {
        max-width: calc(100vw - 16px);
        margin: 8px;
    }

    .card-modal .modal-header {
        padding: 22px 20px 8px;
    }

    .card-modal .modal-title {
        font-size: 1.28rem;
    }

    .card-modal .modal-body {
        padding: 8px 20px 18px;
    }

    .card-modal .modal-body img {
        width: min(100%, 360px);
        max-height: 62vh;
        padding: 10px;
    }

    .card-modal .modal-footer {
        padding: 0 20px 22px;
    }
}

@media (max-width: 520px) {
    .game-topbar {
        border-radius: 18px;
    }

    .brand-kme {
        min-width: 82px;
        font-size: 2rem;
    }

    .brand-kme img {
        width: 78px;
    }

    .game-title-mark>strong {
        font-size: 1.62rem;
    }

    .game-title-mark img {
        width: min(100%, 260px);
        max-height: 68px;
    }

    .game-title-mark small {
        padding-inline: 14px;
        font-size: 0.84rem;
    }

    .top-action-btn {
        flex-basis: 100%;
    }

    .metric-icon {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
    }

    .metric-copy strong {
        font-size: 1.62rem;
    }

    .bingo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bingo-card-link {
        min-height: 176px;
    }

    .bingo-card-title {
        left: 30px;
        right: 0px;
        bottom: 30px;
        max-height: 35px;
        font-size: 0.925rem;
        width: 70%;
    }

    .card-modal .close {
        top: -12px;
        right: -8px;
        width: 46px;
        height: 46px;
    }
}
