/* MyArab — sistem reka bentuk. Satu palet, satu skala taip, satu set komponen. */
@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;700;800&family=Noto+Naskh+Arabic:wght@400;600;700&display=swap");

:root {
  --ink: #1f2a44;
  --ink-2: #4a5568;
  --ink-3: #7a8499;
  --cream: #fbf7ef;
  --paper: #ffffff;
  --mint: #eaf3ee;
  --sky: #e8f1fb;
  --teal: #12836b;
  --teal-d: #0d6a56;
  --teal-l: #d5ece4;
  --orange: #e07a1f;
  --orange-l: #fdebd8;
  --sun: #f6c445;
  --sun-l: #fdf3d3;
  --rose: #d9534f;
  --rose-l: #fbe3e2;
  --line: #e6dfd1;
  --line-2: #efe9dd;
  --r-s: 12px;
  --r-m: 18px;
  --r-l: 28px;
  --sh-1: 0 1px 2px rgba(31, 42, 68, .06), 0 2px 8px rgba(31, 42, 68, .05);
  --sh-2: 0 4px 10px rgba(31, 42, 68, .07), 0 14px 32px rgba(31, 42, 68, .08);
  --sh-press: 0 4px 0 rgba(13, 106, 86, 1);
  --f-head: "Fredoka", "Nunito", system-ui, sans-serif;
  --f-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-ar: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif;
  --max: 1160px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-body); font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--teal-d); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(34px, 5.4vw, 60px); }
h2 { font-size: clamp(28px, 3.6vw, 42px); }
h3 { font-size: 22px; }
h4 { font-size: 18px; }
p { margin: 0 0 1em; }
.ar { font-family: var(--f-ar); direction: rtl; unicode-bidi: isolate; line-height: 1.9; font-weight: 600; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.center { text-align: center; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Butang */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  font-family: var(--f-head); font-weight: 600; font-size: 17px; text-decoration: none; transition: transform .08s, box-shadow .08s, background .15s; user-select: none; }
.btn:active { transform: translateY(2px); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 4px 0 var(--teal-d); }
.btn-primary:hover { background: #149377; }
.btn-primary:active { box-shadow: 0 2px 0 var(--teal-d); }
.btn-sun { background: var(--sun); color: var(--ink); box-shadow: 0 4px 0 #d4a11f; }
.btn-sun:active { box-shadow: 0 2px 0 #d4a11f; }
.btn-ghost { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 2px var(--teal); }
.btn-danger { background: var(--rose-l); color: #9b2c28; }
.btn-lg { min-height: 58px; padding: 0 30px; font-size: 19px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn svg { width: 22px; height: 22px; flex: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--paper); box-shadow: var(--sh-1); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }

/* Kad, pil, input */
.card { background: var(--paper); border-radius: var(--r-l); box-shadow: var(--sh-1); border: 1px solid var(--line-2); padding: 24px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 13px; background: var(--sun-l); color: #8a6100; letter-spacing: .02em; }
.pill.teal { background: var(--teal-l); color: var(--teal-d); }
.pill.orange { background: var(--orange-l); color: #9a4b07; }
.pill.rose { background: var(--rose-l); color: #9b2c28; }
.pill.grey { background: #eef0f4; color: var(--ink-2); }
label.f { display: block; font-weight: 700; font-size: 15px; margin: 0 0 6px; }
.input, select.input, textarea.input { width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--r-s); border: 2px solid var(--line); background: var(--paper); font: inherit; color: var(--ink); outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--teal); }
textarea.input { min-height: 120px; resize: vertical; }
textarea.input.ar, .input.ar { font-size: 24px; text-align: right; }
.field { margin-bottom: 16px; }
.err { color: #9b2c28; background: var(--rose-l); padding: 10px 14px; border-radius: var(--r-s); font-weight: 600; font-size: 15px; }
.ok-msg { color: var(--teal-d); background: var(--teal-l); padding: 10px 14px; border-radius: var(--r-s); font-weight: 600; font-size: 15px; }

/* Bar atas */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(251, 247, 239, .92); backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--line-2); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--f-head); font-weight: 700; font-size: 24px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--teal); display: grid; place-items: center; color: #fff; font-family: var(--f-ar); font-size: 24px; line-height: 1; box-shadow: 0 3px 0 var(--teal-d); }
.brand b { color: var(--teal); font-weight: 700; }
.nav { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.nav a.link { padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 700; }
.nav a.link:hover { background: var(--line-2); color: var(--ink); }
@media (max-width: 820px) { .nav a.link { display: none; } }

/* Grid */
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* Gambar kosa kata: imej 3D, atau jubin bertulisan bila imej belum ada */
.vimg { position: relative; aspect-ratio: 1; border-radius: var(--r-m); overflow: hidden; background: linear-gradient(160deg, #fff 0%, var(--mint) 100%); display: grid; place-items: center; }
.vimg img { width: 100%; height: 100%; object-fit: cover; }
.vimg .vt { font-family: var(--f-ar); font-size: clamp(26px, 6vw, 44px); font-weight: 700; color: var(--teal-d); direction: rtl; padding: 8px; text-align: center; line-height: 1.6; }
.vimg.t1 { background: linear-gradient(160deg, #fff, #fdf3d3); } .vimg.t1 .vt { color: #9a6a00; }
.vimg.t2 { background: linear-gradient(160deg, #fff, #e8f1fb); } .vimg.t2 .vt { color: #2b5c9e; }
.vimg.t3 { background: linear-gradient(160deg, #fff, #fdebd8); } .vimg.t3 .vt { color: #a4520c; }

/* Kaki */
.foot { border-top: 1px solid var(--line-2); padding: 40px 0 60px; color: var(--ink-2); font-size: 15px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.foot a { color: var(--ink-2); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 700; z-index: 100; transition: transform .25s; max-width: calc(100vw - 32px); }
.toast.on { transform: translateX(-50%) translateY(0); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(31, 42, 68, .45); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--paper); border-radius: var(--r-l); max-width: 520px; width: 100%; padding: 28px; box-shadow: var(--sh-2); max-height: calc(100vh - 32px); overflow: auto; }

@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
