body {
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #2a2a2a;
    font-family: Arial, sans-serif;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2%;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    width: 85vw;
    max-width: 500px;
    aspect-ratio: 1;
}

.grid-box {
    background-color: #ffffff; /* white squares */
    border: 1px solid #8B4513;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    aspect-ratio: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    box-sizing: border-box; /* Ensure borders don't affect size */
}

/* Alternating chess squares pattern */
.grid-box:nth-child(odd) {
    background-color: #98c9a4; /* light squares */
}

.grid-box:nth-child(even) {
    background-color: #688d72; /* dark squares */
}

.box-label {
    font-size: 10px;
    font-weight: bold;
    color: #ffffff;
    padding: 2px 4px;
    position: absolute;
    bottom: 2px;
    left: 2px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 2px;
}

.chess-knight {
    font-size: 60px;
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: grab;
    user-select: none;
    z-index: 10;
}

.chess-knight:active {
    cursor: grabbing;
}

/* Different colors for multiple knights */
.chess-knight[id="knight-0"] {
    color: #000000; /* Black - primary knight */
}

.chess-knight[id="knight-1"] {
    color: #8B4513; /* Brown - secondary knight */
}

.chess-knight[id="knight-2"] {
    color: #2F4F4F; /* Dark slate gray - tertiary knight */
}

.chess-knight[id="knight-3"] {
    color: #800080; /* Purple - quaternary knight */
}

/* Highlight active knight */
.chess-knight.active {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

.grid-box.valid-move {
    box-shadow: inset 0 0 0 3px #FF0000, 0 0 10px rgba(255, 0, 0, 0.6);
    cursor: pointer;
    box-sizing: border-box; /* Ensure borders don't affect size */
}

/* Alternative valid move highlight for JavaScript styling */
.valid-move-highlight {
    box-sizing: border-box !important;
    border: 1px solid #ff0000 !important;
}

.grid-box.valid-move:hover {
    box-shadow: inset 0 0 0 3px #FF4444, 0 0 15px rgba(255, 0, 0, 0.8);
    transform: scale(1.02);
    box-sizing: border-box; /* Ensure borders don't affect size */
}

.center-letter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9), 1px 1px 2px rgba(0, 0, 0, 0.7);
    z-index: 1;
    pointer-events: none;
}

.message-container {
    margin-top: 15px;
    text-align: center;
    font-family: Arial, sans-serif;
}

.game-message {
    font-size: 18px !important;
    font-weight: bold !important;
    color: #654321 !important;
    min-height: 30px !important;
    padding: 8px 16px !important;
    background-color: rgba(245, 245, 220, 0.95) !important;
    border-radius: 4px !important;
    border: 2px solid #8b7355 !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease;
    min-width: 200px !important;
    text-align: center !important;
}

.game-message.valid {
    background-color: rgba(240, 230, 140, 0.95);
    color: #654321;
    border-color: #daa520;
    box-shadow: 0 2px 4px rgba(218, 165, 32, 0.3);
    box-sizing: border-box; /* Ensure borders don't affect size */
}

.game-message.invalid {
    background-color: rgba(222, 184, 135, 0.95);
    color: #8b4513;
    border-color: #cd853f;
    box-shadow: 0 2px 4px rgba(205, 133, 63, 0.3);
    box-sizing: border-box; /* Ensure borders don't affect size */
}

.move-counter-container {
    margin-top: 15px;
    text-align: center;
    font-family: Arial, sans-serif;
}

.move-counter-container h3 {
    margin: 0;
    color: #654321;
    font-size: 20px;
    padding: 8px 16px;
    background-color: rgba(245, 245, 220, 0.95);
    border-radius: 4px;
    border: 2px solid #8b7355;
    display: inline-block;
    box-sizing: border-box; /* Ensure borders don't affect size */
}

#move-count {
    color: #b8860b;
    font-weight: bold;
}

.button-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.reset-btn {
    padding: 8px 16px;
    background-color: #8b4513;
    color: #f5f5dc;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.reset-btn:hover {
    background-color: #654321;
}

.reset-btn:active {
    background-color: #5d4e37;
}

.undo-btn {
    padding: 8px 16px;
    background-color: #cd853f;
    color: #654321;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.undo-btn:hover:not(:disabled) {
    background-color: #a0522d;
}

.undo-btn:active:not(:disabled) {
    background-color: #8b4513;
}

.undo-btn:disabled {
    background-color: #d3d3d3;
    color: #999;
    cursor: not-allowed;
}

.share-btn {
    padding: 8px 16px;
    background-color: #20b2aa;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.share-btn:hover {
    background-color: #17a2b8;
}

.share-btn:active {
    background-color: #138496;
}

/* Share popup styles */
.share-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.share-popup {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 80%;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

.share-popup-header {
    background-color: #20b2aa;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.share-popup-header h3 {
    margin: 0;
    font-size: 18px;
}

.share-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.share-popup-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.share-popup-content {
    padding: 20px;
}

.share-copied-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-weight: bold;
    text-align: center;
}

.share-text-area {
    width: 100%;
    height: 200px;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    background-color: #f8f9fa;
    box-sizing: border-box;
}

.share-text-area:focus {
    outline: none;
    border-color: #20b2aa;
}

.share-popup-buttons {
    padding: 15px 20px;
    background-color: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.share-native-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.share-native-btn:hover {
    background-color: #218838;
}

.share-copy-btn {
    background-color: #20b2aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.share-copy-btn:hover {
    background-color: #17a2b8;
}

.share-cancel-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.share-cancel-btn:hover {
    background-color: #5a6268;
}

.consumed-letters-container {
    margin-top: 30px;
    text-align: center;
    font-family: Arial, sans-serif;
}

.consumed-letters-container h3 {
    margin: 0 0 10px 0;
    color: #654321;
    font-size: 18px;
}

#consumed-letters {
    font-size: 24px;
    font-weight: bold;
    color: #8b4513;
    letter-spacing: 8px;
    width: 300px;
    height: 50px;
    padding: 10px;
    background-color: rgba(245, 245, 220, 0.9);
    border-radius: 4px;
    border: 2px solid #8b7355;
    box-sizing: border-box; /* Ensure borders don't affect size */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.words-container {
    margin-top: 20px;
    text-align: center;
    font-family: Arial, sans-serif;
}

.words-container h3 {
    margin: 0 0 10px 0;
    color: #654321;
    font-size: 18px;
}

#words-list {
    font-size: 20px;
    font-weight: bold;
    color: #654321;
    width: 400px;
    height: 100px;
    padding: 10px;
    background-color: rgba(245, 245, 220, 0.95);
    border-radius: 4px;
    border: 2px solid #8b7355;
    line-height: 1.6;
    box-sizing: border-box; /* Ensure borders don't affect size */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.word-item {
    display: inline-block;
    margin: 5px 10px;
    padding: 5px 10px;
    background-color: #f0e68c;
    border-radius: 4px;
    border: 1px solid #daa520;
    box-sizing: border-box; /* Ensure borders don't affect size */
}

.progress-container {
    margin-top: 20px;
    text-align: center;
    font-family: Arial, sans-serif;
}

.progress-container h3 {
    margin: 0 0 10px 0;
    color: #654321;
    font-size: 18px;
}

#progress-display {
    font-size: 16px;
    font-weight: bold;
    color: #654321;
    margin-bottom: 10px;
    padding: 5px 10px;
    background-color: rgba(245, 245, 220, 0.9);
    border-radius: 4px;
    border: 2px solid #8b7355;
    display: inline-block;
    min-width: 150px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* Progress completion styling */
#progress-display.complete {
    background-color: rgba(144, 238, 144, 0.9) !important;
    border-color: #228b22 !important;
    color: #006400 !important;
}

#progress-bar {
    width: 100%;
    max-width: 300px;
    height: 20px;
    background-color: rgba(245, 245, 220, 0.5);
    border-radius: 10px;
    border: 2px solid #8b7355;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #daa520, #b8860b);
    border-radius: 8px;
    width: 0%;
    transition: width 0.5s ease-in-out;
    box-shadow: 0 2px 4px rgba(218, 165, 32, 0.3);
}