/* Study notebook v2 (study.html + js/study-page.js).
 * ONE LINE per word: ruby word · (revealed translation) · EN · remove.
 * Furigana visibility + text size follow the app-wide body hooks
 * (body[data-fmode], body[data-textsize]) — same keys as the reader. */

.study-summary {
  font-family: var(--font-ui, sans-serif);
  font-size: 0.76rem;
  color: #a89f8a;
  margin: 0 0 0.9rem;
}

.st-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(232, 220, 196, 0.08);
}
.st-word {
  flex: 0 0 auto;
  font-family: var(--font-jp, serif);
  font-size: 1.3rem;
  line-height: 1.2;
  color: #f0e8d3;
}
.st-word rt {
  font-size: 0.45em;
  color: #a89f8a;
}
body[data-fmode="off"] .st-word rt { display: none; }
body[data-textsize="large"] .st-word { font-size: 1.55rem; }
body[data-textsize="xl"] .st-word { font-size: 1.85rem; }

/* Revealed translation: takes the middle of the line, may WRAP TO TWO LINES
   (long meanings + large fonts — Joshua 2026-06-10); clamps after that. */
.st-trans {
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-family: var(--font-ui, sans-serif);
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--brass, #c9a464);
}
.st-trans[hidden] { display: none; }
/* While the translation is shown it owns the middle — the spacer retires. */
.st-trans:not([hidden]) ~ .st-spacer { display: none; }
body[data-textsize="large"] .st-trans { font-size: 0.95rem; }
body[data-textsize="xl"] .st-trans { font-size: 1.05rem; }
.st-spacer { flex: 1 1 0; }

.st-show {
  flex: 0 0 auto;
  font-family: var(--font-ui, sans-serif);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid var(--brass, #c9a464);
  background: transparent;
  color: var(--brass, #c9a464);
  cursor: pointer;
}
.st-remove {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  /* grid, NOT inline-flex: this engine zeroes an svg child's width inside an
     inline-flex <button> (empirically verified 2026-06-10). */
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(232, 220, 196, 0.25);
  background: transparent;
  color: #a89f8a;
  cursor: pointer;
}
.st-remove svg { width: 16px; height: 16px; }
.st-show:active, .st-remove:active { transform: scale(0.95); }

.st-empty {
  font-family: var(--font-ui, sans-serif);
  font-size: 0.92rem;
  line-height: 1.6;
  color: #a89f8a;
  padding: 2.5rem 0;
  text-align: center;
}
.st-go {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--brass, #c9a464);
  text-decoration: none;
  border: 1px solid var(--brass, #c9a464);
  border-radius: 12px;
  padding: 10px 22px;
}

/* Header ふ furigana toggle (study page only — reader keeps its command bar). */
.fmode-btn {
  font-family: var(--font-jp, serif);
  font-size: 0.95rem;
}
.fmode-btn:not(.is-active) { opacity: 0.45; }

/* ----- Library header notebook badge --------------------------------------- */
.study-link { position: relative; }
.study-badge {
  position: absolute;
  top: -4px; right: -7px;
  min-width: 19px; height: 19px;            /* a touch larger so 3-digit counts fit (Joshua) */
  padding: 0 5px;
  border-radius: 10px;                      /* circle for 1–2 digits, pill for 3 */
  background: #d44a3a;
  color: #f0e8d3;
  font-family: var(--font-ui, sans-serif);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 19px;
  text-align: center;
  box-sizing: border-box;
}

/* ----- Light (washi) theme ------------------------------------------------- */
body[data-theme="light"] .st-word { color: #2b2620; }
body[data-theme="light"] .st-word rt, body[data-theme="light"] .study-summary, body[data-theme="light"] .st-empty { color: #6e6147; }
body[data-theme="light"] .st-row { border-bottom-color: rgba(43, 38, 32, 0.1); }
body[data-theme="light"] .st-trans, body[data-theme="light"] .st-show, body[data-theme="light"] .st-go { color: #8a6f3c; border-color: #8a6f3c; }
body[data-theme="light"] .st-trans { border: none; }
body[data-theme="light"] .st-remove { color: #6e6147; border-color: rgba(43, 38, 32, 0.25); }
