/* Global interaction feedback, loaded by every page after focus-reset.css.
   1. Taps respond instantly: no 300 ms delay, no grey flash, a short press state.
   2. A thin progress bar at the top runs while the page is leaving or a request is pending.
   3. Any button can show a spinner with the .is-loading class (see ui-feedback.js).
   4. The page behaves like an app screen: no pinch or double-tap zoom (see also the viewport meta). */

html, body {
  touch-action: pan-x pan-y;
}

:where(button, [role="button"], a, label, select, input[type="submit"], input[type="button"], summary) {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
:where(button, [role="button"]):not(:disabled) {
  transition: scale .08s ease-out, opacity .08s ease-out;
}
/* `scale` (not `transform`) so buttons positioned with a transform keep their place. */
:where(button, [role="button"]):not(:disabled):active {
  scale: .97;
  opacity: .82;
}
:where(a):active { opacity: .7; }
:where(button, [role="button"], a):active { transition-duration: 0s; }

/* Top progress bar */
#tono-progress {
  position: fixed;
  top: 0; inset-inline-start: 0;
  height: 3px;
  width: 0;
  background: #FF5400;
  border-start-start-radius:0;border-start-end-radius:2px;border-end-end-radius:2px;border-end-start-radius:0;
  z-index: 2147483000;
  opacity: 0;
  pointer-events: none;
  transition: width .2s ease-out, opacity .2s linear;
}
html.is-loading #tono-progress {
  opacity: 1;
  width: 78%;
  transition: width 4s cubic-bezier(.1,.6,.2,1), opacity .1s linear;
}
html.is-leaving #tono-progress {
  opacity: 1;
  width: 92%;
  transition: width 6s cubic-bezier(.05,.7,.1,1), opacity .1s linear;
}
html.is-loaded #tono-progress {
  width: 100%;
  opacity: 0;
  transition: width .15s ease-out, opacity .3s linear .15s;
}

/* Button spinner */
:where(button, [role="button"]).is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  cursor: progress;
}
:where(button, [role="button"]).is-loading > * { visibility: hidden; }
:where(button, [role="button"]).is-loading::after {
  content: "";
  position: absolute;
  left:50%; top: 50%;
  width: 20px; height: 20px;
  margin-block:-10px 0;margin-inline:-10px 0;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-color: var(--tono-spinner, #0B0F14) transparent var(--tono-spinner, #0B0F14) var(--tono-spinner, #0B0F14);
  animation: tono-spin .7s linear infinite;
  visibility: visible;
}
@keyframes tono-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  :where(button, [role="button"]):not(:disabled):active { scale: 1; }
  #tono-progress { transition: none; }
}

/* ---- sticky title bars (ui-feedback.js stickyBar) ------------------------------------ */
[data-sticky-sentinel] { height: 1px; margin-bottom: -1px; pointer-events: none; }
.is-stuck { box-shadow: 0 1px 0 rgba(11, 15, 20, .08); }

/* ---- connection state (connectivity.js) ---------------------------------------------- */
.tono-net { position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: flex-end; justify-content: center; font-family: "Manrope", "Sora", system-ui, sans-serif; }
.tono-net[hidden] { display: none; }
.tono-net-backdrop { position: absolute; inset: 0; background: rgba(11, 15, 20, .55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.tono-net-sheet {
  position: relative; width: 100%; max-width: 520px; box-sizing: border-box;
  background: #fff; color: #0b0f14; border-radius: 24px 24px 0 0;
  padding: 28px 24px calc(20px + env(safe-area-inset-bottom)); text-align: center;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .18);
  animation: tono-net-rise .28s cubic-bezier(.2, .8, .2, 1);
}
.tono-net-sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: #e3e1dc; margin: -12px auto 20px; }
.tono-net-icon { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; background: #fff1ea; color: #ff5400; }
.tono-net[data-kind="server"] .tono-net-icon { background: #f2f1ee; color: #0b0f14; }
.tono-net-title { margin: 0 0 8px; font-family: "Sora", "Manrope", system-ui, sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.tono-net-text { margin: 0 auto 22px; max-width: 34ch; font-size: 15px; line-height: 1.5; color: #5c6266; }
.tono-net-retry, .tono-net-dismiss { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border-radius: 14px; font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; }
.tono-net-retry { border: 0; background: #ff5400; color: #fff; }
.tono-net-dismiss { margin-top: 8px; border: 0; background: transparent; color: #5c6266; font-weight: 700; font-size: 14px; min-height: 44px; }
.tono-net-shake { animation: tono-net-shake .4s ease; }
.tono-net-pill {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left:50%; transform: translateX(-50%); z-index: 2147482000;
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 999px;
  background: #0b0f14; color: #fff; font: 700 13px/1 "Manrope", system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}
.tono-net-pill[hidden] { display: none; }
.tono-net-toast {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left:50%; transform: translateX(-50%); z-index: 2147482000;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  background: #1f8f4a; color: #fff; font: 700 13px/1 "Manrope", system-ui, sans-serif;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22); animation: tono-net-drop .25s ease;
}
.tono-net-toast[hidden] { display: none; }
@keyframes tono-net-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tono-net-drop { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
@keyframes tono-net-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (min-width: 768px) {
  /* Desktop: a centred modal instead of a bottom sheet. */
  .tono-net { align-items: center; padding: 24px; }
  .tono-net-sheet { max-width: 420px; border-radius: 24px; padding: 36px 32px 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, .28); }
  .tono-net-sheet::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tono-net-sheet, .tono-net-toast, .tono-net-shake { animation: none; }
}
