/* ═══════════════════════════════════════════════════
   Crossword Puzzle Builder — Front End Styles v1.2
   ═══════════════════════════════════════════════════ */

/* ── SHARED SEASON LABEL ── */
.cpb-season {
    display: inline-block; font-size: 12px; font-weight: 700;
    color: #5a9e1f; text-transform: uppercase; letter-spacing: 0.07em;
    margin-bottom: 5px;
}

/* ════════════════════════════════════════════════════
   IMAGE CARDS  — 2-column layout, large cards
   ════════════════════════════════════════════════════ */

.cpb-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}
.cpb-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    transition: box-shadow 0.15s, border-color 0.15s;
    width: 340px;
    flex: 0 0 340px;
}
.cpb-card:hover, .cpb-card:focus {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: #5a9e1f;
    outline: none;
}

/* Thumbnail — fixed width, image fills the box */
.cpb-card-thumb {
    flex: 0 0 200px;
    overflow: hidden;
    background: #f5f5f5;
}
.cpb-card-thumb img {
    width: 200px;
    height: 100%;
    min-height: 130px;
    object-fit: cover;
    display: block;
}

/* Text area */
.cpb-card-body {
    flex: 1;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}
.cpb-card-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: #1a1a1a;
}
.cpb-card-desc {
    font-size: 14px;
    color: #555;
    margin: 0;
    line-height: 1.5;
}

/* ════════════════════════════════════════════════════
   MODAL — opens when a card is clicked
   ════════════════════════════════════════════════════ */

.cpb-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.cpb-modal-box {
    background: #fff;
    border-radius: 6px;
    max-width: 960px;
    width: 100%;
    max-height: 93vh;
    overflow-y: auto;
    padding: 32px 36px;
    position: relative;
}
.cpb-modal-close {
    position: absolute; top: 16px; right: 20px;
    background: none; border: none; font-size: 28px;
    cursor: pointer; color: #aaa; line-height: 1; padding: 0;
}
.cpb-modal-close:hover { color: #222; }

.cpb-modal-header { margin-bottom: 1.5rem; }
.cpb-modal-season { display: inline-block; font-size: 12px; font-weight: 700; color: #5a9e1f; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px; }
.cpb-modal-title  { font-size: 28px; font-weight: 700; margin: 0 0 5px; line-height: 1.2; }
.cpb-modal-desc   { color: #666; font-size: 15px; margin: 0; }

/* Image mode body */
.cpb-modal-body { margin-bottom: 1.25rem; }
.cpb-modal-body img { max-width: 100%; height: auto; display: block; margin: 0 auto; }

/* Interactive puzzle rendered inside modal */
.cpb-modal-puzzle { margin-bottom: 1.25rem; }
.cpb-modal-puzzle .cpb-puzzle { margin: 0; }

.cpb-modal-footer {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    border-top: 1px solid #eee; padding-top: 1rem; margin-top: 0.5rem;
}

/* ── Shared button styles ── */
.cpb-btn {
    padding: 8px 20px; border-radius: 4px; font-size: 13px; font-weight: 600;
    cursor: pointer; border: 2px solid #5a9e1f; background: #fff; color: #5a9e1f;
    transition: background 0.15s, color 0.15s; text-decoration: none; display: inline-block;
    line-height: 1.4;
}
.cpb-btn:hover { background: #5a9e1f; color: #fff; }
.cpb-btn-reveal  { border-color: #777; color: #555; }
.cpb-btn-reveal:hover  { background: #555; color: #fff; border-color: #555; }
.cpb-btn-clear, .cpb-modal-close-btn { border-color: #ccc; color: #888; }
.cpb-btn-clear:hover, .cpb-modal-close-btn:hover { background: #eee; color: #333; border-color: #aaa; }
.cpb-btn-download { border-color: #777; color: #555; }
.cpb-btn-download:hover { background: #555; color: #fff; border-color: #555; }
.cpb-btn-toggle-answer.cpb-showing-answer { background: #5a9e1f; color: #fff; }

/* ════════════════════════════════════════════════════
   INTERACTIVE PUZZLE (standalone embed via [cpb_crossword id=""])
   ════════════════════════════════════════════════════ */

.cpb-puzzle {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 960px;
    margin: 2rem 0;
    color: #222;
}
.cpb-puzzle-header { margin-bottom: 1.25rem; }
.cpb-title { font-size: 26px; font-weight: 700; margin: 0 0 4px; line-height: 1.2; }
.cpb-desc  { color: #666; font-size: 14px; margin: 0; }

.cpb-layout { display: flex; gap: 2.5rem; align-items: flex-start; flex-wrap: wrap; }
.cpb-grid-wrap { flex: 0 0 auto; overflow-x: auto; }
.cpb-clues-wrap { flex: 1 1 240px; display: flex; gap: 2rem; flex-wrap: wrap; padding-top: 4px; }
.cpb-clues-col { flex: 1 1 150px; }
.cpb-clues-col h3 {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: #999; margin: 0 0 10px;
    border-bottom: 1px solid #eee; padding-bottom: 6px;
}

.cpb-clue-item {
    font-size: 13px; color: #444; line-height: 1.5;
    padding: 3px 6px; border-radius: 3px; cursor: pointer;
    margin-bottom: 3px; transition: background 0.1s;
}
.cpb-clue-item:hover { background: #f0f0f0; color: #111; }
.cpb-clue-item.cpb-active { background: #dff0c8; color: #2a5c05; font-weight: 600; }
.cpb-clue-num { font-weight: 700; margin-right: 4px; color: #111; }

.cpb-grid { display: inline-grid; border: 2px solid #111; gap: 0; }
.cpb-cell { width: 32px; height: 32px; position: relative; background: #222; }
.cpb-cell.cpb-white { background: #fff; border: 0.5px solid #bbb; }
.cpb-cell.cpb-highlighted { background: #dff0c8; }
.cpb-cell.cpb-active-cell { background: #7dc44a; }
.cpb-cell-num {
    position: absolute; top: 1px; left: 2px;
    font-size: 7px; font-weight: 700; color: #555;
    line-height: 1; pointer-events: none; z-index: 1;
}
.cpb-cell input {
    width: 100%; height: 100%; border: none; background: transparent;
    text-align: center; font-size: 14px; font-weight: 700;
    text-transform: uppercase; color: #111;
    outline: none; cursor: pointer; caret-color: transparent; padding: 0;
}
.cpb-cell input.cpb-correct { color: #2a5c05; }
.cpb-cell input.cpb-wrong   { color: #c0392b; }

.cpb-controls { margin-top: 1.25rem; display: flex; gap: 10px; flex-wrap: wrap; }
.cpb-message { margin-top: 10px; font-size: 13px; font-weight: 600; min-height: 18px; color: #2a5c05; }
.cpb-message.cpb-msg-error { color: #c0392b; }

/* ── Responsive ── */
@media (max-width: 700px) {
    .cpb-card-thumb { flex: 0 0 120px; }
    .cpb-card-thumb img { width: 120px; }
    .cpb-card-body { padding: 14px 16px; }
    .cpb-card-title { font-size: 17px; }
    .cpb-modal-box { padding: 20px 16px; }
    .cpb-layout { flex-direction: column; }
    .cpb-cell { width: 26px; height: 26px; }
    .cpb-cell input { font-size: 12px; }
}

/* ════════════════════════════════════════════════════
   NEW-STYLE CARD (no thumbnail — interactive puzzle)
   ════════════════════════════════════════════════════ */

.cpb-card.cpb-card-interactive {
    border-left: 4px solid #5a9e1f;
    min-height: 100px;
}
.cpb-card.cpb-card-interactive:hover,
.cpb-card.cpb-card-interactive:focus {
    background: #f8fcf3;
}
.cpb-card-play {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #5a9e1f;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cpb-card-play::after {
    content: "→";
    font-size: 15px;
    transition: transform 0.15s;
}
.cpb-card:hover .cpb-card-play::after,
.cpb-card:focus .cpb-card-play::after {
    transform: translateX(4px);
}
.cpb-card-icon {
    flex: 0 0 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f7e8;
    font-size: 36px;
    color: #5a9e1f;
    min-height: 100px;
    border-right: 1px solid #ddd;
}
