/* KN Games — Cuvinte în careu | player.css | v2.9.9 */

/* ╔══════════════════════════════════════════════════════════════════════════╗
   ║  OUTER — fără padding orizontal (tema WP se ocupă de marginile laterale)║
   ╚══════════════════════════════════════════════════════════════════════════╝ */

.knws-outer {
  position: relative;
  width: 100%;
  padding: 8px 0 20px;       /* doar breathing room sus-jos, nu lateral */
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  background: transparent;
}

/* ── Layout două coloane ─────────────────────────────────────────────────── */

.knws-columns {
  display: flex;
  align-items: stretch;
}

.knws-main {
  flex: 1 1 0;
  min-width: 0;
}

.knws-side {
  flex: 0 0 30%;
  width: 30%;
  padding-left: 16px;
  padding-top: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

/* ── Toolbar — identic cu Rebus ─────────────────────────────────────────── */

.knws-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 10px;
}

.knws-tb-group {
  display: flex;
  align-items: center;
  gap: 1px;
  background: rgba(204, 217, 245, 0.5);
  border-radius: 10px;
  padding: 3px;
}

.knws-btn {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #4d63a0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  padding: 0;
  flex-shrink: 0;
}
.knws-btn:hover  { background: rgba(96, 120, 182, 0.14); }
.knws-btn:active { transform: scale(.92); }
.knws-btn svg    { pointer-events: none; }

.knws-tb-sep {
  width: 1px;
  height: 20px;
  background: rgba(0, 0, 0, 0.12);
  margin: 0 3px;
  flex-shrink: 0;
}

/* ── Zona grilă — NORMAL MODE ───────────────────────────────────────────────
   Position: relative + overflow: hidden — wrapper-ul scalat e absolut înăuntru.
   min-height calculat de JS la init.                                        */

.knws-grid-area {
  position: relative;
  overflow: visible;
  width: 100%;
  min-height: 200px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Wrapper interior — scalat cu transform (ca la Rebus) */
.knws-grid-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  /* transform setat de JS */
}

/* ── Tabel + celule ──────────────────────────────────────────────────────── */

.knws-grid {
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
  background: transparent !important;
  border: none !important;
  outline: none !important;
}

.knws-grid td {
  /* Dimensiune fixată de JS pe fiecare td inline */
  text-align: center;
  vertical-align: middle;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;

  /* Reset complet cu !important — temele WP aplică adesea stiluri pe td */
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;

  /* Aspect identic cu celulele Rebus */
  background: #f2f2f2 !important;
  border: 2px solid #a0a8b8 !important;
  border-radius: 6px !important;
  box-shadow: 0 3px 8px rgba(0,0,0,.18),
              0 1px 2px rgba(0,0,0,.12),
              inset 0 1px 0 rgba(255,255,255,.85) !important;
  color: #1a1a1a !important;
  cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s;
}

.knws-grid td:hover {
  background: #e8e8e8 !important;
  border-color: #8898bb !important;
}

.knws-grid td.knws-selecting {
  background: #dce4f8 !important;
  border-color: #6078b6 !important;
  box-shadow: 0 0 0 2.5px rgba(96,120,182,.28) !important;
  color: #1a1a1a !important;
}

.knws-grid td.knws-wrong {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
  box-shadow: 0 1px 4px rgba(239,68,68,.3) !important;
  color: #991b1b !important;
}

.knws-grid.knws-grid-done,
.knws-grid.knws-grid-done td {
  pointer-events: none !important;
  cursor: default !important;
}

.knws-grid td.knws-cell-blank {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.knws-grid td.knws-found-cell {
  background: #16a34a !important;
  border-color: #15803d !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(22,163,74,.35) !important;
}

.knws-grid td.knws-hint-cell {
  background: #6078b6 !important;
  border-color: #4d63a0 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(96,120,182,.45) !important;
}

/* ── Lista cuvinte — pills ───────────────────────────────────────────────── */

.knws-words-area { width: 100%; }

.knws-word-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.knws-word {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #2c3e50;
  padding: 3px 9px;
  border: 1.5px solid #c5cee0;
  border-radius: 12px;
  background: #f5f7fb;
  cursor: default;
  white-space: nowrap;
  transition: all 0.2s;
}

.knws-word.knws-found {
  text-decoration: line-through;
  text-decoration-color: #16a34a;
  text-decoration-thickness: 2px;
  color: #94a3b8;
  border-color: #16a34a;
  background: #f0fdf4;
  opacity: 0.7;
}

/* ── Imaginea laterală ──────────────────────────────────────────────────── */

.knws-side-image img {
  width: 80%;
  height: auto;
  border-radius: 6px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.knws-lb-wrap {
  position: relative;
  display: block;
}

.knws-lb-trigger {
  cursor: zoom-in;
  display: block;
  width: 100%;
}

.knws-lb-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: rgba(0,0,0,.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.knws-lb-wrap:hover .knws-lb-btn {
  opacity: 1;
  pointer-events: auto;
}

/* ── Lightbox overlay ───────────────────────────────────────────────────── */

.knws-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  transition: opacity .25s ease;
}

.knws-lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  fill: #000;
  padding: 0;
  border-radius: 4px;
}
.knws-lb-close:hover { background: rgba(0,0,0,.08); }

.knws-lb-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  pointer-events: none;
  transform-origin: center center;
}

/* ── Hint tooltip ───────────────────────────────────────────────────────── */

.knws-hint-tooltip {
  position: absolute;
  top: 52px;
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.13);
  padding: 14px 16px 12px;
  max-width: 336px;
  font-size: 0.76rem;
  color: #334155;
  line-height: 1.5;
}
.knws-hint-tooltip strong { display: block; margin-bottom: 6px; font-size: 0.9rem; color: #1e293b; }
.knws-hint-tooltip p { margin: 0 0 5px; }
.knws-hint-tooltip p:last-child { margin-bottom: 0; }

.knws-hint-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 1rem; line-height: 1; padding: 0;
}
.knws-hint-close:hover { color: #475569; }

/* ╔══════════════════════════════════════════════════════════════════════════╗
   ║  FULLSCREEN NATIV :fullscreen + CSS PSEUDO .knws-css-full               ║
   ╚══════════════════════════════════════════════════════════════════════════╝ */

/* Reguli comune pentru ambele variante de fullscreen */
.knws-outer:-webkit-full-screen,
.knws-outer:fullscreen,
.knws-outer.knws-css-full {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  background-color: #ffffff !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  position: relative !important;       /* pentru pseudo + absolute children */
}

/* Overlay albăstrui subtil */
.knws-outer:-webkit-full-screen::before,
.knws-outer:fullscreen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(204, 217, 245, 0.35);
  pointer-events: none;
  z-index: 0;
}
.knws-outer:-webkit-full-screen > *,
.knws-outer:fullscreen > * {
  position: relative;
  z-index: 1;
}

/* Tooltip plutește absolut deasupra conținutului — excepție de la regula de mai sus */
.knws-outer:-webkit-full-screen > .knws-hint-tooltip,
.knws-outer:fullscreen > .knws-hint-tooltip,
.knws-outer.knws-css-full > .knws-hint-tooltip {
  position: absolute !important;
  z-index: 9999 !important;
  top: 62px !important;
  left: 16px !important;
}
/* CSS pseudo-fullscreen nu suportă ::before pe aceeași regulă — override */
.knws-outer.knws-css-full {
  background: linear-gradient(135deg, #eef3ff 0%, #f5f7ff 100%) !important;
}

/* Toolbar */
.knws-outer:-webkit-full-screen .knws-toolbar,
.knws-outer:fullscreen .knws-toolbar,
.knws-outer.knws-css-full .knws-toolbar {
  flex-shrink: 0 !important;
}

/* Columns: iau tot spațiul rămas */
.knws-outer:-webkit-full-screen > .knws-columns,
.knws-outer:fullscreen > .knws-columns,
.knws-outer.knws-css-full > .knws-columns {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  align-items: stretch !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}

/* Main: flex column, umple spațiul */
.knws-outer:-webkit-full-screen .knws-main,
.knws-outer:fullscreen .knws-main,
.knws-outer.knws-css-full .knws-main {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Grid area: ia tot spațiul vertical disponibil */
.knws-outer:-webkit-full-screen .knws-grid-area,
.knws-outer:fullscreen .knws-grid-area,
.knws-outer.knws-css-full .knws-grid-area {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow: visible !important;
  /* position: relative și grid-wrapper absolut — moștenite din stilul de bază */
}

/* Side — centrat vertical în fullscreen */
.knws-outer:-webkit-full-screen .knws-side,
.knws-outer:fullscreen .knws-side,
.knws-outer.knws-css-full .knws-side {
  overflow-y: auto !important;
  padding: 8px 0 8px 16px !important;
  justify-content: center !important;
}

/* Grid-area în fullscreen: fără border vizibil */
.knws-outer:-webkit-full-screen .knws-grid-area,
.knws-outer:fullscreen .knws-grid-area,
.knws-outer.knws-css-full .knws-grid-area {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* ── Banner felicitări + fraza secretă ──────────────────────────────────── */

.knws-banner {
  display: flex; align-items: center; gap: 6px;
  background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 8px;
  color: #2e7d32; font-weight: 700; font-size: 0.78rem;
  padding: 7px 10px; margin-bottom: 8px;
  animation: knws-fade-in 0.4s ease;
}

.knws-secret {
  padding: 8px 10px; background: #fff8e1;
  border: 1px solid #ffe082; border-radius: 8px;
  font-size: 0.72rem; color: #5d4037; line-height: 1.45;
  animation: knws-fade-in 0.5s ease 0.2s both;
}
.knws-secret-lbl { font-weight: 700; color: #e65100; display: block; margin-bottom: 3px; }

/* ── HUD dreapta toolbar ─────────────────────────────────────────────────── */

.knws-hud {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}
.knws-hud-q {
  font-size: .78rem;
  font-weight: 600;
  color: #4d63a0;
}
.knws-hud-score {
  font-size: .72rem;
  font-weight: 800;
  color: #8094c8;
}
.knws-hud-s {
  font-size: .72rem;
  color: #8094c8;
}

/* ── Buton blocat (modul ușor indisponibil) ─────────────────────────────── */

.knws-btn.knws-btn-locked {
  opacity: 0.35 !important;
  cursor: default !important;
  pointer-events: none !important;
}

/* ── Buton apăsat (sunet off) ────────────────────────────────────────────── */

.knws-btn.knws-pressed {
  background: rgba(96, 120, 182, 0.18) !important;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.15);
  color: #6b7280;
}

/* ── Felicitare finală (înlocuiește pills în coloana dreaptă) ────────────── */

.knws-congrats {
  text-align: center;
  padding: 4px 0 6px;
  animation: knws-fade-in 0.4s ease;
}
.knws-congrats-emoji {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 10px;
  display: block;
}
.knws-congrats-title {
  font-size: 19px !important;
  font-weight: 900 !important;
  color: #4d63a0 !important;
  letter-spacing: 1.5px !important;
  margin: 0 0 10px !important;
  padding: 0 !important;
  border: none !important;
  line-height: 1.2 !important;
  font-family: 'Segoe UI', system-ui, sans-serif !important;
}
.knws-congrats-score {
  font-size: 20px !important;
  font-weight: 800 !important;
  color: #6078b6 !important;
  margin: 0 0 5px !important;
  padding: 0 !important;
  font-family: 'Segoe UI', system-ui, sans-serif !important;
}
.knws-congrats-grade {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #4d63a0 !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
  font-family: 'Segoe UI', system-ui, sans-serif !important;
}

.knws-restart-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: #6078b6;
  color: #fff !important;
  border: none;
  border-radius: 8px;
  font-size: 14px !important;
  font-weight: 700 !important;
  font-family: 'Segoe UI', system-ui, sans-serif !important;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none !important;
}
.knws-restart-btn:hover  { background: #4d63a0; color: #fff !important; }
.knws-restart-btn:active { transform: scale(.94); }

/* ── Provocare suplimentară ─────────────────────────────────────────────── */

.knws-challenge-section {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  padding: 6px 0 8px;
  text-align: center;
}
.knws-challenge-section.knws-challenge-visible {
  opacity: 1;
  transform: translateY(0);
}

.knws-challenge-text {
  font-size: 0.82rem;
  color: #475569;
  margin: 0 0 14px;
  line-height: 1.5;
  font-style: italic;
}

.knws-challenge-input-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Input fraza secretă — stil identic cu .knr-ch-inp din Rebus */
.knws-challenge-input {
  width: 200px;        /* valoare inițială; JS suprascrie la fiecare tastare */
  max-width: 100%;     /* nu depășește wrapperul */
  box-sizing: border-box !important;
  padding: 0 16px !important;
  height: 52px !important;
  border: 2px solid #96aadc !important;
  border-radius: 7px !important;
  background: #f5f7fd !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #1a1a1a !important;
  outline: none !important;
  transition: border-color .12s, background .12s;
  -webkit-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;
}
.knws-challenge-input:focus {
  border-color: #6078b6 !important;
  background: #eef1fb !important;
}
.knws-challenge-input.knws-challenge-correct {
  border-color: #16a34a !important;
  background: #dcfce7 !important;
  color: #15803d !important;
  cursor: default !important;
}

/* Oglindă ascunsă pentru calcul lățime auto */
.knws-challenge-mirror {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  font-size: 20px !important;
  font-weight: 800 !important;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;
  letter-spacing: 0.08em !important;
  pointer-events: none;
}

/* Fraza de final — sub fraza revelată */
.knws-fraza-final {
  font-size: 14px; /* 70% din 20px al frazei revelate */
  font-weight: 800;
  color: #15803d;
  letter-spacing: 0.06em;
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}

/* Text revelat după rezolvare */
.knws-challenge-revealed {
  font-size: 20px;
  font-weight: 800;
  color: #15803d;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 10px 16px;
  border: 2px solid #16a34a;
  border-radius: 7px;
  background: #dcfce7;
  line-height: 1.4;
  max-width: 100%;
  word-break: break-word;
  animation: knws-fade-in 0.4s ease;
}

/* ── Mod provocare: celulele găsite devin semitransparente ────────────────── */

.knws-challenge-mode .knws-grid td.knws-found-cell {
  opacity: 0.45 !important;
}

/* Celulă în scanare secvențială (indicație vizuală pentru fraza secretă) */
.knws-grid td.knws-cell-scanning {
  background: #fef3c7 !important;
  border-color: #fde68a !important;
  color: #92400e !important;
  box-shadow: 0 0 8px rgba(251,191,36,.28) !important;
}

/* ── Eroare ─────────────────────────────────────────────────────────────── */
.knws-error { color: #c62828; font-style: italic; }

/* ── Animații ───────────────────────────────────────────────────────────── */
@keyframes knws-fade-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 840px) {
  .knws-columns { flex-direction: column; align-items: stretch; }
  .knws-main    { width: 100%; }
  .knws-side    { flex: none; width: 100%; padding-left: 0; padding-top: 12px; }
}
