/* ================================================================
   CONTEXTO GAME CSS
   Hostinger public_html/ctx-assets/css/game.css
   WordPress + Astra safe — fully scoped to #ctxWrap
   ================================================================ */

/* Hard reset — nothing from Astra leaks in */
#ctxWrap,
#ctxWrap *,
#ctxWrap *::before,
#ctxWrap *::after {
  all: unset;
  box-sizing: border-box;
}

/* ---- CSS Variables ---- */
#ctxWrap {
  --gold:   #c9a431;
  --gold2:  #e8b840;
  --goldk:  #9a7818;
  --bg:     #f5f2ec;
  --surf:   #ffffff;
  --surf2:  #ede9e0;
  --surf3:  #f9f7f3;
  --txt:    #1c1a16;
  --txt2:   #5a5347;
  --txt3:   #9a9080;
  --bdr:    #ddd5c8;
  --grn:    #1b7a3e;
  --grn2:   #28a74a;
  --red:    #b52828;
  --r:      10px;
  --sh:     0 2px 12px rgba(0,0,0,.07);
  --sh2:    0 12px 40px rgba(0,0,0,.16);

  display: block;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 14px 60px;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- NAV BAR ---- */
#ctxWrap .ctx-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 12px;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 4px;
}
#ctxWrap .ctx-nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
#ctxWrap .ctx-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--gold);
  color: #fff;
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  letter-spacing: .3px;
}
#ctxWrap .ctx-mode-btn svg { fill: #fff; flex-shrink: 0; }
#ctxWrap .ctx-mode-btn:hover { background: var(--goldk); }

#ctxWrap .ctx-game-id {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--txt3);
  text-transform: uppercase;
}
#ctxWrap .ctx-nav-right {
  display: flex;
  gap: 7px;
}
#ctxWrap .ctx-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surf2);
  border: 1.5px solid var(--bdr);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--txt2);
  transition: background .15s, border-color .15s;
}
#ctxWrap .ctx-icon-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

/* ---- STATS BAR ---- */
#ctxWrap .ctx-stats-bar {
  display: flex;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 8px 0 10px;
}
#ctxWrap .ctx-stats-bar b { color: var(--txt); font-weight: 900; }
#ctxWrap .ctx-stats-dot { color: var(--bdr); }

/* ---- INPUT ROW ---- */
#ctxWrap .ctx-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
#ctxWrap .ctx-input {
  flex: 1;
  height: 46px;
  padding: 0 14px;
  border: 2px solid var(--bdr);
  border-radius: var(--r);
  font-size: 15px;
  background: var(--surf);
  color: var(--txt);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#ctxWrap .ctx-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,164,49,.15);
}
#ctxWrap .ctx-input::placeholder { color: var(--txt3); }
#ctxWrap .ctx-submit-btn {
  height: 46px;
  padding: 0 20px;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
#ctxWrap .ctx-submit-btn:hover { background: var(--goldk); }

/* ---- ACTION BUTTONS ---- */
#ctxWrap .ctx-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
#ctxWrap .ctx-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 15px;
  border-radius: var(--r);
  border: 1.5px solid var(--bdr);
  background: var(--surf);
  color: var(--txt2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
#ctxWrap .ctx-btn:hover { border-color: var(--gold); color: var(--gold); }
#ctxWrap .ctx-btn-hint { border-color: var(--gold); color: var(--gold); font-weight: 700; }
#ctxWrap .ctx-btn-hint:hover { background: var(--gold); color: #fff; }
#ctxWrap .ctx-btn-giveup { color: var(--red); border-color: var(--red); }
#ctxWrap .ctx-btn-giveup:hover { background: var(--red); color: #fff; }

/* ---- TABS ---- */
#ctxWrap .ctx-tabs {
  display: flex;
  border-bottom: 2px solid var(--bdr);
  margin-bottom: 12px;
}
#ctxWrap .ctx-tab {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--txt3);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
#ctxWrap .ctx-tab:hover { color: var(--gold); }
#ctxWrap .ctx-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ---- GUESS ROWS ---- */
#ctxWrap .ctx-list-wrap { min-height: 40px; }
#ctxWrap .ctx-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 5px;
  background: var(--surf);
  border: 1.5px solid var(--bdr);
  animation: ctxRowIn .22s ease;
}
@keyframes ctxRowIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}
#ctxWrap .ctx-row-word {
  flex: 0 0 96px;
  font-size: 14px;
  font-weight: 700;
  color: var(--txt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ctxWrap .ctx-row-bar {
  flex: 1;
  height: 8px;
  background: var(--surf2);
  border-radius: 4px;
  overflow: hidden;
}
#ctxWrap .ctx-row-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
#ctxWrap .ctx-row-rank {
  flex: 0 0 64px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
}

/* Tier colors */
#ctxWrap .ctx-row.t1  { background: #d4edda; border-color: #6fc48a; }
#ctxWrap .ctx-row.t1  .ctx-row-rank { color: var(--grn); }
#ctxWrap .ctx-row.t1  .ctx-row-bar-fill { background: var(--grn); }
#ctxWrap .ctx-row.t2  .ctx-row-rank { color: var(--grn2); }
#ctxWrap .ctx-row.t2  .ctx-row-bar-fill { background: var(--grn2); }
#ctxWrap .ctx-row.t3  .ctx-row-rank { color: #6a9e28; }
#ctxWrap .ctx-row.t3  .ctx-row-bar-fill { background: #85c136; }
#ctxWrap .ctx-row.t4  .ctx-row-rank { color: var(--goldk); }
#ctxWrap .ctx-row.t4  .ctx-row-bar-fill { background: var(--gold2); }
#ctxWrap .ctx-row.t5  .ctx-row-rank { color: #c87020; }
#ctxWrap .ctx-row.t5  .ctx-row-bar-fill { background: #f09030; }
#ctxWrap .ctx-row.t6  .ctx-row-rank { color: #c04020; }
#ctxWrap .ctx-row.t6  .ctx-row-bar-fill { background: #e05828; }
#ctxWrap .ctx-row.t7  .ctx-row-rank,
#ctxWrap .ctx-row.t8  .ctx-row-rank,
#ctxWrap .ctx-row.t9  .ctx-row-rank,
#ctxWrap .ctx-row.t10 .ctx-row-rank { color: #a02020; }
#ctxWrap .ctx-row.t7  .ctx-row-bar-fill,
#ctxWrap .ctx-row.t8  .ctx-row-bar-fill,
#ctxWrap .ctx-row.t9  .ctx-row-bar-fill,
#ctxWrap .ctx-row.t10 .ctx-row-bar-fill { background: #c03030; }

/* ---- SECONDARY BUTTONS (Create Game / Archive) ---- */
#ctxWrap .ctx-sec-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}
#ctxWrap .ctx-sec-btn {
  padding: 8px 15px;
  border-radius: var(--r);
  border: 1.5px solid var(--bdr);
  background: var(--surf);
  color: var(--txt2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
#ctxWrap .ctx-sec-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ---- HOW TO PLAY ---- */
#ctxWrap .ctx-howto-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0 8px;
}
#ctxWrap .ctx-howto-body {
  display: none;
  background: var(--surf3);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--bdr);
  font-size: 13px;
  color: var(--txt2);
}
#ctxWrap .ctx-howto-body.open { display: block; }
#ctxWrap .ctx-howto-body ul { padding-left: 18px; margin: 6px 0 12px; }
#ctxWrap .ctx-howto-body li { display: list-item; list-style: disc; margin-bottom: 5px; }
#ctxWrap .ctx-howto-body strong { font-weight: 700; color: var(--txt); }
#ctxWrap .ctx-score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}
#ctxWrap .ctx-score-table th {
  text-align: left;
  font-weight: 700;
  color: var(--txt3);
  padding: 3px 6px;
  border-bottom: 1px solid var(--bdr);
}
#ctxWrap .ctx-score-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--surf2);
  color: var(--txt2);
}
#ctxWrap .ctx-score-table td:last-child { font-weight: 700; color: var(--gold); text-align: right; }

/* ---- FAQ ---- */
#ctxWrap .ctx-faq-section { margin-top: 28px; }
#ctxWrap .ctx-faq-heading {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--txt3);
  display: block;
  margin-bottom: 10px;
}
#ctxWrap .ctx-faq-item {
  border: 1.5px solid var(--bdr);
  border-radius: var(--r);
  margin-bottom: 6px;
  overflow: hidden;
  background: var(--surf);
}
#ctxWrap .ctx-faq-q {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--txt);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#ctxWrap .ctx-faq-q::after {
  content: '▼';
  font-size: 9px;
  color: var(--txt3);
  transition: transform .2s;
  display: inline-block;
  flex-shrink: 0;
}
#ctxWrap .ctx-faq-item.open .ctx-faq-q::after { transform: rotate(180deg); }
#ctxWrap .ctx-faq-a {
  display: none;
  padding: 0 14px 13px;
  font-size: 13px;
  color: var(--txt2);
  line-height: 1.65;
}
#ctxWrap .ctx-faq-item.open .ctx-faq-a { display: block; }

/* ---- TOAST ---- */
#ctxToast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: #1c1a16;
  color: #fff;
  padding: 10px 22px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
#ctxToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#ctxToast.success { background: #1b7a3e; }
#ctxToast.error   { background: #b52828; }
#ctxToast.warn    { background: #c87000; }

/* ================================================================
   MODALS — outside #ctxWrap, fixed positioned
   ================================================================ */

.ctx-overlay {
  position: fixed;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0,0,0,.6) !important;
  z-index: 999999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  margin: 0 !important;
  transform: none !important;
}
.ctx-overlay.open { display: flex !important; }
.ctx-modal {
  background: #fff;
  border-radius: 16px;
  padding: 26px;
  width: 100%;
  max-width: 430px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: #1c1a16;
}
.ctx-modal * { box-sizing: border-box; }
.ctx-modal h2 {
  font-size: 19px;
  font-weight: 800;
  color: #1c1a16;
  margin: 0 0 18px;
  display: block;
  padding-right: 28px;
}
.ctx-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ede9e0;
  border: none;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a5347;
  line-height: 1;
}
.ctx-modal-close:hover { background: #c9a431; color: #fff; }
.ctx-modal-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: #c9a431;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  margin-bottom: 8px;
  font-family: inherit;
  transition: background .15s;
}
.ctx-modal-btn:hover { background: #9a7818; }
.ctx-modal-btn.outline {
  background: transparent;
  border: 1.5px solid #c9a431;
  color: #c9a431;
}
.ctx-modal-btn.outline:hover { background: #c9a431; color: #fff; }
.ctx-modal-btn.danger { background: #b52828; }
.ctx-modal-btn.danger:hover { background: #8a1e1e; }
.ctx-modal p {
  font-size: 13px;
  color: #5a5347;
  margin: 0 0 14px;
  display: block;
  line-height: 1.6;
}

/* Win modal */
.ctx-win-word {
  font-size: 34px;
  font-weight: 900;
  color: #c9a431;
  letter-spacing: 3px;
  display: block;
  text-align: center;
  margin-bottom: 18px;
}
.ctx-win-stats {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.ctx-win-stat {
  text-align: center;
  background: #f9f7f3;
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 72px;
  border: 1px solid #ddd5c8;
}
.ctx-win-stat-num { font-size: 24px; font-weight: 900; color: #c9a431; display: block; }
.ctx-win-stat-lbl { font-size: 11px; color: #9a9080; display: block; margin-top: 2px; }
.ctx-countdown { text-align: center; font-size: 12px; color: #9a9080; margin-bottom: 18px; }
.ctx-countdown b { font-size: 22px; font-weight: 900; color: #1c1a16; display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Reveal modal */
.ctx-reveal-word { font-size: 30px; font-weight: 900; color: #b52828; text-align: center; display: block; margin-bottom: 18px; letter-spacing: 3px; }
.ctx-closest-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.ctx-closest-item { background: #ede9e0; border-radius: 6px; padding: 4px 10px; font-size: 12px; color: #5a5347; }
.ctx-closest-item span:last-child { font-size: 10px; color: #c9a431; margin-left: 4px; font-weight: 700; }

/* Mode modal */
.ctx-mode-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 2px solid #ddd5c8;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.ctx-mode-option:hover { border-color: #c9a431; background: #f9f7f3; }
.ctx-mode-icon { font-size: 26px; flex-shrink: 0; }
.ctx-mode-info h3 { font-size: 15px; font-weight: 800; color: #1c1a16; margin: 0 0 3px; display: block; }
.ctx-mode-info p  { font-size: 12px; color: #9a9080; margin: 0; display: block; }

/* Hint modal */
.ctx-hint-reveal {
  font-size: 24px;
  font-weight: 900;
  color: #c9a431;
  text-align: center;
  padding: 16px;
  background: #f9f7f3;
  border-radius: 10px;
  display: block;
  margin-bottom: 12px;
  letter-spacing: 2px;
  border: 1.5px solid #ddd5c8;
}
.ctx-hint-note { font-size: 12px; color: #9a9080; text-align: center; display: block; margin-bottom: 14px; }

/* Archive modal */
.ctx-archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border: 1.5px solid #ddd5c8;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.ctx-archive-item:hover { border-color: #c9a431; background: #f9f7f3; }
.ctx-archive-item.current { border-color: #c9a431; background: #fffbea; }
.ctx-archive-date { font-size: 12px; color: #9a9080; }
.ctx-archive-num  { font-size: 13px; font-weight: 700; color: #1c1a16; }
.ctx-archive-done { font-size: 14px; }

/* Create game modal */
.ctx-create-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 2px solid #ddd5c8;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: #1c1a16;
  outline: none;
  display: block;
  margin-bottom: 10px;
  font-family: inherit;
  transition: border-color .15s;
}
.ctx-create-input:focus { border-color: #c9a431; }
.ctx-create-link {
  display: none;
  word-break: break-all;
  font-size: 12px;
  background: #f9f7f3;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ddd5c8;
  color: #1b7a3e;
  margin-top: 8px;
}
.ctx-create-link.show { display: block; }

/* Stats modal */
.ctx-stats-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

/* ---- MOBILE ---- */
@media (max-width: 480px) {
  #ctxWrap { padding: 0 10px 50px; }
  #ctxWrap .ctx-row-word { flex: 0 0 78px; font-size: 13px; }
  #ctxWrap .ctx-row-rank { flex: 0 0 54px; font-size: 11px; }
  #ctxWrap .ctx-tab { padding: 8px 11px; font-size: 11px; }
}
