body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
  }
  
  #start-menu {
    padding: 2rem;
    text-align: center;
  }
  
  #game-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }
  
  .main-game-area {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 15px;
    min-height: 600px;
  }
  
  #game-info {
    background-color: #f5f5f5;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 14px;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
  }
  
  #game-info p {
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex: 1;
    justify-content: center;
  }
  
  #game-timer, #round-indicator, #remaining-tiles-count {
    font-weight: bold;
    color: #2a5aa0;
    margin-left: 5px;
  }
  
  #left-panel {
    flex: 7;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 450px;
  }
  
  #right-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 280px;
    max-height: none;
    overflow-y: visible;
  }
  
  #board {
    display: grid !important;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    gap: 2px;
    border: 3px solid #777;
    height: 550px !important;
    min-height: 550px !important;
    width: 550px !important;
    min-width: 550px !important;
    background-color: #f7f7e6;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    margin: 0 auto;
  }
  
  .board-and-history-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 20px;
  }
  
  .board-cell {
    background-color: #f8f8e8;
    border: 1px solid #999;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 32px;
    min-height: 32px;
    width: 32px;
    height: 32px;
  }
  
  .board-cell .tile {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    z-index: 2;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .board-cell .tile .point-value {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 10px;
    font-weight: normal;
  }
  
  /* Special tile styles */
  .tw {
    background-color: #ff6666; /* Brighter red for triple word */
    color: black;
  }
  
  .dw {
    background-color: #ffb7b7; /* Pink for double word */
    color: black;
  }
  
  .tl {
    background-color: #6666ff; /* Brighter blue for triple letter */
    color: black;
  }
  
  .dl {
    background-color: #b7b7ff; /* Light blue for double letter */
    color: black;
  }
  
  .center {
    background-color: #ffb7b7; /* Same as double word for center square */
    color: black;
  }
  
  .center-star, .star-symbol {
    position: absolute;
    font-size: 20px;
    color: #333;
    z-index: 2;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .special-text {
    font-size: 9px;
    position: absolute;
    top: 3px;
    left: 3px;
    font-weight: bold;
    pointer-events: none;
    color: rgba(0, 0, 0, 0.8);
    z-index: 1;
  }
  
  /* Drag and drop styles */
  .drag-over {
    background-color: #e0ffe0;
    box-shadow: inset 0 0 5px green;
  }
  
  .suggested {
    background-color: #ffffaa;
    box-shadow: 0 0 10px gold;
  }
  
  .hint-letter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #2a5aa0;
    font-weight: bold;
    opacity: 0.7;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  }
  
  #tile-rack-container {
    margin-top: 15px;
    background-color: #f8f8f8;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  }
  
  #tile-rack-container h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2a5aa0;
    text-align: center;
    font-size: 16px;
  }
  
  #tile-rack {
    display: flex;
    gap: 8px;
    min-height: 60px;
    padding: 15px;
    background-color: #e8e0cf;
    border-radius: 10px;
    border: 2px solid #c9b18a;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  }
  
  .rack-slot {
    width: 42px;
    height: 42px;
    border: 1px dashed #c9b18a;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f5eeda;
    position: relative;
  }
  
  .tile {
    width: 38px;
    height: 38px;
    background-color: #f5deb3;
    border: 1px solid #888;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    user-select: none;
    position: relative;
    cursor: move;
    margin: 0;
    box-shadow: 2px 2px 3px rgba(0,0,0,0.3);
    color: #000;
    font-size: 18px;
  }
  
  .tile.dragging {
    opacity: 0.6;
    z-index: 100;
  }
  
  .tile .point-value {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 10px;
    font-weight: normal;
  }
  
  /* Player-specific tile colors */
  .player-0-tile {
    background-color: #f5deb3; /* Default wheat color for player 0 (human) */
  }
  
  .player-1-tile {
    background-color: #ffcccc; /* Light red for player 1 */
  }
  
  .player-2-tile {
    background-color: #ccffcc; /* Light green for player 2 */
  }
  
  .player-3-tile {
    background-color: #ccccff; /* Light blue for player 3 */
  }
  
  .tile.placed-tile {
    cursor: default;
    box-shadow: 0 0 5px rgba(0, 100, 0, 0.5);
  }
  
  .tile.committed-tile {
    background-color: #d4c89f;
    border: 1px solid #333;
    cursor: not-allowed;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  }
  
  .tile.cpu-tile {
    background-color: #b99c6b;
    color: transparent;
  }
  
  #controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  button {
    padding: 8px 12px;
    background-color: #4a7dbd;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }
  
  button:hover {
    background-color: #3a6da7;
  }
  
  button:disabled {
    background-color: #9fafcb;
    cursor: not-allowed;
  }
  
  .current-player {
    font-weight: bold;
    color: #2a5aa0;
  }
  
  /* Player icon styles */
  .player-icon {
    margin-right: 8px;
    font-size: 14px;
    color: #555;
  }
  
  .current-player-icon {
    color: #2a5aa0;
  }
  
  /* Color indicator for player tiles */
  .color-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #ccc;
  }
  
  /* Scoreboard styling */
  #scoreboard {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
  }
  
  #scoreboard h3 {
    margin-top: 0;
    margin-bottom: 5px;
  }
  
  #scoreList {
    list-style: none;
    padding: 0;
  }
  
  #scoreList li {
    display: flex;
    align-items: center;
    padding: 5px;
    border-bottom: 1px solid #eee;
  }
  
  #chatbot {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background-color: #fafafa;
    height: 200px;
  }
  
  #chat-log {
    flex: 1;
    height: 100px;
    max-height: 100px;
    overflow-y: auto;
    border: 1px solid #aaa;
    padding: 5px;
    background: #fafafa;
    margin-bottom: 5px;
    border-radius: 4px;
  }
  
  #chat-log .bot {
    color: blue;
    font-weight: bold;
  }
  
  #chat-log .player {
    color: green;
  }
  
  /* Thinking indicator */
  #thinking-indicator {
    padding: 8px;
    text-align: center;
    margin-bottom: 8px;
    background-color: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
  }
  
  .thinking-brain {
    font-size: 18px;
    color: #2ecc71; /* Green initially */
    margin-right: 10px;
    animation: pulse-brain 1.5s infinite;
  }
  
  @keyframes pulse-brain {
    0% { transform: scale(0.8); color: #2ecc71; }
    50% { transform: scale(1.2); color: #333333; }
    100% { transform: scale(0.8); color: #2ecc71; }
  }
  
  .thinking-text {
    margin-left: 8px;
    font-size: 14px;
    color: #555;
  }
  
  @keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
  }
  
  /* API Status Indicator */
  .api-status {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    cursor: help;
    margin-right: 10px;
  }
  
  .api-status.connected {
    color: #4CAF50;
  }
  
  .api-status.connecting {
    color: #FFC107;
  }
  
  .api-status.disconnected {
    color: #F44336;
  }
  
  /* Spinner animation for the spinner icon only */
  .fa-spin {
    animation: spin 1.5s infinite linear;
  }
  
  /* Animation for connecting status */
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* API Error Message */
  .api-error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffebee;
    border: 2px solid #f44336;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
  }
  
  .api-error-message p {
    margin: 10px 0;
  }
  
  .api-error-message a {
    color: #2196F3;
    text-decoration: underline;
    font-weight: bold;
  }
  
  .api-error-message a:hover {
    text-decoration: none;
  }
  
  /* API Error Indicator for chat log */
  .api-error-indicator {
    background-color: #ffebee;
    color: #f44336;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
    opacity: 1;
  }
  
  .api-error-indicator i {
    margin-right: 8px;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
  }
  
  .chat-input-container {
    display: flex;
    margin-top: 5px;
    margin-bottom: 10px;
  }
  
  #chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
  }
  
  #sendChatBtn {
    padding: 8px 12px;
    border-radius: 0 4px 4px 0;
    border: none;
    background-color: #4a7dbd;
    color: white;
    cursor: pointer;
  }
  
  #sendChatBtn:hover {
    background-color: #3a6da7;
  }
  
  /* Game-end modal */
  #game-end-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
  }
  
  .modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    max-width: 500px;
    width: 80%;
    text-align: center;
  }
  
  .winner {
    color: #d4af37;
    font-size: 1.5em;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  }
  
  #final-scores, #game-stats {
    margin: 15px 0;
    text-align: left;
  }
  
  #final-score-list {
    list-style-type: none;
    padding-left: 10px;
  }
  
  #final-score-list li {
    margin: 5px 0;
    padding: 3px;
    background-color: #f8f8f8;
    border-radius: 3px;
  }
  
  #new-game-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #4a7dbd;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
  }
  
  #new-game-btn:hover {
    background-color: #3a6da7;
  }
  
  /* Exchange mode */
  .exchange-mode {
    background-color: rgba(255, 235, 205, 0.6);
    border: 2px dashed #d4af37;
    border-radius: 8px;
  }
  
  .selected-for-exchange {
    transform: translateY(-10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 2px solid #f39c12;
  }
  
  /* Button visibility */
  #exchangeBtn, #confirmExchangeBtn, #acceptRecommendationBtn {
    transition: display 0.3s;
  }
  
  #move-history {
    flex: 0 0 auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background-color: #fafafa;
    height: 150px;
    overflow-y: auto;
  }
  
  #move-history h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2a5aa0;
    text-align: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
  }
  
  #move-log {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 5px;
    background-color: #f9f9f9;
    font-size: 12px;
    border-radius: 3px;
  }
  
  .move-entry {
    padding: 5px;
    border-bottom: 1px dotted #ddd;
    line-height: 1.3;
  }
  
  .move-player {
    font-weight: bold;
  }
  
  .scrollable-log {
    overflow-y: auto;
    scrollbar-width: thin;
  }
  
  .scrollable-log::-webkit-scrollbar {
    width: 6px;
  }
  
  .scrollable-log::-webkit-scrollbar-track {
    background: #f1f1f1;
  }
  
  .scrollable-log::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
  }
  
  #denyRecommendationBtn, #acceptRecommendationBtn {
    display: none;
  }
  
  .api-status-tooltip {
    display: none;
    position: absolute;
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 100;
    width: 250px;
    top: 40px;
    left: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  
  .api-status-tooltip a {
    color: #4fc3f7;
    text-decoration: underline;
  }
  
  .api-status-tooltip a:hover {
    text-decoration: none;
  }
  
  h3:hover .api-status-tooltip {
    display: block;
  }
  
  .small-button {
    font-size: 11px;
    padding: 3px 6px;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-top: 5px;
  }
  
  .small-button:hover {
    background-color: #777;
  }
  
  .offline-mode-active {
    background-color: #ff6b6b;
  }
  
  .offline-mode-indicator {
    background-color: #ff6b6b;
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 8px;
  }
  
  /* Start Menu API Status Styles */
  .start-menu-status-container {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  }
  
  .api-status-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }
  
  #start-menu-api-status {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border-radius: 30px;
    font-size: 14px;
    margin: 0 auto 15px auto;
    font-weight: bold;
    background-color: rgba(0,0,0,0.1);
    width: fit-content;
    min-width: 150px;
    animation: none;
  }
  
  /* Icon container to isolate animation */
  .icon-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
  }
  
  /* Ensure the icon always has the same width */
  .icon-container i {
    width: 16px;
    text-align: center;
  }
  
  #start-menu-api-status.connected {
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
  }
  
  #start-menu-api-status.disconnected {
    color: #F44336;
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
  }
  
  #start-menu-api-status.connecting {
    color: #FFC107;
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
  }
  
  #start-menu-api-status .status-text {
    margin-left: 8px;
    animation: none;
  }
  
  .start-menu-message {
    margin-top: 10px;
    padding: 15px;
    border-radius: 8px;
    background-color: #f8f8f8;
    max-width: 500px;
  }
  
  .error-message {
    color: #F44336;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 5px;
    border-radius: 4px;
    background-color: rgba(244, 67, 54, 0.1);
    text-align: center;
  }
  
  .error-message a {
    color: #2196F3;
    text-decoration: underline;
  }
  
  .error-message i {
    margin-right: 5px;
  }
  
  #retry-connection-btn {
    margin-top: 15px;
    padding: 10px 16px;
    font-size: 14px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    align-self: center;
    display: block;
    width: auto;
  }
  
  #retry-connection-btn:hover {
    background-color: #1976D2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  }
  
  /* Disabled Start Button */
  #startGameBtn.disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.7;
    pointer-events: none;
  }
  
  /* Connection log container */
  .connection-log-container {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin: 0;
    height: 300px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
    display: flex;
    flex-direction: column;
  }
  
  #connection-log {
    margin: 0;
    padding: 0;
    list-style-type: none;
    flex: 1;
    overflow-y: auto;
  }
  
  #connection-log li {
    padding: 5px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    border-left: 4px solid #ddd;
    background-color: #f9f9f9;
  }
  
  #connection-log li.error {
    border-left-color: #d32f2f;
    background-color: #ffebee;
  }
  
  #connection-log li.success {
    border-left-color: #388e3c;
    background-color: #e8f5e9;
  }
  
  #connection-log li.info {
    border-left-color: #1976d2;
    background-color: #e3f2fd;
  }
  
  #connection-log .timestamp {
    color: #888;
    margin-right: 5px;
  }
  
  #connection-log .error {
    color: #d32f2f;
  }
  
  #connection-log .success {
    color: #388e3c;
  }
  
  #connection-log .info {
    color: #1976d2;
  }
  
  /* Start Menu Layout */
  .start-menu-layout {
    display: flex;
    flex-direction: row;
    gap: 30px;
    margin-top: 20px;
    justify-content: center;
    align-items: flex-start;
  }
  
  .start-menu-column {
    flex: 1;
  }
  
  .left-column {
    max-width: 400px;
  }
  
  .right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  }
  
  /* Ensure the start menu is responsive */
  @media (max-width: 768px) {
    .start-menu-layout {
      flex-direction: column;
    }
    
    .left-column, .right-column {
      max-width: 100%;
      width: 100%;
    }
  }
  
  #connection-timer {
    margin-top: 10px;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
  }
  
  #connection-timer.info {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
  }
  
  #connection-timer.success {
    background-color: #e8f5e9;
    color: #388e3c;
    border: 1px solid #c8e6c9;
  }
  
  #connection-timer.error {
    background-color: #ffebee;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
  }
  
  /* Connection log container header */
  .connection-log-container h4 {
    margin-top: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
    text-align: center;
    color: #333;
    font-size: 16px;
  }
  
  .special-label {
    position: absolute;
    top: 1px;
    left: 1px;
    font-size: 7px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.7);
    z-index: 1;
  }
  
  .button-warning {
    background-color: #f39c12;
    color: white;
  }
  
  .button-warning:hover {
    background-color: #e67e22;
  }
  
  .offline-mode-indicator {
    background-color: #f39c12;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin: 0 10px;
    display: inline-block;
    animation: pulse-warning 2s infinite;
  }
  
  @keyframes pulse-warning {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
  }
  