:root {
  --bg: #f9f9f9;
  --fg: #333;
  --muted: #666;
  --accent: #ff9f1c;  /* playful orange */
  --brand: #17a2b8;   /* header/footer brand color */
  --card: #fff;
  --shadow: 0 4px 14px rgba(0,0,0,.08);
  --radius: 14px;
  --gap: 20px;
  --maxw: 1400px; /* container width target for 4 columns */
  --ok: #1a7f37;
  --err: #b00020;
  --tab: #ececec;
  --tabActive: #ffd9ad;
}
* { box-sizing: border-box; }

/* Header with HahuBet brand color */
header {
  text-align: center;
  padding: 6px 16px 10px;
  background-color: var(--brand);
  color: #fff;
}



header h1, header .subtitle { color: #fff; }

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: 'Nunito','Noto Sans Ethiopic',system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
}

h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 2.6vw, 2.3rem); }
.subtitle { font-size: clamp(.95rem, 1.2vw, 1.05rem); margin: 0 0 10px; }

/* Main grid: 4 columns on large screens */
.container {
  display: grid;
  grid-template-columns: 1fr; /* mobile */
  gap: var(--gap);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px 32px;
}
@media (min-width: 1100px) {
  .container { grid-template-columns: repeat(4, 1fr); }
}

.series, .practice {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* Titles: default 16px orange; ሀ/ለ/ሐ/መ doubled (32px) */
.series-title {
  font-size: 32px; font-weight: 700; color: var(--accent); margin: 0 0 12px;
}


/* Series list vertical */
.boxes { display: flex; flex-direction: column; gap: 14px; }

/* Practice spans all 4 columns */
@media (min-width: 1100px) { .practice { grid-column: 1 / 5; } }

/* Tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { background: var(--tab); border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 800; cursor: pointer; }
.tab.active { background: var(--tabActive); }
.panel { display: block; }
.panel[hidden] { display: none; }

/* === PRACTICE LAYOUT RULES === */
/* Default grid for any practice ".boxes" unless overridden below */
.practice .boxes { display: grid; grid-template-columns: 1fr; gap: 12px; }

/* Answer (Typing), Listening, Matching => 3 columns (≥900px) */
@media (min-width: 900px) {
  #typing-boxes,
  #listening-boxes,
  #matching-boxes { grid-template-columns: repeat(3, 1fr); }
}

/* Pictures practice: questions grid = 1 column on mobile, 2 columns on larger screens (prevent overflow) */
#pictures-boxes {
  display: grid;
  grid-template-columns: 1fr;    /* mobile: 1 per row */
  gap: 12px;
}
@media (min-width: 800px) {
  #pictures-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* tablet/desktop: 2 per row */
}

/* Handwriting: two columns (left controls, right canvas); stack on small screens */
.hand-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .hand-grid { grid-template-columns: 320px 1fr; } }

/* === Series row styling === */
.box {
  display: flex; align-items: center; gap: 14px; background: #f6f6f6; border: 0; border-radius: 10px;
  padding: 12px; cursor: pointer; flex-wrap: nowrap; width: 100%; text-align: left;
  transition: transform .06s ease, box-shadow .12s ease;
}
.box:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.icon-img { width: 135px; height: 135px; object-fit: contain; border-radius: 8px; background: #fff; flex: 0 0 135px; }
.icon-fallback {
  width: 135px; height: 135px; display: flex; align-items: center; justify-content: center; font-weight: 900;
  font-size: 3.6rem; color: var(--accent); background: #fff; border-radius: 8px; flex: 0 0 135px;
}
.box.uses-letter-media .word-block .letter { display: none; }
.word-block { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.letter { font-weight: 900; font-size: 1.8rem; color: var(--accent); line-height: 1.15; }
.word { font-size: 1.1rem; color: #333; line-height: 1.25; }
.translation { font-size: 1rem; color: var(--muted); line-height: 1.25; }

/* === Typing (Answer) row === */
.practice-row {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center;
  background: #f6f6f6; border-radius: 10px; padding: 10px;
}
.practice-letter { font-weight: 900; font-size: 1.6rem; color: var(--accent); min-width: 2.5ch; text-align: center; }
.practice-audio, .mc-audio {
  border: none; border-radius: 8px; padding: 8px 10px; background: #fff; color: #333; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.practice-input, .match-select, .hand-select, .hand-range {
  padding: 8px 10px; border-radius: 8px; border: 1px solid #ccc; width: 100%; font-family: inherit; font-size: 1rem;
}
.status { font-weight: 700; min-width: 2ch; text-align: center; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn { padding: 10px 14px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.btn.secondary { background: #333; color: #fff; }
.result { margin-top: 8px; font-weight: 800; }

/* === Listening MCQ === */
.mc-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; background: #f6f6f6; border-radius: 10px; padding: 12px; }
.options { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 600px) { .options { grid-template-columns: repeat(2, 1fr); } } /* internal two-column at tablet */

.opt { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.opt input { accent-color: var(--accent); }
.opt.correct { border-color: var(--ok); }
.opt.wrong   { border-color: var(--err); }

/* === Pictures practice (the “picture matching”) === */
.pic-row, .pic-card { width: 100%; }  /* guard against overflow */
.pic-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; background: #f6f6f6; border-radius: 10px; padding: 12px; }
.pic-letter { font-weight: 900; font-size: 1.6rem; color: var(--accent); min-width: 2.5ch; text-align: center; }
.pic-options { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .pic-options { grid-template-columns: repeat(2, minmax(200px, 1fr)); } } /* two-column choices */
.pic-card {
  position: relative; background: #fff; border: 2px solid #ddd; border-radius: 10px; padding: 10px;
  display: grid; grid-template-columns: minmax(160px, 40%) 1fr; align-items: center; gap: 12px; cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.pic-card img { width: 100%; height: 158px; object-fit: contain; background: #fff; border-radius: 6px; }
.pic-fallback {
  width: 100%; height: 158px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 4.6rem;
  color: var(--accent); background: #fff; border-radius: 6px; user-select: none;
}
.pic-caption { font-size: 1rem; color: #333; text-align: left; }
.pic-card input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pic-card.selected { border-color: #2a76f6; box-shadow: 0 0 0 3px rgba(42,118,246,.15); }
.pic-card.correct  { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(26,127,55,.15); }
.pic-card.wrong    { border-color: var(--err); box-shadow: 0 0 0 3px rgba(176,0,32,.12); }

/* === Handwriting === */
.hand-controls { background: #f6f6f6; border-radius: 10px; padding: 12px; display: grid; gap: 10px; align-content: start; }
.hand-label { font-weight: 700; color: #333; }
.hand-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.hand-canvas-wrap { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 8px; }
.hand-canvas { display: block; width: 100%; height: auto; max-width: 600px; border-radius: 8px; background: #fff; touch-action: none; }
.hand-progress { font-weight: 800; color: #333; }
.hand-mini { font-size: .92rem; color: #666; }

@media print {
  body { background: #fff; }
  .container { gap: 12px; }
  .series, .practice { box-shadow: none; border: 1px solid #ddd; }
  .practice-audio, .mc-audio, .btn { display: none; }
}


.nav-btn {
  border-radius: 30px !important;
  padding: 8px 18px !important;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Noto Sans Ethiopic','Nunito',sans-serif;
  transition: 0.2s ease-in-out;
}

/* Active page button */
.nav-btn.active {
  background: #ffffff !important;
  color: #17a2b8 !important;
  border-color: #ffffff !important;
}


.nav-list {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: flex-start; /* centre breaks overflow scroll */
}

/* Hover effect */
.nav-btn:hover {
  background: #ffffff !important;
  color: #17a2b8 !important;
}


/* Font stack with Ethiopic support for crisp Amharic/Geʽez rendering */
:root{
  --brand: #17a2b8;
  --brand-dark: #13899a;
  --text-on-brand: #ffffff;
  --focus: #ffbf47; /* high-visibility focus */
}

/* Scope to header nav only so it doesn't affect other links */
.site-header nav ul{
  list-style: none;
  display: flex;
  gap: 12px;          /* tighter gap for compact look */
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-header nav a{
  display: inline-block;
  padding: 8px 14px;  /* button-like sizing */
  font-size: 16px;
  line-height: 1;
  color: var(--text-on-brand);
  text-decoration: none;
  border-radius: 6px; /* sq */
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08); /* subtle contrast over brand bg */
  transition: background .2s ease, border-color .2s ease, transform .05s ease, color .2s ease;
  /* Better Ethiopic/Geʽez rendering */
  font-family: "Noto Sans Ethiopic", "Abyssinica SIL",
               -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Hover / Active */
.site-header nav a:hover{
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.55);
}
.site-header nav a:active{
  transform: translateY(1px);
}

/* Keyboard focus (accessibility) */
.site-header nav a:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  background: #ffffff;
  color: #17323f; /* readable ink color */
  border-color: #ffffff;
}

/* Optional: mark current page by adding class="is-active" to that <a> */
.site-header nav a.is-active{
  background: #ffffff;
  color: #17323f;
  border-color: #ffffff;
  font-weight: 600;
}

/* Responsive tweaks for small screens */
@media (max-width: 600px){
  .site-header nav ul{
    gap: 8px;
  }
  .site-header nav a{
    padding: 10px 12px;      /* a bit taller for touch targets */
    font-size: 15px;
    border-radius: 12px;     /* slightly less round on mobile */
    background: rgba(255,255,255,0.12);
  }
}


/* Remove the white rectangle after the title */
header h1,
header h2,
header .subtitle {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Keep nav links in one horizontal line */
.site-header nav ul {
  display: flex !important;
  flex-wrap: nowrap !important;   /* stops wrapping */
  gap: 12px;
  margin: 0;
  padding: 0;
  align-items: center;
}

/* Prevent <li> from stacking vertically */
.site-header nav li {
  display: inline-block !important;
}

/* Prevent <a> from forcing blocks */
.site-header nav a {
  display: inline-block !important;
}


/* ----- HAMBURGER TOGGLE (NO WHITE BOX) ----- */
.nav-toggle {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
  display: none; /* hidden on desktop */
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: #fff;
  margin: 5px 0;
  border-radius: 2px;
}

/* ----- NAV DESKTOP (RIGHT-ALIGNED) ----- */
.nav-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: flex-end;  /* right side */
  align-items: center;
}

/* ----- MOBILE BEHAVIOR ----- */
@media (max-width: 700px) {
  /* show hamburger */
  .nav-toggle {
    display: block !important;
  }

  /* hide nav by default */
  .nav-list {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 12px;
    width: 100%;
    margin-top: 12px;
  }

  /* when opened */
  .nav-list.is-open {
    display: flex;
  }
}



/* Make the nav block span ~75% of the header width and center it */
.nav-list {
  width: 90% !important;               /* target 75% of header width */
  justify-content: center !important;  /* centered within the 75% block */
  flex-wrap: nowrap !important;        /* keep in a single line on desktop */
  gap: 10px;                           /* slightly tighter spacing to help fit */
}

/* Increase button font size and keep text on one line */
.site-header nav a {
  font-size: clamp(17px, 1.8vw, 22px) !important;  /* responsive bump */
  white-space: nowrap !important;                  /* prevent line breaks */
  padding: 10px 14px;                              /* balanced hit area after font increase */
  border-radius: 999px !important;                   /* square-ish as requested earlier */
}


/* Prevent local words header from collapsing on mobile */
#site-header .nav-list {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  white-space: nowrap;
}

#site-header .nav-item {
  display: inline-block !important;
  margin-right: 10px;
}

/* Hide the hamburger for local header */
#site-header .nav-toggle {
  display: none !important;
}


/*Each alphabet css */
		body {
			font-family: Arial, sans-serif;
			background-color: #f0f8ff; /* from learning page */
			color: #f0f8ff;
			text-align: center;
			padding: 0px;
            margin: 0;
            padding: 0

		}

       
		
		.container {
			display: grid;
			grid-template-columns: repeat(4, 1fr);
			gap: 20px;
			width: 100%;
			max-width: 1200px;
			margin: 20px auto;
            background-color: #f0f8ff;
		}
		
        .series {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin: 10px;
        }
		
        .box {
            width: 100px;
            height: 100px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            margin: 5px;
            border-radius: 10px;
            color: #f0f8ff;
            font-size: 25px;
            font-weight: bold;
            cursor: pointer;
        }
		
       

        .ha-series .box { background-color: #ffcccc; } /* Light Pink */
        .le-series .box { background-color: #cceeff; } /* Light Blue */
        .ha2-series .box { background-color: #ffe0b3; } /* Light Green */
        .me-series .box { background-color: #ccffcc; } /* Gold */

        .se-series .box { background-color: #ffcccc; } /* Light Pink */
        .re-series .box { background-color: #cceeff; } /* Light Blue */
        .se2-series .box { background-color: #ffe0b3; } /* Light Green */
        .she-series .box { background-color: #ccffcc; } /* Gold */
		
		.qe-series .box { background-color: #FFB6C1; } /* Light Pink */
        .be-series .box { background-color: #ADD8E6; } /* Light Blue */
        .te-series .box { background-color: #90EE90; } /* Light Green */
        .che-series .box { background-color: #FFD700; } /* Gold */
         /* Series Colors */
		
	
		.je-series .box { background-color: #FFCDD2; }
        .ge-series .box { background-color: #C8E6C9; }
        .te-series .box { background-color: #BBDEFB; }
        .che-series .box { background-color: #FFF9C4; }


        .ke-series .box { background-color: #FFDDC1; }
        .xe-series .box { background-color: #C1E1FF; }
        .we-series .box { background-color: #C1FFC1; }
        .ae-series .box { background-color: #FFC1E1; }
		
		.ze-series .box { background-color: #ffcccb; }
        .ze2-series .box { background-color: #d1e7dd; }
        .ye-series .box { background-color: #fff3cd; }
        .de-series .box { background-color: #cfe2f3; }
		
		.hee-series .box { background-color: #ffcccb;}
        .ne-series .box { background-color: #d1e7dd; }
        .nye-series .box { background-color: #fff3cd; }
        .ae-series .box { background-color: #cfe2f3; }
		
		.pe-series .box { background-color: #D4A5A5; }
        .tse-series .box { background-color: #392F5A; color: #FFF; }
        .tse2-series .box { background-color: #31A2AC; }
        .fe-series .box { background-color: #61C0BF; }
        .ve-series .box { background-color: #61C0BF; }
        .pe2-series .box { background-color: #6B4226; color: #FFF; }

/* Footer */
footer {
    margin-top: 40px;
    font-size: 14px;
    color: #666;
}
.footer-links {
    margin-top: 10px;
}
.footer-links a {
    margin: 0 10px;
    color: #0077cc;
    text-decoration: none;
}
.footer-links a:hover {
    text-decoration: underline;
}


/* ---- Add-on for JSON cards (non-conflicting) ---- */
.box .en-word {
  display: block;
  font-size: 12px;
  line-height: 1.2;
  color: #444;
  margin-top: 4px;
}

.box .thumb {
  width: 90px;          /* fits inside your 100x100 .box */
  height: 60px;
  margin-top: 6px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.box .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Optional accessibility focus for keyboard users */
.box { outline: none; }
.box:focus {
  box-shadow: 0 0 0 3px rgba(23,162,184,.35);
}


body {
  background: #f9f9f9;
  font-family: 'Nunito', 'Noto Sans Ethiopic', Arial, sans-serif;
  margin: 0;
  padding: 0;
}

h1 {
  text-align: center;
  margin: 30px 0 10px;
  font-size: 2rem;
  color: #333;
}

.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  padding: 20px;
  text-align: center;
  transition: transform 0.12s, box-shadow 0.12s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
}

.img-wrap {
  width: 100%;
  max-width: 220px;
  margin: 0 auto 16px;
  border-radius: 12px;
  overflow: hidden;
}

.img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.am-word {
  font-size: 2rem;
  font-weight: 900;
  color: #ff9f1c; /* Bright orange for emphasis */
  margin-bottom: 8px;
  font-family: 'Noto Sans Ethiopic', 'Nunito', Arial, sans-serif;
}

.en-word {
  font-size: 1rem;
  color: #555;
  margin-bottom: 12px;
}

.audio-btn {
  background: #17a2b8;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.audio-btn:hover {
  background: #138496;
}


/* --- Words page scoped image sizing --- */
#series-container .card-img-top {
  width: 100%;
  height: auto;

  /* Choose the fit you want: */
  object-fit: contain;         /* shows full image (no cropping) */
  /* object-fit: cover; */     /* alternative: fills box, may crop edges */

  /* Consistent responsive box for varied image sizes */
  aspect-ratio: 4 / 3;         /* adjust if your assets are more square or portrait */
  background: #fff;            /* neutral background for contain mode */
  border-bottom: 1px solid #eee;
}

/* Prevent oversized images from pushing outside the card */
#series-container .card {
  overflow: hidden;
}

/* Make card layout resilient: image + body flex */
#series-container .card.h-100 {
  display: flex;
  flex-direction: column;
}
#series-container .card .card-body {
  flex: 1 1 auto;
}


/* --- Spacing and “independent box” look for word cards --- */

/* Extra safety: row-level vertical spacing (in case g-4 is overridden somewhere) */
#series-container .row {
  row-gap: 1.5rem;     /* ~g-4 vertical gap */
  column-gap: 1.5rem;  /* ~g-4 horizontal gap */
}

/* Card visual separation */
#series-container .card {
  background: #fff;
  border: 1px solid #e9ecef;    /* light border */
  border-radius: 12px;          /* smoother edges */
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06); /* subtle elevation */
  overflow: hidden;             /* keeps image corners rounded */
  transition: box-shadow .15s ease, transform .05s ease;
}

#series-container .card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}

/* Image stays contained and consistent */
#series-container .card-img-top {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;      /* adjust to 1/1 or 3/4 if your assets differ */
  object-fit: contain;      /* or 'cover' if you prefer filling the frame */
  background: #fff;
  border-bottom: 1px solid #eee;
}

/* Keep body content balanced under the image */
#series-container .card.h-100 {
  display: flex;
  flex-direction: column;
}
#series-container .card .card-body {
  flex: 1 1 auto;
  padding-bottom: 1rem;      /* ensure some breathing room */
}


/* ===== Words page namespace (insulates from Bootstrap grid) ===== */

/* Grid wrapper: 1 column on mobile, 4 columns on desktop */
#words-page .words-container {
  display: grid;
  grid-template-columns: 1fr;          /* mobile */
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
  background: #f9f9f9;
}

@media (min-width: 1100px) {
  #words-page .words-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Prevent Bootstrap grid from affecting this island */
#words-page .row,
#words-page [class*="col-"],
#words-page .container {
  all: unset;                           /* strip Bootstrap layout properties */
  display: contents;                    /* keep children participating in our grid */
}

/* Card/box visuals: robust and non-wrapping */
#words-page .box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  color: #222;                          /* readable text */
  text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

/* Image sizing that won’t force wrap or overflow */
#words-page .thumb {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 4 / 3;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}
#words-page .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;                  /* keep entire image visible */
}

/* Card container safeguards (if you use .card markup) */
#words-page .card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: box-shadow .15s ease, transform .05s ease;
}
#words-page .card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}
#words-page .img-wrap,
#words-page .card-img-top {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;                  /* consistent frame */
  object-fit: contain;                   /* or 'cover' if you prefer fill */
  background: #fff;
  border-bottom: 1px solid #eee;
}
#words-page .card.h-100 {
  display: flex;
  flex-direction: column;
}
#words-page .card .card-body {
  flex: 1 1 auto;
  padding-bottom: 1rem;
}

/* Accessibility focus */
#words-page .box:focus {
  outline: 3px solid #17a2b8;
  outline-offset: 2px;
}

/* Fix invisible text caused by earlier body color rule */
#words-page { color: #222; }



/* === Global spacing variables for words pages === */
:root {
  --row-gap: 1.25em;      /* vertical spacing between rows/boxes */
  --col-gap: 1.25em;      /* horizontal spacing between columns */
  --section-gap: 2em;     /* spacing between series sections */
  --card-gap: 1.75em;     /* spacing between card rows */
}

/* === Interactive series (render.js) === */
#series-container {
  display: grid;
  /* 1 col on xs; 4 cols on ≥576px to match your intent */
  grid-template-columns: 1fr;
  gap: var(--section-gap) var(--col-gap);
}

@media (min-width: 768px) {
  #series-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Each series column */
#series-container .series {
  width: 100%;
  /* space between series columns is controlled by grid gap */
  margin: 0; /* remove inline margins */
}

/* Series title spacing */
#series-container .series-title {
  margin: 0 0 0.75em 0;
}
#series-container .series-title.big {
  margin-bottom: 1em;
}

/* Vertical list of boxes inside each series column */
#series-container .boxes {
  display: flex;
  flex-direction: column;
  gap: var(--row-gap);     /* proportional vertical spacing */
}

/* Individual interactive box */
#series-container .box {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.9em;
  width: 100%;
  min-height: 8.5em;
  padding: 0.8em;
  border-radius: 10px;
  background: #f6f6f6;
  cursor: pointer;
  margin: 0 !important;
}

/* Media area size consistent */
#series-container .box .icon-img,
#series-container .box .icon-fallback {
  width: 7.5em;
  height: 7.5em;
  flex: 0 0 7.5em;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

/* Right text block */
#series-container .word-block {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
}

/* Mobile: stack image on top, text below, 1 word per row */
@media (max-width: 767px) {
  #series-container {
    grid-template-columns: 1fr;
  }
  #series-container .box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: unset;
  }
  #series-container .box .icon-img,
  #series-container .box .icon-fallback {
    width: 100%;
    max-width: 220px;
    height: 160px;
    flex: 0 0 auto;
  }
  #series-container .word-block {
    align-items: center;
  }
}

/* Practice section spacing: sits across all columns */
#series-container .practice {
  grid-column: 1 / -1;
  margin: 0; /* controlled by container gap */
}

/* Tabs, panels — keep compact spacing */
#series-container .tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 0.75em;
}
#series-container .panel {
  margin-top: 0.25em;
}

/* === Card grid (render-groups.js read-only fallback) === */
#series-container .mb-4,
#groups-container .mb-4 {
  margin-bottom: var(--section-gap) !important; /* series section spacing */
}

#series-container .row.g-3,
#groups-container .row.g-3 {
  row-gap: var(--card-gap);
  column-gap: var(--col-gap);
}

#series-container .card,
#groups-container .card {
  margin: 0; /* remove inline bottom margin */
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Card image or letter tile height */
#series-container .card-img-top,
#groups-container .card-img-top {
  max-height: 10em;
  object-fit: cover;
}


/* Add padding above the HE–ME, SE–SHE buttons */
#site-header .nav-list {
    padding-top: 1.2rem;   /* adjust 1.2rem → 1.5rem if you want more space */
}

/* Optional: add spacing below them as well */
#site-header .nav-list li {
    margin-bottom: 0.3rem;
}


/* FORCE horizontal scrolling for header nav */
.site-header .nav-list {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 12px;

  overflow-x: auto !important;
  overflow-y: hidden !important;

  -webkit-overflow-scrolling: touch;
  scrollbar-width: none !important;

  white-space: nowrap;
  padding: 10px 0;
  margin: 0;
  justify-content: flex-start !important;

  max-width: 100% !important;
}

.site-header .nav-list::-webkit-scrollbar { display: none; }

/* Desktop: centre and no scroll needed */
@media (min-width: 900px) {
  .site-header .nav-list {
    justify-content: center !important;
    overflow-x: visible !important;
    flex-wrap: wrap !important;
  }
}

/* Ensure list items behave like chips */
.site-header .nav-list li {
  flex: 0 0 auto !important;
  list-style: none;
}

/* Ensure the nav buttons don't expand full width */
.site-header .nav-list .nav-btn {
  flex: 0 0 auto !important;
  white-space: nowrap;
  display: inline-block;

  background: #fff;
  color: var(--brand, #17a2b8);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  border: 0;
  font-size: 1rem;
}

.site-header .nav-list .nav-btn:hover {
  opacity: 0.9;
}


/* ============================================================
   WORDS PAGE ONLY — Horizontal scroll for HE–ME / SE–SHE nav
   Overrides global header styles without touching them
============================================================= */

#site-header .nav-list {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;

  white-space: nowrap !important;
  gap: 12px;
  padding: 10px 0;
  margin: 0;
  justify-content: flex-start !important; /* centre kills scroll — must be flex-start */
  scroll-behavior: smooth;
  scrollbar-width: none !important;       /* hide scrollbar */
}

/* list items behave like small chips */
#site-header .nav-list li {
  flex: 0 0 auto !important;
  list-style: none;
}

/* link buttons */
#site-header .nav-list .nav-btn {
  display: inline-block !important;
  flex: 0 0 auto !important;
  padding: 10px 18px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;

  background: #fff !important;
  color: var(--brand) !important;
  border: none !important;
  font-weight: 800;
  font-size: 1rem;
}

/* disable hamburger (words page only) */
#site-header .nav-toggle {
  display: none !important;
}


#site-header .nav-btn.active {
  background: var(--brand) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #fff;
}


/* Words cards: brand-tinted light border */
#series-container .card {
  border: 1px solid color-mix(in srgb, var(--brand) 18%, #ffffff);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}



/* ============================================================
   MATCH hatope_letters.html SECONDARY NAV BUTTON STYLE
============================================================= */

#site-header .nav-list .nav-btn {
  background: #fff !important;
  color: var(--brand) !important;
  border: 0 !important;
  box-shadow: none !important;

  font-weight: 800 !important;
  font-size: clamp(0.78rem, 1.2vw, 1.05rem) !important;  /* proportional: small mobile → desktop */

  padding: clamp(7px, 1.2vw, 11px) clamp(11px, 2vw, 20px) !important;

  border-radius: 999px !important;

  flex: 0 0 auto !important;
  white-space: nowrap !important;

  scroll-snap-align: start !important;
}

/* On desktop: no scroll needed, center the items */
@media (min-width: 900px) {
  #site-header .nav-list {
    justify-content: center !important;
    overflow-x: visible !important;
    flex-wrap: wrap !important;
  }
}

/* ensure row uses same scroll behavior as letters page */
#site-header .nav-list {
  scroll-snap-type: x mandatory !important;
  padding-bottom: 6px;
}

/* Button row spacing + wrapping */
.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.controls .btn { margin: 0; } /* remove default gaps if any */


/* --- Global question text sizing (~+20%) --- */
#panel-listen-word .opt span { font-size: 1.2rem; }     /* was 1.25rem */
#panel-missing-letter .gap-row span { font-size: 1.2rem; }
#panel-missing-letter .tile { font-size: 1.2rem; min-height: 44px; }
#panel-image-guess .tile { font-size: 1.2rem; }
#panel-match-family .tile { font-size: 1.2rem; }

/* --- Make practice area more colorful, but still soft and readable --- */
.practice {
  background: linear-gradient(135deg, #fff7ec, #e6f7ff 55%, #f4f9ff);
  border-radius: 14px;
  padding: 14px;
}

/* --- Slightly richer “card” backgrounds for rows --- */
.mc-row, .gap-row, .ig-row {
  background: linear-gradient(180deg, #fefaf4, #f6fbff);
  border: 1px solid rgba(0,0,0,0.06);
}

.dnd-bank {
  background: linear-gradient(180deg, #fff, #fbfdff);
  border: 1px dashed #cdd;
}

/* --- Accent badges/borders a bit more playful --- */
.alpha-badge {
  background: #fff7ec;
  border: 2px solid var(--accent, #ff9f1c);
}
.bucket {
  background: #fff;
  border-color: #cfd8dc;
}
.bucket.correct { border-color: #1a7f37; }
.bucket.wrong   { border-color: #b00020; }


#ap-shuffle {
  width: auto !important;
  max-width: fit-content !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  justify-self: center !important;
}


#panel-audio-practice .controls > label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

#panel-audio-practice .controls {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 12px !important;
  column-gap: 12px !important;
}

#panel-audio-practice .controls > label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 0 !important;
  white-space: nowrap !important;
}