/*Games hub*/

.games_hub{
  padding: 2.5rem 1.25rem 4rem;
  background: linear-gradient(180deg, #f8fafc 0%, var(--background-light) 100%);
}

.games_container{
  max-width: 1100px;
  margin: 0 auto;
}

.games_header{
  text-align: center;
  margin-bottom: 1.5rem;
}

.games_label{
  display: inline-block;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.games_title{
  font-size: 1.85rem;
  color: var(--title-color);
  margin-bottom: 0.45rem;
}

.games_subtitle{
  max-width: 60ch;
  margin: 0 auto;
  color: var(--text-light);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* Mobile: 1 column */
.games_grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.game_card{
  width: 100%;
  text-align: left;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  border-radius: 18px;
  padding: 1.05rem;
  box-shadow: 0 16px 36px rgba(15,23,42,0.08);
  cursor: pointer;

  display: flex;
  align-items: center;
  gap: 0.9rem;

  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.game_card:hover{
  transform: translateY(-2px);
  border-color: rgba(23,190,32,0.35);
  box-shadow: 0 22px 48px rgba(15,23,42,0.10);
}

.game_card:active{
  transform: translateY(0);
  box-shadow: 0 14px 30px rgba(15,23,42,0.08);
}

.game_card:focus-visible{
  outline: 2px solid var(--primary-dark);
  outline-offset: 3px;
}

.game_icon{
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(23,190,32,0.10);
  border: 1px solid rgba(23,190,32,0.18);
  flex-shrink: 0;
}

.game_icon i{
  font-size: 1.35rem;
  color: var(--primary-dark);
}

.game_text{
  flex: 1;
  min-width: 0;
}

.game_name{
  display: block;
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 0.2rem;
}

.game_desc{
  display: block;
  color: var(--text-light);
  line-height: 1.55;
  font-size: 0.92rem;
}

.game_tag{
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.82rem;
  background: rgba(23,190,32,0.14);
  color: var(--primary-dark);
  border: 1px solid rgba(23,190,32,0.22);
  flex-shrink: 0;
}

.game_tag.muted{
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.08);
  color: var(--text-light);
}

/* ---------- Game modal ---------- */
.game_modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 0;
  z-index: 1600;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, visibility 0s linear 200ms;
}

.game_modal.show{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 200ms ease;
}

.game_modal_overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  z-index: 1;
}

.game_modal_box{
  position: relative;
  z-index: 2;

  width: min(960px, 94vw);
  height: min(86vh, 720px);
  overflow: hidden;

  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 30px 80px rgba(0,0,0,0.22);

  display: flex;
  flex-direction: column; 
  transform: translateY(6px);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.game_modal.show .game_modal_box{
  transform: translateY(0);
}

.game_modal_top{
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
  background: #fff;
}

.game_modal_label{
  font-weight: 900;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--primary-dark);
  margin-bottom: 0.2rem;
}

.game_modal_title{
  font-size: 1.2rem;
  font-weight: 900;
  margin: 0;
}

.game_modal_close{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.10);
  background: #f3f4f6;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;

  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s ease,
    color 0.3s ease;
}

.game_modal_close:hover{
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
  transform: rotate(90deg);
}

.game_modal_close:active{
  transform: rotate(90deg) scale(0.96);
}

.game_modal_close i{
  font-size: 1.35rem;
  color: inherit;
}

.game_modal_body{
  padding: 0.75rem;
  overflow: auto;
  flex: 1; 
  min-height: 0;
}

body.modal_open{
  overflow: hidden;
  overscroll-behavior: none;
}

#gameMount{
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  padding: 0.65rem;
  height: 100%;
}

/*Memory card game*/

.memory_header{
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.memory_label{
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 0.7px;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
}

.memory_title{
  font-size: 1.15rem;
  margin-bottom: 0.1rem;
}

.memory_subtitle{
  color: var(--text-light);
  line-height: 1.5;
  font-size: 0.88rem;
}

.memory_stats{
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.stat_box{
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 0.4rem 0.55rem;
  min-width: 70px;
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
}

.stat_label{
  display: block;
  color: var(--text-light);
  font-weight: 800;
  font-size: 0.7rem;
  margin-bottom: 0.1rem;
}

.stat_value{
  display: block;
  font-weight: 900;
  color: var(--title-color);
  font-size: 0.88rem;
}

.memory_btn{
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--title-color);
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.memory_btn:hover{
  transform: translateY(-1px);
  border-color: rgba(23,190,32,0.35);
}

.memory_btn:active{
  transform: translateY(0);
}

.memory_btn:focus-visible{
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
}

.memory_btn.primary{
  background: var(--primary-dark);
  color: #fff;
  border-color: var(--primary-dark);
}

.memory_board{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.45rem;

  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(15,23,42,0.08);
}

.card{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  cursor: pointer;
  perspective: 900px;
  user-select: none;
  border: 0;
  background: transparent;
  transition: transform 120ms ease;
}

.card:active{
  transform: scale(0.98);
}

.card:focus-visible{
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
}

.card.disabled{ pointer-events: none; }

.card_inner{
  position: absolute;
  inset: 0;
  border-radius: 14px;
  transform-style: preserve-3d;
  transition: transform 240ms ease;
}

.card.flipped .card_inner{ transform: rotateY(180deg); }

.card_face{
  position: absolute;
  inset: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  border: 1px solid rgba(0,0,0,0.08);
}

.card_front{
  background: linear-gradient(135deg, rgba(23,190,32,0.14), rgba(15,61,46,0.08));
}

.card_front .mark{
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 0.95rem;
  color: var(--primary-dark);
  box-shadow: 0 12px 24px rgba(15,23,42,0.08);
}

.card_back{
  background: #fff;
  transform: rotateY(180deg);
  box-shadow: 0 12px 26px rgba(15,23,42,0.08);
}

.card_back .emoji{
  font-size: 1.35rem;
}

.card.matched .card_back{
  border-color: rgba(23,190,32,0.45);
  box-shadow: 0 14px 30px rgba(23,190,32,0.12);
}

.memory_modal{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 1700;
  padding: 1.25rem;
}

.memory_modal.show{ display: flex; }

.memory_modal_box{
  width: min(520px, 94vw);
  background: #fff;
  border-radius: 18px;
  padding: 1.35rem;
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 26px 70px rgba(0,0,0,0.20);
  text-align: center;
}

.memory_modal_box h3{
  font-size: 1.45rem;
  margin-bottom: 0.45rem;
}

.memory_modal_box p{
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 1rem;
}

@media (min-width: 380px){
  .memory_board{
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 600px){
  .games_hub{ padding: 3rem 1.5rem 4.5rem; }
  .games_title{ font-size: 2.2rem; }

  .memory_board{
    gap: 0.5rem;
    padding: 0.6rem;
  }

  .memory_header{
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .memory_title{ font-size: 1.45rem; }
}

@media (min-width: 900px){
  .games_grid{ grid-template-columns: 1fr 1fr; }
  .game_card{ padding: 1.25rem; }

  .game_modal_top{
    padding: 1rem 1.2rem;
  }

  .game_modal_title{ font-size: 1.35rem; }
}


/*Typing game*/

.typing_wrap{
  display: grid;
  gap: 0.75rem;
}

.typing_top{
  display: grid;
  gap: 0.55rem;
}

.typing_label{
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 0.7px;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-bottom: 0.1rem;
}

.typing_title{
  font-size: 1.15rem;
  margin-bottom: 0.1rem;
}

.typing_subtitle{
  color: var(--text-light);
  line-height: 1.5;
  font-size: 0.88rem;
}

.typing_controls{
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.typing_select{
  appearance: none;
  -webkit-appearance: none;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  font-weight: 900;
  color: var(--title-color);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
}

.typing_select:focus-visible{
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
}

.typing_stats{
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.typing_stats .stat_box{
  min-width: 76px;
}

.typing_quote{
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 0.75rem;
  box-shadow: 0 12px 30px rgba(15,23,42,0.08);
  line-height: 1.7;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.typing_quote .good{ color: #16a34a; font-weight: 900; }
.typing_quote .bad{ color: #ef4444; font-weight: 900; }
.typing_quote .cur{
  background: rgba(23,190,32,0.14);
  border-radius: 6px;
  padding: 0 2px;
  border: 1px solid rgba(23,190,32,0.22);
}

.typing_input{
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  background: #fff;
  font-family: var(--body-font);
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.typing_input:focus{
  border-color: rgba(23,190,32,0.55);
  box-shadow: 0 0 0 4px rgba(23,190,32,0.14);
  outline: none;
}

.typing_actions{
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.typing_note{
  color: var(--text-light);
  font-size: 0.85rem;
  line-height: 1.6;
}

@media (min-width: 600px){
  .typing_title{ font-size: 1.45rem; }
  .typing_wrap{ gap: 0.9rem; }
}
