
/* MN WordSearch Modern Renderer (v1.3.0-dev.15) */

/* Responsive sizing (per puzzle via CSS vars)
   --ptws-cell-size-base, --ptws-letter-size-base set inline by JS
*/
.ptws-modern-root{
  --ptws-cell-size-base: 44px;
  --ptws-letter-size-base: 20px;
  --ptws-cell-size: var(--ptws-cell-size-base);
  --ptws-letter-size: var(--ptws-letter-size-base);
}

/* Small screens: scale down a bit to fit */
@media (max-width: 480px){
  .ptws-modern-root{
    --ptws-cell-size: calc(var(--ptws-cell-size-base) * 0.86);
    --ptws-letter-size: calc(var(--ptws-letter-size-base) * 0.86);
  }
}
/* Medium screens */
@media (min-width: 481px) and (max-width: 768px){
  .ptws-modern-root{
    --ptws-cell-size: calc(var(--ptws-cell-size-base) * 0.93);
    --ptws-letter-size: calc(var(--ptws-letter-size-base) * 0.93);
  }
}
.ptws-modern-root{max-width:100%;overflow:auto}
.ptws-modern-wrap{display:flex;gap:16px;align-items:flex-start}
.ptws-modern-grid{border-collapse:collapse;user-select:none;touch-action:none}
.ptws-modern-grid td{width:32px;height:32px;text-align:center;vertical-align:middle;border:1px solid rgba(255,255,255,0.15);font-weight:700;font-family:inherit;background:var(--ptws-cell-bg, transparent)}
/*
  Selection highlighting
  
  IMPORTANT:
  - We style both the specific modern classes (ptws-modern-cell.*) AND the
    generic state classes (.ptws-selected/.ptws-found) because some themes
    or renderers may change the cell markup.
  - Found highlights must remain clearly visible even after we clear the
    temporary selection state.
*/

/* Found word cells (persist after selection clears) */
.ptws-found,
.ptws-modern-cell.ptws-found{
  background: var(--ptws-solved-color, rgba(50, 205, 50, 0.80)) !important; /* stronger green */
  outline: 3px solid rgba(255,255,255,0.98) !important;
  outline-offset: -3px;
  box-shadow: inset 0 0 0 4px rgba(0,0,0,0.65) !important;
}

/* Currently selected cells (while dragging or click-selecting) */
.ptws-selected,
.ptws-modern-cell.ptws-selected{
  background: rgba(255, 215, 0, 0.85) !important; /* stronger yellow */
  outline: 3px solid rgba(255,255,255,0.95) !important;
  outline-offset: -3px;
  box-shadow: inset 0 0 0 4px rgba(0,0,0,0.65) !important;
}
.ptws-modern-grid .ptws-cell-letter{
  text-transform: uppercase;
  display: inline-block;
  pointer-events: none; /* ensure clicks land on the cell */
  user-select: none;
  -webkit-user-select: none;
}
.ptws-modern-cell{cursor:pointer}
/* (kept above) */
.ptws-modern-wordlist{min-width:180px}
.ptws-modern-wordlist ul{list-style:none;margin:0;padding:0}
.ptws-modern-wordlist li{padding:6px 8px;margin:0 0 6px 0;border:1px solid rgba(255,255,255,0.15);border-radius:6px}
.ptws-modern-wordlist li.ptws-word-found{opacity:0.95;text-decoration:line-through;text-decoration-thickness:2px;text-decoration-skip-ink:none;color:var(--ptws-solved-color, inherit) !important;text-decoration-color:var(--ptws-solved-color, currentColor);}

/* Top/Bottom word list: center + wrap into multiple words per line */
.ptws-modern-top .ptws-modern-wordlist ul,
.ptws-modern-bottom .ptws-modern-wordlist ul{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.ptws-modern-top .ptws-modern-wordlist li,
.ptws-modern-bottom .ptws-modern-wordlist li{margin:0}
.ptws-modern-top{display:block}
.ptws-modern-bottom{display:block}
.ptws-modern-right .ptws-modern-wrap{flex-direction:row}
.ptws-modern-left .ptws-modern-wrap{flex-direction:row-reverse}
/*
  DOM order is: grid then wordlist.
  "Top" should render wordlist above grid => column-reverse.
  "Bottom" should render wordlist below grid => column.
*/
.ptws-modern-top .ptws-modern-wrap{flex-direction:column-reverse}
.ptws-modern-bottom .ptws-modern-wrap{flex-direction:column}
.ptws-modern-banner{margin:8px 0 12px 0;font-weight:600}
.ptws-modern-modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,0.6);display:flex;align-items:center;justify-content:center;z-index:9999}
.ptws-modern-modal{background:#111;border:1px solid rgba(255,255,255,0.15);border-radius:12px;max-width:520px;width:92%;padding:16px}
.ptws-modern-modal .ptws-modern-modal-actions{margin-top:12px;text-align:right}
.ptws-modern-btn{background:rgba(255,255,255,0.12);border:1px solid rgba(255,255,255,0.18);color:inherit;padding:8px 12px;border-radius:10px;cursor:pointer}


/* === MN WordSearch Modern v2 — layout polish (center + wrapped clues) === */

/* Center the whole puzzle area */
.ptws-modern-root{display:flex;justify-content:center}

/* Center grid + clues as a group */
.ptws-modern-wrap{align-items:center;justify-content:center}

/* Center the grid itself */
.ptws-modern-grid{margin-left:auto;margin-right:auto}

/* Word list defaults */
.ptws-modern-wordlist{padding:0;margin:0;list-style:none}

/* Top/Bottom: put clues in rows, centered, wrapping */
.ptws-modern-top .ptws-modern-wordlist,
.ptws-modern-bottom .ptws-modern-wordlist{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  gap:10px;
  min-width:unset;
}

/* Remove the old per-line spacing when using flex-wrap */
.ptws-modern-top .ptws-modern-wordlist li,
.ptws-modern-bottom .ptws-modern-wordlist li{
  margin:0;
}

/* Make clue chips a bit more compact and readable on one line */
.ptws-modern-wordlist li{
  white-space:nowrap;
  text-align:center;
}

/* Left/Right: keep a column list but centered */
.ptws-modern-left .ptws-modern-wordlist,
.ptws-modern-right .ptws-modern-wordlist{
  align-self:center;
}


/* (removed) Word clue styling (match solved word colors) */
.ptws-word-list{
  text-align: center;
}
.ptws-word-list li{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 4px 8px;
}
.ptws-word-found{
  color: var(--ptws-solved-color, inherit) !important;
  text-decoration: line-through;
  text-decoration-color: var(--ptws-solved-color, currentColor);
  text-decoration-thickness: 2px;
  text-decoration-skip-ink: none;
  opacity: 0.95;
}

/* Hint button (one-time) */
.ptws-hint-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  margin: 0 auto 10px auto;
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  font-weight: 600;
}
.ptws-hint-btn:disabled{
  opacity: 0.6;
  cursor: default;
}

/* Hint highlight: subtle pulsing ring around the suggested first letter */
.ptws-modern-cell.ptws-hint{
  position: relative;
  outline: 3px solid rgba(245, 158, 11, 0.9);
  outline-offset: -3px;
}
.ptws-modern-cell.ptws-hint::after{
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid rgba(245, 158, 11, 0.6);
  border-radius: 6px;
  animation: ptwsHintPulse 1.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ptwsHintPulse{
  0%{ transform: scale(1); opacity: 0.6; }
  50%{ transform: scale(1.04); opacity: 0.35; }
  100%{ transform: scale(1); opacity: 0.6; }
}


/* Per-puzzle grid frame (border + shadow) */
.ptws-modern-root.ptws-has-grid-frame .ptws-modern-gridwrap {
  display: inline-block;
  border: 2px solid var(--ptws-grid-border, #111827);
  box-shadow: 0 12px 28px var(--ptws-grid-shadow, rgba(0,0,0,0.35));
  border-radius: 12px;
  overflow: hidden;
  display: inline-block;
}

.ptws-modern-root.ptws-has-grid-frame .ptws-modern-gridwrap td {
  /* Keep inner cells from covering rounded corners */
  background-clip: padding-box;
}

.ptws-modern-gridwrap .ptws-modern-grid{width:100%;}
