:root {
  --ws-navy: #0A265C;
  --ws-text: #1F3349;
  --ws-blue: #e8efff;
  --ws-blue-light: #f6f9ff;
  --ws-pink: #ff77b8;
  --ws-pink-soft: #fff1f8;
  --ws-white: #ffffff;
  --ws-border: #d8e2f7;
  --ws-shadow: 0 10px 24px rgba(10, 38, 92, 0.11);
  --ws-radius: 18px;
  --ws-letter-size: 1.3rem;
  --ws-cell-gap: 2px;
}

* { box-sizing: border-box; }

body {
  background: linear-gradient(180deg, #eef4ff 0%, #ffffff 54%);
  color: var(--ws-text);
}

button { margin: 0em; }

aside { margin: 0em 0em 0em 1em; padding: 0em; }

.ws-page {
  width: min(950px, calc(100% - 0px));
  margin: 0 auto;
  padding: 18px 0 48px;
  font-family: "Open Sans", Arial, sans-serif;
  border.: 1px solid gray;
}

.ws-intro {
  margin: 0 0 12px;
}

.ws-intro h1 {
  margin: 0 0 8px;
  color: var(--ws-navy);
  font-size: 1.4em;
  line-height: 1.12;
}

.ws-intro p {
  max-width: 920px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
}

.ws-controls {
  display: grid;
  grid-template-columns: 1.35fr 1fr 0.8fr;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
}

.ws-control-group,
.ws-comfort {
  min-width: 0;
  background: var(--ws-white);
  border: 1px solid var(--ws-border);
  border-radius: 15px;
  padding: 11px 12px;
  box-shadow: 0 5px 14px rgba(10, 38, 92, 0.07);
}

.ws-control-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ws-navy);
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ws-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.ws-control-group:nth-child(2) .ws-segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ws-segmented button,
.ws-size-buttons button,
.ws-action,
.ws-reset-comfort {
  border: 1px solid #aac1ef;
  border-radius: 10px;
  background: #fff;
  color: var(--ws-navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ws-segmented button {
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.88rem;
  white-space: nowrap;
}

.ws-segmented button:hover,
.ws-size-buttons button:hover,
.ws-action:hover,
.ws-reset-comfort:hover {
  border-color: var(--ws-pink);
}

.ws-segmented button.is-active,
.ws-size-buttons button.is-active,
.ws-action-primary {
  border-color: var(--ws-pink);
  background: var(--ws-pink);
  color: #fff;
}

.ws-comfort {
  position: relative;
  padding: 0;
  display.: none;
}

.ws-comfort summary {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px;
  color: var(--ws-navy);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  text-align: center;
}

.ws-comfort summary::-webkit-details-marker { display: none; }
.ws-comfort summary::after { content: "⚙"; font-size: 1.5em; }
.ws-comfort[open] summary::after { content: "×"; }

.ws-aa {
  color: var(--ws-pink);
  font-size: 1.2rem;
}

.ws-comfort-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  padding: 14px;
  border: 1px solid var(--ws-border);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--ws-shadow);
}

.ws-comfort-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.ws-comfort-row > span {
  color: var(--ws-navy);
  font-weight: 700;
  font-size: 0.9rem;
}

.ws-size-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ws-size-buttons button {
  width: 34px;
  height: 34px;
  padding: 0;
}

.ws-size-a-small { font-size: 0.82rem !important; }
.ws-size-a-medium { font-size: 1rem !important; }
.ws-size-a-large { font-size: 1.18rem !important; }

.ws-segmented-small {
  grid-template-columns: repeat(2, minmax(76px, 1fr));
}

.ws-segmented-small button {
  min-height: 34px;
  padding: 5px 8px;
}

.ws-reset-comfort {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
}

.ws-game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.63fr) minmax(260px, 0.87fr);
  gap: 12px;
  align-items: stretch;
}

.ws-grid-card,
.ws-side-card {
  background: var(--ws-white);
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius);
  box-shadow: var(--ws-shadow);
}

.ws-grid-card {
  padding: 14px;
  min-width: 0;
}

.ws-side-card {
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.ws-grid-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.ws-kicker {
  display: block;
  color: #6c7e94;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ws-grid-heading h2 {
  margin: 2px 0 0;
  color: var(--ws-navy);
  font-size: 1.16rem;
}

.ws-progress {
  flex: 0 0 auto;
  margin-top: 3px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--ws-pink-soft);
  color: var(--ws-navy);
  font-size: 0.78rem;
  font-weight: 700;
}

.ws-instruction {
  margin: 0 0 8px;
  color: #63768e;
  font-size: 1em;
  line-height: 1.35;
}

.ws-grid {
  --grid-count: 13;
  /* Each cell is sized from the letter size, and the whole grid grows or
     shrinks with the number of columns, so the gap between letters stays
     at --ws-cell-gap no matter how many columns the puzzle has. */
  --ws-cell-size: calc(var(--ws-letter-size) * 2.5);
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--grid-count), minmax(0, 1fr));
  gap: var(--ws-cell-gap); 
  width: min(100%, calc(var(--grid-count) * var(--ws-cell-size) + (var(--grid-count) - 1) * var(--ws-cell-gap)));
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ws-cell {
  min-width: 0;
  margin: 0em; 
  aspect-ratio: 1 / 0.85;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #101820;
  font: 700 var(--ws-letter-size)/1 "Open Sans", Arial, sans-serif;
  cursor: pointer;
  touch-action: none;
}

/* Fat rounded lines that cross out found words. The layer sits under the
   letters (cells are positioned and come later in the DOM). */
.ws-line-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ws-found-line {
  stroke: var(--ws-pink);
  stroke-opacity: 0.3;
}

.ws-cell:hover { background: rgba(226, 236, 255, 0.6); }
.ws-cell.is-preview { background: rgba(255, 119, 184, 0.26); }
.ws-cell.is-anchor { box-shadow: inset 0 0 0 2px #6b8fd8; }
.ws-cell.is-found { background: transparent; }

/* When every word is found, the remaining letters that spell the hidden
   message light up in blue so the message can be read in the grid. */
.ws-cell.is-message {
  background: var(--ws-blue);
  color: var(--ws-navy);
}

.ws-cell.is-hint { animation: wsHintPulse 0.85s ease 2; }

@keyframes wsHintPulse {
  0%,100% { box-shadow: none; }
  50% { box-shadow: inset 0 0 0 3px var(--ws-pink); background: var(--ws-pink-soft); }
}

.ws-status {
  min-height: 30px;
  margin-top: 5px;
  color: var(--ws-navy);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.ws-word-section,
.ws-message-section {
  padding: 14px 16px;
}

.ws-word-section h2,
.ws-message-section h2 {
  margin: 0 0 10px;
  color: var(--ws-navy);
  font-size: 1.2em;
  font-weight: 700;
  text-align: center;
}

.ws-word-section h2::after,
.ws-message-section h2::after {
  content: "";
  display: block;
  width: 34px;
  height: 2px;
  margin: 6px auto 0;
  border-radius: 999px;
  background: var(--ws-pink);
}

.ws-word-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ws-word-list li {
  min-width: 0;
  padding: 5px 4px;
  border-bottom: 1px solid #edf1f8;
  color: var(--ws-navy);
  font-size: 1.1em;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ws-word-list li::before {
  content: "○";
  margin-right: 6px;
  color: #8ca7d8;
}

.ws-word-list li.is-found {
  color: #7b8795;
  text-decoration: line-through;
}

.ws-word-list li.is-found::before {
  content: "✓";
  color: var(--ws-pink);
  text-decoration: none;
}

.ws-message-section {
  border-top: 1px solid var(--ws-border);
  background: var(--ws-blue-light);
}

.ws-message-note {
  margin: -2px 0 10px;
  color: #697b91;
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
}

.ws-hidden-message {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px 14px;
  color: var(--ws-navy);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-align: center;
}

.ws-message-word {
  white-space: nowrap;
}

.ws-hidden-message.is-revealed {
  color: var(--ws-navy);
  letter-spacing: 0.03em;
  font-size: 1.05rem;
}

.ws-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 11px;
}

.ws-action {
  min-height: 40px;
  padding: 7px 6px;
  font-size: 1em;
}

.ws-action:hover { transform: translateY(-1px); color: white; }

.ws-feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 11px;
  border: 1px solid var(--ws-border);
  border-radius: 14px;
  background: var(--ws-blue-light);
  overflow: hidden;
}

.ws-feature-strip div {
  padding: 10px 14px;
  border-right: 1px solid var(--ws-border);
}

.ws-feature-strip div:last-child { border-right: 0; }
.ws-feature-strip strong { display: block; color: var(--ws-navy); font-size: 0.85rem; }
.ws-feature-strip span { display: block; margin-top: 2px; color: #65778d; font-size: 0.78rem; line-height: 1.35; }

.ws-seo-text {
  max-width: 900px;
  margin-top: 50px;
  line-height: 1.72;
  padding: 5px 10px;
}

.ws-seo-text h2, .ws-seo-text h3 { color: var(--ws-navy); }
.ws-seo-text h2 { font-size: 1.5rem; margin-top: 24px; }
.ws-seo-text h3 { margin-top: 2px; font-size: 1.22rem; }

.ws-grid.spacing-wide { --ws-cell-gap: 6px; }
.ws-grid.letters-1 { --ws-letter-size: 1.15rem; }
.ws-grid.letters-2 { --ws-letter-size: 1.3rem; }
.ws-grid.letters-3 { --ws-letter-size: 1.45rem; }

@media (max-width: 920px) {
  .ws-page { width: min(100% - 6px, 1120px); }
  .ws-controls { grid-template-columns: 1.3fr 1fr; }
  .ws-comfort { grid-column: 1 / -1; }
  .ws-comfort summary { min-height: 46px; }
  .ws-comfort-panel { width: min(360px, calc(100vw - 40px)); }
  .ws-game-shell { grid-template-columns: minmax(0, 1.45fr) minmax(235px, 0.75fr); }
  .ws-grid-card { padding: 12px; }
  .ws-word-section, .ws-message-section { padding: 12px; }
  .ws-word-list { gap: 3px 7px; }
  .ws-word-list li { font-size: 0.8em; }
}

@media (max-width: 720px) {
  .ws-controls { grid-template-columns: 1fr; }
  .ws-comfort { grid-column: auto; }
  .ws-comfort-panel { position: static; width: auto; border: 0; border-top: 1px solid var(--ws-border); border-radius: 0 0 15px 15px; box-shadow: none; }

  .ws-game-shell { grid-template-columns: 1fr; }

  /* On tablets and narrow laptops, place the full word list below the grid
     and the hidden message below the word list. */
  .ws-side-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    max-width: 95%;
  }

  .ws-word-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px 12px;
  }

  .ws-word-list li {
    font-size: 0.88rem;
    overflow-wrap: normal;
    word-break: normal;
    white-space: nowrap;
  }

  .ws-message-section {
    border-left: 0;
    border-top: 1px solid var(--ws-border);
  }

  .ws-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-feature-strip { grid-template-columns: 1fr; }
  .ws-feature-strip div { border-right: 0; border-bottom: 1px solid var(--ws-border); }
  .ws-feature-strip div:last-child { border-bottom: 0; }
}

@media (max-width: 520px) {
  .ws-page { width: min(100% - 12px, 1120px); padding-top: 12px; }
  .ws-intro h1 { font-size: 1.65rem; }
  .ws-intro p { font-size: 0.92rem; }
  .ws-control-group { padding: 10px; }
  .ws-segmented button { font-size: 0.78rem; padding: 6px 4px; }
  .ws-grid-card { padding: 9px; }
  .ws-grid-heading { align-items: center; }
  .ws-kicker { display: none; }
  .ws-grid-heading h2 { font-size: 1rem; }
  .ws-instruction { font-size: 1em; }
  .ws-grid { --ws-cell-gap: 1px; }
  .ws-grid.spacing-wide { --ws-cell-gap: 3px; }
  .ws-cell { border-radius: 4px; }
  .ws-grid.letters-1 { --ws-letter-size: 0.9rem; }
  .ws-grid.letters-2 { --ws-letter-size: 1rem; }
  .ws-grid.letters-3 { --ws-letter-size: 1.1rem; }
  .ws-side-card { grid-template-columns: 1fr; }

  /* Two readable columns on phones; keep each word on one line. */
  .ws-word-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
  }

  .ws-word-list li {
    font-size: 0.82rem;
    padding: 5px 2px;
    overflow-wrap: normal;
    word-break: normal;
    white-space: nowrap;
  }

  .ws-word-list li::before {
    display: inline;
    margin-right: 4px;
  }

  .ws-message-section {
    border-left: 0;
    border-top: 1px solid var(--ws-border);
  }
}
