body { margin: 0; background: #faf7f2; color: #222; }

.xw-header { background: #fff; border-bottom: 1px solid #e0d8c8; }
.xw-header-nav {
  max-width: 900px; margin: 0 auto; display: flex; flex-wrap: wrap;
  gap: .5rem 1.2rem; padding: .7rem 1rem; align-items: center;
  font-family: system-ui, sans-serif;
}
.xw-header-nav a { color: #7a1515; text-decoration: none; font-size: .95rem; }
.xw-header-nav a:hover { text-decoration: underline; }
.xw-header-nav #xw-lang { margin-left: auto; font-weight: 600; }

.xw-app { font-family: system-ui, sans-serif; max-width: 900px; margin: 0 auto; padding: 0 1rem 2rem; }
.xw-app h1 { font-size: 1.6rem; margin: 1rem 0 .5rem; }
.xw-howto { margin: 0 0 1rem; color: #444; }
.xw-howto p { margin: 0 0 .35rem; line-height: 1.4; }

.xw-controls { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.xw-controls select, .xw-controls button {
  font-size: 1rem; padding: .4rem .8rem; border-radius: 6px; border: 1px solid #ccc; cursor: pointer;
}
.xw-controls button { background: #7a4f9e; color: #fff; border: none; }
.xw-controls button:hover { background: #63407f; }
.xw-controls button.xw-secondary { background: #eee; color: #333; }
.xw-controls button.xw-secondary:hover { background: #ddd; }
.xw-controls button:disabled { opacity: .5; cursor: not-allowed; }
.xw-controls button:disabled:hover { background: #eee; }

/* No flex-wrap: the clue panel must stay to the right of the grid at any
   viewport width (previously wrapped below on narrow/embedded pages, e.g.
   the wider "Sanskrit Literature" set) — the grid scrolls horizontally
   instead via .xw-wrap's overflow-x. */
.xw-body { display: flex; gap: 2rem; align-items: flex-start; }

.xw-wrap { overflow-x: auto; flex: 1 1 auto; min-width: 0; }
.xw-grid { border-collapse: collapse; }
.xw-grid td { width: 2.4rem; height: 2.4rem; padding: 0; position: relative; }
.xw-locked { background: transparent; }
.xw-cell { border: 1px solid #444; background: #fff; }
.xw-num {
  position: absolute; top: 1px; left: 2px; font-size: .55rem; color: #666; line-height: 1;
  pointer-events: none;
}
.xw-input {
  width: 100%; height: 100%; border: none; text-align: center; font-size: 1.1rem;
  background: transparent; box-sizing: border-box; font-family: "Noto Sans Devanagari", sans-serif;
}
/* IAST cells hold Latin text with diacritics (Noto Sans Devanagari has no
   Latin coverage) and can be several characters wide (e.g. "kṣa"). */
.xw-grid-iast td { width: 3.2rem; }
.xw-grid-iast .xw-input { font-family: system-ui, sans-serif; font-size: .95rem; }
.xw-input:focus { outline: 2px solid #7a4f9e; background: #f3ecf9; }
.xw-active-word { background: #efe6f7; }
.xw-correct { color: #1a7a1a; font-weight: bold; }
.xw-wrong { color: #c0392b; }

.xw-clues { flex: 0 0 260px; min-width: 260px; }

@media (max-width: 699px) {
  .xw-body { flex-direction: column; }
  .xw-clues { flex: 1 1 auto; min-width: 0; width: 100%; }
}
.xw-clue-section h4 { margin: 0 0 .3rem; }
.xw-clue-section ul { margin: 0 0 1rem; padding-left: 1.2rem; }
.xw-clue-section li { margin-bottom: .35rem; line-height: 1.35; }

.xw-status { margin-top: .6rem; font-weight: bold; }

/* per-clue research-source link (H720) */
.xw-clues a.xw-src {
  font-size: 0.78em;
  text-decoration: none;
  color: #7a6a4f;
  opacity: 0.75;
}
.xw-clues a.xw-src:hover { opacity: 1; text-decoration: underline; }

.xw-win {
  margin-top: 1.2rem; padding: 1rem 1.1rem; border: 1px solid #e0d8c8;
  background: #fff8ee; border-radius: 8px;
}
.xw-win-title { font-weight: 700; margin: 0 0 .35rem; }
.xw-win p { margin: 0 0 .35rem; }
.xw-win-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .7rem; }
a.xw-cta {
  background: #7a1515; color: #fff; padding: 8px 18px; border-radius: 6px;
  text-decoration: none; font-weight: 600; display: inline-block;
}
a.xw-cta:hover { background: #5c1010; }
.xw-win-actions button {
  font-size: 1rem; padding: .4rem .8rem; border-radius: 6px; border: 1px solid #ccc;
  background: #eee; color: #333; cursor: pointer;
}
.xw-win-actions button:hover { background: #ddd; }

@media print {
  .xw-controls, .xw-header, .xw-header-nav, #xw-win, footer, .xw-howto {
    display: none !important;
  }
  #xw-grid, #xw-clues { display: block; }
}

/* ---------- bandha explorers (/crossword/bandha/, H2943) ---------- */
:root { --bd-cell: 2.4rem; }
.bd-article { font-family: Georgia, "Times New Roman", serif; line-height: 1.55; }
.bd-article p { margin: 0 0 .8rem; }
.bd-article h2 { font-size: 1.25rem; margin: 1.6rem 0 .5rem; font-family: system-ui, sans-serif; }
.bd-article blockquote {
  margin: .8rem 0; padding: .6rem 1rem; border-left: 3px solid #7a4f9e;
  background: #f6f1fa; font-style: normal; overflow-wrap: anywhere;
}
.bd-article { overflow-wrap: break-word; }
.bd-verse { font-family: "Noto Sans Devanagari", Georgia, serif; font-size: 1.1rem; }
.bd-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin: 1.2rem 0; padding: 0; list-style: none; }
.bd-card { border: 1px solid #e0d8c8; border-radius: 8px; background: #fff;
  padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.bd-card a.bd-card-link { color: #7a1515; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.bd-card a.bd-card-link:hover { text-decoration: underline; }
.bd-card svg { width: 100%; height: 96px; }
.bd-card p { margin: 0; color: #444; font-size: .92rem; line-height: 1.4; }
.bd-badge-new { display: inline-block; background: #fff3d6; color: #7a5a15;
  border-radius: 4px; padding: 0 .45em; font-size: .8rem; font-weight: 600; }

.bd-body { display: flex; gap: 1.5rem; align-items: flex-start; }
.bd-side { flex: 0 0 300px; min-width: 260px; }
/* Top/right padding leaves room for the .bd-ord badges that overhang the
   first row/last column — without it overflow-x:auto clips them (H3025). */
.bd-gridwrap { overflow-x: auto; flex: 1 1 auto; min-width: 0; padding: 12px 8px .3rem 2px; }
@media (max-width: 799px) {
  .bd-body { flex-direction: column; align-items: stretch; }
  .bd-side { flex: 1 1 auto; min-width: 0; width: 100%; }
  .bd-gridwrap { max-width: 100%; }
}
.bd-grid { display: grid; gap: 2px; }
.bd-grid-dense { --bd-cell: 1.6rem; }
.bd-cell { position: relative; border: 1px solid #c9bfae; background: #fff;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: background .25s, border-color .25s; }
.bd-syl { font-family: "Noto Sans Devanagari", serif; font-size: .95rem; }
.bd-grid-dense .bd-syl { font-size: .72rem; }
.bd-grid-iast .bd-syl { font-family: system-ui, sans-serif; font-size: .78rem; }
.bd-grid-dense.bd-grid-iast .bd-syl { font-size: .58rem; }
.bd-on { background: #efe6f7; border-color: #7a4f9e; }
.bd-ord { position: absolute; top: -7px; right: -5px; background: #7a4f9e; color: #fff;
  border-radius: 8px; font-size: .55rem; line-height: 1; padding: 2px 4px;
  font-family: system-ui, sans-serif; cursor: pointer; z-index: 1; }
.bd-paths { display: flex; flex-direction: column; gap: .45rem; margin: 0 0 .9rem; }
button.bd-path { text-align: left; font-size: .92rem; padding: .45rem .7rem;
  border-radius: 6px; border: 1px solid #ccc; background: #f6f4ef; color: #333; cursor: pointer; }
button.bd-path:hover { background: #efe6f7; }
button.bd-path.bd-path-active { background: #7a4f9e; color: #fff; border-color: #7a4f9e; }
.bd-panel { border: 1px solid #e0d8c8; border-radius: 8px; background: #fff8ee;
  padding: .8rem 1rem; min-height: 3rem; }
.bd-panel-title { font-weight: 700; margin: 0 0 .4rem; }
.bd-yield-iast { font-style: italic; margin: 0 0 .4rem; overflow-wrap: anywhere; }
.bd-yield-tr { margin: 0; color: #444; }
.bd-panel-hint { margin: 0; color: #777; font-size: .9rem; }
.bd-srcnote { font-size: .88rem; color: #555; border-top: 1px solid #e0d8c8;
  margin-top: 1.4rem; padding-top: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
.bd-srcnote a { color: #7a1515; }
.bd-mw { margin-top: .6rem; font-size: .88rem; }
.bd-mw a { color: #7a1515; margin-right: .8em; }
@media print { .bd-paths, .bd-controls { display: none !important; } }

/* Stacked layout exception (H3025): the cakrabandha wheel is too wide for the
   side-by-side layout — the path menu goes ABOVE the grid, full width. */
.bd-body-stack { flex-direction: column; align-items: stretch; }
.bd-body-stack .bd-side { flex: 1 1 auto; min-width: 0; width: 100%; }
.bd-body-stack .bd-paths { flex-direction: row; flex-wrap: wrap; }
.bd-body-stack .bd-gridwrap { align-self: center; max-width: 100%; }

/* Article footnotes (H3025) */
.bd-fn { font-size: .88rem; color: #555; border-top: 1px dashed #e0d8c8;
  margin-top: 1.2rem; padding-top: .6rem; line-height: 1.5; }
.bd-fn p { margin: 0 0 .5rem; }
sup.bd-fnref a { text-decoration: none; color: #7a1515; }

/* Sator square figure (H3025) */
.bd-sator { margin: .8rem 0; }
.bd-sator svg { max-width: 220px; width: 100%; height: auto; display: block; }
.bd-sator figcaption { font-size: .88rem; color: #555; line-height: 1.45; margin-top: .3rem; }

/* Card images are links too (H3025) */
a.bd-card-img { display: block; }

/* Set title + puzzle number line on the crossword app (H3025) */
.xw-setname { font-family: system-ui, sans-serif; color: #555; margin: -0.2rem 0 .8rem;
  font-size: 1.02rem; }
.xw-setname b { color: #333; }
.xw-puzzle-id { color: #7a4f9e; font-weight: 600; }

/* ---------- bandha fill-in mode (H2944) ---------- */
.bd-controls button { font-size: .95rem; padding: .4rem .8rem; border-radius: 6px;
  border: 1px solid #ccc; background: #7a4f9e; color: #fff; cursor: pointer; border: none; }
.bd-controls button:hover { background: #63407f; }
.bd-controls button.xw-secondary { background: #eee; color: #333; }
.bd-controls button.xw-secondary:hover { background: #ddd; }
.bd-fill-status { font-weight: 600; color: #444; }
.bd-fillin .bd-syl { display: none; }
.bd-input { position: absolute; inset: 0; width: 100%; height: 100%; border: none;
  text-align: center; background: transparent; box-sizing: border-box;
  font-family: "Noto Sans Devanagari", system-ui, sans-serif; font-size: .8rem;
  padding: 0; border-radius: 4px; }
.bd-grid-dense .bd-input { font-size: .6rem; }
.bd-input:focus { outline: 2px solid #7a4f9e; background: #f3ecf9; }
.bd-correct .bd-input { color: #1a7a1a; font-weight: 700; }
.bd-wrong .bd-input { color: #c0392b; }
.bd-fillin .bd-cell.bd-on { background: #efe6f7; }

/* ---------- bandha study page: schematic + hint accordion (H3023) ---------- */
.bd-schema { margin: 1rem 0; }
.bd-schema svg { max-width: 460px; width: 100%; height: auto; display: block; }
.bd-schema figcaption { font-size: .88rem; color: #555; line-height: 1.45; margin-top: .3rem; }
details.bd-hint { margin: 0 0 .8rem; border: 1px solid #e0d8c8; border-radius: 8px;
  background: #fff8ee; padding: .5rem .9rem; }
details.bd-hint summary { cursor: pointer; font-weight: 600; color: #7a1515; }
details.bd-hint[open] summary { margin-bottom: .5rem; }
details.bd-hint p { margin: 0; }
