/* 7arif search bottom sheet (games/retro/sheet-search.js). Works on the main page (style.css tokens) and on the game pages
   (kit.css tokens): only the shared variables are used (--paper, --paper-clip, --paper-2, --ink, --ink-soft, --red, --yellow,
   --font-display, --font-ui, --ib, --il, --ir). Phone: a bottom sheet, input at its top, at most 5 rows of 52 px; it follows
   the visual viewport so the keyboard never covers the input. Wide screens: a card near the top of the page.
   Logical properties only (RTL first). Only transform / opacity animate. */
.ss-root { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
.ss-root.hidden { display: none; }
.ss-back { position: absolute; inset: 0; background: rgba(13, 18, 56, .62); }
.ss-panel { position: relative; display: flex; flex-direction: column; gap: 8px; width: min(560px, 100%); margin-inline: auto; max-height: 100%; min-height: 0;
            background: var(--paper); color: var(--ink); padding-block: 16px calc(12px + var(--ib, 0px)); padding-inline: max(14px, var(--il, 0px)) max(14px, var(--ir, 0px));
            clip-path: polygon(0 9px, 4% 4px, 8% 8px, 12% 2px, 17% 7px, 21% 3px, 26% 9px, 30% 4px, 35% 7px, 39% 1px, 44% 6px, 48% 3px, 53% 9px, 57% 4px, 62% 7px, 66% 2px, 71% 8px, 75% 3px, 80% 7px, 84% 1px, 89% 6px, 93% 3px, 97% 8px, 100% 4px, 100% 100%, 0 100%);
            animation: ss-in 180ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ss-in { from { translate: 0 28px; opacity: .4; } to { translate: 0 0; opacity: 1; } }
.ss-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 10px; flex: 0 0 auto; }
.ss-heading { flex: 1 1 0; min-width: 0; }
.ss-kicker { font: 800 var(--fs-meta, 14px)/1.5 var(--font-ui); color: var(--c-meta, #4a3f2c); }   /* never red */
.ss-title { font: 800 16px/1.45 var(--font-ui); color: var(--ink); overflow-wrap: anywhere; }
.ss-close { flex: 0 0 auto; min-width: 64px; min-height: 44px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 0; background: var(--paper-clip); color: var(--ink);
            font: 800 16px/1 var(--font-ui); box-shadow: 3px 3px 0 var(--ink); cursor: pointer; touch-action: manipulation; transition: translate 60ms; }
.ss-close:active, .ss-close.is-pressed { translate: 2px 2px; box-shadow: 1px 1px 0 var(--ink); }
.ss-input { flex: 0 0 auto; width: 100%; min-height: 50px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 0; background: var(--paper-clip); color: var(--ink);
            font: 800 var(--fs-body, 18px) var(--font-ui); box-shadow: 3px 3px 0 var(--ink); -webkit-appearance: none; appearance: none; margin: 0; }
.ss-input::placeholder { color: var(--ink-soft); opacity: 1; }
.ss-input:focus-visible, .ss-input:focus { outline: 3px solid var(--yellow); outline-offset: 2px; }
.ss-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.ss-list { list-style: none; margin: 2px 0 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 0 1 auto; border-top: 3px solid var(--ink); }
.ss-list:empty { display: none; }
.ss-row { min-height: 50px; padding: 5px 6px; border-bottom: 1.5px solid var(--ink); cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 1px;
          touch-action: manipulation; transition: translate 60ms; }
.ss-row[aria-selected="true"] { background: var(--paper-2); box-shadow: inset 4px 0 0 var(--ink); }
html[dir="rtl"] .ss-row[aria-selected="true"] { box-shadow: inset -4px 0 0 var(--ink); }
.ss-row:active, .ss-row.is-pressed { background: var(--yellow); }
.ss-name { font: 800 18px/1.3 var(--font-ui); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-meta { font: 700 14px/1.4 var(--font-ui); color: var(--ink-meta, #4a3f2c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-meta bdi, .ss-name bdi { font: inherit; color: inherit; }
/* UI sweep E3: the Arabic UI shows the English name on its own line under the Arabic one (owner rule 2026-11-12) */
.ss-en { font: 700 var(--fs-meta, 14px)/1.5 var(--font-ui); color: var(--ink-meta, #4a3f2c); overflow-wrap: normal;   /* the English line is never cut (SYS-PARTS) */ text-align: end; unicode-bidi: isolate; }
html[dir="rtl"] .ss-en { text-align: right; }
.ss-row:has(.ss-en) { min-height: 60px; padding-block: 3px; gap: 0; }
.ss-row:has(.ss-en) .ss-txt { gap: 0; }
.ss-row:has(.ss-en) .ss-name { line-height: 1.25; }
.ss-row:has(.ss-en) .ss-meta { line-height: 1.3; }
/* UI sweep A8: an inline error under the input ("اللاعب ده اتحط قبل كده"); the question title above stays */
.ss-err { flex: 0 0 auto; margin: -2px 0 0; padding-inline-start: 2px; font: 800 15px/1.45 var(--font-ui); color: var(--red-ink, #AE1C23); }
.ss-err[hidden] { display: none; }
.ss-input[aria-invalid="true"] { box-shadow: 3px 3px 0 var(--red-ink, #AE1C23); }
.ss-empty { min-height: 52px; display: flex; align-items: center; padding: 6px; font: 700 var(--fs-meta, 14px)/1.5 var(--font-ui); color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) { .ss-row:hover { background: rgba(244, 210, 31, .4); } }
/* the question's clues under the title (crests, facts, category icons): one compact row, wraps, never cut */
.ss-ctx { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; margin-top: 4px; font: 800 14px/1.3 var(--font-ui); color: var(--ink-meta, #4a3f2c); }
.ss-ctx[hidden] { display: none; }
.ss-ctx img, .ss-ctx .crest { width: 22px; height: 22px; object-fit: contain; flex: 0 0 auto; }
.ss-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border: 1.5px solid var(--ink); background: var(--paper-clip); color: var(--ink); white-space: nowrap; }
.ss-chip.ok { background: var(--lime); }
/* keyboard open: tighter; the question still shows in full (owner rule 2026-11-11: never hidden, never cut) */
.ss-root.is-kb .ss-panel { padding-block-start: 12px; gap: 6px; animation: none; }
.ss-root.is-kb .ss-kicker { display: none; }

/* wide screens: a card under the masthead, not glued to the bottom edge */
@media (min-width: 700px) and (min-height: 560px) {
  .ss-root { justify-content: flex-start; padding-block-start: 12vh; }
  .ss-panel { padding: 26px 22px 20px; filter: drop-shadow(6px 6px 0 var(--navy-deep, #0D1238)); }
}
@media (prefers-reduced-motion: reduce) {
  .ss-panel { animation: ss-fade 120ms ease-out both; }
  .ss-close, .ss-row { transition: none; }
}
@keyframes ss-fade { from { opacity: .4; } to { opacity: 1; } }
/* a row with the last club's crest (only when the club is an allowed meta field) */
.ss-row.has-crest { flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; }
.ss-txt { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; flex: 1 1 auto; }
.ss-crest { flex: 0 0 auto; width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(1.5px 1.5px 0 rgba(26, 26, 26, .45)); }
.ss-ctx .r-qpin__sep { color: var(--ink-soft); }

/* ===== round 4 (owner 2026-11-19, ROUND4.md): the calm search sheet everywhere (home's round-3 sheet): rounded cream,
   a grab handle, no torn edge; a rounded field; suggestion rows separated by a faint hairline, the picked one a rounded
   paper-lo row (no ink bar); chips as pills. ===== */
.ss-panel { clip-path: none; border-radius: 20px 20px 0 0; }
.ss-close { border: 0; border-radius: 12px; background: var(--c-paper-lo, #E6DAC0); box-shadow: none; }
.ss-close:active, .ss-close.is-pressed { translate: 0 1px; box-shadow: none; }
.ss-input { border-radius: 12px; box-shadow: none; }
.ss-input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--c-wrong, #AE1C23); }
.ss-list { border-top: 1px solid rgba(26, 26, 26, .15); }
.ss-row { border-bottom: 1px solid rgba(26, 26, 26, .12); border-radius: 10px; }
.ss-row[aria-selected="true"], html[dir="rtl"] .ss-row[aria-selected="true"] { background: var(--c-paper-lo, #E6DAC0); box-shadow: none; }
/* round 5 (owner 2026-11-19 late, ROUND5.md 50/50): the field keeps a crisp 2 px ink rim (live) on the rounded box; the close
   button is a cream chip with the ink rim and the small hard drop */
.ss-input { border: 2px solid var(--c-ink, #1A1A1A); }
.ss-close { border: 2px solid var(--c-ink, #1A1A1A); background: var(--paper-clip, #FBF7EC); box-shadow: 0 2px 0 var(--c-ink, #1A1A1A); }
.ss-close:active, .ss-close.is-pressed { translate: 0 2px; box-shadow: none; }
.ss-chip { border: 0; border-radius: 999px; background: var(--c-paper-lo, #E6DAC0); padding: 1px 8px; }
/* ===== round 6 (owner 2026-11-20, ROUND6.md K1): the search sheet is the calm BLUE page, not a cream sheet: it reads as
   the game itself rising from the bottom. Light type on the blue, hairlines in --c-line, the picked / pressed row a soft
   light panel; the field stays egg-white with its ink rim (ink type), the close chip stays cream. A 2 px ink top edge and
   a soft shadow part it from the dimmed page behind. ===== */
.ss-panel { background: var(--page-tex, none), var(--c-page, #1D2A73); color: var(--c-on, #FBF7EC); border-top: 2px solid var(--c-ink, #1A1A1A);
            box-shadow: 0 -8px 24px rgba(0, 0, 0, .35); }
.ss-panel::before { background: var(--c-line, rgba(251, 247, 236, .3)); }   /* the grab handle, where a page draws one */
.ss-kicker, .ss-ctx, .ss-empty, .ss-ctx .r-qpin__sep { color: var(--c-on-soft, rgba(251, 247, 236, .78)); }
.ss-title, .ss-name { color: var(--c-on, #FBF7EC); }
.ss-meta, .ss-en { color: var(--c-on-soft, rgba(251, 247, 236, .78)); }
.ss-list { border-top: 1px solid var(--c-line, rgba(251, 247, 236, .3)); }
.ss-row { border-bottom: 1px solid var(--c-line, rgba(251, 247, 236, .3)); }
.ss-row[aria-selected="true"], html[dir="rtl"] .ss-row[aria-selected="true"] { background: var(--c-soft-hi, rgba(251, 247, 236, .14)); box-shadow: none; }
.ss-row:active, .ss-row.is-pressed { background: rgba(251, 247, 236, .22); }
@media (hover: hover) and (pointer: fine) { .ss-row:hover { background: var(--c-soft-hi, rgba(251, 247, 236, .14)); } }
.ss-crest { filter: drop-shadow(1.5px 1.5px 0 rgba(0, 0, 0, .45)); }
.ss-input { background-color: var(--c-paper-hi, #FBF7EC); color: var(--c-ink, #1A1A1A); }
.ss-input:focus-visible, .ss-input:focus { outline-color: var(--c-note, #F4D21F); }
.ss-err { align-self: flex-start; margin: 0; padding: 0 var(--s2, 8px); border-radius: 6px; background: var(--c-wrong, #AE1C23); color: var(--c-on, #FBF7EC); }   /* red ink would not read on the blue: a red pill */
.ss-input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--c-wrong, #AE1C23); }
@media (min-width: 700px) and (min-height: 560px) { .ss-panel { border: 2px solid var(--c-ink, #1A1A1A); border-radius: 20px; filter: none; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); } }
