/* UI tips experiment (2026-11-19). Everything sits under html.ui-tips, so ?uitips=0 switches it all off.
   Tips used: balanced headlines, tabular numbers, hit slop, continuous corners, skeleton loader,
   command menu + shortcut hints, predictive back (JS side). */

/* 17. Balanced headlines: no lonely last word in titles; nicer paragraph endings. */
html.ui-tips :is(h1, h2, h3, .pf-title, dialog h2) { text-wrap: balance; }
html.ui-tips :is(p, li, figcaption) { text-wrap: pretty; }

/* 16. Tabular numbers: counting coins, timers, scores and HP stop jiggling sideways. */
html.ui-tips :is(output, .coin-counter, .score, [class*="timer"], [class*="countdown"], [class*="hp"],
  [class*="score"], [class*="coins"], [class*="price"], [class*="xp"], .rank-summary, time) {
  font-variant-numeric: tabular-nums;
}

/* 13. Hit slop: the small round header icons get an invisible 44px tap zone without changing their look. */
/* :where = zero specificity, so a button that is already absolute/fixed (the Shop/Legacy ✕) keeps its own position. */
:where(html.ui-tips) :where(#help, #profile-open, #account-open, .viewer-close, dialog .close, [aria-label="Close"]) {
  position: relative;
}
html.ui-tips :is(#help, #profile-open, #account-open, .viewer-close, dialog .close, [aria-label="Close"])::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: max(100%, 44px); height: max(100%, 44px); translate: -50% -50%;
}

/* 18. Continuous corners (squircles) where the browser supports it (Chrome 139+). Others keep round corners. */
@supports (corner-shape: squircle) {
  html.ui-tips :is(dialog, .roman-primary, .settings-slab, .account-panel, .rank-summary, .ec-card,
    .vault-pack-offer, .daily-round, .ui-cmd-box) { corner-shape: squircle; }
}

/* 1. Skeleton loader for the profile while it loads (instead of a lone line of text). */
html.ui-tips .pf-page > .pf-note[role="status"]:only-child {
  position: relative; color: transparent; min-height: 260px; margin: 24px auto; max-width: 720px;
  border-radius: 16px; overflow: hidden;
  background:
    linear-gradient(#fff1 0 0) 24px 24px / 88px 88px no-repeat,
    linear-gradient(#fff1 0 0) 132px 36px / 40% 22px no-repeat,
    linear-gradient(#fff1 0 0) 132px 72px / 25% 16px no-repeat,
    linear-gradient(#fff1 0 0) 24px 140px / calc(33% - 32px) 92px no-repeat,
    linear-gradient(#fff1 0 0) 50% 140px / calc(33% - 32px) 92px no-repeat,
    linear-gradient(#fff1 0 0) calc(100% - 24px) 140px / calc(33% - 32px) 92px no-repeat,
    #ffffff08;
}
html.ui-tips .pf-page > .pf-note[role="status"]:only-child::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, #ffffff14 50%, transparent 70%);
  translate: -100% 0; animation: ui-shimmer 1.3s ease-in-out infinite;
}
@keyframes ui-shimmer { to { translate: 100% 0; } }
@media (prefers-reduced-motion: reduce) {
  html.ui-tips .pf-page > .pf-note[role="status"]:only-child::after { animation: none; }
}

/* 3 + 4. Command menu (Ctrl/Cmd+K or "/") with shortcut hints. */
.ui-cmd { position: fixed; inset: 0; z-index: 2147483000; display: grid; justify-items: center; align-items: start;
  padding: max(12vh, env(safe-area-inset-top)) 16px 16px; background: #0b0508b3; backdrop-filter: blur(3px); }
.ui-cmd[hidden] { display: none; }
.ui-cmd-box { width: min(560px, 100%); max-height: min(70vh, 560px); display: grid; grid-template-rows: auto 1fr auto;
  background: #1d0f16; color: #f4e7d2; border: 1px solid #a77f9180; border-radius: 16px;
  box-shadow: 0 24px 60px #000a; overflow: hidden; font-family: Inter, system-ui, sans-serif; }
.ui-cmd-input { all: unset; box-sizing: border-box; width: 100%; padding: 16px 18px; font-size: 1.05rem;
  border-bottom: 1px solid #a77f9140; color: inherit; }
.ui-cmd-input::placeholder { color: #f4e7d280; }
.ui-cmd-list { list-style: none; margin: 0; padding: 6px; overflow: auto; overscroll-behavior: contain; }
.ui-cmd-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.ui-cmd-list li small { margin-left: auto; color: #f4e7d280; font-size: .8rem; }
.ui-cmd-list li[aria-selected="true"] { background: #a77f9133; }
.ui-cmd-list li .ui-cmd-group { color: #d9b46a; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; min-width: 88px; }
.ui-cmd-empty { padding: 18px; color: #f4e7d280; text-align: center; }
.ui-cmd-foot { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 14px; font-size: .75rem; color: #f4e7d299;
  border-top: 1px solid #a77f9140; }
kbd.ui-kbd { display: inline-block; min-width: 1.5em; padding: 1px 6px; border: 1px solid #f4e7d244; border-bottom-width: 2px;
  border-radius: 6px; font: 600 .72rem/1.4 Inter, system-ui, sans-serif; text-align: center; color: #f4e7d2cc; background: #ffffff0d; }
@media (prefers-reduced-motion: no-preference) {
  .ui-cmd:not([hidden]) .ui-cmd-box { animation: ui-cmd-in .16s ease-out; }
  @keyframes ui-cmd-in { from { opacity: 0; translate: 0 -8px; scale: .98; } }
}
