* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none;
    user-select: none;
}

*:focus {
    /* 去除焦点框 */
    outline: none;
}

:root {
    --width: 370px;
    --gapTop: 80px;
    --gapBottom: 10px;

    --color: #756452;
    --bgColor: #fbf7ed;
    --gridBgColor: #9b8b7c;
    --cellBgColor: #bdac97;

    --commonRadius: 12px;
    --gridRadius: 14px;
    --cellRadius: 8px;
    --tileRadius: 10px;
}

@media screen and (max-height: 700px) {
    :root {
        --gapTop: 20px;
    }
}

a {
    color: inherit;
    text-decoration: none;
}

body {
    font-family: sans-serif;
    background-color: var(--bgColor);
    overflow: hidden;
    /* 禁用页面滚动溢出行为 */
    overscroll-behavior: none;
}

[v-cloak] {
    display: none !important;
}

.container {
    width: 100vw;
    height: var(--vh);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    transition: height 200ms ease;
}

/* 头部 */
.header-container {
    width: var(--width);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--gapTop);
    transition: margin 200ms ease;
}

.title-box {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.title-box .game-title {
    color: var(--color);
    font-size: 33px;
    font-weight: bold;
}

.title-box .info {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 5px;
    background-color: #baac9a;
    border-radius: 6px;
    transform: translateY(2px);
}

.menu-btn,
.restart-btn {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px;
    border-radius: var(--commonRadius);
}

.menu-btn img {
    width: 34px;
    height: 34px;
}

.restart-btn img {
    width: 22px;
    height: 22px;
}

.select-btn {
    background-color: #e0dad1;
}

/* 计分栏 */
.score-container {
    width: var(--width);
    display: flex;
    margin-top: 12px;
    margin-bottom: 20px;
    gap: 12px;
}

.score-box,
.highScore-box {
    flex: 1;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 14px;
    background-color: var(--bgColor);
    border-radius: var(--commonRadius);
}

.score-box {
    background-color: #eae7d9;
}

.highScore-box {
    border: #eae7d9 2px solid;
}

.score-box span,
.highScore-box span {
    color: var(--color);
    font-size: 13px;
}

.score-box span:first-child,
.highScore-box span:first-child {
    flex: 1;
}

.score-box span:last-child,
.highScore-box span:last-child {
    font-size: 15px;
    font-weight: bold;
}

/* 游戏区域 */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 200ms ease;
}

/* 方块面板 */
.grid-container {
    position: relative;
    width: 340px;
    height: 340px;
    background-color: var(--gridBgColor);
    border-radius: var(--gridRadius);
    box-shadow: 0px 3px 15px rgb(155, 139, 124, 0.3);
}

/* 背景 */
.cell-box {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4px;
}

.cell-box .cell-row {
    display: flex;
}

.cell-box .cell-row .cell {
    width: 75px;
    height: 75px;
    margin: 4px;
    background-color: var(--cellBgColor);
    border-radius: var(--cellRadius);
}

/* 方块 */
.tile-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.tile-box .tile {
    position: absolute;
    width: 77px;
    height: 77px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 7px;
    font-size: 32px;
    font-weight: bold;
    white-space: nowrap;
    border-radius: var(--tileRadius);
    box-shadow: -0.2px -0.2px 0.2px rgba(150, 150, 150, 0.5),
        0.5px 0.5px 2px rgba(110, 110, 110, 0.5);
    transition: left 80ms linear, top 80ms linear;
}

/* 游戏信息 */
.info-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding: 0 5px;
    color: var(--color);
    font-size: 12px;
    font-weight: bold;
}

/* 工具按钮隐藏动画 */
@keyframes down-up {
    0% {
        opacity: 0.5;
        transform: translateY(15px);
    }

    50% {
        opacity: 1;
        transform: translateY(-2px);
    }

    100% {
        opacity: 1;
        transform: translateY(0px);
    }
}

.tool-container {
    width: var(--width);
    height: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tool-box {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background-color: #eae7d9;
    border-radius: 20px;
    animation: down-up 200ms ease;
}

.undo-box,
.ai-box,
.aiset-box {
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #baac9a;
    border-radius: var(--tileRadius);
    transition: background-color 200ms ease;
}

.ai-box span {
    color: #ffffff;
    font-size: 22px;
    font-weight: bold;
}

.disable {
    background-color: #baac9a4d;
}

/* 菜单窗口 */
.menu-container {
    position: absolute;
    width: 100vw;
    height: var(--vh);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: var(--gapTop);
    transition: padding 200ms ease;
}

/* 菜单窗口弹出动画 */
@keyframes top-down {
    0% {
        opacity: 0.5;
        transform: translateY(-10px);
    }

    50% {
        opacity: 1;
        transform: translateY(2px);
    }

    100% {
        opacity: 1;
        transform: translateY(0px);
    }
}

.menu-box {
    width: var(--width);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    margin-top: 48px;
    background-color: #e0dad1;
    border-radius: var(--commonRadius);
    box-shadow: 0px 10px 15px rgb(155, 139, 124, 0.5);
    animation: top-down 200ms ease;
}

.menu-box .item {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 13px 15px;
    color: #756452;
    border-radius: 8px;
}

.menu-box .item .title {
    font-size: 16.5px;
    font-weight: bold;
}

.menu-box .item .info {
    font-size: 13px;
}

.select-item {
    color: #fff !important;
    background-color: #aea091;
}

/* 对话框 */
@keyframes opacity-up {
    from {
        background-color: rgba(0, 0, 0, 0);
    }

    to {
        background-color: rgba(0, 0, 0, 0.45);
    }
}

.dialog-container {
    position: absolute;
    width: 100vw;
    height: var(--vh);
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: var(--gapTop);
    padding-bottom: var(--gapBottom);
    animation: opacity-up 300ms ease-in-out forwards;
}

@keyframes scale-up {
    0% {
        scale: 0.5;
        transform: translateY(50px);
    }

    50% {
        scale: 1.03;
        transform: translateY(-10px);
    }

    100% {
        scale: 1;
        transform: translateY(0);
    }
}

.restart-box {
    width: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 45px 30px 30px 30px;
    background-color: #eae7d9;
    border-radius: 26px;
    transform-origin: bottom;
    animation: scale-up 200ms ease-in-out forwards;
}

.restart-box .title {
    color: var(--color);
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 20px;
}

.restart-box .ybtn,
.restart-box .nbtn {
    width: 100%;
    height: 50px;
    font-size: 18px;
    border-radius: var(--gridRadius);
    border: none;
}

.restart-box .ybtn {
    color: #fff;
    background-color: var(--gridBgColor);
    box-shadow: 0px 5px 20px rgb(155, 139, 124, 0.3);
}

.restart-box .nbtn {
    color: var(--gridBgColor);
    background-color: #eae7d9;
    border: var(--gridBgColor) 2px solid;
}

.ctrl-container {
    position: absolute;
    width: 100vw;
    height: var(--vh);
    background-color: transparent;
}

/* 底部 */
.footer {
    color: #d3c8bc;
    font-size: 11px;
    margin: var(--gapBottom) 0;
}