/* Word Guess – game-specific styles
   Depends on global task.css.
   Scoped to body.word-guess-page so it won't affect other games.
*/

/* ============ Page + container ============ */
body.word-guess-page{
  background: var(--bg-secondary, #fcfaff) !important;
  min-height: 100svh;

  /* game palette */
  --wg-green: #2ecc71;
  --wg-yellow: #f1c40f;
  --wg-gray: #e5e7eb;
  --wg-ink: #0E1020;

  /* grid sizing */
  --wg-cell: 3.15rem;
  --wg-gap: 0.5rem;

  /* modal */
  --modal-backdrop: rgba(13,17,51,.45);
  --modal-maxw: 40rem;
}

body.word-guess-page .container{
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 18px;
  margin-top: 96px;
}

/* Ensure nothing from task.css squeezes this layout */
body.word-guess-page main,
body.word-guess-page .main{
  width: 100%;
}

@media (max-width: 520px){
  body.word-guess-page .container{ padding: 16px 12px; }
}

/* ============ Hero block ============ */
body.word-guess-page .wg-hero.card{
  padding: var(--space-lg);
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

body.word-guess-page .wg-hero-top{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-md);
  align-items: center;
}

body.word-guess-page .wg-hero-title{
  display: grid;
  gap: .35rem;
  justify-items: center;
  text-align: center;
}

body.word-guess-page .wg-hero-title .hero__title{
  margin: 0;
}

body.word-guess-page .wg-hint{
  margin: 0;
  font-size: var(--fs-small);
  color: var(--muted);
}

body.word-guess-page .wg-hero-mode{
  justify-self: end;
  align-self: start;
}

body.word-guess-page .wg-hero-controls{
  margin-top: var(--space-md);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-md);
  align-items: center;
}

/* ============ Segmented tabs (local; JS toggles .ghost) ============ */
body.word-guess-page .wg-seg{
  display: inline-flex;
  padding: .25rem;
  border: 0.0625rem solid var(--stroke);
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
  gap: .25rem;
  width: fit-content;
}

body.word-guess-page .wg-seg__btn{
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.7rem 1.05rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: var(--fs-body);
  color: var(--brand);
  transition: filter .15s, transform .05s, background .15s, color .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* active = NOT .ghost */
body.word-guess-page .wg-seg__btn.ghost{
  background: transparent;
  color: var(--brand);
}

body.word-guess-page .wg-seg__btn:not(.ghost){
  background: var(--brand);
  color: #fff;
}

body.word-guess-page .wg-seg__btn:active{ transform: translateY(0.0625rem); }

/* ============ Difficulty block ============ */
body.word-guess-page .wg-diff{
  display: none;
  align-items: center;
  gap: var(--space-sm);
  justify-content: flex-end;
}

body.word-guess-page .wg-diff.active{ display: flex; }

body.word-guess-page .wg-diff label{
  font-size: var(--fs-small);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

body.word-guess-page .wg-diff .native-select{ min-width: 11rem; }

/* Hero mobile */
@media (max-width: 40rem){
  body.word-guess-page{ --wg-cell: 3.25rem; --wg-gap: 0.45rem; }

  body.word-guess-page .wg-hero-top{
    grid-template-columns: 1fr;
    justify-items: center;
  }

  body.word-guess-page .wg-hero-mode{ justify-self: center; }

  body.word-guess-page .wg-hero-controls{
    grid-template-columns: 1fr;
    justify-items: center;
  }

  body.word-guess-page .wg-diff{ width: 100%; }

  body.word-guess-page .wg-diff .native-select{
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 22rem){
  body.word-guess-page{ --wg-cell: 3.05rem; --wg-gap: 0.40rem; }
}

/* ============ Grid ============ */
body.word-guess-page .wg-grid{
  display: grid;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
  align-items: center;
  justify-content: center;
}

body.word-guess-page .wg-row{
  display: grid;
  grid-template-columns: repeat(var(--wg-cols, 8), var(--wg-cell));
  gap: var(--wg-gap);
  width: max-content;
}

body.word-guess-page .wg-cell{
  width: var(--wg-cell);
  height: var(--wg-cell);
  border-radius: 0.95rem;
  border: 0.0625rem solid var(--stroke);
  display: grid;
  place-items: center;
  background: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  font-size: clamp(1.05rem, 0.95rem + 0.8vw, 1.35rem);
  line-height: 1;
}

body.word-guess-page .wg-cell.filled{ border-color: rgba(29,25,180,0.25); }
body.word-guess-page .wg-cell.green { background: var(--wg-green); border-color: rgba(0,0,0,0.08); color: var(--wg-ink); }
body.word-guess-page .wg-cell.yellow{ background: var(--wg-yellow); border-color: rgba(0,0,0,0.08); color: var(--wg-ink); }
body.word-guess-page .wg-cell.gray  { background: var(--wg-gray); border-color: rgba(0,0,0,0.08); color: var(--wg-ink); }

/* ============ Modal (was in task1.css) ============ */
html.modal-lock,
body.modal-lock{
  overflow: hidden;
}

body.word-guess-page .modal{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 1rem;
  z-index: 1000;
  isolation: isolate;
}

body.word-guess-page .modal.active{ display: grid; }

body.word-guess-page .modal__backdrop{
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
  z-index: 0;
  backdrop-filter: blur(2px);
}

body.word-guess-page .modal__dialog{
  position: relative;
  z-index: 1;
  background: #fff;
  width: 100%;
  max-width: min(var(--modal-maxw), 96vw);
  max-height: 88svh;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

body.word-guess-page .modal__head{
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

body.word-guess-page .modal__title{
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

body.word-guess-page .modal__subtitle{
  margin-top: .4rem;
  white-space: pre-line;
}

body.word-guess-page .modal__body{
  padding: 1.25rem;
  overflow-y: auto;
}

body.word-guess-page .modal-stats{
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: .75rem;
  margin: .75rem 0 1.25rem;
}

body.word-guess-page .modal-stat{
  border: 1px solid var(--stroke, #E3E6EF);
  border-radius: 1rem;
  padding: .75rem;
  text-align: center;
}

body.word-guess-page .modal-stat__val{
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--brand, #1D19B4);
}

body.word-guess-page .modal__close{
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  line-height: 1;
  font-size: 1.25rem;
  flex: 0 0 auto;
}

/* lead form inside modal */
body.word-guess-page .modal-form{
  display: grid;
  gap: 1rem;
}

body.word-guess-page .form-field{
  display: grid;
  gap: .4rem;
}

body.word-guess-page .label{
  font-size: .85rem;
  font-weight: 600;
}

body.word-guess-page .phone-input{
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .5rem;
}

body.word-guess-page .phone-code{
  width: auto;
  min-width: 6.75rem;
  padding-right: 2.25rem;
}

body.word-guess-page .btn--block{
  width: 100%;
  margin-top: .5rem;
}

body.word-guess-page .form-actions-row{
  display: flex;
  align-items: end;
  gap: var(--space-sm);
}

body.word-guess-page .form-actions-row .form-field{
  flex: 1 1 auto;
}

body.word-guess-page .form-actions-row .btn{
  flex: 0 0 auto;
  height: 3rem;
  padding-inline: 1rem;
  white-space: nowrap;
}

@media (max-width: 480px){
  body.word-guess-page .modal-stats{ grid-template-columns: 1fr; }
  body.word-guess-page .phone-input{ grid-template-columns: 4.5rem 1fr; }
  body.word-guess-page .form-actions-row{
    flex-direction: column;
    align-items: stretch;
  }
  body.word-guess-page .form-actions-row .btn{ width: 100%; }
  body.word-guess-page .modal__close{
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.15rem;
  }
}
/* =========================
   PATCH v1 – Word Guess layout fixes
   ========================= */

/* 1) прибираємо "величезний hero" (task.css зазвичай дає .hero min-height) */
body.word-guess-page .hero,
body.word-guess-page .wg-hero.hero{
  min-height: auto !important;
}

body.word-guess-page .wg-hero.card{
  margin-top: 0 !important;
  padding: var(--space-md) !important;
}

/* 2) робимо адекватний відступ між header і першим блоком */
body.word-guess-page main.container{
  /* якщо header "липкий" – цей padding дає повітря під ним */
  padding-top: 16px !important;
}

/* (опційно) якщо в тебе header реально fixed і перекриває контент,
   збільш до 24–32px */
@media (max-width: 520px){
  body.word-guess-page main.container{
    padding-top: 12px !important;
  }
}

/* 3) "Складність" — стилізуємо select як у кабінеті */
body.word-guess-page .wg-diff{
  gap: 10px !important;
}

body.word-guess-page .wg-diff label{
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--text-caption, #81779e) !important;
}

body.word-guess-page .wg-diff .native-select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  height: 44px;
  padding: 0 44px 0 16px;

  border: 1px solid var(--stroke, #e5dff1);
  border-radius: 999px;
  background: rgba(255,255,255,.75);

  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-title, #0d0a23);

  outline: none;
  cursor: pointer;

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%2381779e' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

body.word-guess-page .wg-diff .native-select:focus{
  border-color: rgba(128,67,247,.55);
  box-shadow: 0 0 0 4px rgba(128,67,247,.12);
}

/* 4) "Спроби", час і 1/6 — в ОДНОМУ рядку */
body.word-guess-page .card > .between.center.mb-8{
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 14px !important;
  flex-wrap: nowrap !important;
}

body.word-guess-page .card > .between.center.mb-8 h3{
  font-size: 20px !important;
  font-weight: 800 !important;
  margin: 0 !important;
  white-space: nowrap;
}

/* pills справа, але без переносів */
body.word-guess-page .card > .between.center.mb-8 .hud{
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-left: auto !important;
  flex-wrap: nowrap !important;
}

body.word-guess-page .card > .between.center.mb-8 .pill{
  white-space: nowrap;
}

/* 5) дрібне підчищення: не даємо hero розтягуватися вниз */
body.word-guess-page .wg-hero-title{
  gap: .25rem !important;
}

body.word-guess-page .wg-hint{
  line-height: 1.3;
}

/* мобільна поведінка: select на всю ширину, рядок "Спроби" не ламаємо */
@media (max-width: 520px){
  body.word-guess-page .card > .between.center.mb-8{
    gap: 10px !important;
  }
  body.word-guess-page .wg-diff{
    width: 100%;
  }
  body.word-guess-page .wg-diff .native-select{
    width: 100%;
  }
}
/* =========================
   PATCH v2 – Hero spacing + difficulty below mode
   ========================= */

/* 1) ВІДЛІПИТИ hero від ігрового екрану + зробити hero не таким "високим" */
body.word-guess-page .wg-hero.card{
  margin-top: 0 !important;                 /* header already adds space */
  margin-bottom: 32px !important; /* оцей зазор між hero і грою */
  padding: 16px !important;       /* було завелике */
}

/* якщо десь задано min-height для hero (з task.css) */
body.word-guess-page .wg-hero.hero{
  min-height: auto !important;
}

/* 2) ДОДАТИ відступи між елементами в hero */
body.word-guess-page .wg-hero-top{
  gap: 12px !important;
}

body.word-guess-page .wg-hero-title{
  gap: 10px !important;  /* було .35rem */
}

body.word-guess-page .wg-hint{
  margin-top: 2px !important;
  margin-bottom: 6px !important;
}

/* 3) Складність ПІД вибір режиму:
      переводимо controls з grid у column */
body.word-guess-page .wg-hero-controls{
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 12px !important;
  margin-top: 14px !important;
}

/* режим завжди зверху */
body.word-guess-page .wg-seg{
  margin: 0 auto !important;
}

/* складність під режимом, по центру */
body.word-guess-page .wg-diff{
  justify-content: center !important;
  width: 100% !important;
  gap: 10px !important;
}

/* щоб label “Складність” не виглядав приліпленим */
body.word-guess-page .wg-diff label{
  margin-right: 6px !important;
}

/* На мобілці: робимо складність компактною і в рядку, але нижче */
@media (max-width: 520px){
  body.word-guess-page .wg-hero.card{
    margin-bottom: 12px !important;
    padding: 14px !important;
  }

  body.word-guess-page .wg-hero-controls{
    gap: 10px !important;
    margin-top: 10px !important;
  }

  body.word-guess-page .wg-diff{
    flex-direction: row !important;
    align-items: center !important;
  }

  body.word-guess-page .wg-diff .native-select{
    width: 100% !important;
    max-width: 240px;
  }
}
/* Mobile: add space above hero (from header) */
@media (max-width: 520px){
  body.word-guess-page{
    padding-top: 64px !important;
  }
}