/* Daily Word Lab — Knowledge Base (indigo accent), themed via the shared
   variables in line_escape.css (dark default, html[data-theme="light"]). */

.wl-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 14px 40px;
  color: var(--text);
  /* V578 (CR-14): #818cf8 was asked to be two things at once and was neither --
     4.08:1 as TEXT on the dark --panel (.wl-stat b, .wl-act.saved) and 2.98:1 as a
     FILL under the hard-coded `color:#fff` of the category chips and Today button.
     It is now the lightest indigo that clears 4.5:1 on --panel (4.64), and the fill's
     ink is a token: near-black indigo on the light fill (7.49), white on the light
     theme's deep one (6.29). Same hue in both. */
  --wl-ind: #8e98f9;
  --wl-ind-ink: #0b0820;
  --wl-ind-soft: rgba(129, 140, 248, 0.14);
  --wl-ind-line: rgba(129, 140, 248, 0.4);
}
html:not([data-dark]) .wl-wrap { --wl-ind: #4f46e5; --wl-ind-ink: #ffffff; --wl-ind-soft: rgba(79,70,229,0.10); --wl-ind-line: rgba(79,70,229,0.35); }

.wl-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.wl-topbar a.back {
  color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 600;
  background: var(--btn); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 12px;
}
.wl-title { font-size: 19px; font-weight: 700; }
.wl-share { font-size: 15px; }

/* category tabs */
.wl-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.wl-cats::-webkit-scrollbar { display: none; }
.wl-cat {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0;
  background: var(--btn); color: var(--muted); border: 1px solid var(--line2);
  border-radius: 9px; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.wl-cat.active { background: var(--wl-ind); border-color: var(--wl-ind); color: var(--wl-ind-ink); }
.wl-cat.placeholder { opacity: .45; border-style: dashed; cursor: not-allowed; }
.wl-badge { background: rgba(0,0,0,0.25); font-size: 10px; font-weight: 700; border-radius: 99px; padding: 2px 7px; }
.wl-cat:not(.active) .wl-badge { background: var(--panel); color: var(--muted2); }

/* view tabs */
.wl-views { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.wl-view { border: 0; background: transparent; color: var(--muted); padding: 7px 15px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }
.wl-view.active { background: var(--wl-ind); color: var(--wl-ind-ink); }

/* loading */
.wl-loading { display: flex; align-items: center; gap: 10px; color: var(--muted2); font-size: 14px; padding: 40px 0; justify-content: center; }
.wl-spin { width: 22px; height: 22px; border: 3px solid var(--line2); border-top-color: var(--wl-ind); border-radius: 50%; animation: wlspin .8s linear infinite; }
@keyframes wlspin { to { transform: rotate(360deg); } }

/* meta + nav */
.wl-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted2); margin-bottom: 8px; flex-wrap: wrap; }
.wl-pill { background: var(--wl-ind-soft); border: 1px solid var(--wl-ind-line); color: var(--text); font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 11px; }
.wl-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.wl-nav-btn { background: var(--btn); color: var(--muted); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.wl-nav-btn:disabled { opacity: .35; cursor: default; }
.wl-today-btn { background: var(--wl-ind); color: var(--wl-ind-ink); border: 0; border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.wl-counter { font-size: 12px; color: var(--muted2); margin-left: 6px; }

/* term card */
.wl-card {
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--wl-ind);
  border-radius: 14px; padding: 22px; margin-bottom: 14px;
  animation: wlfade .3s ease;
}
@keyframes wlfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wl-eyebrow { font-size: 11px; font-weight: 700; color: var(--muted2); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.wl-term { font-family: Georgia, "Times New Roman", serif; font-size: 2.1rem; font-weight: 700; line-height: 1.15; margin-bottom: 10px; }
.wl-termmeta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.wl-pos { background: var(--wl-ind); color: var(--wl-ind-ink); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 3px 10px; }
.wl-tag { font-size: 12px; color: var(--muted2); }
.wl-hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.wl-lbl { font-size: 11px; font-weight: 700; color: var(--muted2); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 7px; }
.wl-def { font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.7; color: var(--text); margin-bottom: 16px; }
.wl-eg { background: var(--btn); border-left: 3px solid var(--wl-ind); border-radius: 0 8px 8px 0; padding: 11px 13px; margin-bottom: 8px; }
.wl-eg p { font-family: Georgia, serif; font-style: italic; font-size: .98rem; color: var(--muted); line-height: 1.6; margin: 0; }
.wl-cardacts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.wl-act { background: var(--btn); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.wl-act.saved { background: var(--wl-ind-soft); border-color: var(--wl-ind); color: var(--wl-ind); }

/* stats strip */
.wl-stats { display: flex; justify-content: space-around; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.wl-stat { text-align: center; }
.wl-stat b { display: block; font-size: 1.35rem; color: var(--wl-ind); }
.wl-stat small { font-size: 11px; color: var(--muted2); }

/* archive */
.wl-arch-head { margin-bottom: 10px; }
#wl-search { width: 100%; background: var(--panel); border: 1px solid var(--line2); border-radius: 9px; color: var(--text); padding: 9px 13px; font-size: 14px; }
#wl-search:focus { border-color: var(--wl-ind); }
#wl-search:focus:not(:focus-visible){ outline: none; }
.wl-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.wl-chip { background: var(--btn); color: var(--muted); border: 1px solid var(--line2); border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.wl-chip.active { background: var(--wl-ind); border-color: var(--wl-ind); color: var(--wl-ind-ink); }
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.wl-gcard { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; transition: border-color .15s, transform .15s; }
.wl-gcard:hover { border-color: var(--wl-ind); transform: translateY(-2px); }
.wl-gcard.today { border-color: var(--wl-ind); }
.wl-gcard.today::before { content: 'Today'; position: absolute; top: -1px; right: 10px; background: var(--wl-ind); color: var(--wl-ind-ink); font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 0 0 6px 6px; }
.wl-gterm { font-family: Georgia, serif; font-size: 1.05rem; font-weight: 700; margin-bottom: 3px; }
.wl-gpos { font-size: 11px; color: var(--muted2); margin-bottom: 6px; }
.wl-gdef { font-size: 12px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wl-gtag { display: inline-block; margin-top: 8px; font-size: 10px; font-weight: 600; color: var(--muted2); background: var(--btn); border-radius: 99px; padding: 2px 8px; }
.wl-gbm { position: absolute; top: 10px; right: 10px; font-size: 13px; }
.wl-none { grid-column: 1/-1; text-align: center; color: var(--muted2); font-size: 14px; padding: 30px 0; }

/* quiz */
.wl-quiz-head { margin-bottom: 14px; }
.wl-quiz-title { font-size: 1.3rem; font-weight: 700; }
.wl-quiz-sub { font-size: 13px; color: var(--muted2); margin-top: 3px; }
.wl-qbar { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.wl-qfill { height: 100%; background: var(--wl-ind); border-radius: 99px; transition: width .4s; }
.wl-qcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; animation: wlfade .3s ease; }
.wl-qnum { font-size: 11px; font-weight: 700; color: var(--muted2); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.wl-qq { font-family: Georgia, serif; font-size: 1.15rem; line-height: 1.5; margin-bottom: 18px; }
.wl-qq em { color: var(--muted); }
.wl-qopts { display: flex; flex-direction: column; gap: 8px; }
.wl-qopt { text-align: left; background: var(--btn); border: 1.5px solid var(--line2); color: var(--text); border-radius: 10px; padding: 12px 14px; font-size: 14px; font-weight: 500; cursor: pointer; }
.wl-qopt:hover:not(:disabled) { border-color: var(--wl-ind); }
.wl-qopt.correct { background: rgba(107,191,75,0.15); border-color: #6bbf4b; color: var(--text); }
.wl-qopt.wrong { background: rgba(224,82,77,0.14); border-color: #e0524d; }
.wl-qfb { margin-top: 14px; border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.55; display: none; }
.wl-qfb.show { display: block; }
.wl-qfb.good { background: rgba(107,191,75,0.12); border: 1px solid rgba(107,191,75,0.5); }
.wl-qfb.bad { background: rgba(224,82,77,0.10); border: 1px solid rgba(224,82,77,0.45); }
.wl-qnext { display: none; margin-top: 14px; background: var(--wl-ind); color: #fff; border: 0; border-radius: 9px; padding: 10px 22px; font-size: 14px; font-weight: 700; cursor: pointer; }
.wl-qnext.show { display: inline-block; }
.wl-qres { text-align: center; padding: 26px 10px; animation: wlfade .3s ease; }
.wl-qscore { font-family: Georgia, serif; font-size: 3.2rem; font-weight: 700; color: var(--wl-ind); }
.wl-qgrade { font-size: 1.15rem; margin: 8px 0 16px; }
.wl-qbreak { display: flex; justify-content: center; gap: 26px; margin-bottom: 18px; font-size: 13px; color: var(--muted2); }
.wl-qbreak b { display: block; font-size: 1.3rem; }
.wl-qbreak .g b { color: #6bbf4b; } .wl-qbreak .r b { color: #e0524d; }

/* modal */
.wl-modal { position: fixed; inset: 0; z-index: 50; background: var(--backdrop2); display: flex; align-items: center; justify-content: center; padding: 18px; }
.wl-modal.hidden { display: none; }
.wl-modal-box { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; max-width: 480px; width: 100%; max-height: 84vh; overflow-y: auto; position: relative; }
.wl-modal-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted2); font-size: 18px; cursor: pointer; }

.hidden { display: none; }

@media (max-width: 520px) {
  .wl-term { font-size: 1.7rem; }
  .wl-card { padding: 16px; }
  .wl-grid { grid-template-columns: 1fr; }
}

/* pronunciation + date-picker calendar (v252) */
.wl-pron{ font-size:.9rem; color:var(--muted2,#8fc7ad); font-style:italic; }
.wl-speak{ background:var(--btn,#16281d); border:1px solid var(--line2,#2c4636); color:var(--text,#eaf5ee); border-radius:8px; padding:2px 9px; cursor:pointer; font-size:.95rem; line-height:1.2; }
.wl-speak:hover{ filter:brightness(1.15); }
.wl-cal{ position:relative; margin:8px 0 0; }
.wl-cal.hidden{ display:none; }
.wl-cal #wl-cal-body{ background:var(--panel,#0f3d2d); border:1px solid var(--line2,#2c4636); border-radius:12px; padding:10px 12px; max-width:320px; box-shadow:0 12px 34px rgba(0,0,0,.45); }
.wl-cal-hd{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; font-weight:700; }
.wl-cal-hd button{ background:var(--btn,#16281d); border:1px solid var(--line2,#2c4636); color:var(--text,#eaf5ee); border-radius:7px; width:30px; height:30px; cursor:pointer; }
.wl-cal-hd button[disabled]{ opacity:.35; cursor:default; }
.wl-cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
.wl-cal-dow{ text-align:center; font-size:11px; color:var(--muted2,#8fc7ad); padding:2px 0; }
.wl-cal-day{ aspect-ratio:1; border:1px solid transparent; background:var(--btn,#16281d); color:var(--text,#eaf5ee); border-radius:7px; cursor:pointer; font-size:12.5px; }
.wl-cal-day:hover:not([disabled]){ border-color:var(--accent,#ffcf5c); }
.wl-cal-day.sel{ background:var(--accent,#ffcf5c); color:#20180a; font-weight:700; }
.wl-cal-day.off{ opacity:.28; cursor:default; }
