    /* ===== Base & Layout ===== */
    .cw-page {
        min-height: calc(100vh - 80px);
        padding: 2rem 0 4rem;
        background: #f8fafc;
    }

    .cw-container {
        max-width: 1140px;
        margin: 0 auto;
        padding: 0 1.5rem;
    }

    .cw-header {
        text-align: center;
        margin-bottom: 2.5rem;
        padding: 2.5rem 2rem;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 1.5rem;
        color: #fff;
        position: relative;
        overflow: hidden;
    }

    .cw-header::before {
        content: '';
        position: absolute;
        top: -50%;
        right: -30%;
        width: 400px;
        height: 400px;
        background: rgba(255,255,255,0.06);
        border-radius: 50%;
        pointer-events: none;
    }

    .cw-header::after {
        content: '';
        position: absolute;
        bottom: -40%;
        left: -20%;
        width: 300px;
        height: 300px;
        background: rgba(255,255,255,0.04);
        border-radius: 50%;
        pointer-events: none;
    }

    .cw-header h1 {
        font-size: 2.2rem;
        font-weight: 800;
        margin: 0 0 0.5rem;
        position: relative;
        z-index: 1;
    }

    .cw-header p {
        font-size: 1.1rem;
        opacity: 0.9;
        margin: 0;
        position: relative;
        z-index: 1;
    }

    /* ===== Cards ===== */
    .cw-card {
        background: #fff;
        border-radius: 1rem;
        padding: 2rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
        margin-bottom: 2rem;
        border: 1px solid rgba(0,0,0,0.04);
    }

    .cw-card h2 {
        font-size: 1.3rem;
        font-weight: 700;
        color: #1e293b;
        margin: 0 0 0.25rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .cw-card h2 .icon {
        font-size: 1.4rem;
    }

    .cw-help {
        color: #64748b;
        font-size: 0.92rem;
        margin: 0 0 1.25rem;
        line-height: 1.5;
    }

    /* ===== Top toolbar ===== */
    .cw-toolbar {
        display: flex;
        gap: 0.75rem;
        align-items: center;
        flex-wrap: wrap;
        margin-bottom: 1.25rem;
    }

    .cw-toolbar-left {
        display: flex;
        gap: 0.75rem;
        align-items: center;
        flex-wrap: wrap;
        flex: 1;
    }

    .cw-select {
        padding: 0.55rem 2rem 0.55rem 0.85rem;
        border: 2px solid #e2e8f0;
        border-radius: 0.6rem;
        font-size: 0.92rem;
        color: #334155;
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 0.7rem center;
        appearance: none;
        cursor: pointer;
        transition: border-color 0.2s;
        min-width: 170px;
    }

    .cw-select:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
    }

    .cw-difficulty-pills {
        display: flex;
        gap: 0;
        border: 2px solid #e2e8f0;
        border-radius: 0.6rem;
        overflow: hidden;
    }

    .cw-pill {
        padding: 0.55rem 1rem;
        font-size: 0.88rem;
        font-weight: 600;
        color: #64748b;
        background: #fff;
        border: none;
        border-right: 1px solid #e2e8f0;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
        white-space: nowrap;
    }

    .cw-pill:last-child { border-right: none; }

    .cw-pill.active {
        background: #667eea;
        color: #fff;
    }

    .cw-pill:not(.active):hover {
        background: #f1f5f9;
    }

    /* ===== Word List ===== */
    .cw-word-list {
        border: 2px solid #e2e8f0;
        border-radius: 0.75rem;
        overflow: hidden;
    }

    .cw-word-list-header {
        display: grid;
        grid-template-columns: 40px 180px 1fr 40px;
        gap: 0;
        padding: 0.6rem 0.75rem;
        background: #f8fafc;
        border-bottom: 2px solid #e2e8f0;
        font-size: 0.78rem;
        font-weight: 700;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .cw-word-row {
        display: grid;
        grid-template-columns: 40px 180px 1fr 40px;
        gap: 0;
        padding: 0;
        border-bottom: 1px solid #f1f5f9;
        align-items: center;
        transition: background 0.15s;
        position: relative;
    }

    .cw-word-row:last-child { border-bottom: none; }

    .cw-word-row:hover { background: #fafaff; }

    .cw-word-row .cw-row-num {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.82rem;
        font-weight: 600;
        color: #94a3b8;
        padding: 0.6rem 0;
        user-select: none;
    }

    .cw-word-row input {
        border: none;
        padding: 0.7rem 0.75rem;
        font-size: 0.95rem;
        background: transparent;
        width: 100%;
        outline: none;
        transition: background 0.15s;
        box-sizing: border-box;
    }

    .cw-word-row input:focus {
        background: rgba(102,126,234,0.04);
    }

    .cw-word-row input.cw-word-input {
        font-weight: 600;
        color: #1e293b;
        text-transform: uppercase;
        border-right: 1px solid #f1f5f9;
    }

    .cw-word-row input.cw-word-input::placeholder { text-transform: none; font-weight: 400; }

    .cw-word-row input.cw-def-input {
        color: #334155;
    }

    .cw-word-row .cw-row-delete {
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: none;
        cursor: pointer;
        color: #cbd5e1;
        padding: 0.6rem;
        border-radius: 0.4rem;
        transition: color 0.15s, background 0.15s;
        font-size: 1.1rem;
    }

    .cw-word-row .cw-row-delete:hover {
        color: #ef4444;
        background: #fef2f2;
    }

    .cw-word-row .cw-row-warning {
        position: absolute;
        right: 44px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.75rem;
        color: #f59e0b;
        font-weight: 600;
        pointer-events: none;
        white-space: nowrap;
    }

    .cw-add-row-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        width: 100%;
        padding: 0.7rem;
        border: none;
        background: #f8fafc;
        color: #667eea;
        font-size: 0.92rem;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
        border-top: 1px solid #e2e8f0;
    }

    .cw-add-row-btn:hover {
        background: #eef2ff;
    }

    .cw-word-count {
        text-align: right;
        font-size: 0.82rem;
        color: #94a3b8;
        margin-top: 0.5rem;
    }

    .cw-word-count.over-limit { color: #ef4444; font-weight: 600; }

    .cw-shortcuts-hint {
        font-size: 0.78rem;
        color: #94a3b8;
        margin-top: 0.4rem;
    }

    .cw-shortcuts-hint kbd {
        display: inline-block;
        padding: 0.1rem 0.4rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.25rem;
        background: #f8fafc;
        font-family: inherit;
        font-size: 0.75rem;
        font-weight: 600;
        color: #64748b;
    }

    /* ===== Buttons ===== */
    .cw-btn-row {
        display: flex;
        gap: 0.75rem;
        flex-wrap: wrap;
        margin-top: 1.5rem;
        align-items: center;
    }

    .cw-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.75rem 1.5rem;
        border-radius: 0.7rem;
        font-size: 0.98rem;
        font-weight: 700;
        cursor: pointer;
        transition: transform 0.15s, box-shadow 0.15s, background 0.15s, opacity 0.15s;
        border: none;
        text-decoration: none;
        white-space: nowrap;
    }

    .cw-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none !important;
    }

    .cw-btn-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: #fff;
    }

    .cw-btn-primary:not(:disabled):hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(102,126,234,0.35);
    }

    .cw-btn-success {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: #fff;
    }

    .cw-btn-success:not(:disabled):hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(16,185,129,0.35);
    }

    .cw-btn-secondary {
        background: #f1f5f9;
        color: #475569;
        border: 2px solid #e2e8f0;
    }

    .cw-btn-secondary:not(:disabled):hover {
        background: #e2e8f0;
    }

    .cw-btn-warning {
        background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
        color: #fff;
    }

    .cw-btn-warning:not(:disabled):hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(245,158,11,0.35);
    }

    .cw-btn-outline {
        background: #fff;
        color: #667eea;
        border: 2px solid #667eea;
    }

    .cw-btn-outline:not(:disabled):hover {
        background: #eef2ff;
    }

    .cw-btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.88rem;
    }

    /* ===== Loading state ===== */
    .cw-loading {
        display: none;
        text-align: center;
        padding: 3rem 2rem;
    }

    .cw-loading.visible { display: block; }

    .cw-spinner {
        width: 44px;
        height: 44px;
        border: 4px solid #e2e8f0;
        border-top-color: #667eea;
        border-radius: 50%;
        animation: cw-spin 0.7s linear infinite;
        margin: 0 auto 1rem;
    }

    @keyframes cw-spin {
        to { transform: rotate(360deg); }
    }

    .cw-loading-text {
        font-size: 1rem;
        color: #64748b;
        font-weight: 600;
    }

    /* ===== Empty state ===== */
    .cw-empty-state {
        text-align: center;
        padding: 4rem 2rem;
        color: #94a3b8;
    }

    .cw-empty-icon {
        font-size: 3.5rem;
        margin-bottom: 1rem;
        opacity: 0.6;
    }

    .cw-empty-state h3 {
        font-size: 1.2rem;
        font-weight: 700;
        color: #64748b;
        margin: 0 0 0.5rem;
    }

    .cw-empty-state p {
        font-size: 0.95rem;
        margin: 0;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
        line-height: 1.5;
    }

    /* ===== Result area ===== */
    .cw-result {
        display: none;
    }

    .cw-result.visible { display: block; }

    /* Stats bar */
    .cw-stats-bar {
        display: flex;
        gap: 1.5rem;
        flex-wrap: wrap;
        margin-bottom: 1.5rem;
        padding: 1rem 1.25rem;
        background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%);
        border-radius: 0.75rem;
        border: 1px solid #e0e7ff;
    }

    .cw-stat {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
    }

    .cw-stat-value {
        font-size: 1.3rem;
        font-weight: 800;
        color: #667eea;
    }

    .cw-stat-label {
        font-size: 0.78rem;
        color: #64748b;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    /* Skipped words */
    .cw-skipped {
        display: none;
        background: #fffbeb;
        border: 1px solid #fcd34d;
        border-radius: 0.75rem;
        padding: 1rem 1.25rem;
        margin-bottom: 1.5rem;
        color: #92400e;
        font-size: 0.92rem;
        line-height: 1.5;
    }

    .cw-skipped.visible { display: block; }

    .cw-skipped-title {
        font-weight: 700;
        margin-bottom: 0.25rem;
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .cw-skipped-words {
        font-weight: 600;
    }

    .cw-skipped-reason {
        font-size: 0.85rem;
        color: #a16207;
        margin-top: 0.25rem;
    }

    /* Solution toggle + interactive toggle */
    .cw-toggle-bar {
        display: flex;
        gap: 2rem;
        align-items: center;
        margin-bottom: 1.25rem;
        flex-wrap: wrap;
    }

    .cw-toggle-item {
        display: flex;
        align-items: center;
        gap: 0.6rem;
    }

    .cw-toggle-switch {
        position: relative;
        width: 48px;
        height: 26px;
        background: #cbd5e1;
        border-radius: 13px;
        cursor: pointer;
        transition: background 0.2s;
        border: none;
        padding: 0;
        flex-shrink: 0;
    }

    .cw-toggle-switch.active { background: #667eea; }

    .cw-toggle-switch .knob {
        position: absolute;
        top: 3px;
        left: 3px;
        width: 20px;
        height: 20px;
        background: #fff;
        border-radius: 50%;
        transition: transform 0.2s;
        box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    }

    .cw-toggle-switch.active .knob {
        transform: translateX(22px);
    }

    .cw-toggle-label {
        font-size: 0.92rem;
        font-weight: 600;
        color: #475569;
        user-select: none;
    }

    /* ===== Grid ===== */
    .cw-grid-wrapper {
        overflow-x: auto;
        display: flex;
        justify-content: center;
        padding: 1.5rem 0;
    }

    .cw-grid {
        border-collapse: collapse;
        border: 2.5px solid #1e293b;
    }

    .cw-grid td {
        width: 40px;
        height: 40px;
        text-align: center;
        vertical-align: middle;
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e293b;
        position: relative;
        border: 1px solid #94a3b8;
        padding: 0;
    }

    .cw-grid td.black {
        background: #1e293b;
        border-color: #1e293b;
    }

    .cw-grid td.letter {
        background: #fff;
        transition: background 0.2s, box-shadow 0.2s;
    }

    .cw-grid td.letter.highlight-across {
        background: #eef2ff;
        box-shadow: inset 0 0 0 2px #667eea;
    }

    .cw-grid td.letter.highlight-down {
        background: #faf5ff;
        box-shadow: inset 0 0 0 2px #a855f7;
    }

    .cw-grid td .num {
        position: absolute;
        top: 1px;
        left: 2px;
        font-size: 0.58rem;
        font-weight: 700;
        color: #667eea;
        line-height: 1;
        pointer-events: none;
        z-index: 1;
    }

    .cw-grid td .ch {
        display: block;
        font-size: 1.1rem;
        line-height: 40px;
    }

    .cw-grid td.letter.hide-sol .ch {
        visibility: hidden;
    }

    /* Interactive mode input */
    .cw-grid td.letter.interactive {
        padding: 0;
    }

    .cw-grid td.letter.interactive .ch { display: none; }

    .cw-grid td.letter.interactive .cw-cell-input {
        display: block;
        width: 100%;
        height: 100%;
        border: none;
        outline: none;
        text-align: center;
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e293b;
        background: transparent;
        text-transform: uppercase;
        caret-color: #667eea;
        padding: 0;
    }

    .cw-grid td.letter.interactive .cw-cell-input:focus {
        background: rgba(102,126,234,0.08);
    }

    .cw-grid td.letter.interactive.correct .cw-cell-input {
        color: #059669;
        background: rgba(16,185,129,0.08);
    }

    .cw-grid td.letter.interactive.wrong .cw-cell-input {
        color: #dc2626;
        background: rgba(239,68,68,0.06);
    }

    /* Cell fade-in animation */
    @keyframes cw-cell-in {
        from { opacity: 0; transform: scale(0.7); }
        to { opacity: 1; transform: scale(1); }
    }

    .cw-grid td.animate-in {
        animation: cw-cell-in 0.3s ease-out both;
    }

    /* ===== Clues ===== */
    .cw-clues {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-top: 2rem;
    }

    .cw-clue-group h3 {
        font-size: 1rem;
        font-weight: 700;
        margin: 0 0 0.75rem;
        padding-bottom: 0.5rem;
        border-bottom: 2.5px solid;
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .cw-clue-group.across h3 {
        color: #667eea;
        border-color: #667eea;
    }

    .cw-clue-group.down h3 {
        color: #a855f7;
        border-color: #a855f7;
    }

    .cw-clue-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .cw-clue-list li {
        padding: 0.55rem 0.6rem;
        font-size: 0.92rem;
        color: #334155;
        line-height: 1.45;
        border-bottom: 1px solid #f1f5f9;
        border-radius: 0.4rem;
        cursor: pointer;
        transition: background 0.15s;
    }

    .cw-clue-list li:last-child { border-bottom: none; }

    .cw-clue-list li:hover {
        background: #f8fafc;
    }

    .cw-clue-list li.active {
        background: #eef2ff;
    }

    .cw-clue-num {
        font-weight: 700;
        margin-right: 0.4rem;
    }

    .cw-clue-group.across .cw-clue-num { color: #667eea; }
    .cw-clue-group.down .cw-clue-num { color: #a855f7; }

    .cw-clue-wordlen {
        font-size: 0.8rem;
        color: #94a3b8;
        font-weight: 500;
        margin-left: 0.3rem;
    }

    /* ===== Bottom actions ===== */
    .cw-bottom-actions {
        display: flex;
        gap: 0.75rem;
        flex-wrap: wrap;
        margin-top: 2rem;
        align-items: center;
    }

    .cw-bottom-actions .spacer { flex: 1; }

    .cw-print-opts {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .cw-checkbox {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.88rem;
        color: #475569;
        cursor: pointer;
    }

    .cw-checkbox input[type="checkbox"] {
        width: 17px;
        height: 17px;
        accent-color: #667eea;
        cursor: pointer;
    }

    /* ===== Toast notifications ===== */
    .cw-toast-container {
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        z-index: 10000;
        display: flex;
        flex-direction: column-reverse;
        gap: 0.5rem;
        pointer-events: none;
    }

    .cw-toast {
        pointer-events: auto;
        padding: 0.75rem 1.25rem;
        border-radius: 0.7rem;
        font-size: 0.92rem;
        font-weight: 600;
        color: #fff;
        box-shadow: 0 8px 24px rgba(0,0,0,0.15);
        transform: translateX(120%);
        opacity: 0;
        transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
        max-width: 360px;
    }

    .cw-toast.visible {
        transform: translateX(0);
        opacity: 1;
    }

    .cw-toast.success { background: #047857; }
    .cw-toast.warning { background: #B45309; }
    .cw-toast.error { background: #dc2626; }
    .cw-toast.info { background: #667eea; }

    /* ===== Print Preview Modal ===== */
    .cw-modal-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9000;
        justify-content: center;
        align-items: center;
        padding: 2rem;
    }

    .cw-modal-overlay.visible {
        display: flex;
    }

    .cw-modal {
        background: #fff;
        border-radius: 1rem;
        max-width: 700px;
        width: 100%;
        max-height: 85vh;
        overflow-y: auto;
        box-shadow: 0 24px 48px rgba(0,0,0,0.2);
        animation: cw-modal-in 0.3s ease-out;
    }

    @keyframes cw-modal-in {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .cw-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.25rem 1.5rem;
        border-bottom: 1px solid #e2e8f0;
    }

    .cw-modal-header h3 {
        margin: 0;
        font-size: 1.15rem;
        font-weight: 700;
        color: #1e293b;
    }

    .cw-modal-close {
        width: 36px;
        height: 36px;
        border: none;
        background: #f1f5f9;
        border-radius: 0.5rem;
        font-size: 1.2rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #64748b;
        transition: background 0.15s;
    }

    .cw-modal-close:hover { background: #e2e8f0; }

    .cw-modal-body {
        padding: 1.5rem;
    }

    .cw-modal-footer {
        display: flex;
        justify-content: flex-end;
        gap: 0.75rem;
        padding: 1rem 1.5rem;
        border-top: 1px solid #e2e8f0;
    }

    .cw-preview-options {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .cw-preview-option label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.92rem;
        color: #334155;
        cursor: pointer;
    }

    .cw-preview-title-input {
        width: 100%;
        padding: 0.6rem 0.85rem;
        border: 2px solid #e2e8f0;
        border-radius: 0.5rem;
        font-size: 0.95rem;
        transition: border-color 0.2s;
    }

    .cw-preview-title-input:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
    }

    /* ===== Confirm Modal ===== */
    .cw-confirm-body {
        text-align: center;
        padding: 1.5rem;
    }

    .cw-confirm-body p {
        font-size: 1rem;
        color: #334155;
        margin: 0 0 0.25rem;
    }

    .cw-confirm-body .sub {
        font-size: 0.88rem;
        color: #94a3b8;
    }

    /* ===== Responsive ===== */
    @media (max-width: 768px) {
        .cw-header h1 { font-size: 1.5rem; }
        .cw-header p { font-size: 0.95rem; }
        .cw-header { padding: 2rem 1.25rem; }

        .cw-card { padding: 1.25rem; }

        .cw-toolbar { flex-direction: column; align-items: stretch; }
        .cw-toolbar-left { flex-direction: column; }

        .cw-word-list-header,
        .cw-word-row {
            grid-template-columns: 32px 120px 1fr 36px;
        }

        .cw-word-row input { font-size: 0.88rem; padding: 0.6rem 0.5rem; }

        .cw-grid td {
            width: 32px;
            height: 32px;
        }

        .cw-grid td .ch,
        .cw-grid td.letter.interactive .cw-cell-input {
            font-size: 0.95rem;
            line-height: 32px;
        }

        .cw-grid td .num { font-size: 0.5rem; }

        .cw-clues { grid-template-columns: 1fr; }

        .cw-btn-row,
        .cw-bottom-actions { flex-direction: column; }

        .cw-stats-bar { flex-direction: column; gap: 0.75rem; }

        .cw-difficulty-pills, .cw-grid-size-pills { width: 100%; }
        .cw-pill, .cw-grid-pill { flex: 1; text-align: center; }

        .cw-toggle-bar { gap: 1rem; }

        .cw-theme-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

        .cw-difficulty-indicator { flex-wrap: wrap; }

        .cw-hint-bar, .cw-timer-bar { flex-wrap: wrap; }
    }

    @media (max-width: 480px) {
        .cw-word-list-header,
        .cw-word-row {
            grid-template-columns: 28px 90px 1fr 32px;
        }

        .cw-grid td { width: 28px; height: 28px; }
        .cw-grid td .ch,
        .cw-grid td.letter.interactive .cw-cell-input {
            font-size: 0.82rem;
            line-height: 28px;
        }
    }

    /* ===== Grid Size Control ===== */
    .cw-grid-size-pills { display: flex; gap: 0; border: 2px solid #e2e8f0; border-radius: 0.6rem; overflow: hidden; }
    .cw-grid-pill { padding: 0.55rem 0.85rem; font-size: 0.85rem; font-weight: 600; color: #64748b; background: #fff; border: none; border-right: 1px solid #e2e8f0; cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap; }
    .cw-grid-pill:last-child { border-right: none; }
    .cw-grid-pill.active { background: #10b981; color: #fff; }
    .cw-grid-pill:not(.active):hover { background: #f1f5f9; }

    /* ===== Difficulty Indicator ===== */
    .cw-difficulty-indicator { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1rem; background: #f8fafc; border-radius: 0.6rem; border: 1px solid #e2e8f0; margin-bottom: 1rem; }
    .cw-difficulty-label { font-size: 0.82rem; font-weight: 600; color: #64748b; white-space: nowrap; }
    .cw-difficulty-bar { flex: 1; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; min-width: 80px; }
    .cw-difficulty-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease, background 0.4s ease; }
    .cw-difficulty-text { font-size: 0.82rem; font-weight: 700; min-width: 50px; text-align: right; }

    /* ===== Hint Button ===== */
    .cw-hint-bar { display: none; align-items: center; gap: 0.75rem; margin-bottom: 1rem; padding: 0.6rem 1rem; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 0.6rem; }
    .cw-hint-bar.visible { display: flex; }
    .cw-hint-count { font-size: 0.85rem; color: #92400e; font-weight: 600; }

    /* ===== Timer ===== */
    .cw-timer-bar { display: none; align-items: center; gap: 0.75rem; margin-bottom: 1rem; padding: 0.6rem 1rem; background: #f0fdf4; border: 1px solid #86efac; border-radius: 0.6rem; }
    .cw-timer-bar.visible { display: flex; }
    .cw-timer-display { font-size: 1.1rem; font-weight: 800; color: #059669; font-variant-numeric: tabular-nums; min-width: 70px; }
    .cw-timer-label { font-size: 0.82rem; color: #16a34a; font-weight: 600; }
    .cw-best-score { margin-left: auto; font-size: 0.82rem; color: #d97706; font-weight: 600; }
    .cw-best-score .trophy { margin-right: 0.25rem; }

    /* ===== Theme cards ===== */
    .cw-theme-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; margin-top: 0.75rem; margin-bottom: 1rem; }
    .cw-theme-grid.visible { display: grid; }
    .cw-theme-card { padding: 0.6rem 0.75rem; border: 2px solid #e2e8f0; border-radius: 0.6rem; background: #fff; cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.15s; text-align: center; }
    .cw-theme-card:hover { border-color: #667eea; background: #eef2ff; transform: translateY(-1px); }
    .cw-theme-card .theme-icon { font-size: 1.3rem; display: block; margin-bottom: 0.2rem; }
    .cw-theme-card .theme-name { font-size: 0.82rem; font-weight: 700; color: #334155; }
    .cw-theme-card .theme-count { font-size: 0.72rem; color: #94a3b8; }

    /* ===== Print styles ===== */
    @media print {
        body { background: #fff !important; }

        .cw-header, .cw-card:first-of-type, .cw-btn-row,
        .cw-toggle-bar, .cw-bottom-actions, .cw-stats-bar,
        .cw-skipped, .cw-loading, .cw-toast-container,
        .cw-modal-overlay, .cw-empty-state,
        nav, footer, .mobile-nav, .cookie-banner, .contact-fab,
        .cw-toolbar { display: none !important; }

        .cw-page { padding: 0; min-height: auto; background: #fff; }
        .cw-container { max-width: 100%; padding: 0; }

        .cw-result { display: block !important; }

        .cw-result .cw-card {
            box-shadow: none;
            border: none;
            padding: 0;
            margin: 0;
        }

        .cw-print-header {
            display: block !important;
            text-align: center;
            margin-bottom: 1.5rem;
        }

        .cw-print-header h2 {
            font-size: 1.6rem;
            margin: 0 0 0.4rem;
            color: #000;
        }

        .cw-print-header .cw-print-date {
            font-size: 0.88rem;
            color: #666;
        }

        .cw-print-name-field {
            display: block !important;
            text-align: right;
            font-size: 0.92rem;
            margin-bottom: 1rem;
            color: #333;
        }

        .cw-print-meta-field {
            display: block !important;
            font-size: 0.88rem;
            color: #555;
            margin-bottom: 0.3rem;
            text-align: left;
        }

        .cw-hint-bar, .cw-timer-bar { display: none !important; }

        .cw-grid {
            margin: 0 auto 1.5rem;
        }

        .cw-grid td { width: 30px; height: 30px; }
        .cw-grid td .ch { font-size: 0.95rem; line-height: 30px; }
        .cw-grid td .num { font-size: 0.55rem; }

        .cw-clues {
            break-inside: avoid;
            page-break-inside: avoid;
            margin-top: 1.5rem;
        }

        .cw-clue-group h3 { font-size: 0.95rem; }
        .cw-clue-list li { padding: 0.3rem 0; font-size: 0.85rem; cursor: default; }

        /* Solution page */
        .cw-print-solution-page {
            display: block !important;
            page-break-before: always;
            text-align: center;
            padding-top: 2rem;
        }

        .cw-print-solution-page h2 {
            font-size: 1.3rem;
            margin-bottom: 1.5rem;
            color: #000;
        }
    }

    /* Hidden elements revealed by print or JS */
    .cw-print-header,
    .cw-print-name-field,
    .cw-print-meta-field,
    .cw-print-solution-page { display: none; }

    /* ====== DARK MODE ====== */
    [data-theme="dark"] .cw-page {
        background: #0f172a !important;
    }

    [data-theme="dark"] .cw-header {
        background: linear-gradient(135deg, #312e81 0%, #3b0764 100%) !important;
    }

    [data-theme="dark"] .cw-card {
        background: #1e293b !important;
        border-color: #334155 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 8px 24px rgba(0,0,0,0.2) !important;
    }

    [data-theme="dark"] .cw-card h2 {
        color: #f1f5f9 !important;
    }

    [data-theme="dark"] .cw-help {
        color: #94a3b8 !important;
    }

    [data-theme="dark"] .cw-select {
        background-color: #0f172a !important;
        color: #e2e8f0 !important;
        border-color: #475569 !important;
    }

    [data-theme="dark"] .cw-difficulty-pills {
        border-color: #475569 !important;
    }

    [data-theme="dark"] .cw-pill {
        background: #0f172a !important;
        color: #94a3b8 !important;
        border-right-color: #475569 !important;
    }

    [data-theme="dark"] .cw-pill:not(.active):hover {
        background: #334155 !important;
    }

    [data-theme="dark"] .cw-pill.active {
        background: #667eea !important;
        color: #fff !important;
    }

    [data-theme="dark"] .cw-word-list {
        border-color: #334155 !important;
    }

    [data-theme="dark"] .cw-word-list-header {
        background: #0f172a !important;
        border-bottom-color: #334155 !important;
        color: #94a3b8 !important;
    }

    [data-theme="dark"] .cw-word-row {
        border-bottom-color: #1e293b !important;
    }

    [data-theme="dark"] .cw-word-row:hover {
        background: #0f172a !important;
    }

    [data-theme="dark"] .cw-word-row input {
        background: transparent !important;
        color: #f1f5f9 !important;
        border-color: #334155 !important;
    }

    [data-theme="dark"] .cw-word-row input::placeholder {
        color: #475569 !important;
    }

    [data-theme="dark"] .cw-word-row input:focus {
        border-color: #667eea !important;
    }

    [data-theme="dark"] .cw-row-num {
        color: #64748b !important;
    }

    [data-theme="dark"] .cw-row-delete {
        color: #64748b !important;
    }

    [data-theme="dark"] .cw-row-delete:hover {
        color: #ef4444 !important;
    }

    [data-theme="dark"] .cw-add-row {
        color: #818cf8 !important;
        border-top-color: #334155 !important;
    }

    [data-theme="dark"] .cw-add-row:hover {
        background: #0f172a !important;
    }

    [data-theme="dark"] .cw-word-count {
        color: #64748b !important;
    }

    [data-theme="dark"] .cw-shortcuts {
        color: #64748b !important;
    }

    [data-theme="dark"] .cw-shortcuts kbd {
        background: #334155 !important;
        color: #cbd5e1 !important;
        border-color: #475569 !important;
    }

    [data-theme="dark"] .cw-grid-cell {
        background: #0f172a !important;
        color: #f1f5f9 !important;
        border-color: #475569 !important;
    }

    [data-theme="dark"] .cw-grid-cell.cw-black {
        background: #334155 !important;
    }

    [data-theme="dark"] .cw-clue-list {
        background: #0f172a !important;
        border-color: #334155 !important;
    }

    [data-theme="dark"] .cw-clue-item {
        color: #e2e8f0 !important;
        border-bottom-color: #1e293b !important;
    }

    [data-theme="dark"] .cw-size-pills {
        border-color: #475569 !important;
    }

    [data-theme="dark"] .cw-size-pill {
        background: #0f172a !important;
        color: #94a3b8 !important;
        border-right-color: #475569 !important;
    }

    [data-theme="dark"] .cw-size-pill.active {
        background: #667eea !important;
        color: #fff !important;
    }

    [data-theme="dark"] .cw-size-pill:not(.active):hover {
        background: #334155 !important;
    }
