/* ═══════════════════════════════════════════════════════
   "Where's my bitcoin?" Bitcoin Transaction Tracker ("the blend").
   On the free-tool tokens in css/tool.css; js/tx-tracker.js builds the result card.
   Motion explains what is happening (the line moving, a confirmation); under
   prefers-reduced-motion every change is instant.
   ═══════════════════════════════════════════════════════ */

.tx { --tx-amber: #e3c35a; --tx-stuck: #1a1206; --tx-green-bg: #0c1a13; --tx-green-line: #1f4d38; }
.tx .tl-wrap { max-width: 1100px; padding-top: 48px; }
.tx .tl-head h1 { font-size: 72px; }
.tx .tl-desc { max-width: 54ch; font-size: 20px; }

/* ── Input ── */
.tx-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; }
.tx-input { flex: 1 1 520px; min-width: 0; min-height: 58px; padding: 0 18px; background: var(--tl-card); border: 1px solid var(--tl-outline); border-radius: 14px; color: var(--tl-text); font-family: var(--mono); font-size: 16px; }
.tx-input::placeholder { color: #8f897f; opacity: 1; }
.tx-input:focus { border-color: var(--orange); }
.tx-input[aria-invalid="true"] { border-color: var(--tl-down); }
.tx-go { flex: none; min-height: 58px; padding: 0 26px; background: var(--orange); color: var(--tl-ink); border: 0; border-radius: 14px; font-family: var(--sans); font-size: 17px; font-weight: 700; cursor: pointer; }
.tx-go:hover { background: #ffa53d; }
.tx-input-err { margin: 10px 0 0; font-size: 15px; color: var(--tl-down); }
.tx-input-err:empty { display: none; }
.tx-privacy { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--tl-muted); }
.tx-privacy svg { flex: none; }

/* ── The lookup trace ── */
.tx-result { margin-top: 22px; }
.tx-result:empty { display: none; }
.tx-trace { padding: 30px; background: var(--tl-card); border: 1px solid var(--tl-line); border-radius: 20px; }
.tx-trace ol { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.tx-trace li { display: flex; align-items: center; gap: 12px; font-size: 17px; color: var(--tl-quiet); opacity: 0.45; transition: opacity 0.3s; }
.tx-trace li.is-done, .tx-trace li.is-failed { opacity: 1; color: var(--tl-text); }
.tx-tick { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--tl-line); color: var(--tl-ink); transition: background-color 0.3s; }
.tx-tick svg { width: 13px; height: 13px; opacity: 0; }
.is-done > .tx-tick { background: var(--tl-up); }
.is-done > .tx-tick svg { opacity: 1; }
.is-failed > .tx-tick { background: var(--tl-down); }
.tx-trace-err { margin: 16px 0 0; font-size: 16px; color: var(--tl-text); }
.tx-trace-err button { margin-left: 8px; }

/* ── Mono labels ── */
.tx-k { margin: 0; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tl-muted); }
.tx-state { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange); }
.tx-state svg { flex: none; width: 14px; height: 14px; }

/* ── The result card: warm while waiting, amber when stuck, green once in a block, neutral when not found ── */
.tx-card { position: relative; padding: 30px; background: var(--tl-warm); border: 1px solid var(--tl-answer-line); border-radius: 20px; transition: background-color 0.5s, border-color 0.5s; }
.tx-card.is-stuck { background: var(--tx-stuck); }
.tx-card.is-stuck .tx-state { color: var(--tx-amber); }
.tx-card.is-confirmed { background: var(--tx-green-bg); border-color: var(--tx-green-line); }
.tx-card.is-confirmed .tx-state { color: var(--tl-up); }
.tx-card.is-neutral { background: var(--tl-card); border-color: var(--tl-line); }
.tx-card.is-neutral .tx-state { color: var(--tl-muted); }
.tx-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 18px; }
.tx-main { flex: 1 1 520px; max-width: 660px; min-width: 0; }
.tx-h { margin: 8px 0 0; font-family: var(--serif); font-weight: 400; font-size: 46px; line-height: 1.08; color: var(--tl-text); overflow-wrap: anywhere; }
.tx-explain { margin: 12px 0 0; font-size: 18px; line-height: 1.55; color: var(--tl-quiet); }
.tx-next { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--tl-muted); }
.tx-next strong { color: var(--tl-text); }
.tx-reasons { margin: 12px 0 0; padding-left: 1.2em; font-size: 16px; line-height: 1.55; color: var(--tl-quiet); }
.tx-reasons li { margin-top: 6px; }
.tx-reasons li::marker { color: var(--orange); }
.tx-reasons a { color: var(--orange); }
.tx-eta { flex: 0 1 280px; min-width: 200px; padding: 16px 18px; border: 1px solid var(--tl-warm-line); border-radius: 14px; }
.tx-eta-v { margin: 4px 0 0; font-family: var(--serif); font-size: 34px; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--tl-text); }
.tx-eta-s { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--tl-dim); }
.tx-eta-s span { display: block; }
/* The cross-fade to green carries one pulse */
@keyframes tx-confirm { from { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.55); } to { box-shadow: 0 0 0 22px rgba(62, 207, 142, 0); } }
.tx-card.is-pulse { animation: tx-confirm 0.9s ease-out 1; }
/* The card rises in once, after the trace */
@keyframes tx-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tx-rise { animation: tx-rise 0.35s ease-out both; }

/* ── Glossary notes: a dotted word that opens a one-sentence note ── */
.tx-term { position: relative; display: inline; }
/* 44px tall to tap, without changing the line: vertical padding taken back by a negative margin */
.tx-term-btn { display: inline-block; margin: -11px 0; padding: 11px 0; background: none; border: 0; color: inherit; font: inherit; line-height: inherit; text-decoration: underline dotted var(--orange); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; }
.tx-term-btn:hover { color: var(--tl-text); }
.tx-tip { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 6; width: min(300px, 80vw); padding: 12px 14px; background: #151413; border: 1px solid var(--tl-outline); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); font-family: var(--sans); font-size: 14px; font-weight: 400; line-height: 1.5; letter-spacing: normal; text-transform: none; color: var(--tl-text); text-align: left; white-space: normal; }
.tx-tip[hidden] { display: none; }
.tx-tip a { display: inline-block; margin-top: 4px; color: var(--orange); font-weight: 600; }
.tx-tip-in { display: block; }

/* ── The 4-step progress tracker ── */
.tx-steps { display: flex; margin: 30px 0 0; padding: 0; list-style: none; }
.tx-step { display: flex; flex: 1 1 0; align-items: flex-start; min-width: 0; }
.tx-step:last-child { flex: 0 0 auto; }
.tx-step-in { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 130px; }
.tx-dot { flex: none; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 2px solid var(--tl-outline); border-radius: 50%; color: var(--tl-ink); transition: background-color 0.4s, border-color 0.4s; }
.tx-dot svg { width: 14px; height: 14px; }
.is-done .tx-dot { background: var(--tl-up); border-color: var(--tl-up); }
.is-now .tx-dot { background: var(--orange); border-color: var(--orange); }
.is-stuck .is-now .tx-dot { background: var(--tx-amber); border-color: var(--tx-amber); }
.tx .tx-step-t { display: block; font-size: 15px; font-weight: 700; line-height: 1.35; color: var(--tl-dim); }
.is-done .tx-step-t { color: var(--tl-text); }
.is-now .tx-step-t { color: var(--orange); }
.is-stuck .is-now .tx-step-t { color: var(--tx-amber); }
.tx-step-s { display: block; font-size: 13px; line-height: 1.4; color: var(--tl-dim); }
.tx-bar { flex: 1; min-width: 20px; height: 2px; margin: 12px 10px 0; background: #2a2724; transition: background-color 0.6s; }
.is-done > .tx-bar { background: var(--tl-up); }
/* The current step breathes: its ring grows and fades, every 2.2s */
@keyframes tx-breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(247, 147, 26, 0.45); } 50% { box-shadow: 0 0 0 9px rgba(247, 147, 26, 0); } }
@keyframes tx-breathe-amber { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 195, 90, 0.45); } 50% { box-shadow: 0 0 0 9px rgba(227, 195, 90, 0); } }
.is-now .tx-dot { animation: tx-breathe 2.2s ease-in-out infinite; }
.is-stuck .is-now .tx-dot { animation-name: tx-breathe-amber; }

/* ── The next blocks miners are likely to build ── */
.tx-line { margin-top: 32px; }
.tx-line-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tl-muted); }
.tx-line-h h3 { margin: 0; font: inherit; color: inherit; }
.tx-row-clip { margin-top: 4px; padding-top: 14px; overflow: hidden; }
.tx-row { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; will-change: transform; }
.tx-row.is-shift { transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1); }
.tx-block { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; min-height: 104px; padding: 14px 12px; background: var(--tl-field); border: 1px solid var(--tl-line); border-radius: 12px; }
.tx-block--last { flex-grow: 2; }
.tx-block.is-you { background: var(--tl-warm); border: 2px solid var(--orange); padding: 13px 11px; }
.tx-block-k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tl-muted); }
.tx-block-f { font-family: var(--mono); font-size: 13px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; color: var(--tl-text); }
.tx-block-u { font-size: 12px; color: var(--tl-dim); }
.tx-block-t { margin-top: auto; font-size: 13px; color: var(--tl-quiet); }
.tx-block.is-you .tx-block-t { color: var(--orange); }
.tx-you { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--orange); color: var(--tl-ink); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; white-space: nowrap; }
.tx-block .tx-you { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); }
.is-stuck .tx-you { background: var(--tx-amber); }
.tx-you-end { flex: none; display: flex; align-items: center; padding: 0 6px; }
/* Stuck: higher-fee transactions keep joining the first three blocks */
@keyframes tx-join { 0% { opacity: 0; } 20% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
.tx-join { position: absolute; top: -9px; right: 6px; padding: 1px 6px; background: var(--tx-stuck); border: 1px solid var(--tl-answer-line); border-radius: 4px; font-family: var(--mono); font-size: 10px; line-height: 1.3; color: var(--tx-amber); white-space: nowrap; opacity: 0; animation: tx-join 2.6s ease-in-out infinite; pointer-events: none; }
.tx-behind { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 15px; line-height: 1.45; color: var(--tx-amber); }
.tx-behind .tx-you { flex: none; }
.tx-row-hint { margin: 10px 0 0; font-size: 13px; color: var(--tl-dim); }
/* Where it was when you started watching, once that has changed */
.tx-history { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--tl-muted); }
.tx-history:empty { display: none; }

/* ── Confirmed: the ring of 6 ── */
.tx-ring { display: flex; gap: 20px; align-items: center; margin-top: 30px; }
.tx-ring svg { flex: none; width: 120px; height: 120px; }
.tx-ring-arc { transition: stroke-dasharray 0.8s ease-out; }
.tx-ring-t { display: block; font-size: 18px; font-weight: 700; color: var(--tl-text); }
.tx-ring-s { font-size: 15px; line-height: 1.5; color: var(--tl-muted); }

/* ── Details and the buttons beside them ── */
.tx-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; margin-top: 26px; }
.tx-details { border-top: 1px solid var(--tl-line); }
.tx-details > summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; font-weight: 700; color: var(--tl-text); list-style: none; cursor: pointer; }
.tx-details > summary::-webkit-details-marker { display: none; }
.tx-dl { margin: 0; }
.tx-dl > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid #1c1b19; font-size: 15px; }
.tx-dl dt { color: var(--tl-muted); }
.tx-dl dd { display: flex; align-items: center; gap: 8px; margin: 0; text-align: right; font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--tl-text); overflow-wrap: anywhere; }
.tx-dl dd.tx-dd-prose { font-family: var(--sans); font-weight: 600; }
.tx-copy { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -10px -10px -10px 0; padding: 0; background: none; border: 0; border-radius: 8px; color: var(--tl-muted); cursor: pointer; }
.tx-copy:hover { color: var(--orange); }
.tx-copy svg { width: 16px; height: 16px; }
.tx-actions { display: flex; flex-direction: column; gap: 10px; min-width: 200px; }
.tx-btn { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 46px; padding: 0 18px; background: transparent; border: 1px solid var(--tl-outline); border-radius: 12px; color: var(--tl-soft); font-family: var(--sans); font-size: 15px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.tx-btn:hover { border-color: var(--orange); color: var(--tl-text); }
.tx-btn--fill { background: var(--orange); border-color: var(--orange); color: var(--tl-ink); font-weight: 700; }
.tx-btn--fill:hover { background: #ffa53d; color: var(--tl-ink); }
.tx-btn--fill[aria-pressed="false"] { background: transparent; color: var(--tl-soft); font-weight: 500; }
.tx-status { min-height: 1.4em; margin: 0; font-size: 13px; line-height: 1.45; color: var(--tl-dim); }
.tx-status.is-warn { color: var(--tx-amber); }

/* ── Taking too long? ── */
.tx-help { margin-top: 22px; padding: 0 28px; background: var(--tl-card); border: 1px solid var(--tl-line); border-radius: 18px; }
.tx-help > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 10px 0; list-style: none; cursor: pointer; }
.tx-help > summary::-webkit-details-marker { display: none; }
.tx-help-t { display: block; font-family: var(--serif); font-size: 26px; line-height: 1.2; color: var(--tl-text); }
.tx-help-s { display: block; font-size: 14px; color: var(--tl-muted); }
.tx-help .tl-mark::before { font-size: 22px; }
.tx-help-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 4px 0 28px; }
.tx-help-card { padding: 18px; background: var(--tl-field); border: 1px solid var(--tl-line); border-radius: 14px; }
.tx-help-card h3 { margin: 0; font-family: var(--sans); font-size: 16px; font-weight: 700; line-height: 1.4; color: var(--tl-text); }
.tx-help-card p { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: var(--tl-quiet); }
.tx-help-card p.tx-help-note { font-size: 13px; color: var(--tl-dim); }

/* ── Address view ── */
.tx-addr-h { font-family: var(--mono); font-size: 30px; line-height: 1.3; }
.tx-addr-bal { margin: 10px 0 0; font-size: 17px; color: var(--tl-quiet); }
.tx-addr-bal strong { font-family: var(--serif); font-weight: 400; font-size: 28px; color: var(--tl-text); }
.tx-addr-list { margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--tl-line); }
.tx-addr-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 11.5rem minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--tl-line); }
.tx-addr-row .tx-chip { justify-self: start; }
.tx-addr-amt { font-size: 16px; font-weight: 700; color: var(--tl-text); }
.tx-addr-amt span { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--tl-dim); }
.tx-addr-time { font-size: 14px; color: var(--tl-muted); }
.tx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--tl-outline); border-radius: 999px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--tl-soft); white-space: nowrap; }
.tx-chip svg { width: 12px; height: 12px; }
.tx-chip--waiting { border-color: var(--tl-answer-line); color: var(--orange); }
.tx-chip--stuck { border-color: var(--tl-answer-line); color: var(--tx-amber); }
.tx-chip--confirmed { border-color: var(--tx-green-line); color: var(--tl-up); }
.tx-addr-empty { margin: 18px 0 0; font-size: 16px; line-height: 1.6; color: var(--tl-quiet); }
.tx-btn--small { min-height: 44px; padding: 0 14px; font-size: 14px; }

/* ── The toast: one line about what just changed ── */
.tx-toast { position: fixed; left: 50%; top: 20px; z-index: 30; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--tl-text); color: var(--tl-ink); font-size: 15px; font-weight: 600; line-height: 1.4; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); opacity: 0; transform: translate(-50%, -10px); pointer-events: none; transition: opacity 0.3s ease-out, transform 0.3s ease-out; }
.tx-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.tx-toast:empty { visibility: hidden; }

/* ── Every answer is one of five ── */
.tx-five { margin-top: 22px; padding: 22px 28px; background: var(--tl-card); border: 1px solid var(--tl-line); border-radius: 18px; }
.tx-five-k { margin: 0 0 12px; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tl-muted); }
.tx-five-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tx-five-list li { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--tl-line); border-radius: 999px; font-size: 13px; }
.tx-five-list strong { color: var(--tl-text); }
.tx-five-list span { color: var(--tl-dim); }

/* No animation loops while the tab is hidden */
html.tx-hidden .tx * { animation-play-state: paused !important; }

/* ── Phones ── */
@media (max-width: 760px) {
    .tx-foot { grid-template-columns: minmax(0, 1fr); }
    .tx-actions { min-width: 0; }
    .tx-help-cards { grid-template-columns: minmax(0, 1fr); }
    .tx-addr-row { grid-template-columns: minmax(0, 1fr) auto; }
    .tx-addr-time { grid-column: 1; }
}
@media (max-width: 640px) {
    .tx .tl-wrap { padding-top: 22px; }
    .tx .tl-head h1 { font-size: 46px; }
    .tx .tl-desc { font-size: 16px; }
    .tx-go { flex: 1 1 100%; }
    .tx-input { flex-basis: 100%; font-size: 14px; }
    .tx-result { margin-top: 20px; }
    .tx-card, .tx-trace { padding: 20px; border-radius: 18px; }
    .tx-h { font-size: 30px; line-height: 1.1; }
    .tx-explain { font-size: 15px; }
    .tx-eta { flex-basis: 100%; }
    /* The tracker runs down the page */
    .tx-steps { flex-direction: column; margin-top: 18px; }
    .tx-step { flex-direction: column; }
    .tx-step-in { flex-direction: row; align-items: center; gap: 12px; min-width: 0; }
    .tx .tx-step-t, .tx-step-s { display: inline; }
    .tx .tx-step-t { margin-right: 6px; }
    .tx-bar { flex: none; width: 2px; height: 22px; min-width: 0; margin: 0 0 0 12px; }
    /* The row scrolls sideways: blocks 1 to 4 and the last box */
    .tx-line { margin-top: 18px; }
    .tx-row-clip { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding-top: 14px; }
    .tx-block { flex: none; width: 108px; min-height: 0; padding: 12px 10px; }
    .tx-block.is-you { padding: 11px 9px; }
    .tx-block--last { width: 118px; }
    .tx-block.is-mid { display: none; }
    .tx-you-end { display: none; }
    .tx-ring svg { width: 90px; height: 90px; }
    .tx-help { padding: 0 18px; }
    .tx-help-t { font-size: 22px; }
    .tx-five { padding: 18px; }
    .tx-addr-h { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .tx *, .tx *::before, .tx *::after, .tx-toast { animation: none !important; transition: none !important; }
    .tx-join { opacity: 1; }
}
