/* memorize.css - Games hub tab switcher + the Memorization category
   (/games). Reuses tokens from styles.css and the .course-shell/.course-hero/
   .course-primary chrome from account.css; puzzle-section-heading etc. are
   borrowed from sliding-puzzle/games.css just for visual consistency between
   the two game categories.

   --memo-scale (default .7, i.e. 30% smaller than those shared components'
   normal size -- the Memorization tab was taking up a lot more vertical
   space than the puzzle tab) scales every font-size/padding below via
   calc(), including on the borrowed shared classes -- but only when
   they're nested under #memorizeCategory, so Sliding Puzzle and the rest
   of the site keep their normal size untouched. memorize.js's text-size
   control (A-/A+) adjusts this variable at runtime and remembers the
   choice in localStorage. */

#memorizeCategory {
  --memo-scale: .7;
}

.games-tabs {
  max-width: 760px;
  width: 100%;
  margin: 24px auto 0;
  display: flex;
  gap: 8px;
}
.games-tab {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.games-tab:hover { color: var(--text); }
.games-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* -- Scoped overrides for shared/borrowed classes, sized down by --memo-scale */
#memorizeCategory .course-hero {
  padding: calc(36px * var(--memo-scale, 1)) calc(28px * var(--memo-scale, 1));
}
#memorizeCategory .course-title {
  font-size: calc(36px * var(--memo-scale, 1));
}
#memorizeCategory .course-subtitle {
  font-size: calc(15px * var(--memo-scale, 1));
}
#memorizeCategory .puzzle-section-heading {
  font-size: calc(20px * var(--memo-scale, 1));
}
#memorizeCategory .verse-text {
  font-size: calc(24px * var(--memo-scale, 1));
}
#memorizeCategory .feedback {
  font-size: calc(14px * var(--memo-scale, 1));
}
#memorizeCategory .feedback.success,
#memorizeCategory .feedback.error {
  padding: calc(18px * var(--memo-scale, 1)) calc(22px * var(--memo-scale, 1));
  gap: calc(14px * var(--memo-scale, 1));
}
#memorizeCategory .feedback strong {
  font-size: calc(17px * var(--memo-scale, 1));
}
#memorizeCategory .course-primary {
  padding: calc(13px * var(--memo-scale, 1)) calc(14px * var(--memo-scale, 1));
  font-size: calc(15px * var(--memo-scale, 1));
}
#memorizeCategory .puzzle-shuffle-btn {
  padding: calc(9px * var(--memo-scale, 1)) calc(16px * var(--memo-scale, 1));
  font-size: calc(13px * var(--memo-scale, 1));
}
#memorizeCategory .puzzle-loading {
  font-size: calc(14px * var(--memo-scale, 1));
}
#memorizeCategory .blank {
  min-width: 9ch; /* extra breathing room per character vs. the site default 6ch */
  padding: 2px 14px;
  text-transform: lowercase; /* grading is already case-insensitive; no reason to fuss over capitals while typing */
}

.memorize-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.memorize-context-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  margin-top: calc(12px * var(--memo-scale, 1));
}
.memorize-context-toggle input { cursor: pointer; }

/* Context words flow inline with the verse's own word/blank spans inside
   #memorizeVerseText (a flex-wrap container) -- same size, same family,
   not italicized, just muted -- so it reads as one continuous paragraph. */
.memorize-context-word {
  color: var(--muted);
  opacity: .75;
}

.memorize-textsize {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.memorize-textsize button {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.memorize-textsize button:hover { background: var(--accent2); }
.memorize-textsize span[id] { min-width: 34px; text-align: center; font-weight: 600; }

/* Non-blocking reminder for anonymous visitors -- practice works fully
   without an account, this just sits above the practice panel rather
   than gating it. */
.memorize-anon-banner:not([hidden]) {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--accent2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
}
.memorize-anon-banner .course-primary {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

.memorize-panel:not([hidden]) {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: calc(24px * var(--memo-scale, 1));
}

.memorize-coverage {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: calc(18px * var(--memo-scale, 1)) calc(22px * var(--memo-scale, 1));
}
.memorize-coverage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: calc(14px * var(--memo-scale, 1));
  font-weight: 600;
  color: var(--text);
  margin-bottom: calc(10px * var(--memo-scale, 1));
}
.memorize-coverage-head span:last-child {
  color: var(--accent);
  font-size: calc(16px * var(--memo-scale, 1));
}
.memorize-coverage-track {
  height: calc(12px * var(--memo-scale, 1));
  border-radius: 999px;
  background: var(--accent2);
  overflow: hidden;
}
.memorize-coverage-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  transition: width .4s ease;
}
.memorize-coverage-detail {
  margin: calc(10px * var(--memo-scale, 1)) 0 0;
  font-size: calc(13px * var(--memo-scale, 1));
  color: var(--muted);
}

.memorize-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: calc(24px * var(--memo-scale, 1));
}
.memorize-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(12px * var(--memo-scale, 1));
  flex-wrap: wrap;
  margin-bottom: calc(14px * var(--memo-scale, 1));
}
.memorize-badges {
  display: flex;
  gap: calc(8px * var(--memo-scale, 1));
  flex-wrap: wrap;
}
.memorize-score-badge {
  font-size: calc(13px * var(--memo-scale, 1));
  font-weight: 600;
  color: var(--accent);
  background: var(--accent2);
  padding: calc(6px * var(--memo-scale, 1)) calc(12px * var(--memo-scale, 1));
  border-radius: 999px;
  white-space: nowrap;
}
.memorize-hidden-badge {
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
}
.memorize-actions {
  display: flex;
  gap: calc(10px * var(--memo-scale, 1));
  flex-wrap: wrap;
  margin-top: calc(18px * var(--memo-scale, 1));
}
.memorize-actions .course-primary,
.memorize-actions .puzzle-shuffle-btn { flex: 1; min-width: calc(140px * var(--memo-scale, 1)); }

.memorize-history {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: calc(20px * var(--memo-scale, 1)) calc(22px * var(--memo-scale, 1));
}
.memorize-history-list {
  display: flex;
  flex-direction: column;
  gap: calc(8px * var(--memo-scale, 1));
}
.memorize-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(10px * var(--memo-scale, 1));
  padding: calc(8px * var(--memo-scale, 1)) 0;
  border-bottom: 1px solid var(--border);
  font-size: calc(13px * var(--memo-scale, 1));
}
.memorize-history-row:last-child { border-bottom: none; }
.memorize-history-ref { font-weight: 600; color: var(--text); }
.memorize-history-meta { color: var(--muted); }
.memorize-history-badge {
  font-size: calc(11px * var(--memo-scale, 1));
  font-weight: 700;
  padding: calc(3px * var(--memo-scale, 1)) calc(8px * var(--memo-scale, 1));
  border-radius: 999px;
  white-space: nowrap;
}
.memorize-history-badge.pass { background: rgba(47,107,47,.12); color: #2f6b2f; }
.memorize-history-badge.partial { background: rgba(200,147,82,.18); color: #8a6526; }
.memorize-history-badge.fail { background: rgba(139,32,32,.1); color: #8b2020; }

@media (max-width: 480px) {
  .games-tabs { flex-direction: column; }
}
