/* Fall Crosswords — scoped to #crossword (screen) and #print-crossword (print sheet) */
#crossword{--xw-easy:#4fae5c;--xw-medium:#e8a40c;--xw-hard:#d9472b;--xw-cell:#fff4dc;--xw-ink:#1c1410;--xw-hl:#ffcf8f;--xw-cur:#f28a2e;--xw-edge:#3a2618}

/* picker */
#crossword .xw-key{font-weight:700;letter-spacing:.04em;text-transform:none;margin-left:10px;white-space:nowrap}
#crossword .xw-key i{display:inline-block;width:10px;height:10px;border-radius:50%;margin:0 4px 0 8px;vertical-align:0}
#crossword .lv-easy{--lv:var(--xw-easy)} #crossword .lv-medium{--lv:var(--xw-medium)} #crossword .lv-hard{--lv:var(--xw-hard)}
#crossword .xw-key i,#crossword .xw-pick .dot{background:var(--lv)}
#crossword .xw-pick{display:inline-flex;align-items:center;gap:6px;border-color:var(--lv)}
#crossword .xw-pick .dot{width:10px;height:10px;border-radius:50%;flex:0 0 auto}
#crossword .xw-pick .ok{display:none;font-weight:900;color:var(--xw-easy)}
#crossword .xw-pick.done .ok{display:inline}
#crossword .xw-pick.on{background:var(--lv);border-color:var(--lv);color:#fff}
#crossword .xw-pick.on .dot{background:#fff}
#crossword .xw-pick.on .ok{color:#fff}

#crossword .xw-head{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:14px 0 0}
#crossword .xw-head h3{font-family:'Lilita One',cursive;font-weight:400;font-size:1.6rem;margin:0;line-height:1.15}
#crossword .xw-badge{font-size:.75rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase;padding:.3em .8em;border-radius:999px;background:var(--lv);color:#fff}

/* layout: clues beside on desktop, below on phones */
#crossword .xw-main{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:24px;align-items:start;margin-top:6px}
#crossword .xw-play{min-width:0}
#crossword .xw-cluebar{min-height:2.8em;background:var(--bg-2);border:1px solid var(--line);border-left:5px solid var(--primary);border-radius:12px;padding:.5em .8em;font-weight:700;line-height:1.35;margin-bottom:10px;color:var(--ink)}
#crossword .xw-cluebar b{color:var(--accent);margin-right:.35em;white-space:nowrap}
#crossword .xw-cluebar i,#crossword .xw-list i{font-style:normal;color:var(--muted);font-weight:600}

/* grid */
#crossword .xw-board{position:relative;width:100%;display:flex;justify-content:center}
#crossword .xw-grid{--cs:40px;display:grid;gap:1px;padding:1px;user-select:none;-webkit-user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent;position:relative}
#crossword .xw-grid>div{width:var(--cs);height:var(--cs)}
#crossword .xw-grid .c{position:relative;background:var(--xw-cell);color:var(--xw-ink);box-shadow:0 0 0 1px var(--xw-edge);cursor:pointer;display:flex;align-items:center;justify-content:center;font-family:var(--body);font-weight:900;line-height:1;transition:background-color .12s}
#crossword .xw-grid .c .n{position:absolute;top:1px;left:2px;font-size:max(9px,calc(var(--cs) * .27));font-weight:800;color:#6b4a2f;line-height:1}
#crossword .xw-grid .c .l{padding-top:calc(var(--cs) * .12)}
#crossword .xw-grid .c.hl{background:var(--xw-hl)}
#crossword .xw-grid .c.cur{background:var(--xw-cur)}
#crossword.typing .xw-grid .c.cur{box-shadow:0 0 0 1px var(--xw-edge),inset 0 0 0 2px #7a2f00}
#crossword .xw-grid .c.bad .l{color:#c4161c}
#crossword .xw-grid .c.bad{background-image:linear-gradient(to top right,transparent 46%,rgba(196,22,28,.55) 48%,rgba(196,22,28,.55) 52%,transparent 54%)}
#crossword .xw-grid .c.rv .l{color:#1b5fa8}
#crossword .xw-grid .c.rv::after{content:"";position:absolute;right:2px;top:2px;border:4px solid transparent;border-top-color:#1b5fa8;border-right-color:#1b5fa8}
#crossword .xw-grid.solved .c{background:#cdeec0;animation:xw-pop .5s ease both}
#crossword .xw-grid.solved .c:nth-child(3n){animation-delay:.08s}
#crossword .xw-grid.solved .c:nth-child(3n+1){animation-delay:.16s}
@keyframes xw-pop{0%{transform:scale(1)}40%{transform:scale(1.18)}100%{transform:scale(1)}}
@media (prefers-reduced-motion:reduce){#crossword .xw-grid.solved .c{animation:none}}

/* one hidden input rides on top of the active square so phone keyboards work */
#crossword .xw-input{position:absolute;left:0;top:0;width:40px;height:40px;margin:0;padding:0;border:0;outline:0;opacity:0;background:transparent;color:transparent;caret-color:transparent;font-size:16px;z-index:2;pointer-events:none;text-transform:uppercase}

#crossword .xw-msg{min-height:1.5em;margin:12px 0 0;font-weight:800;color:var(--accent);text-align:center}
#crossword .actions{justify-content:center}

/* clue lists */
#crossword .xw-clues{display:grid;gap:16px}
#crossword .xw-list{position:relative;max-height:340px;overflow:auto;background:var(--bg-2);border:1px solid var(--line);border-radius:14px;padding:4px 6px 8px;scrollbar-width:thin}
#crossword .xw-list h4{position:sticky;top:-4px;margin:0 -6px;padding:8px 12px 6px;background:var(--bg-2);font-family:'Lilita One',cursive;font-weight:400;font-size:1.15rem;letter-spacing:.02em;color:var(--accent);z-index:1}
#crossword .xw-list ol{list-style:none;margin:0;padding:0}
#crossword .xw-list li{display:flex;gap:8px;padding:6px 8px;border-radius:9px;cursor:pointer;line-height:1.35;font-size:.95rem;color:var(--ink-2);border-left:4px solid transparent}
#crossword .xw-list li b{min-width:1.5em;text-align:right;color:var(--ink);flex:0 0 auto}
#crossword .xw-list li:hover{background:rgba(255,255,255,.05)}
#crossword .xw-list li.cross{border-left-color:var(--line)}
#crossword .xw-list li.on{background:var(--primary);color:#fff;border-left-color:var(--accent)}
#crossword .xw-list li.on b,#crossword .xw-list li.on i{color:#fff}
#crossword .xw-list li:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}

@media (max-width:820px){
  #crossword .xw-main{grid-template-columns:1fr}
  #crossword .xw-clues{grid-template-columns:1fr 1fr}
  #crossword .xw-list{max-height:none}
}
@media (max-width:560px){
  #crossword .xw-clues{grid-template-columns:1fr}
  #crossword .xw-cluebar{position:sticky;top:0;z-index:5;box-shadow:0 6px 14px rgba(0,0,0,.25)}
  #crossword .xw-head h3{font-size:1.35rem}
  #crossword .actions .btn{flex:1 1 auto;justify-content:center}
  #crossword{padding-left:12px;padding-right:12px}
}

/* ---------- print ---------- */
#print-crossword{display:none}
@media print{
  @page{size:letter portrait;margin:.4in}
  body.printing-crossword>*:not(#print-crossword){display:none!important}
  body.printing-crossword{background:#fff!important;color:#000!important}
  body.printing-crossword #print-crossword{display:block;color:#000;font-family:Nunito,Arial,sans-serif}
  #print-crossword .xwp-page{height:9.95in;display:flex;flex-direction:column;page-break-after:always;break-after:page;overflow:hidden}
  #print-crossword .xwp-page:last-child{page-break-after:auto;break-after:auto}
  #print-crossword .xwp-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16pt;border-bottom:2px solid #000;padding-bottom:6pt}
  #print-crossword .xwp-k{font-size:10pt;font-weight:800;letter-spacing:.12em;text-transform:uppercase}
  #print-crossword h1{font-family:'Lilita One',Arial Black,sans-serif;font-weight:400;font-size:26pt;line-height:1.1;margin:2pt 0 0;color:#000}
  #print-crossword .xwp-name{font-size:13pt;font-weight:700;white-space:nowrap}
  #print-crossword .xwp-body{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;gap:14pt;padding-top:14pt;min-height:0}
  #print-crossword .xwp-grid{position:relative;flex:0 0 auto}
  #print-crossword .xwp-c{position:absolute;box-sizing:border-box;border:1.5px solid #000;background:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;line-height:1}
  #print-crossword .xwp-c .n{position:absolute;top:1.5pt;left:2pt;font-weight:700;line-height:1}
  #print-crossword .xwp-c .l{padding-top:12%}
  #print-crossword .xwp-clues{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:18pt;font-size:10.5pt;line-height:1.3}
  #print-crossword .xwp-clues h3{font-family:'Lilita One',Arial Black,sans-serif;font-weight:400;font-size:14pt;margin:0 0 4pt;border-bottom:1px solid #000}
  #print-crossword .xwp-clues ol{list-style:none;margin:0;padding:0}
  #print-crossword .xwp-clues li{margin:0 0 3pt;padding-left:1.9em;text-indent:-1.9em;break-inside:avoid}
  #print-crossword .xwp-clues li b{display:inline-block;width:1.5em;text-indent:0;text-align:right;margin-right:.4em}
  #print-crossword .xwp-clues i{font-style:normal;color:#444}
  #print-crossword .xwp-foot{position:relative;flex:0 0 auto;display:flex;align-items:center;gap:14pt;border-top:2px dashed #999;padding-top:8pt;font-size:10.5pt;line-height:1.35}
  #print-crossword .xwp-logo{height:1.1in;width:auto}
  #print-crossword .xwp-wagon{position:absolute;right:0;bottom:0;height:.6in;width:auto}
}
