:root {
    --bg: #0f394c;
    --fg: #f8fafc;
    --glass: rgba(255, 255, 255, .03);
    --glassBorder: rgba(255, 255, 255, .10);
    --indigoA: rgba(99, 102, 241, .40);
    --panelDark: rgba(2, 6, 23, .82);
    --pillDark: rgba(15, 23, 42, .78);
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg) !important;
}

#screenDifficulty,
#screenGame {
    background: var(--bg) !important;
    padding: 40px 0;
    overflow: visible;
}

#screenGame {
    padding: 0;
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glassBorder);
}

.app-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-content {
    width: 100%;
    max-width: 1280px;
    padding: 1rem;
}

.fade-in-up {
    animation: fadeInUp 1s ease forwards;
    opacity: 0;
    transform: translateY(24px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.difficulty-card {
    width: 100%;
    padding: 1.25rem;
    border-radius: 1.5rem;
    border: 2px solid rgba(255, 255, 255, .06);
    background: #185977;
    transition: all .25s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.difficulty-card:hover {
    border-color: rgba(255, 255, 255, .18);
}

.difficulty-card.active {
    background: #18597754;
    border-color: #49b5e7;
    box-shadow: 0 0 30px rgba(99, 102, 241, .20);
}

.difficulty-title {
    font-weight: 900;
    letter-spacing: .18em;
    font-size: 1.05rem;
    margin: 0;
}

.difficulty-meta {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: .75rem;
    color: rgba(248, 250, 252, .40);
    margin-top: .35rem;
    text-transform: uppercase;
}

.radio-dot {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, .35);
    display: grid;
    place-items: center;
    transition: all .25s ease;
    flex: 0 0 auto;
}

.difficulty-card.active .radio-dot {
    border-color: #49b5e7;
    background: #49b5e7;
}

.radio-dot .inner {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: white;
    opacity: 0;
    transition: opacity .2s ease;
}

.difficulty-card.active .radio-dot .inner {
    opacity: 1;
}

.start-btn {
    margin-top: 2.5rem;
    width: 100%;
    padding: 1.25rem 1.25rem;
    border-radius: 1.5rem;
    font-weight: 900;
    letter-spacing: .20em;
    text-transform: uppercase;
    background: #49b5e7;
    color: #fff;
    border: none;
    transition: all .2s ease;
    box-shadow: 0 20px 60px rgba(255, 255, 255, .06);
}

.start-btn:hover {
    transform: scale(1.02);
}

.start-btn:active {
    transform: scale(.96);
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.brand .logo-pill {
    width: 10px;
    height: 26px;
    border-radius: 999px;
    background: #49b5e7;
    box-shadow: 0 0 24px rgba(99, 102, 241, .30);
}

.brand h1 {
    font-size: 1.05rem;
    margin: 0;
    letter-spacing: .20em;
    font-weight: 900;
    text-transform: uppercase;
    color: #fff;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: 0;
    justify-content: center;
}

.stats:before {
    position: relative;
    background: none;
}

.chip {
    border-radius: 999px;
    padding: .45rem .8rem;
    font-size: .8rem;
    color: rgba(248, 250, 252, .80);
    border: 1px solid rgba(255, 255, 255, .08);
    background: #185977;
}

.chip strong {
    color: rgba(248, 250, 252, .95);
}

.btn-ghost {
    border-radius: 999px;
    padding: .45rem .9rem;
    border: 1px solid rgba(255, 255, 255, .10);
    background: #185977;
    color: rgba(248, 250, 252, .85);
    transition: all .2s ease;
}

.btn-ghost:hover {
    border-color: rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .05);
    transform: translateY(-1px);
}

.board-wrap {
    position: relative;
    border-radius: 1.75rem;
    padding: .75rem;
    box-shadow: 0 25px 80px rgba(0, 0, 0, .45);
    transition: all .7s ease;
}

.board-wrap.won {
    transform: scale(.92);
    opacity: .45;
    filter: blur(3px);
}

.board {
    display: grid;
    gap: .35rem;
    width: min(90vw, 1000px);
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .65rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease, color .2s ease;
    position: relative;
    overflow: hidden;
    color: #fff;
    background: #185977;
    border: 1px solid rgba(255, 255, 255, .04);
    min-width: 0;
}

.cell:hover {
    background: #46768c;
    color: rgba(248, 250, 252, .65);
}

.board.size-8 .cell {
    font-size: clamp(14px, 2.5vw, 22px);
}

.board.size-12 .cell {
    font-size: clamp(12px, 2.1vw, 18px);
}

.board.size-15 .cell {
    font-size: clamp(10px, 1.7vw, 14px);
}

.found {
    color: white !important;
    border-color: rgba(255, 255, 255, .10);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .25);
}

.selection-line {
    pointer-events: none;
    position: absolute;
    height: 32px;
    background: #49b5e773;
    border-radius: 999px;
    transform-origin: left center;
    box-shadow: 0 0 20px rgba(99, 102, 241, .40);
    transition: all .1s ease;
    z-index: 5;
    display: none;
}

@keyframes hint-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
        background-color: rgba(244, 63, 94, 0.2);
    }

    50% {
        transform: scale(1.2);
        box-shadow: 0 0 20px 10px rgba(244, 63, 94, 0);
        background-color: rgba(244, 63, 94, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
        background-color: rgba(244, 63, 94, 0.2);
    }
}

.hint-active {
    animation: hint-pulse 1.5s infinite ease-in-out;
    z-index: 20;
    color: white !important;
    border-radius: .5rem;
}

.wordbank {
    border-radius: 1.25rem;
    padding: 1.25rem;
    border: 1px solid rgba(99, 102, 241, .10);
    background: var(--glass) !important;
}

.wordbank-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.wordbank-title .bar {
    width: 8px;
    height: 24px;
    border-radius: 999px;
    background: #49b5e7;
}

.word-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .55rem .9rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: .9rem;
    transition: all .35s ease;
    border: 1px solid rgba(255, 255, 255, .06);
    background: #185977 !important;
    color: #fff;
    user-select: none;
}

.word-pill.found {
    transform: scale(1.05);
    color: white;
    box-shadow: 0 10px 18px rgba(0, 0, 0, .22);
    border-color: rgba(255, 255, 255, .10);
}

.word-pill.found .word-text {
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, .50);
}

.wordbank-footer {
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid rgba(255, 255, 255, .06);
    font-size: .8rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.percent {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: .55;
    }

    50% {
        opacity: 1;
    }
}

.win-overlay {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(2, 6, 23, .65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999;
    padding: 1rem;
}

.win-overlay.show {
    display: grid;
}

.win-card {
    max-width: 560px;
    width: 100%;
    border-radius: 1.75rem;
    padding: 1.4rem;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .6);
    border: 1px solid rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .04);
}

.win-title {
    color: #fff;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 0 0 .5rem 0;
}

.win-sub {
    color: rgba(148, 163, 184, .85);
    margin: 0 0 1.1rem 0;
}

.win-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.btn-primary-pill {
    border-radius: 999px;
    padding: .75rem 1.1rem;
    border: none;
    background: #49b5e7;
    color: white;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: transform .2s ease;
}

.btn-primary-pill:hover {
    transform: translateY(-1px);
}

.btn-secondary-pill {
    border-radius: 999px;
    padding: .75rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .03);
    color: rgba(248, 250, 252, .90);
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: transform .2s ease;
}

.btn-secondary-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, .22);
}

/* color classes */
.c-emerald {
    background: rgba(16, 185, 129, .90) !important;
}

.c-sky {
    background: rgba(14, 165, 233, .90) !important;
}

.c-rose {
    background: rgba(244, 63, 94, .90) !important;
}

.c-amber {
    background: rgba(245, 158, 11, .90) !important;
}

.c-violet {
    background: rgba(139, 92, 246, .90) !important;
}

.c-fuchsia {
    background: rgba(217, 70, 239, .90) !important;
}

.c-orange {
    background: rgba(249, 115, 22, .90) !important;
}

.c-indigo {
    background: rgba(99, 102, 241, .90) !important;
}

.c-lime {
    background: rgba(132, 204, 22, .90) !important;
}

.c-teal {
    background: rgba(20, 184, 166, .90) !important;
}

.muted-heading {
    color: #ffffffb3;
    letter-spacing: .18em;
    font-weight: 900;
    text-transform: uppercase;
}

@media (min-width: 1200px) {
    .wordbank {
        padding: 10px;
    }

    .wordbank-title {
        justify-content: center;
    }

    .wordbank #wordList .word-pill {
        width: 100%;
        padding: 5px 10px;
        justify-content: center;
        font-size: 10px;
    }
}