/* رتّبها / Rattebha: retro magazine look. Loads after ../retro/kit.css (tokens, poster, cover, buttons, clip, stamp).
   Only game-specific pieces live here: the issue nav, the clue row, the club cards (shield tile + name + move buttons),
   the timeline axis, the control desk and the back page. */


/* ---- issue strip with prev / next ---- */
.tl-issue { padding: 4px 0; }
.tl-issue__mid { flex: 1 1 auto; text-align: center; min-width: 0; }
.tl-issue .r-issue__title { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.tl-issue .r-modetag { font-size: 15px; }
.tl-issue .r-issue__meta { font-size: 16px; line-height: 1.6; }
.tl-cover .r-kicker, .tl-result .r-kicker, .tl-legend .r-kicker { font-size: 16px; line-height: 1.6; }

/* ---- clue row: sticker + question ---- */
.tl-clue { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.tl-sticker { width: 92px; flex: 0 0 auto; }
.tl-sticker b { font-size: 36px; }
.tl-sticker small { font-size: 16px; line-height: 1.2; max-width: 80px; margin-top: -4px; }
.tl-sticker.score b { font-size: 26px; direction: ltr; unicode-bidi: isolate; }
.tl-clue__text { min-width: 0; flex: 1 1 auto; }
.tl-q { font-family: var(--font-display); font-size: 24px; line-height: 1.25; padding-top: 2px; }
.tl-name { font-family: var(--font-display); font-size: 30px; line-height: 1.15; padding-top: 4px; color: var(--ink); overflow-wrap: anywhere; }
.tl-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tl-chip { display: inline-block; font: 700 16px/1.6 var(--font-ui); color: var(--ink); border: 1.5px solid var(--ink); background: var(--paper-clip); padding: 0 7px; }

/* ---- timeline axis: first club on top, latest at the bottom ---- */
.tl-axis { display: flex; align-items: center; gap: 6px; font: 800 16px/1.2 var(--font-ui); color: var(--paper-clip); background: var(--ink);
           width: fit-content; padding: 6px 10px 7px; margin-inline-start: 2px; }
.tl-axis svg { font-size: 15px; color: var(--yellow); }
.tl-axis.first { margin-bottom: 12px; }
.tl-axis.last { margin-top: 12px; }

/* ---- the club cards ---- */
.tl-cards { list-style: none; margin: 0; padding: 0 0 0 0; display: flex; flex-direction: column; row-gap: 12px; position: relative; }
.tl-cards::before { content: ""; position: absolute; top: -12px; bottom: -12px; inset-inline-start: 27px; border-inline-start: 3px dotted var(--ink); opacity: .45; }
.card { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.card.locked { cursor: default; touch-action: auto; }
.tl-card { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 68px; padding: 6px 6px; }
.tl-card.plain { background: var(--paper-clip); border: 2px solid var(--ink); box-shadow: var(--shadow-hard); }
.tl-card.r-clip { padding: 8px 8px; }
.tl-card.r-clip::before { width: 96px; inset-inline-start: 30%; inset-inline-end: auto; transform: rotate(-4deg); }
.tl-card.r-bad { padding: 6px 6px; box-shadow: var(--shadow-hard); border-width: 2px; }
.tl-card.r-clip.r-fresh { animation: tl-drop 220ms cubic-bezier(.3,1.6,.5,1); }
@keyframes tl-drop { from { transform: translateY(-12px) rotate(0); opacity: 0; } to { transform: none; opacity: 1; } }

/* shield tile: a small team-family panel (navy + halftone), as on the main grid */
.tl-tile { position: relative; width: 56px; height: 56px; display: grid; place-items: center; background: var(--fam-team); border: 2px solid var(--ink); }
.tl-tile::before { content: ""; position: absolute; inset: 0; background-image: var(--tex-halftone); background-size: 5px 5px; pointer-events: none; }
.tl-tile img, .tl-tile .tl-crest { position: relative; width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.45)); }
.tl-tile .slot { position: absolute; top: 2px; inset-inline-start: 2px; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; display: grid; place-items: center;
                 background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); font: 900 16px/1 var(--font-ui); z-index: 1; }

.club { min-width: 0; }
.club-name { font: 800 17px/1.35 var(--font-ui); overflow-wrap: anywhere; color: var(--ink); }
.club-sub .r-tag { font-size: 16px; line-height: 1.4; }
.club-sub .putat { font: 700 16px/1.4 var(--font-ui); color: var(--ink-meta); }
.club-sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.club-sub .years { font: 800 16px/1.4 var(--font-ui); color: var(--ink-meta); direction: ltr; unicode-bidi: isolate; }

.moves { display: flex; gap: 8px; }
.move { width: var(--tap); height: var(--tap); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); background: var(--paper-clip); color: var(--ink); display: grid; place-items: center;
        padding: 0; font-size: 22px; transition: transform 60ms; touch-action: manipulation; }
.move svg { width: 1em; height: 1em; }
.move:active { background: var(--yellow); transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.move:disabled { color: rgba(26,26,26,.22); border-color: rgba(26,26,26,.25); box-shadow: none; cursor: default; background: transparent; transform: none; }
.move:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (hover: hover) { .move:not(:disabled):hover { background: var(--yellow); } }

/* wrong: red stamp across the card's top edge */
.tl-stamp { position: absolute; bottom: 6px; inset-inline-start: 6px; font-size: 13px; line-height: 1.1; padding: 0 4px; border-width: 2px; outline-width: 2px; pointer-events: none; z-index: 2; }

/* loss reveal: a club the last attempt missed is greyed, with a dash seal and "you had it at N" */
.tl-card.missed { background: var(--paper-2); border-style: dashed; box-shadow: none; }
.tl-card.missed .tl-tile { opacity: .75; }
.tl-miss { position: absolute; top: -10px; inset-inline-end: -10px; width: 26px; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper-clip); }
.tl-miss::before { content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 3px; background: var(--ink); }

.card.dragging { z-index: 5; cursor: grabbing; }
.card.dragging .tl-card { outline: 3px solid var(--yellow); outline-offset: 2px; box-shadow: 6px 6px 0 var(--ink); }

/* ---- control desk (below the cover on phones, the right-hand page on desktop) ---- */
.tl-desk { margin-top: 18px; }
.tl-desk > .tl-result { margin-top: 0; }
.tl-controls { display: grid; gap: 10px; }
.tl-status { min-height: 1.6em; font-weight: 800; font-size: 16px; line-height: 1.6; color: var(--paper-clip); text-align: center; }
.tl-status:empty { display: none; }
.tl-status.bad { color: var(--ink); background: var(--yellow); padding: 4px 8px; width: fit-content; justify-self: center; box-shadow: 2px 2px 0 var(--navy-deep); }
.tl-check { width: 100%; min-height: 56px; font-size: 18px; }

.tl-result { text-align: center; }
.tl-result .r-kicker { text-align: center; border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; margin-bottom: 8px; }
.tl-headline { font-family: var(--font-display); font-size: 32px; line-height: 1.2; padding-top: 4px; color: var(--paper-clip); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); margin-top: 4px; }
.tl-result__sub { font-weight: 800; color: var(--ink-meta); margin-top: 2px; }
.tl-history { display: grid; gap: 4px; justify-content: center; margin: 12px 0 4px; }
.tl-history div { display: flex; gap: 4px; justify-content: center; }
.tl-history i { width: 18px; height: 18px; border: 2px solid var(--ink); background: var(--paper-2); }
.tl-history i.ok { background: var(--lime); }
.tl-history i.bad { background: var(--red); background-image: repeating-linear-gradient(-45deg, rgba(251,247,236,.35) 0 2px, transparent 2px 5px); }
.tl-share { width: 100%; margin-top: 12px; }
.r-share.flash { background: var(--yellow); }

.tl-legend { display: none; }

/* ---- help sheet ---- */
.tl-help .r-sheet { color: var(--ink); }
.tl-helpbody { font-size: 16px; line-height: 1.6; font-weight: 600; }
.tl-helpbody ul { padding-inline-start: 20px; margin: 8px 0; }
.tl-helpbody li { margin: 4px 0; }
.tl-helpbody .note { font-size: 16px; color: var(--ink-meta); border-top: 1.5px dashed var(--ink); padding-top: 8px; }
.tl-helpclose { width: 100%; margin-top: 10px; }
html.sheet-open { overflow: hidden; }

/* ---- phones: the check button and its status ride in a sticky bottom bar while the round is open ---- */
@media (max-width: 1023px) {
  .tl-desk:not(.done) { position: sticky; bottom: 0; z-index: 6; margin-inline: -4px; padding: 10px 4px calc(10px + env(safe-area-inset-bottom, 0px));
                        background: var(--navy); border-top: 3px solid var(--ink); }
  .tl-desk:not(.done) .tl-controls { gap: 8px; }
}

/* ---- narrow phones ---- */
@media (max-width: 380px) {
  .tl-card { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 8px; min-height: 60px; }
  .tl-tile { width: 46px; height: 46px; }
  .tl-tile img, .tl-tile .tl-crest { width: 33px; height: 33px; }
  .club-name { font-size: 16px; }
  .tl-cards::before { inset-inline-start: 22px; }
  .tl-sticker { width: 86px; }
  .tl-sticker b { font-size: 30px; }
  .tl-stamp { }
  .r-cover__rule { padding: 8px 8px 12px; }
}

/* ---- desktop: two-page spread, cards on the left page, the desk on the right ---- */
@media (min-width: 1024px) {
  .r-poster { --maxw: 1040px; }
  .tl-spread { grid-template-columns: minmax(0, 600px) minmax(0, 1fr); }
  .tl-desk { margin-top: 0; position: sticky; top: 16px; display: grid; gap: 18px; }
  .tl-controls { background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-navy); padding: 16px; }
  .tl-status { color: var(--ink); }
  .tl-status:empty { display: none; }
  .tl-result { margin-top: 0; box-shadow: var(--shadow-navy); }
  .tl-legend { display: grid; gap: 12px; background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-navy); padding: 16px; }
  .tl-legend .r-kicker { border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; margin: 0; }
  .tl-legend__row { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; line-height: 1.6; }
  .tl-legend__ok { position: relative; display: block; height: 36px; background: var(--paper-clip); outline: 3px solid var(--lime); outline-offset: -6px; box-shadow: 2px 3px 0 rgba(26,26,26,.55); }
  .tl-legend__ok::after { content: ""; position: absolute; top: -8px; inset-inline-end: -8px; width: 22px; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink);
    background: var(--lime) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23141821' stroke-width='3.6' stroke-linecap='square'/%3E%3C/svg%3E") center / 70% no-repeat; }
  .tl-legend__bad { display: grid; place-items: center; height: 36px; border: 2px solid var(--red); background-color: #F7D4CF; background-image: repeating-linear-gradient(-45deg, rgba(215,38,46,.09) 0 6px, transparent 6px 13px); }
  .tl-legend__bad .r-stamp { font-size: 24px; transform: rotate(-6deg) scale(.6); padding: 0 5px; border-width: 2px; outline-width: 2px; box-shadow: 2px 2px 0 var(--ink); }
  .tl-legend__row .r-tag { justify-self: center; font-size: 16px; }
  .tl-name { font-size: 40px; }
  .tl-q { font-size: 28px; }
  .tl-cover .r-cover__rule { padding: 14px 18px 20px; }
  .tl-issue .r-issue__title { font-size: 28px; }
  .tl-sticker { width: 96px; }
  .tl-sticker b { font-size: 44px; }
  .tl-cards { row-gap: 16px; }
  .tl-cards::before { inset-inline-start: 34px; }
  .tl-card { grid-template-columns: 70px minmax(0, 1fr) auto; min-height: 84px; gap: 14px; padding: 8px 10px; }
  .tl-card.r-clip { padding: 10px 12px; }
  .tl-tile { width: 70px; height: 70px; }
  .tl-tile img, .tl-tile .tl-crest { width: 52px; height: 52px; }
  .club-name { font-size: 20px; }
  .tl-stamp { font-size: 15px; }
  .tl-check { min-height: 60px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .tl-card.r-clip.r-fresh { animation: none; } }

/* ---- the shared back page (../retro/end.js) replaces our own score / verdict / share; the attempt rows stay on top ---- */
.tl-result.has-end > .r-kicker, .tl-result.has-end > .r-score, .tl-result.has-end > .r-verdict,
.tl-result.has-end > .tl-result__sub, .tl-result.has-end > .tl-share, .tl-result.has-end > #shareOut { display: none; }
.tl-result.has-end > .tl-history { display: none; }
.tl-history--end { margin: 4px 0 14px; }

/* compact phones (owner 2026-11-11): smaller sticker, tighter clue row, axis and cards, a slimmer check bar: more of the
   clubs on one screen; the instruction stays on screen through kit.js pinQuestion while the cards scroll */
@media (max-width: 1023px) {
  .tl-clue { gap: 10px; margin: 2px 0 8px; }
  .tl-sticker { width: 70px; }
  .tl-sticker b { font-size: 28px; }
  .tl-sticker small { font-size: 13px; max-width: 62px; }
  .tl-meta { gap: 4px; margin-top: 4px; }
  .tl-chip { line-height: 1.45; padding: 0 6px; }
  .tl-axis { padding: 4px 9px 5px; }
  .tl-axis.first { margin-bottom: 8px; }
  .tl-axis.last { margin-top: 8px; }
  .tl-cards { row-gap: 8px; }
  .tl-cards::before { top: -8px; bottom: -8px; inset-inline-start: 23px; }
  .tl-card { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 8px; min-height: 56px; padding: 4px 6px; }
  .tl-card.r-clip { padding: 6px 8px; }
  .tl-card.r-bad { padding: 4px 6px; }
  .tl-tile { width: 48px; height: 48px; }
  .tl-tile img, .tl-tile .tl-crest { width: 34px; height: 34px; }
  .tl-desk { margin-top: 12px; }
  .tl-desk:not(.done) { padding-block: 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .tl-check { min-height: 48px; font-size: 17px; }
}

/* alignment pass 2026-11-12: the sticker's words ("محاولات", "tries left", "النتيجة") stay inside the disc: the number and the
   word sit as one centred block, the word a size smaller, the disc a little wider on phones */
.tl-sticker { align-content: center; gap: 0; }
.tl-sticker b { line-height: .95; }
.tl-sticker small { font-size: 14px; line-height: 1.15; margin-top: 0; }
.tl-sticker.score b { font-size: 24px; }
@media (max-width: 1023px) {
  .tl-sticker { width: 80px; }
  .tl-sticker b { font-size: 26px; }
  .tl-sticker small { font-size: 12px; max-width: 64px; }
  .tl-sticker.score b { font-size: 21px; }
}

/* ---- UI sweep 2026-11-16 (P2-gamesB, C8) ----
   drag only from the crest tile (the grip): a vertical swipe anywhere else on a card scrolls the page */
.card { touch-action: pan-y; cursor: default; }
.card:not(.locked) .tl-tile { touch-action: none; cursor: grab; }
.card.dragging .tl-tile { cursor: grabbing; }
/* the tick seal sits on the crest tile's corner, clear of the up / down arrows */
.tl-card.r-clip::after { top: -6px; inset-inline-end: auto; inset-inline-start: 42px; z-index: 2; }
@media (max-width: 380px) { .tl-card.r-clip::after { inset-inline-start: 40px; } }
@media (min-width: 1024px) { .tl-card.r-clip::after { inset-inline-start: 66px; } }
/* wrong place: a small icon stamp on the tile's corner (no Lalezar under 20 px, E1), the club name stays readable */
.tl-stamp { width: 24px; height: 24px; padding: 0; bottom: 2px; inset-inline-start: 2px; border: 2px solid var(--paper-clip); outline: 2px solid var(--red);
            transform: rotate(-8deg); box-shadow: 2px 2px 0 var(--ink);
            background: var(--red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='%23FBF7EC' stroke-width='3.6' stroke-linecap='square'/%3E%3C/svg%3E") center / 70% no-repeat; }
.tl-stamp::before, html[lang="en"] .tl-stamp::before { content: none; }
/* the sticker reads "المحاولة / ٢ / من ٣" (three short lines); once done: the score + "النتيجة" */
.tl-sticker__pre:empty { display: none; }
.tl-sticker small { white-space: nowrap; }
@media (max-width: 1023px) { .tl-sticker { width: 84px; } .tl-sticker b { font-size: 24px; } }
/* P3 cold CLS: the clue, the two axis labels and the cards stay unpainted (laid out) until game.js has written the clue
   (the clue grew 8 -> 119-148 px and moved the sticker and the cards: CLS 0.19-0.25 on slow 4G); failsafe 6 s (the data timeout) */
.tl-cover:has(#clueQ:empty) :is(.tl-clue, .tl-axis, .tl-cards) { visibility: hidden; animation: r-gate-open 0s 6s forwards; }
