* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: #faf8ef;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Arial', 'PingFang SC', sans-serif;
    overflow: hidden;
    touch-action: none;
}

.game-wrapper {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.game-title {
    font-size: 36px;
    font-weight: 700;
    color: #776e65;
}

.back-btn {
    background: #8f7a66;
    border: none;
    color: #fff;
    padding: 10px 32px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:active {
    transform: scale(0.95);
    background: #7a6a58;
}

.game-info-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #bbada0;
    padding: 8px 28px;
    border-radius: 6px;
}

.score-label {
    font-size: 12px;
    color: #eee4da;
    text-transform: uppercase;
}

.score-value {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.new-game-btn-inline {
    background: transparent;
    border: none;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
}

.new-game-btn-inline:active {
    transform: scale(0.9);
}

.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

#grid-container {
    width: calc(100vw - 40px);
    max-width: 400px;
    height: calc(100vw - 40px);
    max-height: 400px;
    padding: 10px;
    background: #bbada0;
    border-radius: 8px;
    position: relative;
}

.grid-cell {
    border-radius: 4px;
    background: #ccc0b3;
    position: absolute;
}

.number-cell {
    border-radius: 4px;
    font-family: Arial;
    font-weight: bold;
    text-align: center;
    position: absolute;
    transition: all 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.game-tips {
    margin-top: 15px;
    font-size: 14px;
    color: #776e65;
}

.game-over-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(238, 228, 218, 0.95);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
    z-index: 100;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-title {
    font-size: 36px;
    font-weight: 700;
    color: #776e65;
}

.final-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.final-score-label {
    font-size: 14px;
    color: #776e65;
}

.final-score-value {
    font-size: 32px;
    font-weight: 700;
    color: #8f7a66;
}

.retry-btn {
    background: #8f7a66;
    border: none;
    color: #fff;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:active {
    transform: scale(0.95);
    background: #7a6a58;
}
