
.axie-tracker-container {
    display: flex;
    width: calc(clamp(85px, 10vw, 125px));
    flex-direction: column;
    justify-content: center;
}

.axie-tracker-image {
    width: calc(clamp(85px, 10vw, 125px));
    object-fit: cover;
    height: calc(clamp(85px, 10vw, 125px));
}

.wrapped-text {
    max-width: 175px;
    overflow-wrap: break-word;
}

/* Marks a Morph Finder subscription among the marketplace-filter trackers, with the classes it watches */
.tracker-morph-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    margin-bottom: 2px;
}

.tag.tracker-kind-tag {
    font-size: 0.7rem;
    height: 1.6em;
}

.tracker-morph-class {
    width: 16px;
    height: 16px;
}

.tracker-morph-classes {
    font-size: 0.7rem;
    opacity: 0.7;
}

.tag.lvl-breed-tag {
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    padding: 0.85em 0.4em 0.85em 0.4em;
}

/* One width and one left edge for the whole page: on a wide screen the add field, the new-tracker card and
   the two lists line up instead of stretching edge to edge. */
.section-add-tracker,
.section-show-tracker {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

.section-add-tracker {
    padding-top: 2rem;
    padding-bottom: 1rem;
}

@media (max-width: 769px) {
    .section-show-tracker,
    .section-add-tracker{
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/*SWITCHER*/

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--trk-switch-off);
    transition: background-color .2s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: transform .2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--trk-accent);
}

.switch input:focus-visible + .slider {
    outline: 2px solid var(--trk-accent-ring);
    outline-offset: 2px;
}

/* While the server is asked: the switch already shows the new state, dimmed until it is confirmed */
.switch.is-busy .slider {
    opacity: 0.55;
    cursor: progress;
}

input:checked + .slider:before {
    transform: translateX(14px);
}

/*PAGINATION*/

.pagination-container {
    padding: 10px;
}


/* ════════════════════════════════════════════════════════════════════════════════════════════════
   Interaction layer. One accent — the site header's blue (--sh-cta-bg) — marks what is chosen, focused
   or switched on; everything else stays in the page's greys. The tracker → notifications filter is the
   connection this page is about, so the chosen row and the list's filter chip share that accent.
   ════════════════════════════════════════════════════════════════════════════════════════════════ */
:root,
.theme-light {
    --trk-accent: var(--sh-cta-bg);
    --trk-accent-soft: hsl(233 100% 60% / 0.08);
    --trk-accent-ring: hsl(233 100% 60% / 0.5);
    --trk-hover: hsl(220 30% 40% / 0.06);
    --trk-quiet: var(--sh-ink-quiet);
    --trk-switch-off: hsl(220 12% 78%);
}

.theme-dark {
    --trk-accent-soft: hsl(233 100% 68% / 0.14);
    --trk-accent-ring: hsl(233 100% 68% / 0.6);
    --trk-hover: hsl(220 40% 85% / 0.06);
    --trk-switch-off: hsl(223 12% 34%);
}

/* Bulma gives .textarea and .input a display of their own, which would beat the hidden attribute */
.trk [hidden] {
    display: none !important;
}

/* ── Add a tracker ── */
.trk-add__label {
    margin-bottom: 0.4rem !important;
}

.trk-add__help {
    color: var(--trk-quiet);
}

/* ── Card headers: title, then what qualifies it ── */
.trk-card__head {
    align-items: center;
    gap: 0.5rem;
    padding-right: 1rem;
}

.trk-slots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--trk-quiet);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.trk-slots__pips {
    display: inline-flex;
    gap: 3px;
}

.trk-slots__pip {
    width: 14px;
    height: 6px;
    border-radius: 3px;
    background: var(--bulma-border);
    transition: background-color 0.25s;
}

.trk-slots__pip.is-used {
    background: var(--trk-accent);
}

.trk-filter {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 60%;
    gap: 0.35rem;
    border: 0;
    cursor: pointer;
    background: var(--trk-accent-soft);
    color: var(--trk-accent);
    font-weight: 600;
}

.trk-filter:hover {
    background: var(--trk-accent);
    color: var(--sh-cta-fg);
}

.trk-filter:focus-visible {
    outline: 2px solid var(--trk-accent-ring);
    outline-offset: 2px;
}

.trk-filter__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trk-hint {
    font-size: 0.8rem;
    color: var(--trk-quiet);
    margin-bottom: 0.5rem !important;
}

/* ── Trackers table ── */
.trk-table {
    width: 100%;
    background: transparent;
}

/* .trk .content table beats Bulma's `.content table td` (top-aligned, its own padding) */
.trk .content .trk-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--trk-quiet);
    white-space: nowrap;
}

.trk .content .trk-table td {
    vertical-align: middle;
}

.trk-row {
    cursor: pointer;
    transition: background-color 0.15s, opacity 0.25s;
}

.trk-row:hover {
    background: var(--trk-hover);
}

.trk-row:focus-visible {
    outline: 2px solid var(--trk-accent-ring);
    outline-offset: -2px;
}

.trk-row.trk-row--active {
    background: var(--trk-accent-soft);
}

.trk-row.trk-row--active > td:first-child {
    box-shadow: inset 3px 0 0 var(--trk-accent);
}

.trk-row.is-editing {
    cursor: default;
    background: var(--trk-accent-soft);
}

.trk-row.is-leaving {
    opacity: 0;
}

.trk-row.is-saved {
    animation: trk-saved 1.2s ease-out;
}

@keyframes trk-saved {
    from { background-color: var(--trk-accent-soft); }
    to { background-color: transparent; }
}

.trk-row__text {
    display: block;
}

.trk-edit {
    margin-top: 4px;
}

.trk-price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.trk-price.is-any {
    font-weight: 400;
    color: var(--trk-quiet);
}

.trk-row__price .input {
    width: 7.5rem;
}

.trk-actions {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
}

/* Quiet icon buttons: grey until pointed at, so a row reads as content first */
.button.is-ghost.trk-icon {
    color: var(--trk-quiet);
    text-decoration: none;
    min-width: 2.1em;
}

.button.is-ghost.trk-icon:hover {
    color: var(--bulma-text-strong);
    background: var(--trk-hover);
    text-decoration: none;
}

.button.is-ghost.trk-icon:focus-visible {
    outline: 2px solid var(--trk-accent-ring);
    outline-offset: 1px;
    box-shadow: none;
}

.button.is-ghost.trk-delete:hover {
    color: var(--bulma-danger);
}

/* Delete asks twice: the first press turns the bin into a plain question */
.button.is-ghost.trk-delete.is-confirming {
    color: var(--bulma-danger-invert);
    background: var(--bulma-danger);
    font-weight: 600;
}

.button.is-ghost.trk-icon.is-saving {
    color: var(--trk-accent);
    pointer-events: none;
}

/* ── Email footer ── */
.trk-email {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--bulma-border-weak);
}

.trk-email__label {
    font-weight: 600;
}

.trk-email__value {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

#email-text {
    overflow-wrap: anywhere;
}

#email-text.is-empty {
    color: var(--trk-quiet);
}

#email-input {
    width: min(240px, 60vw);
}

/* ── Notifications ── */
.trk-notes {
    transition: opacity 0.2s;
}

/* While another tracker's (or page's) list loads, the old one steps back instead of freezing */
.trk-notes.htmx-request {
    opacity: 0.5;
    pointer-events: none;
}

.trk-notes.htmx-added {
    opacity: 0;
}

.trk-note {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bulma-border-weak);
}

.trk-note:last-of-type {
    border-bottom: 0;
}

.trk-note__pic {
    align-self: start;
    border-radius: 12px;
    transition: background-color 0.15s;
}

.trk-note__pic:hover {
    background: var(--trk-hover);
}

.trk-note__pic .axie-tracker-image {
    display: block;
    width: clamp(72px, 8vw, 104px);
    height: clamp(72px, 8vw, 104px);
    object-fit: contain;
}

.trk-note__body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.trk .content .trk-note p {
    margin: 0;
}

.trk-note__top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.trk-note__id {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.trk-note__when {
    font-size: 0.8rem;
    color: var(--trk-quiet);
    white-space: nowrap;
}

.trk-note__price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.trk-note__eth {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--bulma-text-strong);
}

.trk-note__usd {
    font-size: 0.9rem;
    color: var(--trk-quiet);
}

.trk-note__auction {
    font-size: 0.8rem;
    color: var(--trk-quiet);
}

.trk-note__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

.trk-note__links {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
}

/* ── New tracker: the step after a search link is pasted ──
   One card, read top to bottom as a form: a label column on the left, the choice on the right. */
.trk-new {
    margin-top: 1rem;
    transition: opacity 0.2s, transform 0.2s;
}

/* It arrives because the visitor pasted a link, so it says so by settling in */
.trk-new.htmx-added {
    opacity: 0;
    transform: translateY(6px);
}

.trk-new__count {
    font-size: 0.85rem;
    color: var(--trk-quiet);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.trk-new__body {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 1.1rem 1.5rem;
    align-items: start;
    padding: 1.25rem 1.5rem;
}

.trk-new__label {
    padding-top: 0.45rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--trk-quiet);
}

.trk-new__field {
    min-width: 0;
}

.trk-new__quiet {
    color: var(--trk-quiet);
}

.trk-new__field .help {
    margin-top: 0.35rem;
}

/* What the search watches, as one row, drawn like the marketplace's own filter chips: classes and parts in their
   class's colour (the site's palette — deep on light, bright on dark), a part's stage as gems, an excluded part
   struck through, the stats on tiles of their colour. Every chip has a × that reads the search again without it. */
.trk-watch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    --cls-beast: #a9691a;
    --cls-aquatic: #0b7f94;
    --cls-plant: #497f08;
    --cls-bird: #b74f76;
    --cls-bug: #b8452f;
    --cls-reptile: #7c4d9c;
    --cls-mech: #5f6d73;
    --cls-dawn: #7f6caa;
    --cls-dusk: #205d6b;
    --cls-none: #5f5f6d;
}

.theme-dark .trk-watch {
    --cls-beast: #f0921f;
    --cls-aquatic: #00b7d4;
    --cls-plant: #63b900;
    --cls-bird: #ff6fa5;
    --cls-bug: #ff5f42;
    --cls-reptile: #b06fe0;
    --cls-mech: #8598a0;
    --cls-dawn: #b79bf0;
    --cls-dusk: #2b9fb6;
    --cls-none: #8b8b9c;
}

.trk-watch .cls-beast { --c: var(--cls-beast); }
.trk-watch .cls-aquatic { --c: var(--cls-aquatic); }
.trk-watch .cls-plant { --c: var(--cls-plant); }
.trk-watch .cls-bird { --c: var(--cls-bird); }
.trk-watch .cls-bug { --c: var(--cls-bug); }
.trk-watch .cls-reptile { --c: var(--cls-reptile); }
.trk-watch .cls-mech { --c: var(--cls-mech); }
.trk-watch .cls-dawn { --c: var(--cls-dawn); }
.trk-watch .cls-dusk { --c: var(--cls-dusk); }
.trk-watch .cls-none { --c: var(--cls-none); }

.trk-watch .badge-collection-container {
    margin: 0;
}

.trk-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.5rem;
    padding: 0 0.25rem 0 0.4rem;
    border: 1px solid var(--bulma-border-weak);
    border-radius: 0.6rem;
    background: var(--bulma-scheme-main-bis);
    color: var(--bulma-text-strong);
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
}

/* A chip that starts with its words, not an icon */
.trk-chip > .trk-chip__name:first-child {
    margin-left: 0.4rem;
}

.trk-chip--cls,
.trk-chip--part {
    color: var(--c);
}

/* The part's own picture, on the light tile the marketplace puts it on in either theme */
.trk-chip__tile {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.45rem;
    background: #ececf1;
}

.trk-chip__tile img {
    width: 28px;
    height: 28px;
}

/* One gem for the part as hatched, two for evolved */
.trk-chip__stage {
    display: inline-flex;
    gap: 3px;
    margin-left: -0.1rem;
}

.trk-chip__stage i {
    width: 7px;
    height: 7px;
    border-radius: 1.5px;
    background: currentColor;
    transform: rotate(45deg);
}

.trk-chip--not .trk-chip__name {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

/* A stat's icon: a white glyph on a tile of the stat's colour */
.trk-chip__icon {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.4rem;
    color: #fff;
    background: #6b7280;
}

.trk-chip__icon--hp { background: #3aa76d; }
.trk-chip__icon--speed { background: #e0a100; }
.trk-chip__icon--skill { background: #8b5cf6; }
.trk-chip__icon--morale { background: #e5484d; }

.trk-chip__swatch {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--bulma-text-strong) 25%, transparent);
    background: var(--bulma-border-weak);
}

.trk-chip--badge {
    padding-left: 0.3rem;
}

/* The collection and title pills, a size up from their table use */
.trk-chip--badge .badge-collection {
    padding: 5px 11px;
    gap: 6px;
}

.trk-chip--badge .badge-icon-wrapper {
    width: 22px;
}

.trk-chip--badge .badge-number {
    font-size: 0.9rem;
}

/* A filter the tracker cannot follow: shown so the link's own filters all appear, quiet and dashed */
.trk-chip--ignored {
    border-style: dashed;
    color: var(--trk-quiet);
    background: transparent;
    font-weight: 500;
}

.trk-chip__x {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: currentColor;
    opacity: 0.7;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

.trk-chip__x:hover:not(:disabled) {
    opacity: 1;
    background: color-mix(in srgb, currentColor 14%, transparent);
}

.trk-chip__x:disabled {
    opacity: 0.35;
    cursor: progress;
}

.trk-undo {
    margin-top: 0.75rem;
}

.trk-chip__x:focus-visible {
    outline: 2px solid var(--trk-accent-ring);
    outline-offset: 1px;
}

/* The picture: tiles that are radios underneath, so arrows and Space pick one too */
.trk-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trk-pick__tile {
    position: relative;
    cursor: pointer;
}

.trk-pick__tile input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* The marketplace's picture has wide empty margins around the axie; cover crops them so it fills the tile */
.trk-pick__tile img {
    display: block;
    width: 104px;
    height: 92px;
    object-fit: cover;
    border: 1px solid var(--bulma-border-weak);
    border-radius: 12px;
    background: var(--bulma-scheme-main-bis);
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.trk-pick__tile:hover input:not(:checked) + img {
    border-color: var(--bulma-border);
    background: var(--trk-hover);
}

.trk-pick__tile input:checked + img {
    border-color: var(--trk-accent);
    box-shadow: 0 0 0 1px var(--trk-accent);
    background: var(--trk-accent-soft);
}

.trk-pick__tile input:focus-visible + img {
    outline: 2px solid var(--trk-accent-ring);
    outline-offset: 2px;
}

.trk-new__price {
    max-width: 14rem;
}

.trk-new__price .icon {
    color: var(--trk-quiet);
    font-size: 1rem;
    font-weight: 600;
}

.trk-new__name {
    max-width: 34rem;
}

.trk-new__check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.4rem;
    overflow-wrap: anywhere;
}

.trk-new__email {
    max-width: 22rem;
    margin-top: 0.5rem;
}

.trk-new__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--bulma-border-weak);
}

.button.is-ghost.trk-new__cancel {
    color: var(--trk-quiet);
    text-decoration: none;
}

.button.is-ghost.trk-new__cancel:hover {
    color: var(--bulma-text-strong);
    text-decoration: none;
}

/* The one filled button on the page: the site's blue */
.button.trk-new__submit {
    border-color: transparent;
    background: var(--trk-accent);
    color: var(--sh-cta-fg);
    font-weight: 600;
}

.button.trk-new__submit:hover {
    border-color: transparent;
    color: var(--sh-cta-fg);
    filter: brightness(1.08);
}

.button.trk-new__submit:focus-visible,
.button.is-ghost.trk-new__cancel:focus-visible {
    outline: 2px solid var(--trk-accent-ring);
    outline-offset: 2px;
    box-shadow: none;
}

.button.trk-new__submit[disabled] {
    opacity: 0.6;
    cursor: progress;
}

@media (max-width: 640px) {
    .trk-new__body {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.4rem;
        padding: 1rem;
    }

    .trk-new__label {
        padding-top: 0;
    }

    .trk-new__label:not(:first-child) {
        margin-top: 0.8rem;
    }

    .trk-new__actions {
        padding: 0.75rem 1rem;
    }

    .trk-pick__tile img {
        width: 88px;
        height: 78px;
    }
}

/* ── Empty states ── */
.trk-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    color: var(--trk-quiet);
}

.trk .content .trk-empty p {
    margin: 0 0 0.25rem;
}

.trk .content .trk-empty .trk-empty__title {
    font-weight: 600;
    color: var(--bulma-text-strong);
}

/* ── Status message: what an action just did ── */
.trk-toast {
    position: fixed;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: calc(100vw - 32px);
    padding: 0.6rem 1rem;
    border: 1px solid var(--tt-line);
    border-radius: 10px;
    background: var(--tt-surface);
    color: var(--tt-ink);
    box-shadow: var(--tt-shadow);
    font-size: 0.9rem;
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity 0.2s, transform 0.2s;
}

/* Outside .trk, so its display: flex would beat the hidden attribute and leave an invisible box catching clicks */
.trk-toast[hidden] {
    display: none;
}

.trk-toast.is-shown {
    opacity: 1;
    transform: translate(-50%, 0);
}

.trk-toast i {
    color: var(--trk-accent);
}

.trk-toast.is-error {
    border-color: var(--bulma-danger);
}

.trk-toast.is-error i {
    color: var(--bulma-danger);
}

/* ── Phone: a row stacks into two lines so the switch and the buttons stay on screen ── */
@media (max-width: 768px) {
    .trk-table thead {
        display: none;
    }

    .trk-table,
    .trk-table tbody {
        display: block;
    }

    .trk-table tr.trk-row {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "pic name   notify"
            "pic price  actions";
        align-items: center;
        column-gap: 0.75rem;
        padding: 0.5rem 0.25rem;
        border-bottom: 1px solid var(--bulma-border-weak);
    }

    .trk-table tr.trk-row:last-child {
        border-bottom: 0;
    }

    .trk .content .trk-table tr.trk-row > td {
        border: 0;
        padding: 0.1rem 0;
    }

    .trk-row.trk-row--active {
        box-shadow: inset 3px 0 0 var(--trk-accent);
    }

    .trk-row.trk-row--active > td:first-child {
        box-shadow: none;
    }

    .trk-row__pic { grid-area: pic; }
    .trk-row__name { grid-area: name; max-width: none; }
    .trk-row__price { grid-area: price; }
    .trk-row__notify { grid-area: notify; justify-self: end; }
    .trk-row__actions { grid-area: actions; }

    .trk-row .axie-tracker-container,
    .trk-row .axie-tracker-image {
        width: 72px;
        height: 72px;
    }

    .trk-email {
        padding: 0.75rem 1rem;
    }

    /* Bulma's .columns pulls 0.75rem past each side, more than this page's phone padding: the page scrolled
       sideways by a few pixels. The columns stack here anyway, so the gutters are not needed. */
    .section-show-tracker.trk {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .section-show-tracker.trk > .columns {
        margin-left: 0;
        margin-right: 0;
    }

    .section-show-tracker.trk > .columns > .column {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .trk *,
    .trk-toast {
        transition: none !important;
        animation: none !important;
    }
}
