/* ============================================================
   R&K Reading Library — UI Styles (extends kamus.css base)
   ============================================================ */

/* ====== Filter chip bar ====== */
.bc-filter-row {
  display: flex; flex-wrap: wrap;
  gap: 8px; align-items: center;
  margin: 14px auto 6px;
  max-width: 720px;
  justify-content: center;
}
.bc-filter-label {
  color: var(--text-muted); font-size: .84rem; font-weight: 600;
  margin-right: 4px;
}
.bc-chip-link {
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 99px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.bc-chip-link:hover {
  border-color: var(--secondary); color: var(--primary-dark);
  transform: translateY(-1px);
}
.bc-chip-link.is-active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(91,58,138,.25);
}
.bc-chip-link.is-active .bc-cnt {
  background: rgba(255,255,255,.28); color: #fff;
}
.bc-cnt {
  background: var(--primary-light); color: var(--primary);
  font-size: .72rem; font-weight: 700;
  padding: 1px 8px; border-radius: 99px;
}

/* Level chip color variations */
.bc-chip-lvl-N5 { background: linear-gradient(135deg,#a8e6c1,#5db074); color:#fff }
.bc-chip-lvl-N4 { background: linear-gradient(135deg,#a0d8ef,#5b9bd5); color:#fff }
.bc-chip-lvl-N3 { background: linear-gradient(135deg,#f5d488,#e89a4a); color:#fff }
.bc-chip-lvl-N2 { background: linear-gradient(135deg,#f4a8a8,#d65555); color:#fff }
.bc-chip-lvl-N1 { background: linear-gradient(135deg,#c4a8e6,#9333ea); color:#fff }
.bc-chip-link.bc-chip-lvl-N5.is-active,
.bc-chip-link.bc-chip-lvl-N4.is-active,
.bc-chip-link.bc-chip-lvl-N3.is-active,
.bc-chip-link.bc-chip-lvl-N2.is-active,
.bc-chip-link.bc-chip-lvl-N1.is-active { box-shadow: 0 6px 18px rgba(0,0,0,.18) }

.bc-chip-cerita,.bc-chip-berita { font-weight: 700 }
.bc-chip-cerita.is-active { background: linear-gradient(135deg,#5b9bd5,#3978bb); color:#fff; border-color: transparent }
.bc-chip-berita.is-active { background: linear-gradient(135deg,#e89a4a,#d97706); color:#fff; border-color: transparent }

/* ====== NHK callout (top mini banner on list) ====== */
.bc-nhk-mini {
  margin: 0 auto 20px;
  max-width: 780px;
  background: linear-gradient(135deg,#fff8e6,#fef4d2);
  border: 1px solid #f0c46e;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: .92rem;
  color: #6b4513;
  line-height: 1.5;
}
.bc-nhk-mini a {
  color: #6b4513; font-weight: 700;
  border-bottom: 2px solid #6b4513;
}
.bc-nhk-mini a:hover { background: rgba(107,69,19,.08) }

/* ====== Grid of article cards ====== */
.bc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.bc-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-soft);
  transition: all .2s;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
  overflow: hidden;
}
.bc-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0; transition: opacity .2s;
}
.bc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(91,58,138,.16);
  border-color: var(--secondary);
}
.bc-card:hover::before { opacity: 1 }

.bc-card-meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.bc-card-icon {
  font-size: 2.4rem; line-height: 1; margin: 2px 0 0;
}
.bc-card-title-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.18rem; font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.35;
}
.bc-card-title-id {
  font-size: .93rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.bc-card-foot {
  margin-top: auto; padding-top: 6px;
  display: flex; gap: 10px; font-size: .76rem; color: var(--text-muted);
  font-weight: 600;
  border-top: 1px dashed var(--border-soft);
}

.bc-chip {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--bg-soft);
  color: var(--text-secondary);
  line-height: 1.4;
}
.bc-chip-mini { font-size: .68rem }
.bc-chip-berita {
  background: #fef3e2; color: #b45309;
}
.bc-chip-cerita {
  background: #e0f0fb; color: #1e5e9e;
}
.bc-chip-lvl-N5,
.bc-chip-lvl-N4,
.bc-chip-lvl-N3,
.bc-chip-lvl-N2,
.bc-chip-lvl-N1 { color: #fff; font-weight: 800 }
.bc-chip-date { font-size: .72rem; color: var(--text-muted); font-weight: 600 }

/* ====== Detail page ====== */
.bc-detail-wrap { max-width: 820px; }

.bc-article-hero {
  background: linear-gradient(135deg, #fff 0%, #fff8fb 100%);
  border-radius: 24px;
  padding: 30px 28px 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.bc-hero-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.bc-article-title-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 900;
  color: var(--primary-dark);
  margin: 0 0 8px;
  line-height: 1.35;
}
/* Ruby in article hero — larger */
.bc-article-title-jp ruby rt {
  font-size: .42em;
  color: var(--secondary-dark);
  font-weight: 500;
}
.bc-article-title-id {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.bc-rom {
  display: inline-block;
  font-style: italic; color: var(--text-muted);
  margin-left: 8px;
  font-size: .9rem;
}

/* ====== Reading controls ====== */
.bc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  position: sticky; top: 70px; z-index: 30;
}
.bc-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-weight: 700; color: var(--primary-dark);
  font-size: .92rem;
}
.bc-toggle input { display: none }
.bc-toggle-track {
  width: 42px; height: 22px;
  background: var(--border);
  border-radius: 99px; position: relative;
  transition: background .2s;
}
.bc-toggle-track::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.18);
}
.bc-toggle input:checked + .bc-toggle-track {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.bc-toggle input:checked + .bc-toggle-track::after {
  transform: translateX(20px);
}
.bc-rate {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .88rem;
  color: var(--text-secondary); font-weight: 600;
}
.bc-rate select {
  font: inherit; font-size: .88rem;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

/* ====== Body lines ====== */
.bc-body {
  background: #fff;
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  margin-bottom: 22px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.32rem;
  line-height: 2.4;
  color: var(--text);
}
.bc-line {
  margin: 0 0 14px 0;
  padding: 8px 6px 8px 50px;
  border-radius: 10px;
  position: relative;
  transition: background .2s;
}
.bc-line:hover { background: var(--bg-soft) }
.bc-line.is-playing {
  background: linear-gradient(90deg, var(--secondary-light), var(--accent-light));
  box-shadow: 0 0 0 2px var(--secondary) inset;
}
.bc-line-speak {
  position: absolute; left: 8px; top: 6px;
  width: 36px; height: 36px;
  background: var(--primary-light);
  border: none; border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--primary);
  transition: all .15s;
}
.bc-line-speak:hover {
  background: var(--secondary); color: #fff;
  transform: scale(1.1);
}
.bc-line-text { font-family: 'Noto Sans JP', sans-serif }

/* Furigana rt size & color */
.bc-body ruby rt {
  font-size: .5em;
  color: var(--secondary-dark);
  font-weight: 500;
  letter-spacing: 0;
}
/* Furigana toggle off — hide rt */
.bc-body[data-furigana="off"] ruby rt { display: none }

/* ====== Section blocks ====== */
.bc-section {
  background: #fff;
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  margin-bottom: 18px;
}
.bc-section-title {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
}

/* Glossary */
.bc-glossary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.bc-gloss-item {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 10px 14px;
  border-left: 3px solid var(--secondary);
}
.bc-gloss-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 2px;
}
.bc-gloss-id { font-size: .9rem; color: var(--text-secondary) }

/* Comprehension question */
.bc-question {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}
.bc-options {
  display: flex; flex-direction: column; gap: 8px;
}
.bc-opt {
  background: var(--bg-soft);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 13px 18px;
  text-align: left;
  font: inherit; font-size: .98rem; font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.bc-opt:hover {
  border-color: var(--secondary); background: #fff;
  transform: translateX(3px);
}
.bc-opt.is-correct {
  background: linear-gradient(135deg,#a8e6c1,#5db074);
  color: #fff; border-color: transparent;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(93,176,116,.32);
}
.bc-opt.is-wrong {
  background: linear-gradient(135deg,#f4a8a8,#d65555);
  color: #fff; border-color: transparent;
  font-weight: 800;
}
.bc-opt:disabled { cursor: default; transform: none }

.bc-feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: .95rem;
}
.bc-feedback.is-correct {
  background: #eef7ee; color: #1a5c3a;
  border-left: 4px solid #5db074;
}
.bc-feedback.is-wrong {
  background: #ffe7e7; color: #8b1a1a;
  border-left: 4px solid #d65555;
}

/* NHK callout (article detail bottom) */
.bc-nhk-callout {
  background: linear-gradient(135deg, #fff8e6 0%, #fdebd0 100%);
  border-radius: 20px;
  padding: 24px 26px;
  margin: 22px 0;
  border: 1px solid #f0c46e;
  box-shadow: 0 6px 22px rgba(240,196,110,.18);
}
.bc-nhk-head {
  display: flex; gap: 16px; align-items: flex-start;
  margin-bottom: 14px;
}
.bc-nhk-icon {
  font-size: 2.4rem; flex-shrink: 0;
  background: #fff;
  width: 60px; height: 60px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(240,196,110,.32);
}
.bc-nhk-title {
  margin: 0 0 4px;
  font-size: 1.1rem; font-weight: 800;
  color: #6b4513;
}
.bc-nhk-sub {
  margin: 0;
  color: #7a5520;
  font-size: .92rem;
  line-height: 1.5;
}
.bc-nhk-tips {
  margin: 12px 0 0;
  padding-left: 6px;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
  gap: 4px 14px;
  color: #6b4513;
  font-size: .88rem;
  font-weight: 600;
}
.bc-nhk-tips a {
  color: #6b4513; border-bottom: 2px solid #6b4513;
}
.bc-nhk-credit {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(107,69,19,.3);
  font-size: .78rem;
  color: #8a6c2e;
  font-style: italic;
}

@media (max-width: 600px) {
  .bc-body { font-size: 1.15rem; line-height: 2.2; padding: 18px 14px }
  .bc-line { padding-left: 44px }
  .bc-line-speak { width: 30px; height: 30px; font-size: .85rem }
  .bc-article-title-jp { font-size: 1.5rem }
  .bc-controls { padding: 10px 12px; gap: 8px }
}
