/* ================================================================
   Name Scramble Game — Mobile-First Stylesheet
   Strictly consumes Master Brand Design Tokens from brand-tokens.css
   Enhanced for Full Responsiveness Across All Viewports (320px–1200px+)
   ================================================================ */

.bnm-ns-wrap {
    font-family: var(--font-body, 'Inter', -apple-system, sans-serif);
    padding: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    color: var(--ink, #1C1B29);
}

.bnm-ns-card {
    background: var(--surface, #FFFFFF);
    border-radius: 20px;
    padding: 20px 14px 28px;
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, .06));
    border: 1px solid var(--border, #E9E7F0);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
}

.bnm-ns-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--marigold, #F2A93B), var(--brand-primary, #D9006B), var(--brand-secondary, #1A47E7), var(--marigold, #F2A93B));
    background-size: 200% 100%;
    animation: bnmNsGradShift 4s linear infinite;
}

@keyframes bnmNsGradShift {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* Hero Badge */
.bnm-ns-hero-badge {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--marigold, #F2A93B) 0%, #d97706 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    margin: 0 auto 14px;
    box-shadow: 0 8px 24px rgba(242, 169, 59, .35);
}

.bnm-ns-title {
    font-size: clamp(19px, 4.5vw, 28px);
    font-weight: 800;
    margin: 0 0 8px;
    background: linear-gradient(135deg, #b45309, var(--marigold, #F2A93B));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.25;
    word-break: break-word;
}

.bnm-ns-subtitle {
    font-size: clamp(13px, 3.5vw, 15px);
    color: var(--ink-soft, #6B6878);
    line-height: 1.55;
    margin: 0 auto 16px;
    max-width: 520px;
}

/* Letter Tiles */
.bnm-ns-tiles-demo,
.bnm-ns-tiles-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 10px 0 16px;
}

.bnm-ns-tile {
    width: clamp(38px, 9.2vw, 50px);
    height: clamp(44px, 10.8vw, 54px);
    min-width: 36px;
    background: var(--surface, #FFFFFF);
    border: 2px solid var(--border, #E9E7F0);
    border-bottom: 3.5px solid #cbd5e1;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, 4.5vw, 22px);
    font-weight: 900;
    color: var(--ink, #1C1B29);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .05);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform .15s, background .15s, border-color .15s;
    box-sizing: border-box;
}

.bnm-ns-tile:hover {
    transform: translateY(-2px);
    border-color: var(--brand-primary, #D9006B);
    background: var(--brand-primary-soft, #FDF0F6);
}

.bnm-ns-tile:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.bnm-ns-tile--tilt-l {
    transform: rotate(-3deg);
}

.bnm-ns-tile--tilt-r {
    transform: rotate(3deg);
}

/* High Score Badge */
.bnm-ns-high-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--marigold-soft, #FDF1DD);
    color: #92400e;
    font-size: 12.5px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Buttons */
.bnm-ns-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    min-height: 48px;
    padding: 12px 28px;
    transition: transform .2s, box-shadow .2s, background .2s;
    border: none;
    text-decoration: none;
    box-sizing: border-box;
}

.bnm-ns-btn--primary {
    background: var(--btn-view-details-bg, var(--brand-gradient));
    color: var(--btn-view-details-color, #fff);
    box-shadow: 0 4px 18px rgba(217, 0, 107, .35);
    width: 100%;
    max-width: 280px;
}

.bnm-ns-btn--primary:hover {
    transform: translateY(-2px);
    background: var(--btn-view-details-hover-bg, var(--brand-gradient-hover));
    box-shadow: 0 8px 24px rgba(217, 0, 107, .45);
    color: #fff;
    text-decoration: none;
}

/* Game HUD */
.bnm-ns-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--canvas, #FAFAFC);
    border: 1.5px solid var(--border, #E9E7F0);
    border-radius: 14px;
    padding: 8px 12px;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.bnm-ns-hud-box {
    font-size: clamp(13px, 3.8vw, 15px);
    font-weight: 700;
    color: var(--ink, #1C1B29);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.bnm-ns-hud--timer {
    color: var(--ink, #1C1B29);
    font-size: clamp(15px, 4.2vw, 18px);
    font-weight: 800;
}

.bnm-ns-hud--streak {
    background: var(--brand-primary-soft, #FDF0F6);
    color: var(--brand-primary, #D9006B);
    padding: 2px 8px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 700;
}

/* Scramble Box */
.bnm-ns-scramble-box {
    background: linear-gradient(180deg, var(--marigold-soft, #FDF1DD) 0%, var(--surface, #FFFFFF) 100%);
    border: 2px dashed var(--marigold, #F2A93B);
    border-radius: 16px;
    padding: 14px 10px 10px;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.bnm-ns-scramble-hint-label {
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: block;
    margin-bottom: 4px;
}

/* Hint Box */
.bnm-ns-hint-box {
    background: var(--brand-secondary-soft, #EEF2FE);
    border: 1px solid var(--brand-secondary-tint, #E0E7FD);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12.5px;
    color: var(--brand-secondary, #1A47E7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
}

/* Input Form */
.bnm-ns-input-form {
    max-width: 440px;
    width: 100%;
    margin: 0 auto 12px;
    box-sizing: border-box;
}

.bnm-ns-input-group {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

.bnm-ns-text-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid var(--border, #E9E7F0);
    border-radius: 12px;
    font-size: clamp(14px, 4vw, 17px);
    font-family: inherit;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink, #1C1B29);
    background: var(--canvas, #FAFAFC);
    min-height: 48px;
    box-sizing: border-box;
    text-align: center;
}

.bnm-ns-text-input:focus {
    outline: none;
    border-color: var(--brand-primary, #D9006B);
    background: var(--surface, #FFFFFF);
    box-shadow: 0 0 0 3px var(--brand-primary-tint, #FCE7F1);
}

.bnm-ns-submit-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--btn-view-details-bg, var(--brand-gradient));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(217, 0, 107, .35);
    transition: transform .15s;
}

.bnm-ns-submit-btn:hover {
    transform: scale(1.05);
}

/* Shake Animation */
.bnm-ns-shake {
    animation: bnmNsShake .35s ease-in-out;
}

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

/* Controls */
.bnm-ns-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    width: 100%;
}

.bnm-ns-ctrl-btn {
    padding: 8px 12px;
    border-radius: 50px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border, #E9E7F0);
    background: var(--canvas, #FAFAFC);
    color: var(--ink-soft, #6B6878);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 38px;
    flex: 1 1 80px;
    max-width: 110px;
    box-sizing: border-box;
}

.bnm-ns-ctrl--hint {
    background: var(--marigold-soft, #FDF1DD);
    border-color: var(--marigold, #F2A93B);
    color: #92400e;
}

.bnm-ns-ctrl--skip {
    background: var(--brand-primary-soft, #FDF0F6);
    border-color: var(--brand-primary-tint, #FCE7F1);
    color: var(--brand-primary, #D9006B);
}

/* Feedback */
.bnm-ns-feedback {
    min-height: 22px;
    font-size: 13.5px;
    font-weight: 800;
    opacity: 0;
    transition: opacity .2s;
}

.bnm-ns-feedback--success {
    color: var(--teal, #0E8C7F);
}

.bnm-ns-feedback--error {
    color: #ef4444;
}

.bnm-ns-feedback--warning {
    color: var(--marigold, #F2A93B);
}

/* Game Over Screen */
.bnm-ns-over-icon {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, var(--marigold, #F2A93B), #d97706);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    margin: 0 auto 10px;
    box-shadow: 0 8px 20px rgba(242, 169, 59, .35);
}

.bnm-ns-final-score-card {
    background: linear-gradient(135deg, var(--marigold-soft, #FDF1DD) 0%, var(--surface, #FFFFFF) 100%);
    border: 1.5px solid var(--marigold, #F2A93B);
    border-radius: 18px;
    padding: 18px 12px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.bnm-ns-final-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #b45309;
}

.bnm-ns-final-number {
    font-size: clamp(36px, 9vw, 52px);
    font-weight: 900;
    color: #92400e;
    line-height: 1;
    margin: 4px 0 12px;
}

.bnm-ns-final-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #78350f;
}

.bnm-ns-final-stats span {
    background: rgba(255, 255, 255, 0.75);
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid rgba(242, 169, 59, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bnm-ns-final-stats strong {
    color: #451a03;
}

/* Solved Grid */
.bnm-ns-solved-section {
    background: var(--canvas, #FAFAFC);
    border: 1.5px solid var(--border, #E9E7F0);
    border-radius: 16px;
    padding: 16px 12px;
    margin-bottom: 20px;
    text-align: left;
    box-sizing: border-box;
}

.bnm-ns-solved-heading {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--ink, #1C1B29);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bnm-ns-solved-heading .fas {
    color: var(--marigold, #F2A93B);
}

.bnm-ns-solved-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.bnm-ns-solved-card {
    background: var(--surface, #FFFFFF);
    border: 1px solid var(--border, #E9E7F0);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-sizing: border-box;
}

.bnm-ns-card-badge {
    align-self: flex-start;
    background: var(--teal-soft, #E1F4F1);
    color: var(--teal, #0E8C7F);
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bnm-ns-solved-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink, #1C1B29);
    text-decoration: none;
}

.bnm-ns-solved-name:hover {
    color: var(--brand-primary, #D9006B);
}

.bnm-ns-gender-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    align-self: flex-start;
}

.bnm-ns-gender--boy {
    background: var(--brand-secondary-soft, #EEF2FE);
    color: var(--brand-secondary, #1A47E7);
}

.bnm-ns-gender--girl {
    background: var(--brand-primary-soft, #FDF0F6);
    color: var(--brand-primary, #D9006B);
}

.bnm-ns-solved-meaning {
    font-size: 12.5px;
    color: var(--ink-soft, #6B6878);
    line-height: 1.5;
    margin: 0;
}

.bnm-ns-solved-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-primary, #D9006B);
    text-decoration: none;
    margin-top: 2px;
}

.bnm-ns-solved-link:hover {
    text-decoration: underline;
}

/* Actions */
.bnm-ns-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.bnm-ns-btn--share {
    background: var(--btn-view-details-bg, var(--brand-gradient));
    color: #fff;
    box-shadow: 0 4px 16px rgba(217, 0, 107, .3);
    width: 100%;
    max-width: 260px;
}

.bnm-ns-btn--share:hover {
    background: var(--btn-view-details-hover-bg, var(--brand-gradient-hover));
    color: #fff;
}

.bnm-ns-btn--secondary {
    background: var(--canvas, #FAFAFC);
    color: var(--ink-soft, #6B6878);
    border: 1.5px solid var(--border, #E9E7F0);
    width: 100%;
    max-width: 260px;
}

.bnm-ns-btn--secondary:hover {
    background: var(--border, #E9E7F0);
    color: var(--ink, #1C1B29);
}

/* Info & FAQ Sections */
.bnm-ns-info-section,
.bnm-ns-faq-section {
    margin-bottom: 24px;
    text-align: left;
    width: 100%;
}

.bnm-ns-section-title {
    font-size: clamp(17px, 3.5vw, 22px);
    font-weight: 800;
    color: var(--ink, #1C1B29);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bnm-ns-section-title .fas {
    color: var(--marigold, #F2A93B);
}

.bnm-ns-how-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.bnm-ns-how-card {
    background: var(--surface, #FFFFFF);
    border: 1px solid var(--border, #E9E7F0);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, .04);
}

.bnm-ns-how-icon {
    width: 40px;
    height: 40px;
    background: var(--marigold-soft, #FDF1DD);
    color: #b45309;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 10px;
}

.bnm-ns-how-card h3 {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--ink, #1C1B29);
}

.bnm-ns-how-card p {
    font-size: 13px;
    color: var(--ink-soft, #6B6878);
    line-height: 1.55;
    margin: 0;
}

/* FAQ */
.bnm-ns-faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bnm-ns-faq-item {
    background: var(--surface, #FFFFFF);
    border: 1px solid var(--border, #E9E7F0);
    border-radius: 14px;
    overflow: hidden;
}

.bnm-ns-faq-item[open] {
    box-shadow: 0 4px 20px rgba(242, 169, 59, .08);
    border-color: var(--marigold-soft, #FDF1DD);
}

.bnm-ns-faq-q {
    padding: 14px 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink, #1C1B29);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    user-select: none;
}

.bnm-ns-faq-q::-webkit-details-marker {
    display: none;
}

.bnm-ns-faq-q::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 13px;
    color: var(--marigold, #F2A93B);
    transition: transform .3s;
}

.bnm-ns-faq-item[open] .bnm-ns-faq-q {
    color: #b45309;
}

.bnm-ns-faq-item[open] .bnm-ns-faq-q::after {
    transform: rotate(180deg);
}

.bnm-ns-faq-a {
    padding: 0 16px 14px;
    border-top: 1px solid var(--border, #E9E7F0);
}

.bnm-ns-faq-a p {
    font-size: 13px;
    color: var(--ink-soft, #6B6878);
    line-height: 1.6;
    margin: 10px 0 0;
}

/* Tablet & Desktop */
@media (min-width: 600px) {
    .bnm-ns-card {
        padding: 32px 28px 36px;
        border-radius: 24px;
    }

    .bnm-ns-btn--primary {
        max-width: 320px;
    }

    .bnm-ns-tiles-demo,
    .bnm-ns-tiles-container {
        gap: 8px;
    }

    .bnm-ns-tile {
        width: 48px;
        height: 52px;
        font-size: 22px;
        border-radius: 14px;
    }

    .bnm-ns-hud {
        padding: 10px 16px;
    }

    .bnm-ns-solved-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bnm-ns-actions {
        flex-direction: row;
        justify-content: center;
    }

    .bnm-ns-actions .bnm-ns-btn {
        width: auto;
        min-width: 170px;
    }

    .bnm-ns-how-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .bnm-ns-card {
        padding: 40px 36px;
    }

    .bnm-ns-solved-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}