/* Frequency band bar — a row of small colored boxes for quick band filtering.
   Full width (same as the wordbook table below), vivid colors with white text. */
.freq-band-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 8px 10px;
  margin: 8px auto 0;
  width: min(1500px, calc(100% - 32px));
  background: transparent;
  border: none;
  border-radius: 0;
  max-height: 200px;
  overflow-y: auto;
}

.freq-band-box {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 30px; padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.05) 44%, rgba(0,0,0,.10) 100%), var(--band-color, #64748b);
  color: #ffffff;
  font: inherit; font-size: 11px; font-weight: 800;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease, opacity .1s ease;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.24);
  box-shadow: none;
}
.freq-band-box:hover {
  transform: translateY(-2px);
  box-shadow: none;
  opacity: 1;
}
.freq-band-box:active { transform: translateY(0); }
.freq-band-box .freq-band-num { font-size: 11px; font-weight: 900; color: #ffffff; }

/* Active selection: gallery-style swatch with a clear double halo and check marker.
   Keep the pigment color intact; use depth and a small label instead of inverting it. */
.freq-band-box { position: relative; }
.freq-band-box.is-active {
  z-index: 3;
  background: linear-gradient(135deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.05) 44%, rgba(0,0,0,.10) 100%), var(--band-color, #1d4ed8);
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--band-color, #1d4ed8), 0 3px 8px rgba(15, 23, 42, .20);
  transform: translateY(-2px) scale(1.04);
  text-shadow: 0 1px 2px rgba(0,0,0,.24);
}
.freq-band-box.is-active .freq-band-num { color: #ffffff; }
.freq-band-box.is-active:not(.freq-band-all)::after {
  content: "✓";
  position: absolute;
  top: -7px;
  right: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #273449;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-shadow: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .22);
  pointer-events: none;
}

.freq-band-all {
  --band-color: #475569;
  min-width: 44px;
  background: #64748b;
  border-color: #64748b;
  color: #ffffff;
}
.freq-band-all .freq-band-num { font-size: 10px; color: #ffffff; }
/* When "전체" is active (inverted), use dark gray text on white background */
.freq-band-all.is-active {
  background: #ffffff;
  border-color: transparent;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px #64748b;
  color: #475569;
}
.freq-band-all.is-active .freq-band-num { color: #475569; text-shadow: none; }

/* Hidden by band filter — uses a class so it composes with the page's `hidden` attribute. */
tr.freq-band-hidden { display: none !important; }

/* Row band badge — small colored button in the first column of each row */
.row-band-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 24px; padding: 1px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--band-color, #64748b);
  color: #ffffff;
  font: inherit; font-size: 10px; font-weight: 900;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.24);
  box-shadow: none;
  transition: transform .1s ease, opacity .1s ease;
}
.row-band-badge:hover { transform: scale(1.1); opacity: .9; }
.row-band-badge:active { transform: scale(1); }

html[data-theme="dark"] .row-band-badge { opacity: .88; }
html[data-theme="dark"] .row-band-badge:hover { opacity: 1; }

/* Dark mode */
html[data-theme="dark"] .freq-band-bar { background: transparent; border-color: transparent; }
html[data-theme="dark"] .freq-band-box { opacity: .88; }
html[data-theme="dark"] .freq-band-box:hover { opacity: 1; }
html[data-theme="dark"] .freq-band-box.is-active { background: linear-gradient(135deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.05) 44%, rgba(0,0,0,.10) 100%), var(--band-color, #60a5fa); border-color: #171a20; box-shadow: 0 0 0 2px #171a20, 0 0 0 4px var(--band-color, #60a5fa), 0 3px 8px rgba(0,0,0,.35); }
html[data-theme="dark"] .freq-band-all { background: #475569; border-color: #475569; color: #ffffff; }
html[data-theme="dark"] .freq-band-all.is-active { background: #475569; color: #ffffff; border-color: transparent; box-shadow: 0 0 0 2px #171a20, 0 0 0 3px #64748b; }

/* Medal-style frequency badge line on the index page */
.freq-medal-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 24px;
}
.freq-medal {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font: inherit; font-size: 0.72rem; font-weight: 800;
  color: #1e293b;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  line-height: 1.3;
}
.freq-medal:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border-color: var(--medal-color, #94a3b8);
  text-decoration: none;
}
.freq-medal-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--medal-color, #475569);
  color: #ffffff;
  font-size: 10px; font-weight: 900;
  letter-spacing: -.02em;
}
.freq-medal-book { font-size: 10px; font-weight: 800; color: #475569; }
.freq-medal-count { font-size: 11px; font-weight: 900; color: var(--medal-color, #1e293b); }
.freq-medal-empty {
  font-size: 0.78rem; color: var(--muted); font-style: italic;
  padding: 6px 0;
}

html[data-theme="dark"] .freq-medal { background: #111a2b; border-color: #1f2a3c; color: #cbd5e1; }
html[data-theme="dark"] .freq-medal:hover { border-color: var(--medal-color, #60a5fa); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
html[data-theme="dark"] .freq-medal-book { color: #94a3b8; }
html[data-theme="dark"] .freq-medal-count { color: var(--medal-color, #93c5fd); }
html[data-theme="dark"] .freq-medal-empty { color: #64748b; }

@media (max-width: 640px) {
  .freq-band-bar { width: calc(100% - 20px); padding: 6px 8px; gap: 3px; max-height: 160px; }
  .freq-band-box { min-width: 30px; height: 26px; padding: 1px 4px; }
  .freq-band-box .freq-band-num { font-size: 10px; }
}

/* Large explicit All selection: visible feedback before data/rows load. */
.wb-band-row .freq-band-all[aria-busy="true"]::after{content:"…";position:static;display:inline!important;margin-left:2px;color:inherit;font-weight:700;}
.wb-band-wrap .freq-band-bar.wb-band-row{-webkit-mask-image:none!important;mask-image:none!important;}
.wb-band-row .freq-band-all{scroll-snap-align:none;}
