html, body, #root { margin: 0; min-height: 100%; }
body { background: var(--ds-page); }

.at-game { width: 100%; }
.at-wrap { position: relative; width: 100%; max-width: 420px; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.at-canvas { display: block; width: 100%; height: auto; border-radius: 14px; background: #0e0a1c; }
.at-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(10, 8, 20, 0.74); border-radius: 14px; text-align: center; padding: 18px; }
.at-title { font-size: 42px; font-weight: 800; color: #f5c46b; line-height: 1.1; }
.at-sub { color: #e8e2d6; font-size: 15px; line-height: 1.6; max-width: 300px; }
.at-scoreline { color: #f5c46b; font-size: 26px; font-weight: 800; }
.at-hint { color: rgba(232, 226, 214, 0.65); font-size: 12px; }
.at-bigbtn { font-size: 20px; padding: 12px 30px; border-radius: 999px; border: none; background: #f5c46b; color: #241a3d; font-weight: 800; cursor: pointer; }
.at-bigbtn:active { transform: scale(0.96); }
.at-controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 12px auto 0; max-width: 420px; }
.at-touchhint { color: var(--ds-ink-2); font-size: 13px; line-height: 1.6; text-align: center; }

.at-wrap:fullscreen { max-width: none; width: 100%; height: 100%; background: #0e0a1c; display: flex; align-items: center; justify-content: center; border-radius: 0; }
.at-wrap:fullscreen .at-canvas { width: auto; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0; }
.at-btn { position: absolute; z-index: 6; width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); background: rgba(10,8,20,0.5); color: #f5c46b; font-size: 20px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.at-fsbtn { bottom: 10px; inset-inline-end: 10px; }
.at-sndbtn { bottom: 62px; inset-inline-end: 10px; font-size: 18px; }
.at-toast { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 6; background: rgba(10,8,20,0.88); color: #e8e2d6; padding: 8px 16px; border-radius: 999px; font-size: 13px; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.at-wrap.at-fill { max-width: 100%; }
:root { --ds-page: #120b22; --ds-ink-2: #cfc6e0; }
html, body { background: #120b22; color: #e8e2d6; font-family: system-ui, -apple-system, 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif; overscroll-behavior: none; }
.pwa-card { max-width: 460px; margin: 0 auto; padding: 8px 12px 20px; }
.pwa-h { text-align: center; color: #f5c46b; margin: 6px 0 8px; font-size: 26px; }
.pwa-closing { text-align: center; color: #a79cc0; font-size: 12px; }
.at-sharebtn { background: transparent; color: #f5c46b; border: 2px solid #f5c46b; font-size: 16px; padding: 8px 22px; }

.pwa-card { padding: 0 !important; max-width: 460px; }
.pwa .at-game { padding: 0; }
.pwa .at-wrap { max-width: 460px; }
.pwa .at-wrap.at-fill { position: fixed; inset: 0; z-index: 50; width: 100%; max-width: none; height: 100dvh; display: flex; align-items: center; justify-content: center; background: #0e0a1c; border-radius: 0; }
.pwa .at-wrap.at-fill .at-canvas { width: auto; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0; }
.at-priv { color: rgba(232,226,214,.55); font-size: 11px; text-decoration: underline; }
body.pwa { margin: 0; }

/* ===== v4: English UI, characters, boards ===== */
.at-overlay { overflow-y: auto; justify-content: center; gap: 8px; padding: 14px 12px; background: rgba(10, 8, 24, 0.82); font-family: "Trebuchet MS","Arial Rounded MT Bold",system-ui,sans-serif; direction: ltr; -webkit-overflow-scrolling: touch; }
.at-overlay.at-top { justify-content: flex-start; padding-top: 14px; }
.at-title { font-size: 40px; font-weight: 900; letter-spacing: 2px; color: var(--ui, #ffd92e); text-shadow: 0 3px 0 rgba(0,0,0,.45), 0 0 18px var(--ui2, #ff4d4d); line-height: 1; }
.at-title.at-small { font-size: 26px; }
.at-tag { color: #fff; font-weight: 700; font-size: 15px; }
.at-h2 { font-size: 24px; font-weight: 900; color: var(--ui, #ffd92e); text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.at-sub { color: #e8e2d6; font-size: 14px; }
.at-bigbtn { background: linear-gradient(180deg, var(--ui, #ffd92e), var(--ui2, #ff9d2e)); color: #1b1230; font-weight: 900; font-size: 20px; letter-spacing: 1px; padding: 12px 34px; border-radius: 999px; border: none; box-shadow: 0 4px 0 rgba(0,0,0,.4); font-family: inherit; }
.at-bigbtn.at-sm { font-size: 17px; padding: 8px 28px; }
.at-bigbtn:disabled { opacity: .6; }
.at-bigbtn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.at-trio { display: flex; gap: 4px; align-items: flex-end; justify-content: center; }
.at-hero { width: auto; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); animation: at-bob 2.2s ease-in-out infinite; pointer-events: none; }
.at-face { width: auto; border-radius: 50%; background: rgba(255,255,255,.12); pointer-events: none; }
@keyframes at-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.at-label { color: #fff; font-weight: 700; font-size: 14px; margin-top: 4px; }
.at-input { width: 220px; text-align: center; font-size: 20px; font-weight: 800; padding: 10px 12px; border-radius: 14px; border: 3px solid var(--ui, #ffd92e); background: rgba(255,255,255,.95); color: #1b1230; outline: none; font-family: inherit; touch-action: manipulation; }
.at-err { color: #ff8a8a; font-weight: 700; font-size: 13px; }
.at-hint { color: rgba(232,226,214,.7); font-size: 12px; max-width: 280px; }
.at-cards { display: flex; gap: 8px; justify-content: center; width: 100%; }
.at-card { flex: 1 1 0; max-width: 108px; background: rgba(255,255,255,.08); border: 3px solid rgba(255,255,255,.18); border-radius: 18px; padding: 8px 2px 8px; color: #fff; font-family: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .15s; touch-action: manipulation; }
.at-card .at-hero { animation: none; max-width: 100%; }
.at-card.at-sel { border-color: var(--ui); background: rgba(255,255,255,.18); transform: translateY(-4px) scale(1.04); box-shadow: 0 0 18px var(--ui2); }
.at-card.at-sel .at-hero { animation: at-bob 1.6s ease-in-out infinite; }
.at-cname { font-weight: 900; font-size: 16px; color: var(--ui); }
.at-ctag { font-size: 10px; opacity: .85; }
.at-blurb { color: #fff; font-style: italic; font-size: 14px; font-weight: 700; }
.at-who { color: #fff; font-weight: 900; font-size: 20px; }
.at-who span { color: var(--ui); font-size: 15px; }
.at-stats { display: flex; gap: 14px; color: #fff; font-weight: 800; font-size: 16px; }
.at-scoreline { color: var(--ui); font-size: 44px; font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,.4); line-height: 1; }
.at-row2 { display: flex; gap: 8px; justify-content: center; }
.at-mini { position: relative; background: rgba(255,255,255,.12); color: #fff; border: 2px solid rgba(255,255,255,.28); border-radius: 999px; padding: 9px 14px; font-weight: 800; font-size: 14px; font-family: inherit; touch-action: manipulation; }
.at-dot { position: absolute; top: -7px; right: -5px; min-width: 20px; height: 20px; border-radius: 10px; background: #ff3d5a; color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; padding: 0 3px; box-sizing: border-box; }
.at-link { background: none; border: none; color: rgba(255,255,255,.75); text-decoration: underline; font-size: 14px; font-family: inherit; padding: 6px; touch-action: manipulation; }
.at-claimnow { background: #ff3d5a; color: #fff; border: none; border-radius: 999px; padding: 8px 16px; font-weight: 900; font-size: 14px; font-family: inherit; animation: at-pulse 1s infinite; }
@keyframes at-pulse { 50% { transform: scale(1.06); } }
.at-tabs { display: flex; gap: 6px; }
.at-tabs button { background: rgba(255,255,255,.1); color: #fff; border: 2px solid rgba(255,255,255,.25); border-radius: 999px; padding: 6px 16px; font-weight: 800; font-size: 13px; font-family: inherit; }
.at-tabs button.on { background: var(--ui); color: #1b1230; border-color: var(--ui); }
.at-list { width: 100%; max-width: 330px; display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; min-height: 0; overflow-y: auto; text-align: left; }
.at-row { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.09); border-radius: 12px; padding: 4px 10px; color: #fff; font-weight: 700; font-size: 15px; }
.at-row.at-me { background: rgba(255,255,255,.24); outline: 2px solid var(--ui); }
.at-rank { width: 34px; font-weight: 900; color: var(--ui); text-align: center; }
.at-rname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-rscore { font-weight: 900; color: var(--ui); }
.at-dots { text-align: center; color: #aaa; line-height: .6; }
.at-coinbar { color: #ffe14a; font-weight: 900; font-size: 20px; }
.at-daily { width: 100%; max-width: 330px; border: 2px dashed rgba(255,255,255,.3); background: rgba(255,255,255,.07); color: #ddd; border-radius: 12px; padding: 8px; font-weight: 800; font-size: 13px; font-family: inherit; }
.at-daily.ready { background: var(--ui); color: #1b1230; border: 2px solid var(--ui); animation: at-pulse 1.2s infinite; }
.at-sect { color: var(--ui); font-weight: 900; font-size: 14px; margin-top: 6px; text-transform: uppercase; letter-spacing: 1px; }
.at-ach { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.09); border-radius: 12px; padding: 6px 10px; color: #fff; }
.at-ach.done { outline: 2px solid var(--ui); }
.at-achtxt { flex: 1; display: flex; flex-direction: column; font-size: 12px; }
.at-achtxt b { font-size: 14px; }
.at-achtxt span { opacity: .75; }
.at-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); margin-top: 3px; overflow: hidden; }
.at-bar i { display: block; height: 100%; background: var(--ui); }
.at-claim { background: rgba(255,255,255,.14); color: #fff; border: 2px solid rgba(255,255,255,.3); border-radius: 999px; padding: 6px 10px; font-weight: 800; font-size: 12px; min-width: 76px; font-family: inherit; }
.at-claim:not(:disabled) { background: var(--ui); color: #1b1230; border-color: var(--ui); }
.at-claim.on { background: #2dce89; border-color: #2dce89; color: #fff; }
.at-got { color: #2dce89; font-weight: 900; font-size: 20px; min-width: 76px; text-align: center; }
.at-note { color: #ddd; font-size: 12px; line-height: 1.5; }
.at-toast2 { bottom: auto; top: 14px; background: var(--ui, #ffd92e); color: #1b1230; font-weight: 900; }
.at-privwrap { text-align: center; padding: 6px; }
.at-btn { z-index: 7; }

.at-coin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3a0, #ffd23f 55%, #c8920a); border: 1.5px solid #9a6a00; vertical-align: -2px; box-sizing: border-box; }
.at-medal { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; font-size: 14px; color: #3a2a00; box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.at-medal.m1 { background: linear-gradient(#fff3a0, #f2b705); } .at-medal.m2 { background: linear-gradient(#f4f6fa, #aab4c4); } .at-medal.m3 { background: linear-gradient(#ffd0a0, #c47a3a); }
.at-ui .at-btn { width: 38px; height: 38px; font-size: 17px; inset-inline-end: auto; left: 10px; bottom: 10px; top: auto; }
.at-ui .at-sndbtn { bottom: 10px; left: 56px; font-size: 16px; }
.at-ui .at-fsbtn { bottom: 10px; left: 10px; }

.at-cont { color: #7dffb0; }
.at-invite { background: rgba(255,255,255,.1); color: #fff; border: 2px dashed var(--ui, #ffd92e); border-radius: 999px; padding: 9px 16px; font-weight: 800; font-size: 14px; font-family: inherit; touch-action: manipulation; }
.at-pulse { animation: at-pulse 1s infinite; }
.at-sharebox { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; max-width: 300px; }
.at-msg { width: 100%; font-size: 12px; padding: 8px; border-width: 2px; text-align: left; box-sizing: border-box; }
.at-stats { flex-wrap: wrap; justify-content: center; font-size: 14px; }
.at-coin { width: 20px; height: 20px; background: #e11d2e; border: 2px solid #fff; color: #fff; font: 900 13px/16px Arial, sans-serif; text-align: center; box-shadow: 0 0 8px rgba(255,60,60,.7); }
.at-coin::after { content: '$'; }
.at-ar { letter-spacing: 0 !important; font-family: "Noto Kufi Arabic","Segoe UI","Tahoma","Noto Sans Arabic","Geeza Pro","Arial",system-ui,sans-serif; font-weight: 900; font-size: 54px; }
.at-title.at-small.at-ar { font-size: 40px; }
.at-arsm { font-family: "Noto Kufi Arabic","Segoe UI","Tahoma","Noto Sans Arabic","Geeza Pro","Arial",sans-serif; font-weight: 900; font-size: 26px; color: var(--ui, #ffd92e); letter-spacing: 0; text-shadow: 0 2px 0 rgba(0,0,0,.45); }
.at-en { font-size: 20px; font-weight: 900; letter-spacing: 6px; color: #fff; margin-top: -4px; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.at-en.at-ensm { font-size: 13px; letter-spacing: 4px; margin-top: -6px; }
.at-arsm span { font: 800 14px "Trebuchet MS", Arial, sans-serif; letter-spacing: 2px; color: #fff; }

/* ===== v10: funfair look ===== */
.at-overlay { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='26'%3E%3Cpath d='M0 2 Q60 12 120 2' stroke='%23fff' stroke-width='1.5' fill='none'/%3E%3Cpath d='M4 4 L24 6 L12 24Z' fill='%23ff4d6d'/%3E%3Cpath d='M34 7 L54 8 L44 24Z' fill='%23ffd23f'/%3E%3Cpath d='M64 8 L84 7 L74 24Z' fill='%234dd2ff'/%3E%3Cpath d='M94 6 L114 4 L104 24Z' fill='%237bed9f'/%3E%3C/svg%3E") repeat-x 0 0 / 120px 26px, linear-gradient(180deg, rgba(58,22,110,.80), rgba(150,30,100,.78)) !important; padding-top: 34px; }
.at-overlay.at-top { padding-top: 34px; }
.at-title.at-ar { display: inline-block; color: #fff6c8; background: linear-gradient(180deg, #ff3d5a, #c4122f); border: 5px dotted #fff4b0; border-radius: 18px; padding: 2px 22px 6px; box-shadow: 0 0 0 3px #7a0a20, 0 0 22px rgba(255,220,120,.9), 0 6px 0 rgba(0,0,0,.35); text-shadow: 0 3px 0 #7a0a20; animation: at-marq 1s steps(1) infinite; }
@keyframes at-marq { 0% { border-color: #fff4b0; } 50% { border-color: #ffd23f; box-shadow: 0 0 0 3px #7a0a20, 0 0 30px rgba(255,200,80,1), 0 6px 0 rgba(0,0,0,.35); } }
.at-en { background: #2a8cff; padding: 2px 16px; border-radius: 6px; border: 2px solid #fff; margin-top: 4px; box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.at-arsm { background: linear-gradient(180deg, #ff3d5a, #c4122f); padding: 0 14px 3px; border-radius: 10px; border: 3px dotted #fff4b0; color: #fff6c8; }
.at-h2 { color: #fff6c8; text-shadow: 0 3px 0 #7a0a20; }
.at-bigbtn { border: 3px solid #fff !important; background: linear-gradient(180deg, #ffe14a, #ff8a1f) !important; box-shadow: 0 5px 0 #a8430a, 0 0 14px rgba(255,220,120,.6) !important; }
.at-mini, .at-invite, .at-claim, .at-daily { border-color: #fff4b0 !important; }
.at-card { background: rgba(255,255,255,.16) !important; border-color: #fff4b0 !important; }
.at-card.at-sel { background: rgba(255,226,120,.28) !important; border-color: #ffd23f !important; }
.at-ach, .at-row { background: rgba(255,255,255,.14) !important; border: 2px solid rgba(255,244,176,.55) !important; }
.at-sect { color: #ffe14a; }

.at-home { gap: 6px; }
.at-home .at-homecards { max-width: 360px; }
.at-home .at-card { max-width: 112px; }
.at-home .at-playbig { font-size: 30px; padding: 14px 54px; margin-top: 4px; }

.at-ad { display: flex; align-items: center; justify-content: center; }
.at-ad-banner { width: 100%; max-width: 320px; min-height: 50px; margin-top: 4px; }
.at-ad-inter { width: 100%; max-width: 300px; min-height: 100px; }

/* ===== funfair icon buttons ===== */
.at-ico { flex: none; display: block; filter: drop-shadow(0 1px 0 rgba(0,0,0,.35)); }
.at-btn { display: flex; align-items: center; justify-content: center; border: 3px dotted #ffe9a0 !important; background: radial-gradient(circle at 35% 30%, #7a2a8a, #3a1457) !important; box-shadow: 0 3px 0 rgba(0,0,0,.4), 0 0 10px rgba(255,210,90,.45); padding: 0; }
.at-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.4); }
.at-pausebtn { bottom: 114px; inset-inline-end: 10px; }
.at-mini, .at-bigbtn, .at-invite, .at-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.at-mini { border: 3px solid #fff4b0 !important; background: linear-gradient(180deg, #8a3fa8, #4a1a6e) !important; box-shadow: 0 3px 0 #1d0a33, 0 0 8px rgba(255,220,120,.35); }
.at-link { color: #ffe9a0; text-decoration: none; background: rgba(0,0,0,.25); border-radius: 999px; padding: 6px 14px; }
.at-pause { z-index: 8; background: rgba(20, 8, 40, .82); }
.at-pause .at-row2 { flex-wrap: wrap; justify-content: center; }

.at-lock button, .at-lock a { pointer-events: none; opacity: .55; }
.at-lock { pointer-events: auto; }
.at-overlay.at-home { padding: 8px 0 58px; box-sizing: border-box; gap: 4px; justify-content: flex-start; overflow: hidden; }
.at-home .at-title { font-size: 30px; padding: 4px 22px; }
.at-home .at-en { font-size: 11px; padding: 2px 14px; letter-spacing: 5px; }
.at-home .at-tag { font-size: 12px; }
.at-home .at-ctag { font-size: 10px; }
.at-home .at-cname { font-size: 13px; }
.at-home .at-stats { font-size: 12px; }
.at-home .at-playbig { font-size: 26px; padding: 10px 46px; }
.at-home .at-mini { padding: 7px 12px; font-size: 13px; }
.at-home .at-invite { padding: 7px 14px; font-size: 13px; }

/* ===== v19: four heroes ===== */
.at-cards { flex-wrap: wrap; }
.at-cards .at-card { flex: 0 0 calc(50% - 8px); max-width: 150px; }
.at-home .at-homecards { max-width: 372px; flex-wrap: nowrap; gap: 5px; }
.at-home .at-homecards .at-card { flex: 1 1 0; max-width: 90px; padding: 6px 1px 6px; border-width: 2px; border-radius: 14px; }
.at-home .at-homecards .at-cname { font-size: 12px; }
.at-home .at-homecards .at-ctag { font-size: 9px; }
.at-card[style*="--ui: #ff6fae"] .at-cname, .at-card[style*="--ui:#ff6fae"] .at-cname { color: #ff6fae; }
.at-cards .at-card { padding: 5px 2px 5px; } .at-cards { gap: 6px; }
