body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}
.container {
  background: #fff;
  margin-top: 10px;
  padding: 14px 6px;
  border-radius: 10px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.keyword-row, .input-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2px;
}
.box {
  width: 30px;
  height: 30px;
  border: 2px solid #bbb;
  border-radius: 6px;
  margin: 0 1px;
  font-size: 1.1rem;
  text-align: center;
  background: #f9f9f9;
  outline: none;
  transition: border 0.2s;
}
.box[readonly] {
  background: #e0e0e0;
  border-color: #888;
  color: #333;
}
.btn {
  padding: 12px 32px;
  font-size: 1.1rem;
  border: none;
  border-radius: 6px;
  background: #0078d7;
  color: #fff;
  cursor: pointer;
  margin: 2px 0;
  transition: background 0.2s;
}
.btn:disabled {
  background: #bbb;
  cursor: not-allowed;
}
.score {
  font-size: 1.2rem;
  margin-top: 8px;
  color: #0078d7;
  font-weight: bold;
}
.toggle-container {
  width: 100%;
  max-width: 340px;
  background: #f7faff;
  border-radius: 10px;
  border: 2px solid #cce0f7;
  margin-bottom: 4px;
  padding: 8px 4px 6px 4px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0;
  gap: 2px;
  padding: 2px 0;
  flex-wrap: wrap;
}
.toggle-separator {
  width: 100%;
  height: 1px;
  background: #cce0f7;
  margin: 0 0 0 0;
}
.toggle-label {
  font-weight: bold;
  flex: 0 0 110px;
  text-align: left;
  min-width: 100px;
  margin-right: 2px;
  white-space: nowrap;
}
.toggle-btn {
  flex: 1 1 0;
  min-width: 28px;
  max-width: 36px;
  padding: 4px 0;
  margin: 0 1px;
  border: 1px solid #bbb;
  border-radius: 5px;
  background: #f4f4f4;
  color: #333;
  font-size: .95rem;
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
  box-sizing: border-box;
}
.toggle-btn.selected {
  background: #0078d7;
  color: #fff;
  border-color: #0078d7;
}
.anchor-word-box {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  background: #f9f9fb;
  border-radius: 8px;
  border: 1.5px solid #cce0f7;
  margin-bottom: 6px;
  padding: 6px 6px 4px 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: auto;
  margin-right: auto;
}
.anchor-label {
  font-weight: bold;
  color: #0078d7;
  font-size: 1.08em;
  margin-bottom: 2px;
  margin-left: 2px;
}
.anchor-separator {
  width: 100%;
  height: 1px;
  background: #cce0f7;
  margin: 0 0 6px 0;
  border-radius: 2px;
}
#keywordRow {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  width: auto;
}
.box-wrapper {
  position: relative;
  display: inline-block;
}
.letter-score {
  position: absolute;
  right: 7px;
  bottom: 2px;
  font-size: 0.65em;     
  font-weight: bold;     
  color: #888;
  pointer-events: none;
  background: transparent;
}
.score {
  font-size: 1rem;
  margin-top: 8px;
  color: #0078d7;
  font-weight: bold;
  text-align: center;
}
.multiplier-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffb300;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1em;
  margin-right: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.status-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  font-size: 1.5em;
}
.status-icon.valid {
  color: #2ecc40;
}
.status-icon.invalid {
  color: #ff4136;
}
@media (max-width: 500px) {
  .container { max-width: 98vw; padding: 12px 2vw; }
  .box { width: 26px; height: 26px; font-size: 1rem; }
}
.button-row .btn {
  flex: 1 1 0;
  padding: 10px 6px;
  min-width: 110px;
  white-space: nowrap;
}
.input-row {
  border-bottom: 1px dashed #7ca7d7;
  padding-bottom: 2px;
  margin-bottom: 4px;
}
.input-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
/* Responsive adjustments */
@media (max-width: 600px) {
  .toggle-container {
    flex-direction: column;
    align-items: center;
  }
  .toggle-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .toggle-label {
    margin-bottom: 4px;
  }
  .toggle-btn {
    margin: 2px 0;
  }
}
footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100vw;
  text-align: center;
  font-size: 0.6em;
  color: #666;
  background: #fff;
  padding: 6px 0;
  z-index: 100;
  box-shadow: 0 -1px 8px rgba(0,0,0,0.04);
}

#closeMenuBtn {
    position: absolute;
    top: 2px;           /* Move the button up */
    right: 12px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 50%;
    font-size: 1.3em;
    color: #1976d2;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
    transition: background 0.2s;
    z-index: 101;
}

#closeMenuBtn:hover {
    background: #bbdefb;
}

/* Add more space between the close button and the first menu button */
#collapsibleMenu {
    display: none;
    position: fixed;
    left: 50%;
    top: 60px; /* adjust as needed to appear below your menu button */
    transform: translateX(-50%);
    background: #f7faff;
    border: 1.5px solid #cce0f7;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    padding: 40px 10px 12px 10px;
    z-index: 1000;
    min-width: 280px;
    width: 280px;
}

.active-row {
    background: #e3f2fd;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
    transition: background 0.2s;
}

.share-btn {
    width: 100%;
    margin-top: 12px;
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 0;
    transition: background 0.2s;
}

.share-btn:hover {
    background: #bbdefb;
}

body.dark-mode {
    background: #181a1b;
    color: #e0e0e0;
}
body.dark-mode .container,
body.dark-mode .modal-content,
body.dark-mode #collapsibleMenu {
    background: #23272a;
    color: #e0e0e0;
}
body.dark-mode input.box {
    background: #222;
    color: #e0e0e0;
    border-color: #444;
}
body.dark-mode .btn {
    background: #e3f2fd;
    color: #1976d2;
    border: 1.5px solid #90caf9;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
    transition: background 0.2s;
}
body.dark-mode .btn:hover {
    background: #bbdefb;
}
body.dark-mode .active-row {
    background: #e3f2fd; /* much lighter for contrast */
    color: #222b3a;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
    transition: background 0.2s;
}
/* Dark mode: Buttons */
body.dark-mode .btn,
body.dark-mode button,
body.dark-mode .share-btn {
    background: #e3f2fd;
    color: #1976d2;
    border: 1.5px solid #90caf9;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
    transition: background 0.2s;
}

body.dark-mode .btn:hover,
body.dark-mode button:hover,
body.dark-mode .share-btn:hover {
    background: #bbdefb;
}

/* Dark mode: Modal content (score modal, options, help, daily scores, best scores, feedback) */
body.dark-mode #newHighScoreModal > div,
body.dark-mode #optionsModal > div,
body.dark-mode #helpModal > div,
body.dark-mode #dailyScoresModal > div,
body.dark-mode #bestScoresModal > div,
body.dark-mode #feedbackModal > div {
    background: #23272a !important;
    color: #f3f6fa !important;
    border: 1.5px solid #90caf9;
}

/* Dark mode: Modal content for Best Scores and Daily Challenge Scores */
body.dark-mode #highScoresModal > div,
body.dark-mode #dailyHistoryModal > div {
    background: #23272a !important;
    color: #f3f6fa !important;
    border: 1.5px solid #90caf9;
}

/* Dark mode: Modal content for existing modals */
body.dark-mode #highScoresModal > div,
body.dark-mode #dailyHistoryModal > div,
body.dark-mode #newHighScoreModal > div,
body.dark-mode #optionsModal > div,
body.dark-mode #helpModal > div,
body.dark-mode #feedbackModal > div {
    background: #23272a !important;
    color: #f3f6fa !important;
    border: 1.5px solid #90caf9;
}

/* Modal headings: slightly brighter for contrast */
body.dark-mode #highScoresModal h2,
body.dark-mode #dailyHistoryModal h2,
body.dark-mode #newHighScoreModal h2,
body.dark-mode #optionsModal h2,
body.dark-mode #helpModal h2,
body.dark-mode #feedbackModal h2 {
    color: #e3f2fd !important;
}

/* Tables and content inside these modals */
body.dark-mode #highScoresModal table,
body.dark-mode #dailyHistoryModal table {
    border: 1.5px solid #90caf9;
    color: #f3f6fa;
    background: #23272a;
}

body.dark-mode #highScoresModal td,
body.dark-mode #dailyHistoryModal td {
    border: 1px solid #90caf9;
    color: #f3f6fa;
    background: #23272a;
}

body.dark-mode #highScoresModal th,
body.dark-mode #dailyHistoryModal th {
    color: #222b3a !important;
    background: #e3f2fd !important;
    border: 1px solid #90caf9;
}

/* Modal close button: keep it visible */
body.dark-mode #closeMenuBtn,
body.dark-mode #closeOptions,
body.dark-mode #closeHelp {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

/* Dark mode: Tip text in help modal lighter for readability */
body.dark-mode #helpModal p {
    color: #f3f6fa !important;
}

#clearHighScores {
    height: 44px;
    font-size: 1.08em;
    padding: 10px 32px;
}

body.dark-mode .toggle-label {
    color: #1976d2 !important;
}

/* Prevent blinking cursor and outline on non-input elements */
body, .container, .modal-content, #collapsibleMenu, #highScoresModal, #dailyHistoryModal,
#newHighScoreModal, #optionsModal, #helpModal, #feedbackModal, button, .btn, .toggle-btn, .anchor-word-box {
    user-select: none;
    outline: none;
    caret-color: transparent;
}

/* Allow caret and selection only in input boxes */
input.box, textarea, input[type="text"], input[type="search"], input[type="email"], input[type="password"] {
    user-select: text;
    caret-color: auto;
    outline: auto;
}
