/* Kelime Bulmaca — 8×8 sürükle-bırak kelime arama */
.page-kelime-izgarasi-oyunu .game-content-section {
    padding-top: 0.5rem;
    margin-top: 0 !important;
}

/* Kelime tahmin başlangıç formu: wordle-setting-block ile aynı dikey boşluk ve ayırıcı çizgi */
.page-kelime-izgarasi-oyunu .wordsearch-setup-form > fieldset {
    border: none;
    padding: 0 0 1rem 0;
    margin: 0 0 5px 0;
    border-bottom: 1px solid #dee2e6;
}

/* Kelime tahmin — Nasıl Oynanır kart gövdesi ile aynı iç kenar boşluğu */
.page-kelime-izgarasi-oyunu .how-to-play-card > .card-body {
    padding: var(--bs-card-spacer-y, 1rem) var(--bs-card-spacer-x, 1rem);
}

/* Kelime tahmin oyun kartı gövdesi (p-5 olmayan): standart kart padding */
.page-kelime-izgarasi-oyunu .game-content-section .col-lg-8 > .card > .card-body:not(.wordsearch-start-card-body) {
    padding: var(--bs-card-spacer-y, 1rem) var(--bs-card-spacer-x, 1rem);
}

/* Kelime tahmin oyun başlangıç metni ile aynı tipografi (wordle-intro-text ile eşdeğer) */
.wordsearch-start-card-body {
    padding-top: 2.5px !important;
    padding-bottom: 0.375rem !important;
}

.wordsearch-intro-text {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.wordsearch-intro-text .lead {
    font-size: inherit;
    line-height: 1.5;
}

/* Hafıza görselleri — ızgara kutusu (padding + köşeler) ile aynı boyutta, görsel kutuyu tam doldurur */
.wordsearch-grid-bg-wrap {
    --wordsearch-bg-opacity: 0.52;
    width: 100%;
    max-width: min(96vw, var(--ws-grid-max, 640px));
    margin-left: auto;
    margin-right: auto;
    border-radius: 12px;
}
/* Rastgele görsel: kart gövdesi yatay dolgusunu aşarak satırı (oyun sütunu) kenardan kenara kaplar; ızgara aynı max genişlikte ortada kalır */
.page-kelime-izgarasi-oyunu .wordsearch-grid-bg-wrap.wordsearch-has-bg {
    max-width: none;
    width: calc(100% + 2 * var(--bs-card-spacer-x, 1rem));
    margin-left: calc(-1 * var(--bs-card-spacer-x, 1rem));
    margin-right: calc(-1 * var(--bs-card-spacer-x, 1rem));
    border-radius: 12px;
}
/* Ara sarmalayıcıları devre dışı: yükseklik/genişlik yalnızca #wordsearch-grid’den gelir; arka plan tüm kutuyla örtüşür */
.wordsearch-grid-bg-wrap.wordsearch-has-bg .wordsearch-grid-bg-foreground,
.wordsearch-grid-bg-wrap.wordsearch-has-bg .wordsearch-wrap {
    display: contents;
}
.wordsearch-grid-bg-wrap .wordsearch-bg-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 12px;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: var(--wordsearch-bg-opacity);
    pointer-events: none;
}
.wordsearch-grid-bg-wrap .wordsearch-bg-scrim {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.62);
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.wordsearch-grid-bg-wrap:not(.wordsearch-has-bg) .wordsearch-bg-scrim {
    opacity: 0;
}
.wordsearch-grid-bg-wrap .wordsearch-grid-bg-foreground {
    z-index: 1;
}

.wordsearch-wrap {
    width: 100%;
    max-width: min(96vw, var(--ws-grid-max, 640px));
    margin: 0 auto;
}

/* N×N eşit 1fr izler + kare kutu → her hücre alanı tam kare; dış boyut seçilen N’ye göre (--ws-grid-max) */
.wordsearch-grid {
    display: grid;
    width: 100%;
    max-width: min(96vw, var(--ws-grid-max, 640px));
    box-sizing: border-box;
    grid-template-columns: repeat(var(--ws-cols, 8), minmax(0, 1fr));
    grid-template-rows: repeat(var(--ws-rows, 8), minmax(0, 1fr));
    gap: 4px;
    padding: 10px;
    background: linear-gradient(145deg, #0E5952 0%, #148579 100%);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    aspect-ratio: 1 / 1;
    max-height: min(92vw, var(--ws-grid-max, 580px));
    margin-left: auto;
    margin-right: auto;
}

.wordsearch-grid-bg-wrap.wordsearch-has-bg .wordsearch-grid {
    background: transparent;
    position: relative;
    z-index: 1;
}

.wordsearch-setup-form #wordsearch-size-select {
    max-width: 20rem;
}

.wordsearch-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: clamp(0.48rem, min(3.2vw, 3.2vh), 1.12rem);
    background: #fff;
    color: #0E5952;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.wordsearch-cell:hover {
    background: #e8f5f3;
}

.wordsearch-cell.ws-drag-over {
    background: #b8e0d9;
}

.wordsearch-cell.ws-found {
    background: #d4edda;
    color: #155724;
}

/* Sürükleyerek seçim — turuncu; daha önce bulunmuş (yeşil) hücrelerin üzerinden geçerken de aynı turuncu */
.wordsearch-cell.ws-selecting,
.wordsearch-cell.ws-found.ws-selecting {
    background: #fd7e14 !important;
    color: #fff !important;
}

.wordsearch-cell.ws-invalid-flash {
    animation: ws-invalid 0.35s ease;
}

@keyframes ws-invalid {
    0%, 100% { background: #fff; }
    50% { background: #f8d7da; }
}

.wordsearch-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: center;
    margin-top: 1.25rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px dashed #dee2e6;
}

.wordsearch-word-tag {
    font-weight: 600;
    font-size: 0.95rem;
    color: #0E5952;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    background: #fff;
    border: 2px solid #148579;
}

.wordsearch-word-tag.found {
    text-decoration: line-through;
    opacity: 0.65;
    border-color: #28a745;
    color: #155724;
    background: #d4edda;
}

.wordsearch-stats-bar {
    background: linear-gradient(135deg, #148579 0%, #0E5952 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.wordsearch-stats-bar .stat-pill {
    text-align: center;
}

.wordsearch-stats-bar .stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    display: block;
    line-height: 1.2;
}

.wordsearch-stats-bar .stat-label {
    font-size: 0.85rem;
    opacity: 0.95;
}

.wordsearch-win-banner {
    display: none;
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
    line-height: 1.45;
}

.wordsearch-win-banner.show {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    text-align: center;
}

/* Oyunu bitir — site teal paleti ve üst istatistik çubuğu ile uyumlu */
.wordsearch-win-banner.wordsearch-finish-reveal {
    background: linear-gradient(135deg, #148579 0%, #0E5952 100%);
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.14);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.wordsearch-win-banner.show:not(.wordsearch-finish-reveal) i {
    font-size: 1.35rem;
    flex-shrink: 0;
}

.wordsearch-win-banner.wordsearch-finish-reveal i {
    font-size: 1.35rem;
    opacity: 0.95;
    flex-shrink: 0;
}

/* Oyunu bitir ile açığa çıkan kelimeler — sarı yerine site teal tonları */
.wordsearch-cell.ws-revealed {
    background: #d5e8e6 !important;
    color: #0E5952 !important;
    box-shadow: inset 0 0 0 2px rgba(20, 133, 121, 0.55);
}

#wordsearch-grid.wordsearch-grid-disabled {
    pointer-events: none;
    opacity: 0.9;
}

.wordsearch-found-meanings-title {
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    line-height: 1.4;
}

.wordsearch-found-meanings .wordsearch-meanings-table {
    --bs-table-bg: transparent;
    --bs-table-border-color: transparent;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9375rem;
}

.wordsearch-found-meanings .wordsearch-meanings-table > :not(caption) > * > * {
    border-left-width: 0 !important;
    border-right-width: 0 !important;
    border-top-width: 0 !important;
    box-shadow: none;
}

.wordsearch-found-meanings .wordsearch-meanings-table thead.wordsearch-meanings-thead th {
    background: #d8ebe8;
    color: #0E5952;
    font-weight: 600;
    border: 0;
    border-bottom: 1px solid rgba(14, 89, 82, 0.2);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.wordsearch-found-meanings .wordsearch-meanings-table thead.wordsearch-meanings-thead th:first-child {
    border-radius: 8px 0 0 0;
}

.wordsearch-found-meanings .wordsearch-meanings-table thead.wordsearch-meanings-thead th:last-child {
    border-radius: 0 8px 0 0;
}

.wordsearch-found-meanings .wordsearch-meanings-table tbody td {
    border-left: 0;
    border-right: 0;
    border-top: 0;
    border-bottom: 1px solid rgba(14, 89, 82, 0.16);
    vertical-align: top;
}

.wordsearch-found-meanings .wordsearch-meanings-table .wordsearch-meanings-icon-col,
.wordsearch-found-meanings .wordsearch-meanings-table .wordsearch-meanings-icon-cell {
    width: 2.75rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    vertical-align: middle;
}

/* Tablo satırları — bulunan: yeşil; bulunamayan: ızgara .ws-revealed ile aynı teal ton */
.wordsearch-found-meanings .wordsearch-meanings-table tbody tr.wordsearch-mean-row--found td {
    background-color: #d4edda;
    color: #155724;
}

.wordsearch-found-meanings .wordsearch-meanings-table tbody tr.wordsearch-mean-row--found .wordsearch-meanings-icon-cell {
    background-color: #d4edda;
}

.wordsearch-found-meanings .wordsearch-meanings-table tbody tr.wordsearch-mean-row--revealed td {
    background-color: #d5e8e6;
    color: #0E5952;
}

.wordsearch-found-meanings .wordsearch-meanings-table tbody tr.wordsearch-mean-row--revealed .wordsearch-meanings-icon-cell {
    background-color: #d5e8e6;
}

.wordsearch-mean-icon {
    color: #155724;
}

.wordsearch-mean-row--revealed .wordsearch-mean-icon,
.wordsearch-mean-icon.wordsearch-mean-icon--revealed {
    color: #148579;
}

@media (max-width: 576px) {
    .wordsearch-grid {
        gap: 3px;
        padding: 8px;
    }
}
