/* வாக்கியம் அமை — 5W1H sentence builder (js/views/sentence.js) */
.sb-home, .sb-page { display: grid; gap: 18px; min-width: 0; }
.sb-home .ml, .sb-page .ml { font-family: var(--f-ml); }
.sb-muted { color: var(--ink-3); margin: 0; font-size: .92rem; }
.sb-print { display: none; }

/* Slot colours: a coloured edge + soft tint; the words always say which question it is */
.sb-s-who   { --sc: var(--peacock); --sc-soft: var(--peacock-soft); }
.sb-s-when  { --sc: var(--zari-deep); --sc-soft: var(--zari-soft); }
.sb-s-where { --sc: var(--leaf); --sc-soft: var(--leaf-soft); }
.sb-s-why   { --sc: var(--silk); --sc-soft: var(--silk-soft, color-mix(in srgb, var(--silk) 14%, var(--surface))); }
.sb-s-what  { --sc: var(--kumkum); --sc-soft: var(--kumkum-soft, color-mix(in srgb, var(--kumkum) 12%, var(--surface))); }
.sb-s-how   { --sc: var(--marigold); --sc-soft: color-mix(in srgb, var(--marigold) 16%, var(--surface)); }
.sb-s-verb  { --sc: var(--ink); --sc-soft: var(--surface-2); }

.sb-grades { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sb-grades .pp-toggle { min-height: 44px; }
.sb-minebook { font-weight: 500; }
.sb-row-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }
.sb-row-head .sec-title { margin: 0; }

/* Rule + the book's worked example */
.sb-rule { padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); display: grid; gap: 8px; min-width: 0; }
.sb-rule .sec-title { margin: 0; }
.sb-rule-ml { margin: 0; font-size: 1.08rem; line-height: 1.7; }
.sb-rule-en { margin: 0; color: var(--ink-2); }
.sb-example { margin-top: 6px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); display: grid; gap: 6px; }
.sb-ex-label, .sb-ex-ml, .sb-ex-en { margin: 0; }
.sb-ex-ml { font-size: 1.2rem; font-weight: 700; line-height: 1.6; color: var(--peacock-deep); }
.sb-ex-en { color: var(--ink-2); }

.sb-break { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sb-break li { display: grid; gap: 1px; padding: 5px 10px 4px; border-radius: 12px; background: var(--sc-soft); border: 1px solid var(--line); border-bottom: 4px solid var(--sc); min-width: 0; }
.sb-break-t { font-weight: 700; font-size: 1.02rem; color: var(--ink); overflow-wrap: anywhere; }
.sb-break-k { font-size: .76rem; color: var(--ink-2); }

/* Week list */
.sb-weeks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.sb-week { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 76px; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.sb-week:hover, .sb-week:focus-visible { border-color: var(--peacock); }
.sb-week.has-saved { border-color: color-mix(in srgb, var(--leaf) 55%, var(--line)); }
.sb-week > .icon { width: 20px; height: 20px; color: var(--peacock); }
.sb-week-n { display: grid; justify-items: center; min-width: 54px; padding: 6px 4px; border-radius: 14px; background: var(--leaf-soft); color: var(--leaf); }
.sb-week-n .ml { font-size: .72rem; font-weight: 600; }
.sb-week-n b { font-family: var(--f-display); font-size: 1.5rem; line-height: 1; }
.sb-week-body { display: grid; gap: 6px; min-width: 0; }
.sb-week-title { font-weight: 700; overflow-wrap: anywhere; }
.sb-week-title .en { font-weight: 500; color: var(--ink-3); font-size: .86rem; }
.sb-week-words { display: flex; flex-wrap: wrap; gap: 4px; }
.sb-wchip { padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; }

.sb-more { display: grid; gap: 10px; }
.sb-details { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); padding: 0 16px; min-width: 0; }
.sb-details > summary { display: flex; align-items: center; gap: 8px; min-height: 52px; cursor: pointer; font-weight: 700; }
.sb-details > summary .icon { width: 20px; height: 20px; color: var(--zari-deep); }
.sb-details[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sb-bank, .sb-endings { display: grid; gap: 8px; padding-bottom: 16px; min-width: 0; }
.sb-bank h3 { margin: 10px 0 0; font-size: 1.02rem; }
.sb-plain { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.sb-end-table td { min-width: 6em; }

/* Builder page */
.sb-head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sb-tabs { margin: 0; }
.sb-tabs .wk-tab { cursor: pointer; font: inherit; min-height: 52px; }
.sb-tabs .wk-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sb-stage { min-width: 0; }
.sb-build { display: grid; gap: 18px; min-width: 0; }
.sb-pick .sec-title { margin-bottom: 10px; }
.sb-words { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-wordbtn { display: grid; justify-items: start; gap: 1px; min-height: 52px; padding: 6px 14px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; }
.sb-wordbtn .ml { font-weight: 700; font-size: 1.1rem; }
.sb-wordbtn .en { font-size: .76rem; color: var(--ink-3); }
.sb-wordbtn[aria-pressed="true"] { border-color: var(--peacock); background: var(--peacock-soft); color: var(--peacock-deep); box-shadow: inset 0 0 0 1px var(--peacock); }
.sb-wordbtn[aria-pressed="true"] .en { color: var(--peacock-deep); }
.sb-current { margin-top: 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.sb-current-word { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sb-current-ml { font-family: var(--f-display); font-size: 1.9rem; font-weight: 800; color: var(--peacock-deep); line-height: 1.25; overflow-wrap: anywhere; }
.sb-current-en { margin: 0; font-weight: 600; color: var(--ink-2); }

.sb-grid { display: grid; gap: 18px; min-width: 0; }
@media (min-width: 980px) {
  .sb-grid { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); align-items: start; }
  .sb-side { position: sticky; top: calc(var(--top-h) + 12px); max-height: calc(100vh - var(--top-h) - 24px); overflow-y: auto; }
  .sb-mini { display: none !important; }
}
.sb-main { min-width: 0; display: grid; gap: 12px; align-content: start; }
.sb-fill-title { margin: 0; justify-content: space-between; }
.sb-fill-title .btn { margin-left: auto; }

/* compact sticky preview while filling the boxes on phones */
.sb-mini { position: sticky; top: calc(var(--top-h) + 6px); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 2px solid var(--peacock); box-shadow: var(--shadow-1); font-size: .95rem; min-width: 0; }
.sb-mini > span:first-child { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.sb-mini-n { flex: none; font: 700 .78rem var(--f-ui); color: var(--peacock-deep); }

.sb-slots { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.sb-slot { display: grid; gap: 8px; align-content: start; padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--sc); min-width: 0; }
.sb-slot.sb-s-verb { grid-column: 1 / -1; border-left-width: 8px; }
.sb-slot-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.sb-q { font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.sb-qen { font-size: .86rem; color: var(--ink-2); font-weight: 600; }
.sb-inrow { display: flex; gap: 6px; align-items: center; }
.sb-input { max-width: none; flex: 1 1 auto; width: 100%; }
.sb-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--sc); }
.sb-clear { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink-2); cursor: pointer; }
.sb-clear .icon { width: 18px; height: 18px; }
.sb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-chips[hidden] { display: none; }
.sb-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 4px 12px; border-radius: var(--r-pill); border: 2px solid var(--line-2); background: var(--sc-soft, var(--surface-2)); color: var(--ink); font: 600 1rem var(--f-ml); cursor: pointer; max-width: 100%; text-align: left; }
.sb-chip .ml { overflow-wrap: anywhere; }
.sb-chip:hover { border-color: var(--sc, var(--peacock)); }
.sb-chip.is-model { border-style: dashed; border-color: var(--zari-deep); background: var(--zari-soft); }
.sb-chip .icon { width: 16px; height: 16px; flex: none; color: var(--zari-deep); }
.sb-chip-lab { font: 600 .72rem var(--f-ui); color: var(--ink-3); margin-right: 2px; }
.sb-morebtn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 4px 12px; border-radius: var(--r-pill); border: 2px dashed var(--line-2); background: transparent; color: var(--ink-2); font: 600 .86rem var(--f-ui); cursor: pointer; }
.sb-morebtn .icon { width: 16px; height: 16px; }
.sb-note { margin: 0; font-size: .84rem; color: var(--ink-3); }
.sb-verbhelp { display: grid; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.sb-verbhelp-lab { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.sb-verbhelp-lab .icon { width: 18px; height: 18px; }
.sb-select { min-height: 44px; max-width: 100%; padding: 6px 10px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 1rem var(--f-ml); }
.sb-forms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sb-forms .sb-muted { flex-basis: 100%; }

/* Side: live sentence + checker */
.sb-side { display: grid; gap: 12px; align-content: start; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); min-width: 0; }
.sb-live { display: grid; gap: 8px; }
.sb-live-lab { margin: 0; font-size: .82rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.sb-live-text { margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 2; overflow-wrap: anywhere; }
.sb-live-empty { margin: 0; color: var(--ink-3); font-style: italic; }
.sb-tok { padding: 1px 6px; border-radius: 8px; background: var(--sc-soft); box-shadow: inset 0 -3px 0 var(--sc); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.sb-counts { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sb-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sb-actions .btn { min-height: 44px; }
.sb-actions .btn:disabled { opacity: .5; cursor: not-allowed; }
.sb-saved-msg { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--leaf); font-weight: 600; min-height: 0; }
.sb-saved-msg:empty { display: none; }
.sb-saved-msg .icon { width: 18px; height: 18px; }
.sb-link { border: 0; background: none; padding: 8px 2px; min-height: 44px; color: var(--peacock); font: inherit; text-decoration: underline; cursor: pointer; }
.sb-side-title { margin: 4px 0 0; font-size: 1.05rem; }
.sb-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sb-check { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.45; font-size: .94rem; }
.sb-check-ic { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.sb-check-ic .icon { width: 16px; height: 16px; }
.sb-check.is-ok .sb-check-ic { background: var(--leaf-soft); color: var(--leaf); }
.sb-check.is-warn .sb-check-ic { background: var(--zari-soft); color: var(--zari-deep); }
.sb-check.is-no .sb-check-ic { background: var(--kumkum-soft, color-mix(in srgb, var(--kumkum) 14%, var(--surface))); color: var(--kumkum); }
.sb-check.is-no { border-color: color-mix(in srgb, var(--kumkum) 45%, var(--line)); }
.sb-check-body { min-width: 0; overflow-wrap: anywhere; }
.sb-fix { margin-top: 6px; display: inline-flex; }
.sb-tips { display: grid; gap: 6px; }
.sb-tips:empty { display: none; }
.sb-tip { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--zari-soft); color: var(--ink); font-size: .92rem; }
.sb-tip > .icon { width: 18px; height: 18px; color: var(--zari-deep); }
.sb-tip a { color: var(--peacock); }

.sb-model:empty { display: none; }
.sb-model-card { display: grid; gap: 8px; padding: 14px; border-radius: 16px; border: 2px dashed var(--zari); background: var(--surface); }
.sb-model-lab { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sb-model-ml { margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.6; }
.sb-model-en { margin: 0; color: var(--ink-2); font-size: .92rem; }
.sb-book { display: grid; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.sb-book > p.ml { margin: 0; font-weight: 600; line-height: 1.6; }

/* Word-order game */
.sb-order { display: grid; gap: 14px; min-width: 0; }
.sb-order-box { display: grid; gap: 14px; }
.sb-order-hint { margin: 0; line-height: 1.6; }
.sb-answer { list-style: none; margin: 0; padding: 12px; min-height: 72px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-radius: 18px; border: 2px dashed var(--line-2); background: var(--surface); }
.sb-answer-empty { color: var(--ink-3); font-style: italic; }
.sb-pool { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sb-tile { min-height: 52px; padding: 6px 14px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--sc-soft, var(--surface)); color: var(--ink); font: 700 1.15rem var(--f-ml); box-shadow: 0 3px 0 var(--sc, var(--zari)); cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.sb-tile:disabled { opacity: .3; box-shadow: none; cursor: default; }
.sb-tile.is-placed { background: var(--peacock-soft); border-color: var(--peacock); color: var(--peacock-deep); box-shadow: none; }
.sb-tile.is-placed[class*="sb-s-"] { background: var(--sc-soft); color: var(--ink); border-color: var(--sc); }
.sb-tile.is-placed:disabled { opacity: 1; }

/* My sentences */
.sb-mine { display: grid; gap: 12px; min-width: 0; }
.sb-mylist { margin: 0; padding-left: 1.6em; display: grid; gap: 10px; }
.sb-myitem { padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 8px; min-width: 0; }
.sb-myitem-top { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-mytext { margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.sb-empty { display: grid; justify-items: center; gap: 8px; padding: 28px 16px; border-radius: var(--r-lg); border: 2px dashed var(--line-2); text-align: center; color: var(--ink-2); }
.sb-empty > .icon { width: 32px; height: 32px; color: var(--zari-deep); }
.sb-empty p { margin: 0; }

/* High contrast: stronger edges */
:root[data-contrast="high"] .sb-slot, :root[data-contrast="high"] .sb-break li, :root[data-contrast="high"] .sb-tile, :root[data-contrast="high"] .sb-chip { border-color: var(--ink-2); }
:root[data-contrast="high"] .sb-tok { box-shadow: inset 0 -3px 0 var(--ink); }

@media (max-width: 520px) {
  .sb-current-ml { font-size: 1.6rem; }
  .sb-live-text { font-size: 1.15rem; }
  .sb-week { grid-template-columns: auto 1fr; }
  .sb-week > .chip, .sb-week > .icon { grid-column: 2; justify-self: start; }
}

@media print {
  .sb-page > *:not(#sb-panel), .sb-mine > *:not(.sb-print), .toast, .toasts { display: none !important; }
  .shell:has(.sb-page) { display: block !important; }
  .main:has(.sb-page) { max-width: none !important; width: auto !important; margin: 0 !important; padding: 0 !important; }
  .sb-print { display: block; color: #000; background: #fff; font-family: var(--f-ui); }
  .sb-print [lang="ta"] { font-family: var(--f-ml); }
  .sb-print h2 { font-size: 16pt; margin: 0 0 6pt; }
  .sb-print-meta { display: flex; flex-wrap: wrap; gap: 6pt 24pt; font-size: 10.5pt; }
  .sb-print-list { font-size: 13pt; line-height: 1.9; padding-left: 1.4em; }
  .sb-print-list li { break-inside: avoid; }
  .sb-print-word { font-size: 9pt; color: #444; }
  .sb-print-lines { display: grid; gap: 0; margin: 8pt 0 14pt; }
  .sb-print-lines span { display: block; height: 28pt; border-bottom: 1px solid #999; }
  .sb-print-sign { font-size: 10.5pt; margin-top: 12pt; }
}

/* three tabs side by side, even on a phone */
.sb-tabs { flex-wrap: nowrap; }
.sb-tabs .wk-tab { flex: 1 1 0; min-width: 0; padding: 8px 6px; text-align: center; }
.sb-tabs .wk-tab .ml { overflow-wrap: normal; }
@media (max-width: 520px) { .sb-tabs .wk-tab .ml { font-size: .9rem; } }
