* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  color: #111;
  background: #fff;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 22px;
  text-align: center;
}

.sub { color: #333; margin-top: 6px; }

textarea {
  width: 100%;
  max-width: 820px;
  min-height: 120px;
  padding: 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 12px;
  margin: 14px 0;
}

.controls {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.check { display:flex; gap:8px; align-items:center; user-select:none; }

.buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 10px 0 6px;
}

button {
  padding: 10px 14px;
  font-size: 16px;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  background: #111;
  color: #fff;
}

button:disabled { opacity: .55; cursor: not-allowed; }

.msg {
  min-height: 20px;
  color: #b00020;
  margin: 8px 0 0;
}

/* Printable area */
.printArea {
  margin: 18px auto 0;
  padding: 18px;
  border: 1px solid #eee;
  border-radius: 16px;
  max-width: 820px;
  text-align: left;
}

.sheetHeader { display:flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sheetHeader h2 { margin: 0; font-size: 20px; }
.meta { color:#555; font-size: 13px; }

.gridWrap { display:flex; justify-content:center; margin: 12px 0; }

.grid {
  display: grid;
  gap: 3px;
  justify-content: center;
}

.cell {
  width: 32px;
  height: 32px;
  border: 1px solid #111;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
}

.wordListWrap h3 { margin: 8px 0 8px; font-size: 16px; }
.wordList { display:grid; grid-template-columns: repeat(3, 1fr); gap: 6px 18px; font-size: 14px; }

.footer { margin-top: 14px; color:#444; font-size: 12px; text-align:center; }

/* Print styling */
@media print {
  body { background: #fff; }
  .wrap > *:not(#printArea) { display: none !important; }
  #printArea { border: 0; padding: 0; margin: 0; }
  button, textarea, .controls, .msg { display:none !important; }
}
/* =========================
   CLEAN MOBILE LAYOUT
========================= */

* { box-sizing: border-box; }

body { overflow-x: hidden; }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

textarea#words {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  font-size: 16px;
}

.buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 14px 0;
}

.buttons button {
  padding: 10px 14px;
  border-radius: 10px;
}

/* Keep the grid nicely centered */
.gridWrap {
  display: flex;
  justify-content: center;
}

/* Desktop grid sizes can stay as-is */

/* MOBILE */
@media (max-width: 600px) {

  .wrap {
    max-width: 100%;
    padding: 18px 12px;
  }

  /* Buttons become full width and easy to tap */
  .buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .buttons button {
    width: 100%;
    font-size: 16px;
    padding: 12px 14px;
  }

  /* Stop the grid being cut off */
  .gridWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  /* Make the grid fit smaller screens */
  .grid {
    transform-origin: top left;
    transform: scale(0.85);
  }
}

