/* table-game.css */

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #eef5ef;
    color: #18281e;
}

.table-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

.table-shell {
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: #1e733c;
    text-decoration: none;
    font-weight: 700;
}

h1 {
    margin: 0 0 10px 0;
    font-size: 40px;
}

p {
    margin: 0 0 28px 0;
    color: #486052;
    font-size: 18px;
}

.table-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 30px;
    align-items: start;
}

.table-card,
.card-bank-panel {
    background: #f1f7f1;
    border: 1px solid #cfdfd1;
    border-radius: 22px;
    padding: 24px;
}

.table-grid {
    display: grid;
    border: 2px solid #789883;
    background: white;
    border-radius: 14px;
    overflow: hidden;
}

.table-header,
.table-cell {
    overflow-wrap: anywhere;
}

.table-header {
    background: #d8ecdc;
    padding: 18px;
    font-size: 22px;
    font-weight: 900;
    border-right: 2px solid #789883;
    border-bottom: 2px solid #789883;
}

.table-header:last-child {
    border-right: none;
}

.table-cell {
    min-height: 72px;
    padding: 14px 18px;
    border-right: 2px solid #789883;
    border-bottom: 2px solid #789883;
    display: flex;
    align-items: center;
    font-size: 20px;
    box-sizing: border-box;
}

.table-cell:nth-child(2n) {
    border-right: none;
}

.filled-cell {
    background: white;
    font-weight: 700;
}

.drop-cell {
    flex-wrap: wrap;
    gap: 8px;
    align-content: center;
    background: #edf6ee;
    justify-content: center;
}

.drop-cell::before {
    content: "Drop answer here";
    color: #496756;
    font-size: 14px;
    font-weight: 700;
}

.drop-cell:has(.draggable-card)::before {
    display: none;
}

.drop-cell.correct {
    background: #e9f9ef;
}

.drop-cell.incorrect {
    background: #fdecec;
}

.card-bank-panel {
    position: sticky;
    top: 24px;
}

.card-bank-panel h2 {
    margin: 0 0 18px 0;
    font-size: 26px;
}

.card-bank {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 160px;
    margin-bottom: 24px;
}

.draggable-card {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    background: white;
    border: 2px solid #bbd1bf;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 20px;
    font-weight: 900;
    cursor: grab;
    text-align: center;
    user-select: none;
}

.draggable-card:active {
    cursor: grabbing;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.primary-btn,
.secondary-btn {
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.primary-btn {
    border: none;
    background: #1e733c;
    color: white;
}

.secondary-btn {
    background: white;
    color: #1e733c;
    border: 2px solid #1e733c;
}

.status-text {
    margin-top: 18px;
    min-height: 24px;
    font-weight: 800;
}

@media (max-width: 900px) {
    .table-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .card-bank-panel {
        position: static;
    }

    .card-bank {
        flex-direction: row;
        flex-wrap: wrap;
    }
}


.draggable-card.card-correct {
    border-color: #237648;
    background: #e9f9ef;
}

.draggable-card.card-correct::after {
    content: " ✓";
    color: #237648;
    font-weight: 900;
}

.draggable-card.card-incorrect {
    border-color: #e53935;
    background: #fdecec;
}

.draggable-card.card-incorrect::after {
    content: " ✕";
    color: #e53935;
    font-weight: 900;
}

.game-mode-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin: 20px 0 24px;
    background: #f1f7f1;
    border: 1px solid #cfdfd1;
    border-radius: 16px;
    padding: 14px 18px;
}

.mode-toggle {
    display: flex;
    gap: 10px;
}

.mode-btn {
    border: 2px solid #bbd1bf;
    background: white;
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 900;
    cursor: pointer;
}

.mode-btn.active {
    background: #1e733c;
    border-color: #1e733c;
    color: white;
}

.timer-display {
    font-size: 20px;
    font-weight: 900;
    color: #18281e;
}

.difficulty-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin: 0 0 24px;
    background: #f1f7f1;
    border: 1px solid #cfdfd1;
    border-radius: 16px;
    padding: 14px 18px;
    font-weight: 900;
}

.difficulty-toggle {
    display: flex;
    gap: 10px;
}

.difficulty-btn {
    border: 2px solid #bbd1bf;
    background: white;
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 900;
    cursor: pointer;
}

.difficulty-btn.active {
    background: #1e733c;
    border-color: #1e733c;
    color: white;
}

.input-cell {
    background: #edf6ee;
    justify-content: center;
}

.answer-input {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    border: 2px solid #bbd1bf;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}

.answer-input.input-correct {
    border-color: #237648;
    background: #e9f9ef;
}

.answer-input.input-incorrect {
    border-color: #e53935;
    background: #fdecec;
}

.typing-mode-message {
    background: #e6f3e9;
    border: 1px solid #bcdac4;
    color: #205c36;
    border-radius: 14px;
    padding: 16px;
    font-weight: 800;
    line-height: 1.4;
}

.mode-btn:disabled,
.difficulty-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.back-link:hover { text-decoration: underline; }
.primary-btn:hover, .mode-btn.active:hover, .difficulty-btn.active:hover { background: #175e31; }
.table-shell :focus-visible { outline: 3px solid #237648; outline-offset: 3px; }
