/* ---------- Terms of Service — phone layout (components/terms/terms-m.php, below 1024px) ----------
 * Rail of section tiles, one swipeable card (follows the finger and tilts via --dx, set by terms-mobile.js) with an
 * "up next" tab tucked under it, the key protections card, and a bottom sheet with the full section text.
 * The sheet is moved to <body> by the script, so its rules are not scoped under .tm. White mode: terms-mobile-light.css
 */
@media (max-width: 1023px) {
    .tm {
        --tm-ease: cubic-bezier(0.22, 1, 0.36, 1);
        --tm-display: Sora, 'Noto Sans Arabic', system-ui, sans-serif;
        --tm-mono: 'JetBrains Mono', ui-monospace, monospace;
        /* z-index: above the page's fixed .global-vignette (z 1), which would darken the edges of the design */
        position: relative; z-index: 2; overflow: hidden; max-width: 560px; margin: 0 auto;
        padding: calc(var(--snav-space, 0px) + 20px + env(safe-area-inset-top, 0px)) 20px 48px; color: #fff;
    }
    .tm__glow { position: absolute; left: 50%; top: 150px; width: 560px; height: 560px; transform: translateX(-50%); pointer-events: none; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 65%); }

    /* Hero */
    .tm__crumbs { position: relative; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
    .tm__crumbs a { display: flex; align-items: center; min-height: 32px; color: rgba(255, 255, 255, 0.45); text-decoration: none; }
    .tm__crumbs i { font-size: 8px; color: rgba(255, 255, 255, 0.22); }
    .tm__crumbs span { color: rgba(255, 255, 255, 0.75); }
    .tm__meta { position: relative; display: flex; align-items: center; gap: 12px; margin-top: 22px; font-size: 12.5px; font-weight: 500; color: rgba(255, 255, 255, 0.6); }
    .tm__stack { display: flex; }
    .tm__stack > span {
        width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
        background: radial-gradient(circle at 35% 30%, #2a2a2f 0%, #0b0b0d 100%); box-shadow: 0 0 0 2px #000, inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    }
    .tm__stack > span + span { margin-inline-start: -10px; }
    .tm__stack img { width: 24px; height: 24px; object-fit: contain; pointer-events: none; }
    .tm__title { position: relative; margin: 12px 0 0; font-family: var(--tm-display); font-size: 34px; line-height: 1.06; letter-spacing: -0.05em; font-weight: 600; color: #fff; }
    .tm__title span { color: rgba(255, 255, 255, 0.42); }
    .tm__lead { position: relative; margin: 12px 0 0; max-width: 34ch; font-size: 15px; line-height: 1.6; color: rgba(255, 255, 255, 0.5); text-wrap: pretty; }

    /* Rail */
    .tm__rail {
        position: relative; display: flex; gap: 8px; margin: 22px -20px 0; padding: 6px 20px 4px; overflow-x: auto; scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 28px), transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 28px), transparent 100%);
    }
    .tm__rail::-webkit-scrollbar { display: none; }
    .tm__tile { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; width: 60px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .tm__tile:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 20px; }
    .tm__tile-ring { position: relative; width: 58px; height: 58px; padding: 1px; border-radius: 19px; background: rgba(255, 255, 255, 0.07); opacity: .55; transition: opacity .3s; }
    .tm__tile-in { width: 100%; height: 100%; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: #060607; }
    .tm__tile-in img { width: 38px; height: 38px; object-fit: contain; pointer-events: none; filter: grayscale(1) brightness(0.8); transition: transform .45s var(--tm-ease), filter .3s; }
    .tm__tile-read {
        position: absolute; top: -4px; inset-inline-end: -4px; width: 18px; height: 18px; border-radius: 50%; display: none; align-items: center; justify-content: center;
        background: #fff; color: #0a0a0a; font-size: 8px; box-shadow: 0 0 0 3px #000;
    }
    .tm__tile.is-read .tm__tile-read { display: flex; }
    .tm__tile-num { font-family: var(--tm-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; color: rgba(255, 255, 255, 0.38); }
    .tm__tile[aria-current="true"] .tm__tile-ring { opacity: 1; background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.08) 55%, rgba(255, 255, 255, 0.2) 100%); }
    .tm__tile[aria-current="true"] .tm__tile-in { background: radial-gradient(ellipse 120% 90% at 50% 0%, #2a2a2f 0%, #0e0e10 70%, #08080a 100%); }
    .tm__tile[aria-current="true"] .tm__tile-in img { filter: grayscale(0) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.75)); transform: translateY(-2px) scale(1.1); }
    .tm__tile[aria-current="true"] .tm__tile-num { color: #fff; }

    /* Deck card */
    .tm-deck { position: relative; isolation: isolate; display: flex; flex-direction: column; margin-top: 12px; }
    .tm-deck__card {
        position: relative; z-index: 2; display: flex; border-radius: 28px; padding: 1px; background: rgba(255, 255, 255, 0.1);
        touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
        transform: translateX(calc(var(--dx, 0) * 1px)) rotate(calc(var(--dx, 0) * .025deg)); transition: transform .45s var(--tm-ease);
    }
    .tm-deck__card.is-hl { background: linear-gradient(160deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.08) 45%, rgba(255, 255, 255, 0.16) 100%); }
    .tm-deck__card.is-drag { transition: none; }
    .tm-deck__card:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
    .tm-deck__panel { flex: 1; min-width: 0; border-radius: 27px; overflow: hidden; padding: 20px; background: linear-gradient(180deg, #121214 0%, #0d0d0f 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
    .tm-deck__items { display: grid; align-items: start; }
    .tm-deck__item { grid-area: 1 / 1; min-width: 0; visibility: hidden; opacity: 0; }
    .tm-deck__item.is-active { visibility: visible; opacity: 1; }
    .tm-deck__item.is-in { animation: tmIn .6s var(--tm-ease) both; }
    .tm-deck__item.is-in .tm-deck__coin img { animation: tmArt .8s var(--tm-ease) both, tmFloat 6s ease-in-out .8s infinite; }
    .tm-deck__top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
    .tm-deck__head { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; }
    .tm__pill {
        display: inline-flex; align-items: center; height: 28px; padding: 0 13px; border-radius: 999px; white-space: nowrap;
        background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
        font-family: var(--tm-display); font-size: 12.5px; font-weight: 500; letter-spacing: -0.01em; color: rgba(255, 255, 255, 0.88);
    }
    .tm-deck__num { display: flex; align-items: flex-start; gap: 6px; font-family: var(--tm-display); font-size: 56px; line-height: .8; font-weight: 300; letter-spacing: -0.06em; color: #fff; font-variant-numeric: proportional-nums; }
    .tm-deck__num span { padding-top: 4px; font-size: 14px; line-height: 1; font-weight: 500; letter-spacing: 0; color: rgba(255, 255, 255, 0.32); }
    .tm-deck__coin { position: relative; flex-shrink: 0; width: 96px; height: 96px; margin-bottom: 6px; }
    .tm-deck__coin img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.75)); animation: tmFloat 6s ease-in-out infinite; }
    .tm__floor { position: absolute; left: 50%; bottom: -10px; width: 92%; height: 12px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 70%); }
    .tm-deck__title { margin: 16px 0 0; font-family: var(--tm-display); font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.04em; color: #fff; text-wrap: balance; }
    .tm-deck__text {
        margin: 12px 0 0; font-size: 15.5px; line-height: 1.6; color: rgba(255, 255, 255, 0.48);
        display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
    }
    .tm-deck__text span { font-weight: 500; color: rgba(255, 255, 255, 0.92); }
    .tm__read {
        margin-top: 18px; width: 100%; height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 999px; cursor: pointer;
        background: linear-gradient(180deg, #ffffff 0%, #d6d6dc 100%); box-shadow: 0 8px 22px rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.14);
        color: #0a0a0a; font-family: var(--tm-display); font-size: 14px; font-weight: 600; letter-spacing: -0.01em; -webkit-tap-highlight-color: transparent; transition: scale .2s ease;
    }
    .tm__read:active { scale: .98; }
    .tm__read:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
    .tm__read i { font-size: 11px; transform: rotate(45deg); }
    html[dir="rtl"] .tm__read i { transform: rotate(-45deg); }

    /* "Up next" tab + the sliver under it */
    .tm-deck__next {
        position: relative; z-index: 1; margin: -26px 12px 0; padding: 38px 12px 12px; padding-inline-start: 16px; display: flex; align-items: center; gap: 12px;
        border-radius: 0 0 22px 22px; border: 1px solid rgba(255, 255, 255, 0.09); border-top: 0; background: linear-gradient(180deg, #0e0e10 0%, #0a0a0b 100%);
        font: inherit; color: inherit; text-align: start; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .tm-deck__next:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
    .tm-deck__next-art { flex-shrink: 0; width: 30px; height: 30px; object-fit: contain; pointer-events: none; filter: grayscale(1); opacity: .75; }
    .tm-deck__next-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
    .tm-deck__next-label { font-family: var(--tm-display); font-size: 11.5px; font-weight: 500; letter-spacing: -0.01em; color: rgba(255, 255, 255, 0.45); }
    .tm-deck__next-q { font-size: 13.5px; font-weight: 500; color: rgba(255, 255, 255, 0.82); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tm-deck__next-ico { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 11px; transition: scale .2s ease; }
    .tm-deck__next:active .tm-deck__next-ico { scale: .9; }
    .tm-deck__sliver { position: relative; z-index: 0; display: block; height: 10px; margin: 0 28px; border: 1px solid rgba(255, 255, 255, 0.05); border-top: 0; border-radius: 0 0 18px 18px; background: #070708; }

    /* Key protections */
    .tm__label { display: flex; align-items: center; gap: 10px; margin-top: 30px; font-family: var(--tm-mono); font-size: 10px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: rgba(255, 255, 255, 0.45); }
    .tm__label span { width: 18px; height: 1px; background: rgba(255, 255, 255, 0.3); }
    .tm-prot { margin-top: 14px; border-radius: 24px; padding: 1px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.05) 60%, rgba(255, 255, 255, 0.08) 100%); }
    .tm-prot__in { position: relative; overflow: hidden; border-radius: 23px; padding: 18px; padding-inline-start: 20px; background: linear-gradient(180deg, #131315 0%, #0b0b0d 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
    .tm-prot__in::before { content: ''; position: absolute; inset-inline-end: -50px; top: -60px; width: 200px; height: 200px; pointer-events: none; background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 65%); }
    .tm-prot__head { position: relative; display: flex; align-items: center; gap: 14px; }
    .tm-prot__title { flex: 1; min-width: 0; font-family: var(--tm-display); font-size: 20px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.2; color: #fff; }
    .tm-prot__coin { position: relative; flex-shrink: 0; width: 64px; height: 64px; }
    .tm-prot__coin img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.75)); }
    .tm-prot__coin .tm__floor { bottom: -6px; height: 9px; background: radial-gradient(ellipse, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0) 70%); }
    .tm-prot__text { position: relative; margin: 10px 0 0; font-size: 14.5px; line-height: 1.6; color: rgba(255, 255, 255, 0.52); text-wrap: pretty; }
    .tm-prot__pay { position: relative; display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.6); font-size: 24px; line-height: 1; }
    .tm-prot__pay .fa-bitcoin { font-size: 20px; }
    .tm-prot__pay .fa-paypal { font-size: 19px; }
    .tm__ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 8px; margin-top: 14px; font-size: 13.5px; text-align: center; }
    .tm__ask span { color: rgba(255, 255, 255, 0.5); }
    .tm__ask a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; color: #fff; text-decoration: none; }
    .tm__ask a i { font-size: 15px; }

    /* Arabic script joins its letters: no negative tracking */
    html[dir="rtl"] :is(.tm__title, .tm__pill, .tm-deck__title, .tm-deck__next-label, .tm__read, .tm__label, .tm-prot__title, .tm-sheet__count, .tm-sheet__head h2, .tm-sheet__intro, .tm-sheet__go-txt span) { letter-spacing: 0; }
    html[dir="rtl"] :is(.tm__crumbs i, .tm-sheet__prev i) { transform: scaleX(-1); }

    /* ---------- Bottom sheet ---------- */
    html.tm-lock, html.tm-lock body { overflow: hidden; }
    .tm-sheet { --tm-ease: cubic-bezier(0.22, 1, 0.36, 1); --tm-display: Sora, 'Noto Sans Arabic', system-ui, sans-serif; --tm-mono: 'JetBrains Mono', ui-monospace, monospace; position: fixed; inset: 0; z-index: 10000; color: #fff; }
    .tm-sheet[hidden] { display: none; }
    .tm-sheet__scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .4s; }
    .tm-sheet__panel {
        position: absolute; left: 0; right: 0; bottom: 0; top: calc(58px + env(safe-area-inset-top, 0px)); max-width: 560px; margin: 0 auto; display: flex; flex-direction: column;
        border-radius: 30px 30px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.12); background: linear-gradient(180deg, #141416 0%, #0a0a0b 180px);
        box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6); outline: none; transform: translateY(105%); transition: transform .55s var(--tm-ease);
    }
    .tm-sheet.is-open .tm-sheet__scrim { opacity: 1; }
    .tm-sheet.is-open .tm-sheet__panel { transform: none; }
    .tm-sheet__grip { flex-shrink: 0; display: block; width: 38px; height: 5px; margin: 10px auto 0; border-radius: 999px; background: rgba(255, 255, 255, 0.18); }
    .tm-sheet__bar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px 0 20px; padding-inline: 20px 14px; }
    .tm-sheet__count { font-family: var(--tm-mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.45); }
    .tm-sheet__count span { color: #fff; }
    .tm-sheet__close { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
    .tm-sheet__close span { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.85); font-size: 13px; }
    .tm-sheet__close:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 50%; }
    .tm-sheet__segs { flex-shrink: 0; display: flex; gap: 4px; padding: 6px 20px 0; }
    .tm-sheet__segs span { flex: 1; height: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); transition: background .4s; }
    .tm-sheet__segs span.is-read { background: rgba(255, 255, 255, 0.4); }
    .tm-sheet__segs span.is-cur { background: #fff; }
    .tm-sheet__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 22px 20px 28px; }
    .tm-sheet__body::-webkit-scrollbar { display: none; }
    .tm-sheet__sec.is-in { animation: tmIn .6s var(--tm-ease) both; }
    .tm-sheet__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
    .tm-sheet__head h2 { margin: 0; font-family: var(--tm-display); font-size: 27px; line-height: 1.15; font-weight: 600; letter-spacing: -0.045em; color: #fff; text-wrap: balance; }
    .tm-sheet__head img { flex-shrink: 0; width: 72px; height: 72px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.7)); }
    .tm-sheet__p { margin: 16px 0 0; font-size: 15.5px; line-height: 1.7; color: rgba(255, 255, 255, 0.58); text-wrap: pretty; }
    .tm-sheet__p.is-first { color: rgba(255, 255, 255, 0.86); }
    .tm-sheet__intro { margin: 22px 0 0; font-family: var(--tm-display); font-size: 14.5px; line-height: 1.4; font-weight: 600; letter-spacing: -0.01em; color: #fff; }
    .tm-sheet__list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
    .tm-sheet__list li { display: flex; gap: 12px; padding: 14px 16px 14px 14px; padding-inline: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.07); }
    .tm-sheet__list li span:first-child { flex-shrink: 0; width: 20px; padding-top: 3px; font-family: var(--tm-mono); font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.38); }
    .tm-sheet__list li span:last-child { font-size: 14.5px; line-height: 1.6; color: rgba(255, 255, 255, 0.72); text-wrap: pretty; }
    .tm-sheet__foot { flex-shrink: 0; display: flex; gap: 10px; padding: 12px 16px calc(22px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(255, 255, 255, 0.07); background: #0a0a0b; }
    .tm-sheet__prev {
        flex-shrink: 0; width: 56px; height: 56px; border-radius: 18px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04);
        display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.85); font-size: 14px; cursor: pointer; transition: opacity .3s;
    }
    .tm-sheet__prev:disabled { opacity: .3; cursor: default; }
    .tm-sheet__go {
        flex: 1; min-width: 0; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 18px; padding-inline: 18px 8px; border: 0; border-radius: 18px; cursor: pointer;
        background: linear-gradient(180deg, #ffffff 0%, #dcdce1 100%); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.14); color: #0a0a0a; text-align: start; transition: scale .2s ease;
    }
    .tm-sheet__go:active { scale: .98; }
    .tm-sheet__go-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
    .tm-sheet__go-txt span:first-child { font-size: 11px; font-weight: 600; color: rgba(0, 0, 0, 0.5); }
    .tm-sheet__go-txt span:last-child { font-family: var(--tm-display); font-size: 14px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tm-sheet__go-ico { flex-shrink: 0; width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: #0a0a0a; color: #fff; font-size: 12px; }
    .tm-sheet :is(.tm-sheet__prev, .tm-sheet__go):focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
}

@keyframes tmIn { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes tmArt { from { opacity: 0; scale: .7; rotate: -25deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes tmFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }

@media (prefers-reduced-motion: reduce) {
    .tm-deck__card, .tm-sheet__panel, .tm-sheet__scrim, .tm__tile-in img { transition: none !important; }
    .tm-deck__item.is-in, .tm-sheet__sec.is-in, .tm-deck__coin img, .tm-deck__item.is-in .tm-deck__coin img { animation: none !important; }
}
