/* ===== Base ===== */
body {
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  margin: 0;
  padding: 0;
}

#wrapper {
  max-width: 800px;
  width: 100%;
  margin: 20px auto;
  padding: 16px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  box-sizing: border-box;
}

a {
  text-decoration: none;
  color: #1f6feb;
}
a:hover {
  text-decoration: underline;
}

/* ===== Top links ===== */
#top-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

/* ===== Headings / copy ===== */
h1, h2 {
  margin-bottom: 0.3em;
  text-align: center;
}

p.description {
  font-size: 14px;
  color: #555;
  text-align: center;
  margin-top: 0;
  margin-bottom: 12px;
  line-height: 1.35;
}

#status {
  margin-top: 6px;
  color: #555;
  font-size: 13px;
  text-align: center;
}

#puzzle-meta {
  font-size: 13px;
  color: #777;
  text-align: center;
  margin-bottom: 4px;
}

#progress {
  font-size: 15px;
  font-weight: bold;
  text-align: center;
  margin: 6px 0 10px 0;
}

/* ===== Words ===== */
#words {
  margin-top: 4px;
  font-size: 18px;
  text-align: center;
}

#words .words-title {
  display: block;
  margin-bottom: 4px;
}

#words .words-list {
  display: block;
}

#words span.found-word {
  text-decoration: line-through;
  color: #777;
}

/* ===== Grid ===== */
#grid-container {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  overflow-x: auto;
}

#grid {
  border-collapse: collapse;
  touch-action: none;
}

#grid td {
  width: 32px;
  height: 32px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #333;
  font-size: 20px;
  font-weight: bold;
  user-select: none;
  cursor: pointer;
}

#grid td.preview {
  background-color: #cce5ff;
}

#grid td.found {
  background-color: #90ee90;
  color: #000;
}

/* ===== Archive buttons ===== */
h2.archive-heading {
  text-align: center;
  margin-top: 18px;
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: 520px;
  margin: 0 auto 8px auto;
}

/* Force 4 buttons on row 1, 3 centered on row 2 */
.archive-list button:nth-child(5) { grid-column: 2; }
.archive-list button:nth-child(6) { grid-column: 3; }
.archive-list button:nth-child(7) { grid-column: 4; }

.archive-list button {
  width: 100%;
  font-size: 12px;
  padding: 7px 8px;
  border: 1px solid #cfd6e4;
  border-radius: 10px;
  background: #ffffff;
  color: #1f6feb;
  cursor: pointer;
}

.archive-list button:hover {
  text-decoration: underline;
}

.archive-list button.active {
  background: #e9f2ff;
  border-color: #8bb7ff;
  color: #0b3d91;
  font-weight: bold;
}

/* ===== Mobile tweaks ===== */
@media (max-width: 600px) {
  #wrapper {
    margin: 10px;
    border-radius: 8px;
  }

  #top-links {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  #grid td {
    width: 26px;
    height: 26px;
    font-size: 16px;
  }
}

@media (max-width: 400px) {
  #grid td {
    width: 22px;
    height: 22px;
    font-size: 14px;
  }
}
