/* Infoline Gaming Hub — employee app. Mobile-first.
   Look: Infoline blues on an ice ground, the hand-drawn doodle stickers from the
   Infoliners stories, chunky game cards, XP bars. Playful, not an HR portal. */
:root {
  --sky: #57C2E9;
  --navy: #0C447C;
  --blue: #185FA5;
  --ice: #EAF7FD;
  --grey: #97999A;
  --muted: #5B6875;   /* brand grey darkened for readable text (4.5:1+ on white and ice) */
  --ink: #222223;
  --card: #FFFFFF;
  --line: #D3E8F4;
  --soft: #F4FAFE;
  --sun: #FFC83A;
  --red: #E3262F;
  --green: #18A957;
  --ar: 'Tajawal', 'Avenir Next', Avenir, system-ui, sans-serif;
  --en: 'Avenir Next', Avenir, 'Neue Montreal', 'Nunito Sans', system-ui, sans-serif;
  --shadow: 0 14px 34px -18px rgba(12, 68, 124, .45);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html, body { overflow-x: clip; }
body { background: var(--ice); color: var(--ink); font-family: var(--ar); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; min-height: 100svh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
[hidden] { display: none !important; }
.en { font-family: var(--en); letter-spacing: .04em; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* page frame */
.app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 96px); position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 4px 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 34px; display: block; }
.brand .word { line-height: 1; color: var(--navy); padding-inline-start: 10px; border-inline-start: 2px solid var(--line); }
.brand .word span { display: block; font: 900 12px var(--en); letter-spacing: .24em; color: var(--blue); }
.topright { display: flex; align-items: center; gap: 8px; }
.langbtn { border: 2px solid var(--line); background: var(--card); color: var(--navy); border-radius: 999px; padding: 7px 12px; font: 800 13px var(--ar); min-height: 38px; }
html[lang="ar"] .langbtn { font-family: var(--en); }
.langbtn:hover { border-color: var(--sky); }
.authlang { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); inset-inline-end: 16px; z-index: 2; }
html[lang="en"] body { font-family: var(--en); }
html[lang="en"] .hero h1, html[lang="en"] .sec h2, html[lang="en"] .gbody h3, html[lang="en"] .phead h1, html[lang="en"] .auth h1 { font-family: var(--en); letter-spacing: -.01em; }
.avatarbtn { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--card); background: var(--card); box-shadow: var(--shadow); font-size: 22px; display: grid; place-items: center; text-decoration: none; }

/* stickers */
.sticker { position: absolute; mix-blend-mode: multiply; pointer-events: none; -webkit-mask-image: radial-gradient(closest-side, #000 70%, transparent 100%); mask-image: radial-gradient(closest-side, #000 70%, transparent 100%); }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 28px; padding: 22px 20px 20px; background: var(--card); box-shadow: var(--shadow); isolation: isolate; }
.hero::before { content: ''; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 200px; border-radius: 46% 54% 60% 40% / 52% 40% 60% 48%; background: var(--ice); z-index: -1; }
.hero h1 { font: 900 34px/1.1 var(--ar); margin: 0; color: var(--navy); }
.hero h1 .eyes { display: inline-block; animation: peek 3s ease-in-out infinite; }
.hero p { margin: 8px 0 0; font-size: 16px; line-height: 1.6; color: #4A5A6E; max-width: 26ch; }
.hero .s1 { width: 70px; inset-inline-end: -8px; top: -10px; transform: rotate(8deg); opacity: .95; }
.hero h1 { padding-inline-end: 52px; }
.hero .s2 { width: 64px; left: 74px; top: 6px; }
@keyframes peek { 0%, 70%, 100% { transform: translateX(0); } 78% { transform: translateX(-4px); } 88% { transform: translateX(4px); } }

/* player strip */
.player { margin-top: 16px; display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; border-radius: 20px; padding: 12px 14px; }
.player .av { width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, .14); display: grid; place-items: center; font-size: 24px; flex: none; }
.player .info { flex: 1; min-width: 0; }
.player .hi { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xpbar { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .18); overflow: hidden; margin-top: 6px; }
.xpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--sky), #9FE0F7); border-radius: 8px; transform-origin: left; transition: transform 1s cubic-bezier(.2, .8, .2, 1); }
html[dir="rtl"] .xpbar i { transform-origin: right; }
.player .lvl { font: 700 12px var(--en); opacity: .85; margin-top: 4px; display: flex; justify-content: space-between; gap: 8px; }
.player .xp { text-align: center; flex: none; }
.player .xp b { display: block; font: 900 22px var(--en); line-height: 1; color: var(--sky); }
.player .xp span { font-size: 11px; opacity: .8; font-weight: 700; }

/* section heads */
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.sec h2 { margin: 0; font: 900 22px var(--ar); color: var(--navy); }
.sec a, .sec button { font-size: 14px; font-weight: 700; color: var(--blue); background: none; border: 0; text-decoration: none; }

/* game cards */
.games { display: grid; gap: 16px; }
.gcard { position: relative; background: var(--card); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; animation: rise .45s ease both; }
.gcard:nth-child(2) { animation-delay: .06s; } .gcard:nth-child(3) { animation-delay: .12s; } .gcard:nth-child(4) { animation-delay: .18s; }
.gcard .cover { position: relative; aspect-ratio: 16 / 9; background: var(--accent, var(--blue)) center / cover no-repeat; overflow: hidden; }
.gcard .cover .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; background:
  radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .18) 0 12%, transparent 13%),
  radial-gradient(circle at 80% 70%, rgba(255, 255, 255, .12) 0 18%, transparent 19%), var(--accent, var(--sky)); }
.gcard .no { position: absolute; top: 12px; inset-inline-end: 12px; font: 900 11px var(--en); letter-spacing: .14em; color: #fff; background: rgba(12, 68, 124, .72); padding: 5px 9px; border-radius: 8px; backdrop-filter: blur(4px); }
.badge { position: absolute; top: 12px; inset-inline-start: 12px; font-weight: 800; font-size: 13px; padding: 6px 11px; border-radius: 999px; background: var(--card); color: var(--navy); box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .4); }
.badge.live { background: var(--red); color: #fff; }
.badge.soon { background: var(--sun); color: var(--ink); }
.badge.done { background: var(--green); color: #fff; }
.badge.ended { background: var(--ink); color: #fff; }
.badge.test { background: #FFF4D6; color: #8A6100; }
.gbody { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.gbody .sub { font: 800 11px var(--en); letter-spacing: .2em; color: var(--sky); }
.gbody h3 { margin: 0; font: 900 24px/1.2 var(--ar); color: var(--navy); }
.gbody p { margin: 0; color: #4A5A6E; font-size: 15px; line-height: 1.6; white-space: pre-line; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font-size: 12px; font-weight: 700; background: var(--ice); color: var(--blue); padding: 5px 10px; border-radius: 999px; }
.gfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.gmeta { font-size: 13px; color: var(--muted); font-weight: 600; }
.gmeta b { color: var(--navy); }
.cta { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 16px; padding: 13px 20px; font: 800 16px var(--ar); background: var(--blue); color: #fff; text-decoration: none; box-shadow: 0 5px 0 var(--navy); transition: transform .1s; }
.cta:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--navy); }
.cta.ghost { background: var(--ice); color: var(--navy); box-shadow: 0 5px 0 var(--line); }
.cta[aria-disabled="true"] { background: #E4E9EE; color: var(--muted); box-shadow: 0 5px 0 #CBD3DA; pointer-events: none; }
.gcard.featured { outline: 3px solid var(--sky); outline-offset: -3px; }
.gcard.featured .cover { aspect-ratio: 16 / 10; }
.myline { font-size: 13px; font-weight: 700; color: var(--green); }

/* mini leaderboard */
.mini { background: var(--card); border-radius: 22px; padding: 8px; box-shadow: var(--shadow); }
.lrow { display: grid; grid-template-columns: 34px 34px 1fr auto; align-items: center; gap: 8px; padding: 10px 10px; border-radius: 14px; }
.lrow + .lrow { border-top: 1px solid var(--ice); }
.lrow .rk { font: 900 18px var(--en); color: var(--blue); text-align: center; }
.lrow .av { font-size: 20px; text-align: center; }
.lrow .nm { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .nm small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.lrow .v { font: 900 16px var(--en); color: var(--navy); direction: ltr; }
.lrow.me { background: var(--navy); color: #fff; }
.lrow.me .rk, .lrow.me .v { color: var(--sky); }
.lrow.me .nm small { color: rgba(255, 255, 255, .7); }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; font-weight: 600; line-height: 1.7; }

/* podium */
.podium { display: grid; grid-template-columns: 1fr 1.12fr 1fr; align-items: end; gap: 8px; margin: 6px 0 14px; }
.pp { border-radius: 18px 18px 10px 10px; padding: 26px 6px 12px; text-align: center; color: #fff; position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pp.p1 { background: var(--blue); min-height: 150px; } .pp.p2 { background: var(--sky); color: var(--navy); min-height: 122px; } .pp.p3 { background: var(--navy); min-height: 104px; }
.pp .medal { position: absolute; top: -18px; font-size: 30px; }
.pp .av { font-size: 28px; }
.pp b { font-weight: 900; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp span { font: 800 13px var(--en); opacity: .9; direction: ltr; }

/* chips + controls */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 2px solid var(--line); background: var(--card); color: var(--navy); border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.row2 { display: flex; gap: 8px; align-items: center; margin: 10px 0 14px; flex-wrap: wrap; }
select.sel { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 10px; font-weight: 700; color: var(--navy); }
.mebar { position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 82px); margin-top: 12px; }

/* profile */
.phead { text-align: center; padding: 24px 16px 18px; position: relative; }
.phead .big { width: 92px; height: 92px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 46px; margin: 0 auto 10px; }
.phead h1 { margin: 0; font: 900 28px var(--ar); color: var(--navy); }
.phead .dept { color: var(--muted); font-weight: 600; margin-top: 2px; }
.xpbig { font: 900 44px var(--en); color: var(--blue); line-height: 1; margin-top: 12px; direction: ltr; }
.xpbig small { font-size: 18px; color: var(--sky); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 18px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.stat .ic { font-size: 20px; }
.stat b { display: block; font: 900 26px var(--en); color: var(--navy); line-height: 1.1; margin-top: 4px; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 700; }
.lvlcard { background: var(--card); border-radius: 18px; padding: 14px 16px; margin-top: 10px; box-shadow: var(--shadow); }
.lvlcard .xpbar { background: var(--ice); height: 10px; }
.lvlcard .t { display: flex; justify-content: space-between; font-weight: 800; color: var(--navy); font-size: 14px; }
.ach { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ab { background: var(--card); border-radius: 18px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.ab .ic { font-size: 30px; }
.ab b { display: block; font-size: 13px; font-weight: 800; color: var(--navy); margin-top: 4px; }
.ab span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.ab.locked { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.ab.locked .ic { filter: grayscale(1); opacity: .35; }
.ab.locked b { color: var(--muted); }
.mygames { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.mg { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; }
.mg + .mg { border-top: 1px solid var(--ice); }
.mg .th { width: 52px; height: 52px; border-radius: 14px; background: var(--accent, var(--sky)) center / cover; flex: none; display: grid; place-items: center; font-size: 22px; }
.mg .t { flex: 1; min-width: 0; }
.mg .t b { display: block; font-weight: 900; color: var(--navy); }
.mg .t span { font-size: 13px; color: var(--muted); font-weight: 600; }
.st { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.st.completed { background: #E3F7EC; color: #0E7A3E; }
.st.in_progress { background: #FFF4D6; color: #8A6100; }
.st.not_played { background: var(--ice); color: var(--muted); }
.settings { display: grid; gap: 10px; }
.btn2 { border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 800; background: var(--card); color: var(--navy); box-shadow: var(--shadow); text-align: start; display: flex; justify-content: space-between; align-items: center; }

/* bottom nav */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 10px); pointer-events: none; }
.tabbar nav { pointer-events: auto; max-width: 420px; margin: 0 auto; background: var(--navy); border-radius: 22px; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; box-shadow: 0 16px 34px -14px rgba(12, 68, 124, .7); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 16px; color: rgba(255, 255, 255, .7); text-decoration: none; font-size: 12px; font-weight: 800; }
.tabbar a span { font-size: 20px; line-height: 1; }
.tabbar a[aria-current="page"] { background: rgba(255, 255, 255, .14); color: #fff; }

/* auth */
.auth { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: calc(env(safe-area-inset-top, 0px) + 20px) 16px 30px; max-width: 460px; margin: 0 auto; position: relative; overflow-x: clip; }
.auth .logo { height: 54px; display: block; margin: 0 auto; }
.auth .title { text-align: center; color: var(--navy); }
.auth .title span { display: block; font: 900 15px var(--en); letter-spacing: .36em; color: var(--blue); }
.auth h1 { text-align: center; margin: 6px 0 0; font: 900 30px var(--ar); color: var(--navy); }
.panel { background: var(--card); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); position: relative; z-index: 1; }
.tabs2 { display: grid; grid-template-columns: 1fr 1fr; background: var(--ice); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.tabs2 button { border: 0; background: none; border-radius: 11px; padding: 10px; font-weight: 800; color: var(--muted); }
.tabs2 button[aria-pressed="true"] { background: var(--card); color: var(--navy); box-shadow: 0 2px 8px -4px rgba(12, 68, 124, .4); }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 800; color: var(--navy); }
.field input, .field select { width: 100%; border: 2px solid var(--line); background: var(--soft); border-radius: 14px; padding: 13px 14px; font-size: 17px; font-weight: 700; color: var(--ink); outline: none; }
.field input:focus, .field select:focus { border-color: var(--sky); background: #fff; }
.field .hint { font-size: 12px; color: var(--muted); }
.avs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.avs button { border: 2px solid transparent; background: none; border-radius: 12px; font-size: 22px; padding: 6px 0; }
.avs button[aria-pressed="true"] { border-color: var(--sky); background: var(--ice); }
.go { width: 100%; border: 0; border-radius: 16px; padding: 15px; font: 900 18px var(--ar); background: var(--blue); color: #fff; box-shadow: 0 5px 0 var(--navy); margin-top: 4px; }
.go:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--navy); }
.go:disabled { opacity: .55; }
.msg { color: var(--red); font-weight: 700; font-size: 14px; min-height: 20px; margin-top: 10px; text-align: center; line-height: 1.5; }
.ok { color: var(--green); }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(12, 30, 52, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet .inner { background: var(--card); width: 100%; max-width: 560px; border-radius: 26px 26px 0 0; padding: 20px 16px calc(env(safe-area-inset-bottom, 0px) + 20px); max-height: 88svh; overflow: auto; animation: up .3s ease; }
.sheet h3 { margin: 0 0 14px; font: 900 22px var(--ar); color: var(--navy); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.loading { text-align: center; padding: 60px 0; color: var(--muted); font-weight: 700; }

@media (min-width: 900px) {
  .app { max-width: 1040px; }
  .home-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 24px; align-items: start; }
  .games { grid-template-columns: 1fr 1fr; }
  .gcard.featured { grid-column: 1 / -1; }
  .hero h1 { font-size: 42px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
