/* settings.css — the one-page settings: a section index and the sections.
   Plug-in sections from other packages use the same classes (.card.st-card,
   .st-row, .st-actions) so every section looks like one page. */

.st-layout { display: grid; grid-template-columns: 220px minmax(0, 860px); gap: var(--s6); align-items: start; }
.st-index {
  position: sticky; top: calc(var(--s5) + var(--safe-top));
  display: flex; flex-direction: column; gap: 2px;
}
.st-link {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 40px; padding: 0 var(--s3);
  border-radius: var(--r-md);
  color: var(--text-2); text-decoration: none; font-weight: 800; font-size: var(--fs-sm);
}
.st-link:hover { background: var(--surface); color: var(--text); }
.st-link[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.st-link[aria-current="true"] .icon { color: var(--accent-deep); }

.st-body { display: flex; flex-direction: column; gap: var(--s7); min-width: 0; }
.st-section { scroll-margin-top: calc(var(--s5) + var(--safe-top)); }
.st-title { display: flex; align-items: center; gap: var(--s3); font-size: var(--fs-xl); margin-bottom: var(--s2); }
.st-title .icon { color: var(--accent-deep); width: 1.1em; height: 1.1em; }
.st-lead { color: var(--text-2); font-weight: 600; margin-bottom: var(--s4); max-width: 62ch; }
.st-content { display: flex; flex-direction: column; gap: var(--s4); }
.st-content > .st-title + * { margin-top: var(--s3); }

.st-card { display: flex; flex-direction: column; gap: var(--s4); }
.st-card h3 { font-size: var(--fs-lg); }
.st-card > .hint { margin-top: calc(var(--s2) * -1); }
.st-actions { display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; }
.st-toolbar { display: flex; align-items: center; gap: var(--s3); }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); flex-wrap: wrap; }
.st-row-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; }
.st-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.st-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.st-pw { display: flex; gap: var(--s2); align-items: center; }
.st-pw .input { flex: 1; font-family: ui-monospace, 'JetBrains Mono', monospace; font-weight: 600; }

.st-profile { display: flex; gap: var(--s5); align-items: flex-start; }
.st-profile .avatar-lg { --size: 76px; margin-top: 4px; }
.st-profile-main { flex: 1; display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.st-colors { display: flex; gap: var(--s2); flex-wrap: wrap; }
.st-color {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--c); border: 2px solid var(--outline);
  display: grid; place-items: center;
}
.st-color[aria-checked="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--c); }

.st-dev-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--bg); color: var(--text-2); flex: none; }
.st-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.st-row-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.st-people .list-row .avatar { --size: 40px; }
.st-creds { margin: 0; padding: var(--s4); border-radius: var(--r-md); background: var(--bg-sunk); font-family: ui-monospace, monospace; font-size: var(--fs-sm); white-space: pre-wrap; user-select: all; }

.st-checks { display: flex; flex-direction: column; gap: var(--s2); }
.st-check { display: flex; align-items: center; gap: var(--s3); font-weight: 700; min-height: 36px; cursor: pointer; }
.st-check input { width: 20px; height: 20px; accent-color: var(--accent-deep); }
.st-review { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding-top: var(--s3); border-top: 1px solid var(--line); }
.st-review .hint { margin: 0; }
.st-trash-cover { width: 36px; flex: none; }
.st-card code { font-size: .9em; padding: 1px 6px; border-radius: 6px; background: var(--bg-sunk); }

.st-about-head { display: flex; align-items: center; gap: var(--s5); }
.st-about-bear { width: 84px; flex: none; }
.st-about-name { font-family: var(--font-brand); font-weight: 600; font-size: var(--fs-xl); }
.st-build { font-family: var(--font-brand); font-weight: 600; font-size: var(--fs-3xl); line-height: 1.05; color: var(--accent-deep); }
.st-facts { font-size: var(--fs-md); }
.st-storage { display: flex; flex-direction: column; gap: var(--s2); }
.st-storage-line { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; font-size: var(--fs-sm); }
.st-storage .bar { height: 10px; }
.st-storage .bar > i { background: var(--brand); }

/* Phone: the index becomes a sticky row of chips along the top. */
@media (max-width: 900px) {
  .st-layout { grid-template-columns: 1fr; gap: var(--s4); }
  .st-index {
    top: 0; z-index: 5; flex-direction: row; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(var(--gutter) * -1); padding: calc(var(--s2) + var(--safe-top)) var(--gutter) var(--s2);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .st-index::-webkit-scrollbar { display: none; }
  .st-link { flex: none; min-height: 36px; border-radius: var(--r-pill); border: 1.5px solid var(--line-2); background: var(--surface-2); }
  .st-link[aria-current="true"] { background: var(--text); color: var(--bg); box-shadow: none; border-color: var(--text); }
  .st-link[aria-current="true"] .icon { color: var(--bg); }
  .st-section { scroll-margin-top: calc(64px + var(--safe-top)); }
  .st-grid2, .st-grid3 { grid-template-columns: 1fr; }
  .st-profile { flex-direction: column; align-items: center; }
  .st-profile-main { width: 100%; }
  .st-people .list-row, .st-trash .list-row { flex-wrap: wrap; }
  .st-people .st-badges { order: 3; width: 100%; justify-content: flex-start; padding-left: 52px; }
  .st-people .st-row-actions { order: 4; width: 100%; padding-left: 52px; justify-content: flex-start; }
  .st-trash .st-row-actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
  .st-about-head { flex-direction: column; text-align: center; }
}

@media (max-width: 760px) { .st-color { width: 32px; height: 32px; } }

/* ---- Box sets and collections */
.st-scan-list { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.st-scan-list li { display: flex; gap: var(--s2); align-items: flex-start; font-size: var(--fs-sm); }
.st-scan-list .icon { margin-top: 3px; color: var(--accent-deep); flex: none; }

/* ---- Storage (settings/storage.js). Series colours are the logo's hues,
   validated (dataviz validator) against this card's surface in each theme:
   books, narration, originals, covers & text, trash & kept. */
.st-store { --viz-1: #0B7FA6; --viz-2: #DD6F14; --viz-3: #A8466C; --viz-4: #C08A12; --viz-5: #99531A; }
:root[data-theme="dark"] .st-store { --viz-1: #2690B8; --viz-2: #DB7020; --viz-3: #BC5594; --viz-4: #B38514; --viz-5: #9C4E22; }
.st-store.is-busy { opacity: .55; pointer-events: none; transition: opacity var(--t-base) var(--ease); }
.st-store-wait { display: flex; align-items: center; gap: var(--s3); color: var(--text-2); font-weight: 700; padding: var(--s4) 0; }
.st-store-card { display: flex; flex-direction: column; gap: var(--s4); }
.st-store-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.st-store-figure { display: block; font-family: var(--font-ui); font-weight: 800; font-size: clamp(2.4rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: -.01em; }
.st-store-barwrap { position: relative; }
.st-store-bar { display: flex; gap: 2px; height: 26px; width: 100%; }
.st-seg { flex-basis: 0; min-width: 3px; background: var(--c); outline-offset: 2px; cursor: default; }
.st-seg:first-child { border-radius: 4px 0 0 4px; }
.st-seg:last-child { border-radius: 0 4px 4px 0; }
.st-seg:only-child { border-radius: 4px; }
.st-store-tip { position: absolute; top: 34px; translate: -50% 0; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--raise); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); font-size: var(--fs-sm); white-space: nowrap; pointer-events: none; }
.st-store-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.st-store-legend li { display: grid; grid-template-columns: 14px 1fr auto 70px; align-items: baseline; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.st-store-legend li:last-child { border-bottom: 0; }
.st-key { width: 12px; height: 12px; border-radius: 3px; background: var(--c); align-self: start; margin-top: 5px; }
.st-legend-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.st-legend-label .faint { font-size: var(--fs-xs); }
.st-legend-val { font-weight: 800; text-align: right; }
.st-legend-pct { text-align: right; font-size: var(--fs-sm); }
.st-volumes { display: flex; flex-direction: column; gap: var(--s4); }
.st-volume { display: flex; flex-direction: column; gap: 6px; }
.st-volume-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.st-meter { height: 10px; border-radius: 10px; background: var(--brand-soft); overflow: hidden; }
.st-meter > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand-deep); }
.st-meter > i.is-warn { background: var(--sun); }
.st-meter > i.is-danger { background: var(--danger); }
.st-store-largest { min-width: 0; }
.st-store-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); table-layout: fixed; }
.st-store-table th:nth-child(n+2), .st-store-table td:nth-child(n+2) { width: 96px; }
.st-store-table td:first-child { overflow: hidden; }
.st-store-table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 6px 8px; border-bottom: 1.5px solid var(--line-2); }
.st-store-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.st-store-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-store-table tbody tr { cursor: pointer; }
.st-store-table tbody tr:hover, .st-store-table tbody tr:focus-visible { background: var(--bg); }
.st-store-book { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.st-store-book > div:last-child { min-width: 0; }
.st-store-cover { width: 30px; flex: none; }
.st-store-cover .cover { box-shadow: none; }
.st-store-forge { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border-radius: var(--r-md); background: var(--bg-sunk); }
.st-store-forge .icon { margin-top: 3px; color: var(--brand-deep); }
@media (max-width: 560px) {
  .st-store-head { flex-direction: column; gap: var(--s2); }
  .st-store-head .btn { align-self: flex-start; margin-left: -12px; }
  .st-store-legend li { grid-template-columns: 14px 1fr auto; }
  .st-legend-pct { display: none; }
  .st-store-table th:nth-child(2), .st-store-table td:nth-child(2) { display: none; }
  .st-store-table th:nth-child(n+3), .st-store-table td:nth-child(n+3) { width: 78px; }
}

.st-store-book > div:last-child > .ellipsis:first-child { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Settings → TV and projector (inside the Android app, tv/settings-section.js) */
.st-tv-now { display: flex; gap: var(--s2); align-items: center; margin-bottom: var(--s2); }
.st-tv-now .icon { width: 22px; height: 22px; flex: none; color: var(--brand-deep); }
.st-tv-way { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.st-tv-way h3 { font-family: var(--font-brand); font-size: var(--fs-md); margin: 0 0 var(--s1); }
.st-tv-way p { color: var(--text-2); line-height: 1.5; margin: 0 0 var(--s1); }
.st-tv-icon { flex: none; display: flex; width: 28px; }
.st-tv-icon .icon { width: 24px; height: 24px; color: var(--brand-deep); margin-top: 2px; }
