/* Game Page Stylesheet
   All rules scoped to .game-page (the page root div in game.rs). */

.game-page .game-container {
    width: 100%;
    max-width: 1200px;
    background-color: #E8E9EC;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    margin: 20px auto;
    animation: fadeIn 0.3s ease-out;
}

.game-page .top-bar {
    background-color: #E8E9EC;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #D1D5DB;
}


.game-page .top-bar-title {
    font-size: 18px;
    color: #333;
    font-weight: 400;
}

/* --- Main Content --- */
.game-page .main-content {
    display: flex;
    padding: 24px;
    gap: 24px;
    flex: 1;
    flex-wrap: wrap;
}

.game-page .left-pane {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 600px;
}

.game-page .right-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 300px;
}

.game-page .pane-title {
    font-size: 28px;
    font-weight: 400;
    color: #111;
    margin-bottom: 16px;
    text-align: center;
}

/* --- Crossword Grid Wrapper & Container --- */
.game-page .crossword-wrapper {
    background-color: white;
    border: 1px solid #999;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    overflow: auto;
}

.game-page .grid-container {
    display: grid;
    grid-template-rows: repeat(var(--grid-rows), 28px);
    grid-template-columns: repeat(var(--grid-cols), 28px);
    gap: 0;
    background-color: transparent;
}

.game-page .cell {
    width: 28px;
    height: 28px;
    background-color: white;
    border-top: 1px solid #333;
    border-left: 1px solid #333;
    border-right: none;
    border-bottom: none;
    box-shadow: 1px 0 0 0 #333, 0 1px 0 0 #333, 1px 1px 0 0 #333;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Times New Roman', Times, serif;
    font-size: 16px;
    font-weight: bold;
    color: #000;
    position: relative;
    cursor: pointer;
    user-select: none;
    text-transform: uppercase;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.game-page .cell .num {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 10px;
    font-weight: normal;
    font-family: Arial, sans-serif;
    line-height: 1;
    color: #555;
}

/* --- Focus & Highlight states --- */
.game-page .cell.selected {
    background-color: #cce2ff !important;
    border-color: #5c58f1 !important;
    box-shadow: 1px 0 0 0 #5c58f1, 0 1px 0 0 #5c58f1, 1px 1px 0 0 #5c58f1, inset 0 0 0 1.5px #5c58f1;
    z-index: 10;
}

.game-page .cell.highlighted {
    background-color: #e6f2ff;
}

/* --- Hint Locked state --- */
.game-page .cell.hint-used {
    background-color: #e5e7eb !important;
    color: #4b5563;
    font-weight: normal;
    cursor: not-allowed;
}

/* --- Validation states --- */
.game-page .cell.correct {
    background-color: #d1fae5 !important;
    border-color: #10b981;
    box-shadow: 1px 0 0 0 #10b981, 0 1px 0 0 #10b981, 1px 1px 0 0 #10b981;
    color: #065f46;
}

.game-page .cell.incorrect {
    background-color: #fee2e2 !important;
    border-color: #ef4444;
    box-shadow: 1px 0 0 0 #ef4444, 0 1px 0 0 #ef4444, 1px 1px 0 0 #ef4444;
    color: #991b1b;
}

.game-page .cell.selected.correct {
    border-color: #10b981 !important;
    box-shadow: 1px 0 0 0 #10b981, 0 1px 0 0 #10b981, 1px 1px 0 0 #10b981, inset 0 0 0 1.5px #5c58f1;
}

.game-page .cell.selected.incorrect {
    border-color: #ef4444 !important;
    box-shadow: 1px 0 0 0 #ef4444, 0 1px 0 0 #ef4444, 1px 1px 0 0 #ef4444, inset 0 0 0 1.5px #5c58f1;
}

/* --- Controls --- */
.game-page .controls-area {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    padding: 10px 0;
    gap: 16px;
}

.game-page .hint-group {
    grid-column: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-page .action-group {
    grid-column: 2;
    display: flex;
    gap: 16px;
}

.game-page .btn {
    background-color: #5C58F1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.game-page .btn:hover {
    background-color: #4b48d6;
}

.game-page .btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.game-page .hint-text {
    color: #333;
    font-size: 16px;
    white-space: nowrap;
}

/* --- Dictionary panel --- */
.game-page .dictionary-container {
    background-color: #F3F4F6;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    min-height: 480px;
}

.game-page .dictionary-select {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background-color: #FFFFFF;
    font-size: 15px;
    color: #1F2937;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234B5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.game-page .dictionary-select:focus {
    border-color: #4D49FC;
    box-shadow: 0 0 0 3px rgba(77, 73, 252, 0.15);
}

.game-page .dictionary-list {
    padding: 12px;
    flex: 1;
    background-color: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    overflow-y: auto;
    max-height: 400px;
    min-height: 300px;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.game-page .dictionary-clue {
    margin-bottom: 6px;
    font-size: 15px;
    color: #1F2937;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}

.game-page .dictionary-clue:hover {
    background-color: #F3F4F6;
    color: #111827;
}

.game-page .dictionary-clue.active {
    background-color: #E0E7FF;
    color: #4D49FC;
    font-weight: 600;
}
