body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f5f5f5;
    color: #333333;
}

body.dark-mode {
    background-color: #181818;
    color: #fff;
}

.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

body.dark-mode .header {
    background-color: #282828;
}

.theme-toggle {
    margin-right: 10px;
}

.score {
    font-size: 18px;
}

.game-container {
    text-align: center;
    background: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
}

body.dark-mode .game-container {
    background: #282828;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.grid-size-selector {
    margin-bottom: 20px;
}

.grid {
    display: grid;
    grid-gap: 5px;
    margin-bottom: 20px;
}

.grid-3x3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4x4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid div {
    width: 100%;
    padding-top: 100%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    border: 1px solid #e0e0e0;
}

.grid div::after {
    content: attr(data-letter);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.grid div .top-left,
.grid div .bottom-right {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
}

.grid div .top-left {
    top: 2px;
    left: 2px;
}

.grid div .bottom-right {
    bottom: 2px;
    right: 2px;
}

body.dark-mode .grid div {
    background: #383838;
}

input {
    padding: 5px;
    font-size: 16px;
    width: 80%;
}

button {
    padding: 5px 10px;
    font-size: 16px;
}

#timer {
    font-size: 20px;
    margin-bottom: 20px;
}

#shareButton {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #ff6347;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: none;
}

#shareButton:hover {
    background-color: #e5533d;
}
