/* remote.css — the phone remote (/remote), approving a screen's sign-in
   (/link), and the Remote control section of Settings.

   The remote is laid out for one thumb: what the screen is showing at the top
   (read, not touched), the page-turning surface in the middle, and every other
   control in the lower half where the thumb already is. */

/* ------------------------------------------------------------------ remote */
.route-remote { background: var(--bg); overflow: hidden; }
.rm {
  height: 100%;
  display: flex; flex-direction: column;
  max-width: 600px; margin: 0 auto;
  padding: var(--safe-top) calc(var(--s3) + var(--safe-right)) calc(var(--s3) + var(--safe-bottom)) calc(var(--s3) + var(--safe-left));
}
.rm-top { display: flex; align-items: center; gap: var(--s2); min-height: 56px; }
.rm-title { font-family: var(--font-brand); font-weight: 600; font-size: var(--fs-lg); }
.rm-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 60%;
  min-height: 40px; padding: 0 var(--s3);
  border: 1.5px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  font-weight: 800; font-size: var(--fs-sm);
}
.rm-chip .icon { flex: none; }
.rm-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* picker */
.rm-picker { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s3) 0 var(--s5); overflow: auto; }
.rm-h1 { font-size: var(--fs-2xl); }
.rm-screens { display: flex; flex-direction: column; gap: var(--s3); }
.rm-screen {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 76px; padding: var(--s3) var(--s4);
  border: 2px solid var(--line-2); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); text-align: left;
}
.rm-screen:disabled { opacity: .55; }
.rm-screen:not(:disabled):hover { border-color: var(--accent); }
.rm-screen-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: var(--r-md); background: var(--brand-soft); color: var(--brand-deep); }
.rm-screen-icon .icon { width: 26px; height: 26px; }
.rm-screen-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rm-screen-name { font-weight: 800; font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-owner { color: var(--text-3); font-weight: 700; font-size: var(--fs-sm); }
.rm-screen-what { color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-dot { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--text-3); vertical-align: middle; }
.rm-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.rm-none { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s5) var(--s3); border: 2px dashed var(--line-2); border-radius: var(--r-lg); }
.rm-none-bear { width: 84px; }
.rm-steps { margin: 0; padding-left: 1.2em; text-align: left; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-weight: 600; }
.rm-steps strong { color: var(--text); }
.rm-picker-foot { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }
.rm-picker-foot p { margin: 0; font-size: var(--fs-sm); }
.rm-pair-input { font-family: var(--font-brand); font-size: 2.4rem; text-align: center; letter-spacing: .4em; font-variant-numeric: tabular-nums; min-height: 72px; }

/* controller */
.rm-drive { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s3); padding-top: var(--s1); }
.rm-offline { align-items: center; flex-wrap: wrap; }
.rm-now {
  position: relative;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.rm-cover { width: 46px; flex: none; }
.rm-cover .cover { box-shadow: var(--shadow-1); }
.rm-cover-empty { width: 46px; aspect-ratio: 2 / 3; display: grid; place-items: center; border-radius: var(--cover-r); background: var(--bg-sunk); color: var(--text-3); }
.rm-now-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rm-now-title { font-family: var(--font-brand); font-weight: 600; font-size: var(--fs-lg); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-now-sub { color: var(--text-2); font-size: var(--fs-sm); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.3em; }
.rm-bar { height: 4px; margin-top: 4px; }
.rm-tick {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px 3px 6px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 800;
  opacity: 0; pointer-events: none;
}
.rm-tick .icon { width: 14px; height: 14px; }
.rm-tick.ok { background: var(--ok-soft); color: var(--ok); }
.rm-tick.late { background: var(--sun-soft); color: var(--text); }

.rm-pad {
  position: relative;
  flex: 1; min-height: 190px;
  display: grid; grid-template-columns: 1fr 1fr;
  border-radius: var(--r-xl);
  border: 2px solid var(--line-2);
  background: var(--surface);
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}
.is-offline .rm-pad { opacity: .45; }
.rm-half {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  color: var(--text-2);
  pointer-events: none;
}
.rm-prev { border-right: 1.5px dashed var(--line-2); }
.rm-arrow { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--bg-sunk); color: var(--text); }
.rm-next .rm-arrow { background: var(--accent); color: var(--on-accent); border: var(--stroke) solid var(--outline); }
.rm-arrow .icon { width: 40px; height: 40px; stroke-width: 2.5; }
.rm-half-label { font-weight: 800; font-size: var(--fs-sm); }
.rm-pad-hint {
  position: absolute; left: 50%; bottom: 12px; translate: -50% 0; z-index: 1;
  padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  white-space: nowrap; font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); pointer-events: none;
}
.rm-ripple { position: absolute; border-radius: 50%; background: var(--accent); pointer-events: none; }
.rm-flash {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--text); color: var(--bg); font-weight: 800;
  pointer-events: none; white-space: nowrap;
}
.rm-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.rm-sr:focus-visible { position: static; width: auto; height: auto; clip: auto; margin: 0; }

.rm-controls { display: flex; flex-direction: column; gap: var(--s2); }
.rm-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.rm-key {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 68px; padding: 6px 4px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: 11.5px; font-weight: 800; line-height: 1.15; text-align: center;
}
.rm-key .icon { width: 24px; height: 24px; }
.rm-key[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.rm-row { display: flex; align-items: center; gap: var(--s2); min-height: 48px; }
/* A TV the app drives: one plain way to take the book back to the phone. */
.rm-stop { width: 100%; justify-content: center; }
.rm-row-icon { color: var(--text-3); display: grid; place-items: center; }
.rm-range { flex: 1; }

.rm-results { display: flex; flex-direction: column; gap: 2px; }
.rm-result {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-areas: "cover text" "cover acts";
  column-gap: var(--s3); row-gap: var(--s2); align-items: start;
  padding: var(--s3) 0; border-bottom: 1px solid var(--line);
}
.rm-result-cover { grid-area: cover; width: 52px; }
.rm-result-text { grid-area: text; min-width: 0; }
.rm-result-title { font-weight: 800; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rm-result-sub { color: var(--text-3); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-result-acts { grid-area: acts; display: flex; gap: var(--s2); }
.rm-result-acts .btn { flex: 1; max-width: 150px; }
.rm-recent { margin: 0; font-size: var(--fs-sm); }
.rm-more { display: flex; flex-direction: column; }
.rm-more-row {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 56px; padding: 0 var(--s2);
  border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text);
  font-weight: 700; text-align: left;
}
.rm-more-row:last-child { border-bottom: 0; }
.rm-more-row .icon { color: var(--text-2); }

@media (max-height: 700px) {
  .rm-key { min-height: 56px; }
  .rm-key span { display: none; }
  .rm-arrow { width: 56px; height: 56px; }
}
@media (min-width: 700px) {
  .rm-keys { gap: var(--s3); }
  .rm-key { min-height: 80px; font-size: var(--fs-sm); }
}

/* ------------------------------------------------------------------ link */
.route-link { overflow: auto; }
.lk { min-height: 100%; display: flex; flex-direction: column; padding: var(--safe-top) var(--gutter) calc(var(--s6) + var(--safe-bottom)); }
.lk-top { min-height: 56px; display: flex; align-items: center; }
.lk-center { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding-top: clamp(0px, 6vh, 64px); }
.lk-card {
  width: min(460px, 100%);
  display: flex; flex-direction: column; align-items: center; gap: var(--s4);
  text-align: center;
  padding: var(--s6) var(--s5) var(--s5);
  background: var(--surface-2);
  border: 3px solid var(--outline);
  border-radius: var(--r-xl);
  box-shadow: 0 8px 0 var(--outline), var(--shadow-2);
}
.lk-bear { width: 88px; }
.lk-card h1 { font-size: var(--fs-2xl); }
.lk-lead { margin: -6px 0 0; font-weight: 600; }
.lk-digits { display: flex; align-items: center; gap: var(--s2); }
.lk-group { display: flex; gap: 6px; }
.lk-dash { width: 10px; height: 3px; border-radius: 2px; background: var(--line-2); }
.lk-digit {
  width: 48px; height: 62px; padding: 0;
  border: var(--stroke) solid var(--line-2); border-radius: var(--r-md);
  background: var(--raise); color: var(--text);
  font-family: var(--font-brand); font-size: 2rem; font-weight: 600; text-align: center;
  font-variant-numeric: tabular-nums;
  caret-color: var(--accent);
}
.lk-digit:focus { outline: none; border-color: var(--brand-deep); box-shadow: 0 0 0 4px var(--brand-soft); }
.lk-digit.filled { border-color: var(--text-2); }
.lk-error { max-width: 100%; }
.lk-hint { margin: 0; }
.lk-hint strong { word-break: break-all; }
.lk-check { width: 92px; height: 92px; }
.lk-check circle { stroke: var(--ok); }
.lk-check path { stroke: var(--ok); }
.lk-card .btn-block + .btn-block { margin-top: calc(-1 * var(--s2)); }
@media (max-width: 380px) {
  .lk-digit { width: 40px; height: 56px; font-size: 1.7rem; }
  .lk-card { padding: var(--s5) var(--s4) var(--s4); }
}

/* ------------------------------------------------------------------ settings section */
.sr { gap: var(--s5); }
.sr-block { display: flex; flex-direction: column; gap: var(--s3); }
.sr-block h3 { gap: var(--s2); }
.sr-block p { margin: 0; }
.sr-status { display: inline-flex; align-items: center; gap: 6px; }
.sr-code { padding: var(--s4); border-radius: var(--r-lg); background: var(--bg); border: 1.5px solid var(--line); display: flex; flex-direction: column; gap: var(--s2); }
.sr-code-digits { display: flex; gap: var(--s2); }
.sr-code-digits span {
  display: grid; place-items: center;
  width: 56px; height: 68px; border-radius: var(--r-md);
  background: var(--raise); border: var(--stroke) solid var(--outline);
  font-family: var(--font-brand); font-size: 2.2rem; font-weight: 600;
}
.sr-kind { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand-deep); flex: none; }
