.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 32px 0 26px
}

.news-title {
    display: flex;
    align-items: center;
    gap: 14px
}

.eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #957042
}

.news .title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #957042
}

.hide {display: none;}

h1 {
    font-size: 32px;
    letter-spacing: -1.3px;
    margin: 4px 0 0
}

.back-link {
    font-size: 14px;
    color: #53627b;
    text-decoration: none;
    white-space: nowrap
}

.game {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 28px;
    margin-bottom: 40px
}

.controls {
    border: 1px solid #eee2d2;
    border-radius: 18px;
    padding: 30px 25px;
    background: #fffcf7
}

h2 {
    font-size: 28px;
    line-height: 1.45;
    letter-spacing: -1.3px;
    margin: 12px 0
}

.intro {
    font-size: 14px;
    line-height: 1.8;
    color: #7c715f;
    margin: 0 0 25px
}

.scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 25px 0
}

.scores>div {
    padding: 16px 10px;
    background: white;
    border: 1px solid #e8decd;
    border-radius: 12px;
    text-align: center;
    min-width: 0
}

.scores span {
    display: block;
    font-size: 12px;
    color: #7d715f
}

.scores strong {
    display: block;
    font-size: 27px;
    color: #674d30;
    margin-top: 6px;
    overflow-wrap: anywhere
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #7d715f;
    gap: 8px
}

.progress-label b {
    color: #87561f
}

progress {
    width: 100%;
    height: 7px;
    appearance: none;
    border: 0;
    border-radius: 9px;
    margin: 12px 0 25px;
    overflow: hidden;
    background: #ede4d6
}

progress::-webkit-progress-bar {
    background: #ede4d6
}

progress::-webkit-progress-value {
    background: #cb9550;
    border-radius: 9px
}

progress::-moz-progress-bar {
    background: #cb9550
}

.actions {
    display: grid;
    gap: 9px
}

button {
    border: 1px solid #dfd4c3;
    border-radius: 9px;
    background: #fff;
    color: #705335;
    padding: 12px 15px;
    font-size: 13px;
    font-weight: 700;
    touch-action: manipulation
}

button.primary {
    background: #96622f;
    border-color: #96622f;
    color: #fff
}

button:hover:not(:disabled) {
    filter: brightness(.94)
}

button:disabled {
    opacity: .45;
    cursor: default
}

.note {
    text-align: center;
    font-size: 11px;
    line-height: 1.8;
    color: #827764;
    margin: 16px 0 0
}

.mini-tiles {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px
}

.mini-tiles span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #f1e7d6;
    color: #7c6140;
    font-size: 20px;
    font-weight: 800
}

.mini-tiles span:last-child {
    background: #e9d7b2
}

.mini-tiles i {
    font-style: normal;
    color: #b3a38a
}

.play-area {
    border-radius: 18px;
    background: #f8f6f1;
    padding: 26px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0
}

.status-wrap {
    text-align: center;
    min-height: 70px
}

#status {
    color: #66553f;
    font-size: 16px;
    font-weight: 700;
    margin: 9px 0 18px;
    word-break: keep-all
}

.board-frame {
    position: relative;
    width: 100%;
    max-width: 424px;
    padding: 12px;
    background: #b9aa94;
    box-shadow: 0 6px 0 #a59782, 0 15px 25px #6a512416;
    border-radius: 15px
}

.board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    touch-action: none;
    user-select: none;
    border-radius: 5px
}

.board:focus-visible {
    outline: 3px solid #87561f;
    outline-offset: 16px
}

.tile {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #cfc4b3;
    color: #62523e;
    font-family: Arial, sans-serif;
    font-size: clamp(25px, 3.3vw, 43px);
    font-weight: 800;
    font-variant-numeric: tabular-nums
}

.tile.filled {
    box-shadow: 0 2px 2px #6b542414
}

.v2 {
    background: #f6eee2
}

.v4 {
    background: #eee0c4
}

.v8 {
    background: #eeb777;
    color: #533919
}

.v16 {
    background: #eb995e;
    color: #4c2d18
}

.v32 {
    background: #dc7955;
    color: #fff
}

.v64 {
    background: #bd5137;
    color: #fff
}

.v128 {
    background: #e2bf5b;
    color: #513d15;
    font-size: 34px
}

.v256 {
    background: #d9af44;
    color: #48330b;
    font-size: 34px
}

.v512 {
    background: #c89528;
    color: #382805;
    font-size: 34px
}

.v1024 {
    background: #9e751a;
    color: #fff;
    font-size: 29px
}

.v2048 {
    background: #79551a;
    color: #fff;
    font-size: 29px
}

.small-number {
    font-size: 18px;
    overflow-wrap: anywhere
}

.board-help {
    color: #837763;
    margin: 23px 0 13px;
    font-size: 12px;
    text-align: center
}

.direction-pad {
    display: flex;
    gap: 8px
}

.direction-pad button {
    width: 46px;
    height: 44px;
    padding: 0;
    font-size: 22px;
    background: #fffdf8
}

.result {
    position: absolute;
    inset: 0;
    background: #fff8e9ed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-radius: 15px;
    text-align: center;
    padding: 20px
}

.result p {
    font-size: 27px;
    font-weight: 900;
    letter-spacing: -1px;
    color: #704c25;
    margin: 0
}

.result span {
    font-size: 14px;
    color: #7d694e;
    margin-bottom: 6px
}

.guide {
    grid-column: 1/-1;
    border: 1px solid #e8e1d5;
    border-radius: 13px;
    padding: 18px 23px
}

.guide summary {
    font-size: 14px;
    font-weight: 700;
    cursor: pointer
}

.tips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px
}

.tips p {
    font-size: 13px;
    line-height: 1.8;
    color: #7c715f;
    margin: 18px 0 0
}

.tips b {
    display: block;
    color: #79582f;
    margin-bottom: 5px
}

dialog {
    border: 1px solid #e8e1d5;
    border-radius: 16px;
    padding: 26px;
    max-width: calc(100vw - 36px)
}

dialog::backdrop {
    background: #101b3070
}

dialog h2 {
    font-size: 22px
}

dialog p {
    font-size: 14px;
    color: #7c715f
}

.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px
}

[hidden] {
    display: none !important
}

@media(prefers-reduced-motion:no-preference) {
    .tile.new {
        animation: appear .16s ease-out
    }

    .tile.merged {
        animation: merge .18s ease-out
    }

    @keyframes appear {
        from {
            transform: scale(.5);
            opacity: .3
        }

        to {
            transform: scale(1);
            opacity: 1
        }
    }

    @keyframes merge {
        50% {
            transform: scale(1.08)
        }
    }
}

@media(max-width:850px) {
    .game {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 18px
    }

    .controls {
        padding: 23px 18px
    }

    h2 {
        font-size: 25px
    }

    .play-area {
        padding: 22px 17px
    }

    .board-frame {
        padding: 9px
    }

    .board {
        gap: 7px
    }

    .tile {
        font-size: 33px
    }

    .v128,
    .v256,
    .v512 {
        font-size: 28px
    }

    .v1024,
    .v2048 {
        font-size: 23px
    }

    .small-number {
        font-size: 18px
    }
}

@media(max-width:650px) {
    h1 {
        font-size: 24px
    }

    .game-title {
        gap: 9px
    }

    .game-title img {
        width: 43px;
        height: 45px
    }

    .page-heading {
        gap: 8px;
        margin: 25px 0 20px
    }

    .back-link {
        font-size: 12px
    }

    .game {
        grid-template-columns: 1fr;
        gap: 16px
    }

    .controls {
        padding: 18px
    }

    .controls>.eyebrow,
    .controls>h2,
    .intro,
    .mini-tiles,
    .progress-label,
    progress {
        display: none
    }

    .scores {
        margin: 0 0 13px
    }

    .scores>div {
        padding: 10px
    }

    .scores strong {
        font-size: 24px;
        margin-top: 3px
    }

    .actions {
        grid-template-columns: 1fr 1fr
    }

    .note {
        margin-top: 10px;
        font-size: 10px
    }

    .play-area {
        padding: 22px 13px
    }

    .board-frame {
        max-width: 390px
    }

    .tile {
        font-size: clamp(27px, 8vw, 40px)
    }

    .v128,
    .v256,
    .v512 {
        font-size: clamp(24px, 7vw, 34px)
    }

    .v1024,
    .v2048 {
        font-size: clamp(21px, 6vw, 29px)
    }

    .small-number {
        font-size: 18px
    }

    .status-wrap {
        min-height: 64px
    }

    .board-help {
        font-size: 10px
    }

    .result p {
        font-size: 24px
    }

    .tips {
        grid-template-columns: 1fr;
        gap: 0
    }

    .guide {
        padding: 17px
    }
}

.fortune-tabs {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 14px 0 22px;
    padding: 0
}

.tab-panel {border-top:solid 1px #dfdfdf;
 padding-top: 30px;
}

.tab-btn {
    padding: 11px 18px;
    border: 1px solid #dfd4c3;
    border-radius: 999px;
    background: #fff;
    color: #705335;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer
}

.tab-btn.is-active {
    background: #96622f;
    border-color: #96622f;
    color: #fff
}

.tab-panel[hidden] {
    display: none
}