المكوّنات · بطاقة بنكية تنقلب
بطاقة بنكية تنقلب
وجهان، ورقم مقنَّع يُكشف لثوانٍ ثم يعود
9 تصاميم من هذه العائلة
<div class="ap apcc"><div class="ph">
<div class="sb"><span class="tm num"></span>
<span class="r" aria-hidden="true"><span>▲</span><span>◗</span><span class="bt num"></span></span></div>
<div class="scr"><div class="body">
<div class="scene">
<div class="card3d">
<div class="face front">
<div class="top"><span class="brand">PenTool Bank</span><span class="chip"></span></div>
<div class="no num"></div>
<div class="bot"><span><i data-ar="الاسم" data-en="Name">الاسم</i>
<b data-ar="عبدالله الحربي" data-en="ABDULLAH ALHARBI">عبدالله الحربي</b></span>
<span><i data-ar="تنتهي" data-en="Expires">تنتهي</i><b class="ex num"></b></span></div>
</div>
<div class="face back">
<div class="mag"></div>
<div class="cvvrow"><span data-ar="رمز التحقّق" data-en="CVV">رمز التحقّق</span>
<b class="cvv num"></b></div>
<p data-ar="لا تشارك هذه البيانات مع أحد" data-en="Never share these details">لا تشارك هذه البيانات مع أحد</p>
</div>
</div>
</div>
<div class="acts">
<button class="fl tap" data-ar="اقلب البطاقة" data-en="Flip card">اقلب البطاقة</button>
<button class="rv tap" data-ar="أظهر الرقم" data-en="Reveal number">أظهر الرقم</button>
</div>
<div class="lg num" role="status" aria-live="polite"></div>
</div></div>
<div class="safe"></div>
</div></div>
/* pt-scoped */
/* appcard-wallet — محفظة بنكية */
.apcc{width:100%;height:100%;display:flex;align-items:center;
justify-content:center;padding:6px;font-size:10px;color:var(--pt-text-secondary);
overflow:hidden}
.apcc .ph{position:relative;width:198px;height:100%;max-height:224px;display:flex;
flex-direction:column;overflow:hidden;background:var(--pt-bg-base);
border:1px solid var(--pt-border-default);border-radius:20px;
box-shadow:var(--pt-shadow-3)}
/* شريط الحالة — ليس تزيينًا: يثبت أعلى الشاشة فلا يبدأ المحتوى عند الحافّة */
.apcc .sb{flex:none;display:flex;align-items:center;justify-content:space-between;
padding:5px 12px 2px;font-size:7px;color:var(--pt-text-muted);
font-variant-numeric:tabular-nums}
.apcc .sb .r{display:flex;gap:3px}
.apcc .scr{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.apcc .body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
-webkit-overflow-scrolling:touch}
.apcc .body::-webkit-scrollbar{width:0}
/* المنطقة الآمنة السفلية — شريط الإيماءات يأكل ما تحته */
.apcc .safe{flex:none;height:9px;display:grid;place-items:center}
.apcc .safe::after{content:'';width:52px;height:3px;border-radius:99px;
background:var(--pt-border-strong)}
.apcc h6{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.apcc p{margin:0;font-size:8px;color:var(--pt-text-muted);line-height:1.65}
.apcc .num{font-variant-numeric:tabular-nums}
.apcc button{font:inherit;cursor:pointer;
transition:background var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
color var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
transform var(--pt-motion-duration-fast) var(--pt-motion-easing-standard)}
.apcc button:focus-visible, .apcc a:focus-visible, .apcc input:focus-visible{
outline:2px solid var(--pt-focus-ring);outline-offset:-1px}
/* هدف اللمس: 44 بكسلًا على الشاشات اللمسية، ومساحة نقر ممتدّة على غيرها */
@media(pointer:coarse){.apcc .tap{min-width:44px;min-height:44px}
}
.apcc .tap{position:relative}
.apcc .tap::before{content:'';position:absolute;inset:-6px}
@media(prefers-reduced-motion:reduce){.apcc *{transition:none!important;animation:none!important}
}
.apcc .body{padding:10px 12px;display:flex;flex-direction:column;gap:8px}
.apcc .scene{perspective:600px}
.apcc .card3d{position:relative;width:100%;aspect-ratio:1.6;transform-style:preserve-3d;
transition:transform var(--pt-motion-duration-slow) var(--pt-motion-easing-emphasized)}
.apcc .card3d.flip{transform:rotateY(180deg)}
.apcc .face{position:absolute;inset:0;backface-visibility:hidden;border-radius:12px;
padding:11px;display:flex;flex-direction:column;justify-content:space-between;
box-shadow:var(--pt-shadow-4)}
.apcc .front{background:linear-gradient(135deg,#1b2a4a,#3d4f86 55%,#6b6fb0);color:#fff}
.apcc .back{background:linear-gradient(135deg,#20263c,#333a58);color:#fff;
transform:rotateY(180deg);justify-content:flex-start;gap:8px}
.apcc .top{display:flex;align-items:center;justify-content:space-between}
.apcc .brand{font-size:8.5px;font-weight:700;letter-spacing:.04em}
.apcc .chip{width:22px;height:16px;border-radius:4px;
background:linear-gradient(135deg,#e0c070,#b89040)}
.apcc .no{font-size:12px;letter-spacing:.12em;direction:ltr;text-align:start;
font-family:var(--pt-font-mono)}
.apcc .bot{display:flex;gap:14px}
.apcc .bot i{display:block;font-style:normal;font-size:6px;opacity:.72}
.apcc .bot b{font-size:8px;font-weight:600}
.apcc .mag{height:22px;margin:2px -11px 0;background:#0d1020}
.apcc .cvvrow{display:flex;align-items:center;justify-content:space-between;gap:8px;
padding:5px 8px;border-radius:6px;background:rgba(255,255,255,.9);color:#111;font-size:7.5px}
.apcc .cvv{font-family:var(--pt-font-mono);font-size:10px}
.apcc .back p{font-size:6.5px;color:rgba(255,255,255,.7);margin:0}
.apcc .acts{display:flex;gap:6px}
.apcc .acts button{flex:1;padding:7px;border-radius:9px;
border:1px solid var(--pt-border-default);background:transparent;
color:var(--pt-text-secondary);font-size:8.5px}
.apcc .acts button:hover{border-color:var(--pt-accent);color:var(--pt-accent)}
.apcc .lg{min-height:12px;font-size:7.5px;color:var(--pt-text-muted);text-align:center}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.apcc');
if (!host) return;
var snapshot = host.innerHTML;
var timers = [];
var ac = null;
/* الجسم كما كتبه المولِّد. يستقبل بدائل مظلَّلة لـ root وdocument
والمؤقّتات، فينظّف نفسه دون أن يعرف أنه قابل لإعادة التركيب. */
function run(root, document, setTimeout, setInterval) {
var ar = document.documentElement.lang !== 'en';
var n = function (v, d) { return Number(v).toLocaleString('en-US', {
minimumFractionDigits: d || 0, maximumFractionDigits: d || 0 }); };
var money = function (usd, d) {
return ar ? n(usd * 3.75, d) + ' ر.س' : '$' + n(usd, d);
};
var set = function (sel, txt) {
var el = root.querySelector(sel); if (el) el.textContent = txt; return el;
};
/* الساعة بأرقام لاتينية دائمًا — قرار موحّد في المشروع كلّه */
(function clock() {
var t = root.querySelector('.tm');
if (!t) return;
function tick() {
var d = new Date();
t.textContent = String(d.getHours()).padStart(2, '0') + ':' +
String(d.getMinutes()).padStart(2, '0');
setTimeout(tick, 20000);
}
tick();
})();
var bt = root.querySelector('.bt');
if (bt) bt.textContent = '84%';
/* اهتزاز خفيف حيث يوجد — تأكيد لمسيّ لا يعتمد عليه شيء */
var buzz = function (ms) { try { if (navigator.vibrate) navigator.vibrate(ms || 8); } catch (e) {} };
var FULL = '4921 7734 0058 2461', MASK = '•••• •••• •••• 2461';
var no = root.querySelector('.no'), lg = root.querySelector('.lg');
set('.ex', '09/29'); set('.cvv', '•••');
no.textContent = MASK;
root.querySelector('.fl').addEventListener('click', function () {
var c = root.querySelector('.card3d');
c.classList.toggle('flip');
var back = c.classList.contains('flip');
root.querySelector('.cvv').textContent = back ? '418' : '•••';
buzz();
});
/* إعادة التقنيع بمؤقّت: طلب المستخدم أن يقرأه مرّة، لا أن يبقى مكشوفًا
لمن يمسك الجهاز بعده. */
var t = null;
root.querySelector('.rv').addEventListener('click', function () {
clearTimeout(t);
no.textContent = FULL;
var left = 6;
(function tick() {
lg.textContent = ar ? 'يُخفى بعد ' + left + ' ثوانٍ' : 'Hides in ' + left + 's';
if (--left < 0) { no.textContent = MASK; lg.textContent = ''; return; }
t = setTimeout(tick, 1000);
})();
});
}
function mount() {
ac = new AbortController();
var real = window.document;
/* وسيط يمرّر كل شيء إلى المستند الحقيقي، ويعلّق كل مستمع بإشارة
تُقطع عند إعادة التركيب — فلا يبقى مستمع من نسخة ماتت. */
var doc = new Proxy(real, {
get: function (t, k) {
if (k === 'addEventListener') {
return function (type, fn, opts) {
var o = (opts && typeof opts === 'object') ? Object.assign({}, opts)
: { capture: !!opts };
o.signal = ac.signal;
return t.addEventListener(type, fn, o);
};
}
var v = t[k];
return typeof v === 'function' ? v.bind(t) : v;
}
});
function track(fn) {
return function (f, ms) { var id = fn(f, ms); timers.push(id); return id; };
}
run(host, doc, track(window.setTimeout.bind(window)),
track(window.setInterval.bind(window)));
}
function unmount() {
if (ac) ac.abort();
// المعرّفان يتشاركان فضاءً واحدًا في المتصفّح، فالإلغاء المزدوج آمن
timers.forEach(function (id) { window.clearTimeout(id); window.clearInterval(id); });
timers = [];
host.innerHTML = snapshot;
}
mount();
addEventListener('pt-lang', function () { unmount(); mount(); });
})();
# Flipping Bank Card
**Role:** You are an Arabic-first UI designer and front-end engineer. Read the whole
specification before writing a single line, then follow it literally. If two requirements
conflict, favour usability over visual effect.
**Goal:** Flipping Bank Card — Two faces, with a masked number revealed briefly then re-hidden
**Why this component matters:** Re-mask the card number on a timer rather than leaving it exposed: the user asked to read it once, not to leave it visible for whoever picks up the phone next.
**Direction:** Genuine RTL — not a mirrored Latin layout. Use logical properties
(`margin-inline-start`, `padding-inline`, `inset-inline-start`, `text-align: start`),
never physical ones (`margin-left`, `left`). The layout must flip with `dir` on its own,
with no duplicated rules.
**Typography:** Cairo for Arabic, IBM Plex Sans for Latin. Arabic line-height must be
`0.18` higher than the Latin equivalent — dots, hamzas and maddas need more vertical room.
Arabic font-size runs `1.06×` the Latin size at the same optical weight.
**Numerals:** Western digits in both languages (`1,234.50`). Only the currency changes:
`ر.س` **after** the number in Arabic, `$` **before** it in English. Jordanian dinar
uses **three** decimal places, not two.
**Colors:** Dark mode — background `#0D142B` · surfaces `#211F54` · borders `#545C91` · text `#918FC2`.
Accent `#ADA9E8` must never exceed 8% of the screen area.
**Language:** Bilingual — every string carries both Arabic and English, and the layout
flips with `dir` automatically.
**States:** `default` · `hover` · `focus` · `active` · `disabled` · `loading` · `error`.
Do not design the resting state alone.
**Accessibility:** Contrast ratio at least `4.5:1`, complete keyboard navigation,
visible focus rings, and honour `prefers-reduced-motion`.
**Output:** Clean HTML and CSS in two separate files. No frameworks, no libraries,
no external dependencies.