/* مشوار / Mashwar: the career page of the magazine. Shared look comes from ../retro/kit.css (linked first);
   this file only lays out the game: ticket-stub timeline, clue clippings, guess box, back-page result. */

.tries small:empty { display: none; }

.r-spread > .r-cover + .r-cover { margin-top: 18px; }
@media (min-width: 1024px) {
  .r-spread > .r-cover + .r-cover { margin-top: 0; }
  .cv-play { position: sticky; top: 16px; }
  .r-poster { padding-top: 6px; }
}

/* ---- issue strip: prev / next round ---- */
.r-issue { margin-bottom: 14px; }
.issue-mid { flex: 1 1 auto; min-width: 0; text-align: center; }
.issue-top { display: flex; align-items: center; justify-content: center; gap: 8px; }
/* date + difficulty: one centred row that wraps as a whole (the difficulty stamp goes under the date, centred, instead
   of a dangling "|" at the end of the date line); the stamp's own border is the separator */
.r-issue__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px; }
.r-issue__meta .r-sep { display: none; }
.diff { display: inline-block; font: 800 12px/1.5 var(--font-ui); padding: 0 6px; border: 2px solid currentColor; transform: rotate(-3deg); }
.diff.easy { color: var(--blue); }
.diff.medium { color: var(--ink); background: var(--yellow); border-color: var(--ink); }
.diff.hard { color: var(--paper-clip); background: var(--ink); border-color: var(--ink); }

/* ---- board head: headline + attempts sticker ---- */
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.board-titles { min-width: 0; }
.board-q { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 7.4vw, 34px); line-height: 1.15; margin: 0 0 6px; padding-top: 2px; }
.tries { flex: 0 0 auto; width: 88px; margin-top: 4px; }
.tries small:first-child { margin-bottom: 1px; }
.tries b { font-size: 36px; padding-top: 2px; }

/* ---- timeline: a column of ticket stubs ---- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: stub; }
.spell { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: stretch; min-height: 52px;
         background: var(--paper-clip); border: 2px solid var(--ink); box-shadow: 2px 3px 0 var(--ink); animation: r-drop 220ms cubic-bezier(.3,1.6,.5,1) both; }
/* rows stay straight: a tilted row looks misaligned on phones (owner 2026-11-12) */
/* no perforation notches: the half-circles read as broken bits on the row edges (owner 2026-11-12) */
.spell::before, .spell::after { display: none !important; }
.spell::before, .spell::after { content: ""; position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.spell::before { inset-inline-start: -8px; clip-path: inset(0 0 0 50%); }
.spell::after { inset-inline-end: -8px; clip-path: inset(0 50% 0 0); }
html[dir="ltr"] .spell::before { clip-path: inset(0 0 0 50%); }
html[dir="rtl"] .spell::before { clip-path: inset(0 50% 0 0); }
html[dir="rtl"] .spell::after { clip-path: inset(0 0 0 50%); }
.stub-no { display: grid; place-items: center; background: var(--navy); color: var(--paper-clip); font: 800 14px/1 var(--font-ui); border-inline-end: 2px solid var(--ink); }
.spell.eg .stub-no { background: var(--blue); }
.cn { align-self: center; display: flex; align-items: center; gap: 8px; padding: 6px 10px 4px; font-family: var(--font-display); font-size: 24px; line-height: 1.2; min-width: 0; overflow-wrap: break-word; }
.cnt { min-width: 0; }
/* narrow phones in English: Latin club names are long ("Bolton Wanderers"), Cairo bold wraps them on word boundaries */
@media (max-width: 420px) { html[lang="en"] .cn { font: 800 18px/1.3 var(--font-ui); } html[lang="en"] .yrs { min-width: 0; padding-inline: 8px 18px; font-size: 13.5px; } }
/* club crest (web/assets/clubs-icons.js); a plain shield outline when the club has none */
.crest { flex: 0 0 auto; width: 30px; height: 30px; object-fit: contain; }
i.crest.none { display: inline-block; width: 24px; height: 28px; border: 2px solid var(--ink); border-radius: 3px 3px 50% 50% / 3px 3px 40% 40%; background: var(--paper-2); opacity: .7; }
.crest.sm { width: 22px; height: 22px; }
i.crest.none.sm { width: 18px; height: 21px; }
.yrs { display: grid; place-items: center; padding: 0 12px; padding-inline-end: 18px; min-width: 96px; border-inline-start: 2px dashed var(--ink); font: 800 14px/1.2 var(--font-ui); white-space: nowrap; color: var(--ink); background: var(--paper-2); line-height: 1.5; }
.spell.loan { border-style: dashed; background: var(--paper); box-shadow: none; }
.spell.loan .stub-no { background: var(--paper-2); color: var(--ink); }
.loanbadge { display: inline-block; vertical-align: middle; font: 800 13px/1.5 var(--font-ui); color: var(--blue); border: 2px solid currentColor; padding: 0 5px; transform: rotate(-4deg); margin-inline-start: 4px; }
@media (max-width: 359px) { .cn { font: 800 17px/1.3 var(--font-ui); padding-inline: 6px; gap: 6px; } .crest { width: 24px; height: 24px; } .yrs { min-width: 78px; padding: 0; padding-inline: 6px 12px; font-size: 13px; } .spell { grid-template-columns: 28px minmax(0, 1fr) auto; } }

.legend { display: flex; gap: 16px; justify-content: center; margin-top: 14px; font-size: 14px; font-weight: 800; color: var(--ink-meta); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 22px; height: 12px; border: 2px solid var(--ink); background: var(--paper-clip); }
.legend i.l { border-style: dashed; background: var(--paper); }

/* ---- clue clippings ---- */
.sec-title { margin: 0 0 10px; }
.clues { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; }
.clue { position: relative; background: var(--paper-clip); border: 2px solid var(--ink); box-shadow: 2px 3px 0 var(--ink); padding: 10px 10px 8px; min-height: 66px; display: flex; flex-direction: column; justify-content: center; }
.clue:not(.locked)::before { content: none; position: absolute; top: -7px; inset-inline: 0; margin-inline: auto; width: 42%; height: 12px; transform: rotate(-5deg); background: rgba(244,210,31,.82); }
.clue:nth-child(odd):not(.locked) { }
.clue:nth-child(even):not(.locked) { }
.clue:first-child { grid-column: 1 / -1; }
.clue .k { font: 800 14px/1.4 var(--font-ui); color: var(--ink-soft); }
.clue .v { font-family: var(--font-display); font-size: 24px; line-height: 1.25; padding-top: 3px; overflow-wrap: break-word; }
.clue.locked { background: var(--paper-2); border: 2px dashed rgba(26,26,26,.45); box-shadow: none; }
.clue.locked .v { font: 700 14px/1.4 var(--font-ui); color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }
/* the next clue to open (near-miss: you can see what the next miss buys you) */
.clue.locked.next { border-color: var(--ink); background: var(--paper-clip); }
.clue.locked.next .v { color: var(--ink); font-weight: 800; }
.clue.locked .v svg { font-size: 16px; }
/* a clue opened by a miss slides in from the inline start in 250 ms */
.clue.new { --from: -28px; animation: cv-slide 250ms cubic-bezier(.2,.9,.3,1) both; }
html[dir="rtl"] .clue.new { --from: 28px; }
@keyframes cv-slide { from { transform: translateX(var(--from)); opacity: 0; } }
@keyframes cv-fade { from { opacity: 0; } }

/* ---- guess box ---- */
.play { border-top: 3px solid var(--ink); padding-top: 12px; }
/* the guess bar: a button that looks like the search box and opens the shared search sheet (sheet-search.js).
   Phones: fixed at the bottom of the screen (primary action in the thumb zone, rule 17) on a navy strip. */
.search-open { display: flex; align-items: center; gap: 10px; min-height: 56px; text-align: start; cursor: text; color: var(--ink-soft); font: 700 17px/1.4 var(--font-ui); box-shadow: 4px 4px 0 var(--red); }
.search-open svg { flex: 0 0 auto; width: 22px; height: 22px; color: var(--ink); }
.search-open:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--red); }
@media (hover: hover) { .r-btn:hover { filter: brightness(1.05); } .r-round:hover { background: rgba(239,230,210,.12); } .search-open:hover { background: #fff; } }
@media (max-width: 1023px) {
  .guessbar { position: fixed; z-index: 20; inset-inline: 0; bottom: 0; padding: 10px 14px calc(10px + var(--ib)); padding-inline: calc(14px + var(--il)) calc(14px + var(--ir));
              background: var(--navy); border-top: 3px solid var(--ink); }
  .guessbar .search-open { max-width: 520px; margin-inline: auto; box-shadow: 3px 3px 0 var(--red); }
  body:has(.play:not(.hidden)) .r-poster { padding-bottom: 96px; }
  .play { border-top: 0; padding-top: 0; }
  .play .sec-title { display: none; }
}
.result:not(.hidden) ~ .wrong, .play.hidden ~ .wrong { margin-top: 0; }

.wrong { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.wrong:empty { display: none; }
.wrong li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; }
.wn { min-width: 0; display: flex; flex-direction: column; }
.wn s { font-family: var(--font-display); font-weight: 400 !important; font-size: 24px; line-height: 1.25; padding-top: 2px; }
.wn small { font-size: 14px; font-weight: 700; color: var(--ink-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrong .r-stamp { font-size: 19px; padding: 0 8px; flex: 0 0 auto; }
/* give up (2026-11-15): a small text button beside the clues title, far from the guess box; it asks first (end.js) */
.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.sec-row .sec-title { margin: 0; }
.giveup { flex: 0 0 auto; margin: 0; }

/* ---- result: the back page ---- */
.result { text-align: center; }
.result-kicker { font-size: 15px; margin: 4px 0 0; }
.answer { margin: 8px auto 0; max-width: 360px; text-align: center; }
.answer.r-card { transform: none; }
.answer-k { margin: 0; font: 800 14px/1.4 var(--font-ui); color: var(--ink-soft); }
.who { font-family: var(--font-display); font-size: 30px; line-height: 1.2; padding-top: 4px; overflow-wrap: break-word; }
.answer .meta { font-size: 15px; font-weight: 700; color: var(--ink-meta); }
/* the full career line under the answer: first club at the inline start (right in Arabic), chevrons between */
.career-k { margin: 16px 0 6px; font: 800 14px/1.4 var(--font-ui); color: var(--ink-soft); }
/* the full career after the end block, folded (UI sweep C10): «شوف المشوار كامل» */
.career-fold { margin: 16px 0 0; border-top: 2px dashed var(--ink); }
.career-fold > summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; margin: 0; cursor: pointer; list-style: none; font: 800 16px/1.4 var(--font-ui); color: var(--ink); }
.career-fold > summary::-webkit-details-marker { display: none; }
.career-fold > summary::after { content: "+"; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid var(--ink); font: 800 18px/1 var(--font-ui); }
.career-fold[open] > summary::after { content: "−"; }
.career-fold > .career-line { padding-bottom: 8px; }
/* the answer clipping, then the end block (no extra gap: the end block starts with the score) */
#endBox { margin-top: 14px; }
/* the position chip beside the stops count (UI sweep C10) */
.board-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 25px; }
.board-chips .r-tag { font-size: 14px; }
.pos-chip { background: var(--paper-clip); border: 2px solid var(--ink); }
.pos-chip.hidden, .pos-chip:empty { display: none; }
/* a finished day: the sticker reads «اتلعب ٢/٥» */
.tries.is-done b { font-size: 24px; }
.career-line { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; max-width: 520px; }
.cl { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; background: var(--paper-clip); border: 2px solid var(--ink); font: 800 15px/1.4 var(--font-ui); }
.cl small { font-size: 14px; font-weight: 700; color: var(--ink-meta); }
.cl.loan { border-style: dashed; background: var(--paper); }
.cl { position: relative; }
.cl + .cl::before { content: ""; position: absolute; inset-inline-start: -13px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid var(--ink); border-width: 2px 2px 0 0; transform: rotate(45deg); }
html[dir="rtl"] .cl + .cl::before { transform: rotate(-135deg); }
.archive-note { margin: 0 0 12px; padding: 4px 10px; border: 2px dashed var(--ink); font: 800 14px/1.4 var(--font-ui); background: var(--paper-2); }
.nojs { color: var(--paper); text-align: center; }

/* ---- how-to-play sheet ---- */
html.sheet-open { overflow: hidden; }
.help-title { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.2; margin: 4px 0 6px; }
.tagline { margin: 0 0 12px; font-weight: 700; }
.howto { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.howto li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; font-weight: 600; }
.step { width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
        display: grid; place-items: center; font-family: var(--font-display); font-weight: 400; font-size: 18px; line-height: 1; padding-top: 3px; }
.fineprint { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin: 14px 0; }
.play-btn { width: 100%; }

@media (prefers-reduced-motion: reduce) { .spell { animation: none !important; } .clue.new { animation: cv-fade 150ms linear both !important; } }
@media (forced-colors: active) { .spell, .clue, .stat, .r-sugg li { border: 1px solid CanvasText; } }

/* desktop: the career page is the big left/right page of the spread */
@media (min-width: 1024px) {
  .board-q { font-size: 42px; }
  .r-issue__title { font-size: 28px; }
  .timeline { gap: 12px; }
  .spell { min-height: 64px; grid-template-columns: 44px minmax(0, 1fr) auto; }
  .stub-no { font-size: 16px; }
  .cn { font-size: 26px; padding-inline: 16px; }
  .yrs { min-width: 130px; font-size: 18px; }
  .legend { font-size: 14px; margin-top: 18px; }
  .cv-board .r-cover__rule { padding: 14px 18px 20px; }
}
.help { position: fixed; inset: 0; z-index: 40; }

/* rules pass (tests/rules/audit.py): Arabic body text >= 16 px / 1.6, Lalezar only >= 24 px; the guess bar hides under
   the help sheet (no target behind it) */
.board-titles .r-kicker { font-size: 16px; line-height: 1.6; }
.tagline, .howto li { font-size: 16px; line-height: 1.6; }
.fineprint { font-size: 16px; line-height: 1.6; }
.step { font: 800 17px/1 var(--font-ui); padding-top: 0; }
html.sheet-open .guessbar { visibility: hidden; }

/* compact phones (owner 2026-11-11): the board, the clues and the guess bar take less room, so more of the career
   shows at once; the question itself stays on screen through kit.js pinQuestion (crests + opened clues) */
@media (max-width: 1023px) {
  .r-spread > .r-cover + .r-cover { margin-top: 12px; }
  .r-issue { margin-bottom: 8px; }
  .board-head { margin-bottom: 8px; gap: 8px; }
  .board-q { font-size: clamp(24px, 6.8vw, 30px); margin-bottom: 4px; }
  /* three lines in the disc ("فاضل / ٥ / محاولات"): a little wider and tighter so the words stay inside the circle */
  .tries { width: 78px; margin-top: 0; align-content: center; gap: 0; }
  .tries b { font-size: 26px; line-height: .95; padding-top: 3px; }
  .tries { width: 84px; }
  .tries small { font-size: 12px; font-weight: 800; line-height: 1.15; }
  .timeline { gap: 6px; }
  .spell { min-height: 44px; }
  .cn { padding: 3px 8px 1px; }
  .crest { width: 26px; height: 26px; }
  .yrs { min-width: 88px; font-size: 14px; }
  .legend { margin-top: 8px; }
  .sec-title { margin-bottom: 8px; }
  .clues { gap: 10px 8px; margin-bottom: 12px; }
  .clue { min-height: 54px; padding: 7px 9px 5px; }
  .guessbar { padding-block: 7px calc(7px + var(--ib)); }
  .search-open { min-height: 48px; }
  body:has(.play:not(.hidden)) .r-poster { padding-bottom: 76px; }
  .wrong li { min-height: 50px; }
  .sec-row { margin-bottom: 8px; }
}

/* alignment pass 2026-11-12: desktop attempts disc, same three lines kept inside the circle */
@media (min-width: 1024px) {
  .tries { width: 100px; align-content: center; gap: 0; }
  .tries b { font-size: 34px; line-height: .95; }
  .tries small { font-size: 12px; line-height: 1.15; }
}
/* dual names (kit.js dual): the strike of a wrong guess reaches both lines (it does not cross an inline-flex box) */
.wn s .r-dn > span { text-decoration: line-through; text-decoration-thickness: 2px; }
.wn s .r-dn > .r-dn__en { text-decoration-thickness: 1px; }

/* G3 (UI sweep 2026-11-16): the first paint (before game.js and the data) keeps the final sizes: the issue strip with its
   date + difficulty line, and the board as tall as a career, so nothing on screen moves when the career lands */
@media (max-width: 1023px) {
  .cv-board .r-issue { min-height: 80px; }
}
/* P3 cold CLS: the issue's middle (its date and difficulty arrive with game.js and re-centre it) and everything under the
   career line (legend, the guess card) stay unpainted until game.js has drawn the line; the old 420 px reserve for the
   line was taller than most careers (194 px on 17 Nov: the legend and the guess card moved up 226 px, CLS 0.10) */
.cv-board .issue-mid:has(#roundDate:empty), .r-spread:has(.timeline:empty) :is(.cv-board .legend, .cv-play) { visibility: hidden; animation: r-gate-open 0s 6s forwards; }
