/* ════════════════════════════════════════════════════════════
   LumorowLMS — Crossword Puzzle
   Layout:
     - Title (optional)
     - Large, centered grid across the top half of the block
     - Two-column clue list (Across | Down) underneath
   ════════════════════════════════════════════════════════════ */

/* Override shared.css's 780px cap — this is a wide block. */
.llmsb-cw-block {
    width: 100%;
    max-width: 1200px;
    margin: 24px auto;
    padding: 24px 28px;
    background: #fff;
    color: #1a1a2e;
    border: 2px solid var(--llmsb-primary, #F77205);
    border-radius: 12px;
    box-sizing: border-box;
}

.llmsb-cw-title {
    margin: 0 0 18px;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: #1a1a2e;
}

/* ── Grid ─────────────────────────────────────────────────── */
.llmsb-cw-grid-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 24px;
}
.llmsb-cw-grid {
    display: grid;
    gap: 0;
    background: #1a1a2e;       /* shows through gaps as the grid rules */
    border: 2px solid #1a1a2e;
    border-radius: 4px;
    width: 100%;
    max-width: 720px;          /* per-instance override in style attr */
    aspect-ratio: var(--cw-ratio, 1 / 1);
}
.llmsb-cw-cell {
    position: relative;
    background: #fff;
    border: 1px solid #c8cdd3;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 0.1s;
}
.llmsb-cw-cell.llmsb-cw-cell-block {
    background: #1a1a2e;
    border-color: #1a1a2e;
}
.llmsb-cw-num {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #6b7280;
    pointer-events: none;
    user-select: none;
}
.llmsb-cw-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    text-align: center;
    font-size: clamp(14px, 2.4vw, 22px);
    font-weight: 700;
    text-transform: uppercase;
    color: #1a1a2e;
    padding: 0;
    margin: 0;
    line-height: 1;
    box-sizing: border-box;
    caret-color: var(--llmsb-primary, #F77205);
}
.llmsb-cw-input:focus { background: #fff3e0; }
.llmsb-cw-cell.is-active { background: #fff3e0; }
.llmsb-cw-cell.is-active-word { background: #fff8ee; }

/* Result states */
.llmsb-cw-cell.is-correct .llmsb-cw-input {
    background: #d9f5d9;
    color: #15803d;
}
.llmsb-cw-cell.is-wrong .llmsb-cw-input {
    background: #ffe2e2;
    color: #b81f1f;
}

/* ── Clues ───────────────────────────────────────────────── */
.llmsb-cw-clues {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
    margin-top: 12px;
}
.llmsb-cw-clues-col h3 {
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--llmsb-primary, #F77205);
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: 0.3px;
}
.llmsb-cw-clues-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: none;
}
.llmsb-cw-clues-list li {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 5px 8px;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
}
.llmsb-cw-clues-list li::before {
    content: attr(value);
    flex: 0 0 28px;
    font-weight: 700;
    color: var(--llmsb-primary, #F77205);
    text-align: right;
}
.llmsb-cw-clues-list li:hover { background: #fafafa; }
.llmsb-cw-clues-list li.is-active { background: #fff3e0; }
.llmsb-cw-clue-text { color: #1a1a2e; }

/* ── Controls ────────────────────────────────────────────── */
.llmsb-cw-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}
.llmsb-cw-submit {
    background: var(--llmsb-primary, #F77205);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 32px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: background 0.15s;
}
.llmsb-cw-submit:hover { background: #d96304; }
.llmsb-cw-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Results ─────────────────────────────────────────────── */
.llmsb-cw-results {
    margin-top: 18px;
    padding: 14px 18px;
    background: #fafafa;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
}
.llmsb-cw-results-score {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--llmsb-primary, #F77205);
}

/* ── Editor styles ────────────────────────────────────────── */
.llmsb-cw-editor {
    padding: 20px;
    background: #fff;
    border: 2px dashed var(--llmsb-primary, #F77205);
    border-radius: 12px;
}
.llmsb-cw-editor-header {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--llmsb-primary, #F77205);
    margin-bottom: 8px;
}
.llmsb-cw-editor-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 12px;
}
.llmsb-cw-editor-meta .ok strong { color: #15803d; }
.llmsb-cw-editor-meta .warn strong { color: #c2410c; }
.llmsb-cw-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.llmsb-cw-editor-section {
    margin-top: 18px;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.llmsb-cw-editor-section h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--llmsb-primary, #F77205);
}
.llmsb-cw-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
}
.llmsb-cw-row-word { flex: 0 0 140px; }
.llmsb-cw-row-clue { flex: 1 1 auto; }
.llmsb-cw-row-actions { flex: 0 0 auto; }
.llmsb-cw-preview {
    display: grid;
    gap: 0;
    background: #1a1a2e;
    border: 2px solid #1a1a2e;
    border-radius: 4px;
    width: fit-content;
    margin: 14px auto 0;
}
.llmsb-cw-preview-cell {
    width: 28px; height: 28px;
    background: #fff;
    border: 1px solid #c8cdd3;
    position: relative;
    font-size: 0.62rem;
    color: #6b7280;
    text-align: left;
    padding: 1px 2px;
    box-sizing: border-box;
}
.llmsb-cw-preview-cell.is-block { background: #1a1a2e; border-color: #1a1a2e; }

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 720px) {
    .llmsb-cw-clues { grid-template-columns: 1fr; gap: 18px; }
    .llmsb-cw-block { padding: 16px 14px; }
}
