/* ═══════════════════════════════════════════════
   CT Game Gali Plugin — style.css
   Chhapra Today Brand: Red #c0392b / White / Black
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;600;700;800&family=Poppins:wght@400;600;700;800&display=swap');

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ctg-red:      #c0392b;
  --ctg-red-d:    #922b21;
  --ctg-orange:   #ff8c42;
  --ctg-black:    #1a1a1a;
  --ctg-gray:     #6b7280;
  --ctg-border:   #e5e7eb;
  --ctg-white:    #ffffff;
  --ctg-shadow:   0 2px 16px rgba(0,0,0,0.08);
  --ctg-radius:   14px;
  --ctg-font:     'Poppins','Noto Sans Devanagari',sans-serif;
}

/* ════════════════════════════════════════════
   WIDGET — home-page strip
════════════════════════════════════════════ */
.ctg-widget {
  font-family: var(--ctg-font);
  padding: 4px 0 16px;
}

.ctg-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ctg-widget-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ctg-black);
}

.ctg-title-icon { font-size: 1.3rem; }

.ctg-title-text {
  background: linear-gradient(135deg, var(--ctg-red), #e74c3c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ctg-more-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ctg-gray);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: color 0.2s;
}
.ctg-more-link:hover { color: var(--ctg-red); text-decoration: none; }
.ctg-arrow { font-size: 1rem; }

/* Strip */
.ctg-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 700px) {
  .ctg-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
  .ctg-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* Widget Card */
.ctg-card {
  background: var(--gb, #f5f5f5);
  border-radius: var(--ctg-radius);
  overflow: hidden;
  border: 2px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--ctg-shadow);
}
.ctg-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
  border-color: var(--gc);
}

.ctg-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px 14px;
  gap: 12px;
}

.ctg-card-preview {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctg-card-preview svg { width: 80px; height: 80px; }

.ctg-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.ctg-card-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ctg-black);
  text-align: center;
}

/* Play button — orange like screenshot */
.ctg-play-btn {
  display: block;
  width: 100%;
  background: var(--ctg-orange);
  color: white;
  text-align: center;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  font-family: var(--ctg-font);
  letter-spacing: 0.2px;
}
.ctg-play-btn:hover {
  background: #e67e2e;
  transform: scale(1.03);
  text-decoration: none;
  color: white;
}

/* ════════════════════════════════════════════
   ALL GAMES PAGE
════════════════════════════════════════════ */
.ctg-all-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.ctg-all-card {
  background: var(--gb, #f5f5f5);
  border-radius: var(--ctg-radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  box-shadow: var(--ctg-shadow);
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}
.ctg-all-card:hover { transform: translateY(-3px); border-color: var(--gc); }

.ctg-all-preview {
  width: 80px; height: 80px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}
.ctg-all-preview svg { width: 80px; height: 80px; }

.ctg-all-info { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ctg-all-name { font-size: 1.05rem; font-weight: 800; color: var(--ctg-black); }
.ctg-all-desc { font-size: 0.78rem; color: var(--ctg-gray); line-height: 1.5; }

/* ════════════════════════════════════════════
   GAME PAGE LAYOUT
════════════════════════════════════════════ */
.ctg-page-wrap {
  font-family: var(--ctg-font);
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.ctg-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--ctg-gray); margin-bottom: 20px;
}
.ctg-breadcrumb a { color: var(--ctg-red); text-decoration: none; font-weight: 600; }
.ctg-breadcrumb a:hover { text-decoration: underline; }

.ctg-page-hero {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(135deg, var(--pg-color,#c0392b), color-mix(in srgb, var(--pg-color,#c0392b) 60%,#fff));
  color: white; border-radius: var(--ctg-radius);
  padding: 22px 28px; margin-bottom: 24px;
}
.ctg-page-hero-icon {
  font-size: 2.8rem; width: 68px; height: 68px;
  background: rgba(255,255,255,0.2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ctg-page-title { font-size: clamp(1.3rem,3vw,1.9rem); font-weight: 800; color: #fff; margin-bottom: 4px; }
.ctg-page-subtitle { font-size: 0.88rem; opacity: 0.9; color: #fff; }

.ctg-page-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 22px;
  align-items: start;
}
@media (max-width: 820px) { .ctg-page-layout { grid-template-columns: 1fr; } }

/* Game Card */
.ctg-game-card {
  background: white;
  border-radius: var(--ctg-radius);
  box-shadow: var(--ctg-shadow);
  overflow: hidden;
  border: 1px solid var(--ctg-border);
}
.ctg-game-card-head {
  background: linear-gradient(135deg, var(--pg-color,#c0392b), color-mix(in srgb,var(--pg-color,#c0392b) 70%,#fff));
  color: #fff; padding: 16px 22px;
  font-size: 0.95rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.ctg-game-body { padding: 20px; min-height: 420px; }

/* Loading */
.ctg-loading-game {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 60px 20px;
  color: var(--ctg-gray); font-size: 0.9rem;
}
.ctg-spinner {
  width: 36px; height: 36px;
  border: 4px solid var(--ctg-border);
  border-top-color: var(--pg-color, var(--ctg-red));
  border-radius: 50%;
  animation: ctgSpin 0.7s linear infinite;
}
@keyframes ctgSpin { to { transform: rotate(360deg); } }

/* Sidebar */
.ctg-page-sidebar { display: flex; flex-direction: column; gap: 18px; }

.ctg-how-box, .ctg-other-box {
  background: white; border-radius: var(--ctg-radius);
  box-shadow: var(--ctg-shadow); overflow: hidden;
  border: 1px solid var(--ctg-border);
}
.ctg-how-head, .ctg-other-head {
  background: var(--ctg-black); color: white;
  padding: 11px 16px; font-size: 0.82rem;
  font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
}
.ctg-how-body { padding: 16px; font-size: 0.84rem; line-height: 1.8; color: #374151; }
.ctg-how-body ol { padding-left: 18px; }
.ctg-how-body li { margin-bottom: 6px; }
.ctg-how-body strong { color: var(--ctg-black); }

.ctg-other-list { display: flex; flex-direction: column; gap: 1px; background: var(--ctg-border); }
.ctg-other-game-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--rb,#f5f5f5);
  text-decoration: none; transition: filter 0.15s;
  border-left: 4px solid var(--rc,#ccc);
}
.ctg-other-game-card:hover { filter: brightness(0.96); text-decoration: none; }
.ctg-other-game-icon { font-size: 1.5rem; flex-shrink: 0; }
.ctg-other-game-name { font-size: 0.88rem; font-weight: 700; color: var(--ctg-black); }
.ctg-other-game-desc { font-size: 0.72rem; color: var(--ctg-gray); }

/* ════════════════════════════════════════════
   SUDOKU GAME UI
════════════════════════════════════════════ */
.ctg-sudoku-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ctg-sudoku-meta {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 400px;
}
.ctg-sudoku-info { font-size: 0.82rem; color: var(--ctg-gray); font-weight: 600; }
.ctg-sudoku-timer {
  font-size: 1rem; font-weight: 800; color: var(--ctg-black);
  font-variant-numeric: tabular-nums;
  background: #f0f4f8; padding: 4px 12px; border-radius: 20px;
}
.ctg-sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 3px solid #4a7c59;
  border-radius: 4px;
  overflow: hidden;
  width: min(100%, 400px);
  aspect-ratio: 1;
}
.ctg-s-cell {
  border: 1px solid #c8d8c8;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(0.7rem,2vw,1rem);
  font-weight: 700; cursor: pointer;
  transition: background 0.15s;
  aspect-ratio: 1;
  position: relative;
  user-select: none;
}
.ctg-s-cell.given    { color: #1a1a1a; background: #e8f5e9; cursor: default; }
.ctg-s-cell.user     { color: #4a7c59; background: white; }
.ctg-s-cell.selected { background: #c8e6c9 !important; }
.ctg-s-cell.error    { color: #c0392b !important; background: #ffebee !important; }
.ctg-s-cell.highlight{ background: #f1f8e9; }
/* Thick borders for 3x3 boxes */
.ctg-s-cell:nth-child(3n)   { border-right: 2px solid #4a7c59; }
.ctg-s-cell:nth-child(9n)   { border-right: none; }
.ctg-sudoku-grid .ctg-s-cell:nth-child(n+19):nth-child(-n+27),
.ctg-sudoku-grid .ctg-s-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid #4a7c59; }

.ctg-sudoku-numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  width: min(100%, 400px);
}
.ctg-numpad-btn {
  background: white; border: 2px solid #4a7c59;
  border-radius: 8px; padding: 10px 4px;
  font-size: 1rem; font-weight: 700; color: #4a7c59;
  cursor: pointer; font-family: var(--ctg-font);
  transition: all 0.15s;
}
.ctg-numpad-btn:hover { background: #4a7c59; color: white; transform: scale(1.05); }

.ctg-sudoku-erase {
  background: #fff3e0; border: 2px solid #e67e22;
  border-radius: 8px; padding: 8px 20px;
  font-size: 0.85rem; font-weight: 700; color: #e67e22;
  cursor: pointer; font-family: var(--ctg-font);
}

.ctg-game-controls {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.ctg-btn-primary {
  background: linear-gradient(135deg,#c0392b,#e74c3c);
  color: white; border: none; border-radius: 8px;
  padding: 10px 22px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: var(--ctg-font);
  transition: all 0.2s;
}
.ctg-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(192,57,43,0.35); }
.ctg-btn-secondary {
  background: white; color: var(--ctg-black);
  border: 2px solid var(--ctg-border);
  border-radius: 8px; padding: 10px 22px;
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; font-family: var(--ctg-font);
  transition: all 0.2s;
}
.ctg-btn-secondary:hover { border-color: var(--ctg-red); color: var(--ctg-red); }

.ctg-difficulty {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.ctg-diff-btn {
  padding: 6px 16px; border-radius: 20px; font-size: 0.8rem;
  font-weight: 700; cursor: pointer; border: 2px solid var(--ctg-border);
  background: white; color: var(--ctg-gray); font-family: var(--ctg-font);
  transition: all 0.15s;
}
.ctg-diff-btn.active,
.ctg-diff-btn:hover { border-color: #4a7c59; background: #4a7c59; color: white; }

/* ════════════════════════════════════════════
   TIC-TAC-TOE GAME UI
════════════════════════════════════════════ */
.ctg-ttt-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ctg-ttt-score {
  display: flex; gap: 20px; align-items: center;
}
.ctg-ttt-score-item {
  text-align: center;
  background: #f9fafb;
  border-radius: 10px;
  padding: 8px 20px;
  min-width: 70px;
}
.ctg-ttt-score-item.active-player { background: #fff3e0; border: 2px solid #e07b39; }
.ctg-ttt-score-label { font-size: 0.7rem; font-weight: 700; color: var(--ctg-gray); text-transform: uppercase; }
.ctg-ttt-score-val { font-size: 1.4rem; font-weight: 800; color: var(--ctg-black); }
.ctg-ttt-score-sep { font-size: 1.2rem; color: var(--ctg-gray); }

.ctg-ttt-status {
  font-size: 1rem; font-weight: 700;
  padding: 8px 20px; border-radius: 20px;
  background: #fff3e0; color: #e07b39;
  min-height: 38px; display: flex; align-items: center;
}

.ctg-ttt-board {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; width: min(100%, 320px);
}
.ctg-ttt-cell {
  aspect-ratio: 1;
  background: white;
  border: 3px solid #e07b39;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(2rem,8vw,3rem);
  font-weight: 900; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}
.ctg-ttt-cell:hover:empty { background: #fff3e0; }
.ctg-ttt-cell.x-mark { color: #4a7c59; }
.ctg-ttt-cell.o-mark { color: #e07b39; }
.ctg-ttt-cell.win-cell { background: #fff3e0; animation: ctgPulse 0.5s ease; }
@keyframes ctgPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.ctg-ttt-mode {
  display: flex; gap: 8px;
}
.ctg-mode-btn {
  padding: 7px 16px; border-radius: 20px; font-size: 0.8rem;
  font-weight: 700; cursor: pointer;
  border: 2px solid var(--ctg-border);
  background: white; color: var(--ctg-gray);
  font-family: var(--ctg-font); transition: all 0.15s;
}
.ctg-mode-btn.active, .ctg-mode-btn:hover {
  border-color: #e07b39; background: #e07b39; color: white;
}

/* ════════════════════════════════════════════
   WORD SEARCH (SHABDKHOJ) GAME UI
════════════════════════════════════════════ */
.ctg-ws-wrap { display: flex; flex-direction: column; gap: 16px; }
.ctg-ws-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 560px) { .ctg-ws-layout { grid-template-columns: 1fr; } }

.ctg-ws-grid-outer {
  border: 3px solid #7c5cbf;
  border-radius: 8px;
  overflow: hidden;
  display: inline-block;
}
.ctg-ws-grid {
  display: grid;
  gap: 0;
  user-select: none;
}
.ctg-ws-cell {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
  border: 1px solid #e8d5f5;
  cursor: pointer;
  transition: background 0.1s;
  color: #1a1a1a;
  font-family: 'Noto Sans Devanagari', sans-serif;
}
.ctg-ws-cell:hover   { background: #e8d5f5; }
.ctg-ws-cell.selecting { background: #ce93d8; color: white; }
.ctg-ws-cell.found   { background: #7c5cbf; color: white; font-weight: 900; }

.ctg-ws-words { display: flex; flex-direction: column; gap: 8px; }
.ctg-ws-words-title {
  font-size: 0.78rem; font-weight: 700;
  color: var(--ctg-gray); text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.ctg-ws-word-item {
  font-size: 0.9rem; font-weight: 700;
  color: #4a148c;
  padding: 5px 12px; background: #f3e5f5;
  border-radius: 6px; border-left: 4px solid #7c5cbf;
  font-family: 'Noto Sans Devanagari', sans-serif;
  transition: all 0.2s;
}
.ctg-ws-word-item.found {
  background: #7c5cbf; color: white;
  text-decoration: line-through; opacity: 0.7;
}

.ctg-ws-progress {
  font-size: 0.82rem; color: var(--ctg-gray); font-weight: 600;
  text-align: center;
}

/* ════════════════════════════════════════════
   CROSSWORD GAME UI
════════════════════════════════════════════ */
.ctg-cw-wrap { display: flex; flex-direction: column; gap: 16px; }
.ctg-cw-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 600px) { .ctg-cw-layout { grid-template-columns: 1fr; } }

.ctg-cw-grid-outer {
  border: 3px solid #546e7a;
  border-radius: 8px;
  overflow: hidden;
  display: inline-block;
}
.ctg-cw-grid { display: grid; gap: 0; user-select: none; }
.ctg-cw-cell {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700;
  border: 1px solid #b0bec5;
  position: relative;
  font-family: 'Noto Sans Devanagari', sans-serif;
}
.ctg-cw-cell.black { background: #263238; border-color: #263238; cursor: default; }
.ctg-cw-cell.white { background: white; cursor: pointer; }
.ctg-cw-cell.white:hover { background: #eceff1; }
.ctg-cw-cell.active { background: #b2dfdb !important; }
.ctg-cw-cell.highlight { background: #e0f2f1; }
.ctg-cw-cell.correct { background: #c8e6c9 !important; color: #2e7d32; }
.ctg-cw-cell.wrong   { background: #ffcdd2 !important; color: #c62828; }

.ctg-cw-cell .ctg-cw-num {
  position: absolute; top: 1px; left: 2px;
  font-size: 0.45rem; font-weight: 700;
  color: #546e7a; line-height: 1; font-family: 'Poppins', sans-serif;
}
.ctg-cw-cell input {
  width: 100%; height: 100%; border: none; outline: none;
  text-align: center; font-size: 0.9rem; font-weight: 700;
  background: transparent; cursor: pointer;
  font-family: 'Noto Sans Devanagari', sans-serif;
  color: #1a1a1a; padding: 0;
  caret-color: transparent;
}

.ctg-cw-clues { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.ctg-cw-clue-section { background: #f8f9fa; border-radius: 8px; padding: 12px; }
.ctg-cw-clue-title {
  font-size: 0.78rem; font-weight: 800; color: #546e7a;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 2px solid #546e7a;
}
.ctg-cw-clue-item {
  font-size: 0.82rem; color: #374151; line-height: 1.6;
  padding: 4px 6px; border-radius: 4px;
  cursor: pointer; font-family: 'Noto Sans Devanagari', sans-serif;
  transition: background 0.15s;
}
.ctg-cw-clue-item:hover { background: #e0f2f1; }
.ctg-cw-clue-item.active { background: #b2dfdb; font-weight: 700; }
.ctg-cw-clue-item.solved { color: #4caf50; }
.ctg-cw-clue-num { font-weight: 800; color: #546e7a; margin-right: 4px; }

/* Win overlay */
.ctg-win-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  animation: ctgFadeIn 0.3s ease;
}
@keyframes ctgFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ctg-win-box {
  background: white; border-radius: 20px;
  padding: 40px 32px; text-align: center;
  max-width: 340px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: ctgSlideUp 0.4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes ctgSlideUp {
  from { transform: translateY(40px) scale(0.9); opacity: 0; }
  to   { transform: translateY(0) scale(1);      opacity: 1; }
}
.ctg-win-emoji { font-size: 4rem; margin-bottom: 12px; display: block; }
.ctg-win-title { font-size: 1.6rem; font-weight: 800; color: var(--ctg-black); margin-bottom: 8px; }
.ctg-win-sub   { font-size: 0.9rem; color: var(--ctg-gray); margin-bottom: 24px; line-height: 1.6; }
.ctg-win-btns  { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
