/* ================================================================ secretbadges-1128 (public/secretbadges.js)
   Anton 22:03-22:04 ET 2026-11-28: better secret-title badges that read on the walnut panel and "look like they belong in the game".
   Strip: three equal tiles, each a 48 px struck brass badge (52 px on desktop, 44 px at 360) above its name; the whole tile is the tap (>= 48 px tall).
   Locked: dark enamel + brass keyhole whose gold glow breathes (the approved 16:05 breath: .35 -> .75 over 3.2 s, offset per badge)
   and a slow glint across the plate every 7 s. Unlocked: a one-time strike (flip + flash ring) the first time this client sees it.
   Shapes: no border-radius anywhere; plates are V-cut (clip-path chamfers). Text >= 4.5:1 on the walnut. Reduced motion: all static. */
#game #titles.sb-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }
/* hotfix-1129: no heading above the strip any more (Anton 05:32 ET 2026-11-29), so no top gap: the badges sit on the panel padding like every other panel's first row */
#game .titles-row > #titles, #game .titles-row > #titles.sb-strip { margin-top: 0; }
#game .sb-tile { --c: 6px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; min-width: 0; min-height: 48px; margin: 0; padding: 4px 2px 5px;
  border: 0; border-radius: 0; background: transparent; color: #fff1c9; font: inherit; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent; outline: none; isolation: isolate; }
#game .sb-tile::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .15s;
  background: linear-gradient(180deg, rgba(255, 215, 106, .16), rgba(255, 215, 106, .05));
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); }
@media (hover: hover) { #game .sb-tile:hover::before { opacity: 1; } }   /* no sticky hover after a tap on phones */
#game .sb-tile:focus-visible::before { opacity: 1; }
#game .sb-tile:focus-visible::before { background: linear-gradient(180deg, rgba(255, 215, 106, .2), rgba(255, 215, 106, .08)), linear-gradient(#ffd76a, #ffd76a) bottom / 100% 2px no-repeat; }
#game .sb-tile:active .sb-badge { transform: translateY(1px) scale(.97); }
.sb-badge { position: relative; flex: 0 0 auto; display: block; width: 48px; height: 48px; filter: drop-shadow(0 2px 1.5px rgba(20, 6, 0, .7)); transition: transform .12s ease-out; }
.sb-badge > svg, .sb-card-badge > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sb-txt { display: flex; flex-direction: column; align-items: center; max-width: 100%; min-width: 0; line-height: 1.12; }
.sb-txt b { font: 700 12.5px/1.1 var(--font-display, Fredoka, sans-serif); letter-spacing: .02em; color: #fff1c9; text-shadow: 0 1px 0 rgba(30, 8, 0, .85); }
.sb-txt small { margin-top: 2px; font: 700 10.5px/1.15 Nunito, sans-serif; color: #e9cf9f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#game .sb-tile.sb-locked .sb-txt b { color: #f6cf62; font-size: 14px; letter-spacing: .14em; text-shadow: 0 0 6px rgba(255, 196, 80, .4), 0 1px 0 rgba(40, 12, 0, .85); }
#game .sb-tile.sb-on .sb-txt small { color: #ffd76a; }
#game .sb-tile.sb-dark .sb-txt b { color: #e4ddd0; } #game .sb-tile.sb-dark .sb-txt small { color: #cfc8bb; }
@media (min-width: 901px) { .sb-badge { width: 52px; height: 52px; } .sb-txt b { font-size: 12px; letter-spacing: 0; } }
@media (max-width: 370px) { .sb-badge { width: 44px; height: 44px; } .sb-txt b { font-size: 11.5px; } .sb-txt small { font-size: 10px; } }

/* locked: the keyhole glow breathes, a glint crosses the plate now and then (each badge offset so they never move together) */
.sb-breath { opacity: .35; animation: sbBreath 3.2s ease-in-out infinite; }
.sb-glint { opacity: 0; }
.sb-locked .sb-glint, .sb-card.sb-locked .sb-glint { animation: sbGlint 7s ease-in-out infinite; }
#titles .sb-tile:nth-child(2) .sb-breath { animation-delay: -1.1s; } #titles .sb-tile:nth-child(3) .sb-breath { animation-delay: -2.2s; }
#titles .sb-tile:nth-child(2) .sb-glint { animation-delay: -2.4s; } #titles .sb-tile:nth-child(3) .sb-glint { animation-delay: -4.8s; }
@keyframes sbBreath { 0%, 100% { opacity: .35; } 50% { opacity: .75; } }
@keyframes sbGlint { 0%, 78% { opacity: 0; transform: translateX(0); } 80% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; transform: translateX(118px); } }

/* unlocked, the first time: the badge is struck (a quick coin flip in from small) and a brass flash ring opens behind it */
.sb-reveal .sb-badge { animation: sbStrike 1.1s ease-out both; }
.sb-reveal .sb-badge::before { content: ''; position: absolute; inset: -18px; z-index: -1; pointer-events: none; animation: sbFlash 1.5s ease-out .25s both;
  background: radial-gradient(closest-side, rgba(255, 241, 184, 1), rgba(255, 214, 90, .8) 52%, rgba(255, 201, 60, 0) 78%); }
.sb-reveal .sb-glint { animation: sbGlint 1.6s ease-in-out .5s 1 both; }
.sb-reveal .sb-txt { animation: sbRise .6s ease-out .45s both; }
@keyframes sbStrike { 0% { transform: scale(.5) rotateY(90deg); opacity: 0; } 35% { transform: scale(1.16) rotateY(0); opacity: 1; } 60% { transform: scale(.95) rotateY(0); } 100% { transform: scale(1) rotateY(0); } }
@keyframes sbFlash { 0% { transform: scale(.6); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes sbRise { from { transform: translateY(5px); opacity: 0; } to { transform: none; opacity: 1; } }

/* the detail card: a V-cut walnut plate inside a gilt rim, under the game's own pop-ups (#modal is 5000) */
.sb-card-wrap { position: fixed; inset: 0; z-index: 4900; display: grid; place-items: center; padding: 16px; background: rgba(12, 5, 0, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: sbFade .18s ease-out both; }
.sb-card { --c: 14px; position: relative; isolation: isolate; width: min(340px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 18px 20px 18px; display: flex; flex-direction: column; align-items: center; text-align: center;
  color: #f6e6c8; background: linear-gradient(135deg, #fff1b8, #e9b23c 35%, #8a5a12 65%, #ffd76a); border-radius: 0;
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); animation: sbPop .26s cubic-bezier(.2, 1.3, .4, 1) both; }
.sb-card::before { content: ''; position: absolute; inset: 2.5px; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 70% at 50% 0, rgba(255, 210, 120, .14), rgba(255, 210, 120, 0) 60%),
    repeating-linear-gradient(2deg, rgba(255, 210, 150, 0) 0 2px, rgba(255, 210, 150, .06) 2px 3px, rgba(30, 8, 0, 0) 3px 5px, rgba(30, 8, 0, .18) 5px 6px), linear-gradient(180deg, #5e2a0f, #43190a 60%, #361306);
  clip-path: polygon(calc(var(--c) - 1px) 0, calc(100% - var(--c) + 1px) 0, 100% calc(var(--c) - 1px), 100% calc(100% - var(--c) + 1px), calc(100% - var(--c) + 1px) 100%, calc(var(--c) - 1px) 100%, 0 calc(100% - var(--c) + 1px), 0 calc(var(--c) - 1px)); }
.sb-card-badge { display: block; width: 112px; height: 112px; margin: 2px 0 8px; filter: drop-shadow(0 4px 4px rgba(10, 3, 0, .7)); }
.sb-card .sb-kicker { font: 800 11px/1.2 Nunito, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #ffd76a; }
.sb-card h2 { margin: 4px 0 10px; font: 700 24px/1.1 var(--font-display, Fredoka, sans-serif); letter-spacing: .03em; color: #fff1c9; text-shadow: 0 2px 0 rgba(20, 6, 0, .7); }
.sb-card.sb-locked h2 { color: #f6cf62; letter-spacing: .2em; }
.sb-card .sb-hint { margin: 0 0 8px; font: 700 15px/1.35 Nunito, sans-serif; color: #fff1c9; }
.sb-card .sb-hint b { color: #ffd76a; }
.sb-card .sb-row { width: 100%; margin: 0 0 8px; padding: 8px 10px; text-align: left; font: 600 13.5px/1.35 Nunito, sans-serif; color: #f6e6c8; background: rgba(15, 5, 0, .42); box-shadow: inset 0 0 0 1px rgba(255, 215, 106, .28);
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px); }
.sb-card .sb-row b { display: block; margin-bottom: 2px; font: 800 10.5px/1.2 Nunito, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #ffd76a; }
.sb-card .sb-note { margin: 2px 0 12px; font: 600 13px/1.35 Nunito, sans-serif; color: #e9cf9f; }
.sb-card .sb-close { --c: 7px; min-width: 140px; min-height: 46px; padding: 0 22px; border: 0; border-radius: 0; cursor: pointer; font: 700 16px var(--font-display, Fredoka, sans-serif); letter-spacing: .03em; color: #3d2400;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45); background: linear-gradient(180deg, #fff3b0 0%, #ffd76a 30%, #f2b632 65%, #d89412 100%);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); }
.sb-card .sb-close:active { filter: brightness(.92); transform: translateY(1px); }
.sb-card .sb-close:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #3d2400; }
@keyframes sbFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sbPop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

/* secretbadges-1128b: the same badge, large, on the "Secret title unlocked" celebration (replaces art/title_*.png and its round swatch)
   and small on the achievement banner. The celebration's own pop (celPop) is the strike; a brass flash opens behind it once. */
.celebrate .cel-swatch.cel-sb { position: relative; width: clamp(128px, 36vw, 196px); height: clamp(128px, 36vw, 196px); border-radius: 0; overflow: visible; background: none; box-shadow: none;
  filter: drop-shadow(0 6px 6px rgba(10, 3, 0, .7)) drop-shadow(0 0 22px rgba(255, 201, 60, .55)); }
.celebrate .cel-swatch.cel-sb > svg { width: 100%; height: 100%; display: block; overflow: visible; filter: none; }
.celebrate .cel-swatch.cel-sb::before { content: ''; position: absolute; inset: -22%; z-index: -1; pointer-events: none; background: radial-gradient(closest-side, rgba(255, 241, 184, .95), rgba(255, 214, 90, .6) 50%, rgba(255, 201, 60, 0) 76%);
  animation: sbFlash 1.5s ease-out .2s both; }
.celebrate.still .cel-swatch.cel-sb::before { animation: none; opacity: 0; }
.ach-banner .ab-ic:has(.sb-ab) { background: none; border-radius: 0; overflow: visible; }
.ach-banner .ab-ic .sb-badge.sb-ab { width: 44px; height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .sb-breath { animation: none; opacity: .55; }
  .sb-glint, .sb-locked .sb-glint, .sb-card.sb-locked .sb-glint, .sb-reveal .sb-glint { animation: none; opacity: 0; }
  .sb-reveal .sb-badge, .sb-reveal .sb-badge::before, .sb-reveal .sb-txt, .sb-card-wrap, .sb-card { animation: none; }
  .celebrate .cel-swatch.cel-sb::before { animation: none; opacity: 0; }
}
/* ================================================================ secretbadges-1128 END */
