/* ============================================================
   21-rules.css — "ሕጎች / Rules" 4-tab page (Card / Play / Winning / Fair play)
   Opened from the Profile tab's "View game rules" button and from the
   hamburger menu's "Rules" item (both call showRules() in 05-tabs.js).
   ============================================================ */

.rules { padding-bottom: 4px; }

.rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.rules-title {
  font-size: 19px;
  font-weight: 900;
  color: #f0c14b;
}

.rules-x {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

/* ---- Tab bar: Card | Play | Winning | Fair play ---- */
.rules-tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: var(--surface);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 14px;
}

.rules-tabbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.rules-tabbtn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rules-tabbtn.on { background: var(--card-bg); color: #f0c14b; box-shadow: 0 1px 4px rgba(0,0,0,.18); }

/* ---- Progress row: "2 / 4" ... pill ... bar ---- */
.rules-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rules-count { font-size: 13px; font-weight: 700; color: var(--text-muted); }

.rules-pill {
  background: var(--purple);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 20px;
}

.rules-progress-bar {
  height: 5px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 18px;
}

.rules-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--warning));
  transition: width .2s ease;
}

/* ---- Hero: big icon circle + page title ---- */
.rules-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.rules-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.rules-icon-circle svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.rules-icon-circle.c-green { background: var(--green); }
.rules-icon-circle.c-blue { background: var(--blue); }
.rules-icon-circle.c-orange { background: var(--warning); }
.rules-icon-circle.c-purple { background: var(--purple); }
.rules-icon-circle.c-red { background: var(--danger); }

.rules-hero-title { font-size: 21px; font-weight: 900; }

/* ---- Numbered step cards (Card tab, Play tab) ---- */
.rules-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}

.step-num {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
}

.step-num.c-green { background: var(--green); }
.step-num.c-red { background: var(--danger); }
.step-num.c-blue { background: var(--blue); }
.step-num.c-orange { background: var(--warning); }
.step-num.c-purple { background: var(--purple); }

.step-txt b { display: block; font-size: 15px; font-weight: 800; margin-bottom: 3px; }

.step-txt p { font-size: 13.5px; line-height: 1.55; color: var(--text); opacity: .88; }

/* ---- "Game mechanics" / "Card details" box ---- */
.mech-box {
  background: rgba(35,134,54,.1);
  border: 1px solid rgba(63,185,80,.4);
  border-radius: 14px;
  padding: 14px;
  margin-top: 6px;
}

.mech-head { font-size: 13px; font-weight: 800; color: #3fb950; margin-bottom: 10px; }

.mech-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; }

.mech-item b { display: block; font-size: 12.5px; font-weight: 800; margin-bottom: 2px; }

.mech-item span { display: block; font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ---- Winning tiers (10 ETB / 20 ETB) ---- */
.tier-box { border-radius: 14px; padding: 14px; margin-bottom: 10px; border: 1px solid; }

.tier-box.amber { background: rgba(210,153,34,.12); border-color: rgba(210,153,34,.45); }
.tier-box.blue { background: rgba(31,111,235,.12); border-color: rgba(31,111,235,.4); }

.tier-head { font-size: 14px; font-weight: 800; margin-bottom: 6px; }
.tier-box.amber .tier-head { color: #e3a008; }
.tier-box.blue .tier-head { color: #58a6ff; }

.tier-box p { font-size: 13px; line-height: 1.55; color: var(--text); opacity: .9; }

.rules-subhead { font-size: 13.5px; color: var(--text); margin: 16px 0 10px; line-height: 1.5; }

/* ---- Individual pattern cards ---- */
.pattern-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.pattern-ic {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
}

.pattern-txt b { display: block; font-size: 14.5px; font-weight: 800; margin-bottom: 2px; }

.pattern-txt p { font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }

/* ---- Tiny dot-grid used inside pattern-ic and the combo visual ---- */
.pdot-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5px;
  width: 100%;
  height: 100%;
}

.pdot-grid i { display: block; border-radius: 1.5px; background: rgba(255,255,255,.3); }
.pdot-grid i.on { background: #fff; }
.pdot-grid i.free { background: rgba(255,255,255,.65); }

.pdot-grid.neutral i { background: var(--surface); border: 1px solid var(--border); }
.pdot-grid.neutral i.on { background: var(--green); border-color: var(--green); }
.pdot-grid.neutral i.free { background: #f0c14b; border-color: #f0c14b; }

/* ---- Green boxes: "2 patterns = win" combo visual + "Multiple winners" ---- */
.combo-box, .fair-box.neutral {
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.combo-box {
  background: rgba(63,185,80,.1);
  border: 1px solid rgba(63,185,80,.4);
}

.combo-head { font-size: 13.5px; font-weight: 800; color: #3fb950; margin-bottom: 10px; }

.combo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }

.combo-grid { width: 92px; height: 92px; flex-shrink: 0; }

.combo-info p { font-size: 12.5px; line-height: 1.55; color: var(--text); opacity: .9; }

.combo-caption { margin-top: 8px; font-size: 12px; font-weight: 800; color: #3fb950; text-align: center; }

.combo-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }

.combo-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(63,185,80,.3);
  transition: width .2s, border-radius .2s;
}

.combo-dots i.on { width: 20px; border-radius: 4px; background: #3fb950; }

/* ---- Fair-play boxes ---- */
.fair-box { border-radius: 14px; padding: 14px; margin-bottom: 10px; }

.fair-box.purple { background: rgba(137,87,229,.12); border: 1px solid rgba(137,87,229,.4); }
.fair-box.neutral { background: var(--card-bg); border: 1px solid var(--border); }

.fair-head { font-size: 13.5px; font-weight: 800; margin-bottom: 6px; }
.fair-box.purple .fair-head { color: #b794f6; }

.fair-box p { font-size: 13px; line-height: 1.55; color: var(--text); opacity: .9; }

.good-list { list-style: none; margin-top: 4px; }

.good-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.good-list li:last-child { border-bottom: none; }

.good-list li b { flex-shrink: 0; color: #3fb950; }

/* ---- Prev / next nav row at the bottom of the sheet ---- */
.rules-navrow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.rules-navbtn {
  padding: 11px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.rules-navbtn:active { transform: scale(.96); }
