/* Base wrappers */
.afm-wrap{max-width:1100px;margin:0 auto;padding:14px;}
.afm-card{background:#fff;border:1px solid #e9e9ef;border-radius:16px;padding:16px;box-shadow:0 10px 24px rgba(20,20,30,.04);}
.afm-muted{color:#6b7280;}
.afm-title{font-weight:900;font-size:18px;margin-bottom:6px;}
.afm-sub{color:#6b7280;margin-bottom:12px;}
.afm-ro{padding:10px 12px;background:#f7f7fb;border:1px solid #ececf4;border-radius:12px;min-height:42px;display:flex;align-items:center;}
.afm-field label{display:block;font-weight:800;margin-bottom:8px;}
.afm-req{color:#dc2626;font-weight:900;margin-left:2px;} /* ✅ v5.2.0 required asterisk */
.afm-field input,.afm-field textarea,.afm-field select{
  width:100%;border:1px solid #e7e7ef;border-radius:12px;padding:10px 12px;background:#fff;outline:none;
}
.afm-field textarea{resize:vertical;}
.afm-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
@media (max-width:800px){.afm-grid{grid-template-columns:1fr;}}

.afm-help{font-size:12px;color:#6b7280;margin-top:6px;}
.afm-msg{font-size:13px;}
.afm-msg-ok{color:#0f766e;}
.afm-msg-err{color:#b91c1c;}

/* Callouts / highlights */
.afm-callout{
  display:block;
  padding:0 14px;
  border-radius:12px;
  background:rgba(15,118,110,0.08);
  border:1px solid rgba(15,118,110,0.18);
  color:#0f172a;
}

/* Buttons */
.afm-btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 14px;border-radius:12px;border:1px solid transparent;
  font-weight:900;cursor:pointer;
  transition:filter .15s ease, transform .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
  text-decoration:none;user-select:none;
}
/* ✅ v5.2.4: unified hover — all buttons darken + lift 1px */
.afm-btn:hover:not(:disabled){
  filter:brightness(.88);
  transform:translateY(-1px);
  box-shadow:0 4px 12px rgba(0,0,0,.12);
}
.afm-btn:active:not(:disabled){
  filter:brightness(.82);
  transform:translateY(0);
  box-shadow:none;
}
.afm-btn:disabled{opacity:.55;cursor:not-allowed;}

.afm-btn-primary{background:#2563eb;color:#fff;}
.afm-btn-primary:hover{color:#fff;}

.afm-btn-ghost{background:#f3f4f6;color:#111827;border-color:#e5e7eb;}
.afm-btn-ghost:hover{color:#111827;}

.afm-btn-danger{background:#dc2626;color:#fff;}
.afm-btn-danger:hover{color:#fff;}

/* Details + Submit Rating hover font should not turn black */
.afm-open-details:hover{color:#111827;}
#afm-rate-btn:hover{color:#fff;}

/* Progress bar */
.afm-progress{width:100%;height:10px;border-radius:999px;background:#eef2ff;overflow:hidden;border:1px solid #e5e7eb;}
.afm-progress-bar{height:100%;width:0%;background:#2563eb;border-radius:999px;transition:width .12s ease;}
.afm-progress-text{font-size:12px;color:#6b7280;}

/* Market shell (remove white background only in market) */
.afm-market-shell{background:transparent;padding:0;}
.afm-market-shell .afm-wrap{padding:0;}
.afm-market-shell .afm-card{background:transparent;border:none;box-shadow:none;padding:0;}

/* Subtle glass container for the market */
.afm-market-glass{
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  padding: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.10);
}




/* Search + sort centered side-by-side */
.afm-market-tools-center{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin: 14px auto 26px auto;
  flex-wrap:nowrap; /* ✅ keep side-by-side */
}

@media (max-width:680px){
  .afm-market-tools-center{
    flex-wrap:wrap; /* ✅ allow wrap only on small screens */
  }
}

/* v5.2.2: identical height, radius, and placeholder size on both markets */
#afm-search, .afm-market-search-input{
  width:min(520px, 92vw);
  max-width:520px;
  border:1px solid #e7e7ef;
  border-radius:999px !important;
  padding:0 16px !important;
  background:#fff;
  height:44px !important;
  min-height:44px !important;
  line-height:44px;
  box-sizing:border-box !important;
  font-size:14px !important;
  color:#111827;
}
#afm-search::placeholder, .afm-market-search-input::placeholder{
  font-size:14px !important;
  color:#9ca3af;
}

#afm-sort, .afm-market-sort-select{
  height:44px;
  line-height:44px;
  width:240px; /* prevent text truncation (Newest/Top Rated etc) */
  max-width:92vw;
  border:1px solid #e7e7ef;
  border-radius:999px;
  padding:0 14px;
  padding-right:42px; /* Chrome native arrow can overlay text */
  box-sizing:border-box;
  background:#fff;
  white-space:nowrap;
}



/* Game cards — v5.2.1: 4-col, 2 rows visible, original vertical card shape */

/* Scrollable box — exactly 2 rows visible (card ~318px + 14px gap = 332px × 2) */
.afm-market-scroll-box{
  max-height:calc(2 * (318px + 14px));
  overflow-y:auto;
  overflow-x:hidden;
  padding-right:6px;
  scrollbar-width:thin;
  scrollbar-color:#d1d5db transparent;
}
.afm-market-scroll-box::-webkit-scrollbar{width:5px;}
.afm-market-scroll-box::-webkit-scrollbar-track{background:transparent;}
.afm-market-scroll-box::-webkit-scrollbar-thumb{
  background:#d1d5db;
  border-radius:999px;
}
.afm-market-scroll-box::-webkit-scrollbar-thumb:hover{background:#9ca3af;}

/* 4 columns on wide, stepping down on smaller screens */
.afm-grid-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;}
@media (max-width:1000px){.afm-grid-cards{grid-template-columns:repeat(3,1fr);}}
@media (max-width:700px){.afm-grid-cards{grid-template-columns:repeat(2,1fr);}}
@media (max-width:480px){.afm-grid-cards{grid-template-columns:1fr;}}

/* Original vertical card — image on top, body below */
.afm-card-game{
  background:#fff;
  border:1px solid #ececf4;
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 10px 24px rgba(20,20,30,.05);
  display:flex;
  flex-direction:column; /* ← restored vertical */
}
.afm-card-img{position:relative;height:170px;width:100%;background:#f3f4f6;overflow:hidden;flex:none;}
.afm-card-img img{width:100%;height:100%;object-fit:cover;display:block;}

/* Badges shortcode */
.afm-badges-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px;}
.afm-badge-tile{background:#fff;border:1px solid #ececf4;border-radius:16px;padding:12px;display:flex;flex-direction:column;align-items:center;gap:8px;}
.afm-badge-icon{width:48px;height:48px;border-radius:14px;object-fit:contain;border:1px solid #e5e7eb;background:#fff;}
.afm-badge-icon--empty{display:block;}
.afm-badge-name{font-size:13px;font-weight:600;text-align:center;color:#111827;line-height:1.2;}



/* Base badge */
.afm-badge{
  position:absolute;
  top:10px;
  left:10px;
  font-weight:900;
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  color:#fff;
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
}

/* Free */
.afm-badge-free{
  background:rgba(5,150,105,0.82);
}

/* Paid & purchased */
.afm-badge-paid{
  background:rgba(5,150,105,0.82);
}

/* Owned → blue */
.afm-badge-owned{
  background:rgba(37,99,235,0.82);
}

/* Locked paid (xx Tcoin not purchased) */
.afm-badge-locked{
  background:rgba(17,24,39,0.82);
}

/* ✅ v5.5.5: Bottom row — engine badge + platform icons */
.afm-card-bottom-row{
  position:absolute;
  bottom:8px;
  left:8px;
  right:8px;
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.afm-engine-badge{
  display:inline-flex;
  align-items:center;
  font-weight:700;
  font-size:11px;
  padding:4px 9px;
  border-radius:999px;
  color:#fff;
  letter-spacing:0.2px;
  pointer-events:none;
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
  white-space:nowrap;
}
.afm-engine-gdevelop{
  background:rgba(124,58,237,0.82);
}
.afm-engine-makecode{
  background:rgba(22,163,74,0.82);
}
/* ✅ v5.5.6: Platform row inside card body (above rating) */
.afm-card-platforms{
  display:flex;
  align-items:center;
  gap:5px;
  margin-bottom:5px;
  flex-wrap:wrap;
}
.afm-card-platforms-label{
  font-size:11px;
  font-weight:700;
  color:#6b7280;
  text-transform:uppercase;
  letter-spacing:0.4px;
  margin-right:1px;
}
.afm-plat-icon-wrap{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px;
  height:22px;
  border-radius:6px;
  background:#f3f4f6;
  border:1px solid #e5e7eb;
  color:#111827;
}
.afm-plat-svg{
  width:13px;
  height:13px;
  display:block;
  color:#111827;
}




.afm-card-body{padding:14px;}
.afm-card-title{font-weight:900;font-size:16px;line-height:1.2;}
.afm-devline{margin-top:6px;color:#374151;font-size:13px;}
.afm-card-desc{margin-top:10px;color:#4b5563;font-size:13px;line-height:1.45;}
.afm-card-meta{margin-top:10px;color:#111827;font-weight:800;}
.afm-card-actions{margin-top:12px;display:flex;gap:10px;flex-wrap:wrap;}

/* My Games list rows */
.afm-row{display:flex;gap:12px;padding:12px;border:1px solid #ececf4;border-radius:16px;margin-top:12px;background:#fff;}
.afm-thumb{width:62px;height:62px;border-radius:16px;overflow:hidden;background:#f3f4f6;border:1px solid #ececf4;}
.afm-thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.afm-thumb-ph{width:100%;height:100%;}
.afm-row-main{flex:1;}
.afm-row-title{font-weight:900;}
.afm-row-meta{margin-top:6px;color:#6b7280;font-size:13px;}
.afm-row-actions{margin-top:10px;display:flex;gap:10px;flex-wrap:wrap;align-items:center;}

/* Profile */
.afm-profile{display:grid;grid-template-columns:280px 1fr;gap:16px;align-items:start;}
@media (max-width:900px){.afm-profile{grid-template-columns:1fr;}}
.afm-profile-avatar{display:flex;flex-direction:column;gap:12px;align-items:center;}
.afm-profile-avatar img{width:170px;height:170px;border-radius:22px;object-fit:cover;border:1px solid #ececf4;background:#fff;}
.afm-profile-points{text-align:center;}
.afm-points-num{font-weight:1000;font-size:20px;}
.afm-points-label{color:#6b7280;margin-top:6px;}

/* Modal: centered, darker overlay, margin left/right for clean content */
.afm-modal{
  position:fixed;inset:0;z-index:9999;
  background:rgba(0,0,0,.70); /* ✅ darker */
  padding:18px 14px; /* ✅ margin left/right */
}
.afm-modal-inner{
  max-width:820px;margin:0 auto;
  background:#fff;border-radius:18px;border:1px solid #ececf4;
  box-shadow:0 30px 80px rgba(0,0,0,.28);
  position:relative;
  top:50%;transform:translateY(-50%); /* ✅ centered */
}
@media (max-width:900px){
  .afm-modal-inner{top:0;transform:none;margin-top:0;}
}
.afm-modal-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 16px;border-bottom:1px solid #f0f0f5;
}
.afm-modal-body{padding:16px;}
.afm-modal-title{font-weight:1000;font-size:16px;}



.afm-x{
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid #fecaca;
  background:#dc2626;
  color:#fff;
  font-weight:1000;
  font-size:18px;
  cursor:pointer;

  display:flex;              /* ✅ center perfectly */
  align-items:center;        /* ✅ vertical center */
  justify-content:center;    /* ✅ horizontal center */
  line-height:1;             /* ✅ prevent font baseline shift */
  padding:0;                 /* ✅ remove default button padding */
}
.afm-x:hover{filter:brightness(.92);}



.afm-details{padding:16px;}
.afm-details-desc{color:#374151;white-space:pre-wrap;line-height:1.55;}
.afm-rate-box{display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.afm-comments textarea{width:100%;}

/* Comments */
.afm-comments-list{display:flex;flex-direction:column;gap:10px;}
.afm-comment{border:1px solid #ececf4;border-radius:14px;padding:10px 12px;background:#fff;}
.afm-comment-head{display:flex;gap:10px;align-items:center;justify-content:space-between;}
.afm-comment-body{margin-top:6px;color:#374151;line-height:1.5;white-space:pre-wrap;}

/* prevent background scroll when modal open */
body.afm-modal-open{overflow:hidden;}


/* -------------------------------------------
 * Community UI additions
 * ------------------------------------------- */
.afm-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:18px;
  height:18px;
  padding:0 6px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  background: rgba(0,0,0,0.08);
}

.afm-glow{
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
  border-radius: 999px;
}

.afm-dot{
  width:12px;
  height:12px;
  border-radius:999px;
  border:2px solid #fff;
  display:inline-block;
}
.afm-dot-online{ background:#21c55d; }
.afm-dot-offline{ background:#9ca3af; }

/* Unread chat indicator (green dot) on Chat button */
.afm-chat-dot{
  position:absolute;
  top:6px;
  right:6px;
  width:11px;
  height:11px;
  border-width:2px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
}

.afm-chat-bubble{
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.06);
  font-size: 14px;
  line-height: 1.35;
  word-wrap: break-word;
}
.afm-chat-bubble-me{
  background: rgba(0,0,0,0.10);
}



/* ---- AFM Community UI polish ---- */
#afm-community-requests-btn{ position:relative; }
#afm-community-req-badge.afm-badge{
  position:absolute !important;
  top:-6px; right:-6px;
  min-width:18px; height:18px;
  line-height:18px;
  padding:0 6px !important;
  display:inline-flex !important;
  align-items:center; justify-content:center;
  border-radius:999px;
  font-size:12px;
}

/* Ensure modals always have comfortable margins on all sides */
.afm-modal{
  display:flex;
  align-items:center;
  justify-content:center;
}
.afm-modal-inner{
  top:auto !important;
  transform:none !important;
  margin:0 auto;
  width:100%;
  max-height:calc(100vh - 36px);
  overflow:auto;
}


/* Community UI refinements */
.afm-friend-row{border:1px solid #eef0f6;background:#fff;}
.afm-friend-actions .afm-btn{padding:8px 10px;border-radius:12px;font-weight:800;}
@media (max-width: 720px){
  .afm-friend-actions{flex-wrap:wrap;justify-content:flex-end;}
  .afm-friend-actions .afm-btn{padding:8px 10px;}
}


/* Daily Task claim button pulse */
@keyframes afmPulse {
  0%   { box-shadow: 0 0 0 0 rgba(124,58,237,0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(124,58,237,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,58,237,0); }
}


/* v5.2.4: border-radius always 12px on all states */
.afm-btn,.afm-btn:hover,.afm-btn:focus,.afm-btn:active{border-radius:12px !important;}

/* ─────────────────────────────────────────────────────────────
 * v5.3.0  In-App Mail Notification Button
 * ───────────────────────────────────────────────────────────── */

/* Pulse glow when there are unread notifications */
#afm-mail-btn.afm-mail-has-unread {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,.20);
  animation: afm-mail-pulse 2s ease-in-out infinite;
}
@keyframes afm-mail-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(37,99,235,.20); }
  50%       { box-shadow: 0 0 0 5px rgba(37,99,235,.10); }
}

/* Notification rows inside modal */
.afm-notif-row:hover { background:#f8fafc !important; }
.afm-notif-row:last-child { border-bottom: none; }
.afm-mail-wrap { display:inline-block; }

/* ─────────────────────────────────────────────────────────────
 * v5.4.0  [afm_record] shortcode — Created / Used tiles
 * Same square-border style as badge tiles.
 * ───────────────────────────────────────────────────────────── */

.afm-record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
/* Centered variant used inside profile modals */
.afm-record-grid.afm-record-grid-center {
  justify-content: center;
  grid-template-columns: repeat(2, minmax(120px, 200px));
}

.afm-record-tile {
  background: #fff;
  border: 1px solid #ececf4;
  border-radius: 16px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(20,20,30,.04);
}

.afm-record-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.3;
  text-align: center;
}

.afm-record-number {
  font-size: 40px;
  font-weight: 900;
  color: #111827;
  line-height: 1;
  letter-spacing: -1px;
}

/* =============================================================
 * v5.5.8 — Fullscreen in-page game overlay
 * ============================================================= */

/* Lock page scroll while overlay is open */
body.afm-overlay-open {
  overflow: hidden;
}

/* The full-viewport overlay container */
#afm-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  flex-direction: column;
}

/* Slim top bar: game title + close button */
#afm-game-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 44px;
  min-height: 44px;
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  gap: 12px;
}

#afm-game-overlay-title {
  font-weight: 700;
  font-size: 14px;
  color: #f9fafb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

#afm-game-overlay-close {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: #d1d5db;
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

#afm-game-overlay-close:hover {
  background: rgba(255,255,255,0.16);
  color: #fff;
}

/* The game iframe — fills all remaining height */
#afm-game-overlay-frame {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  background: #000;
}

/* Loading spinner centered over the iframe area */
#afm-game-overlay-loading {
  position: absolute;
  inset: 44px 0 0 0; /* below the bar */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  pointer-events: none;
  z-index: 1;
}

#afm-game-overlay-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.12);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: afm-spin 0.8s linear infinite;
}

@keyframes afm-spin {
  to { transform: rotate(360deg); }
}

/* Mobile: make bar slightly taller for touch targets */
@media (max-width: 600px) {
  #afm-game-overlay-bar {
    height: 48px;
    min-height: 48px;
    padding: 0 12px;
  }
  #afm-game-overlay-close {
    padding: 6px 12px;
  }
}
