/* Timeline Sorter v2. Scoped to .tls2 / body.tls2-page so nothing leaks into other pages. Same look as Guess the Fee v2 and Transfer Business v2. */
body.tls2-page {
  background:
    radial-gradient(70% 38% at 10% 0%, rgba(74, 163, 255, 0.14), transparent 70%),
    radial-gradient(70% 38% at 92% 0%, rgba(255, 138, 61, 0.11), transparent 70%),
    #060a12;
  background-attachment: fixed;
}
@media (max-width: 640px) { body.tls2-page .site-header, body.tls2-page .circuit-bar { position: static; } }
.tls2-h1 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.tls2, .tls2-modal {
  --panel: #0e1424; --panel2: #141c32; --line: rgba(255, 255, 255, .12);
  --txt: #f3f5fa; --dim: #9aa6bd; --acc: #4aa3ff; --warn: #f5b83d; --ink: #0a0d14;
  --good: #38c977; --bad: #ff6b6b; --amber: #f5b83d;
  color: var(--txt);
}
.tls2 { max-width: 440px; margin: 0 auto; padding: 6px 0 90px; }
.tls2 button, .tls2 input { font-family: inherit; }
.tls2 [hidden] { display: none !important; }
.tls2 :focus-visible, .tls2-modal :focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.tls2-preview { background: rgba(245, 184, 61, .1); border: 1px dashed rgba(245, 184, 61, .6); color: #ffe2a8; border-radius: 8px; padding: 8px 12px; font-size: 12px; line-height: 1.4; margin: 4px 0 10px; }

/* HUD */
.tls2-hud { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 2px 6px; position: relative; }
.tls2-brand { padding: 0 40px; font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 28px; line-height: 1; text-align: center; }
.tls2-brand small { display: block; font-family: var(--font-body, Inter, sans-serif); font-size: 9.5px; letter-spacing: .22em; font-weight: 700; color: var(--acc); margin-top: 5px; }
.tls2-icons { position: absolute; right: 2px; top: 4px; display: flex; gap: 6px; }
.tls2-icons button, .tls2-datenav button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--txt); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.tls2-icons button:hover, .tls2-datenav button:not(:disabled):hover { border-color: var(--acc); }
.tls2-datenav { display: flex; align-items: center; justify-content: center; gap: 8px; }
.tls2-datenav button:disabled { opacity: .3; cursor: not-allowed; }
.tls2-datenav span { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 15px; color: var(--acc); min-width: 84px; text-align: center; white-space: nowrap; }

/* Puzzle heading */
.tls2-phead { text-align: center; margin: 6px 0 8px; }
.tls2-diff { display: inline-block; font-size: 9px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; border-radius: 999px; padding: 3px 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--dim); }
.tls2-diff.d0 { color: var(--good); border-color: rgba(56, 201, 119, .5); }
.tls2-diff.d1 { color: var(--amber); border-color: rgba(245, 184, 61, .5); }
.tls2-diff.d2 { color: var(--bad); border-color: rgba(255, 107, 107, .5); }
.tls2-ptitle { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 27px; line-height: 1.08; text-transform: uppercase; margin: 6px 0 0; overflow-wrap: anywhere; }

/* Attempts + hint */
.tls2-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 6px; min-height: 36px; }
.tls2-pips { display: flex; gap: 6px; align-items: center; }
.tls2-pip { min-width: 42px; height: 26px; padding: 0 8px; border-radius: 8px; background: #232c45; color: #6c7894; font-size: 11px; font-weight: 900; letter-spacing: .04em; display: flex; align-items: center; justify-content: center; border: 1.5px solid transparent; font-variant-numeric: tabular-nums; }
.tls2-pip.now { border-color: var(--acc); color: var(--txt); background: var(--panel); }
.tls2-pip.done { background: var(--panel2); color: var(--txt); }
.tls2-pip.win { background: var(--good); color: var(--ink); }
.tls2-hint { border: 1px solid rgba(245, 184, 61, .55); background: rgba(245, 184, 61, .08); color: #ffe2a8; border-radius: 999px; font-weight: 800; font-size: 12px; min-height: 34px; padding: 0 12px; cursor: pointer; white-space: nowrap; }
.tls2-hint:disabled { opacity: .45; cursor: not-allowed; }
.tls2-ends { font-size: 10px; letter-spacing: .2em; font-weight: 800; text-transform: uppercase; color: #6c7894; text-align: center; margin: 2px 0; }

/* Cards */
.tls2-list { position: relative; display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px; padding: 0; list-style: none; }
.tls2-card { position: relative; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 6px; min-height: 68px; padding: 8px 8px 8px 2px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .18s ease, border-color .2s, background .2s, box-shadow .2s; }
.tls2-card.mouse-drag { cursor: grab; }
.tls2-grip { width: 44px; height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--dim); touch-action: none; cursor: grab; border-radius: 10px; font-size: 18px; line-height: 1; }
.tls2-grip b { font-family: var(--font-display, 'Jersey 15', sans-serif); font-weight: 400; font-size: 15px; color: #6c7894; }
.tls2-txt { font-size: 14.5px; font-weight: 700; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.tls2-when { display: inline-block; margin-top: 4px; font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 17px; color: var(--acc); }
.tls2-note { display: block; font-size: 11.5px; font-weight: 700; color: var(--dim); margin-top: 1px; }
.tls2-mv { display: flex; flex-direction: column; gap: 4px; }
.tls2-mv button { width: 40px; height: 29px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--txt); font-size: 13px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
.tls2-mv button:disabled { opacity: .25; cursor: not-allowed; }
.tls2-mv button:not(:disabled):active { background: var(--acc); color: var(--ink); }

.tls2-card.locked { border-color: var(--good); background: rgba(56, 201, 119, .1); }
.tls2-card.locked .tls2-grip { cursor: default; color: var(--good); font-size: 17px; }
.tls2-card.miss { border-color: rgba(245, 184, 61, .75); border-style: dashed; }
.tls2-card.shake { animation: tlsShake .38s ease; }
.tls2-card.pop { animation: tlsPop .45s ease; }
.tls2-card.dragging { z-index: 6; transition: none; cursor: grabbing; border-color: var(--acc); background: var(--panel2); box-shadow: 0 14px 28px rgba(0, 0, 0, .55), 0 0 0 3px rgba(74, 163, 255, .22); }
.tls2-card.settling { z-index: 6; transition: transform .16s ease, box-shadow .16s ease; }
.tls2-list.dragging-on .tls2-card:not(.dragging) { transition: transform .16s ease; }
.tls2-card.final-ok { border-color: var(--good); background: rgba(56, 201, 119, .1); }
.tls2-card.final-no { border-color: rgba(245, 184, 61, .75); background: rgba(245, 184, 61, .07); }
.tls2-card.final-ok .tls2-grip, .tls2-card.final-no .tls2-grip { cursor: default; }
.tls2-card.final-ok .tls2-grip { color: var(--good); }
.tls2-card.final-no .tls2-grip { color: var(--amber); }

.tls2-msg { text-align: center; font-size: 13px; font-weight: 700; color: #cfd6e6; min-height: 20px; margin: 2px 0 8px; }
.tls2-msg b { color: var(--txt); }
.tls2-check { width: 100%; min-height: 54px; font-weight: 900; font-size: 16px; border-radius: 14px; border: 0; background: var(--acc); color: var(--ink); cursor: pointer; }
.tls2-check:active { transform: scale(.985); }
.tls2-check:disabled { opacity: .5; cursor: not-allowed; }
.tls2-tip { text-align: center; font-size: 11.5px; color: #6c7894; margin-top: 8px; }

/* Result */
.tls2-result { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; text-align: center; margin: 8px 0 12px; animation: tlsRise .5s ease backwards; }
.tls2-kicker { font-size: 10.5px; letter-spacing: .22em; font-weight: 800; color: var(--acc); text-transform: uppercase; }
.tls2-grade { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 34px; line-height: 1.1; margin: 6px 0 2px; }
.tls2-bigscore { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 56px; line-height: 1; margin: 2px 0; }
.tls2-bigscore small { font-size: 22px; color: var(--dim); }
.tls2-rsub { font-size: 13px; color: var(--dim); margin: 0 0 10px; }
.tls2-grid { font-size: 24px; line-height: 1.35; letter-spacing: 3px; margin: 6px 0 10px; }
.tls2-minstats { display: flex; justify-content: center; gap: 18px; margin: 0 0 12px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.tls2-minstats b { display: block; font-size: 20px; color: var(--txt); letter-spacing: 0; }
.tls2-acts { display: flex; gap: 8px; }
.tls2-acts button { flex: 1; font-weight: 800; font-size: 14px; padding: 13px 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .3); cursor: pointer; background: transparent; color: var(--txt); min-height: 46px; }
.tls2-acts button.primary { background: var(--acc); border-color: var(--acc); color: var(--ink); }
.tls2-next { font-size: 12px; color: var(--dim); margin-top: 12px; }
.tls2-h3 { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 800; margin: 14px 0 8px; text-align: center; }

.tls2-empty { text-align: center; padding: 32px 16px; color: var(--dim); font-size: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; }

/* Preview tools */
.tls2-tools { margin-top: 18px; padding: 12px; border: 1px dashed rgba(245, 184, 61, .6); border-radius: 10px; font-size: 12px; color: #ffe2a8; }
.tls2-tools label { display: block; margin: 8px 0 4px; }
.tls2-tools input[type="date"] { background: var(--panel); color: var(--txt); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.tls2-tools div { margin-top: 6px; }
.tls2-tools button { margin: 4px 6px 0 0; padding: 7px 10px; border-radius: 6px; border: 1px solid rgba(245, 184, 61, .6); background: transparent; color: #ffe2a8; cursor: pointer; font-weight: 700; }
.tls2-tools code { display: block; white-space: pre-wrap; margin-top: 8px; font-size: 11.5px; color: #cfd6e6; }

/* Modal */
.tls2-modal { position: fixed; inset: 0; z-index: 9999; background: rgba(3, 6, 12, .78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tls2-modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 18px; width: 100%; max-width: 380px; max-height: 88vh; overflow: auto; }
.tls2-modal-box h2 { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 28px; margin: 0 0 12px; font-weight: 400; }
.tls2-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-bottom: 14px; }
.tls2-stat-grid b { display: block; font-size: 24px; font-family: var(--font-display, 'Jersey 15', sans-serif); font-weight: 400; }
.tls2-stat-grid small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 800; }
.tls2-dist { margin: 4px 0 12px; }
.tls2-dist h3 { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 800; margin: 0 0 8px; }
.tls2-dr { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.tls2-dr > span:first-child { width: 52px; color: var(--dim); }
.tls2-dr > i { display: block; height: 16px; min-width: 18px; background: #3a4560; border-radius: 4px; font-style: normal; font-size: 11px; line-height: 16px; text-align: right; padding: 0 5px; }
.tls2-dr > i.hi { background: var(--good); color: var(--ink); }
.tls2-bnote { font-size: 12px; color: var(--dim); margin: 6px 0 0; }
.tls2-modal-box button.tls2-close { width: 100%; min-height: 46px; margin-top: 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .3); background: transparent; color: var(--txt); font-weight: 800; cursor: pointer; }

.tls2-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes tlsRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tlsShake { 0%, 100% { translate: 0 0; } 20% { translate: -6px 0; } 45% { translate: 6px 0; } 70% { translate: -3px 0; } }
@keyframes tlsPop { 0% { scale: 1; } 40% { scale: 1.035; } 100% { scale: 1; } }
@media (prefers-reduced-motion: reduce) { .tls2 *, .tls2-modal * { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { .tls2-ptitle { font-size: 23px; } .tls2-brand { padding: 0 38px; font-size: 26px; } .tls2-txt { font-size: 13.5px; } .tls2-card { grid-template-columns: 40px 1fr auto; } .tls2-grip { width: 40px; } .tls2-mv button { width: 36px; } }

/* ---- live: leaderboard note ---- */
.tls2-lbnote { font-size: 12px; color: var(--dim, #9a9a9a); margin: -4px 0 10px; text-align: center; }
