/* App-wide polish: skeleton placeholders, empty states, pull to refresh
   (polish.js) and the first-run tour (tour.js). Dark variants only under
   [data-theme="dark"]. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- skeletons ---------- */
.skl { display: block; background: var(--skl-base, #e8eaed); border-radius: 8px; position: relative; overflow: hidden; }
.skl::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: skl-shine 1.3s ease-in-out infinite; }
@keyframes skl-shine { to { transform: translateX(100%); } }
.skl-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.skl-line { height: 11px; border-radius: 6px; }
.skl-line.skl-thin { height: 9px; opacity: .7; }
.skl-line.skl-big { height: 20px; border-radius: 8px; }
.skl-line.skl-mt { margin-top: 6px; }
.skl-rings { display: flex; justify-content: space-around; padding: 4px 0; }
.skl-ring { width: 72px; height: 72px; border-radius: 50%; background: none; box-shadow: inset 0 0 0 7px var(--skl-base, #e8eaed); }
.skl-row { display: flex; align-items: center; gap: 12px; }
.skl-dot { width: 36px; height: 36px; border-radius: 12px; flex: none; }
.skl-col { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.skl-bars { display: flex; align-items: flex-end; gap: 8px; height: 90px; }
.skl-bars .skl { flex: 1; border-radius: 6px 6px 3px 3px; }
.skl-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.skl-tile { height: 74px; border-radius: 16px; }
.skl-dark { background: var(--tile-dark, var(--n-hero)); border-radius: 22px; }
.skl-hero { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 6px; }
.skl-on-dark { background: rgba(255, 255, 255, .09); }
.skl-on-dark::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); }
.skl-block-wrap { margin-top: 12px; }
.ch-skel { cursor: default; display: flex; flex-direction: column; gap: 10px; }
.ch-skel .skl-line.w40 { width: 40%; } .ch-skel .skl-line.w70 { width: 70%; }
.skl-line.w40 { width: 40%; height: 10px; } .skl-line.w70 { width: 70%; height: 16px; }
.skl-block { height: 44px; border-radius: 12px; }
:root[data-theme="dark"] { --skl-base: #24272c; }
:root[data-theme="dark"] .skl::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
@media (prefers-reduced-motion: reduce) { .skl::after { animation: none; } }

/* ---------- empty states ---------- */
.u-empty { display: flex; gap: 14px; align-items: flex-start; padding: 16px; text-align: left; }
.panel > .u-empty, .u-empty.is-bare { padding: 4px 2px; }
.u-empty-ico { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(var(--acc-400-rgb), .28), rgba(var(--acc-500-rgb), .1)); color: var(--acc-600);
  box-shadow: inset 0 0 0 1px rgba(var(--acc-500-rgb), .18); }
.u-empty-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.u-empty-main { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.u-empty-main b { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.u-empty-main p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.u-empty-btn { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; }
.u-empty.is-center { flex-direction: column; align-items: center; text-align: center; padding: 22px 16px; }
.u-empty.is-center .u-empty-main { align-items: center; }
:root[data-theme="dark"] .u-empty-ico { color: var(--acc-400); }

/* ---------- pull to refresh ---------- */
html.ptr-home, html.ptr-home body { overscroll-behavior-y: contain; }
.ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 6px); z-index: 60; transform: translate(-50%, -56px); opacity: 0; pointer-events: none; }
.ptr-disc { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--panel); color: var(--acc-600);
  box-shadow: 0 1px 2px rgba(var(--n-ink-rgb), .06), 0 10px 24px -6px rgba(var(--n-ink-rgb), .25); }
.ptr svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ptr-arrow { transform-origin: 12px 12px; transform: rotate(calc(var(--p, 0) * 180deg)); transition: transform .15s ease; }
.ptr-spin { stroke-dasharray: 34 60; opacity: 0; transform-origin: 12px 12px; }
.ptr.is-armed .ptr-disc { background: var(--acc-500); color: #fff; box-shadow: 0 10px 24px -6px rgba(var(--acc-500-rgb), .6); }
.ptr.is-busy .ptr-arrow, .ptr.is-done .ptr-arrow { opacity: 0; }
.ptr.is-busy .ptr-spin { opacity: 1; animation: ptr-spin .8s linear infinite; }
.ptr.is-done .ptr-disc { background: var(--acc-500); color: #fff; }
.ptr.is-done .ptr-spin { opacity: 1; stroke-dasharray: 60 60; animation: none; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
:root[data-theme="dark"] .ptr-disc { background: #24272c; color: var(--acc-400); }

/* ---------- first-run tour ---------- */
body.tu-open { overflow: hidden; }
.tu { position: fixed; inset: 0; z-index: 5000; display: grid; grid-template-columns: minmax(0, 1fr); place-items: end center; }
.tu-shade { position: absolute; inset: 0; background: rgba(8, 9, 11, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s ease; }
.tu-panel { position: relative; width: 100%; min-width: 0; box-sizing: border-box; max-width: 460px; max-height: 100dvh; display: flex; flex-direction: column; background: var(--bg, var(--n-bg));
  border-radius: 28px 28px 0 0; padding: 14px 0 calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateY(40px); opacity: 0;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .25s ease; box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .4); }
@media (min-width: 600px) { .tu { place-items: center; } .tu-panel { border-radius: 28px; } }
.tu.in .tu-shade { opacity: 1; }
.tu.in .tu-panel { transform: none; opacity: 1; }
.tu-top { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.tu-count { font-size: 12px; font-weight: 600; color: var(--muted); }
.tu-skip { border: 0; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tu-track { display: flex; align-items: stretch; min-width: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; outline: none; overscroll-behavior-x: contain; }
.tu-track::-webkit-scrollbar { display: none; }
.tu-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; padding: 8px 20px 0; box-sizing: border-box; }
.tu-art { height: 252px; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 10px; padding: 8px 6px; position: relative; }
.tu-art::before { content: ""; position: absolute; inset: 10% 8%; background: radial-gradient(closest-side, rgba(var(--acc-400-rgb), .22), transparent); filter: blur(10px); z-index: 0; }
.tu-art > * { position: relative; z-index: 1; }
/* Real app components, shrunk to fit and not clickable. */
.tu-real { display: flex; flex-direction: column; gap: 10px; zoom: .84; pointer-events: none; user-select: none; text-align: left; }
.tu-real > * { margin: 0 !important; }
.tu-real .hm-ring-dial { width: 100px; }
.tu-real .ch-card { margin: 0; }
.tu-slide .tu-art > * { transform: translateY(10px) scale(.98); opacity: 0; transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .35s ease; }
.tu-slide.on .tu-art > * { transform: none; opacity: 1; }
.tu-slide.on .tu-art > *:nth-child(2) { transition-delay: .08s; }
.tu-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tu-kick { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--acc-600); }
.tu-copy h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.tu-copy p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.tu-link { margin-top: 4px; border: 0; background: none; padding: 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--acc-600); cursor: pointer; text-decoration: none; }
.tu-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 0; }
.tu-dots { display: flex; gap: 6px; }
.tu-dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; background: var(--n-line, #c9ccd1); cursor: pointer; transition: width .25s ease, background .25s ease; }
.tu-dot.on { width: 22px; background: var(--acc-500); }
.tu-next { min-width: 120px; justify-content: center; }
.tu button:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.tu-next:focus:not(:focus-visible) { box-shadow: 0 8px 20px var(--accent-glow); }

/* slide pictures */
.tu-tip-ico { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(var(--acc-500-rgb), .12); color: var(--acc-600); }
.tu-tips svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tu-tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tu-tip { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 6px; border-radius: 20px; background: var(--panel); font-size: 12px; font-weight: 600; text-align: center;
  box-shadow: 0 1px 2px rgba(var(--n-ink-rgb), .04), 0 12px 28px -8px rgba(var(--n-ink-rgb), .16); }
.tu-fab { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; background: var(--acc-500); color: #fff; box-shadow: 0 10px 22px -6px rgba(var(--acc-500-rgb), .7); }
.tu-tip-ico { width: 44px; height: 44px; border-radius: 15px; }
.tu-tips .tu-fab svg { width: 22px; height: 22px; stroke-width: 2.6; }

/* Phones: smaller and tighter so the tour sits in the lower half and every
   slide fits without scrolling, down to an iPhone SE. */
@media (max-width: 599px) {
  .tu-panel { padding-top: 12px; border-radius: 24px 24px 0 0; }
  .tu-top { padding: 0 16px; }
  .tu-skip { padding: 6px 12px; font-size: 12.5px; }
  .tu-slide { padding: 4px 16px 0; }
  .tu-art { height: 212px; gap: 8px; padding: 6px 2px; }
  .tu-real { zoom: .78; }
  .tu-copy { gap: 4px; }
  .tu-copy h2 { font-size: 20px; }
  .tu-copy p { font-size: 13.5px; line-height: 1.45; }
  .tu-link { font-size: 13.5px; }
  .tu-foot { padding: 12px 16px 0; }
  .tu-next { min-width: 104px; padding: 10px 18px; }
  .tu-tip { padding: 12px 4px; gap: 8px; border-radius: 18px; }
  .tu-fab, .tu-tip-ico { width: 38px; height: 38px; border-radius: 13px; }
}
@media (max-height: 700px) and (max-width: 599px) {
  .tu-art { height: 180px; }
  .tu-real { zoom: .68; }
  .tu-real .hm-coach { display: none; }
}

:root[data-theme="dark"] .tu-panel { background: #0f1113; }
:root[data-theme="dark"] .tu-skip, :root[data-theme="dark"] .tu-tip { background: #1b1e22; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); }
:root[data-theme="dark"] .tu-kick, :root[data-theme="dark"] .tu-link { color: var(--acc-400); }
@media (prefers-reduced-motion: reduce) {
  .tu-panel, .tu-shade, .tu-slide .tu-art > * { transition: none; }
}
:root[data-theme="dark"] .tu-dot:not(.on) { background: rgba(255, 255, 255, .22); }
