/* ============================================================
   CrossGames – Estilos dos Jogos
   ============================================================ */

/* ---- Game Layout ---- */
.game-page { min-height: 100vh; background: var(--cream); }

.game-header {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark3) 100%);
  color: var(--white); padding: 1.5rem 0;
  border-bottom: 2px solid rgba(212,168,67,.3);
}
.game-header-inner {
  max-width: 960px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
}
.game-back {
  color: var(--gold); font-size: 1.8rem; text-decoration: none; line-height: 1;
  transition: transform .2s;
}
.game-back:hover { transform: translateX(-3px); text-decoration: none; }
.game-title { flex: 1; min-width: 0; }
.game-title h1 { font-size: 1.5rem; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-title p { color: #aaa; font-size: .85rem; margin-top: .2rem; }
.game-hud { display: flex; gap: 1.5rem; align-items: center; flex-shrink: 0; }
.hud-item { text-align: center; }
.hud-item .hud-val { display: block; font-size: 1.5rem; font-weight: 800; color: var(--gold); font-family: 'Cinzel', serif; }
.hud-item .hud-label { font-size: .72rem; color: #aaa; text-transform: uppercase; letter-spacing: .08em; }

/* ---- Game Container ---- */
.game-container { max-width: 960px; margin: 2rem auto; padding: 0 1.5rem 4rem; }
.game-box {
  background: var(--white); border-radius: var(--radius-lg); padding: 2rem;
  box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.game-box h2 { font-size: 1.3rem; color: var(--dark); margin-bottom: 1.2rem; text-align: center; }

/* ---- Progress ---- */
.progress-wrap { margin-bottom: 1.5rem; }
.progress-info { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-light); margin-bottom: .4rem; }
.progress-bar-bg { background: var(--cream-dark); border-radius: 50px; height: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 50px; transition: width .5s ease; }

/* ---- Quiz ---- */
.question-text {
  font-size: 1.2rem; font-weight: 700; text-align: center;
  margin-bottom: 2rem; color: var(--dark); line-height: 1.5;
}
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 500px) { .options-grid { grid-template-columns: 1fr; } }
.option-btn {
  padding: 1rem 1.2rem; border: 2px solid var(--cream-dark); border-radius: var(--radius);
  background: var(--white); font-family: 'Nunito', sans-serif; font-size: .95rem;
  font-weight: 600; cursor: pointer; text-align: left; transition: all .2s;
  color: var(--text);
}
.option-btn:hover:not(:disabled) { border-color: var(--gold); background: #fffbf0; }
.option-btn.correct { border-color: var(--success); background: rgba(39,174,96,.1); color: var(--success); }
.option-btn.wrong { border-color: var(--danger); background: rgba(231,76,60,.1); color: var(--danger); }
.option-btn:disabled { cursor: default; opacity: .85; }

/* ---- True/False ---- */
.tf-buttons { display: flex; gap: 1.5rem; justify-content: center; margin-top: 1.5rem; }
.tf-btn {
  padding: 1.2rem 3rem; border-radius: var(--radius-lg); font-size: 1.2rem; font-weight: 800;
  border: 3px solid; cursor: pointer; transition: all .2s; font-family: 'Nunito', sans-serif;
}
.tf-true { border-color: var(--success); color: var(--success); background: rgba(39,174,96,.08); }
.tf-true:hover:not(:disabled) { background: var(--success); color: #fff; }
.tf-false { border-color: var(--danger); color: var(--danger); background: rgba(231,76,60,.08); }
.tf-false:hover:not(:disabled) { background: var(--danger); color: #fff; }
.tf-btn.correct { background: var(--success); color: #fff; border-color: var(--success); }
.tf-btn.wrong { background: var(--danger); color: #fff; border-color: var(--danger); }
.tf-btn:disabled { cursor: default; }

/* ---- Hangman / Forca ---- */
.hangman-figure { text-align: center; font-size: 5rem; margin: 1rem 0; }
.word-display { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: 1.5rem 0; }
.letter-slot {
  width: 38px; height: 50px; border-bottom: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; color: var(--dark);
  font-family: 'Cinzel', serif;
}
.keyboard-grid {
  display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: 1.5rem;
}
.key-btn {
  width: 38px; height: 38px; border: 2px solid var(--cream-dark); border-radius: 6px;
  background: var(--white); font-weight: 700; cursor: pointer; font-family: 'Nunito', sans-serif;
  transition: all .2s;
}
.key-btn:hover:not(:disabled) { border-color: var(--gold); background: #fffbf0; }
.key-btn.hit { border-color: var(--success); background: rgba(39,174,96,.15); color: var(--success); }
.key-btn.miss { border-color: var(--danger); background: rgba(231,76,60,.1); color: #bbb; }
.key-btn:disabled { cursor: default; }
.hangman-hint { font-style: italic; color: var(--text-light); text-align: center; margin-bottom: 1rem; font-size: .95rem; }

/* ---- Memory Game ---- */
.memory-grid {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 480px) { .memory-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; } }
.mem-card {
  aspect-ratio: 1; border-radius: var(--radius); cursor: pointer;
  perspective: 600px; position: relative;
}
.mem-card-inner {
  width: 100%; height: 100%; position: relative;
  transform-style: preserve-3d; transition: transform .4s;
}
.mem-card.flipped .mem-card-inner,
.mem-card.matched .mem-card-inner { transform: rotateY(180deg); }
.mem-front, .mem-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; border: 2px solid transparent;
}
.mem-front {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark3) 100%);
  color: var(--gold); font-size: 1.8rem;
}
.mem-back {
  background: var(--cream); border-color: var(--gold);
  transform: rotateY(180deg); font-size: .8rem; text-align: center; padding: .4rem;
  color: var(--dark);
}
.mem-card.matched .mem-back { background: rgba(39,174,96,.15); border-color: var(--success); }

/* ---- Word Search ---- */
.wordsearch-grid {
  display: inline-grid; gap: 2px; margin: 0 auto; display: grid;
  border: 2px solid var(--cream-dark); border-radius: 8px; overflow: hidden;
}
.ws-cell {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .95rem; cursor: pointer; user-select: none;
  background: var(--white); transition: background .15s; color: var(--dark);
  border: 1px solid var(--cream-dark);
}
.ws-cell:hover { background: #fffbf0; }
.ws-cell.selected { background: var(--gold-light); color: var(--brown); }
.ws-cell.found { background: rgba(39,174,96,.2); color: var(--success); font-weight: 900; }
.words-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.word-chip {
  padding: .3rem .9rem; border-radius: 50px; border: 2px solid var(--gold);
  font-weight: 700; font-size: .85rem; color: var(--gold-dark);
}
.word-chip.found-chip { background: var(--success); border-color: var(--success); color: #fff; text-decoration: line-through; }

/* ---- Fill in Blank ---- */
.verse-text {
  font-size: 1.1rem; line-height: 2; text-align: center; color: var(--dark);
  margin: 1.5rem 0; font-style: italic;
}
.blank-input {
  border: none; border-bottom: 3px solid var(--gold); background: transparent;
  font-size: 1.1rem; font-family: 'Nunito', sans-serif; font-weight: 700;
  min-width: 100px; text-align: center; outline: none; color: var(--dark);
  padding: 0 .3rem;
}
.blank-input.correct { border-color: var(--success); color: var(--success); }
.blank-input.wrong { border-color: var(--danger); color: var(--danger); }
.check-btn { display: block; margin: 1.5rem auto 0; }

/* ---- Ordering Game ---- */
.order-list { display: flex; flex-direction: column; gap: .6rem; }
.order-item {
  padding: .9rem 1.2rem; background: var(--cream); border: 2px solid var(--cream-dark);
  border-radius: var(--radius); cursor: grab; font-weight: 600; font-size: .95rem;
  display: flex; align-items: center; gap: .8rem; transition: all .2s;
  user-select: none;
}
.order-item:hover { border-color: var(--gold); background: #fffbf0; }
.order-item.dragging { opacity: .5; cursor: grabbing; }
.order-item.correct-pos { border-color: var(--success); background: rgba(39,174,96,.1); }
.order-item.wrong-pos { border-color: var(--danger); background: rgba(231,76,60,.08); }
.order-handle { color: #aaa; font-size: 1.2rem; }
.order-num { color: var(--gold); font-weight: 800; font-family: 'Cinzel', serif; min-width: 1.5rem; }

/* ---- Matching Game ---- */
.match-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 500px) { .match-columns { grid-template-columns: 1fr; } }
.match-col { display: flex; flex-direction: column; gap: .6rem; }
.match-col h3 { font-size: .85rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .4rem; }
.match-item {
  padding: .8rem 1rem; border: 2px solid var(--cream-dark); border-radius: var(--radius);
  font-weight: 600; font-size: .9rem; cursor: pointer; transition: all .2s; text-align: center;
  background: var(--white);
}
.match-item:hover { border-color: var(--gold); background: #fffbf0; }
.match-item.selected { border-color: var(--gold); background: rgba(212,168,67,.15); }
.match-item.matched { border-color: var(--success); background: rgba(39,174,96,.1); color: var(--success); cursor: default; }
.match-item.wrong-match { border-color: var(--danger); background: rgba(231,76,60,.1); animation: shake .3s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* ---- Result Screen ---- */
.result-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.7); align-items: center; justify-content: center;
  padding: 1rem; backdrop-filter: blur(4px);
}
.result-overlay.show { display: flex; animation: fadeIn .3s ease; }
.result-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 2.5rem 2rem;
  max-width: 420px; width: 100%; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  animation: slideDown .3s ease;
}
.result-card .r-stars { font-size: 3rem; margin-bottom .5rem; }
.result-card .r-score { font-size: 3.5rem; font-weight: 800; color: var(--gold); font-family: 'Cinzel', serif; }
.result-card .r-label { color: var(--text-light); font-size: 1rem; margin: .3rem 0 1rem; }
.result-card .r-msg { font-size: 1.1rem; font-weight: 700; color: var(--dark); margin-bottom: 1.5rem; }
.result-btns { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* ---- Streak HUD item ---- */
#streakWrap { display: none; align-items: center; }
#streakWrap .hud-val { color: #ff9f43 !important; }

/* ---- Flash feedback on game-box ---- */
@keyframes flashCorrect { 0%,100%{ box-shadow: var(--shadow); } 50%{ box-shadow: 0 0 0 4px rgba(39,174,96,.5); } }
@keyframes flashWrong   { 0%,100%{ box-shadow: var(--shadow); } 50%{ box-shadow: 0 0 0 4px rgba(231,76,60,.4); } }
.game-box.flash-correct { animation: flashCorrect .5s ease; }
.game-box.flash-wrong   { animation: flashWrong .5s ease; }

/* ---- Answer option pop animation ---- */
@keyframes popIn { 0%{ transform:scale(.95); opacity:.7; } 100%{ transform:scale(1); opacity:1; } }
.option-btn { animation: popIn .18s ease; }
.option-btn.correct { animation: none; transform: scale(1.03); }

/* ---- Theme picker ---- */
.theme-pick-btn {
  background: var(--white); border: 2px solid #e8dfc0; border-radius: 12px;
  padding: 1rem .8rem; cursor: pointer; transition: all .18s;
  font-family: 'Nunito', sans-serif; color: var(--dark); line-height: 1.4;
  text-align: center; width: 100%;
}
.theme-pick-btn strong { font-size: .95rem; display: block; margin: .3rem 0 .15rem; }
.theme-pick-btn small { font-size: .78rem; color: var(--text-light); }
.theme-pick-btn:hover { border-color: var(--gold); background: #fffbf0; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }

/* ---- Touch drag feedback ---- */
.order-item.touch-over {
  border-color: var(--gold); background: rgba(212,168,67,.2);
  transform: scale(1.02); transition: all .15s;
}

/* ---- Mobile Game Header ---- */
@media (max-width: 600px) {
  .game-header { padding: .7rem 0; }
  .game-header-inner { padding: 0 .8rem; gap: .5rem; flex-wrap: nowrap; align-items: center; }
  .game-title h1 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
  .game-title p { display: none; }
  .game-hud { gap: .7rem; }
  .hud-item .hud-val { font-size: 1rem; }
  .hud-item .hud-label { font-size: .58rem; }
  .game-container { margin: .8rem auto; padding: 0 .8rem 2rem; }
  .game-box { padding: 1rem; }
  .question-text { font-size: 1rem; margin-bottom: 1.2rem; }
  .tf-btn { padding: 1rem 1.8rem; font-size: 1rem; }
}

/* ---- Mobile Word Search ---- */
@media (max-width: 520px) {
  .wordsearch-grid { display: grid !important; width: 100%; }
  .ws-cell { width: auto !important; height: auto !important; aspect-ratio: 1; font-size: .62rem !important; }
}

/* ---- Mobile Crossword ---- */
@media (max-width: 520px) {
  .crossword-grid { display: grid !important; width: 100%; }
  .cw-cell { width: auto !important; height: auto !important; aspect-ratio: 1; }
  .cw-cell input { font-size: .68rem; padding-top: 8px !important; }
  .cw-num { font-size: .42rem; }
}

/* ---- Mobile Memory Grid ---- */
@media (max-width: 380px) {
  .memory-grid { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .mem-front { font-size: 1.4rem; }
  .mem-back { font-size: .7rem; }
}

/* ---- Crossword ---- */
.crossword-grid { display: inline-grid; gap: 2px; }
.cw-cell {
  width: 36px; height: 36px; border: 2px solid var(--cream-dark); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; position: relative; background: var(--white);
}
.cw-cell.black { background: var(--dark); border-color: var(--dark); }
.cw-cell input {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
  text-align: center; font-size: .9rem; font-weight: 800; background: transparent;
  font-family: 'Cinzel', serif; outline: none; text-transform: uppercase;
}
.cw-cell input:focus { background: rgba(212,168,67,.2); }
.cw-cell.active input { background: rgba(212,168,67,.2); }
.cw-cell.correct input { background: rgba(39,174,96,.2); color: var(--success); }
.cw-cell.wrong input { background: rgba(231,76,60,.1); color: var(--danger); }
.cw-num { position: absolute; top: 1px; left: 2px; font-size: .55rem; color: var(--gold-dark); font-weight: 700; line-height: 1; }
.cw-clues { margin-top: 1.5rem; }
.cw-clues h3 { font-size: 1rem; margin-bottom: .6rem; color: var(--dark); }
.cw-clue { font-size: .88rem; margin-bottom: .3rem; color: var(--text); }
.cw-clue strong { color: var(--gold-dark); }
.cw-clue.answered { color: var(--success); text-decoration: line-through; }
