/* Family App — sheets, help, preferences, the song panel and tooltips.
 *
 * Split out of app.css when that file passed 500 lines. The boundary is a real
 * one rather than an arbitrary cut: everything here is overlay chrome that
 * appears on top of the app, and nothing in it participates in page layout.
 */
/* ------------------------------------------------------- sheets & tooltips */

/* One panel for Preferences, Help and the song panel. Built on <dialog> so the
 * browser owns the focus trap, the backdrop and Escape. Rises from the bottom
 * on a phone, where the thumb is; centred on a wide screen, where a full-width
 * strip along the bottom would look like a mistake. */
.sheet {
  border: none; padding: 0; background: var(--paper); color: var(--ink);
  width: 100%; max-width: 560px; max-height: 88vh;
  margin: auto auto 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.sheet.wide { max-width: 640px; }
.sheet::backdrop { background: rgba(40, 30, 36, .38); }

@media (min-width: 700px) {
  .sheet { margin: auto; border-radius: var(--radius-lg); max-height: 82vh; }
}

.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--hair); flex: 0 0 auto;
}
.sheet-head h2 { margin: 0; font-size: var(--t-lg); font-weight: 600; flex: 1 1 auto; }
.sheet-actions { flex: 0 0 auto; display: flex; }
.sheet-x {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: none; color: var(--muted); display: grid; place-items: center;
}
.sheet-x:hover { background: var(--silver-2); color: var(--ink); }
.sheet-x svg { width: 19px; height: 19px; }

.sheet-body {
  padding: var(--s-4) var(--s-5) var(--s-6);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}

/* ---- preferences */
.prefs-h { font-size: var(--t-xs); font-weight: 600; letter-spacing: .08em;
           text-transform: uppercase; color: var(--rose);
           margin: var(--s-5) 0 var(--s-3); }
.prefs-h:first-child { margin-top: 0; }
.prefs-sizes { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.prefs-note { font-size: var(--t-sm); color: var(--muted); margin: var(--s-3) 0 0; }
.prefs-about { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s-4);
               font-size: var(--t-sm); }
.prefs-k { color: var(--muted); }
.prefs-v { font-variant-numeric: tabular-nums; }

/* ---- help */
.help-search {
  width: 100%; font: inherit; font-size: var(--t-md);
  padding: 12px 14px; border-radius: 12px; min-height: 44px;
  border: 1px solid var(--silver-1); background: var(--paper); color: var(--ink);
  margin-bottom: var(--s-4);
}
.help-search:focus { outline: none; border-color: var(--pink); }

.help-letter { font-size: var(--t-xs); font-weight: 600; letter-spacing: .1em;
               color: var(--rose); margin: var(--s-4) 0 var(--s-2); }
.help-letter:first-child { margin-top: 0; }
.help-count { font-size: var(--t-xs); color: var(--muted); margin: 0 0 var(--s-3); }
.help-none { font-size: var(--t-sm); color: var(--muted); }

.help-topic { border-bottom: 1px solid var(--hair); }
.help-title {
  width: 100%; text-align: left; border: none; background: none;
  padding: 13px 0; font-size: var(--t-base); font-weight: 500; min-height: 44px;
}
.help-topic.on .help-title { color: var(--rose); }
.help-why { display: block; font-size: var(--t-xs); color: var(--muted);
            margin: -8px 0 10px; font-style: italic; }
.help-body { font-size: var(--t-sm); line-height: 1.62; color: var(--ink);
             padding: 0 0 var(--s-4); max-width: 60ch; white-space: pre-line; }

/* ---- what this is */
.about p { margin: 0 0 var(--s-4); font-size: var(--t-base); line-height: 1.62; max-width: 46ch; }
.about p:last-child { margin-bottom: 0; }
.about-fine { font-size: var(--t-sm); color: var(--muted); border-top: 1px solid var(--hair);
              padding-top: var(--s-4); }

/* ---- troubleshooting */
.tool {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: none; color: var(--slate); display: grid; place-items: center;
}
.tool:hover { background: var(--silver-2); color: var(--ink); }
.tool svg { width: 21px; height: 21px; }

.check { display: flex; gap: var(--s-3); padding: 11px 0;
         border-bottom: 1px solid var(--hair); align-items: flex-start; }
.check-mark { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
              display: grid; place-items: center; font-size: 13px; font-weight: 700;
              margin-top: 1px; }
.check.ok   .check-mark { background: var(--green-lo); color: var(--green); }
.check.bad  .check-mark { background: var(--rose-lo); color: var(--rose); }
.check-name { font-size: var(--t-base); }
.check-detail { display: block; font-size: var(--t-xs); color: var(--muted); margin-top: 1px; }
.check-fix { display: block; font-size: var(--t-sm); color: var(--rose); margin-top: 4px; }

/* Numbered, because these get read down a telephone one line at a time. */
.steps { margin: 8px 0 2px; padding-left: 20px; font-size: var(--t-sm);
         color: var(--ink); line-height: 1.55; }
.steps li { margin-bottom: 4px; }
.check .btn { width: 100%; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: calc(1.375rem * var(--scale)); letter-spacing: .06em;
  text-align: center; padding: var(--s-4); border-radius: var(--radius);
  background: var(--silver-2); color: var(--ink); margin: 0;
}

.report {
  white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: calc(0.688rem * var(--scale)); line-height: 1.5; color: var(--muted);
  background: var(--silver-2); border-radius: 12px; padding: var(--s-3);
  max-height: 190px; overflow: auto; margin: 0;
}

/* ---- search results */
.sresult {
  display: block; width: 100%; text-align: left;
  border: none; background: none; padding: 11px 10px; border-radius: 10px;
  min-height: 44px; border-bottom: 1px solid var(--hair);
}
.sresult.on { background: var(--pink-lo); }
.sresult-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.sresult-label { font-size: var(--t-base); min-width: 0; }
/* The type, as a quiet badge — the information grouping used to carry, without
   the contradiction grouping introduced. */
.sresult-kind { flex: 0 0 auto; font-size: 10px; font-weight: 600; letter-spacing: .07em;
                text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
                background: var(--silver-2); color: var(--slate); }
.sresult-kind.k-songs { background: var(--pink-lo); color: var(--rose); }
.sresult-kind.k-messages { background: var(--green-lo); color: var(--green); }
.sresult-label b { color: var(--rose); font-weight: 600; }
.sresult-detail { display: block; font-size: var(--t-xs); color: var(--muted);
                  font-variant-numeric: tabular-nums; margin-top: 2px; }
.sresult .help-why { margin: 2px 0 0; }

/* ---- the song panel */
.songpanel { display: flex; flex-direction: column; gap: var(--s-2); }
.songpanel-l { font-size: var(--t-xs); font-weight: 600; letter-spacing: .08em;
               text-transform: uppercase; color: var(--rose); margin-top: var(--s-4); }
.songpanel-l:first-child { margin-top: 0; }
.songpanel .edit { font-size: var(--t-md); }
.send.stopping { background: var(--rose); }
.send.muted, .send:disabled { background: var(--silver-1); color: var(--muted);
                              box-shadow: none; cursor: default; }

/* ---- undo inside the toast */
.toast-undo {
  background: none; border: none; color: var(--pink); font-weight: 600;
  padding: 4px 2px 4px 10px; font-size: inherit; text-decoration: underline;
}

/* ---- long-press tooltip (R1-35; never on the record disc) */
.tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--ink); color: #fff;
  font-size: var(--t-xs); line-height: 1.4;
  padding: 8px 11px; border-radius: 9px; max-width: min(74vw, 280px);
  box-shadow: var(--shadow); opacity: 0; transition: opacity .12s ease-out;
}
.tip.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
