﻿:root {
    --cell-size: 32px;
    --font-s: 14px;
    --grid-bg: #2f6fae;
    --cell-border: #999;
    --cell-bg: #fff;
    --black-cell: #3f82c4;
    --num-color: #444;
    --correct-bg: #dff0d8;
    --incorrect-bg: #f8d7da;
    --focus-outline: rgba(52,144,220,0.25);
    --accent: #3490dc;
}

/* Page layout */
body {
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    margin: 20px;
    background: #f7f7f9;
    color: #222;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

    .controls label {
        font-size: 14px;
    }

button {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #bbb;
    background: #fff;
    cursor: pointer;
}

    button:active {
        transform: translateY(1px);
    }

/* Top-level layout */
.crossword-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.grid-wrap {
    background: var(--grid-bg);
    padding: 8px;
    border-radius: 6px;
}

/* Table / Grid */
.crossword {
    border-collapse: collapse;
    table-layout: fixed;
    user-select: none;
}

    .crossword td {
        width: var(--cell-size);
        height: var(--cell-size);
        background: var(--cell-bg);
        position: relative;
        text-align: center;
        vertical-align: middle;
        border: 1px solid var(--cell-border);
        padding: 0;
        box-sizing: border-box;
    }

    /* Black squares */
    .crossword .black {
        background: var(--black-cell);
        border-color: var(--black-cell);
    }

/* Number in cell */
.cell-number {
    position: absolute;
    left: 2px;
    top: 1px;
    font-size: 10px;
    color: var(--num-color);
    line-height: 1;
    pointer-events: none;
}

/* Inputs for letters */
.cell-input {
    width: 100%;
    height: 100%;
    border: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-align: center;
    font-weight: 700;
    font-size: calc(var(--font-s) + 2px);
    line-height: var(--cell-size);
    background: transparent;
    caret-color: var(--accent);
    outline: none;
    text-transform: uppercase;
    color: #111;
    -webkit-appearance: none;
    appearance: none;
}

    /* Placeholder (optional visual hint) */
    .cell-input::placeholder {
        color: rgba(0,0,0,0.12);
    }

/* Focus state - highlight cell */
.crossword td:focus-within {
    box-shadow: 0 0 0 3px var(--focus-outline);
    z-index: 2;
    border-radius: 4px;
}

/* Correct / incorrect indicators */
.cell-input.correct {
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0.05));
    background-color: var(--correct-bg);
    color: #084b16;
}

.cell-input.incorrect {
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0.05));
    background-color: var(--incorrect-bg);
    color: #671616;
}

/* Disabled reveal styling */
.cell-input:disabled {
    background: transparent;
    color: #111;
    opacity: 1;
}

/* Clues */
.clues-wrap {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 320px;
}

    .clues-wrap h3 {
        margin: 0 0 6px 0;
    }

    .clues-wrap ol,
    .clues-wrap ul {
        margin: 0 0 0 18px;
        padding: 0;
    }

    .clues-wrap li {
        margin: 6px 0;
        line-height: 1.3;
        cursor: pointer;
        transition: background .12s ease;
        padding: 2px 6px;
        border-radius: 4px;
    }

        .clues-wrap li:hover {
            background: rgba(0,0,0,0.03);
        }

/* Small-screen adjustments */
@media (max-width: 880px) {
    .crossword-area {
        flex-direction: column;
        align-items: center;
    }

    .clues-wrap {
        min-width: 100%;
        order: 2;
    }

    .grid-wrap {
        order: 1;
    }
}

/* Responsive cell-size control */
@media (min-width: 1200px) {
    :root {
        --cell-size: 36px;
        --font-s: 16px;
    }
}

@media (max-width: 480px) {
    :root {
        --cell-size: 28px;
        --font-s: 12px;
    }

    .clues-wrap {
        min-width: 260px;
    }
}

/* Print-friendly */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    .controls, .notes, button {
        display: none !important;
    }

    .grid-wrap {
        background: transparent;
        padding: 0;
    }

    .cell-input {
        font-size: 12pt;
        -webkit-print-color-adjust: exact;
    }

        .cell-input.correct, .cell-input.incorrect {
            background: transparent !important;
        }
}

/* Minor polish */
.notes {
    font-size: 13px;
    color: #555;
    margin-top: 14px;
}

.revealed .cell-letter {
    color: #888;
}

/* Accessibility: focus-visible outline for keyboard users */
.cell-input:focus-visible {
    outline: 2px solid rgba(52,144,220,0.6);
    outline-offset: -2px;
}

/* Make table cells not selectable to avoid accidental text selection */
.crossword td, .crossword td * {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

    /* but allow selection inside inputs */
    .crossword td input {
        user-select: text;
    }


/* =========================================================
   BB Bible Helps site-style overrides
   The crossword's puzzle-specific rules above remain intact.
   ========================================================= */

body.activity-page {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background: #eef3f8;
    color: #222;
}

.activity-page .container {
    width: min(1100px, 96vw);
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 18px;
}

.activity-header {
    width: 100%;
    margin: 0 0 10px;
    text-align: center;
}

.activity-header img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
}

.activity-title {
    margin: 8px 0 12px;
    padding: 0;
    color: #0645a5;
    font-size: clamp(22px, 2vw, 30px);
    line-height: 1.15;
    font-weight: 700;
    text-align: center;
}

.activity-page .controls {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #9bb8d5;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 60, 130, .08);
}

.activity-page .controls label {
    color: #333;
}

.activity-page button {
    border: 1px solid #7da1c5;
    border-radius: 6px;
    background: #f5f9fd;
    color: #164f87;
    padding: 7px 11px;
    font-weight: 600;
}

.activity-page button:hover {
    background: #e7f1fb;
}

.activity-panel {
    padding: 12px;
    background: #fff;
    border: 1px solid #9bb8d5;
    border-radius: 12px;
    box-shadow: 0 1px 5px rgba(0, 60, 130, .08);
}

.activity-page .clues-wrap h3 {
    color: #0645a5;
    font-size: 18px;
}

@media (max-width: 600px) {
    .activity-page .container {
        width: 96vw;
    }

    .activity-header img {
        max-height: 110px;
    }

    .activity-title {
        font-size: 22px;
    }

    .activity-page .controls {
        padding: 8px;
    }

    .activity-panel {
        padding: 8px;
    }
}

@media print {
    .activity-header {
        display: none;
    }

    .activity-title {
        color: #000;
    }

    .activity-panel,
    .activity-page .controls {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
}
