/* =========================================================
   SAGAXIQ WORD BUILDER — COMPACT UI
========================================================= */

.wb-page,
.wb-page * {
    box-sizing: border-box;
}

.wb-page {

    --bg: #060912;
    --panel: #0d1625;
    --panel2: #111c2d;

    --cyan: #00e5ff;
    --green: #39e879;
    --red: #ff5268;
    --yellow: #ffc857;
    --purple: #b52cff;

    --text: #f5f8ff;
    --muted: #8fa0b7;

    min-height: calc(100vh - 55px);

    padding: 7px 10px 35px;

    color: var(--text);

    background:
        radial-gradient(
            circle at 50% -10%,
            rgba(0,229,255,.12),
            transparent 32%
        ),
        radial-gradient(
            circle at 0% 35%,
            rgba(181,44,255,.06),
            transparent 28%
        ),
        var(--bg);

    overflow-x: hidden;
}


.wb-shell {

    width: min(900px, 100%);

    margin: auto;
}


/* =========================================================
   BACK
========================================================= */

.wb-topbar {

    height: 34px;

    display: flex;

    align-items: center;

    margin-bottom: 5px;
}


.wb-back {

    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 5px 8px;

    border-radius: 8px;

    color: var(--cyan);

    text-decoration: none;

    font-size: .82rem;

    font-weight: 700;
}


.wb-back:hover {

    background: rgba(0,229,255,.07);

    color: white;
}


/* =========================================================
   START SCREEN
========================================================= */

.wb-start {

    width: min(600px, 100%);

    margin: 3vh auto 0;

    text-align: center;
}


.wb-logo {

    width: 48px;

    height: 48px;

    display: grid;

    place-items: center;

    margin: 0 auto 8px;

    border-radius: 14px;

    font-size: 25px;

    background:
        rgba(0,229,255,.06);

    border: 1px solid rgba(0,229,255,.15);
}


.wb-start h1 {

    margin: 0;

    color: white;

    font-size: clamp(1.65rem, 4vw, 2.35rem);

    line-height: 1.1;

    letter-spacing: -.03em;
}


.wb-intro {

    max-width: 540px;

    margin: 8px auto 16px;

    color: var(--muted);

    line-height: 1.45;

    font-size: .86rem;
}


.wb-primary {

    min-height: 42px;

    padding: 8px 24px;

    border: 0;

    border-radius: 10px;

    font: inherit;

    font-size: .9rem;

    font-weight: 800;

    cursor: pointer;

    color: #001116;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            #62f4ff
        );

    box-shadow:
        0 0 20px rgba(0,229,255,.2);

    transition: .15s;
}


.wb-primary:hover {

    transform: translateY(-1px);
}


.wb-howto {

    margin-top: 17px;

    padding: 15px;

    text-align: left;

    border-radius: 13px;

    border: 1px solid rgba(255,255,255,.07);

    background: rgba(255,255,255,.025);
}


.wb-howto h2 {

    margin: 0 0 9px;

    text-align: center;

    font-size: .98rem;
}


.wb-howto ul {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 5px 16px;

    margin: 0;

    padding: 0;

    list-style: none;
}


.wb-howto li {

    color: #aebcd0;

    font-size: .76rem;

    line-height: 1.4;
}


.wb-howto li::before {

    content: "✓";

    color: var(--green);

    font-weight: 900;

    margin-right: 6px;
}


/* =========================================================
   GAME CARD
========================================================= */

.wb-game {

    width: min(760px, 100%);

    margin: 0 auto;

    padding: 15px 18px 16px;

    border-radius: 18px;

    border: 1px solid rgba(0,229,255,.14);

    background:
        radial-gradient(
            circle at 50% 0,
            rgba(0,229,255,.055),
            transparent 34%
        ),
        var(--panel);

    box-shadow:
        0 15px 50px rgba(0,0,0,.35);
}


.wb-game-head {

    position: relative;

    text-align: center;
}


.wb-game-head h1 {

    margin: 0;

    font-size: clamp(1.45rem, 3vw, 1.9rem);

    line-height: 1.1;

    color: white;
}


.wb-game-head p {

    margin: 3px 0 0;

    color: var(--muted);

    font-size: .78rem;
}


.wb-music {

    position: absolute;

    top: -1px;

    right: 0;

    width: 34px;

    height: 34px;

    border-radius: 9px;

    border: 1px solid rgba(255,255,255,.09);

    background: rgba(255,255,255,.035);

    color: white;

    cursor: pointer;

    font-size: .85rem;
}


/* =========================================================
   SOURCE WORD
========================================================= */

.wb-main-word {

    margin: 9px 0 10px;

    text-align: center;

    font-size: clamp(1.35rem, 4vw, 2.05rem);

    font-weight: 900;

    letter-spacing: .08em;

    line-height: 1.05;

    color: var(--cyan);

    text-shadow:
        0 0 15px rgba(0,229,255,.35);

    overflow-wrap: anywhere;
}


/* =========================================================
   LIVE STATS
========================================================= */

.wb-live {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 8px;

    width: min(430px, 100%);

    margin: 0 auto 10px;
}


.wb-live-card {

    padding: 7px 8px;

    text-align: center;

    border-radius: 10px;

    background: rgba(255,255,255,.025);

    border: 1px solid rgba(255,255,255,.06);
}


.wb-live-label {

    display: block;

    color: var(--muted);

    font-size: .58rem;

    text-transform: uppercase;

    letter-spacing: .09em;
}


.wb-live-value {

    display: block;

    margin-top: 1px;

    color: white;

    font-size: 1rem;

    font-weight: 900;

    line-height: 1.1;
}


.wb-danger {

    color: var(--red) !important;

    animation: wbPulse .7s infinite alternate;
}


@keyframes wbPulse {

    from {
        opacity: .65;
    }

    to {
        opacity: 1;
    }
}


/* =========================================================
   LETTER AREA
========================================================= */

.wb-letter-area {

    padding: 13px 9px 12px;

    border-radius: 14px;

    background: rgba(0,0,0,.12);

    border: 1px solid rgba(255,255,255,.055);
}


.wb-letters {

    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    align-items: center;

    gap: 6px;

    max-width: 680px;

    margin: auto;
}


.wb-letter {

    width: clamp(39px, 5.5vw, 50px);

    height: clamp(39px, 5.5vw, 50px);

    padding: 0;

    border-radius: 10px;

    border: 1px solid rgba(255,255,255,.14);

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #dce3ed
        );

    color: #172133;

    font-size: clamp(.9rem, 2vw, 1.1rem);

    font-weight: 900;

    cursor: pointer;

    transition: .12s;

    box-shadow:
        0 4px 10px rgba(0,0,0,.22);
}


.wb-letter:hover {

    transform: translateY(-1px);
}


.wb-letter.selected {

    background:
        linear-gradient(
            145deg,
            #3f4c5e,
            #293547
        );

    color: white;

    border-color: var(--cyan);

    box-shadow:
        0 0 13px rgba(0,229,255,.18);

    transform: scale(.94);
}


/* =========================================================
   CURRENT WORD
========================================================= */

.wb-current {

    min-height: 43px;

    display: grid;

    place-items: center;

    margin: 11px auto 5px;

    padding: 5px 10px;

    border-radius: 10px;

    border: 1px dashed rgba(0,229,255,.2);

    background: rgba(0,229,255,.025);

    color: white;

    font-size: clamp(1rem, 3vw, 1.3rem);

    font-weight: 800;

    letter-spacing: .06em;

    line-height: 1.1;

    overflow-wrap: anywhere;
}


.wb-message {

    min-height: 19px;

    text-align: center;

    font-size: .73rem;

    font-weight: 700;
}


.wb-message.error {
    color: var(--red);
}


.wb-message.success {
    color: var(--green);
}


/* =========================================================
   ACTION BUTTONS
========================================================= */

.wb-actions {

    display: grid;

    grid-template-columns: 1.35fr 1fr 1fr;

    gap: 7px;

    margin-top: 3px;
}


.wb-action {

    min-height: 39px;

    padding: 6px 8px;

    border: 0;

    border-radius: 9px;

    font: inherit;

    font-size: .78rem;

    font-weight: 800;

    cursor: pointer;

    transition: .15s;
}


.wb-action:hover {

    transform: translateY(-1px);
}


.wb-add {

    color: #00130a;

    background: var(--green);
}


.wb-clear {

    color: white;

    background: #b82f45;
}


.wb-restart {

    color: #171100;

    background: var(--yellow);
}


.wb-action:disabled {

    opacity: .5;

    cursor: not-allowed;

    transform: none;
}


/* =========================================================
   WORD HISTORY
========================================================= */

.wb-history {

    margin-top: 9px;

    border-radius: 11px;

    overflow: hidden;

    border: 1px solid rgba(255,255,255,.055);

    background: rgba(255,255,255,.018);
}


.wb-history-head {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 7px 10px;

    border-bottom: 1px solid rgba(255,255,255,.055);
}


.wb-history-head strong {

    color: white;

    font-size: .78rem;
}


.wb-history-head span {

    color: var(--muted);

    font-size: .65rem;
}


.wb-word-list {

    min-height: 34px;

    max-height: 68px;

    overflow-y: auto;

    padding: 4px 7px;
}


.wb-word-list:empty::before {

    content: "Accepted words will appear here.";

    display: block;

    padding: 5px;

    color: #718097;

    text-align: center;

    font-size: .67rem;
}


.wb-chip {

    display: inline-flex;

    margin: 2px;

    padding: 3px 7px;

    border-radius: 999px;

    border: 1px solid rgba(0,229,255,.1);

    background: rgba(0,229,255,.05);

    color: #dcecff;

    font-size: .66rem;
}


/* =========================================================
   RESULT OVERLAY
========================================================= */

.wb-result-overlay {

    position: fixed;

    inset: 0;

    z-index: 99999;

    display: none;

    align-items: center;

    justify-content: center;

    padding: 8px;

    background: rgba(2,5,12,.91);

    overflow: hidden;
}


.wb-result-overlay.show {

    display: flex;
}


.wb-result {

    width: min(700px, 100%);

    max-height: calc(100vh - 16px);

    overflow-y: auto;

    padding: 16px;

    border-radius: 17px;

    border: 1px solid rgba(0,229,255,.16);

    background:
        radial-gradient(
            circle at 50% 0,
            rgba(0,229,255,.07),
            transparent 30%
        ),
        #0c1421;

    box-shadow:
        0 20px 70px rgba(0,0,0,.65);

    text-align: center;

    scrollbar-width: thin;

    animation: resultIn .2s ease-out;
}


@keyframes resultIn {

    from {
        opacity: 0;
        transform: translateY(8px) scale(.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* RESULT HEADER */

.wb-result-icon {

    font-size: 1.75rem;

    line-height: 1;
}


.wb-result h2 {

    margin: 4px 0 2px;

    font-size: clamp(1.45rem, 4vw, 1.9rem);

    line-height: 1.1;

    color: white;
}


.wb-result-subtitle {

    max-width: 500px;

    margin: 4px auto 10px;

    color: var(--muted);

    font-size: .76rem;

    line-height: 1.4;
}


/* SCORE */

.wb-final-score {

    padding: 9px;

    border-radius: 11px;

    border: 1px solid rgba(0,229,255,.12);

    background: rgba(255,255,255,.018);
}


.wb-final-score small {

    display: block;

    color: var(--muted);

    text-transform: uppercase;

    letter-spacing: .1em;

    font-size: .57rem;
}


.wb-final-score strong {

    display: block;

    margin-top: 1px;

    color: var(--cyan);

    font-size: 2.35rem;

    line-height: .95;

    text-shadow:
        0 0 17px rgba(0,229,255,.3);
}


/* RESULT STATS */

.wb-result-stats {

    display: grid;

    grid-template-columns: repeat(4, 1fr);

    gap: 6px;

    margin-top: 7px;
}


.wb-result-stat {

    padding: 7px 3px;

    border-radius: 9px;

    border: 1px solid rgba(255,255,255,.055);

    background: rgba(255,255,255,.02);
}


.wb-result-stat strong {

    display: block;

    color: white;

    font-size: .92rem;

    line-height: 1.1;
}


.wb-result-stat span {

    display: block;

    margin-top: 2px;

    color: var(--muted);

    font-size: .56rem;

    line-height: 1.2;
}


/* PERFORMANCE */

.wb-performance {

    margin-top: 7px;

    padding: 9px 11px;

    text-align: left;

    border-radius: 10px;

    border: 1px solid rgba(255,255,255,.055);

    background: rgba(255,255,255,.02);
}


.wb-performance-top {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 5px;
}


.wb-performance-top strong {

    color: white;

    font-size: .8rem;
}


.wb-performance-top span {

    color: var(--cyan);

    font-size: .78rem;

    font-weight: 800;
}


.wb-progress {

    height: 6px;

    overflow: hidden;

    border-radius: 99px;

    background: #202b3c;
}


.wb-progress span {

    display: block;

    height: 100%;

    width: 0;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            var(--cyan),
            var(--purple)
        );

    transition: width .5s ease;
}


/* INSIGHT */

.wb-insight {

    margin-top: 7px;

    padding: 8px 10px;

    border-radius: 9px;

    border: 1px solid rgba(255,200,87,.1);

    background: rgba(255,200,87,.025);

    color: #bfcbdc;

    line-height: 1.35;

    font-size: .7rem;
}


/* ACCEPTED WORDS */

.wb-final-words {

    margin-top: 5px;

    text-align: left;
}


.wb-final-words summary {

    padding: 5px 2px;

    cursor: pointer;

    color: #dfe8f5;

    font-size: .75rem;

    font-weight: 800;
}


.wb-final-list {

    display: flex;

    flex-wrap: wrap;

    gap: 3px;

    max-height: 55px;

    overflow-y: auto;

    padding: 5px;

    border-radius: 8px;

    background: rgba(0,0,0,.13);

    border: 1px solid rgba(255,255,255,.045);
}


.wb-final-chip {

    padding: 3px 6px;

    border-radius: 6px;

    background: rgba(0,229,255,.05);

    color: #dcecff;

    font-size: .62rem;
}


/* RESULT BUTTONS */

.wb-result-actions {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 7px;

    margin-top: 8px;
}


.wb-result-actions .wb-primary {

    width: 100%;

    min-height: 39px;

    font-size: .78rem;
}


.wb-more {

    display: grid;

    place-items: center;

    min-height: 39px;

    border-radius: 9px;

    border: 1px solid rgba(0,229,255,.35);

    color: var(--cyan);

    text-decoration: none;

    font-size: .78rem;

    font-weight: 800;
}


.wb-more:hover {

    background: rgba(0,229,255,.06);

    color: white;
}


/* =========================================================
   SEO
========================================================= */

.wb-seo {

    width: min(850px, 100%);

    margin: 32px auto 0;

    padding: 19px;

    border-radius: 14px;

    border: 1px solid rgba(255,255,255,.05);

    background: rgba(255,255,255,.015);
}


.wb-seo h2 {

    margin: 0 0 8px;

    color: white;

    font-size: 1.2rem;
}


.wb-seo h3 {

    margin: 17px 0 5px;

    color: #eaf3ff;

    font-size: .95rem;
}


.wb-seo p,
.wb-seo li {

    color: #91a0b5;

    line-height: 1.6;

    font-size: .78rem;
}


.wb-seo ul {

    padding-left: 18px;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 700px) {

    .wb-page {
        padding: 5px 7px 30px;
    }

    .wb-game {
        padding: 12px;
        border-radius: 14px;
    }

    .wb-howto ul {
        grid-template-columns: 1fr;
    }

    .wb-result-overlay {
        padding: 5px;
    }

    .wb-result {
        max-height: calc(100vh - 10px);
        padding: 13px;
        border-radius: 14px;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 480px) {

    .wb-topbar {
        height: 30px;
    }

    .wb-back {
        font-size: .72rem;
        padding: 4px 6px;
    }

    .wb-game {
        padding: 9px;
    }

    .wb-game-head h1 {
        font-size: 1.3rem;
    }

    .wb-main-word {
        font-size: 1.45rem;
        margin: 7px 0 8px;
    }

    .wb-live {
        gap: 5px;
        margin-bottom: 7px;
    }

    .wb-live-card {
        padding: 5px;
    }

    .wb-live-value {
        font-size: .88rem;
    }

    .wb-letter-area {
        padding: 9px 4px;
    }

    .wb-letters {
        gap: 4px;
    }

    .wb-letter {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        font-size: .82rem;
    }

    .wb-current {
        min-height: 38px;
        margin-top: 8px;
        font-size: 1rem;
    }

    .wb-actions {
        gap: 5px;
    }

    .wb-action {
        min-height: 36px;
        font-size: .7rem;
    }

    .wb-history {
        margin-top: 6px;
    }

    .wb-result-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .wb-result-stat {
        padding: 6px 2px;
    }

    .wb-result-stat strong {
        font-size: .78rem;
    }

    .wb-result-stat span {
        font-size: .48rem;
    }

    .wb-result-actions {
        gap: 5px;
    }

}


/* =========================================================
   VERY SMALL PHONES
========================================================= */

@media (max-width: 360px) {

    .wb-letter {
        width: 31px;
        height: 31px;
        font-size: .75rem;
    }

    .wb-game {
        padding: 7px;
    }

    .wb-result {
        padding: 10px;
    }

}


/* =========================================================
   REDUCED MOTION
========================================================= */

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

    *,
    *::before,
    *::after {

        animation: none !important;

        transition: none !important;
    }

}

