/* ============================================================
   GERABYTEZ — Plataforma de Jogos Didáticos
   Estilo compartilhado (HUB + Jogos)
   ============================================================ */

:root {
  --bg: #0f172a;
  --bg-soft: #16213e;
  --panel: #1b2747;
  --panel-light: #24315a;
  --text: #f1f5f9;
  --text-dim: #a8b3cc;
  --accent-orange: #f7941d;
  --accent-navy: #16305c;
  --good: #22c55e;
  --bad: #ef4444;
  --radius: 16px;
  --subject-color: #2563eb;
  --header-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 800px at 10% -10%, #1a2550 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Topbar (marca) ---------- */
.gb-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(90deg, var(--accent-navy), #0c1b3a);
  border-bottom: 3px solid var(--accent-orange);
  position: sticky;
  top: 0;
  z-index: 50;
}

.gb-topbar img.gb-logo {
  height: 44px;
  width: auto;
}

.gb-topbar .gb-brand {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
}

.gb-topbar .gb-brand span { color: var(--accent-orange); }

.gb-topbar .gb-tag {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: -2px;
}

.gb-topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- HUB: seletores ---------- */
.gb-selectors {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 22px 0 8px;
}

.gb-selector-block h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.gb-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gb-chip {
  background: var(--panel);
  border: 2px solid transparent;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .15s ease;
}

.gb-chip:hover { background: var(--panel-light); }

.gb-chip.active {
  border-color: var(--accent-orange);
  background: linear-gradient(135deg, var(--accent-orange), #c9700a);
  color: #1b1200;
}

.gb-chip .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--subject-color, #888);
  flex: none;
}

/* ---------- Grade de jogos ---------- */
.gb-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.gb-subject-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--subject-color);
}

.gb-subject-heading .icon { font-size: 1.5rem; }
.gb-subject-heading h2 { margin: 0; font-size: 1.15rem; }
.gb-subject-heading .count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.gb-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  border-top: 4px solid var(--subject-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 150px;
}

.gb-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
}

.gb-card .icon { font-size: 1.8rem; }
.gb-card h4 { margin: 0; font-size: 1rem; line-height: 1.3; }
.gb-card .meta {
  font-size: 0.76rem;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.gb-card .badge {
  background: var(--panel-light);
  padding: 2px 8px;
  border-radius: 999px;
}
.gb-card .play-btn {
  margin-top: auto;
  background: var(--subject-color);
  color: #fff;
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 700;
  text-align: center;
  font-size: 0.88rem;
}

.gb-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
  font-size: 1rem;
}

/* ---------- Rodapé ---------- */
.gb-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  padding: 30px 16px 40px;
}

/* ============================================================
   TELA DE JOGO
   ============================================================ */
.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 3px solid var(--subject-color);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}

.game-header .gb-mini-logo { height: 30px; }

.game-header .title-block {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.game-header .title-block .gtitle { font-weight: 700; font-size: 0.95rem; }
.game-header .title-block .gsubject { font-size: 0.75rem; color: var(--text-dim); }

.game-header .spacer { flex: 1; }

.hbtn {
  background: var(--panel-light);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hbtn.back { background: #33406a; }
.hbtn.restart { background: var(--accent-orange); color: #1b1200; }

.hud {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.hud .pill {
  background: var(--panel);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  gap: 6px;
  align-items: center;
}
.hud .pill.score { color: var(--accent-orange); }
.hud .pill .bar-wrap {
  width: 120px; height: 8px; background: #0c1530; border-radius: 6px; overflow: hidden;
}
.hud .pill .bar-fill {
  height: 100%; background: var(--subject-color); width: 0%;
  transition: width .3s ease;
}

.game-stage {
  max-width: 760px;
  margin: 10px auto 60px;
  padding: 10px 16px 40px;
}

.q-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  border-left: 5px solid var(--subject-color);
}
.q-card .q-text {
  font-size: 1.08rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.45;
}
.q-card .q-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.opt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .opt-grid.two-col { grid-template-columns: 1fr 1fr; }
}

.opt-btn {
  background: var(--panel-light);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 12px;
  text-align: left;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition: all .12s ease;
}
.opt-btn:active { transform: scale(0.98); }
.opt-btn.correct { background: var(--good); color: #06210f; border-color: #16a34a; font-weight: 700; }
.opt-btn.wrong { background: var(--bad); color: #2b0707; border-color: #b91c1c; font-weight: 700; }
.opt-btn.disabled-choice { opacity: 0.55; pointer-events: none; }
.opt-btn.selected-order {
  border-color: var(--accent-orange);
}

.vf-row { display: flex; gap: 14px; }
.vf-btn {
  flex: 1;
  padding: 18px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.1rem;
  text-align: center;
}
.vf-btn.true { background: #14532d; color: #dcfce7; }
.vf-btn.false { background: #7f1d1d; color: #fee2e2; }

.order-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
  background: #0c1530;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
}
.order-token-slot {
  padding: 8px 12px;
  background: var(--subject-color);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; }

.pair-cols { display: flex; gap: 16px; flex-wrap: wrap; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (min-width: 480px) {
  .memory-grid { grid-template-columns: repeat(4, 1fr); }
}
.mem-card {
  aspect-ratio: 1 / 1;
  background: var(--subject-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  text-align: center;
  padding: 6px;
  font-weight: 700;
  color: #fff;
  user-select: none;
}
.mem-card.hidden-face { background: var(--panel-light); color: transparent; }
.mem-card.matched { background: var(--good); color: #06210f; opacity: 0.6; }

.hangman-word {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 4px;
}
.hangman-letter-box {
  width: 30px;
  border-bottom: 3px solid var(--subject-color);
  text-align: center;
}
.hangman-keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.key-btn {
  background: var(--panel-light);
  color: var(--text);
  width: 36px;
  height: 40px;
  border-radius: 8px;
  font-weight: 700;
}
.key-btn.used-correct { background: var(--good); color: #06210f; }
.key-btn.used-wrong { background: var(--bad); color: #2b0707; }
.hangman-tries { text-align: center; color: var(--text-dim); margin-top: 10px; font-size: 0.85rem; }

.classify-buckets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.bucket-btn {
  flex: 1;
  min-width: 120px;
  background: var(--panel-light);
  padding: 16px;
  border-radius: 12px;
  font-weight: 700;
  text-align: center;
}

.next-btn {
  margin-top: 16px;
  width: 100%;
  background: var(--subject-color);
  color: #fff;
  padding: 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.next-btn.show { opacity: 1; pointer-events: auto; }

.feedback-flash {
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  margin-top: 10px;
  min-height: 20px;
}
.feedback-flash.ok { color: var(--good); }
.feedback-flash.no { color: var(--bad); }

/* ---------- Fim de jogo ---------- */
.end-screen {
  text-align: center;
  padding: 40px 20px;
}
.end-screen .big-score {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent-orange);
  margin: 10px 0;
}
.end-screen .msg { color: var(--text-dim); margin-bottom: 24px; font-size: 1rem; }
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.end-actions .hbtn { padding: 14px 24px; font-size: 0.95rem; }

@media (max-width: 480px) {
  .gb-topbar .gb-brand { font-size: 1.05rem; }
  .gb-topbar img.gb-logo { height: 36px; }
  .end-screen .big-score { font-size: 2.2rem; }
}
