* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "nyt-cheltenham", "Georgia", serif;
  background: #faf8f5;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  width: 100%;
  max-width: 600px;
  padding: 16px 16px 4px;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

#datePicker {
  font-family: inherit;
  font-size: 1rem;
  color: #555;
  background: white;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

#datePicker:focus {
  outline: none;
  border-color: #5ba4cf;
}

.loading {
  display: block;
  padding: 60px 20px;
  text-align: center;
  font-size: 1.1rem;
  color: #888;
  font-style: italic;
}

.theme-banner {
  margin: 6px auto;
  max-width: 360px;
  text-align: center;
}

.theme-label {
  display: inline-block;
  background: #d4eef7;
  color: #1a6b8a;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 4px 16px;
  border-radius: 3px 3px 0 0;
}

.theme-text {
  border: 1.5px solid #d4eef7;
  border-top: none;
  padding: 10px 24px;
  font-size: 1.15rem;
  font-weight: 500;
  border-radius: 0 0 6px 6px;
  background: white;
}

.progress-stats {
  text-align: center;
  margin: 4px 0 0;
}

.progress-stats .progress {
  margin: 0;
}

.progress-stats .progress + .progress {
  margin-top: 2px;
}

.progress {
  text-align: center;
  font-size: 0.85rem;
  color: #555;
  margin: 4px 0 0;
}

.progress strong {
  color: #1a1a1a;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #1a1a1a;
  color: white;
}

.btn-primary:hover {
  background: #333;
}

.btn-secondary {
  background: #e8e8e8;
  color: #333;
}

.btn-secondary:hover {
  background: #ddd;
}

.btn-clear {
  background: #fff3f3;
  color: #c0392b;
  border: 1px solid #f0d0d0;
}

.btn-clear:hover {
  background: #fde8e8;
}

/* Grid */
.game-area {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 32px;
  width: 100%;
  max-width: 600px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  width: 100%;
  max-width: 380px;
}

.toolbar .btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.current-word {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #1a1a1a;
  min-height: 32px;
  margin: 2px 0;
}

.grid-container {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

canvas#pathCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
}

.grid {
  display: grid;
  gap: 0;
  position: relative;
  z-index: 1;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Inter", "Arial Black", "Helvetica Neue", sans-serif;
  font-weight: 900;
  cursor: pointer;
  position: relative;
  transition: background 0.12s, transform 0.1s;
  border-radius: 4px;
  z-index: 3;
}

.cell:hover {
  background: rgba(0,0,0,0.04);
}

/* Found words */
.found-words {
  margin-top: 16px;
  width: 100%;
  max-width: 380px;
}

.found-words h3 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 8px;
}

.found-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.found-tag {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.5px;
}

.site-footer {
  width: 100%;
  max-width: 600px;
  padding: 20px 16px 28px;
  margin-top: auto;
  text-align: center;
}

.site-footer p {
  font-size: 0.72rem;
  color: #999;
  line-height: 1.5;
}

.site-footer em {
  font-style: normal;
  color: #888;
}

@media (max-width: 500px) {
  header {
    padding: 10px 12px 2px;
  }
  header h1 {
    font-size: 1.4rem;
    margin-bottom: 2px;
  }
  #datePicker {
    font-size: 0.85rem;
    padding: 4px 10px;
    padding-right: 28px;
  }
  .theme-banner {
    margin: 4px auto;
  }
  .theme-label {
    font-size: 0.55rem;
    padding: 2px 10px;
  }
  .theme-text {
    font-size: 0.85rem;
    padding: 5px 14px;
  }
  .progress {
    font-size: 0.75rem;
    margin: 2px 0 0;
  }
  .current-word {
    min-height: 22px;
    font-size: 0.95rem;
    margin: 1px 0;
  }
  .game-area {
    padding: 0 8px 16px;
  }
  .toolbar {
    margin: 6px 0;
    max-width: 300px;
  }
  .toolbar .btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
  .found-words {
    margin-top: 8px;
    max-width: 300px;
  }
  .found-words h3 {
    font-size: 0.75rem;
  }
  .site-footer {
    padding: 12px 12px 20px;
  }
  .site-footer p {
    font-size: 0.65rem;
  }
}
