/* =========================================================
   HTF CROSSWORD (REBUILD v1) — self-contained + responsive
   Drop-in widget CSS. No dependencies.
   ========================================================= */

.htf-cw-app{
  --cw-cell: 34px;
  --cw-gap: 0px;
  --cw-border: rgba(255,255,255,.55);
  --cw-panel: rgba(14,18,22,.78);
  --cw-tile: #e9e9e9;
  --cw-ink: #1a1a1a;
  --cw-accent: #16d46b;
  --cw-wrong: #ff4d4d;
  --cw-right: #16d46b;

  color: #fff;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.htf-cw-card{
  background: var(--cw-panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}

.htf-cw-top{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.htf-cw-title{
  font-weight: 700;
  letter-spacing: .4px;
  font-size: 18px;
  margin: 0;
}

.htf-cw-controls{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.htf-cw-btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.18);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  line-height: 1;
}
.htf-cw-btn:hover{ background: rgba(255,255,255,.08); }

.htf-cw-select{
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(0,0,0,.18);
  color: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
}

.htf-cw-layout{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 900px){
  .htf-cw-layout{
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }
}

/* GRID WRAP ensures horizontal scroll on small screens */
.htf-cw-gridwrap{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

/* The crossword grid */
.htf-cw-grid{
  display: grid;
  grid-template-columns: repeat(var(--cw-size), var(--cw-cell));
  grid-auto-rows: var(--cw-cell);
  gap: var(--cw-gap);
  width: max-content;           /* prevents “wrap to next line” */
  max-width: none;
  border: 1px solid var(--cw-border);
  background: transparent;
}

/* Each cell */
.htf-cw-cell{
  position: relative;
  width: var(--cw-cell);
  height: var(--cw-cell);
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.18);
  background: var(--cw-tile);
  border-radius: 6px;
  overflow: hidden;
}

/* Black blocks */
.htf-cw-cell.is-block{
  background: #07090b;
  border-color: rgba(255,255,255,.08);
}

/* number in top-left */
.htf-cw-num{
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: #000; /* numbers are black */
  opacity: .95;
  pointer-events: none;
}

/* letter input */
.htf-cw-input{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--cw-accent);
  text-transform: uppercase;
  font-weight: 900;
  font-size: 18px;
  text-align: center;
  outline: none;
  padding: 0;
  margin: 0;
  caret-color: transparent;
  font-family: inherit;
  line-height: var(--cw-cell);
}
.htf-cw-input::-ms-clear{ display:none; }

/* focus ring */
.htf-cw-cell:has(.htf-cw-input:focus){
  box-shadow: inset 0 0 0 2px rgba(22,212,107,.65);
}

/* correctness feedback */
.htf-cw-cell.is-wrong .htf-cw-input{ color: var(--cw-wrong); }
.htf-cw-cell.is-right .htf-cw-input{ color: var(--cw-right); }

/* Clues */
.htf-cw-clues{
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 10px;
}

@media (min-width: 900px){
  .htf-cw-clues{
    border-top: 0;
    padding-top: 0;
  }
}

.htf-cw-cluecols{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px){
  .htf-cw-cluecols{ grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px){
  .htf-cw-cluecols{ grid-template-columns: 1fr; }
}

.htf-cw-cluebox{
  background: rgba(0,0,0,.16);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 10px;
  min-height: 160px;
}

.htf-cw-cluebox h3{
  margin: 0 0 6px 0;
  font-size: 14px;
  letter-spacing: .4px;
}

.htf-cw-cluelist{
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 240px;          /* clue scrollbar */
  overflow-y: auto;
  padding-right: 6px;
}

.htf-cw-clue{
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 4px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
}
.htf-cw-clue:hover{ background: rgba(255,255,255,.06); }
.htf-cw-clue.is-active{ background: rgba(22,212,107,.14); border: 1px solid rgba(22,212,107,.22); }

.htf-cw-cluenum{
  font-weight: 900;
  color: rgba(255,255,255,.92);
}

/* Helper note */
.htf-cw-help{
  font-size: 12px;
  opacity: .9;
  margin-top: 6px;
}
