/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-1: #2b1d4a;
    --bg-2: #4b2a72;
    --bg-3: #7a3f9c;
    --tile-empty: rgba(255, 255, 255, 0.18);
    --tile-fill: #ffffff;
    --tile-text: #2b1d4a;
    --accent: #ffd166;
    --accent-2: #ff7eb6;
    --good: #3ddc84;
    --bad: #ff5470;
    --wheel-bg: rgba(255, 255, 255, 0.92);
    --wheel-tile: transparent;
    --wheel-tile-text: #1a1a2e;
    --wheel-tile-active: rgba(255, 209, 102, 0.9);
    --line: rgba(255, 209, 102, 0.95);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --pack-gradient: linear-gradient(160deg, #7a3f9c, #4b2a72 45%, #2b1d4a);
    --pack-bg: none;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #fff;
    background: #1a0f2e;
}

.app.large-text {
    font-size: 1.1rem;
}

/* ---------- Background photo + tint ---------- */
.bg-photo {
    position: fixed;
    inset: 0;
    background-image: var(--pack-bg);
    background-size: cover;
    background-position: center;
    transition: background-image 0.6s ease, opacity 0.6s ease;
    z-index: -2;
}

.bg-tint {
    position: fixed;
    inset: 0;
    background: var(--pack-gradient);
    opacity: 0.78;
    transition: background 0.6s ease;
    z-index: -1;
}

/* ---------- App layout ---------- */
.app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    flex: 0 0 auto;
}

.level-info {
    text-align: center;
    flex: 1 1 auto;
    min-width: 0;
}

.level-theme {
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.85;
}

.level-number {
    font-size: 16px;
    font-weight: 800;
    margin-top: 2px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.15s var(--ease-out), background 0.15s ease;
    flex: 0 0 auto;
    backdrop-filter: blur(6px);
}

.icon-btn:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.28);
}

.icon-btn.ghost {
    background: rgba(255, 255, 255, 0.12);
}

.icon-btn.aa-active {
    background: var(--accent);
    color: var(--tile-text);
}

.coin-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 999px;
    padding: 5px 12px 5px 6px;
    font-weight: 800;
    font-size: 14px;
    flex: 0 0 auto;
}

.coin-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--tile-text);
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 13px;
}

.coin-count.bump {
    animation: pop 0.4s var(--ease-bounce);
}

.play-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ---------- Grid ---------- */
.grid-wrap {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    padding: 6px 12px;
    min-height: 0;
}

.grid {
    --cell: 44px;
    --gap: 6px;
    display: grid;
    gap: var(--gap);
    grid-auto-rows: var(--cell);
    grid-auto-columns: var(--cell);
}

.cell {
    width: var(--cell);
    height: var(--cell);
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: calc(var(--cell) * 0.55);
    font-weight: 800;
    color: var(--tile-text);
    background: var(--tile-empty);
    position: relative;
}

.cell.active {
    background: var(--tile-fill);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18), 0 8px 18px rgba(0, 0, 0, 0.3);
}

.cell.def-pickable {
    cursor: pointer;
}

.cell.def-pickable.revealed:hover {
    background: #fff7da;
    transition: background 0.15s ease;
}

.cell .letter {
    opacity: 0;
    transform: translateY(4px) scale(0.8);
    transition: opacity 0.25s var(--ease-out),
        transform 0.35s var(--ease-bounce);
}

.cell.revealed .letter {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.cell.flash {
    animation: cellFlash 0.5s var(--ease-out);
}

@keyframes cellFlash {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 209, 102, 0);
    }

    40% {
        transform: scale(1.15);
        box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.45);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18), 0 8px 18px rgba(0, 0, 0, 0.3);
    }
}

/* ---------- Bonus bar ---------- */
.bonus-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 4px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 999px;
    font-size: 12px;
    animation: pop 0.4s var(--ease-bounce);
}

.bonus-label {
    opacity: 0.85;
    letter-spacing: 0.5px;
}

.bonus-count {
    font-weight: 800;
    color: var(--accent);
}

@keyframes pop {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ---------- Word preview ---------- */
.word-preview {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    min-height: 52px;
}

.preview-tile {
    background: rgba(255, 255, 255, 0.95);
    color: var(--tile-text);
    width: 32px;
    height: 40px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
    animation: tilePop 0.18s var(--ease-bounce);
}

.word-preview.valid .preview-tile {
    background: var(--good);
    color: #fff;
}

.word-preview.bonus .preview-tile {
    background: var(--accent);
    color: var(--tile-text);
}

.word-preview.invalid .preview-tile {
    background: var(--bad);
    color: #fff;
    animation: shake 0.35s ease;
}

@keyframes tilePop {
    0% {
        transform: translateY(8px) scale(0.6);
        opacity: 0;
    }

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

@keyframes shake {

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

    25% {
        transform: translateX(-6px);
    }

    50% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-4px);
    }
}

/* ---------- Wheel row (wheel + side controls) ---------- */
.wheel-row {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    gap: 10px;
    align-items: center;
    padding: 6px 14px 14px;
    flex: 0 0 auto;
}

.side-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.side-btn {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.18s var(--ease-bounce), background 0.18s ease;
    backdrop-filter: blur(8px);
}

.side-btn:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.5);
}

.shuffle-icon {
    display: inline-block;
    transition: transform 0.5s var(--ease-bounce);
    font-size: 22px;
}

.side-btn.spinning .shuffle-icon {
    transform: rotate(360deg);
}

.hint-btn .hint-icon {
    font-size: 20px;
}

.hint-btn .hint-cost {
    position: absolute;
    right: -2px;
    bottom: -4px;
    background: var(--accent);
    color: var(--tile-text);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 999px;
    border: 2px solid #1a0f2e;
}

.star-btn .star-icon {
    color: var(--accent);
    font-size: 22px;
}

.star-badge {
    position: absolute;
    right: -4px;
    top: -4px;
    background: #fff;
    color: #1a0f2e;
    font-size: 10px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 2px solid #1a0f2e;
}

.gift-btn .gift-icon {
    font-size: 22px;
}

.gift-badge {
    position: absolute;
    right: -2px;
    top: -2px;
    background: var(--bad);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    animation: badgePulse 1.6s ease-in-out infinite;
}

@keyframes badgePulse {

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

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

/* ---------- Wheel ---------- */
.wheel-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: min(70vw, 30vh, 280px);
    margin: 0 auto;
    justify-self: center;
}

.wheel-line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 2;
}

.wheel-line polyline {
    fill: none;
    stroke: var(--line);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.5));
    transition: stroke 0.18s ease;
}

.wheel-line.valid polyline {
    stroke: var(--good);
}

.wheel-line.bonus polyline {
    stroke: var(--accent);
}

.wheel-line.invalid polyline {
    stroke: var(--bad);
}

.wheel {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--wheel-bg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    touch-action: none;
}

.wheel-tile {
    position: absolute;
    width: 28%;
    height: 28%;
    min-width: 36px;
    min-height: 36px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--wheel-tile);
    color: var(--wheel-tile-text);
    display: grid;
    place-items: center;
    font-size: clamp(20px, 6vw, 32px);
    font-weight: 800;
    text-transform: uppercase;
    transition: transform 0.4s var(--ease-bounce), background 0.18s ease, color 0.18s ease;
    will-change: transform;
}

.wheel-tile.active {
    background: var(--wheel-tile-active);
    transform: translate(-50%, -50%) scale(1.18);
}

/* ---------- Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    z-index: 50;
    animation: fadeIn 0.25s ease;
}

.modal[hidden] {
    display: none;
}

.modal.small .modal-card {
    width: min(86vw, 340px);
}

.modal-card {
    background: linear-gradient(160deg, #5a2f8d, #2b1d4a);
    border-radius: 24px;
    padding: 28px 24px 22px;
    width: min(86vw, 360px);
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    animation: cardIn 0.45s var(--ease-bounce);
}

.modal-emoji {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 8px;
    animation: pop 0.6s var(--ease-bounce);
}

.modal-title {
    font-size: 22px;
    margin-bottom: 6px;
}

.modal-sub {
    opacity: 0.85;
    margin-bottom: 16px;
    font-size: 14px;
}

.def-word {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--accent);
    letter-spacing: 1px;
}

.def-text {
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 18px;
    opacity: 0.92;
}

.stars-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 8px 0 16px;
}

.stars-row .star {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.18);
    transition: color 0.4s var(--ease-bounce), transform 0.4s var(--ease-bounce);
}

.stars-row .star.lit {
    color: var(--accent);
    transform: scale(1.15);
    text-shadow: 0 0 14px rgba(255, 209, 102, 0.7);
}

.reward-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: center;
    margin-bottom: 14px;
    font-weight: 800;
    color: var(--accent);
}

.primary-btn {
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 13px 18px;
    background: var(--accent);
    color: var(--tile-text);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
    transition: transform 0.15s var(--ease-out);
}

.primary-btn:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes cardIn {
    0% {
        transform: translateY(20px) scale(0.85);
        opacity: 0;
    }

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

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(180px + var(--safe-bottom));
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    z-index: 40;
    animation: toastIn 0.3s var(--ease-bounce);
    pointer-events: none;
    max-width: 80vw;
    text-align: center;
}

.toast[hidden] {
    display: none;
}

@keyframes toastIn {
    from {
        transform: translate(-50%, 8px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    .wheel-wrap {
        max-width: min(60vw, 35vh, 320px);
    }

    .word-preview {
        font-size: 28px;
    }
}

@media (max-height: 700px) {
    .word-preview {
        height: 40px;
        min-height: 40px;
        font-size: 20px;
    }

    .preview-tile {
        width: 28px;
        height: 34px;
    }

    .side-btn {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }
}

@media (max-height: 580px) {
    .topbar {
        padding: 6px 10px;
    }

    .level-theme {
        font-size: 11px;
    }

    .level-number {
        font-size: 14px;
    }

    .icon-btn,
    .coin-pill {
        transform: scale(0.92);
    }

    .wheel-row {
        padding: 4px 12px 8px;
    }

    .word-preview {
        height: 36px;
        min-height: 36px;
    }
}

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

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   SCREENS (multi-screen router)
   ============================================================ */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

.screen.active {
    display: flex;
}

/* ---------- Splash ---------- */
.splash {
    align-items: center;
    justify-content: center;
}

.splash-photo {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #6db7e8 0%, #4a90c2 45%, #2e5f86 100%);
    z-index: 0;
}

.splash-photo::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 45%;
    background: linear-gradient(180deg, transparent, rgba(20, 60, 40, 0.55));
}

.splash-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
}

.splash-logo {
    font-size: clamp(28px, 9vw, 46px);
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.splash-o {
    color: var(--accent);
}

.splash-bar {
    width: min(60vw, 260px);
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    overflow: hidden;
}

.splash-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 999px;
    transition: width 0.15s linear;
}

.splash-foot {
    position: absolute;
    bottom: calc(18px + var(--safe-bottom));
    z-index: 1;
    font-size: 11px;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

/* ---------- Home hub ---------- */
.home {
    overflow-y: auto;
}

.home-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    flex: 0 0 auto;
}

.home-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 999px;
    padding: 5px 14px 5px 5px;
    cursor: pointer;
    border: none;
    color: #fff;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: grid;
    place-items: center;
    font-size: 22px;
}

.home-name-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    text-align: left;
}

.home-name {
    font-weight: 800;
    font-size: 14px;
}

.home-code {
    font-size: 11px;
    opacity: 0.7;
}

.home-hero {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 20px;
    min-height: 0;
}

.home-logo {
    font-size: clamp(34px, 11vw, 58px);
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.home-tag {
    font-size: 13px;
    opacity: 0.85;
}

.play-btn {
    margin-top: 8px;
    border: none;
    cursor: pointer;
    width: min(70vw, 260px);
    padding: 16px;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffe07a, var(--accent));
    color: var(--tile-text);
    box-shadow: 0 8px 0 #c79a2e, 0 14px 26px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: transform 0.12s var(--ease-out);
}

.play-btn:active {
    transform: translateY(5px);
    box-shadow: 0 3px 0 #c79a2e;
}

.play-label {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 2px;
}

.play-sub {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.7;
}

.hub-grid {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 14px 16px calc(20px + var(--safe-bottom));
}

.hub-tile {
    position: relative;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    padding: 12px 6px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.12s var(--ease-out), background 0.15s ease;
}

.hub-tile:active {
    transform: scale(0.94);
    background: rgba(255, 255, 255, 0.24);
}

.hub-ico {
    font-size: 26px;
}

.hub-txt {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.9;
}

.hub-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    background: var(--bad);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
    display: grid;
    place-items: center;
    animation: badgePulse 1.6s ease-in-out infinite;
}

/* ============================================================
   SUB-SCREENS (shared shell)
   ============================================================ */
.sub-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    flex: 0 0 auto;
}

.sub-title {
    flex: 1 1 auto;
    text-align: center;
    font-size: 18px;
    font-weight: 800;
}

.sub-right {
    width: 38px;
    flex: 0 0 auto;
}

.sub-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 16px calc(24px + var(--safe-bottom));
    -webkit-overflow-scrolling: touch;
}

.section-h {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    margin: 18px 0 8px;
}

.empty-note {
    opacity: 0.7;
    font-size: 14px;
    text-align: center;
    padding: 18px 8px;
}

.mini-btn {
    border: none;
    cursor: pointer;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    transition: transform 0.12s var(--ease-out), background 0.15s ease;
}

.mini-btn:active {
    transform: scale(0.94);
}

.mini-btn.solid {
    background: var(--accent);
    color: var(--tile-text);
}

.text-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 15px;
    text-transform: uppercase;
}

.text-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    text-transform: none;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.lb-banner {
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #8a5fd6, #6a3fae);
    padding: 0 0 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.lb-sun {
    position: relative;
    height: 96px;
    background:
        radial-gradient(circle at 50% 90%, #ffd166 0 38px, transparent 39px),
        linear-gradient(180deg, #ff9a76, #ffd1a1 60%, #cfe7ff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 12px;
    color: #6a3fae;
}

.lb-month {
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lb-myscore {
    font-weight: 900;
    font-size: 20px;
}

.lb-countdown {
    text-align: center;
    margin: -14px auto 8px;
    width: fit-content;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.lb-tabs {
    display: flex;
    gap: 6px;
    padding: 4px 10px;
}

.lb-tab {
    flex: 1 1 0;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 12px;
    font-weight: 800;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    letter-spacing: 0.5px;
}

.lb-tab.on {
    background: #fff;
    color: #6a3fae;
}

.lb-tab.pill {
    border-radius: 999px;
}

.lb-tabs.region .lb-tab.on {
    background: var(--accent);
    color: var(--tile-text);
}

.lb-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 9px 12px;
}

.lb-row.you {
    background: linear-gradient(90deg, #ff7eb6, #ff5da2);
    font-weight: 800;
}

.lb-row.pinned {
    position: sticky;
    bottom: 0;
}

.lb-rank {
    width: 26px;
    text-align: center;
    font-weight: 800;
    font-size: 13px;
    opacity: 0.85;
}

.lb-medal {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 13px;
    color: #fff;
}

.lb-medal.m1 {
    background: #f7b500;
}

.lb-medal.m2 {
    background: #b8c2cc;
}

.lb-medal.m3 {
    background: #cd7f32;
}

.lb-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    display: grid;
    place-items: center;
    font-size: 18px;
    flex: 0 0 auto;
}

.lb-name {
    flex: 1 1 auto;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    font-weight: 800;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lb-sunico {
    font-size: 13px;
}

/* ============================================================
   FRIENDS & GIFTS
   ============================================================ */
.my-code-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 12px 14px;
}

.my-code-label {
    font-size: 12px;
    opacity: 0.7;
    flex: 1 1 auto;
}

.my-code {
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--accent);
    font-size: 15px;
}

.add-friend-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

.inbox-row,
.friend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.inbox-from,
.friend-name {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.inbox-from span,
.friend-name span {
    font-size: 12px;
    opacity: 0.7;
}

/* ============================================================
   DAILY PUZZLE
   ============================================================ */
.daily-body {
    text-align: center;
}

.daily-hero {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    padding: 22px 18px;
    margin-top: 8px;
}

.daily-cal {
    width: 88px;
    height: 92px;
    margin: 0 auto 14px;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    color: var(--tile-text);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.daily-month {
    background: var(--bad);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 0;
    text-transform: uppercase;
}

.daily-day {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    font-size: 38px;
    font-weight: 900;
}

.daily-streak {
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 6px;
}

.daily-status {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 16px;
}

.week-strip {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 18px;
}

.week-cell {
    flex: 1 1 0;
    max-width: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.week-cell.done {
    background: rgba(255, 209, 102, 0.25);
}

.week-cell.today {
    outline: 2px solid var(--accent);
}

.week-dow {
    font-size: 11px;
    opacity: 0.7;
}

.week-mark {
    font-size: 16px;
    color: var(--accent);
}

/* ============================================================
   COLLECTIONS
   ============================================================ */
.coll-summary {
    text-align: center;
    font-weight: 800;
    margin: 6px 0 14px;
    opacity: 0.9;
}

.coll-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.coll-chip {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 7px 14px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* ============================================================
   ACHIEVEMENTS
   ============================================================ */
.ach-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.ach-row.unlocked {
    opacity: 1;
    background: rgba(255, 209, 102, 0.16);
}

.ach-ico {
    font-size: 26px;
    width: 40px;
    text-align: center;
}

.ach-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.ach-text span {
    font-size: 12px;
    opacity: 0.75;
}

.ach-state {
    color: var(--good);
    font-weight: 900;
    font-size: 18px;
}

/* ============================================================
   SHOP
   ============================================================ */
.shop-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 8px;
}

.shop-ico {
    font-size: 26px;
    width: 40px;
    text-align: center;
}

.shop-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.shop-text span {
    font-size: 12px;
    opacity: 0.75;
}

.shop-btn {
    min-width: 64px;
}

/* ============================================================
   KITTY BANK
   ============================================================ */
.kitty-body {
    text-align: center;
}

.kitty-banner {
    display: inline-block;
    background: linear-gradient(180deg, #ff9a3c, #e0641c);
    color: #fff;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 8px 26px;
    border-radius: 999px;
    margin: 8px 0 18px;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
}

.kitty-cat {
    font-size: 110px;
    line-height: 1;
    margin: 10px 0;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
}

.kitty-cat.full {
    animation: kittyWiggle 0.6s var(--ease-bounce) infinite;
}

@keyframes kittyWiggle {

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

    50% {
        transform: rotate(4deg);
    }
}

.kitty-bar-wrap {
    max-width: 320px;
    margin: 18px auto;
}

.kitty-bar {
    height: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 999px;
    overflow: hidden;
}

.kitty-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffe07a, var(--accent));
    border-radius: 999px;
    transition: width 0.5s var(--ease-out);
}

.kitty-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 800;
    margin-top: 6px;
    opacity: 0.85;
}

.kitty-title {
    font-size: 18px;
    margin: 8px 0 4px;
}

.kitty-sub {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 18px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.kitty-body .primary-btn {
    max-width: 320px;
    margin: 0 auto;
}

/* ============================================================
   LEVEL MAP
   ============================================================ */
.map-pack {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin: 16px 0 8px;
    font-size: 13px;
}

.map-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.map-node {
    width: 58px;
    height: 58px;
    border: none;
    cursor: pointer;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: transform 0.12s var(--ease-out);
}

.map-node:active {
    transform: scale(0.92);
}

.map-node.cleared {
    background: rgba(255, 209, 102, 0.22);
}

.map-node.current {
    outline: 2px solid var(--accent);
}

.map-num {
    font-weight: 800;
    font-size: 15px;
}

.map-stars {
    font-size: 9px;
    color: var(--accent);
    letter-spacing: 1px;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.set-row {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
}

.set-label {
    font-size: 14px;
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-row .set-label {
    margin-bottom: 0;
}

.toggle {
    width: 50px;
    height: 28px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.25);
    position: relative;
    transition: background 0.2s ease;
    flex: 0 0 auto;
}

.toggle::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s var(--ease-out);
}

.toggle.on {
    background: var(--good);
}

.toggle.on::after {
    transform: translateX(22px);
}

.danger-btn {
    width: 100%;
    border: none;
    cursor: pointer;
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 84, 112, 0.25);
    color: #ffd0d8;
    font-weight: 800;
    font-size: 14px;
}

.set-foot {
    text-align: center;
    font-size: 11px;
    opacity: 0.55;
    margin-top: 18px;
    line-height: 1.5;
}

/* ============================================================
   LOGIN / CHOOSE PLAYER
   ============================================================ */
.login {
    align-items: center;
    justify-content: center;
}

.login-inner {
    width: min(88vw, 380px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px;
}

.login-logo {
    font-size: clamp(26px, 8vw, 40px);
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.login-sub {
    opacity: 0.85;
    font-size: 14px;
    margin-bottom: 4px;
}

.player-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 46vh;
    overflow-y: auto;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: none;
    cursor: pointer;
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    color: #fff;
    transition: transform 0.12s var(--ease-out), background 0.15s ease;
}

.player-card:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.24);
}

.player-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: grid;
    place-items: center;
    font-size: 24px;
    flex: 0 0 auto;
}

.player-meta {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.25;
    min-width: 0;
}

.player-meta span {
    font-size: 12px;
    opacity: 0.7;
}

.player-go {
    font-size: 24px;
    font-weight: 800;
    opacity: 0.6;
}

.new-player-btn {
    width: 100%;
    margin-top: 6px;
}

.text-btn {
    margin-top: 10px;
    background: none;
    border: none;
    color: #fff;
    opacity: 0.7;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
}

/* Avatar picker (register modal) */
.reg-input {
    width: 100%;
    text-align: center;
    text-transform: none;
    margin-bottom: 14px;
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.avatar-opt {
    aspect-ratio: 1 / 1;
    border: 2px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 24px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.12s var(--ease-out);
}

.avatar-opt:active {
    transform: scale(0.9);
}

.avatar-opt.on {
    border-color: var(--accent);
    background: rgba(255, 209, 102, 0.25);
}

/* ============================================================
   DIFFICULTY PICKER
   ============================================================ */
.diff-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: center;
    padding-top: 16px;
}

.diff-card {
    border: none;
    cursor: pointer;
    border-radius: 20px;
    padding: 20px;
    color: #fff;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 16px;
    align-items: center;
    text-align: left;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.22), 0 12px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.12s var(--ease-out);
}


.diff-card:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
}

.diff-card.easy {
    background: linear-gradient(135deg, #56ab2f, #2f7d1c);
}

.diff-card.medium {
    background: linear-gradient(135deg, #ff9a3c, #e0641c);
}

.diff-card.hard {
    background: linear-gradient(135deg, #ff5f6d, #c0303f);
}

.diff-emoji {
    grid-row: 1 / 3;
    grid-column: 1;
    font-size: 38px;
}

.diff-name {
    grid-row: 1;
    grid-column: 2;
    font-size: 22px;
    font-weight: 900;
    align-self: end;
}

.diff-desc {
    grid-row: 2;
    grid-column: 2;
    font-size: 13px;
    opacity: 0.9;
    align-self: start;
}