/* ============================================================
   NATTERRUSH
   A NATTERFLY ORIGINAL - TIMED MODE
============================================================ */

.natterpop-wrapper {
    position: relative;
    width: min(100%, 1080px);
    margin: 0 auto;
    padding: 20px;
    color: #ffffff;
    text-align: left;
}

/* ============================================================
   INTRO
============================================================ */

.natterpop-intro {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 12px;
    padding: 14px 18px;
    border: 1px solid rgba(89, 186, 224, .32);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(12, 48, 63, .96), rgba(6, 27, 38, .94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.natterpop-intro.is-hidden {
    display: none;
}

.natterpop-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 78px;
    height: 78px;
    border: 1px solid rgba(98, 201, 239, .32);
    border-radius: 50%;
    background: rgba(2, 17, 25, .76);
    box-shadow: 0 0 24px rgba(21, 176, 232, .10);
}

.natterpop-logo-wrap img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.natterpop-original {
    display: block;
    margin-bottom: 3px;
    color: #79d7f7;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.natterpop-intro-copy h2 {
    margin: 0 0 4px;
    color: #ffffff;
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1;
}

.natterpop-intro-copy p {
    max-width: 660px;
    margin: 0;
    color: #bed3dc;
    font-size: 11px;
    line-height: 1.55;
}

.natterpop-intro-slogan {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 6px;
    color: #6fd4f8;
    font-size: 16px;
    font-style: italic;
    font-weight: 700;
    line-height: 1.05;
    opacity: .82;
    transform: rotate(-4deg);
}

/* ============================================================
   TOP STATS
============================================================ */

.natterpop-topbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.natterpop-stat {
    padding: 10px 8px;
    border: 1px solid rgba(89, 186, 224, .28);
    border-radius: 6px;
    background: rgba(9, 39, 52, .92);
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.natterpop-stat span {
    display: block;
    margin-bottom: 2px;
    color: #96bdcb;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.natterpop-stat strong {
    display: block;
    color: #ffffff;
    font-size: 18px;
}

/* ============================================================
   MAIN TWO-COLUMN LAYOUT
============================================================ */

.natterpop-game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 285px;
    gap: 14px;
    align-items: start;
}

.natterpop-main-panel,
.natterpop-side-panel {
    min-width: 0;
}

.natterpop-main-panel {
    padding: 12px;
    border: 1px solid rgba(89, 186, 224, .24);
    border-radius: 9px;
    background: rgba(2, 17, 25, .72);
    box-shadow: inset 0 0 28px rgba(0, 0, 0, .18);
}

/* ============================================================
   BOARD
============================================================ */

.natterpop-board {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    padding: 10px;
    border: 1px solid rgba(96, 192, 230, .32);
    border-radius: 9px;
    background:
        radial-gradient(circle at 50% 8%, rgba(45, 116, 141, .34), transparent 56%),
        rgba(3, 22, 31, .96);
    box-shadow:
        inset 0 0 28px rgba(0, 0, 0, .30),
        0 8px 30px rgba(0, 0, 0, .16);
}

.natterpop-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    min-width: 0;
    padding: 5px;
    border: 1px solid #55727c;
    border-radius: 11px;
    background: linear-gradient(180deg, #ffffff, #dce9ee);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .88),
        0 2px 5px rgba(0, 0, 0, .30);
    color: #17343f;
    cursor: pointer;
    transition:
        transform .11s ease,
        box-shadow .11s ease,
        border-color .11s ease;
}

.natterpop-tile:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: #7ecbe8;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .9),
        0 4px 10px rgba(0, 0, 0, .32),
        0 0 10px rgba(78, 194, 237, .14);
}

.natterpop-tile.is-selected {
    transform: none;
    border-color: #76c9ea;
    box-shadow: inset 0 0 0 2px rgba(118, 201, 234, .55);
}

.natterpop-tile.is-line {
    border-color: #76c9ea;
    box-shadow:
        inset 0 0 0 2px rgba(118, 201, 234, .45),
        0 0 8px rgba(118, 201, 234, .32);
}

.natterpop-tile.is-bomb {
    border-color: #df8fdb;
    box-shadow:
        inset 0 0 0 2px rgba(223, 143, 219, .48),
        0 0 9px rgba(223, 143, 219, .38);
}

.natterpop-tile.is-wild {
    border-color: #f4c84f;
    background: radial-gradient(circle, #ffffff 0%, #e5f6fb 52%, #bddbe5 100%);
    box-shadow:
        inset 0 0 0 2px rgba(117, 201, 233, .48),
        0 0 12px rgba(244, 200, 79, .52);
}

.natterpop-tile img {
    display: block;
    max-width: 78%;
    max-height: 78%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.natterpop-fallback {
    font-size: clamp(24px, 3.3vw, 40px);
    line-height: 1;
    pointer-events: none;
}

.natterpop-special-mark {
    position: absolute;
    right: 3px;
    bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0d2a35;
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
    pointer-events: none;
}

/* ============================================================
   BOARD FOOTER
============================================================ */

.natterpop-board-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    max-width: 660px;
    margin: 10px auto 0;
}

.natterpop-music-slot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 145px;
}

.natterpop-status {
    max-width: 660px;
    min-height: 18px;
    margin: 7px auto 0;
    color: #d7edf5;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.natterpop-start {
    flex: 0 0 auto;
    min-width: 145px;
    min-height: 40px;
    margin: 0;
    box-shadow: 0 0 16px rgba(50, 191, 239, .16);
}

/* ============================================================
   SIDE PANEL
============================================================ */

.natterpop-side-panel {
    display: grid;
    gap: 10px;
}

.natterpop-help-card,
.natterpop-tip {
    border: 1px solid rgba(89, 186, 224, .28);
    border-radius: 8px;
    background: rgba(7, 34, 46, .90);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.natterpop-help-card {
    padding: 14px;
}

.natterpop-help-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 9px;
    color: #ffffff;
    font-size: 14px;
}

.natterpop-help-card h3 i {
    color: #6fd4f8;
}

.natterpop-help-card p {
    margin: 0 0 11px;
    color: #b5ccd5;
    font-size: 10px;
    line-height: 1.55;
}

.natterpop-rules {
    display: grid;
    gap: 6px;
}

.natterpop-rules div {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid rgba(255,255,255,.06);
}

.natterpop-rules div:first-child {
    border-top: 0;
}

.natterpop-rules b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    border-radius: 5px;
    background: rgba(31, 113, 145, .48);
    color: #ffffff;
    font-size: 10px;
}

.natterpop-rules span {
    color: #d2e5ec;
    font-size: 10px;
    font-weight: 700;
}

.natterpop-objective {
    min-height: 0;
    margin: 0;
    padding: 9px 10px;
    border: 1px solid rgba(96, 192, 230, .20);
    border-radius: 5px;
    background: rgba(1, 20, 29, .60);
    color: #d3e9f1;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.45;
}

.natterpop-best-score {
    display: block;
    color: #ffd96a;
    font-size: 20px;
    line-height: 1.15;
}

.natterpop-tip {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 12px;
    color: #cde6ef;
    font-size: 10px;
    font-style: italic;
    line-height: 1.45;
}

.natterpop-tip i {
    margin-top: 1px;
    color: #72d6f7;
}

.natterpop-wrapper.is-game-over .natterpop-intro {
    display: grid;
}

/* ============================================================
   RESPONSIVE
============================================================ */

@media (max-width: 920px) {
    .natterpop-wrapper {
        padding: 14px;
    }

    .natterpop-game-layout {
        grid-template-columns: minmax(0, 1fr);
    }

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

    .natterpop-tip {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .natterpop-wrapper {
        padding: 9px;
    }

    .natterpop-intro {
        grid-template-columns: 68px minmax(0, 1fr);
        gap: 11px;
        padding: 11px;
    }

    .natterpop-intro-slogan {
        display: none;
    }

    .natterpop-logo-wrap {
        width: 60px;
        height: 60px;
    }

    .natterpop-logo-wrap img {
        width: 44px;
        height: 44px;
    }

    .natterpop-intro-copy h2 {
        font-size: 22px;
    }

    .natterpop-intro-copy p {
        font-size: 9px;
    }

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

    .natterpop-board {
        gap: 3px;
        padding: 5px;
    }

    .natterpop-tile {
        padding: 2px;
        border-radius: 7px;
    }

    .natterpop-special-mark {
        width: 14px;
        height: 14px;
        font-size: 8px;
    }

    .natterpop-board-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .natterpop-music-slot,
    .natterpop-start {
        width: 100%;
    }

    .natterpop-music-slot {
        justify-content: stretch;
    }

    .natterpop-music-toggle {
        width: 100%;
    }

    .natterpop-side-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .natterpop-tip {
        grid-column: auto;
    }
}

@media (max-width: 430px) {
    .natterpop-board {
        gap: 2px;
        padding: 4px;
    }

    .natterpop-tile {
        border-radius: 5px;
    }
}

/* ============================================================
   NATTERRUSH MOTION / FEEDBACK
============================================================ */

.natterpop-wrapper {
    position: relative;
}

.natterpop-tile.is-popping {
    z-index: 4;
    pointer-events: none;
    animation: natterpopPop .52s cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes natterpopPop {
    0%   { transform: scale(1) rotate(0deg); opacity: 1; }
    18%  { transform: scale(1.16) rotate(0deg); opacity: 1; }
    36%  { transform: scale(.88) rotate(0deg); opacity: 1; }
    55%  { transform: scale(1.12) rotate(-2deg); opacity: 1; }
    64%  { transform: scale(1.08) rotate(3deg); opacity: 1; }
    73%  { transform: scale(1.1) rotate(-3deg); opacity: 1; }
    82%  { transform: scale(1.06) rotate(2deg); opacity: 1; }
    100% { transform: scale(.12) rotate(0deg); opacity: 0; }
}

.natterpop-tile.is-dropping {
    animation: natterpopDrop .40s cubic-bezier(.18,.78,.24,1.08) both;
}

@keyframes natterpopDrop {
    from {
        transform: translateY(calc(-1 * var(--drop-rows) * (100% + 5px)));
    }
    82% {
        transform: translateY(3px);
    }
    to {
        transform: translateY(0);
    }
}

.natterpop-praise {
    position: absolute;
    z-index: 20;
    left: 50%;
    top: 56%;
    max-width: 90%;
    padding: 8px 16px;
    border: 1px solid rgb(255 255 255 / 40%);
    border-radius: 16px;
    background: rgb(7 23 29 / 88%);
    color: #ffffff;
    box-shadow: 0 7px 24px rgb(0 0 0 / 34%);
    font-size: clamp(18px, 5vw, 34px);
    font-weight: 900;
    letter-spacing: .025em;
    line-height: 1.05;
    text-align: center;
    text-shadow: 0 2px 0 rgb(0 0 0 / 25%);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(.65) rotate(-2deg);
}

.natterpop-praise.is-showing {
    animation: natterpopPraise 1.8s cubic-bezier(.18,.75,.25,1) both;
}

@keyframes natterpopPraise {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(.55) rotate(-4deg); }
    20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); }
    38%  { opacity: 1; transform: translate(-50%, -50%) scale(.98) rotate(0); }
    72%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
    100% { opacity: 0; transform: translate(-50%, -63%) scale(.9) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
    .natterpop-tile.is-popping,
    .natterpop-tile.is-dropping,
    .natterpop-praise.is-showing {
        animation-duration: .01ms !important;
    }
}

/* ============================================================
   NATTERRUSH MUSIC TOGGLE
============================================================ */

.natterpop-music-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    margin: 0;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 4px;
    background: rgba(0, 0, 0, .18);
    color: inherit;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.natterpop-music-toggle:hover {
    background: rgba(0, 0, 0, .28);
}

.natterpop-music-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .natterpop-music-toggle {
        min-height: 44px;
    }
}

/* ============================================================
   NATTERRUSH - TIMED MODE ADDITIONS
============================================================ */
.natterpop-wrapper.is-rush-warning .natterpop-board {
    animation: natterrushWarning .55s ease-in-out infinite alternate;
}
.natterpop-wrapper.is-rush-warning #natterpop-moves {
    animation: natterrushClock .45s ease-in-out infinite alternate;
}
@keyframes natterrushWarning {
    from { box-shadow: inset 0 0 28px rgba(0,0,0,.30), 0 8px 30px rgba(0,0,0,.16); }
    to { box-shadow: inset 0 0 28px rgba(0,0,0,.30), 0 0 22px rgba(255,255,255,.28); }
}
@keyframes natterrushClock { from { transform: scale(1); } to { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
    .natterpop-wrapper.is-rush-warning .natterpop-board,
    .natterpop-wrapper.is-rush-warning #natterpop-moves { animation: none; }
}


/* NatterRush: urgent final 10-second board shudder */
#natterpop-board.is-rush-warning {
    animation: natterrush-board-shudder .22s linear infinite !important;
    transform-origin: center center;
}

@keyframes natterrush-board-shudder {
    0%   { transform: translate(0, 0); }
    20%  { transform: translate(-3px, 1px); }
    40%  { transform: translate(3px, -1px); }
    60%  { transform: translate(-2px, -1px); }
    80%  { transform: translate(2px, 1px); }
    100% { transform: translate(0, 0); }
}
