/* rebus.css - True Rebus (vertical keyword + horizontal words) */

.rebus-body {
    min-height: 100vh;
    background-color: var(--bg-color);
    transition: background-color 0.3s ease;
}

.rebus-wrapper {
    padding-top: 80px;
}

/* Ensure glass panel adapts to theme */
.rebus-wrapper .glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    color: var(--text-color);
}

@media (max-width: 576px) {
    .rebus-wrapper {
        padding-top: 60px;
    }
    .rebus-wrapper .glass-panel {
        padding: 1rem !important;
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
    }
}

/* Adapt text colors to theme */
.rebus-wrapper h1,
.rebus-wrapper .display-4 {
    color: var(--text-color);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.rebus-wrapper .lead {
    color: var(--secondary-text-color);
}

.rebus-wrapper h4,
.rebus-wrapper #current-topic-display {
    color: var(--text-color);
}

.rebus-wrapper #loading-text {
    color: var(--secondary-text-color);
}
.rebus-grid-wrapper {
    overflow: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 12px;
    box-shadow: inset 0 4px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    max-height: 80vh;
    scrollbar-width: thin;
    scrollbar-color: #3498db rgba(255,255,255,0.1);
    display: block;
}

body.dark-theme .rebus-grid-wrapper {
    background: rgba(0, 0, 0, 0.7);
    box-shadow: inset 0 4px 25px rgba(0,0,0,0.9);
}


@media (max-width: 576px) {
    .rebus-grid-wrapper {
        padding: 5px;
        border-radius: 4px;
    }
}

.rebus-grid-inner {
    width: max-content;
    margin: 0 auto;
    transform-origin: 0 0;
    transition: transform 0.1s cubic-bezier(0.1, 0.7, 1.0, 0.1);
}

.rebus-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 3px;
    gap: 2px;
}

.rebus-hint-label {
    width: 180px;
    min-width: 180px;
    text-align: right;
    padding-right: 12px;
    color: var(--text-color);
    font-size: 0.85rem;
    line-height: 1.2;
    font-family: 'Outfit', sans-serif;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.rebus-hint-number {
    font-weight: 800;
    color: #f1c40f;
    margin-right: 4px;
}

/* Cell base */
.rebus-cell {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #34495e;
    border-radius: 4px;
    background-color: #fff;
    flex-shrink: 0;
}

/* Cell for the vertical keyword intersection */
.rebus-cell.key-cell {
    background: linear-gradient(135deg, #f39c12, #f1c40f);
    border-color: #e67e22;
    box-shadow: 0 0 8px rgba(241, 196, 15, 0.4);
}

/* Empty/spacer cell (no letter) */
.rebus-cell.spacer-cell {
    background: transparent;
    border: none;
}

.rebus-cell-input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    color: #2c3e50;
    background: transparent;
    padding: 0;
    margin: 0;
    outline: none;
    transition: all 0.15s ease;
}

.rebus-cell-input:focus {
    background-color: #e8f8f5;
    box-shadow: inset 0 0 0 3px #3498db;
    transform: scale(1.08);
    z-index: 10;
    border-radius: 4px;
}

.rebus-cell-input.correct {
    color: #27ae60;
}

/* Vertical keyword display at the bottom */
.rebus-keyword-display {
    margin-top: 20px;
    text-align: center;
}

.rebus-keyword-display p {
    color: var(--text-color);
    font-weight: 600;
}

.rebus-keyword-display .keyword-letter {
    display: inline-block;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    margin: 2px;
    border-radius: 6px;
    background: linear-gradient(135deg, #f39c12, #f1c40f);
    color: #2c3e50;
    border: 2px solid #e67e22;
}

.rebus-keyword-display .keyword-letter.revealed {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-color: #1e8449;
    color: white;
}

.rebus-keyword-display .keyword-letter.hidden {
    background: rgba(255,255,255,0.15);
    color: transparent;
    border-color: rgba(255,255,255,0.2);
}

/* Dark theme overrides */
.dark-theme .rebus-cell {
    background-color: #ecf0f1;
    border-color: #7f8c8d;
}

.dark-theme .rebus-cell.spacer-cell {
    background-color: transparent !important;
    border-color: transparent !important;
}

.dark-theme .rebus-cell.key-cell {
    background: linear-gradient(135deg, #f39c12, #f1c40f);
    border-color: #e67e22;
}

.dark-theme .rebus-cell-input {
    color: #1a1a2e;
}

.dark-theme .rebus-cell-input.correct {
    color: #27ae60 !important;
}

.dark-theme .rebus-grid-wrapper {
    background: rgba(0, 0, 0, 0.7);
    box-shadow: inset 0 4px 20px rgba(0,0,0,0.8);
}

.dark-theme .rebus-wrapper h1,
.dark-theme .rebus-wrapper .display-4,
.dark-theme .rebus-wrapper .lead,
.dark-theme .rebus-wrapper h4,
.dark-theme .rebus-keyword-display p,
.dark-theme .rebus-hint-label {
    color: var(--text-color) !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
    .rebus-hint-label {
        width: 120px;
        min-width: 120px;
        font-size: 0.75rem;
    }
    .rebus-cell {
        width: 38px;
        height: 38px;
    }
    .rebus-cell-input {
        font-size: 1.2rem;
    }
    .rebus-keyword-display .keyword-letter {
        width: 38px;
        height: 38px;
        line-height: 38px;
        font-size: 1.2rem;
    }
}
